From e3b0c7f3a5d7fbbfb5f21b3000c696f07d23c17f Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 13 Apr 2018 12:43:40 -0300 Subject: [PATCH 1/4] fix test --- test/client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/client.js b/test/client.js index 14b31567..5f4b63fa 100644 --- a/test/client.js +++ b/test/client.js @@ -1171,6 +1171,7 @@ describe('client API', function() { }); }); }); + it('should create Bitcoin Cash wallet', function(done) { clients[0].seedFromRandomWithMnemonic({ coin: 'bch' @@ -1453,7 +1454,7 @@ describe('client API', function() { }); }); - it('should store walletPrivKey', function(done) { + it.only('should store walletPrivKey', function(done) { clients[0].createWallet('mywallet', 'creator', 1, 1, { network: 'testnet' }, function(err) { @@ -1467,7 +1468,7 @@ describe('client API', function() { status.wallet.publicKeyRing.length.should.equal(1); status.wallet.status.should.equal('complete'); var key2 = status.customData.walletPrivKey; - key2.should.be.equal(key2); + clients[0].credentials.walletPrivKey.should.be.equal(key2); done(); }); }); From 5dab59bb06387098950a8a4053998b4383cda98d Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 13 Apr 2018 14:50:05 -0300 Subject: [PATCH 2/4] bump; --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b2d68c15..f6a10c61 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "bitcore-wallet-client", "description": "Client for bitcore-wallet-service", "author": "BitPay Inc", - "version": "6.7.2", + "version": "6.7.3", "license": "MIT", "keywords": [ "bitcoin", From e9289c0b54f789c726ce07c989193cb66133d9cf Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 13 Apr 2018 14:50:32 -0300 Subject: [PATCH 3/4] Hide encrypted json is no decrypting key is present --- lib/api.js | 7 +++---- lib/common/utils.js | 19 ++++++++++++++++--- lib/credentials.js | 2 +- test/client.js | 29 +++++++++++++++++++++++++++-- test/utils.js | 24 ++++++++++++++++++++++++ 5 files changed, 71 insertions(+), 10 deletions(-) diff --git a/lib/api.js b/lib/api.js index 921d9a40..f7a77f8a 100644 --- a/lib/api.js +++ b/lib/api.js @@ -1493,13 +1493,13 @@ API.prototype._processWallet = function(wallet) { var encryptingKey = self.credentials.sharedEncryptingKey; - var name = Utils.decryptMessage(wallet.name, encryptingKey); + var name = Utils.decryptMessageNoThrow(wallet.name, encryptingKey); if (name != wallet.name) { wallet.encryptedName = wallet.name; } wallet.name = name; _.each(wallet.copayers, function(copayer) { - var name = Utils.decryptMessage(copayer.name, encryptingKey); + var name = Utils.decryptMessageNoThrow(copayer.name, encryptingKey); if (name != copayer.name) { copayer.encryptedName = copayer.name; } @@ -1507,7 +1507,7 @@ API.prototype._processWallet = function(wallet) { _.each(copayer.requestPubKeys, function(access) { if (!access.name) return; - var name = Utils.decryptMessage(access.name, encryptingKey); + var name = Utils.decryptMessageNoThrow(access.name, encryptingKey); if (name != access.name) { access.encryptedName = access.name; } @@ -1747,7 +1747,6 @@ API.prototype.createTxProposal = function(opts, cb) { if (err) return cb(err); self._processTxps(txp); - if (!Verifier.checkProposalCreation(args, txp, self.credentials.sharedEncryptingKey)) { return cb(new Errors.SERVER_COMPROMISED); } diff --git a/lib/common/utils.js b/lib/common/utils.js index d0ae9011..b275a70e 100644 --- a/lib/common/utils.js +++ b/lib/common/utils.js @@ -30,15 +30,28 @@ Utils.encryptMessage = function(message, encryptingKey) { }, Utils.SJCL)); }; +// Will throw if it can't decrypt Utils.decryptMessage = function(cyphertextJson, encryptingKey) { + if (!cyphertextJson) return; + + if (!encryptingKey) + throw 'No key'; + + var key = sjcl.codec.base64.toBits(encryptingKey); + return sjcl.decrypt(key, cyphertextJson); +}; + + +Utils.decryptMessageNoThrow = function(cyphertextJson, encryptingKey) { try { - var key = sjcl.codec.base64.toBits(encryptingKey); - return sjcl.decrypt(key, cyphertextJson); - } catch (ex) { + return Utils.decryptMessage(cyphertextJson, encryptingKey); + } catch (e) { return cyphertextJson; } }; + + /* TODO: It would be nice to be compatible with bitcoind signmessage. How * the hash is calculated there? */ Utils.hashMessage = function(text) { diff --git a/lib/credentials.js b/lib/credentials.js index 90ea617c..7b3e11e8 100644 --- a/lib/credentials.js +++ b/lib/credentials.js @@ -313,7 +313,7 @@ Credentials.prototype.getDerivedXPrivKey = function(password) { return deriveFn(path); }; -Credentials.prototype.addWalletPrivateKey = function(walletPrivKey) { +Credent.prototype.addWalletPrivateKey = function(walletPrivKey) { this.walletPrivKey = walletPrivKey; this.sharedEncryptingKey = Utils.privateKeyToAESKey(walletPrivKey); }; diff --git a/test/client.js b/test/client.js index 5f4b63fa..07c25ee2 100644 --- a/test/client.js +++ b/test/client.js @@ -1454,7 +1454,7 @@ describe('client API', function() { }); }); - it.only('should store walletPrivKey', function(done) { + it('should store walletPrivKey', function(done) { clients[0].createWallet('mywallet', 'creator', 1, 1, { network: 'testnet' }, function(err) { @@ -1468,6 +1468,7 @@ describe('client API', function() { status.wallet.publicKeyRing.length.should.equal(1); status.wallet.status.should.equal('complete'); var key2 = status.customData.walletPrivKey; + clients[0].credentials.walletPrivKey.should.be.equal(key2); done(); }); @@ -2360,7 +2361,7 @@ describe('client API', function() { }); }); }); - it('Should fail to create proposal with insufficient funds for fee', function(done) { + it('Should fail to create proposal with insufficient funds for fee', function(done) { var opts = { amount: 5e8 - 200e2, toAddress: 'n2TBMPzPECGUfcT2EByiTJ12TPZkhN2mN5', @@ -2450,6 +2451,30 @@ describe('client API', function() { }); }); }); + it('Should hide message and refusal texts if not key is present', function(done) { + var opts = { + amount: 1e8, + toAddress: 'n2TBMPzPECGUfcT2EByiTJ12TPZkhN2mN5', + message: 'some message', + }; + helpers.createAndPublishTxProposal(clients[0], opts, function(err, x) { + should.not.exist(err); + clients[1].rejectTxProposal(x, 'rejection comment', function(err, tx1) { + should.not.exist(err); + + clients[2].credentials.sharedEncryptingKey=null; + + clients[2].getTxProposals({}, function(err, txs) { + should.not.exist(err); + txs[0].message.should.equal(''); + txs[0].actions[0].copayerName.should.equal(''); + txs[0].actions[0].comment.should.equal(''); + done(); + }); + }); + }); + }); + it('Should encrypt proposal message', function(done) { var opts = { outputs: [{ diff --git a/test/utils.js b/test/utils.js index 88d841c7..f2dee64c 100644 --- a/test/utils.js +++ b/test/utils.js @@ -189,6 +189,30 @@ describe('Utils', function() { }); }); + + describe('#decryptMessage should throw', function() { + it('should encrypt and decrypt', function() { + var pwd = "ezDRS2NRchMJLf1IWtjL5A=="; + var ct = Utils.encryptMessage('hello world', pwd); + (function(){ + Utils.decryptMessage(ct, 'test') + }).should.throw('invalid aes key size'); + }); + }); + + describe('#decryptMessageNoThrow should not throw', function() { + it('should encrypt and decrypt', function() { + var pwd = "ezDRS2NRchMJLf1IWtjL5A=="; + var ct = Utils.encryptMessage('hello world', pwd); + var msg = Utils.decryptMessageNoThrow(ct, 'test'); + // returns encrypted json + should.exist(JSON.parse(msg).iv); + should.exist(JSON.parse(msg).ct); + }); + }); + + + describe('#getProposalHash', function() { it('should compute hash for old style proposals', function() { var hash = Utils.getProposalHash('msj42CCGruhRsFrGATiUuh25dtxYtnpbTx', 1234, 'the message'); From 4c9e00c462c83e8973d6aeaa1a41bfc80c9dd6b5 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 13 Apr 2018 14:54:08 -0300 Subject: [PATCH 4/4] update bundles --- bitcore-wallet-client.min.js | 14 +++++++------- lib/credentials.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bitcore-wallet-client.min.js b/bitcore-wallet-client.min.js index 70ef34c6..c5ab7bff 100644 --- a/bitcore-wallet-client.min.js +++ b/bitcore-wallet-client.min.js @@ -1,9 +1,9 @@ -!function(){function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0&&(c.lastNotificationId=e.last(d).id),e.each(d,function(a){c.emit("notification",a)}),b())})},d.prototype._initNotifications=function(a){var b=this;a=a||{};var c=a.notificationIntervalSeconds||5;b.notificationsIntervalId=setInterval(function(){b._fetchLatestNotifications(c,function(a){a&&(a instanceof x.NOT_FOUND||a instanceof x.NOT_AUTHORIZED)&&b._disposeNotifications()})},1e3*c)},d.prototype._disposeNotifications=function(){var a=this;a.notificationsIntervalId&&(clearInterval(a.notificationsIntervalId),a.notificationsIntervalId=null)},d.prototype.setNotificationsInterval=function(a){var b=this;b._disposeNotifications(),a>0&&b._initNotifications({notificationIntervalSeconds:a})},d._encryptMessage=function(a,b){return a?r.encryptMessage(a,b):null},d._decryptMessage=function(a,b){if(!a)return"";try{return r.decryptMessage(a,b)}catch(c){return""}},d.prototype._processTxNotes=function(a){var b=this;if(a){var c=b.credentials.sharedEncryptingKey;e.each([].concat(a),function(a){a.encryptedBody=a.body,a.body=d._decryptMessage(a.body,c),a.encryptedEditedByName=a.editedByName,a.editedByName=d._decryptMessage(a.editedByName,c)})}},d.prototype._processTxps=function(a){var b=this;if(a){var c=b.credentials.sharedEncryptingKey;e.each([].concat(a),function(a){a.encryptedMessage=a.message,a.message=d._decryptMessage(a.message,c)||null,a.creatorName=d._decryptMessage(a.creatorName,c),e.each(a.actions,function(a){a.copayerName=d._decryptMessage(a.copayerName,c),a.comment=d._decryptMessage(a.comment,c)}),e.each(a.outputs,function(a){a.encryptedMessage=a.message,a.message=d._decryptMessage(a.message,c)||null}),a.hasUnconfirmedInputs=e.some(a.inputs,function(a){return 0==a.confirmations}),b._processTxNotes(a.note)})}},d._parseError=function(a){if(a){if(e.isString(a))try{a=JSON.parse(a)}catch(b){a={error:a}}var c;return a.code?x[a.code]?(c=new x[a.code],a.message&&(c.message=a.message)):c=new Error(a.code+": "+a.message):c=new Error(a.error||JSON.stringify(a)),t.error(c),c}},d._signRequest=function(a,b,c,d){var e=[a.toLowerCase(),b,JSON.stringify(c)].join("|");return r.signMessage(e,d)},d.prototype.seedFromRandom=function(a){f.checkArgument(arguments.length<=1,"DEPRECATED: only 1 argument accepted."),f.checkArgument(e.isUndefined(a)||e.isObject(a),"DEPRECATED: argument should be an options object."),a=a||{},this.credentials=u.create(a.coin||"btc",a.network||"livenet")};var z;d.prototype.validateKeyDerivation=function(a,b){function c(a,b){var c="m/0/0",d="Lorem ipsum dolor sit amet, ne amet urbanitas percipitur vim, libris disputando his ne, et facer suavitate qui. Ei quidam laoreet sea. Cu pro dico aliquip gubergren, in mundi postea usu. Ad labitur posidonium interesset duo, est et doctus molestie adipiscing.",e=a.deriveChild(c).privateKey,f=r.signMessage(d,e),g=b.deriveChild(c).publicKey;return r.verifyMessage(d,f,g)}function d(){var a="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",b=l(a).toHDPrivateKey();if("xprv9s21ZrQH143K3GJpoapnV8SFfukcVBSfeCficPSGfubmSFDxo1kuHnLisriDvSnRRuL2Qrg5ggqHKNVpxR86QEC8w35uxmGoggxtQTPvfUu"!=b.toString())return!1;if(b=b.deriveChild("m/44'/0'/0'"),"xprv9xpXFhFpqdQK3TmytPBqXtGSwS3DLjojFhTGht8gwAAii8py5X6pxeBnQ6ehJiyJ6nDjWGJfZ95WxByFXVkDxHXrqu53WCRGypk2ttuqncb"!=b.toString())return!1;var d=j.HDPublicKey.fromString("xpub6BosfCnifzxcFwrSzQiqu2DBVTshkCXacvNsWGYJVVhhawA7d4R5WSWGFNbi8Aw6ZRc1brxMyWMzG3DSSSSoekkudhUd9yLb6qx39T9nMdj");return c(b,d)}function e(){var b;try{b=g.getMnemonic()}catch(d){}var e;if(b&&(!g.mnemonicHasPassphrase||a.passphrase)){var f=new l(b);e=f.toHDPrivateKey(a.passphrase,g.network)}e||(e=new j.HDPrivateKey(g.xPrivKey)),e=e.deriveChild(g.getBaseAddressDerivationPath());var h=new j.HDPublicKey(g.xPubKey);return c(e,h)}var f=this;a=a||{};var g=f.credentials,h=!0;z||a.skipDeviceValidation||(h=d(),z=!0);var i=g.canSign()&&!g.isPrivKeyEncrypted()?e():!0;return f.keyDerivationOk=h&&i,b(null,f.keyDerivationOk)},d.prototype.seedFromRandomWithMnemonic=function(a){f.checkArgument(arguments.length<=1,"DEPRECATED: only 1 argument accepted."),f.checkArgument(e.isUndefined(a)||e.isObject(a),"DEPRECATED: argument should be an options object."),a=a||{},this.credentials=u.createWithMnemonic(a.coin||"btc",a.network||"livenet",a.passphrase,a.language||"en",a.account||0)},d.prototype.getMnemonic=function(){return this.credentials.getMnemonic()},d.prototype.mnemonicHasPassphrase=function(){return this.credentials.mnemonicHasPassphrase},d.prototype.clearMnemonic=function(){return this.credentials.clearMnemonic()},d.prototype.seedFromExtendedPrivateKey=function(a,b){b=b||{},this.credentials=u.fromExtendedPrivateKey(b.coin||"btc",a,b.account||0,b.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44,b)},d.prototype.seedFromMnemonic=function(a,b){f.checkArgument(e.isUndefined(b)||e.isObject(b),"DEPRECATED: second argument should be an options object."),b=b||{},this.credentials=u.fromMnemonic(b.coin||"btc",b.network||"livenet",a,b.passphrase,b.account||0,b.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44,b)},d.prototype.seedFromExtendedPublicKey=function(a,b,c,d){f.checkArgument(e.isUndefined(d)||e.isObject(d)),d=d||{},this.credentials=u.fromExtendedPublicKey(d.coin||"btc",a,b,c,d.account||0,d.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44)},d.prototype["export"]=function(a){f.checkState(this.credentials),a=a||{};var b,c=u.fromObj(this.credentials);return a.noSign?c.setNoSign():a.password&&c.decryptPrivateKey(a.password),b=JSON.stringify(c.toObj())},d.prototype["import"]=function(a){try{var b=u.fromObj(JSON.parse(a));this.credentials=b}catch(c){throw new x.INVALID_BACKUP}},d.prototype._import=function(a){f.checkState(this.credentials);var b=this;b.openWallet(function(c,d){return c?c instanceof x.NOT_AUTHORIZED||b.isPrivKeyExternal()?a(c):(t.info("Copayer not found, trying to add access"),void b.addAccess({},function(c){return c?a(new x.WALLET_DOES_NOT_EXIST):void b.openWallet(a)})):a(null,d)})},d.prototype.importFromMnemonic=function(a,b,c){function d(c){return u.fromMnemonic(b.coin||"btc",b.network||"livenet",a,b.passphrase,b.account||0,b.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44,{nonCompliantDerivation:c,entropySourcePath:b.entropySourcePath,walletPrivKey:b.walletPrivKey})}t.debug("Importing from 12 Words");var e=this;b=b||{};try{e.credentials=d(!1)}catch(f){return t.info("Mnemonic error:",f),c(new x.INVALID_BACKUP)}e._import(function(a,b){if(!a)return c(null,b);if(a instanceof x.INVALID_BACKUP)return c(a);if(a instanceof x.NOT_AUTHORIZED||a instanceof x.WALLET_DOES_NOT_EXIST){var f=d(!0);return f.xPubKey.toString()==e.credentials.xPubKey.toString()?c(a):(e.credentials=f,e._import(c))}return c(a)})},d.prototype.importFromExtendedPrivateKey=function(a,b,c){t.debug("Importing from Extended Private Key"),c||(c=b,b={},t.warn("DEPRECATED WARN: importFromExtendedPrivateKey should receive 3 parameters."));try{this.credentials=u.fromExtendedPrivateKey(b.coin||"btc",a,b.account||0,b.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44,b)}catch(d){return t.info("xPriv error:",d),c(new x.INVALID_BACKUP)}this._import(c)},d.prototype.importFromExtendedPublicKey=function(a,b,c,d,g){f.checkArgument(5==arguments.length,"DEPRECATED: should receive 5 arguments"),f.checkArgument(e.isUndefined(d)||e.isObject(d)),f.shouldBeFunction(g),d=d||{},t.debug("Importing from Extended Private Key");try{this.credentials=u.fromExtendedPublicKey(d.coin||"btc",a,b,c,d.account||0,d.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44,d)}catch(h){return t.info("xPriv error:",h),g(new x.INVALID_BACKUP)}this._import(g)},d.prototype.decryptBIP38PrivateKey=function(b,d,e,f){var g,h=a("bip38"),i=new h;try{g=i.decrypt(b,d)}catch(k){return f(new Error("Could not decrypt BIP38 private key",k))}var l=new j.PrivateKey(g),m=l.publicKey.toAddress().toString(),n=new c(m,"ascii"),o=j.crypto.Hash.sha256sha256(n).toString("hex").substring(0,8),p=j.encoding.Base58Check.decode(b).toString("hex").substring(6,14);return o!=p?f(new Error("Incorrect passphrase")):f(null,g)},d.prototype.getBalanceFromPrivateKey=function(a,b,c){var d=this;e.isFunction(b)&&(c=b,b="btc");var f=k[b],a=new f.PrivateKey(a),g=a.publicKey.toAddress();d.getUtxos({addresses:g.toString()},function(a,b){return a?c(a):c(null,e.sumBy(b,"satoshis"))})},d.prototype.buildTxFromPrivateKey=function(a,b,c,d){var f=this;c=c||{};var g=c.coin||"btc",i=k[g],a=i.PrivateKey(a),j=a.publicKey.toAddress();h.waterfall([function(a){f.getUtxos({addresses:j.toString()},function(b,c){return a(b,c)})},function(d,f){if(!e.isArray(d)||0==d.length)return f(new Error("No utxos found"));var g=c.fee||1e4,h=e.sumBy(d,"satoshis")-g;if(0>=h)return f(new x.INSUFFICIENT_FUNDS);var j;try{var k=i.Address.fromString(b);j=(new i.Transaction).from(d).to(k,h).fee(g).sign(a),j.serialize()}catch(l){return t.error("Could not build transaction from private key",l),f(new x.COULD_NOT_BUILD_TRANSACTION)}return f(null,j)}],d)},d.prototype.openWallet=function(a){f.checkState(this.credentials);var b=this;return b.credentials.isComplete()&&b.credentials.hasWalletInfo()?a(null,!0):void b._doGetRequest("/v2/wallets/?includeExtendedInfo=1",function(c,f){if(c)return a(c);var g=f.wallet;if(b._processStatus(f),!b.credentials.hasWalletInfo()){var h=e.find(g.copayers,{id:b.credentials.copayerId});b.credentials.addWalletInfo(g.id,g.name,g.m,g.n,h.name)}if("complete"!=g.status)return a();if(b.credentials.walletPrivKey){if(!v.checkCopayers(b.credentials,g.copayers))return a(new x.SERVER_COMPROMISED)}else t.warn("Could not verify copayers key (missing wallet Private Key)");return b.credentials.addPublicKeyRing(d._extractPublicKeyRing(g.copayers)),b.emit("walletCompleted",g),a(null,f)})},d.prototype._getHeaders=function(a,b,c){var d={"x-client-version":"bwc-"+w.version};return this.supportStaffWalletId&&(d["x-wallet-id"]=this.supportStaffWalletId),d},d.prototype._doRequest=function(a,b,c,f,h){var i=this,j=i._getHeaders(a,b,c);if(i.credentials)if(j["x-identity"]=i.credentials.copayerId,f&&i.session)j["x-session"]=i.session;else{var k,l=c._requestPrivKey||i.credentials.requestPrivKey;l&&(delete c._requestPrivKey,k=d._signRequest(a,b,c,l)),j["x-signature"]=k}var m=i.request[a](i.baseUrl+b);m.accept("json"),e.each(j,function(a,b){a&&m.set(b,a)}),c&&("post"==a||"put"==a?m.send(c):m.query(c)),m.timeout(i.timeout),m.end(function(a,b){return b?(b.body&&t.debug(g.inspect(b.body,{depth:10})),200!==b.status?404===b.status?h(new x.NOT_FOUND):b.status?(t.error("HTTP Error:"+b.status),h(b.body?d._parseError(b.body):new Error(b.status))):h(new x.CONNECTION_ERROR):'{"error":"read ECONNRESET"}'===b.body?h(new x.ECONNRESET_ERROR(JSON.parse(b.body))):h(null,b.body,b.header)):h(new x.CONNECTION_ERROR)})},d.prototype._login=function(a){this._doPostRequest("/v1/login",{},a)},d.prototype._logout=function(a){this._doPostRequest("/v1/logout",{},a)},d.prototype._doRequestWithLogin=function(a,b,c,d){function e(a){f._login(function(b,c){return b?a(b):c?(f.session=c,void a()):a(new x.NOT_AUTHORIZED)})}var f=this;h.waterfall([function(a){return f.session?a():void e(a)},function(d){f._doRequest(a,b,c,!0,function(g,h,i){g&&g instanceof x.NOT_AUTHORIZED&&e(function(e){return e?d(e):f._doRequest(a,b,c,!0,d)}),d(null,h,i)})}],d)},d.prototype._doPostRequest=function(a,b,c){return this._doRequest("post",a,b,!1,c)},d.prototype._doPutRequest=function(a,b,c){return this._doRequest("put",a,b,!1,c)},d.prototype._doGetRequest=function(a,b){return a+=a.indexOf("?")>0?"&":"?",a+="r="+e.random(1e4,99999),this._doRequest("get",a,{},!1,b)},d.prototype._doGetRequestWithLogin=function(a,b){return a+=a.indexOf("?")>0?"&":"?",a+="r="+e.random(1e4,99999),this._doRequestWithLogin("get",a,{},b)},d.prototype._doDeleteRequest=function(a,b){return this._doRequest("delete",a,{},!1,b)},d._buildSecret=function(a,b,d,f){e.isString(b)&&(b=j.PrivateKey.fromString(b));var g=new c(a.replace(/-/g,""),"hex"),h=new j.encoding.Base58(g).toString();return e.padEnd(h,22,"0")+b.toWIF()+("testnet"==f?"T":"L")+d},d.parseSecret=function(a){function b(a,b){var c=[];b.push(a.length);for(var d=0;d1?j:null)})})},d.prototype.joinWallet=function(a,b,c,f){var g=this;if(f||(f=c,c={},t.warn("DEPRECATED WARN: joinWallet should receive 4 parameters.")),!g._checkKeyDerivation())return f(new Error("Cannot join wallet"));c=c||{};var h=c.coin||"btc";if(!e.includes(["btc","bch"],h))return f(new Error("Invalid coin"));try{var i=d.parseSecret(a)}catch(j){return f(j)}g.credentials||g.seedFromRandom({coin:h,network:i.network}),g.credentials.addWalletPrivateKey(i.walletPrivKey.toString()),g._doJoinWallet(i.walletId,i.walletPrivKey,g.credentials.xPubKey,g.credentials.requestPubKey,b,{coin:h,dryRun:!!c.dryRun},function(a,d){return a?f(a):(c.dryRun||g.credentials.addWalletInfo(d.id,d.name,d.m,d.n,b),f(null,d))})},d.prototype.recreateWallet=function(a){f.checkState(this.credentials),f.checkState(this.credentials.isComplete()),f.checkState(this.credentials.walletPrivKey);var b=this;this.getStatus({includeExtendedInfo:!0},function(c){if(!c)return t.info("Wallet is already created"),a();var d=b.credentials,e=j.PrivateKey.fromString(d.walletPrivKey),f=d.walletId,g=d.derivationStrategy!=q.DERIVATION_STRATEGIES.BIP45,i=r.encryptMessage(d.walletName||"recovered wallet",d.sharedEncryptingKey),k=(d.coin,{name:i,m:d.m,n:d.n,pubKey:e.toPublicKey().toString(),coin:d.coin,network:d.network,id:f,supportBIP44AndP2PKH:g});b._doPostRequest("/v2/wallets/",k,function(c,i){if(c)return c instanceof x.WALLET_ALREADY_EXISTS?b.addAccess({},function(c){return c?a(c):void b.openWallet(function(b){return a(b)})}):a(c);f||(f=i.walletId);var j=1;h.each(b.credentials.publicKeyRing,function(a,c){var h=a.copayerName||"copayer "+j++;b._doJoinWallet(f,e,a.xPubKey,a.requestPubKey,h,{coin:d.coin,supportBIP44AndP2PKH:g},function(a){return a&&a instanceof x.COPAYER_IN_WALLET?c():c(a)})},a)})})},d.prototype._processWallet=function(a){var b=this,c=b.credentials.sharedEncryptingKey,d=r.decryptMessage(a.name,c);d!=a.name&&(a.encryptedName=a.name),a.name=d,e.each(a.copayers,function(a){var b=r.decryptMessage(a.name,c);b!=a.name&&(a.encryptedName=a.name),a.name=b,e.each(a.requestPubKeys,function(a){if(a.name){var b=r.decryptMessage(a.name,c);b!=a.name&&(a.encryptedName=a.name),a.name=b}})})},d.prototype._processStatus=function(a){function b(a){var b=a.wallet.copayers;if(b){var d=e.find(b,{id:c.credentials.copayerId});if(d&&d.customData){var f;try{f=JSON.parse(r.decryptMessage(d.customData,c.credentials.personalEncryptingKey))}catch(g){t.warn("Could not decrypt customData:",d.customData)}f&&(a.customData=f,!c.credentials.walletPrivKey&&f.walletPrivKey&&c.credentials.addWalletPrivateKey(f.walletPrivKey))}}}var c=this;b(a),c._processWallet(a.wallet),c._processTxps(a.pendingTxps)},d.prototype.getNotifications=function(a,b){f.checkState(this.credentials);var c=this;a=a||{};var d="/v1/notifications/";a.lastNotificationId?d+="?notificationId="+a.lastNotificationId:a.timeSpan&&(d+="?timeSpan="+a.timeSpan),c._doGetRequestWithLogin(d,function(d,f){if(d)return b(d);var g=e.filter(f,function(b){return a.includeOwn||b.creatorId!=c.credentials.copayerId});return b(null,g)})},d.prototype.getStatus=function(a,b){f.checkState(this.credentials),b||(b=a,a={},t.warn("DEPRECATED WARN: getStatus should receive 2 parameters."));var c=this;a=a||{};var e=[];e.push("includeExtendedInfo="+(a.includeExtendedInfo?"1":"0")),e.push("twoStep="+(a.twoStep?"1":"0")),c._doGetRequest("/v2/wallets/?"+e.join("&"),function(a,e){if(a)return b(a);if("pending"==e.wallet.status){var f=c.credentials;e.wallet.secret=d._buildSecret(f.walletId,f.walletPrivKey,f.coin,f.network)}return c._processStatus(e),b(a,e)})},d.prototype.getPreferences=function(a){f.checkState(this.credentials),f.checkArgument(a);var b=this;b._doGetRequest("/v1/preferences/",function(b,c){return b?a(b):a(null,c)})},d.prototype.savePreferences=function(a,b){f.checkState(this.credentials),f.checkArgument(b);var c=this;c._doPutRequest("/v1/preferences/",a,b)},d.prototype.fetchPayPro=function(a,b){f.checkArgument(a).checkArgument(a.payProUrl),s.get({url:a.payProUrl,http:this.payProHttp,coin:this.credentials.coin||"btc"},function(a,c){return a?b(a):b(null,c)})},d.prototype.getUtxos=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete()),a=a||{};var c="/v1/utxos/";a.addresses&&(c+="?"+n.stringify({addresses:[].concat(a.addresses).join(",")})),this._doGetRequest(c,b)},d.prototype._getCreateTxProposalArgs=function(a){var b=this,c=e.cloneDeep(a);return c.message=d._encryptMessage(a.message,this.credentials.sharedEncryptingKey)||null,c.payProUrl=a.payProUrl||null,e.each(c.outputs,function(a){a.message=d._encryptMessage(a.message,b.credentials.sharedEncryptingKey)||null}),c},d.prototype.createTxProposal=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete()),f.checkState(this.credentials.sharedEncryptingKey),f.checkArgument(a);var c=this,d=c._getCreateTxProposalArgs(a);c._doPostRequest("/v2/txproposals/",d,function(a,e){return a?b(a):(c._processTxps(e),v.checkProposalCreation(d,e,c.credentials.sharedEncryptingKey)?b(null,e):b(new x.SERVER_COMPROMISED))})},d.prototype.publishTxProposal=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete()),f.checkArgument(a).checkArgument(a.txp),f.checkState(parseInt(a.txp.version)>=3);var c=this,d=r.buildTx(a.txp),e=d.uncheckedSerialize(),g={proposalSignature:r.signMessage(e,c.credentials.requestPrivKey)},h="/v1/txproposals/"+a.txp.id+"/publish/";c._doPostRequest(h,g,function(a,d){return a?b(a):(c._processTxps(d),b(null,d))})},d.prototype.createAddress=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this;return b||(b=a,a={},t.warn("DEPRECATED WARN: createAddress should receive 2 parameters.")),c._checkKeyDerivation()?(a=a||{},void c._doPostRequest("/v3/addresses/",a,function(a,d){return a?b(a):v.checkAddress(c.credentials,d)?b(null,d):b(new x.SERVER_COMPROMISED)})):b(new Error("Cannot create new address for this wallet"))},d.prototype.getMainAddresses=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this;a=a||{};var d=[];a.limit&&d.push("limit="+a.limit),a.reverse&&d.push("reverse=1");var g="";d.length>0&&(g="?"+d.join("&"));var h="/v1/addresses/"+g;c._doGetRequest(h,function(d,f){if(d)return b(d);if(!a.doNotVerify){var g=e.some(f,function(a){return!v.checkAddress(c.credentials,a)});if(g)return b(new x.SERVER_COMPROMISED)}return b(null,f)})},d.prototype.getBalance=function(a,b){b||(b=a,a={},t.warn("DEPRECATED WARN: getBalance should receive 2 parameters."));a=a||{},f.checkState(this.credentials&&this.credentials.isComplete());var c=[];if(a.twoStep&&c.push("?twoStep=1"),a.coin){if(!e.includes(["btc","bch"],a.coin))return b(new Error("Invalid coin"));c.push("coin="+a.coin)}var d="";c.length>0&&(d="?"+c.join("&"));var g="/v1/balance/"+d;this._doGetRequest(g,b)},d.prototype.getTxProposals=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this;c._doGetRequest("/v1/txproposals/",function(d,e){return d?b(d):(c._processTxps(e),void h.every(e,function(b,d){return a.doNotVerify?d(!0):void c.getPayPro(b,function(a,e){var f=v.checkTxProposal(c.credentials,b,{paypro:e});return d(f)})},function(d){if(!d)return b(new x.SERVER_COMPROMISED);var f;return f=a.forAirGapped?{txps:JSON.parse(JSON.stringify(e)),encryptedPkr:a.doNotEncryptPkr?null:r.encryptMessage(JSON.stringify(c.credentials.publicKeyRing),c.credentials.personalEncryptingKey),unencryptedPkr:a.doNotEncryptPkr?JSON.stringify(c.credentials.publicKeyRing):null,m:c.credentials.m,n:c.credentials.n}:e,b(null,f)}))})},d.prototype.getPayPro=function(a,b){var c=this;return!a.payProUrl||this.doNotVerifyPayPro?b():void s.get({url:a.payProUrl,http:c.payProHttp,coin:a.coin||"btc"},function(a,c){return a?b(new Error("Cannot check transaction now:"+a)):b(null,c)})},d.prototype.signTxProposal=function(a,b,c){f.checkState(this.credentials&&this.credentials.isComplete()),f.checkArgument(a.creatorId),e.isFunction(b)&&(c=b,b=null);var d=this;if(!a.signatures){if(!d.canSign())return c(new x.MISSING_PRIVATE_KEY);if(d.isPrivKeyEncrypted()&&!b)return c(new x.ENCRYPTED_PRIVATE_KEY)}d.getPayPro(a,function(f,g){if(f)return c(f);var h=v.checkTxProposal(d.credentials,a,{paypro:g});if(!h)return c(new x.SERVER_COMPROMISED);var i=a.signatures;if(e.isEmpty(i))try{i=d._signTxp(a,b)}catch(j){return t.error("Error signing tx",j),c(j)}var k="/v1/txproposals/"+a.id+"/signatures/",l={signatures:i};d._doPostRequest(k,l,function(a,b){return a?c(a):(d._processTxps(b),c(null,b))})})},d.prototype.signTxProposalFromAirGapped=function(a,b,c,d,g){f.checkState(this.credentials);var h=this;if(!h.canSign())throw new x.MISSING_PRIVATE_KEY;if(h.isPrivKeyEncrypted()&&!g)throw new x.ENCRYPTED_PRIVATE_KEY;var i;try{i=JSON.parse(r.decryptMessage(b,h.credentials.personalEncryptingKey))}catch(j){throw new Error("Could not decrypt public key ring")}if(!e.isArray(i)||i.length!=d)throw new Error("Invalid public key ring");if(h.credentials.m=c,h.credentials.n=d,h.credentials.addressType=a.addressType,h.credentials.addPublicKeyRing(i),!v.checkTxProposalSignature(h.credentials,a))throw new Error("Fake transaction proposal");return h._signTxp(a,g)},d.signTxProposalFromAirGapped=function(a,b,c,f,g,h){h=h||{};var i=h.coin||"btc";if(!e.includes(["btc","bch"],i))return cb(new Error("Invalid coin"));var j=JSON.parse(c);if(!e.isArray(j)||j.length!=g)throw new Error("Invalid public key ring");var k=new d({baseUrl:"https://bws.example.com/bws/api"});if("xprv"===a.slice(0,4)||"tprv"===a.slice(0,4)){if("xprv"===a.slice(0,4)&&"testnet"==b.network)throw new Error("testnet HD keys must start with tprv");if("tprv"===a.slice(0,4)&&"livenet"==b.network)throw new Error("livenet HD keys must start with xprv");k.seedFromExtendedPrivateKey(a,{coin:i,account:h.account,derivationStrategy:h.derivationStrategy})}else k.seedFromMnemonic(a,{coin:i,network:b.network,passphrase:h.passphrase,account:h.account,derivationStrategy:h.derivationStrategy});if(k.credentials.m=f,k.credentials.n=g,k.credentials.addressType=b.addressType,k.credentials.addPublicKeyRing(j),!v.checkTxProposalSignature(k.credentials,b))throw new Error("Fake transaction proposal");return k._signTxp(b)},d.prototype.rejectTxProposal=function(a,b,c){f.checkState(this.credentials&&this.credentials.isComplete()),f.checkArgument(c);var e=this,g="/v1/txproposals/"+a.id+"/rejections/",h={reason:d._encryptMessage(b,e.credentials.sharedEncryptingKey)||""};e._doPostRequest(g,h,function(a,b){return a?c(a):(e._processTxps(b),c(null,b))})},d.prototype.broadcastRawTx=function(a,b){f.checkState(this.credentials),f.checkArgument(b);var c=this;a=a||{};var d="/v1/broadcast_raw/";c._doPostRequest(d,a,function(a,c){return a?b(a):b(null,c)})},d.prototype._doBroadcast=function(a,b){var c=this,d="/v1/txproposals/"+a.id+"/broadcast/";c._doPostRequest(d,{},function(a,d){return a?b(a):(c._processTxps(d),b(null,d))})},d.prototype.broadcastTxProposal=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this;c.getPayPro(a,function(d,e){if(e){var f=r.buildTx(a);c._applyAllSignatures(a,f),s.send({http:c.payProHttp,url:a.payProUrl,amountSat:a.amount,refundAddr:a.changeAddress.address,merchant_data:e.merchant_data,rawTx:f.serialize({disableSmallFees:!0,disableLargeFees:!0,disableDustOutputs:!0}),coin:a.coin||"btc"},function(d,e,f){return d?b(d):void c._doBroadcast(a,function(a,c){return b(a,c,f)})})}else c._doBroadcast(a,b)})},d.prototype.removeTxProposal=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this,d="/v1/txproposals/"+a.id;c._doDeleteRequest(d,function(a){return b(a)})},d.prototype.getTxHistory=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this,d=[];a&&(a.skip&&d.push("skip="+a.skip),a.limit&&d.push("limit="+a.limit),a.includeExtendedInfo&&d.push("includeExtendedInfo=1"));var e="";d.length>0&&(e="?"+d.join("&"));var g="/v1/txhistory/"+e;c._doGetRequest(g,function(a,d){return a?b(a):(c._processTxps(d),b(null,d))})},d.prototype.getTx=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this,d="/v1/txproposals/"+a;this._doGetRequest(d,function(a,d){return a?b(a):(c._processTxps(d),b(null,d))})},d.prototype.startScan=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this,d={includeCopayerBranches:a.includeCopayerBranches};c._doPostRequest("/v1/addresses/scan",d,function(a){return b(a)})},d.prototype.addAccess=function(a,b){ -f.checkState(this.credentials&&this.credentials.canSign()),a=a||{};var c=new j.PrivateKey(a.generateNewKey?null:this.credentials.requestPrivKey),d=c.toPublicKey().toString(),e=new j.HDPrivateKey(this.credentials.xPrivKey).deriveChild(this.credentials.getBaseAddressDerivationPath()),g=r.signRequestPubKey(d,e),h=this.credentials.copayerId,i=a.name?r.encryptMessage(a.name,this.credentials.sharedEncryptingKey):null,a={copayerId:h,requestPubKey:d,signature:g,name:i,restrictions:a.restrictions};this._doPutRequest("/v1/copayers/"+h+"/",a,function(a,d){return a?b(a):b(null,d.wallet,c)})},d.prototype.getTxNote=function(a,b){f.checkState(this.credentials);var c=this;a=a||{},c._doGetRequest("/v1/txnotes/"+a.txid+"/",function(a,d){return a?b(a):(c._processTxNotes(d),b(null,d))})},d.prototype.editTxNote=function(a,b){f.checkState(this.credentials);var c=this;a=a||{},a.body&&(a.body=d._encryptMessage(a.body,this.credentials.sharedEncryptingKey)),c._doPutRequest("/v1/txnotes/"+a.txid+"/",a,function(a,d){return a?b(a):(c._processTxNotes(d),b(null,d))})},d.prototype.getTxNotes=function(a,b){f.checkState(this.credentials);var c=this;a=a||{};var d=[];e.isNumber(a.minTs)&&d.push("minTs="+a.minTs);var g="";d.length>0&&(g="?"+d.join("&")),c._doGetRequest("/v1/txnotes/"+g,function(a,d){return a?b(a):(c._processTxNotes(d),b(null,d))})},d.prototype.getFiatRate=function(a,b){f.checkArgument(b);var c=this,a=a||{},d=[];a.ts&&d.push("ts="+a.ts),a.provider&&d.push("provider="+a.provider);var e="";d.length>0&&(e="?"+d.join("&")),c._doGetRequest("/v1/fiatrates/"+a.code+"/"+e,function(a,c){return a?b(a):b(null,c)})},d.prototype.pushNotificationsSubscribe=function(a,b){var c="/v1/pushnotifications/subscriptions/";this._doPostRequest(c,a,function(a,c){return a?b(a):b(null,c)})},d.prototype.pushNotificationsUnsubscribe=function(a,b){var c="/v2/pushnotifications/subscriptions/"+a;this._doDeleteRequest(c,b)},d.prototype.txConfirmationSubscribe=function(a,b){var c="/v1/txconfirmations/";this._doPostRequest(c,a,function(a,c){return a?b(a):b(null,c)})},d.prototype.txConfirmationUnsubscribe=function(a,b){var c="/v1/txconfirmations/"+a;this._doDeleteRequest(c,b)},d.prototype.getSendMaxInfo=function(a,b){var c=this,d=[];a=a||{},a.feeLevel&&d.push("feeLevel="+a.feeLevel),null!=a.feePerKb&&d.push("feePerKb="+a.feePerKb),a.excludeUnconfirmedUtxos&&d.push("excludeUnconfirmedUtxos=1"),a.returnInputs&&d.push("returnInputs=1");var e="";d.length>0&&(e="?"+d.join("&"));var f="/v1/sendmaxinfo/"+e;c._doGetRequest(f,function(a,c){return a?b(a):b(null,c)})},d.prototype.getStatusByIdentifier=function(a,b){f.checkState(this.credentials);var c=this;a=a||{};var e=[];e.push("includeExtendedInfo="+(a.includeExtendedInfo?"1":"0")),e.push("twoStep="+(a.twoStep?"1":"0")),c._doGetRequest("/v1/wallets/"+a.identifier+"?"+e.join("&"),function(a,e){if(a||!e||!e.wallet)return b(a);if("pending"==e.wallet.status){var f=c.credentials;e.wallet.secret=d._buildSecret(f.walletId,f.walletPrivKey,f.coin,f.network)}return c._processStatus(e),b(a,e)})},d.prototype._oldCopayDecrypt=function(a,b,c){var d,e="@#$",f="%^#@";try{var g=a+e+b;d=m.decrypt(g,c)}catch(h){g=a+f+b;try{d=m.decrypt(g,c)}catch(h){t.debug(h)}}if(!d)return null;var i;try{i=JSON.parse(d)}catch(h){}return i},d.prototype.getWalletIdsFromOldCopay=function(a,b,c){var d=this._oldCopayDecrypt(a,b,c);if(!d)return null;var f=d.walletIds.concat(e.keys(d.focusedTimestamps));return e.uniq(f)},d.prototype.createWalletFromOldCopay=function(a,b,c,d){var e=this._oldCopayDecrypt(a,b,c);return e?e.publicKeyRing.copayersExtPubKeys.length!=e.opts.totalCopayers?d(new Error("Wallet is incomplete, cannot be imported")):(this.credentials=u.fromOldCopayWallet(e),void this.recreateWallet(d)):d(new Error("Could not decrypt"))},b.exports=d}).call(this,a("buffer").Buffer)},{"../package.json":343,"./common":5,"./credentials":7,"./errors":8,"./log":11,"./paypro":12,"./verifier":13,async:30,bip38:37,"bitcore-lib":89,"bitcore-lib-cash":38,"bitcore-mnemonic":138,buffer:187,events:232,"json-stable-stringify":254,lodash:259,preconditions:276,querystring:293,sjcl:320,superagent:328,url:335,util:340}],3:[function(a,b,c){"use strict";var d={};d.SCRIPT_TYPES={P2SH:"P2SH",P2PKH:"P2PKH"},d.DERIVATION_STRATEGIES={BIP44:"BIP44",BIP45:"BIP45",BIP48:"BIP48"},d.PATHS={REQUEST_KEY:"m/1'/0",TXPROPOSAL_KEY:"m/1'/1",REQUEST_KEY_AUTH:"m/2"},d.BIP45_SHARED_INDEX=2147483647,d.UNITS={btc:{toSatoshis:1e8,full:{maxDecimals:8,minDecimals:8},"short":{maxDecimals:6,minDecimals:2}},bit:{toSatoshis:100,full:{maxDecimals:2,minDecimals:2},"short":{maxDecimals:0,minDecimals:0}}},b.exports=d},{}],4:[function(a,b,c){"use strict";var d={};d.DEFAULT_FEE_PER_KB=1e4,d.MIN_FEE_PER_KB=0,d.MAX_FEE_PER_KB=1e6,d.MAX_TX_FEE=1e8,b.exports=d},{}],5:[function(a,b,c){var d={};d.Constants=a("./constants"),d.Defaults=a("./defaults"),d.Utils=a("./utils"),b.exports=d},{"./constants":3,"./defaults":4,"./utils":6}],6:[function(a,b,c){(function(c){"use strict";function d(){}var e=a("lodash"),f=a("preconditions").singleton(),g=a("sjcl"),h=a("json-stable-stringify"),i=a("bitcore-lib"),j={btc:i,bch:a("bitcore-lib-cash")},k=i.PrivateKey,l=i.PublicKey,m=i.crypto,n=(i.encoding,a("./constants")),o=a("./defaults");d.SJCL={},d.encryptMessage=function(a,b){var c=g.codec.base64.toBits(b);return g.encrypt(c,a,e.defaults({ks:128,iter:1},d.SJCL))},d.decryptMessage=function(a,b){try{var c=g.codec.base64.toBits(b);return g.decrypt(c,a)}catch(d){return a}},d.hashMessage=function(a){f.checkArgument(a);var b=new c(a),d=m.Hash.sha256sha256(b);return d=new i.encoding.BufferReader(d).readReverse()},d.signMessage=function(a,b){f.checkArgument(a);var c=new k(b),e=d.hashMessage(a);return m.ECDSA.sign(e,c,"little").toString()},d.verifyMessage=function(a,b,c){if(f.checkArgument(a),f.checkArgument(c),!b)return!1;var e=new l(c),g=d.hashMessage(a);try{var h=new m.Signature.fromString(b);return m.ECDSA.verify(g,h,e,"little")}catch(i){return!1}},d.privateKeyToAESKey=function(a){f.checkArgument(a&&e.isString(a)),f.checkArgument(i.PrivateKey.isValid(a),"The private key received is invalid");var b=i.PrivateKey.fromString(a);return i.crypto.Hash.sha256(b.toBuffer()).slice(0,16).toString("base64")},d.getCopayerHash=function(a,b,c){return[a,b,c].join("|")},d.getProposalHash=function(a){function b(a,b,c,d){return[a,b,c||"",d||""].join("|")}return arguments.length>1?b.apply(this,arguments):h(a)},d.deriveAddress=function(a,b,c,d,g,h){f.checkArgument(e.includes(e.values(n.SCRIPT_TYPES),a)),h=h||"btc";var i,k=j[h],l=e.map(b,function(a){var b=new k.HDPublicKey(a.xPubKey);return b.deriveChild(c).publicKey});switch(a){case n.SCRIPT_TYPES.P2SH:i=k.Address.createMultisig(l,d,g);break;case n.SCRIPT_TYPES.P2PKH:f.checkState(e.isArray(l)&&1==l.length),i=k.Address.fromPublicKey(l[0],g)}return{address:i.toString(),path:c,publicKeys:e.invokeMap(l,"toString")}},d.xPubToCopayerId=function(a,b){var c="btc"==a?b:a+b,d=g.hash.sha256.hash(c);return g.codec.hex.fromBits(d)},d.signRequestPubKey=function(a,b){var c=new i.HDPrivateKey(b).deriveChild(n.PATHS.REQUEST_KEY_AUTH).privateKey;return d.signMessage(a,c)},d.verifyRequestPubKey=function(a,b,c){var e=new i.HDPublicKey(c).deriveChild(n.PATHS.REQUEST_KEY_AUTH).publicKey;return d.verifyMessage(a,b,e.toString())},d.formatAmount=function(a,b,c){function d(a,b){var c=a.toString().split("."),d=(c[1]||"0").substring(0,b);return parseFloat(c[0]+"."+d)}function g(a,b,c,d){a=a.replace(".",c);var f=a.split(c),g=f[0],h=f[1];h=e.dropRightWhile(h,function(a,b){return"0"==a&&b>=d}).join("");var i=f.length>1?c+h:"";return g=g.replace(/\B(?=(\d{3})+(?!\d))/g,b),g+i}f.shouldBeNumber(a),f.checkArgument(e.includes(e.keys(n.UNITS),b)),c=c||{};var h=n.UNITS[b],i=c.fullPrecision?"full":"short",j=d(a/h.toSatoshis,h[i].maxDecimals).toFixed(h[i].maxDecimals);return g(j,c.thousandsSeparator||",",c.decimalSeparator||".",h[i].minDecimals)},d.buildTx=function(a){var b=a.coin||"btc",c=j[b],d=new c.Transaction;switch(f.checkState(e.includes(e.values(n.SCRIPT_TYPES),a.addressType)),a.addressType){case n.SCRIPT_TYPES.P2SH:e.each(a.inputs,function(b){d.from(b,b.publicKeys,a.requiredSignatures)});break;case n.SCRIPT_TYPES.P2PKH:d.from(a.inputs)}if(a.toAddress&&a.amount&&!a.outputs?d.to(a.toAddress,a.amount):a.outputs&&e.each(a.outputs,function(a){f.checkState(a.script||a.toAddress,"Output should have either toAddress or script specified"),a.script?d.addOutput(new c.Transaction.Output({script:a.script,satoshis:a.amount})):d.to(a.toAddress,a.amount)}),d.fee(a.fee),d.change(a.changeAddress.address),d.outputs.length>1){var g=e.reject(a.outputOrder,function(a){return a>=d.outputs.length});f.checkState(d.outputs.length==g.length),d.sortOutputs(function(a){return e.map(g,function(b){return a[b]})})}var h=e.reduce(a.inputs,function(a,b){return+b.satoshis+a},0),i=e.reduce(d.outputs,function(a,b){return+b.satoshis+a},0);return f.checkState(h-i>=0),f.checkState(h-i<=o.MAX_TX_FEE),d},b.exports=d}).call(this,a("buffer").Buffer)},{"./constants":3,"./defaults":4,"bitcore-lib":89,"bitcore-lib-cash":38,buffer:187,"json-stable-stringify":254,lodash:259,preconditions:276,sjcl:320}],7:[function(a,b,c){(function(c){"use strict";function d(){this.version="1.0.0",this.derivationStrategy=m.DERIVATION_STRATEGIES.BIP44,this.account=0}function e(a){if(!h.includes(["btc","bch"],a))throw new Error("Invalid coin")}function f(a){if(!h.includes(["livenet","testnet"],a))throw new Error("Invalid network")}var g=a("preconditions").singleton(),h=a("lodash"),i=a("bitcore-lib"),j=a("bitcore-mnemonic"),k=a("sjcl"),l=a("./common"),m=l.Constants,n=l.Utils,o=["coin","network","xPrivKey","xPrivKeyEncrypted","xPubKey","requestPrivKey","requestPubKey","copayerId","publicKeyRing","walletId","walletName","m","n","walletPrivKey","personalEncryptingKey","sharedEncryptingKey","copayerName","externalSource","mnemonic","mnemonicEncrypted","entropySource","mnemonicHasPassphrase","derivationStrategy","account","compliantDerivation","addressType","hwInfo","entropySourcePath"];d.create=function(a,b){e(a),f(b);var c=new d;return c.coin=a,c.network=b,c.xPrivKey=new i.HDPrivateKey(b).toString(),c.compliantDerivation=!0,c._expand(),c};var p={en:j.Words.ENGLISH,es:j.Words.SPANISH,ja:j.Words.JAPANESE,zh:j.Words.CHINESE,fr:j.Words.FRENCH,it:j.Words.ITALIAN};d.createWithMnemonic=function(a,b,c,h,i,k){if(e(a),f(b),!p[h])throw new Error("Unsupported language");g.shouldBeNumber(i),k=k||{};for(var l=new j(p[h]);!j.isValid(l.toString());)l=new j(p[h]);var m=new d;return m.coin=a,m.network=b,m.account=i,m.xPrivKey=l.toHDPrivateKey(c,b).toString(),m.compliantDerivation=!0,m._expand(),m.mnemonic=l.phrase,m.mnemonicHasPassphrase=!!c,m},d.fromExtendedPrivateKey=function(a,b,c,f,i){e(a),g.shouldBeNumber(c),g.checkArgument(h.includes(h.values(m.DERIVATION_STRATEGIES),f)),i=i||{};var j=new d;return j.coin=a,j.xPrivKey=b,j.account=c,j.derivationStrategy=f,j.compliantDerivation=!i.nonCompliantDerivation,i.walletPrivKey&&j.addWalletPrivateKey(i.walletPrivKey),j._expand(),j},d.fromMnemonic=function(a,b,c,i,k,l,n){e(a),f(b),g.shouldBeNumber(k),g.checkArgument(h.includes(h.values(m.DERIVATION_STRATEGIES),l)),n=n||{};var o=new j(c),p=new d;return p.coin=a,p.xPrivKey=o.toHDPrivateKey(i,b).toString(),p.mnemonic=c,p.mnemonicHasPassphrase=!!i,p.account=k,p.derivationStrategy=l,p.compliantDerivation=!n.nonCompliantDerivation,p.entropySourcePath=n.entropySourcePath,n.walletPrivKey&&p.addWalletPrivateKey(n.walletPrivKey),p._expand(),p},d.fromExtendedPublicKey=function(a,b,f,j,k,l,n){e(a),g.checkArgument(j),g.shouldBeNumber(k),g.checkArgument(h.includes(h.values(m.DERIVATION_STRATEGIES),l)),n=n||{};var o=new c(j,"hex");g.checkArgument(o.length>=14,"At least 112 bits of entropy are needed");var p=new d;return p.coin=a,p.xPubKey=b,p.entropySource=i.crypto.Hash.sha256sha256(o).toString("hex"),p.account=k,p.derivationStrategy=l,p.externalSource=f,p.compliantDerivation=!0,p._expand(),p},d._getNetworkFromExtendedKey=function(a){return g.checkArgument(a&&h.isString(a)),"t"==a.charAt(0)?"testnet":"livenet"},d.prototype._hashFromEntropy=function(a,b){g.checkState(a);var d=new c(this.entropySource,"hex"),e=i.crypto.Hash.sha256hmac(d,new c(a));return e.slice(0,b)},d.prototype._expand=function(){g.checkState(this.xPrivKey||this.xPubKey&&this.entropySource);var a=d._getNetworkFromExtendedKey(this.xPrivKey||this.xPubKey);if(this.network?g.checkState(this.network==a):this.network=a,this.xPrivKey){var b=new i.HDPrivateKey.fromString(this.xPrivKey),c=this.compliantDerivation?h.bind(b.deriveChild,b):h.bind(b.deriveNonCompliantChild,b),e=c(this.getBaseAddressDerivationPath());this.xPubKey=e.hdPublicKey.toString()}if(this.entropySourcePath){var f=c(this.entropySourcePath).publicKey.toBuffer();this.entropySource=i.crypto.Hash.sha256sha256(f).toString("hex")}if(this.entropySource){var f=this._hashFromEntropy("reqPrivKey",32),j=new i.PrivateKey(f.toString("hex"),a);this.requestPrivKey=j.toString(),this.requestPubKey=j.toPublicKey().toString()}else{var k=c(m.PATHS.REQUEST_KEY);this.requestPrivKey=k.privateKey.toString();var l=k.publicKey;this.requestPubKey=l.toString(),this.entropySource=i.crypto.Hash.sha256(k.privateKey.toBuffer()).toString("hex")}this.personalEncryptingKey=this._hashFromEntropy("personalKey",16).toString("base64"),g.checkState(this.coin),this.copayerId=n.xPubToCopayerId(this.coin,this.xPubKey),this.publicKeyRing=[{xPubKey:this.xPubKey,requestPubKey:this.requestPubKey}]},d.fromObj=function(a){var b=new d;return h.each(o,function(c){b[c]=a[c]}),b.coin=b.coin||"btc",b.derivationStrategy=b.derivationStrategy||m.DERIVATION_STRATEGIES.BIP45,b.addressType=b.addressType||m.SCRIPT_TYPES.P2SH,b.account=b.account||0,g.checkState(b.xPrivKey||b.xPubKey||b.xPrivKeyEncrypted,"invalid input"),b},d.prototype.toObj=function(){var a=this,b={};return h.each(o,function(c){b[c]=a[c]}),b},d.prototype.getBaseAddressDerivationPath=function(){var a;switch(this.derivationStrategy){case m.DERIVATION_STRATEGIES.BIP45:return"m/45'";case m.DERIVATION_STRATEGIES.BIP44:a="44";break;case m.DERIVATION_STRATEGIES.BIP48:a="48"}var b="livenet"==this.network?"0":"1";return"m/"+a+"'/"+b+"'/"+this.account+"'"},d.prototype.getDerivedXPrivKey=function(a){var b=this.getBaseAddressDerivationPath(),c=new i.HDPrivateKey(this.getKeys(a).xPrivKey,this.network),d=this.compliantDerivation?h.bind(c.deriveChild,c):h.bind(c.deriveNonCompliantChild,c);return d(b)},d.prototype.addWalletPrivateKey=function(a){this.walletPrivKey=a,this.sharedEncryptingKey=n.privateKeyToAESKey(a)},d.prototype.addWalletInfo=function(a,b,c,d,e){this.walletId=a,this.walletName=b,this.m=c,this.n=d,e&&(this.copayerName=e),"BIP44"==this.derivationStrategy&&1==d?this.addressType=m.SCRIPT_TYPES.P2PKH:this.addressType=m.SCRIPT_TYPES.P2SH,!this.xPrivKey&&this.externalSource&&d>1&&(this.derivationStrategy=m.DERIVATION_STRATEGIES.BIP48),1==d&&this.addPublicKeyRing([{xPubKey:this.xPubKey,requestPubKey:this.requestPubKey}])},d.prototype.hasWalletInfo=function(){return!!this.walletId},d.prototype.isPrivKeyEncrypted=function(){return!!this.xPrivKeyEncrypted&&!this.xPrivKey},d.prototype.encryptPrivateKey=function(a,b){if(this.xPrivKeyEncrypted)throw new Error("Private key already encrypted");if(!this.xPrivKey)throw new Error("No private key to encrypt");if(this.xPrivKeyEncrypted=k.encrypt(a,this.xPrivKey,b),!this.xPrivKeyEncrypted)throw new Error("Could not encrypt");this.mnemonic&&(this.mnemonicEncrypted=k.encrypt(a,this.mnemonic,b)),delete this.xPrivKey,delete this.mnemonic},d.prototype.decryptPrivateKey=function(a){if(!this.xPrivKeyEncrypted)throw new Error("Private key is not encrypted");try{this.xPrivKey=k.decrypt(a,this.xPrivKeyEncrypted),this.mnemonicEncrypted&&(this.mnemonic=k.decrypt(a,this.mnemonicEncrypted)),delete this.xPrivKeyEncrypted,delete this.mnemonicEncrypted}catch(b){throw new Error("Could not decrypt")}},d.prototype.getKeys=function(a){var b={};if(this.isPrivKeyEncrypted()){g.checkArgument(a,"Private keys are encrypted, a password is needed");try{b.xPrivKey=k.decrypt(a,this.xPrivKeyEncrypted),this.mnemonicEncrypted&&(b.mnemonic=k.decrypt(a,this.mnemonicEncrypted))}catch(c){throw new Error("Could not decrypt")}}else b.xPrivKey=this.xPrivKey,b.mnemonic=this.mnemonic;return b},d.prototype.addPublicKeyRing=function(a){this.publicKeyRing=h.clone(a)},d.prototype.canSign=function(){return!!this.xPrivKey||!!this.xPrivKeyEncrypted},d.prototype.setNoSign=function(){delete this.xPrivKey,delete this.xPrivKeyEncrypted,delete this.mnemonic,delete this.mnemonicEncrypted},d.prototype.isComplete=function(){return this.m&&this.n&&this.publicKeyRing&&this.publicKeyRing.length==this.n?!0:!1},d.prototype.hasExternalSource=function(){return"string"==typeof this.externalSource},d.prototype.getExternalSourceName=function(){return this.externalSource},d.prototype.getMnemonic=function(){if(this.mnemonicEncrypted&&!this.mnemonic)throw new Error("Credentials are encrypted");return this.mnemonic},d.prototype.clearMnemonic=function(){delete this.mnemonic,delete this.mnemonicEncrypted},d.fromOldCopayWallet=function(a){function b(a){var b=a.publicKeyRing.copayersExtPubKeys.sort().join(""),d=new c(b),e=new i.PrivateKey.fromBuffer(i.crypto.Hash.sha256(d));return e.toString()}var e=new d;e.coin="btc",e.derivationStrategy=m.DERIVATION_STRATEGIES.BIP45,e.xPrivKey=a.privateKey.extendedPrivateKeyString,e._expand(),e.addWalletPrivateKey(b(a)),e.addWalletInfo(a.opts.id,a.opts.name,a.opts.requiredCopayers,a.opts.totalCopayers);var f=h.map(a.publicKeyRing.copayersExtPubKeys,function(b){var c,d=b===e.xPubKey;if(d){var f=m.PATHS.REQUEST_KEY;c=new i.HDPrivateKey(e.xPrivKey).deriveChild(f).hdPublicKey}else{var f=m.PATHS.REQUEST_KEY_AUTH;c=new i.HDPublicKey(b).deriveChild(f)}var g=new i.HDPublicKey(b).deriveChild("m/2147483646/0/0"),h=g.publicKey.toString("hex"),j=a.publicKeyRing.nicknameFor[h];return d&&(e.copayerName=j),{xPubKey:b,requestPubKey:c.publicKey.toString(),copayerName:j}});return e.addPublicKeyRing(f),e},b.exports=d}).call(this,a("buffer").Buffer)},{"./common":5,"bitcore-lib":89,"bitcore-mnemonic":138,buffer:187,lodash:259,preconditions:276,sjcl:320}],8:[function(a,b,c){"use strict";function d(a,b){return a.replace("{0}",b[0]).replace("{1}",b[1]).replace("{2}",b[2])}var e=a("lodash"),f=function(a,b){var c=function(){if(e.isString(b.message))this.message=d(b.message,arguments);else{if(!e.isFunction(b.message))throw new Error("Invalid error definition for "+b.name);this.message=b.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return c.prototype=Object.create(a.prototype),c.prototype.name=a.prototype.name+b.name,a[b.name]=c,b.errors&&g(c,b.errors),c},g=function(a,b){e.each(b,function(b){f(a,b)})},h=function(a,b){return g(a,b),a},i={};i.Error=function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack},i.Error.prototype=Object.create(Error.prototype),i.Error.prototype.name="bwc.Error";var j=a("./spec");h(i.Error,j),b.exports=i.Error,b.exports.extend=function(a){return f(i.Error,a)}},{"./spec":9,lodash:259}],9:[function(a,b,c){"use strict";var d=[{name:"INVALID_BACKUP",message:"Invalid Backup."},{name:"WALLET_DOES_NOT_EXIST",message:"Wallet does not exist."},{name:"MISSING_PRIVATE_KEY",message:"Missing private keys to sign."},{name:"ENCRYPTED_PRIVATE_KEY",message:"Private key is encrypted, cannot sign transaction."},{name:"SERVER_COMPROMISED",message:"Server response could not be verified."},{name:"COULD_NOT_BUILD_TRANSACTION",message:"Could not build the transaction."},{name:"INSUFFICIENT_FUNDS",message:"Insufficient funds."},{name:"CONNECTION_ERROR",message:"Wallet service connection error."},{name:"NOT_FOUND",message:"Wallet service not found."},{name:"ECONNRESET_ERROR",message:"ECONNRESET, body: {0}"},{name:"WALLET_ALREADY_EXISTS",message:"Wallet already exists."},{name:"COPAYER_IN_WALLET",message:"Copayer in wallet."},{name:"WALLET_FULL",message:"Wallet is full."},{name:"WALLET_NOT_FOUND",message:"Wallet not found."},{name:"INSUFFICIENT_FUNDS_FOR_FEE",message:"Insufficient funds for fee."},{name:"LOCKED_FUNDS",message:"Locked funds."},{name:"DUST_AMOUNT",message:"Amount below dust threshold."},{name:"COPAYER_VOTED",message:"Copayer already voted on this transaction proposal."},{name:"NOT_AUTHORIZED",message:"Not authorized."},{name:"UNAVAILABLE_UTXOS",message:"Unavailable unspent outputs."},{name:"TX_NOT_FOUND",message:"Transaction proposal not found."},{name:"MAIN_ADDRESS_GAP_REACHED",message:"Maximum number of consecutive addresses without activity reached."},{name:"COPAYER_REGISTERED",message:"Copayer already register on server."}];b.exports=d},{}],10:[function(a,b,c){var d=b.exports=a("./api");d.Verifier=a("./verifier"),d.Utils=a("./common/utils"),d.sjcl=a("sjcl"),d.Bitcore=a("bitcore-lib"),d.BitcoreCash=a("bitcore-lib-cash")},{"./api":2,"./common/utils":6,"./verifier":13,"bitcore-lib":89,"bitcore-lib-cash":38,sjcl:320}],11:[function(a,b,c){var d=a("lodash"),e="silent",f=function(a){this.name=a||"log",this.level=e};f.prototype.getLevels=function(){return g};var g={silent:-1,debug:0,info:1,log:2,warn:3,error:4,fatal:5};d.each(g,function(a,b){"silent"!==b&&(f.prototype[b]=function(){if("silent"!==this.level&&a>=g[this.level]){if(Error.stackTraceLimit&&"debug"==this.level){var c=Error.stackTraceLimit;Error.stackTraceLimit=2;var d;try{anerror()}catch(e){d=e.stack}var f=d.split("\n"),h=f[2];h=":"+h.substr(6),Error.stackTraceLimit=c}var i,j="["+b+(h||"")+"] "+arguments[0],i=[].slice.call(arguments,1);console[b]?(i.unshift(j),console[b].apply(console,i)):(i.length&&(j+=JSON.stringify(i)),console.log(j))}})}),f.prototype.setLevel=function(a){this.level=a};var h=new f("copay");b.exports=h},{lodash:259}],12:[function(a,b,c){(function(c,d){var e=a("preconditions").singleton(),f=a("bitcore-lib"),g={btc:f,bch:a("bitcore-lib-cash")},h=a("bitcore-payment-protocol"),i={};i._nodeRequest=function(b,c){b.agent=!1;var e=b.httpNode||a("http"===b.proto?"http":"https"),f="POST"==b.method?"post":"get";e[f](b,function(a){var b=[];return 200!=a.statusCode?c(new Error("HTTP Request Error: "+a.statusCode+" "+a.statusMessage+" "+(b?b:""))):(a.on("data",function(a){b.push(a)}),void a.on("end",function(){return b=d.concat(b),c(null,b)}))})},i._browserRequest=function(a,b){var c=(a.method||"GET").toUpperCase(),d=a.url,e=a;e.headers=e.headers||{},e.body=e.body||e.data||"";var f=a.xhr||new XMLHttpRequest;f.open(c,d,!0),Object.keys(e.headers).forEach(function(a){var b=e.headers[a];"Content-Length"!==a&&"Content-Transfer-Encoding"!==a&&f.setRequestHeader(a,b)}),f.responseType="arraybuffer",f.onload=function(a){var c=f.response;return 200==f.status?b(null,new Uint8Array(c)):b("HTTP Request Error: "+f.status+" "+f.statusText+" "+c?c:"")},f.onerror=function(a){var c;return c=0!==f.status&&f.statusText?f.statusText:"HTTP Request Error",b(new Error(c))},e.body?f.send(e.body):f.send(null)};var j=function(a){a.url.match(/^((http[s]?):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/);if(a.proto=RegExp.$2,a.host=RegExp.$3,a.path=RegExp.$4+RegExp.$6,a.http)return a.http;var b=a.env;return b||(b=c&&!c.browser?"node":"browser"),"node"==b?i._nodeRequest:http=i._browserRequest};i.get=function(a,b){e.checkArgument(a&&a.url);var c=j(a),f=a.coin||"btc",i=g[f],k=f.toUpperCase(),l=new h(k);a.headers=a.headers||{Accept:h.LEGACY_PAYMENT[k].REQUEST_CONTENT_TYPE,"Content-Type":"application/octet-stream"},c(a,function(c,e){if(c)return b(c);var f,g,j,k;try{var m=h.PaymentRequest.decode(e);f=l.makePaymentRequest(m),j=f.get("signature"),k=f.get("serialized_payment_details"),g=f.verify(!0)}catch(n){return b(new Error("Could not parse payment protocol"+n))}var o=h.PaymentDetails.decode(k),p=new h;p=p.makePaymentDetails(o);var q=p.get("outputs");if(q.length>1)return b(new Error("Payment Protocol Error: Requests with more that one output are not supported"));var r=q[0],s=r.get("amount").toNumber(),t="test"==p.get("network")?"testnet":"livenet",u=r.get("script").offset,v=r.get("script").limit,w=new d(new Uint8Array(r.get("script").buffer)),x=w.slice(u,v),y=new i.Address.fromScript(new i.Script(x),t),z=p.get("merchant_data");z&&(z=z.toString());var A=g.verified;g.isChain&&(A=A&&g.chainVerified);var B={verified:A,caTrusted:g.caTrusted,caName:g.caName,selfSigned:g.selfSigned,expires:p.get("expires"),memo:p.get("memo"),time:p.get("time"),merchant_data:z,toAddress:y.toString(),amount:s,network:t,domain:a.host,url:a.url},C=p.get("required_fee_rate");return C&&(B.requiredFeeRate=C),b(null,B)})},i._getPayProRefundOutputs=function(a,b,c){b=b.toString(10);var d,e=g[c],f=new h.Output,i=new e.Address(a);if(i.isPayToPublicKeyHash())d=e.Script.buildPublicKeyHashOut(i);else{if(!i.isPayToScriptHash())throw new Error("Unrecognized address type "+i.type);d=e.Script.buildScriptHashOut(i)}return f.set("script",d.toBuffer()),f.set("amount",b),[f]},i._createPayment=function(a,b,c,e,f){var g=new h;g=g.makePayment(),a&&(a=new d(a),g.set("merchant_data",a));var i=new d(b,"hex");g.set("transactions",[i]);var j=this._getPayProRefundOutputs(c,e,f);j&&g.set("refund_to",j),g=g.serialize();for(var k=new ArrayBuffer(g.length),l=new Uint8Array(k),m=0;m=3))throw new Error("Transaction proposal not supported");var k=i.buildTx(b);return h=k.uncheckedSerialize(),j.debug("Regenerating & verifying tx proposal hash -> Hash: ",h," Signature: ",b.proposalSignature),i.verifyMessage(h,b.proposalSignature,g)&&d.checkAddress(a,b.changeAddress)?!0:!1},d.checkPaypro=function(a,b){var c,d,e;return parseInt(a.version)>=3?(c=a.outputs[0].toAddress,d=a.amount,a.feePerKb&&(e=a.feePerKb/1024)):(c=a.toAddress,d=a.amount),c==b.toAddress&&d==b.amount},d.checkTxProposal=function(a,b,c){return c=c||{},this.checkTxProposalSignature(a,b)?c.paypro&&!this.checkPaypro(b,c.paypro)?!1:!0:!1},b.exports=d},{"./common":5,"./log":11,"bitcore-lib":89,lodash:259,preconditions:276}],14:[function(a,b,c){try{var d=a("asn1.js")}catch(e){var d=a("../..")}var f=c,g={"2 5 29 9":"subjectDirectoryAttributes","2 5 29 14":"subjectKeyIdentifier","2 5 29 15":"keyUsage","2 5 29 17":"subjectAlternativeName","2 5 29 18":"issuerAlternativeName","2 5 29 19":"basicConstraints","2 5 29 20":"cRLNumber","2 5 29 21":"reasonCode","2 5 29 24":"invalidityDate","2 5 29 27":"deltaCRLIndicator","2 5 29 28":"issuingDistributionPoint","2 5 29 29":"certificateIssuer","2 5 29 30":"nameConstraints","2 5 29 31":"cRLDistributionPoints","2 5 29 32":"certificatePolicies","2 5 29 33":"policyMappings","2 5 29 35":"authorityKeyIdentifier","2 5 29 36":"policyConstraints","2 5 29 37":"extendedKeyUsage","2 5 29 46":"freshestCRL","2 5 29 54":"inhibitAnyPolicy","1 3 6 1 5 5 7 1 1":"authorityInformationAccess","1 3 6 1 5 5 7 11":"subjectInformationAccess"},h=d.define("CertificateList",function(){this.seq().obj(this.key("tbsCertList").use(p),this.key("signatureAlgorithm").use(i),this.key("signature").bitstr())});f.CertificateList=h;var i=d.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())});f.AlgorithmIdentifier=i;var j=d.define("Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(k),this.key("signatureAlgorithm").use(i),this.key("signature").bitstr())});f.Certificate=j;var k=d.define("TBSCertificate",function(){this.seq().obj(this.key("version").def("v1").explicit(0).use(l),this.key("serialNumber")["int"](),this.key("signature").use(i),this.key("issuer").use(s),this.key("validity").use(m),this.key("subject").use(s),this.key("subjectPublicKeyInfo").use(o),this.key("issuerUniqueID").optional().implicit(1).bitstr(),this.key("subjectUniqueID").optional().implicit(2).bitstr(),this.key("extensions").optional().explicit(3).seqof(r))});f.TBSCertificate=k;var l=d.define("Version",function(){this["int"]({0:"v1",1:"v2",2:"v3"})});f.Version=l;var m=d.define("Validity",function(){this.seq().obj(this.key("notBefore").use(n),this.key("notAfter").use(n))});f.Validity=m;var n=d.define("Time",function(){this.choice({utcTime:this.utctime(),genTime:this.gentime()})});f.Time=n;var o=d.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(i),this.key("subjectPublicKey").bitstr())});f.SubjectPublicKeyInfo=o;var p=d.define("TBSCertList",function(){this.seq().obj(this.key("version").optional()["int"](),this.key("signature").use(i),this.key("issuer").use(s),this.key("thisUpdate").use(n),this.key("nextUpdate").use(n),this.key("revokedCertificates").optional().seqof(q),this.key("crlExtensions").explicit(0).optional().seqof(r))});f.TBSCertList=p;var q=d.define("RevokedCertificate",function(){this.seq().obj(this.key("userCertificate").use(G),this.key("revocationDate").use(n),this.key("crlEntryExtensions").optional().seqof(r))}),r=d.define("Extension",function(){this.seq().obj(this.key("extnID").objid(g),this.key("critical").bool().def(!1),this.key("extnValue").octstr().contains(function(a){var b=Ha[a.extnID];return b?b:d.define("OctString",function(){ -this.any()})}))});f.Extension=r;var s=d.define("Name",function(){this.choice({rdnSequence:this.use(x)})});f.Name=s;var t=d.define("GeneralName",function(){this.choice({otherName:this.implicit(0).use(v),rfc822Name:this.implicit(1).ia5str(),dNSName:this.implicit(2).ia5str(),directoryName:this.explicit(4).use(s),ediPartyName:this.implicit(5).use(w),uniformResourceIdentifier:this.implicit(6).ia5str(),iPAddress:this.implicit(7).octstr(),registeredID:this.implicit(8).objid()})});f.GeneralName=t;var u=d.define("GeneralNames",function(){this.seqof(t)});f.GeneralNames=u;var v=d.define("AnotherName",function(){this.seq().obj(this.key("type-id").objid(),this.key("value").explicit(0).any())});f.AnotherName=v;var w=d.define("EDIPartyName",function(){this.seq().obj(this.key("nameAssigner").implicit(0).optional().use(D),this.key("partyName").implicit(1).use(D))});f.EDIPartyName=w;var x=d.define("RDNSequence",function(){this.seqof(y)});f.RDNSequence=x;var y=d.define("RelativeDistinguishedName",function(){this.setof(z)});f.RelativeDistinguishedName=y;var z=d.define("AttributeTypeAndValue",function(){this.seq().obj(this.key("type").use(B),this.key("value").use(C))});f.AttributeTypeAndValue=z;var A=d.define("Attribute",function(){this.seq().obj(this.key("type").use(B),this.key("values").setof(C))});f.Attribute=A;var B=d.define("AttributeType",function(){this.objid()});f.AttributeType=B;var C=d.define("AttributeValue",function(){this.any()});f.AttributeValue=C;var D=d.define("DirectoryString",function(){this.choice({teletexString:this.t61str(),printableString:this.printstr(),universalString:this.unistr(),utf8String:this.utf8str(),bmpString:this.bmpstr()})});f.DirectoryString=D;var E=d.define("AuthorityKeyIdentifier",function(){this.seq().obj(this.key("keyIdentifier").implicit(0).optional().use(F),this.key("authorityCertIssuer").implicit(1).optional().use(u),this.key("authorityCertSerialNumber").implicit(2).optional().use(G))});f.AuthorityKeyIdentifier=E;var F=d.define("KeyIdentifier",function(){this.octstr()});f.KeyIdentifier=F;var G=d.define("CertificateSerialNumber",function(){this["int"]()});f.CertificateSerialNumber=G;var H=d.define("ORAddress",function(){this.seq().obj(this.key("builtInStandardAttributes").use(I),this.key("builtInDomainDefinedAttributes").optional().use(U),this.key("extensionAttributes").optional().use(W))});f.ORAddress=H;var I=d.define("BuiltInStandardAttributes",function(){this.seq().obj(this.key("countryName").optional().use(J),this.key("administrationDomainName").optional().use(K),this.key("networkAddress").implicit(0).optional().use(L),this.key("terminalIdentifier").implicit(1).optional().use(N),this.key("privateDomainName").explicit(2).optional().use(O),this.key("organizationName").implicit(3).optional().use(P),this.key("numericUserIdentifier").implicit(4).optional().use(Q),this.key("personalName").implicit(5).optional().use(R),this.key("organizationalUnitNames").implicit(6).optional().use(S))});f.BuiltInStandardAttributes=I;var J=d.define("CountryName",function(){this.choice({x121DccCode:this.numstr(),iso3166Alpha2Code:this.printstr()})});f.CountryName=J;var K=d.define("AdministrationDomainName",function(){this.choice({numeric:this.numstr(),printable:this.printstr()})});f.AdministrationDomainName=K;var L=d.define("NetworkAddress",function(){this.use(M)});f.NetworkAddress=L;var M=d.define("X121Address",function(){this.numstr()});f.X121Address=M;var N=d.define("TerminalIdentifier",function(){this.printstr()});f.TerminalIdentifier=N;var O=d.define("PrivateDomainName",function(){this.choice({numeric:this.numstr(),printable:this.printstr()})});f.PrivateDomainName=O;var P=d.define("OrganizationName",function(){this.printstr()});f.OrganizationName=P;var Q=d.define("NumericUserIdentifier",function(){this.numstr()});f.NumericUserIdentifier=Q;var R=d.define("PersonalName",function(){this.set().obj(this.key("surname").implicit(0).printstr(),this.key("givenName").implicit(1).printstr(),this.key("initials").implicit(2).printstr(),this.key("generationQualifier").implicit(3).printstr())});f.PersonalName=R;var S=d.define("OrganizationalUnitNames",function(){this.seqof(T)});f.OrganizationalUnitNames=S;var T=d.define("OrganizationalUnitName",function(){this.printstr()});f.OrganizationalUnitName=T;var U=d.define("BuiltInDomainDefinedAttributes",function(){this.seqof(V)});f.BuiltInDomainDefinedAttributes=U;var V=d.define("BuiltInDomainDefinedAttribute",function(){this.seq().obj(this.key("type").printstr(),this.key("value").printstr())});f.BuiltInDomainDefinedAttribute=V;var W=d.define("ExtensionAttributes",function(){this.seqof(X)});f.ExtensionAttributes=W;var X=d.define("ExtensionAttribute",function(){this.seq().obj(this.key("extensionAttributeType").implicit(0)["int"](),this.key("extensionAttributeValue").any().explicit(1)["int"]())});f.ExtensionAttribute=X;var Y=d.define("SubjectKeyIdentifier",function(){this.use(F)});f.SubjectKeyIdentifier=Y;var Z=d.define("KeyUsage",function(){this.bitstr()});f.KeyUsage=Z;var $=d.define("CertificatePolicies",function(){this.seqof(_)});f.CertificatePolicies=$;var _=d.define("PolicyInformation",function(){this.seq().obj(this.key("policyIdentifier").use(aa),this.key("policyQualifiers").optional().use(ba))});f.PolicyInformation=_;var aa=d.define("CertPolicyId",function(){this.objid()});f.CertPolicyId=aa;var ba=d.define("PolicyQualifiers",function(){this.seqof(ca)});f.PolicyQualifiers=ba;var ca=d.define("PolicyQualifierInfo",function(){this.seq().obj(this.key("policyQualifierId").use(da),this.key("qualifier").any())});f.PolicyQualifierInfo=ca;var da=d.define("PolicyQualifierId",function(){this.objid()});f.PolicyQualifierId=da;var ea=d.define("PolicyMappings",function(){this.seqof(fa)});f.PolicyMappings=ea;var fa=d.define("PolicyMapping",function(){this.seq().obj(this.key("issuerDomainPolicy").use(aa),this.key("subjectDomainPolicy").use(aa))});f.PolicyMapping=fa;var ga=d.define("SubjectAlternativeName",function(){this.use(u)});f.SubjectAlternativeName=ga;var ha=d.define("IssuerAlternativeName",function(){this.use(u)});f.IssuerAlternativeName=ha;var ia=d.define("SubjectDirectoryAttributes",function(){this.seqof(A)});f.SubjectDirectoryAttributes=ia;var ja=d.define("BasicConstraints",function(){this.seq().obj(this.key("cA").bool().def(!1),this.key("pathLenConstraint").optional()["int"]())});f.BasicConstraints=ja;var ka=d.define("NameConstraints",function(){this.seq().obj(this.key("permittedSubtrees").implicit(0).optional().use(la),this.key("excludedSubtrees").implicit(1).optional().use(la))});f.NameConstraints=ka;var la=d.define("GeneralSubtrees",function(){this.seqof(ma)});f.GeneralSubtrees=la;var ma=d.define("GeneralSubtree",function(){this.seq().obj(this.key("base").use(t),this.key("minimum").implicit(0).def(0).use(na),this.key("maximum").implicit(0).optional().use(na))});f.GeneralSubtree=ma;var na=d.define("BaseDistance",function(){this["int"]()});f.BaseDistance=na;var oa=d.define("PolicyConstraints",function(){this.seq().obj(this.key("requireExplicitPolicy").implicit(0).optional().use(pa),this.key("inhibitPolicyMapping").implicit(1).optional().use(pa))});f.PolicyConstraints=oa;var pa=d.define("SkipCerts",function(){this["int"]()});f.SkipCerts=pa;var qa=d.define("ExtendedKeyUsage",function(){this.seqof(ra)});f.ExtendedKeyUsage=qa;var ra=d.define("KeyPurposeId",function(){this.objid()});f.KeyPurposeId=ra;var sa=d.define("CRLDistributionPoints",function(){this.seqof(ta)});f.CRLDistributionPoints=sa;var ta=d.define("DistributionPoint",function(){this.seq().obj(this.key("distributionPoint").optional().explicit(0).use(ua),this.key("reasons").optional().implicit(1).use(va),this.key("cRLIssuer").optional().implicit(2).use(u))});f.DistributionPoint=ta;var ua=d.define("DistributionPointName",function(){this.choice({fullName:this.implicit(0).use(u),nameRelativeToCRLIssuer:this.implicit(1).use(y)})});f.DistributionPointName=ua;var va=d.define("ReasonFlags",function(){this.bitstr()});f.ReasonFlags=va;var wa=d.define("InhibitAnyPolicy",function(){this.use(pa)});f.InhibitAnyPolicy=wa;var xa=d.define("FreshestCRL",function(){this.use(sa)});f.FreshestCRL=xa;var ya=d.define("AuthorityInfoAccessSyntax",function(){this.seqof(za)});f.AuthorityInfoAccessSyntax=ya;var za=d.define("AccessDescription",function(){this.seq().obj(this.key("accessMethod").objid(),this.key("accessLocation").use(t))});f.AccessDescription=za;var Aa=d.define("SubjectInformationAccess",function(){this.seqof(za)});f.SubjectInformationAccess=Aa;var Ba=d.define("CRLNumber",function(){this["int"]()});f.CRLNumber=Ba;var Ca=d.define("DeltaCRLIndicator",function(){this.use(Ba)});f.DeltaCRLIndicator=Ca;var Da=d.define("IssuingDistributionPoint",function(){this.seq().obj(this.key("distributionPoint").explicit(0).optional().use(ua),this.key("onlyContainsUserCerts").implicit(1).def(!1).bool(),this.key("onlyContainsCACerts").implicit(2).def(!1).bool(),this.key("onlySomeReasons").implicit(3).optional().use(va),this.key("indirectCRL").implicit(4).def(!1).bool(),this.key("onlyContainsAttributeCerts").implicit(5).def(!1).bool())});f.IssuingDistributionPoint=Da;var Ea=d.define("ReasonCode",function(){this["enum"]({0:"unspecified",1:"keyCompromise",2:"cACompromise",3:"affiliationChanged",4:"superseded",5:"cessationOfOperation",6:"certificateHold",8:"removeFromCRL",9:"privilegeWithdrawn",10:"aACompromise"})});f.ReasonCode=Ea;var Fa=d.define("InvalidityDate",function(){this.gentime()});f.InvalidityDate=Fa;var Ga=d.define("CertificateIssuer",function(){this.use(u)});f.CertificateIssuer=Ga;var Ha={subjectDirectoryAttributes:ia,subjectKeyIdentifier:Y,keyUsage:Z,subjectAlternativeName:ga,issuerAlternativeName:ha,basicConstraints:ja,cRLNumber:Ba,reasonCode:Ea,invalidityDate:Fa,deltaCRLIndicator:Ca,issuingDistributionPoint:Da,certificateIssuer:Ga,nameConstraints:ka,cRLDistributionPoints:sa,certificatePolicies:$,policyMappings:ea,authorityKeyIdentifier:E,policyConstraints:oa,extendedKeyUsage:qa,freshestCRL:xa,inhibitAnyPolicy:wa,authorityInformationAccess:ya,subjectInformationAccess:Aa}},{"../..":1,"asn1.js":15}],15:[function(a,b,c){var d=c;d.bignum=a("bn.js"),d.define=a("./asn1/api").define,d.base=a("./asn1/base"),d.constants=a("./asn1/constants"),d.decoders=a("./asn1/decoders"),d.encoders=a("./asn1/encoders")},{"./asn1/api":16,"./asn1/base":18,"./asn1/constants":22,"./asn1/decoders":24,"./asn1/encoders":27,"bn.js":153}],16:[function(a,b,c){function d(a,b){this.name=a,this.body=b,this.decoders={},this.encoders={}}var e=a("../asn1"),f=a("inherits"),g=c;g.define=function(a,b){return new d(a,b)},d.prototype._createNamed=function(b){var c;try{c=a("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(d){c=function(a){this._initNamed(a)}}return f(c,b),c.prototype._initNamed=function(a){b.call(this,a)},new c(this)},d.prototype._getDecoder=function(a){return a=a||"der",this.decoders.hasOwnProperty(a)||(this.decoders[a]=this._createNamed(e.decoders[a])),this.decoders[a]},d.prototype.decode=function(a,b,c){return this._getDecoder(b).decode(a,c)},d.prototype._getEncoder=function(a){return a=a||"der",this.encoders.hasOwnProperty(a)||(this.encoders[a]=this._createNamed(e.encoders[a])),this.encoders[a]},d.prototype.encode=function(a,b,c){return this._getEncoder(b).encode(a,c)}},{"../asn1":15,inherits:251,vm:341}],17:[function(a,b,c){function d(a,b){return g.call(this,b),h.isBuffer(a)?(this.base=a,this.offset=0,void(this.length=a.length)):void this.error("Input not Buffer")}function e(a,b){if(Array.isArray(a))this.length=0,this.value=a.map(function(a){return a instanceof e||(a=new e(a,b)),this.length+=a.length,a},this);else if("number"==typeof a){if(!(a>=0&&255>=a))return b.error("non-byte EncoderBuffer value");this.value=a,this.length=1}else if("string"==typeof a)this.value=a,this.length=h.byteLength(a);else{if(!h.isBuffer(a))return b.error("Unsupported type: "+typeof a);this.value=a,this.length=a.length}}var f=a("inherits"),g=a("../base").Reporter,h=a("buffer").Buffer;f(d,g),c.DecoderBuffer=d,d.prototype.save=function(){return{offset:this.offset,reporter:g.prototype.save.call(this)}},d.prototype.restore=function(a){var b=new d(this.base);return b.offset=a.offset,b.length=this.offset,this.offset=a.offset,g.prototype.restore.call(this,a.reporter),b},d.prototype.isEmpty=function(){return this.offset===this.length},d.prototype.readUInt8=function(a){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(a||"DecoderBuffer overrun")},d.prototype.skip=function(a,b){if(!(this.offset+a<=this.length))return this.error(b||"DecoderBuffer overrun");var c=new d(this.base);return c._reporterState=this._reporterState,c.offset=this.offset,c.length=this.offset+a,this.offset+=a,c},d.prototype.raw=function(a){return this.base.slice(a?a.offset:this.offset,this.length)},c.EncoderBuffer=e,e.prototype.join=function(a,b){return a||(a=new h(this.length)),b||(b=0),0===this.length?a:(Array.isArray(this.value)?this.value.forEach(function(c){c.join(a,b),b+=c.length}):("number"==typeof this.value?a[b]=this.value:"string"==typeof this.value?a.write(this.value,b):h.isBuffer(this.value)&&this.value.copy(a,b),b+=this.length),a)}},{"../base":18,buffer:187,inherits:251}],18:[function(a,b,c){var d=c;d.Reporter=a("./reporter").Reporter,d.DecoderBuffer=a("./buffer").DecoderBuffer,d.EncoderBuffer=a("./buffer").EncoderBuffer,d.Node=a("./node")},{"./buffer":17,"./node":19,"./reporter":20}],19:[function(a,b,c){function d(a,b){var c={};this._baseState=c,c.enc=a,c.parent=b||null,c.children=null,c.tag=null,c.args=null,c.reverseArgs=null,c.choice=null,c.optional=!1,c.any=!1,c.obj=!1,c.use=null,c.useDecoder=null,c.key=null,c["default"]=null,c.explicit=null,c.implicit=null,c.contains=null,c.parent||(c.children=[],this._wrap())}var e=a("../base").Reporter,f=a("../base").EncoderBuffer,g=a("../base").DecoderBuffer,h=a("minimalistic-assert"),i=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],j=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(i),k=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];b.exports=d;var l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];d.prototype.clone=function(){var a=this._baseState,b={};l.forEach(function(c){b[c]=a[c]});var c=new this.constructor(b.parent);return c._baseState=b,c},d.prototype._wrap=function(){var a=this._baseState;j.forEach(function(b){this[b]=function(){var c=new this.constructor(this);return a.children.push(c),c[b].apply(c,arguments)}},this)},d.prototype._init=function(a){var b=this._baseState;h(null===b.parent),a.call(this),b.children=b.children.filter(function(a){return a._baseState.parent===this},this),h.equal(b.children.length,1,"Root node can have only one child")},d.prototype._useArgs=function(a){var b=this._baseState,c=a.filter(function(a){return a instanceof this.constructor},this);a=a.filter(function(a){return!(a instanceof this.constructor)},this),0!==c.length&&(h(null===b.children),b.children=c,c.forEach(function(a){a._baseState.parent=this},this)),0!==a.length&&(h(null===b.args),b.args=a,b.reverseArgs=a.map(function(a){if("object"!=typeof a||a.constructor!==Object)return a;var b={};return Object.keys(a).forEach(function(c){c==(0|c)&&(c|=0);var d=a[c];b[d]=c}),b}))},k.forEach(function(a){d.prototype[a]=function(){var b=this._baseState;throw new Error(a+" not implemented for encoding: "+b.enc)}}),i.forEach(function(a){d.prototype[a]=function(){var b=this._baseState,c=Array.prototype.slice.call(arguments);return h(null===b.tag),b.tag=a,this._useArgs(c),this}}),d.prototype.use=function(a){h(a);var b=this._baseState;return h(null===b.use),b.use=a,this},d.prototype.optional=function(){var a=this._baseState;return a.optional=!0,this},d.prototype.def=function(a){var b=this._baseState;return h(null===b["default"]),b["default"]=a,b.optional=!0,this},d.prototype.explicit=function(a){var b=this._baseState;return h(null===b.explicit&&null===b.implicit),b.explicit=a,this},d.prototype.implicit=function(a){var b=this._baseState;return h(null===b.explicit&&null===b.implicit),b.implicit=a,this},d.prototype.obj=function(){var a=this._baseState,b=Array.prototype.slice.call(arguments);return a.obj=!0,0!==b.length&&this._useArgs(b),this},d.prototype.key=function(a){var b=this._baseState;return h(null===b.key),b.key=a,this},d.prototype.any=function(){var a=this._baseState;return a.any=!0,this},d.prototype.choice=function(a){var b=this._baseState;return h(null===b.choice),b.choice=a,this._useArgs(Object.keys(a).map(function(b){return a[b]})),this},d.prototype.contains=function(a){var b=this._baseState;return h(null===b.use),b.contains=a,this},d.prototype._decode=function(a,b){var c=this._baseState;if(null===c.parent)return a.wrapResult(c.children[0]._decode(a,b));var d=c["default"],e=!0,f=null;if(null!==c.key&&(f=a.enterKey(c.key)),c.optional){var h=null;if(null!==c.explicit?h=c.explicit:null!==c.implicit?h=c.implicit:null!==c.tag&&(h=c.tag),null!==h||c.any){if(e=this._peekTag(a,h,c.any),a.isError(e))return e}else{var i=a.save();try{null===c.choice?this._decodeGeneric(c.tag,a,b):this._decodeChoice(a,b),e=!0}catch(j){e=!1}a.restore(i)}}var k;if(c.obj&&e&&(k=a.enterObject()),e){if(null!==c.explicit){var l=this._decodeTag(a,c.explicit);if(a.isError(l))return l;a=l}var m=a.offset;if(null===c.use&&null===c.choice){if(c.any)var i=a.save();var n=this._decodeTag(a,null!==c.implicit?c.implicit:c.tag,c.any);if(a.isError(n))return n;c.any?d=a.raw(i):a=n}if(b&&b.track&&null!==c.tag&&b.track(a.path(),m,a.length,"tagged"),b&&b.track&&null!==c.tag&&b.track(a.path(),a.offset,a.length,"content"),d=c.any?d:null===c.choice?this._decodeGeneric(c.tag,a,b):this._decodeChoice(a,b),a.isError(d))return d;if(c.any||null!==c.choice||null===c.children||c.children.forEach(function(c){c._decode(a,b)}),c.contains&&("octstr"===c.tag||"bitstr"===c.tag)){var o=new g(d);d=this._getUse(c.contains,a._reporterState.obj)._decode(o,b)}}return c.obj&&e&&(d=a.leaveObject(k)),null===c.key||null===d&&e!==!0?null!==f&&a.exitKey(f):a.leaveKey(f,c.key,d),d},d.prototype._decodeGeneric=function(a,b,c){var d=this._baseState;return"seq"===a||"set"===a?null:"seqof"===a||"setof"===a?this._decodeList(b,a,d.args[0],c):/str$/.test(a)?this._decodeStr(b,a,c):"objid"===a&&d.args?this._decodeObjid(b,d.args[0],d.args[1],c):"objid"===a?this._decodeObjid(b,null,null,c):"gentime"===a||"utctime"===a?this._decodeTime(b,a,c):"null_"===a?this._decodeNull(b,c):"bool"===a?this._decodeBool(b,c):"objDesc"===a?this._decodeStr(b,a,c):"int"===a||"enum"===a?this._decodeInt(b,d.args&&d.args[0],c):null!==d.use?this._getUse(d.use,b._reporterState.obj)._decode(b,c):b.error("unknown tag: "+a)},d.prototype._getUse=function(a,b){var c=this._baseState;return c.useDecoder=this._use(a,b),h(null===c.useDecoder._baseState.parent),c.useDecoder=c.useDecoder._baseState.children[0],c.implicit!==c.useDecoder._baseState.implicit&&(c.useDecoder=c.useDecoder.clone(),c.useDecoder._baseState.implicit=c.implicit),c.useDecoder},d.prototype._decodeChoice=function(a,b){var c=this._baseState,d=null,e=!1;return Object.keys(c.choice).some(function(f){var g=a.save(),h=c.choice[f];try{var i=h._decode(a,b);if(a.isError(i))return!1;d={type:f,value:i},e=!0}catch(j){return a.restore(g),!1}return!0},this),e?d:a.error("Choice not matched")},d.prototype._createEncoderBuffer=function(a){return new f(a,this.reporter)},d.prototype._encode=function(a,b,c){var d=this._baseState;if(null===d["default"]||d["default"]!==a){var e=this._encodeValue(a,b,c);if(void 0!==e&&!this._skipDefault(e,b,c))return e}},d.prototype._encodeValue=function(a,b,c){var d=this._baseState;if(null===d.parent)return d.children[0]._encode(a,b||new e);var f=null;if(this.reporter=b,d.optional&&void 0===a){if(null===d["default"])return;a=d["default"]}var g=null,h=!1;if(d.any)f=this._createEncoderBuffer(a);else if(d.choice)f=this._encodeChoice(a,b);else if(d.contains)g=this._getUse(d.contains,c)._encode(a,b),h=!0;else if(d.children)g=d.children.map(function(c){if("null_"===c._baseState.tag)return c._encode(null,b,a);if(null===c._baseState.key)return b.error("Child should have a key");var d=b.enterKey(c._baseState.key);if("object"!=typeof a)return b.error("Child expected, but input is not object");var e=c._encode(a[c._baseState.key],b,a);return b.leaveKey(d),e},this).filter(function(a){return a}),g=this._createEncoderBuffer(g);else if("seqof"===d.tag||"setof"===d.tag){if(!d.args||1!==d.args.length)return b.error("Too many args for : "+d.tag);if(!Array.isArray(a))return b.error("seqof/setof, but data is not Array");var i=this.clone();i._baseState.implicit=null,g=this._createEncoderBuffer(a.map(function(c){var d=this._baseState;return this._getUse(d.args[0],a)._encode(c,b)},i))}else null!==d.use?f=this._getUse(d.use,c)._encode(a,b):(g=this._encodePrimitive(d.tag,a),h=!0);var f;if(!d.any&&null===d.choice){var j=null!==d.implicit?d.implicit:d.tag,k=null===d.implicit?"universal":"context";null===j?null===d.use&&b.error("Tag could be ommited only for .use()"):null===d.use&&(f=this._encodeComposite(j,h,k,g))}return null!==d.explicit&&(f=this._encodeComposite(d.explicit,!1,"context",f)),f},d.prototype._encodeChoice=function(a,b){var c=this._baseState,d=c.choice[a.type];return d||h(!1,a.type+" not found in "+JSON.stringify(Object.keys(c.choice))),d._encode(a.value,b)},d.prototype._encodePrimitive=function(a,b){var c=this._baseState;if(/str$/.test(a))return this._encodeStr(b,a);if("objid"===a&&c.args)return this._encodeObjid(b,c.reverseArgs[0],c.args[1]);if("objid"===a)return this._encodeObjid(b,null,null);if("gentime"===a||"utctime"===a)return this._encodeTime(b,a);if("null_"===a)return this._encodeNull();if("int"===a||"enum"===a)return this._encodeInt(b,c.args&&c.reverseArgs[0]);if("bool"===a)return this._encodeBool(b);if("objDesc"===a)return this._encodeStr(b,a);throw new Error("Unsupported tag: "+a)},d.prototype._isNumstr=function(a){return/^[0-9 ]*$/.test(a)},d.prototype._isPrintstr=function(a){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(a)}},{"../base":18,"minimalistic-assert":264}],20:[function(a,b,c){function d(a){this._reporterState={obj:null,path:[],options:a||{},errors:[]}}function e(a,b){this.path=a,this.rethrow(b)}var f=a("inherits");c.Reporter=d,d.prototype.isError=function(a){return a instanceof e},d.prototype.save=function(){var a=this._reporterState;return{obj:a.obj,pathLen:a.path.length}},d.prototype.restore=function(a){var b=this._reporterState;b.obj=a.obj,b.path=b.path.slice(0,a.pathLen)},d.prototype.enterKey=function(a){return this._reporterState.path.push(a)},d.prototype.exitKey=function(a){var b=this._reporterState;b.path=b.path.slice(0,a-1)},d.prototype.leaveKey=function(a,b,c){var d=this._reporterState;this.exitKey(a),null!==d.obj&&(d.obj[b]=c)},d.prototype.path=function(){return this._reporterState.path.join("/")},d.prototype.enterObject=function(){var a=this._reporterState,b=a.obj;return a.obj={},b},d.prototype.leaveObject=function(a){var b=this._reporterState,c=b.obj;return b.obj=a,c},d.prototype.error=function(a){var b,c=this._reporterState,d=a instanceof e;if(b=d?a:new e(c.path.map(function(a){return"["+JSON.stringify(a)+"]"}).join(""),a.message||a,a.stack),!c.options.partial)throw b;return d||c.errors.push(b),b},d.prototype.wrapResult=function(a){var b=this._reporterState;return b.options.partial?{result:this.isError(a)?null:a,errors:b.errors}:a},f(e,Error),e.prototype.rethrow=function(a){if(this.message=a+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,e),!this.stack)try{throw new Error(this.message)}catch(b){this.stack=b.stack}return this}},{inherits:251}],21:[function(a,b,c){var d=a("../constants");c.tagClass={0:"universal",1:"application",2:"context",3:"private"},c.tagClassByName=d._reverse(c.tagClass),c.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},c.tagByName=d._reverse(c.tag)},{"../constants":22}],22:[function(a,b,c){var d=c;d._reverse=function(a){var b={};return Object.keys(a).forEach(function(c){(0|c)==c&&(c=0|c);var d=a[c];b[d]=c}),b},d.der=a("./der")},{"./der":21}],23:[function(a,b,c){function d(a){this.enc="der",this.name=a.name,this.entity=a,this.tree=new e,this.tree._init(a.body)}function e(a){j.Node.call(this,"der",a)}function f(a,b){var c=a.readUInt8(b);if(a.isError(c))return c;var d=l.tagClass[c>>6],e=0===(32&c);if(31===(31&c)){var f=c;for(c=0;128===(128&f);){if(f=a.readUInt8(b),a.isError(f))return f;c<<=7,c|=127&f}}else c&=31;var g=l.tag[c];return{cls:d,primitive:e,tag:c,tagStr:g}}function g(a,b,c){var d=a.readUInt8(c);if(a.isError(d))return d;if(!b&&128===d)return null;if(0===(128&d))return d;var e=127&d;if(e>4)return a.error("length octect is too long");d=0;for(var f=0;e>f;f++){d<<=8;var g=a.readUInt8(c);if(a.isError(g))return g;d|=g}return d}var h=a("inherits"),i=a("../../asn1"),j=i.base,k=i.bignum,l=i.constants.der;b.exports=d,d.prototype.decode=function(a,b){return a instanceof j.DecoderBuffer||(a=new j.DecoderBuffer(a,b)),this.tree._decode(a,b)},h(e,j.Node),e.prototype._peekTag=function(a,b,c){if(a.isEmpty())return!1;var d=a.save(),e=f(a,'Failed to peek tag: "'+b+'"');return a.isError(e)?e:(a.restore(d),e.tag===b||e.tagStr===b||e.tagStr+"of"===b||c)},e.prototype._decodeTag=function(a,b,c){var d=f(a,'Failed to decode tag of "'+b+'"');if(a.isError(d))return d;var e=g(a,d.primitive,'Failed to get length of "'+b+'"');if(a.isError(e))return e;if(!c&&d.tag!==b&&d.tagStr!==b&&d.tagStr+"of"!==b)return a.error('Failed to match tag: "'+b+'"');if(d.primitive||null!==e)return a.skip(e,'Failed to match body of: "'+b+'"');var h=a.save(),i=this._skipUntilEnd(a,'Failed to skip indefinite length body: "'+this.tag+'"');return a.isError(i)?i:(e=a.offset-h.offset,a.restore(h),a.skip(e,'Failed to match body of: "'+b+'"'))},e.prototype._skipUntilEnd=function(a,b){for(;;){var c=f(a,b);if(a.isError(c))return c;var d=g(a,c.primitive,b);if(a.isError(d))return d;var e;if(e=c.primitive||null!==d?a.skip(d):this._skipUntilEnd(a,b),a.isError(e))return e;if("end"===c.tagStr)break}},e.prototype._decodeList=function(a,b,c,d){for(var e=[];!a.isEmpty();){var f=this._peekTag(a,"end");if(a.isError(f))return f;var g=c.decode(a,"der",d);if(a.isError(g)&&f)break;e.push(g)}return e},e.prototype._decodeStr=function(a,b){if("bitstr"===b){var c=a.readUInt8();return a.isError(c)?c:{unused:c,data:a.raw()}}if("bmpstr"===b){var d=a.raw();if(d.length%2===1)return a.error("Decoding of string type: bmpstr length mismatch");for(var e="",f=0;fd?2e3+d:1900+d}return Date.UTC(d,e-1,f,g,h,i,0)},e.prototype._decodeNull=function(a){return null},e.prototype._decodeBool=function(a){var b=a.readUInt8();return a.isError(b)?b:0!==b},e.prototype._decodeInt=function(a,b){var c=a.raw(),d=new k(c);return b&&(d=b[d.toString(10)]||d),d},e.prototype._use=function(a,b){return"function"==typeof a&&(a=a(b)),a._getDecoder("der").tree}},{"../../asn1":15,inherits:251}],24:[function(a,b,c){var d=c;d.der=a("./der"),d.pem=a("./pem")},{"./der":23,"./pem":25}],25:[function(a,b,c){function d(a){g.call(this,a),this.enc="pem"}var e=a("inherits"),f=a("buffer").Buffer,g=a("./der");e(d,g),b.exports=d,d.prototype.decode=function(a,b){for(var c=a.toString().split(/[\r\n]+/g),d=b.label.toUpperCase(),e=/^-----(BEGIN|END) ([^-]+)-----$/,h=-1,i=-1,j=0;ja?"0"+a:a}function g(a,b,c,d){var e;if("seqof"===a?a="seq":"setof"===a&&(a="set"),l.tagByName.hasOwnProperty(a))e=l.tagByName[a];else{if("number"!=typeof a||(0|a)!==a)return d.error("Unknown tag: "+a);e=a}return e>=31?d.error("Multi-octet tag encoding unsupported"):(b||(e|=32),e|=l.tagClassByName[c||"universal"]<<6)}var h=a("inherits"),i=a("buffer").Buffer,j=a("../../asn1"),k=j.base,l=j.constants.der;b.exports=d,d.prototype.encode=function(a,b){return this.tree._encode(a,b).join()},h(e,k.Node),e.prototype._encodeComposite=function(a,b,c,d){var e=g(a,b,c,this.reporter);if(d.length<128){var f=new i(2);return f[0]=e,f[1]=d.length,this._createEncoderBuffer([f,d])}for(var h=1,j=d.length;j>=256;j>>=8)h++;var f=new i(2+h);f[0]=e,f[1]=128|h;for(var j=1+h,k=d.length;k>0;j--,k>>=8)f[j]=255&k;return this._createEncoderBuffer([f,d])},e.prototype._encodeStr=function(a,b){if("bitstr"===b)return this._createEncoderBuffer([0|a.unused,a.data]);if("bmpstr"===b){for(var c=new i(2*a.length),d=0;d=40)return this.reporter.error("Second objid identifier OOB");a.splice(0,2,40*a[0]+a[1])}for(var e=0,d=0;d=128;f>>=7)e++; -}for(var g=new i(e),h=g.length-1,d=a.length-1;d>=0;d--){var f=a[d];for(g[h--]=127&f;(f>>=7)>0;)g[h--]=128|127&f}return this._createEncoderBuffer(g)},e.prototype._encodeTime=function(a,b){var c,d=new Date(a);return"gentime"===b?c=[f(d.getFullYear()),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):"utctime"===b?c=[f(d.getFullYear()%100),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+b+" time is not supported yet"),this._encodeStr(c,"octstr")},e.prototype._encodeNull=function(){return this._createEncoderBuffer("")},e.prototype._encodeInt=function(a,b){if("string"==typeof a){if(!b)return this.reporter.error("String int or enum given, but no values map");if(!b.hasOwnProperty(a))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(a));a=b[a]}if("number"!=typeof a&&!i.isBuffer(a)){var c=a.toArray();!a.sign&&128&c[0]&&c.unshift(0),a=new i(c)}if(i.isBuffer(a)){var d=a.length;0===a.length&&d++;var e=new i(d);return a.copy(e),0===a.length&&(e[0]=0),this._createEncoderBuffer(e)}if(128>a)return this._createEncoderBuffer(a);if(256>a)return this._createEncoderBuffer([0,a]);for(var d=1,f=a;f>=256;f>>=8)d++;for(var e=new Array(d),f=e.length-1;f>=0;f--)e[f]=255&a,a>>=8;return 128&e[0]&&e.unshift(0),this._createEncoderBuffer(new i(e))},e.prototype._encodeBool=function(a){return this._createEncoderBuffer(a?255:0)},e.prototype._use=function(a,b){return"function"==typeof a&&(a=a(b)),a._getEncoder("der").tree},e.prototype._skipDefault=function(a,b,c){var d,e=this._baseState;if(null===e["default"])return!1;var f=a.join();if(void 0===e.defaultBuffer&&(e.defaultBuffer=this._encodeValue(e["default"],b,c).join()),f.length!==e.defaultBuffer.length)return!1;for(d=0;de;++e)if(a[e]!==b[e]){c=a[e],d=b[e];break}return d>c?-1:c>d?1:0}function e(a){return c.Buffer&&"function"==typeof c.Buffer.isBuffer?c.Buffer.isBuffer(a):!(null==a||!a._isBuffer)}function f(a){return Object.prototype.toString.call(a)}function g(a){return e(a)?!1:"function"!=typeof c.ArrayBuffer?!1:"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(a):a?a instanceof DataView?!0:a.buffer&&a.buffer instanceof ArrayBuffer?!0:!1:!1}function h(a){if(u.isFunction(a)){if(x)return a.name;var b=a.toString(),c=b.match(z);return c&&c[1]}}function i(a,b){return"string"==typeof a?a.length=0;h--)if(i[h]!==j[h])return!1;for(h=i.length-1;h>=0;h--)if(g=i[h],!n(a[g],b[g],c,d))return!1;return!0}function q(a,b,c){n(a,b,!0)&&l(a,b,c,"notDeepStrictEqual",q)}function r(a,b){if(!a||!b)return!1;if("[object RegExp]"==Object.prototype.toString.call(b))return b.test(a);try{if(a instanceof b)return!0}catch(c){}return Error.isPrototypeOf(b)?!1:b.call({},a)===!0}function s(a){var b;try{a()}catch(c){b=c}return b}function t(a,b,c,d){var e;if("function"!=typeof b)throw new TypeError('"block" argument must be a function');"string"==typeof c&&(d=c,c=null),e=s(b),d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&l(e,c,"Missing expected exception"+d);var f="string"==typeof d,g=!a&&u.isError(e),h=!a&&e&&!c;if((g&&f&&r(e,c)||h)&&l(e,c,"Got unwanted exception"+d),a&&e&&c&&!r(e,c)||!a&&e)throw e}var u=a("util/"),v=Object.prototype.hasOwnProperty,w=Array.prototype.slice,x=function(){return"foo"===function(){}.name}(),y=b.exports=m,z=/\s*function\s+([^\(\s]*)\s*/;y.AssertionError=function(a){this.name="AssertionError",this.actual=a.actual,this.expected=a.expected,this.operator=a.operator,a.message?(this.message=a.message,this.generatedMessage=!1):(this.message=k(this),this.generatedMessage=!0);var b=a.stackStartFunction||l;if(Error.captureStackTrace)Error.captureStackTrace(this,b);else{var c=new Error;if(c.stack){var d=c.stack,e=h(b),f=d.indexOf("\n"+e);if(f>=0){var g=d.indexOf("\n",f+1);d=d.substring(g+1)}this.stack=d}}},u.inherits(y.AssertionError,Error),y.fail=l,y.ok=m,y.equal=function(a,b,c){a!=b&&l(a,b,c,"==",y.equal)},y.notEqual=function(a,b,c){a==b&&l(a,b,c,"!=",y.notEqual)},y.deepEqual=function(a,b,c){n(a,b,!1)||l(a,b,c,"deepEqual",y.deepEqual)},y.deepStrictEqual=function(a,b,c){n(a,b,!0)||l(a,b,c,"deepStrictEqual",y.deepStrictEqual)},y.notDeepEqual=function(a,b,c){n(a,b,!1)&&l(a,b,c,"notDeepEqual",y.notDeepEqual)},y.notDeepStrictEqual=q,y.strictEqual=function(a,b,c){a!==b&&l(a,b,c,"===",y.strictEqual)},y.notStrictEqual=function(a,b,c){a===b&&l(a,b,c,"!==",y.notStrictEqual)},y["throws"]=function(a,b,c){t(!0,a,b,c)},y.doesNotThrow=function(a,b,c){t(!1,a,b,c)},y.ifError=function(a){if(a)throw a};var A=Object.keys||function(a){var b=[];for(var c in a)v.call(a,c)&&b.push(c);return b}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":340}],30:[function(a,b,c){(function(a){!function(){function c(a){var b=!1;return function(){if(b)throw new Error("Callback was already called.");b=!0,a.apply(d,arguments)}}var d,e,f={};d=this,null!=d&&(e=d.async),f.noConflict=function(){return d.async=e,f};var g=Object.prototype.toString,h=Array.isArray||function(a){return"[object Array]"===g.call(a)},i=function(a,b){for(var c=0;c=a.length&&d())}if(d=d||function(){},!a.length)return d();var f=0;i(a,function(a){b(a,c(e))})},f.forEach=f.each,f.eachSeries=function(a,b,c){if(c=c||function(){},!a.length)return c();var d=0,e=function(){b(a[d],function(b){b?(c(b),c=function(){}):(d+=1,d>=a.length?c():e())})};e()},f.forEachSeries=f.eachSeries,f.eachLimit=function(a,b,c,d){var e=m(b);e.apply(null,[a,c,d])},f.forEachLimit=f.eachLimit;var m=function(a){return function(b,c,d){if(d=d||function(){},!b.length||0>=a)return d();var e=0,f=0,g=0;!function h(){if(e>=b.length)return d();for(;a>g&&f=b.length?d():h())})}()}},n=function(a){return function(){var b=Array.prototype.slice.call(arguments);return a.apply(null,[f.each].concat(b))}},o=function(a,b){return function(){var c=Array.prototype.slice.call(arguments);return b.apply(null,[m(a)].concat(c))}},p=function(a){return function(){var b=Array.prototype.slice.call(arguments);return a.apply(null,[f.eachSeries].concat(b))}},q=function(a,b,c,d){if(b=j(b,function(a,b){return{index:b,value:a}}),d){var e=[];a(b,function(a,b){c(a.value,function(c,d){e[a.index]=d,b(c)})},function(a){d(a,e)})}else a(b,function(a,b){c(a.value,function(a){b(a)})})};f.map=n(q),f.mapSeries=p(q),f.mapLimit=function(a,b,c,d){return r(b)(a,c,d)};var r=function(a){return o(a,q)};f.reduce=function(a,b,c,d){f.eachSeries(a,function(a,d){c(b,a,function(a,c){b=c,d(a)})},function(a){d(a,b)})},f.inject=f.reduce,f.foldl=f.reduce,f.reduceRight=function(a,b,c,d){var e=j(a,function(a){return a}).reverse();f.reduce(e,b,c,d)},f.foldr=f.reduceRight;var s=function(a,b,c,d){var e=[];b=j(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c&&e.push(a),b()})},function(a){d(j(e.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};f.filter=n(s),f.filterSeries=p(s),f.select=f.filter,f.selectSeries=f.filterSeries;var t=function(a,b,c,d){var e=[];b=j(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c||e.push(a),b()})},function(a){d(j(e.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};f.reject=n(t),f.rejectSeries=p(t);var u=function(a,b,c,d){a(b,function(a,b){c(a,function(c){c?(d(a),d=function(){}):b()})},function(a){d()})};f.detect=n(u),f.detectSeries=p(u),f.some=function(a,b,c){f.each(a,function(a,d){b(a,function(a){a&&(c(!0),c=function(){}),d()})},function(a){c(!1)})},f.any=f.some,f.every=function(a,b,c){f.each(a,function(a,d){b(a,function(a){a||(c(!1),c=function(){}),d()})},function(a){c(!0)})},f.all=f.every,f.sortBy=function(a,b,c){f.map(a,function(a,c){b(a,function(b,d){b?c(b):c(null,{value:a,criteria:d})})},function(a,b){if(a)return c(a);var d=function(a,b){var c=a.criteria,d=b.criteria;return d>c?-1:c>d?1:0};c(null,j(b.sort(d),function(a){return a.value}))})},f.auto=function(a,b){b=b||function(){};var c=l(a),d=c.length;if(!d)return b();var e={},g=[],j=function(a){g.unshift(a)},m=function(a){for(var b=0;bd;){var f=d+(e-d+1>>>1);c(b,a[f])>=0?d=f:e=f-1}return d}function e(a,b,e,g){return a.started||(a.started=!0),h(b)||(b=[b]),0==b.length?f.setImmediate(function(){a.drain&&a.drain()}):void i(b,function(b){var h={data:b,priority:e,callback:"function"==typeof g?g:null};a.tasks.splice(d(a.tasks,h,c)+1,0,h),a.saturated&&a.tasks.length===a.concurrency&&a.saturated(),f.setImmediate(a.process)})}var g=f.queue(a,b);return g.push=function(a,b,c){e(g,a,b,c)},delete g.unshift,g},f.cargo=function(a,b){var c=!1,d=[],e={tasks:d,payload:b,saturated:null,empty:null,drain:null,drained:!0,push:function(a,c){h(a)||(a=[a]),i(a,function(a){d.push({data:a,callback:"function"==typeof c?c:null}),e.drained=!1,e.saturated&&d.length===b&&e.saturated()}),f.setImmediate(e.process)},process:function g(){if(!c){if(0===d.length)return e.drain&&!e.drained&&e.drain(),void(e.drained=!0);var f="number"==typeof b?d.splice(0,b):d.splice(0,d.length),h=j(f,function(a){return a.data});e.empty&&e.empty(),c=!0,a(h,function(){c=!1;var a=arguments;i(f,function(b){b.callback&&b.callback.apply(null,a)}),g()})}},length:function(){return d.length},running:function(){return c}};return e};var x=function(a){return function(b){var c=Array.prototype.slice.call(arguments,1);b.apply(null,c.concat([function(b){var c=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(b?console.error&&console.error(b):console[a]&&i(c,function(b){console[a](b)}))}]))}};f.log=x("log"),f.dir=x("dir"),f.memoize=function(a,b){var c={},d={};b=b||function(a){return a};var e=function(){var e=Array.prototype.slice.call(arguments),g=e.pop(),h=b.apply(null,e);h in c?f.nextTick(function(){g.apply(null,c[h])}):h in d?d[h].push(g):(d[h]=[g],a.apply(null,e.concat([function(){c[h]=arguments;var a=d[h];delete d[h];for(var b=0,e=a.length;e>b;b++)a[b].apply(null,arguments)}])))};return e.memo=c,e.unmemoized=a,e},f.unmemoize=function(a){return function(){return(a.unmemoized||a).apply(null,arguments)}},f.times=function(a,b,c){for(var d=[],e=0;a>e;e++)d.push(e);return f.map(d,b,c)},f.timesSeries=function(a,b,c){for(var d=[],e=0;a>e;e++)d.push(e);return f.mapSeries(d,b,c)},f.seq=function(){var a=arguments;return function(){var b=this,c=Array.prototype.slice.call(arguments),d=c.pop();f.reduce(a,c,function(a,c,d){c.apply(b,a.concat([function(){var a=arguments[0],b=Array.prototype.slice.call(arguments,1);d(a,b)}]))},function(a,c){d.apply(b,[a].concat(c))})}},f.compose=function(){return f.seq.apply(null,Array.prototype.reverse.call(arguments))};var y=function(a,b){var c=function(){var c=this,d=Array.prototype.slice.call(arguments),e=d.pop();return a(b,function(a,b){a.apply(c,d.concat([b]))},e)};if(arguments.length>2){var d=Array.prototype.slice.call(arguments,2);return c.apply(this,d)}return c};f.applyEach=n(y),f.applyEachSeries=p(y),f.forever=function(a,b){function c(d){if(d){if(b)return b(d);throw d}a(c)}c()},"undefined"!=typeof b&&b.exports?b.exports=f:"undefined"!=typeof define&&define.amd?define([],function(){return f}):d.async=f}()}).call(this,a("_process"))},{_process:282}],31:[function(a,b,c){var d=a("safe-buffer").Buffer;b.exports=function(a){function b(b){if(0===b.length)return"";for(var c=[0],d=0;d0;)c.push(f%g),f=f/g|0}for(var i="",j=0;0===b[j]&&j=0;--k)i+=a[c[k]];return i}function c(a){if("string"!=typeof a)throw new TypeError("Expected String");if(0===a.length)return d.allocUnsafe(0);for(var b=[0],c=0;c>=8;for(;j>0;)b.push(255&j),j>>=8}for(var k=0;a[k]===h&&k0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===a[b-2]?2:"="===a[b-1]?1:0}function e(a){return 3*a.length/4-d(a)}function f(a){var b,c,e,f,g,h=a.length;f=d(a),g=new l(3*h/4-f),c=f>0?h-4:h;var i=0;for(b=0;c>b;b+=4)e=k[a.charCodeAt(b)]<<18|k[a.charCodeAt(b+1)]<<12|k[a.charCodeAt(b+2)]<<6|k[a.charCodeAt(b+3)],g[i++]=e>>16&255,g[i++]=e>>8&255,g[i++]=255&e;return 2===f?(e=k[a.charCodeAt(b)]<<2|k[a.charCodeAt(b+1)]>>4,g[i++]=255&e):1===f&&(e=k[a.charCodeAt(b)]<<10|k[a.charCodeAt(b+1)]<<4|k[a.charCodeAt(b+2)]>>2,g[i++]=e>>8&255,g[i++]=255&e),g}function g(a){return j[a>>18&63]+j[a>>12&63]+j[a>>6&63]+j[63&a]}function h(a,b,c){for(var d,e=[],f=b;c>f;f+=3)d=(a[f]<<16&16711680)+(a[f+1]<<8&65280)+(255&a[f+2]),e.push(g(d));return e.join("")}function i(a){for(var b,c=a.length,d=c%3,e="",f=[],g=16383,i=0,k=c-d;k>i;i+=g)f.push(h(a,i,i+g>k?k:i+g));return 1===d?(b=a[c-1],e+=j[b>>2],e+=j[b<<4&63],e+="=="):2===d&&(b=(a[c-2]<<8)+a[c-1],e+=j[b>>10],e+=j[b>>4&63],e+=j[b<<2&63],e+="="),f.push(e),f.join("")}c.byteLength=e,c.toByteArray=f,c.fromByteArray=i;for(var j=[],k=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=m.length;o>n;++n)j[n]=m[n],k[m.charCodeAt(n)]=n;k["-".charCodeAt(0)]=62,k["_".charCodeAt(0)]=63},{}],33:[function(a,b,c){function d(a,b,c){return this instanceof d?void(null!=a&&("number"==typeof a?this.fromNumber(a,b,c):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))):new d(a,b,c)}function e(a,b,c,d,e,f){for(;--f>=0;){var g=b*this[a++]+c[d]+e;e=Math.floor(g/67108864),c[d++]=67108863&g}return e}function f(a){return fb.charAt(a)}function g(a,b){var c=gb[a.charCodeAt(b)];return null==c?-1:c}function h(a){for(var b=this.t-1;b>=0;--b)a[b]=this[b];a.t=this.t,a.s=this.s}function i(a){this.t=1,this.s=0>a?-1:0,a>0?this[0]=a:-1>a?this[0]=a+bb:this.t=0}function j(a){var b=new d;return b.fromInt(a),b}function k(a,b){var c,e=this;if(16==b)c=4;else if(8==b)c=3;else if(256==b)c=8;else if(2==b)c=1;else if(32==b)c=5;else{if(4!=b)return void e.fromRadix(a,b);c=2}e.t=0,e.s=0;for(var f=a.length,h=!1,i=0;--f>=0;){var j=8==c?255&a[f]:g(a,f);0>j?"-"==a.charAt(f)&&(h=!0):(h=!1,0==i?e[e.t++]=j:i+c>e.DB?(e[e.t-1]|=(j&(1<>e.DB-i):e[e.t-1]|=j<=e.DB&&(i-=e.DB))}8==c&&0!=(128&a[0])&&(e.s=-1,i>0&&(e[e.t-1]|=(1<0&&this[this.t-1]==a;)--this.t}function m(a){var b=this;if(b.s<0)return"-"+b.negate().toString(a);var c;if(16==a)c=4;else if(8==a)c=3;else if(2==a)c=1;else if(32==a)c=5;else{if(4!=a)return b.toRadix(a);c=2}var d,e=(1<0)for(j>j)>0&&(g=!0,h=f(d));i>=0;)c>j?(d=(b[i]&(1<>(j+=b.DB-c)):(d=b[i]>>(j-=c)&e,0>=j&&(j+=b.DB,--i)),d>0&&(g=!0),g&&(h+=f(d));return g?h:"0"}function n(){var a=new d;return d.ZERO.subTo(this,a),a}function o(){return this.s<0?this.negate():this}function p(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t;if(b=c-a.t,0!=b)return this.s<0?-b:b;for(;--c>=0;)if(0!=(b=this[c]-a[c]))return b;return 0}function q(a){var b,c=1;return 0!=(b=a>>>16)&&(a=b,c+=16),0!=(b=a>>8)&&(a=b,c+=8),0!=(b=a>>4)&&(a=b,c+=4),0!=(b=a>>2)&&(a=b,c+=2),0!=(b=a>>1)&&(a=b,c+=1),c}function r(){return this.t<=0?0:this.DB*(this.t-1)+q(this[this.t-1]^this.s&this.DM)}function s(){return this.bitLength()>>3}function t(a,b){var c;for(c=this.t-1;c>=0;--c)b[c+a]=this[c];for(c=a-1;c>=0;--c)b[c]=0;b.t=this.t+a,b.s=this.s}function u(a,b){for(var c=a;c=0;--c)b[c+h+1]=d[c]>>f|i,i=(d[c]&g)<=0;--c)b[c]=0;b[h]=i,b.t=d.t+h+1,b.s=d.s,b.clamp()}function w(a,b){var c=this;b.s=c.s;var d=Math.floor(a/c.DB);if(d>=c.t)return void(b.t=0);var e=a%c.DB,f=c.DB-e,g=(1<>e;for(var h=d+1;h>e;e>0&&(b[c.t-d-1]|=(c.s&g)<d;)e+=c[d]-a[d],b[d++]=e&c.DM,e>>=c.DB;if(a.t>=c.DB;e+=c.s}else{for(e+=c.s;d>=c.DB;e-=a.s}b.s=0>e?-1:0,-1>e?b[d++]=c.DV+e:e>0&&(b[d++]=e),b.t=d,b.clamp()}function y(a,b){var c=this.abs(),e=a.abs(),f=c.t;for(b.t=f+e.t;--f>=0;)b[f]=0;for(f=0;f=0;)a[c]=0;for(c=0;c=b.DV&&(a[c+b.t]-=b.DV,a[c+b.t+1]=1)}a.t>0&&(a[a.t-1]+=b.am(c,b[c],a,2*c,0,1)),a.s=0,a.clamp()}function A(a,b,c){var e=this,f=a.abs();if(!(f.t<=0)){var g=e.abs();if(g.t0?(f.lShiftTo(k,h),g.lShiftTo(k,c)):(f.copyTo(h),g.copyTo(c));var l=h.t,m=h[l-1];if(0!=m){var n=m*(1<1?h[l-2]>>e.F2:0),o=e.FV/n,p=(1<=0&&(c[c.t++]=1,c.subTo(u,c)),d.ONE.dlShiftTo(l,u),u.subTo(h,h);h.t=0;){var v=c[--s]==m?e.DM:Math.floor(c[s]*o+(c[s-1]+r)*p);if((c[s]+=h.am(0,v,c,t,0,l))0&&c.rShiftTo(k,c),0>i&&d.ZERO.subTo(c,c)}}}function B(a){var b=new d;return this.abs().divRemTo(a,null,b),this.s<0&&b.compareTo(d.ZERO)>0&&a.subTo(b,b),b}function C(a){this.m=a}function D(a){return a.s<0||a.compareTo(this.m)>=0?a.mod(this.m):a}function E(a){return a}function F(a){a.divRemTo(this.m,null,a)}function G(a,b,c){a.multiplyTo(b,c),this.reduce(c)}function H(a,b){a.squareTo(b),this.reduce(b)}function I(){if(this.t<1)return 0;var a=this[0];if(0==(1&a))return 0;var b=3&a;return b=b*(2-(15&a)*b)&15,b=b*(2-(255&a)*b)&255,b=b*(2-((65535&a)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV,b>0?this.DV-b:-b}function J(a){this.m=a,this.mp=a.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(b,b),b}function L(a){var b=new d;return a.copyTo(b),this.reduce(b),b}function M(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var b=0;b>15)*this.mpl&this.um)<<15)&a.DM;for(c=b+this.m.t,a[c]+=this.m.am(0,d,a,b,0,this.m.t);a[c]>=a.DV;)a[c]-=a.DV,a[++c]++}a.clamp(),a.drShiftTo(this.m.t,a),a.compareTo(this.m)>=0&&a.subTo(this.m,a)}function N(a,b){a.squareTo(b),this.reduce(b)}function O(a,b,c){a.multiplyTo(b,c),this.reduce(c)}function P(){return 0==(this.t>0?1&this[0]:this.s)}function Q(a,b){if(a>4294967295||1>a)return d.ONE;var c=new d,e=new d,f=b.convert(this),g=q(a)-1;for(f.copyTo(c);--g>=0;)if(b.sqrTo(c,e),(a&1<0)b.mulTo(e,f,c);else{var h=c;c=e,e=h}return b.revert(c)}function R(a,b){var c;return c=256>a||b.isEven()?new C(b):new J(b),this.exp(a,c)}function S(){var a=new d;return this.copyTo(a),a}function T(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function V(){return 0==this.t?this.s:this[0]<<16>>16}function W(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function X(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function Y(a){if(null==a&&(a=10),0==this.signum()||2>a||a>36)return"0";var b=this.chunkSize(a),c=Math.pow(a,b),e=j(c),f=new d,g=new d,h="";for(this.divRemTo(e,f,g);f.signum()>0;)h=(c+g.intValue()).toString(a).substr(1)+h,f.divRemTo(e,f,g);return g.intValue().toString(a)+h}function Z(a,b){var c=this;c.fromInt(0),null==b&&(b=10);for(var e=c.chunkSize(b),f=Math.pow(b,e),h=!1,i=0,j=0,k=0;kl?"-"==a.charAt(k)&&0==c.signum()&&(h=!0):(j=b*j+l,++i>=e&&(c.dMultiply(f),c.dAddOffset(j,0),i=0,j=0))}i>0&&(c.dMultiply(Math.pow(b,i)),c.dAddOffset(j,0)),h&&d.ZERO.subTo(c,c)}function $(a,b,c){var e=this;if("number"==typeof b)if(2>a)e.fromInt(1);else for(e.fromNumber(a,c),e.testBit(a-1)||e.bitwiseTo(d.ONE.shiftLeft(a-1),ga,e),e.isEven()&&e.dAddOffset(1,0);!e.isProbablePrime(b);)e.dAddOffset(2,0),e.bitLength()>a&&e.subTo(d.ONE.shiftLeft(a-1),e);else{var f=new Array,g=7&a;f.length=(a>>3)+1,b.nextBytes(f),g>0?f[0]&=(1<0)for(e>e)!=(a.s&a.DM)>>e&&(c[f++]=d|a.s<=0;)8>e?(d=(a[b]&(1<>(e+=a.DB-8)):(d=a[b]>>(e-=8)&255,0>=e&&(e+=a.DB,--b)),0!=(128&d)&&(d|=-256),0===f&&(128&a.s)!=(128&d)&&++f,(f>0||d!=a.s)&&(c[f++]=d);return c}function aa(a){return 0==this.compareTo(a)}function ba(a){return this.compareTo(a)<0?this:a}function ca(a){return this.compareTo(a)>0?this:a}function da(a,b,c){var d,e,f=this,g=Math.min(a.t,f.t);for(d=0;g>d;++d)c[d]=b(f[d],a[d]);if(a.ta?this.rShiftTo(-a,b):this.lShiftTo(a,b),b}function oa(a){var b=new d;return 0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b),b}function pa(a){if(0==a)return-1;var b=0;return 0==(65535&a)&&(a>>=16,b+=16),0==(255&a)&&(a>>=8,b+=8),0==(15&a)&&(a>>=4,b+=4),0==(3&a)&&(a>>=2,b+=2),0==(1&a)&&++b,b}function qa(){for(var a=0;a=this.t?0!=this.s:0!=(this[b]&1<d;)e+=c[d]+a[d],b[d++]=e&c.DM,e>>=c.DB;if(a.t>=c.DB;e+=c.s}else{for(e+=c.s;d>=c.DB;e+=a.s}b.s=0>e?-1:0,e>0?b[d++]=e:-1>e&&(b[d++]=c.DV+e),b.t=d,b.clamp()}function za(a){var b=new d;return this.addTo(a,b),b}function Aa(a){var b=new d;return this.subTo(a,b),b}function Ba(a){var b=new d;return this.multiplyTo(a,b),b}function Ca(){var a=new d;return this.squareTo(a),a}function Da(a){var b=new d;return this.divRemTo(a,b,null),b}function Ea(a){var b=new d;return this.divRemTo(a,null,b),b}function Fa(a){var b=new d,c=new d;return this.divRemTo(a,b,c),new Array(b,c)}function Ga(a){this[this.t]=this.am(0,a-1,this,0,0,this.t),++this.t,this.clamp()}function Ha(a,b){if(0!=a){for(;this.t<=b;)this[this.t++]=0;for(this[b]+=a;this[b]>=this.DV;)this[b]-=this.DV,++b>=this.t&&(this[this.t++]=0),++this[b]}}function Ia(){}function Ja(a){return a}function Ka(a,b,c){a.multiplyTo(b,c)}function La(a,b){a.squareTo(b)}function Ma(a){return this.exp(a,new Ia)}function Na(a,b,c){var d=Math.min(this.t+a.t,b);for(c.s=0,c.t=d;d>0;)c[--d]=0;var e;for(e=c.t-this.t;e>d;++d)c[d+this.t]=this.am(0,a[d],c,d,0,this.t);for(e=Math.min(a.t,b);e>d;++d)this.am(0,a[d],c,d,0,b-d);c.clamp()}function Oa(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;--d>=0;)c[d]=0;for(d=Math.max(b-this.t,0);d2*this.m.t)return a.mod(this.m);if(a.compareTo(this.m)<0)return a;var b=new d;return a.copyTo(b),this.reduce(b),b}function Ra(a){ -return a}function Sa(a){var b=this;for(a.drShiftTo(b.m.t-1,b.r2),a.t>b.m.t+1&&(a.t=b.m.t+1,a.clamp()),b.mu.multiplyUpperTo(b.r2,b.m.t+1,b.q3),b.m.multiplyLowerTo(b.q3,b.m.t+1,b.r2);a.compareTo(b.r2)<0;)a.dAddOffset(1,b.m.t+1);for(a.subTo(b.r2,a);a.compareTo(b.m)>=0;)a.subTo(b.m,a)}function Ta(a,b){a.squareTo(b),this.reduce(b)}function Ua(a,b,c){a.multiplyTo(b,c),this.reduce(c)}function Va(a,b){var c,e,f=a.bitLength(),g=j(1);if(0>=f)return g;c=18>f?1:48>f?3:144>f?4:768>f?5:6,e=8>f?new C(b):b.isEven()?new Pa(b):new J(b);var h=new Array,i=3,k=c-1,l=(1<1){var m=new d;for(e.sqrTo(h[1],m);l>=i;)h[i]=new d,e.mulTo(m,h[i-2],h[i]),i+=2}var n,o,p=a.t-1,r=!0,s=new d;for(f=q(a[p])-1;p>=0;){for(f>=k?n=a[p]>>f-k&l:(n=(a[p]&(1<0&&(n|=a[p-1]>>this.DB+f-k)),i=c;0==(1&n);)n>>=1,--i;if((f-=i)<0&&(f+=this.DB,--p),r)h[n].copyTo(g),r=!1;else{for(;i>1;)e.sqrTo(g,s),e.sqrTo(s,g),i-=2;i>0?e.sqrTo(g,s):(o=g,g=s,s=o),e.mulTo(s,h[n],g)}for(;p>=0&&0==(a[p]&1<f)return b;for(f>e&&(f=e),f>0&&(b.rShiftTo(f,b),c.rShiftTo(f,c));b.signum()>0;)(e=b.getLowestSetBit())>0&&b.rShiftTo(e,b),(e=c.getLowestSetBit())>0&&c.rShiftTo(e,c),b.compareTo(c)>=0?(b.subTo(c,b),b.rShiftTo(1,b)):(c.subTo(b,c),c.rShiftTo(1,c));return f>0&&c.lShiftTo(f,c),c}function Xa(a){if(0>=a)return 0;var b=this.DV%a,c=this.s<0?a-1:0;if(this.t>0)if(0==b)c=this[0]%a;else for(var d=this.t-1;d>=0;--d)c=(b*c+this[d])%a;return c}function Ya(a){var b=a.isEven();if(0===this.signum())throw new Error("division by zero");if(this.isEven()&&b||0==a.signum())return d.ZERO;for(var c=a.clone(),e=this.clone(),f=j(1),g=j(0),h=j(0),i=j(1);0!=c.signum();){for(;c.isEven();)c.rShiftTo(1,c),b?(f.isEven()&&g.isEven()||(f.addTo(this,f),g.subTo(a,g)),f.rShiftTo(1,f)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&i.isEven()||(h.addTo(this,h),i.subTo(a,i)),h.rShiftTo(1,h)):i.isEven()||i.subTo(a,i),i.rShiftTo(1,i);c.compareTo(e)>=0?(c.subTo(e,c),b&&f.subTo(h,f),g.subTo(i,g)):(e.subTo(c,e),b&&h.subTo(f,h),i.subTo(g,i))}if(0!=e.compareTo(d.ONE))return d.ZERO;for(;i.compareTo(a)>=0;)i.subTo(a,i);for(;i.signum()<0;)i.addTo(a,i);return i}function Za(a){var b,c=this.abs();if(1==c.t&&c[0]<=hb[hb.length-1]){for(b=0;bd;)d*=hb[e++];for(d=c.modInt(d);e>b;)if(d%hb[b++]==0)return!1}return c.millerRabin(a)}function $a(a){var b=this.subtract(d.ONE),c=b.getLowestSetBit();if(0>=c)return!1;var e=b.shiftRight(c);a=a+1>>1,a>hb.length&&(a=hb.length);for(var f,g=new d(null),h=[],i=0;a>i;++i){for(;f=hb[Math.floor(Math.random()*hb.length)],-1!=h.indexOf(f););h.push(f),g.fromInt(f);var j=g.modPow(e,this);if(0!=j.compareTo(d.ONE)&&0!=j.compareTo(b)){for(var f=1;f++=eb;++eb)gb[db++]=eb;for(db="a".charCodeAt(0),eb=10;36>eb;++eb)gb[db++]=eb;for(db="A".charCodeAt(0),eb=10;36>eb;++eb)gb[db++]=eb;C.prototype.convert=D,C.prototype.revert=E,C.prototype.reduce=F,C.prototype.mulTo=G,C.prototype.sqrTo=H,J.prototype.convert=K,J.prototype.revert=L,J.prototype.reduce=M,J.prototype.mulTo=O,J.prototype.sqrTo=N,_a.copyTo=h,_a.fromInt=i,_a.fromString=k,_a.clamp=l,_a.dlShiftTo=t,_a.drShiftTo=u,_a.lShiftTo=v,_a.rShiftTo=w,_a.subTo=x,_a.multiplyTo=y,_a.squareTo=z,_a.divRemTo=A,_a.invDigit=I,_a.isEven=P,_a.exp=Q,_a.toString=m,_a.negate=n,_a.abs=o,_a.compareTo=p,_a.bitLength=r,_a.byteLength=s,_a.mod=B,_a.modPowInt=R,Ia.prototype.convert=Ja,Ia.prototype.revert=Ja,Ia.prototype.mulTo=Ka,Ia.prototype.sqrTo=La,Pa.prototype.convert=Qa,Pa.prototype.revert=Ra,Pa.prototype.reduce=Sa,Pa.prototype.mulTo=Ua,Pa.prototype.sqrTo=Ta;var hb=[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],ib=(1<<26)/hb[hb.length-1];_a.chunkSize=W,_a.toRadix=Y,_a.fromRadix=Z,_a.fromNumber=$,_a.bitwiseTo=da,_a.changeBit=ua,_a.addTo=ya,_a.dMultiply=Ga,_a.dAddOffset=Ha,_a.multiplyLowerTo=Na,_a.multiplyUpperTo=Oa,_a.modInt=Xa,_a.millerRabin=$a,_a.clone=S,_a.intValue=T,_a.byteValue=U,_a.shortValue=V,_a.signum=X,_a.toByteArray=_,_a.equals=aa,_a.min=ba,_a.max=ca,_a.and=fa,_a.or=ha,_a.xor=ja,_a.andNot=la,_a.not=ma,_a.shiftLeft=na,_a.shiftRight=oa,_a.getLowestSetBit=qa,_a.bitCount=sa,_a.testBit=ta,_a.setBit=va,_a.clearBit=wa,_a.flipBit=xa,_a.add=za,_a.subtract=Aa,_a.multiply=Ba,_a.divide=Da,_a.remainder=Ea,_a.divideAndRemainder=Fa,_a.modPow=Va,_a.modInverse=Ya,_a.pow=Ma,_a.gcd=Wa,_a.isProbablePrime=Za,_a.square=Ca,d.ZERO=j(0),d.ONE=j(1),d.valueOf=j,b.exports=d},{"../package.json":36}],34:[function(a,b,c){(function(b){var c=a("assert"),d=a("./bigi");d.fromByteArrayUnsigned=function(a){return new d(128&a[0]?[0].concat(a):a)},d.prototype.toByteArrayUnsigned=function(){var a=this.toByteArray();return 0===a[0]?a.slice(1):a},d.fromDERInteger=function(a){return new d(a)},d.prototype.toDERInteger=d.prototype.toByteArray,d.fromBuffer=function(a){if(128&a[0]){var b=Array.prototype.slice.call(a);return new d([0].concat(b))}return new d(a)},d.fromHex=function(a){return""===a?d.ZERO:(c.equal(a,a.match(/^[A-Fa-f0-9]+/),"Invalid hex string"),c.equal(a.length%2,0,"Incomplete hex"),new d(a,16))},d.prototype.toBuffer=function(a){for(var c=this.toByteArrayUnsigned(),d=[],e=a-c.length;d.lengthd;++d)b.push(a.and(c).toNumber()),a=a.shrn(5);return b.reverse()}function h(a){for(var b=new q(1),c=new q(34359738367),d=0;d"},d.prototype.toCashBuffer=function(){var a=new c([this.network[this.type]]),b=c.concat([a,this.hashBuffer]);return b},d.prototype.toCashAddress=function(){function a(a){switch(a){case"pubkeyhash":return 0;case"scripthash":return 8;default:throw new Error("Invalid type:"+a)}}function b(a){switch(8*a.length){case 160:return 0;case 192:return 1;case 224:return 2;case 256:return 3;case 320:return 4;case 384:return 5;case 448:return 6;case 512:return 7;default:throw new Error("Invalid hash size:"+a.length)}}var c=[0,0,0,0,0,0,0,0],d=this.network.prefixArray.concat([0]),e=a(this.type)+b(this.hashBuffer),f=Array.prototype.slice.call(this.hashBuffer,0),i=s([e].concat(f),8,5),j=d.concat(i).concat(c),k=i.concat(g(h(j)));return this.network.prefix+":"+r.encode(k)};var t=i.map([656907472481,522768456162,0xf33e5fb3c4,748107326120,130178868336],function(a){return new q(a)});b.exports=d;var u=a("./script")}).call(this,a("buffer").Buffer)},{"./crypto/bn":44,"./crypto/hash":46,"./encoding/base58check":51,"./errors":55,"./networks":59,"./publickey":62,"./script":63,"./util/base32":80,"./util/convertBits":82,"./util/js":83,"./util/preconditions":84,buffer:187,lodash:87}],40:[function(a,b,c){(function(c){"use strict";function d(a){return this instanceof d?(e.extend(this,d._from(a)),this):new d(a)}var e=a("lodash"),f=a("./blockheader"),g=a("../crypto/bn"),h=a("../util/buffer"),i=a("../encoding/bufferreader"),j=a("../encoding/bufferwriter"),k=a("../crypto/hash"),l=a("../transaction"),m=a("../util/preconditions");d.MAX_BLOCK_SIZE=1e6,d._from=function(a){var b={};if(h.isBuffer(a))b=d._fromBufferReader(i(a));else{if(!e.isObject(a))throw new TypeError("Unrecognized argument for Block");b=d._fromObject(a)}return b},d._fromObject=function(a){var b=[];a.transactions.forEach(function(a){a instanceof l?b.push(a):b.push(l().fromObject(a))});var c={header:f.fromObject(a.header),transactions:b};return c},d.fromObject=function(a){var b=d._fromObject(a);return new d(b)},d._fromBufferReader=function(a){var b={};m.checkState(!a.finished(),"No block data received"),b.header=f.fromBufferReader(a);var c=a.readVarintNum();b.transactions=[];for(var d=0;c>d;d++)b.transactions.push(l().fromBufferReader(a));return b},d.fromBufferReader=function(a){m.checkArgument(a,"br is required");var b=d._fromBufferReader(a);return new d(b)},d.fromBuffer=function(a){return d.fromBufferReader(new i(a))},d.fromString=function(a){var b=new c(a,"hex");return d.fromBuffer(b)},d.fromRawBlock=function(a){h.isBuffer(a)||(a=new c(a,"binary"));var b=i(a);b.pos=d.Values.START_OF_BLOCK;var e=d._fromBufferReader(b);return new d(e)},d.prototype.toObject=d.prototype.toJSON=function(){var a=[];return this.transactions.forEach(function(b){a.push(b.toObject())}),{header:this.header.toObject(),transactions:a}},d.prototype.toBuffer=function(){return this.toBufferWriter().concat()},d.prototype.toString=function(){return this.toBuffer().toString("hex")},d.prototype.toBufferWriter=function(a){a||(a=new j),a.write(this.header.toBuffer()),a.writeVarintNum(this.transactions.length);for(var b=0;b1;d=Math.floor((d+1)/2)){for(var e=0;d>e;e+=2){var f=Math.min(e+1,d-1),g=c.concat([a[b+e],a[b+f]]);a.push(k.sha256sha256(g))}b+=d}return a},d.prototype.getMerkleRoot=function(){var a=this.getMerkleTree();return a[a.length-1]},d.prototype.validMerkleRoot=function(){var a=new g(this.header.merkleRoot.toString("hex"),"hex"),b=new g(this.getMerkleRoot().toString("hex"),"hex");return 0!==a.cmp(b)?!1:!0},d.prototype._getHash=function(){return this.header._getHash()};var n={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=this.header.id),this._id},set:e.noop};Object.defineProperty(d.prototype,"id",n),Object.defineProperty(d.prototype,"hash",n),d.prototype.inspect=function(){return""},d.Values={START_OF_BLOCK:8,NULL_HASH:new c("0000000000000000000000000000000000000000000000000000000000000000","hex")},b.exports=d}).call(this,a("buffer").Buffer)},{"../crypto/bn":44,"../crypto/hash":46,"../encoding/bufferreader":52,"../encoding/bufferwriter":53,"../transaction":66,"../util/buffer":81,"../util/preconditions":84,"./blockheader":41,buffer:187,lodash:87}],41:[function(a,b,c){(function(c){"use strict";var d=a("lodash"),e=a("../crypto/bn"),f=a("../util/buffer"),g=a("../encoding/bufferreader"),h=a("../encoding/bufferwriter"),i=a("../crypto/hash"),j=(a("../util/js"),a("../util/preconditions")),k=486604799,l=function n(a){if(!(this instanceof n))return new n(a);var b=n._from(a);return this.version=b.version,this.prevHash=b.prevHash,this.merkleRoot=b.merkleRoot,this.time=b.time,this.timestamp=b.time,this.bits=b.bits,this.nonce=b.nonce,b.hash&&j.checkState(this.hash===b.hash,"Argument object hash property does not match block hash."),this};l._from=function(a){var b={};if(f.isBuffer(a))b=l._fromBufferReader(g(a));else{if(!d.isObject(a))throw new TypeError("Unrecognized argument for BlockHeader");b=l._fromObject(a)}return b},l._fromObject=function(a){j.checkArgument(a,"data is required");var b=a.prevHash,e=a.merkleRoot;d.isString(a.prevHash)&&(b=f.reverse(new c(a.prevHash,"hex"))),d.isString(a.merkleRoot)&&(e=f.reverse(new c(a.merkleRoot,"hex")));var g={hash:a.hash,version:a.version,prevHash:b,merkleRoot:e,time:a.time,timestamp:a.time,bits:a.bits,nonce:a.nonce};return g},l.fromObject=function(a){var b=l._fromObject(a);return new l(b)},l.fromRawBlock=function(a){f.isBuffer(a)||(a=new c(a,"binary"));var b=g(a);b.pos=l.Constants.START_OF_HEADER;var d=l._fromBufferReader(b);return new l(d)},l.fromBuffer=function(a){var b=l._fromBufferReader(g(a));return new l(b)},l.fromString=function(a){var b=new c(a,"hex");return l.fromBuffer(b)},l._fromBufferReader=function(a){var b={};return b.version=a.readInt32LE(),b.prevHash=a.read(32),b.merkleRoot=a.read(32),b.time=a.readUInt32LE(),b.bits=a.readUInt32LE(),b.nonce=a.readUInt32LE(),b},l.fromBufferReader=function(a){var b=l._fromBufferReader(a);return new l(b)},l.prototype.toObject=l.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:f.reverse(this.prevHash).toString("hex"),merkleRoot:f.reverse(this.merkleRoot).toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},l.prototype.toBuffer=function(){return this.toBufferWriter().concat()},l.prototype.toString=function(){return this.toBuffer().toString("hex")},l.prototype.toBufferWriter=function(a){return a||(a=new h),a.writeInt32LE(this.version),a.write(this.prevHash),a.write(this.merkleRoot),a.writeUInt32LE(this.time),a.writeUInt32LE(this.bits),a.writeUInt32LE(this.nonce),a},l.prototype.getTargetDifficulty=function(a){a=a||this.bits;for(var b=new e(16777215&a),c=8*((a>>>24)-3);c-->0;)b=b.mul(new e(2));return b},l.prototype.getDifficulty=function(){var a=this.getTargetDifficulty(k).mul(new e(Math.pow(10,8))),b=this.getTargetDifficulty(),c=a.div(b).toString(10),d=c.length-8;return c=c.slice(0,d)+"."+c.slice(d),parseFloat(c)},l.prototype._getHash=function(){var a=this.toBuffer();return i.sha256sha256(a)};var m={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=g(this._getHash()).readReverse().toString("hex")),this._id},set:d.noop};Object.defineProperty(l.prototype,"id",m),Object.defineProperty(l.prototype,"hash",m),l.prototype.validTimestamp=function(){var a=Math.round((new Date).getTime()/1e3);return this.time>a+l.Constants.MAX_TIME_OFFSET?!1:!0},l.prototype.validProofOfWork=function(){var a=new e(this.id,"hex"),b=this.getTargetDifficulty();return a.cmp(b)>0?!1:!0},l.prototype.inspect=function(){return""},l.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new e("10000000000000000000000000000000000000000000000000000000000000000","hex")},b.exports=l}).call(this,a("buffer").Buffer)},{"../crypto/bn":44,"../crypto/hash":46,"../encoding/bufferreader":52,"../encoding/bufferwriter":53,"../util/buffer":81,"../util/js":83,"../util/preconditions":84,buffer:187,lodash:87}],42:[function(a,b,c){b.exports=a("./block"),b.exports.BlockHeader=a("./blockheader"),b.exports.MerkleBlock=a("./merkleblock")},{"./block":40,"./blockheader":41,"./merkleblock":43}],43:[function(a,b,c){(function(c){"use strict";function d(a){if(!(this instanceof d))return new d(a);var b={};if(g.isBuffer(a))b=d._fromBufferReader(h(a));else{if(!e.isObject(a))throw new TypeError("Unrecognized argument for MerkleBlock");var c;c=a.header instanceof f?a.header:f.fromObject(a.header),b={header:c,numTransactions:a.numTransactions,hashes:a.hashes,flags:a.flags}}return e.extend(this,b),this._flagBitsUsed=0,this._hashesUsed=0,this}var e=a("lodash"),f=a("./blockheader"),g=a("../util/buffer"),h=a("../encoding/bufferreader"),i=a("../encoding/bufferwriter"),j=a("../crypto/hash"),k=(a("../util/js"),a("../transaction")),l=a("../errors"),m=a("../util/preconditions");d.fromBuffer=function(a){return d.fromBufferReader(h(a))},d.fromBufferReader=function(a){return new d(d._fromBufferReader(a))},d.prototype.toBuffer=function(){return this.toBufferWriter().concat()},d.prototype.toBufferWriter=function(a){a||(a=new i),a.write(this.header.toBuffer()),a.writeUInt32LE(this.numTransactions),a.writeVarintNum(this.hashes.length);for(var b=0;bthis.numTransactions)return!1;if(8*this.flags.lengththis.numTransactions)throw new l.MerkleBlock.InvalidMerkleTree; -if(8*this.flags.length8*this.flags.length)return null;var f=this.flags[d.flagBitsUsed>>3]>>>(7&d.flagBitsUsed++)&1;if(0!==a&&f){var g=this._traverseMerkleTree(a-1,2*b,d),h=g;return 2*b+1=this.hashes.length)return null;var i=this.hashes[d.hashesUsed++];return 0===a&&f&&d.txs.push(i),new c(i,"hex")},d.prototype._calcTreeWidth=function(a){return this.numTransactions+(1<>a},d.prototype._calcTreeHeight=function(){for(var a=0;this._calcTreeWidth(a)>1;)a++;return a},d.prototype.hasTransaction=function(a){m.checkArgument(!e.isUndefined(a),"tx cannot be undefined"),m.checkArgument(a instanceof k||"string"==typeof a,'Invalid tx given, tx must be a "string" or "Transaction"');var b=a;a instanceof k&&(b=g.reverse(new c(a.id,"hex")).toString("hex"));var d=[],f=this._calcTreeHeight();return this._traverseMerkleTree(f,0,{txs:d}),-1!==d.indexOf(b)},d._fromBufferReader=function(a){m.checkState(!a.finished(),"No merkleblock data received");var b={};b.header=f.fromBufferReader(a),b.numTransactions=a.readUInt32LE();var c=a.readVarintNum();b.hashes=[];for(var d=0;c>d;d++)b.hashes.push(a.read(32).toString("hex"));var e=a.readVarintNum();for(b.flags=[],d=0;e>d;d++)b.flags.push(a.readUInt8());return b},d.fromObject=function(a){return new d(a)},b.exports=d}).call(this,a("buffer").Buffer)},{"../crypto/hash":46,"../encoding/bufferreader":52,"../encoding/bufferwriter":53,"../errors":55,"../transaction":66,"../util/buffer":81,"../util/js":83,"../util/preconditions":84,"./blockheader":41,buffer:187,lodash:87}],44:[function(a,b,c){(function(c){"use strict";var d=a("bn.js"),e=a("../util/preconditions"),f=a("lodash"),g=function(a){for(var b=new c(a.length),d=0;da.size?b=d.trim(b,f):f0&&0===(127&a[a.length-1])&&(a.length<=1||0===(128&a[a.length-2])))throw new Error("non-minimally encoded script number");return d.fromSM(a,{endian:"little"})},d.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},d.prototype.gt=function(a){return this.cmp(a)>0},d.prototype.gte=function(a){return this.cmp(a)>=0},d.prototype.lt=function(a){return this.cmp(a)<0},d.trim=function(a,b){return a.slice(b-a.length,a.length)},d.pad=function(a,b,d){for(var e=new c(d),f=0;ff;f++)e[f]=0;return e},b.exports=d}).call(this,a("buffer").Buffer)},{"../util/preconditions":84,"bn.js":153,buffer:187,lodash:87}],45:[function(a,b,c){(function(c){"use strict";var d=a("./bn"),e=a("./point"),f=a("./signature"),g=a("../publickey"),h=a("./random"),i=a("./hash"),j=a("../util/buffer"),k=a("lodash"),l=a("../util/preconditions"),m=function n(a){return this instanceof n?void(a&&this.set(a)):new n(a)};m.prototype.set=function(a){return this.hashbuf=a.hashbuf||this.hashbuf,this.endian=a.endian||this.endian,this.privkey=a.privkey||this.privkey,this.pubkey=a.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),this.sig=a.sig||this.sig,this.k=a.k||this.k,this.verified=a.verified||this.verified,this},m.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},m.prototype.calci=function(){for(var a=0;4>a;a++){this.sig.i=a;var b;try{b=this.toPublicKey()}catch(c){console.error(c);continue}if(b.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},m.fromString=function(a){var b=JSON.parse(a);return new m(b)},m.prototype.randomK=function(){var a,b=e.getN();do a=d.fromBuffer(h.getRandomBuffer(32));while(!a.lt(b)||!a.gt(d.Zero));return this.k=a,this},m.prototype.deterministicK=function(a){k.isUndefined(a)&&(a=0);var b=new c(32);b.fill(1);var f=new c(32);f.fill(0);var g=this.privkey.bn.toBuffer({size:32}),h="little"===this.endian?j.reverse(this.hashbuf):this.hashbuf;f=i.sha256hmac(c.concat([b,new c([0]),g,h]),f),b=i.sha256hmac(b,f),f=i.sha256hmac(c.concat([b,new c([1]),g,h]),f),b=i.sha256hmac(b,f),b=i.sha256hmac(b,f);for(var l=d.fromBuffer(b),m=e.getN(),n=0;a>n||!l.lt(m)||!l.gt(d.Zero);n++)f=i.sha256hmac(c.concat([b,new c([0])]),f),b=i.sha256hmac(b,f),b=i.sha256hmac(b,f),l=d.fromBuffer(b);return this.k=l,this},m.prototype.toPublicKey=function(){var a=this.sig.i;l.checkArgument(0===a||1===a||2===a||3===a,new Error("i must be equal to 0, 1, 2, or 3"));var b=d.fromBuffer(this.hashbuf),c=this.sig.r,f=this.sig.s,h=1&a,i=a>>1,j=e.getN(),k=e.getG(),m=i?c.add(j):c,n=e.fromX(h,m),o=n.mul(j);if(!o.isInfinity())throw new Error("nR is not a valid curve point");var p=b.neg().umod(j),q=c.invm(j),r=n.mul(f).add(k.mul(p)).mul(q),s=g.fromPoint(r,this.sig.compressed);return s},m.prototype.sigError=function(){if(!j.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var a=this.sig.r,b=this.sig.s;if(!(a.gt(d.Zero)&&a.lt(e.getN())&&b.gt(d.Zero)&&b.lt(e.getN())))return"r and s not in range";var c=d.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),f=e.getN(),g=b.invm(f),h=g.mul(c).umod(f),i=g.mul(a).umod(f),k=e.getG().mulAdd(h,this.pubkey.point,i);return k.isInfinity()?"p is infinity":0!==k.getX().umod(f).cmp(a)?"Invalid signature":!1},m.toLowS=function(a){return a.gt(d.fromBuffer(new c("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(a=e.getN().sub(a)),a},m.prototype._findSignature=function(a,b){var c,f,g,h,i=e.getN(),j=e.getG(),k=0;do(!this.k||k>0)&&this.deterministicK(k),k++,c=this.k,f=j.mul(c),g=f.x.umod(i),h=c.invm(i).mul(b.add(a.mul(g))).umod(i);while(g.cmp(d.Zero)<=0||h.cmp(d.Zero)<=0);return h=m.toLowS(h),{s:h,r:g}},m.prototype.sign=function(){var a=this.hashbuf,b=this.privkey,c=b.bn;l.checkState(a&&b&&c,new Error("invalid parameters")),l.checkState(j.isBuffer(a)&&32===a.length,new Error("hashbuf must be a 32 byte buffer"));var e=d.fromBuffer(a,this.endian?{endian:this.endian}:void 0),g=this._findSignature(c,e);return g.compressed=this.pubkey.compressed,this.sig=new f(g),this},m.prototype.signRandomK=function(){return this.randomK(),this.sign()},m.prototype.toString=function(){var a={};return this.hashbuf&&(a.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(a.privkey=this.privkey.toString()),this.pubkey&&(a.pubkey=this.pubkey.toString()),this.sig&&(a.sig=this.sig.toString()),this.k&&(a.k=this.k.toString()),JSON.stringify(a)},m.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},m.sign=function(a,b,c){return m().set({hashbuf:a,endian:c,privkey:b}).sign().sig},m.verify=function(a,b,c,d){return m().set({hashbuf:a,endian:d,sig:b,pubkey:c}).verify().verified},b.exports=m}).call(this,a("buffer").Buffer)},{"../publickey":62,"../util/buffer":81,"../util/preconditions":84,"./bn":44,"./hash":46,"./point":47,"./random":48,"./signature":49,buffer:187,lodash:87}],46:[function(a,b,c){(function(c){"use strict";var d=a("crypto"),e=a("../util/buffer"),f=a("../util/preconditions"),g=b.exports;g.sha1=function(a){return f.checkArgument(e.isBuffer(a)),d.createHash("sha1").update(a).digest()},g.sha1.blocksize=512,g.sha256=function(a){return f.checkArgument(e.isBuffer(a)),d.createHash("sha256").update(a).digest()},g.sha256.blocksize=512,g.sha256sha256=function(a){return f.checkArgument(e.isBuffer(a)),g.sha256(g.sha256(a))},g.ripemd160=function(a){return f.checkArgument(e.isBuffer(a)),d.createHash("ripemd160").update(a).digest()},g.sha256ripemd160=function(a){return f.checkArgument(e.isBuffer(a)),g.ripemd160(g.sha256(a))},g.sha512=function(a){return f.checkArgument(e.isBuffer(a)),d.createHash("sha512").update(a).digest()},g.sha512.blocksize=1024,g.hmac=function(a,b,d){f.checkArgument(e.isBuffer(b)),f.checkArgument(e.isBuffer(d)),f.checkArgument(a.blocksize);var g=a.blocksize/8;if(d.length>g)d=a(d);else if(g>d){var h=new c(g);h.fill(0),d.copy(h),d=h}var i=new c(g);i.fill(92);var j=new c(g);j.fill(54);for(var k=new c(g),l=new c(g),m=0;g>m;m++)k[m]=i[m]^d[m],l[m]=j[m]^d[m];return a(c.concat([k,a(c.concat([l,b]))]))},g.sha256hmac=function(a,b){return g.hmac(g.sha256,a,b)},g.sha512hmac=function(a,b){return g.hmac(g.sha512,a,b)}}).call(this,a("buffer").Buffer)},{"../util/buffer":81,"../util/preconditions":84,buffer:187,crypto:200}],47:[function(a,b,c){(function(c){"use strict";var d=a("./bn"),e=a("../util/buffer"),f=a("elliptic").ec,g=new f("secp256k1"),h=g.curve.point.bind(g.curve),i=g.curve.pointFromX.bind(g.curve),j=function(a,b,c){try{var d=h(a,b,c)}catch(e){throw new Error("Invalid Point")}return d.validate(),d};j.prototype=Object.getPrototypeOf(g.curve.point()),j.fromX=function(a,b){try{var c=i(b,a)}catch(d){throw new Error("Invalid X")}return c.validate(),c},j.getG=function(){return g.curve.g},j.getN=function(){return new d(g.curve.n.toArray())},j.prototype._getX||(j.prototype._getX=j.prototype.getX),j.prototype.getX=function(){return new d(this._getX().toArray())},j.prototype._getY||(j.prototype._getY=j.prototype.getY),j.prototype.getY=function(){return new d(this._getY().toArray())},j.prototype.validate=function(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");var a;try{a=i(this.getX(),this.getY().isOdd())}catch(b){throw new Error("Point does not lie on the curve")}if(0!==a.y.cmp(this.y))throw new Error("Invalid y value for curve.");if(!this.mul(j.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},j.pointToCompressed=function(a){var b,d=a.getX().toBuffer({size:32}),f=a.getY().toBuffer({size:32}),g=f[f.length-1]%2;return b=new c(g?[3]:[2]),e.concat([b,d])},b.exports=j}).call(this,a("buffer").Buffer)},{"../util/buffer":81,"./bn":44,buffer:187,elliptic:216}],48:[function(a,b,c){(function(c,d){"use strict";function e(){}e.getRandomBuffer=function(a){return c.browser?e.getRandomBufferBrowser(a):e.getRandomBufferNode(a)},e.getRandomBufferNode=function(b){var c=a("crypto");return c.randomBytes(b)},e.getRandomBufferBrowser=function(a){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var b=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var b=window.msCrypto}var c=new Uint8Array(a);b.getRandomValues(c);var e=new d(c);return e},e.getPseudoRandomBuffer=function(a){for(var b,c=4294967296,e=new d(a),f=0;a>=f;f++){var g=Math.floor(f/4),h=f-4*g;0===h?(b=Math.random()*c,e[f]=255&b):e[f]=255&(b>>>=8)}return e},b.exports=e}).call(this,a("_process"),a("buffer").Buffer)},{_process:282,buffer:187,crypto:200}],49:[function(a,b,c){(function(c){"use strict";var d=a("./bn"),e=a("lodash"),f=a("../util/preconditions"),g=a("../util/buffer"),h=a("../util/js"),i=function j(a,b){if(!(this instanceof j))return new j(a,b);if(a instanceof d)this.set({r:a,s:b});else if(a){var c=a;this.set(c)}};i.prototype.set=function(a){return this.r=a.r||this.r||void 0,this.s=a.s||this.s||void 0,this.i="undefined"!=typeof a.i?a.i:this.i,this.compressed="undefined"!=typeof a.compressed?a.compressed:this.compressed,this.nhashtype=a.nhashtype||this.nhashtype||void 0,this},i.fromCompact=function(a){f.checkArgument(g.isBuffer(a),"Argument is expected to be a Buffer");var b=new i,c=!0,e=a.slice(0,1)[0]-27-4;0>e&&(c=!1,e+=4);var h=a.slice(1,33),j=a.slice(33,65);return f.checkArgument(0===e||1===e||2===e||3===e,new Error("i must be 0, 1, 2, or 3")),f.checkArgument(32===h.length,new Error("r must be 32 bytes")),f.checkArgument(32===j.length,new Error("s must be 32 bytes")),b.compressed=c,b.i=e,b.r=d.fromBuffer(h),b.s=d.fromBuffer(j),b},i.fromDER=i.fromBuffer=function(a,b){var c=i.parseDER(a,b),d=new i;return d.r=c.r,d.s=c.s,d},i.fromTxFormat=function(a){var b=a.readUInt8(a.length-1),c=a.slice(0,a.length-1),d=new i.fromDER(c,!1);return d.nhashtype=b,d},i.fromString=function(a){var b=new c(a,"hex");return i.fromDER(b)},i.parseDER=function(a,b){f.checkArgument(g.isBuffer(a),new Error("DER formatted signature should be a buffer")),e.isUndefined(b)&&(b=!0);var c=a[0];f.checkArgument(48===c,new Error("Header byte should be 0x30"));var h=a[1],i=a.slice(2).length;f.checkArgument(!b||h===i,new Error("Length byte should length of what follows")),h=i>h?h:i;var j=a[2];f.checkArgument(2===j,new Error("Integer byte for r should be 0x02"));var k=a[3],l=a.slice(4,4+k),m=d.fromBuffer(l),n=0===a[4]?!0:!1;f.checkArgument(k===l.length,new Error("Length of r incorrect"));var o=a[4+k+0];f.checkArgument(2===o,new Error("Integer byte for s should be 0x02"));var p=a[4+k+1],q=a.slice(4+k+2,4+k+2+p),r=d.fromBuffer(q),s=0===a[4+k+2+2]?!0:!1;f.checkArgument(p===q.length,new Error("Length of s incorrect"));var t=4+k+2+p;f.checkArgument(h===t-2,new Error("Length of signature incorrect"));var u={header:c,length:h,rheader:j,rlength:k,rneg:n,rbuf:l,r:m,sheader:o,slength:p,sneg:s,sbuf:q,s:r};return u},i.prototype.toCompact=function(a,b){if(a="number"==typeof a?a:this.i,b="boolean"==typeof b?b:this.compressed,0!==a&&1!==a&&2!==a&&3!==a)throw new Error("i must be equal to 0, 1, 2, or 3");var d=a+27+4;b===!1&&(d-=4);var e=new c([d]),f=this.r.toBuffer({size:32}),g=this.s.toBuffer({size:32});return c.concat([e,f,g])},i.prototype.toBuffer=i.prototype.toDER=function(){var a=this.r.toBuffer(),b=this.s.toBuffer(),d=128&a[0]?!0:!1,e=128&b[0]?!0:!1,f=d?c.concat([new c([0]),a]):a,g=e?c.concat([new c([0]),b]):b,h=f.length,i=g.length,j=2+h+2+i,k=2,l=2,m=48,n=c.concat([new c([m,j,k,h]),f,new c([l,i]),g]);return n},i.prototype.toString=function(){var a=this.toDER();return a.toString("hex")},i.isTxDER=function(a){if(a.length<9)return!1;if(a.length>73)return!1;if(48!==a[0])return!1;if(a[1]!==a.length-3)return!1;var b=a[3];if(5+b>=a.length)return!1;var c=a[5+b];if(b+c+7!==a.length)return!1;var d=a.slice(4);if(2!==a[2])return!1;if(0===b)return!1;if(128&d[0])return!1;if(b>1&&0===d[0]&&!(128&d[1]))return!1;var e=a.slice(6+b);return 2!==a[6+b-2]?!1:0===c?!1:128&e[0]?!1:c>1&&0===e[0]&&!(128&e[1])?!1:!0},i.prototype.hasLowS=function(){return this.s.lt(new d(1))||this.s.gt(new d("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))?!1:!0},i.prototype.hasDefinedHashtype=function(){if(!h.isNaturalNumber(this.nhashtype))return!1;var a=this.nhashtype&~i.SIGHASH_ANYONECANPAY;return ai.SIGHASH_SINGLE?!1:!0},i.prototype.toTxFormat=function(){var a=this.toDER(),b=new c(1);return b.writeUInt8(this.nhashtype,0),c.concat([a,b])},i.SIGHASH_ALL=1,i.SIGHASH_NONE=2,i.SIGHASH_SINGLE=3,i.SIGHASH_FORKID=64,i.SIGHASH_ANYONECANPAY=128,b.exports=i}).call(this,a("buffer").Buffer)},{"../util/buffer":81,"../util/js":83,"../util/preconditions":84,"./bn":44,buffer:187,lodash:87}],50:[function(a,b,c){(function(c){"use strict";var d=a("lodash"),e=a("bs58"),f=a("buffer"),g="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),h=function i(a){if(!(this instanceof i))return new i(a);if(c.isBuffer(a)){var b=a;this.fromBuffer(b)}else if("string"==typeof a){var d=a;this.fromString(d)}else a&&this.set(a)};h.validCharacters=function(a){return f.Buffer.isBuffer(a)&&(a=a.toString()),d.every(d.map(a,function(a){return d.includes(g,a)}))},h.prototype.set=function(a){return this.buf=a.buf||this.buf||void 0,this},h.encode=function(a){if(!f.Buffer.isBuffer(a))throw new Error("Input should be a buffer");return e.encode(a)},h.decode=function(a){if("string"!=typeof a)throw new Error("Input should be a string");return new c(e.decode(a))},h.prototype.fromBuffer=function(a){return this.buf=a,this},h.prototype.fromString=function(a){var b=h.decode(a);return this.buf=b,this},h.prototype.toBuffer=function(){return this.buf},h.prototype.toString=function(){return h.encode(this.buf)},b.exports=h}).call(this,a("buffer").Buffer)},{bs58:85,buffer:187,lodash:87}],51:[function(a,b,c){(function(c){"use strict";var d=a("lodash"),e=a("./base58"),f=a("buffer"),g=a("../crypto/hash").sha256sha256,h=function i(a){if(!(this instanceof i))return new i(a);if(c.isBuffer(a)){var b=a;this.fromBuffer(b)}else if("string"==typeof a){var d=a;this.fromString(d)}else a&&this.set(a)};h.prototype.set=function(a){return this.buf=a.buf||this.buf||void 0,this},h.validChecksum=function(a,b){return d.isString(a)&&(a=new f.Buffer(e.decode(a))),d.isString(b)&&(b=new f.Buffer(e.decode(b))),b||(b=a.slice(-4),a=a.slice(0,-4)),h.checksum(a).toString("hex")===b.toString("hex")},h.decode=function(a){if("string"!=typeof a)throw new Error("Input must be a string");var b=new c(e.decode(a));if(b.length<4)throw new Error("Input string too short");var d=b.slice(0,-4),f=b.slice(-4),h=g(d),i=h.slice(0,4);if(f.toString("hex")!==i.toString("hex"))throw new Error("Checksum mismatch");return d},h.checksum=function(a){return g(a).slice(0,4)},h.encode=function(a){if(!c.isBuffer(a))throw new Error("Input must be a buffer");var b=new c(a.length+4),d=h.checksum(a);return a.copy(b),d.copy(b,a.length),e.encode(b)},h.prototype.fromBuffer=function(a){return this.buf=a,this},h.prototype.fromString=function(a){var b=h.decode(a);return this.buf=b,this},h.prototype.toBuffer=function(){return this.buf},h.prototype.toString=function(){return h.encode(this.buf)},b.exports=h}).call(this,a("buffer").Buffer)},{"../crypto/hash":46,"./base58":50,buffer:187,lodash:87}],52:[function(a,b,c){(function(c){"use strict";var d=a("lodash"),e=a("../util/preconditions"),f=a("../util/buffer"),g=a("../crypto/bn"),h=function i(a){if(!(this instanceof i))return new i(a);if(!d.isUndefined(a))if(c.isBuffer(a))this.set({buf:a});else if(d.isString(a)){var b=new c(a,"hex");if(2*b.length!=a.length)throw new TypeError("Invalid hex string");this.set({buf:b})}else{if(!d.isObject(a))throw new TypeError("Unrecognized argument for BufferReader");var e=a;this.set(e)}};h.prototype.set=function(a){return this.buf=a.buf||this.buf||void 0,this.pos=a.pos||this.pos||0,this},h.prototype.eof=function(){return this.pos>=this.buf.length},h.prototype.finished=h.prototype.eof,h.prototype.read=function(a){e.checkArgument(!d.isUndefined(a),"Must specify a length");var b=this.buf.slice(this.pos,this.pos+a);return this.pos=this.pos+a,b},h.prototype.readAll=function(){var a=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,a},h.prototype.readUInt8=function(){var a=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,a},h.prototype.readUInt16BE=function(){var a=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,a},h.prototype.readUInt16LE=function(){var a=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,a},h.prototype.readUInt32BE=function(){var a=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,a},h.prototype.readUInt32LE=function(){var a=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,a},h.prototype.readInt32LE=function(){var a=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,a},h.prototype.readUInt64BEBN=function(){var a=this.buf.slice(this.pos,this.pos+8),b=g.fromBuffer(a);return this.pos=this.pos+8,b},h.prototype.readUInt64LEBN=function(){var a,b=this.buf.readUInt32LE(this.pos),c=this.buf.readUInt32LE(this.pos+4),d=4294967296*c+b;if(9007199254740991>=d)a=new g(d);else{var e=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);a=new g(e,10,"le")}return this.pos=this.pos+8,a},h.prototype.readVarintNum=function(){var a=this.readUInt8();switch(a){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var b=this.readUInt64LEBN(),c=b.toNumber();if(c<=Math.pow(2,53))return c;throw new Error("number too large to retain precision - use readVarintBN");default:return a}},h.prototype.readVarLengthBuffer=function(){var a=this.readVarintNum(),b=this.read(a);return e.checkState(b.length===a,"Invalid length while reading varlength buffer. Expected to read: "+a+" and read "+b.length),b},h.prototype.readVarintBuf=function(){var a=this.buf.readUInt8(this.pos);switch(a){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},h.prototype.readVarintBN=function(){var a=this.readUInt8();switch(a){case 253:return new g(this.readUInt16LE());case 254:return new g(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new g(a)}},h.prototype.reverse=function(){for(var a=new c(this.buf.length),b=0;ba?(b=new c(1),b.writeUInt8(a,0)):65536>a?(b=new c(3),b.writeUInt8(253,0),b.writeUInt16LE(a,1)):4294967296>a?(b=new c(5),b.writeUInt8(254,0),b.writeUInt32LE(a,1)):(b=new c(9),b.writeUInt8(255,0),b.writeInt32LE(-1&a,1),b.writeUInt32LE(Math.floor(a/4294967296),5)),b},f.varintBufBN=function(a){var b=void 0,d=a.toNumber();if(253>d)b=new c(1),b.writeUInt8(d,0);else if(65536>d)b=new c(3),b.writeUInt8(253,0),b.writeUInt16LE(d,1);else if(4294967296>d)b=new c(5),b.writeUInt8(254,0),b.writeUInt32LE(d,1);else{var e=new f;e.writeUInt8(255),e.writeUInt64LEBN(a);var b=e.concat()}return b},b.exports=f}).call(this,a("buffer").Buffer)},{"../util/buffer":81,assert:29,buffer:187}],54:[function(a,b,c){(function(c){"use strict";var d=a("./bufferwriter"),e=a("./bufferreader"),f=a("../crypto/bn"),g=function h(a){if(!(this instanceof h))return new h(a);if(c.isBuffer(a))this.buf=a;else if("number"==typeof a){var b=a;this.fromNumber(b)}else if(a instanceof f){var d=a;this.fromBN(d)}else if(a){var e=a;this.set(e)}};g.prototype.set=function(a){return this.buf=a.buf||this.buf,this},g.prototype.fromString=function(a){return this.set({buf:new c(a,"hex")}),this},g.prototype.toString=function(){return this.buf.toString("hex")},g.prototype.fromBuffer=function(a){return this.buf=a,this},g.prototype.fromBufferReader=function(a){return this.buf=a.readVarintBuf(),this},g.prototype.fromBN=function(a){return this.buf=d().writeVarintBN(a).concat(),this},g.prototype.fromNumber=function(a){return this.buf=d().writeVarintNum(a).concat(),this},g.prototype.toBuffer=function(){return this.buf},g.prototype.toBN=function(){return e(this.buf).readVarintBN()},g.prototype.toNumber=function(){return e(this.buf).readVarintNum()},b.exports=g}).call(this,a("buffer").Buffer)},{"../crypto/bn":44,"./bufferreader":52,"./bufferwriter":53,buffer:187}],55:[function(a,b,c){"use strict";function d(a,b){return a.replace("{0}",b[0]).replace("{1}",b[1]).replace("{2}",b[2])}var e=a("lodash"),f=function(a,b){var c=function(){if(e.isString(b.message))this.message=d(b.message,arguments);else{if(!e.isFunction(b.message))throw new Error("Invalid error definition for "+b.name);this.message=b.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return c.prototype=Object.create(a.prototype),c.prototype.name=a.prototype.name+b.name,a[b.name]=c,b.errors&&g(c,b.errors),c},g=function(a,b){e.each(b,function(b){f(a,b)})},h=function(a,b){return g(a,b),a},i={};i.Error=function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack},i.Error.prototype=Object.create(Error.prototype),i.Error.prototype.name="bitcore.Error";var j=a("./spec");h(i.Error,j),b.exports=i.Error,b.exports.extend=function(a){return f(i.Error,a)}},{"./spec":56,lodash:87}],56:[function(a,b,c){"use strict";var d="http://bitcore.io/";b.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+d+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"MerkleBlock",message:"Internal Error on MerkleBlock {0}",errors:[{name:"InvalidMerkleTree",message:"This MerkleBlock contain an invalid Merkle Tree"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]},{}],57:[function(a,b,c){(function(c){"use strict";function d(a){if(a instanceof d)return a;if(!(this instanceof d))return new d(a);if(!a)return this._generateRandomly();if(m.get(a))return this._generateRandomly(a);if(g.isString(a)||s.isBuffer(a))if(d.isValidSerialized(a))this._buildFromSerialized(a);else if(t.isValidJSON(a))this._buildFromJSON(a);else{if(!s.isBuffer(a)||!d.isValidSerialized(a.toString()))throw d.getSerializedError(a);this._buildFromSerialized(a.toString())}else{if(!g.isObject(a))throw new r.UnrecognizedArgument(a);this._buildFromObject(a)}}var e=a("assert"),f=a("buffer"),g=a("lodash"),h=a("./util/preconditions"),i=a("./crypto/bn"),j=a("./encoding/base58"),k=a("./encoding/base58check"),l=a("./crypto/hash"),m=a("./networks"),n=a("./crypto/point"),o=a("./privatekey"),p=a("./crypto/random"),q=a("./errors"),r=q.HDPrivateKey,s=a("./util/buffer"),t=a("./util/js"),u=128,v=1/8,w=512; +!function(){function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0&&(c.lastNotificationId=e.last(d).id),e.each(d,function(a){c.emit("notification",a)}),b())})},d.prototype._initNotifications=function(a){var b=this;a=a||{};var c=a.notificationIntervalSeconds||5;b.notificationsIntervalId=setInterval(function(){b._fetchLatestNotifications(c,function(a){a&&(a instanceof x.NOT_FOUND||a instanceof x.NOT_AUTHORIZED)&&b._disposeNotifications()})},1e3*c)},d.prototype._disposeNotifications=function(){var a=this;a.notificationsIntervalId&&(clearInterval(a.notificationsIntervalId),a.notificationsIntervalId=null)},d.prototype.setNotificationsInterval=function(a){var b=this;b._disposeNotifications(),a>0&&b._initNotifications({notificationIntervalSeconds:a})},d._encryptMessage=function(a,b){return a?r.encryptMessage(a,b):null},d._decryptMessage=function(a,b){if(!a)return"";try{return r.decryptMessage(a,b)}catch(c){return""}},d.prototype._processTxNotes=function(a){var b=this;if(a){var c=b.credentials.sharedEncryptingKey;e.each([].concat(a),function(a){a.encryptedBody=a.body,a.body=d._decryptMessage(a.body,c),a.encryptedEditedByName=a.editedByName,a.editedByName=d._decryptMessage(a.editedByName,c)})}},d.prototype._processTxps=function(a){var b=this;if(a){var c=b.credentials.sharedEncryptingKey;e.each([].concat(a),function(a){a.encryptedMessage=a.message,a.message=d._decryptMessage(a.message,c)||null,a.creatorName=d._decryptMessage(a.creatorName,c),e.each(a.actions,function(a){a.copayerName=d._decryptMessage(a.copayerName,c),a.comment=d._decryptMessage(a.comment,c)}),e.each(a.outputs,function(a){a.encryptedMessage=a.message,a.message=d._decryptMessage(a.message,c)||null}),a.hasUnconfirmedInputs=e.some(a.inputs,function(a){return 0==a.confirmations}),b._processTxNotes(a.note)})}},d._parseError=function(a){if(a){if(e.isString(a))try{a=JSON.parse(a)}catch(b){a={error:a}}var c;return a.code?x[a.code]?(c=new x[a.code],a.message&&(c.message=a.message)):c=new Error(a.code+": "+a.message):c=new Error(a.error||JSON.stringify(a)),t.error(c),c}},d._signRequest=function(a,b,c,d){var e=[a.toLowerCase(),b,JSON.stringify(c)].join("|");return r.signMessage(e,d)},d.prototype.seedFromRandom=function(a){f.checkArgument(arguments.length<=1,"DEPRECATED: only 1 argument accepted."),f.checkArgument(e.isUndefined(a)||e.isObject(a),"DEPRECATED: argument should be an options object."),a=a||{},this.credentials=u.create(a.coin||"btc",a.network||"livenet")};var z;d.prototype.validateKeyDerivation=function(a,b){function c(a,b){var c="m/0/0",d="Lorem ipsum dolor sit amet, ne amet urbanitas percipitur vim, libris disputando his ne, et facer suavitate qui. Ei quidam laoreet sea. Cu pro dico aliquip gubergren, in mundi postea usu. Ad labitur posidonium interesset duo, est et doctus molestie adipiscing.",e=a.deriveChild(c).privateKey,f=r.signMessage(d,e),g=b.deriveChild(c).publicKey;return r.verifyMessage(d,f,g)}function d(){var a="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",b=l(a).toHDPrivateKey();if("xprv9s21ZrQH143K3GJpoapnV8SFfukcVBSfeCficPSGfubmSFDxo1kuHnLisriDvSnRRuL2Qrg5ggqHKNVpxR86QEC8w35uxmGoggxtQTPvfUu"!=b.toString())return!1;if(b=b.deriveChild("m/44'/0'/0'"),"xprv9xpXFhFpqdQK3TmytPBqXtGSwS3DLjojFhTGht8gwAAii8py5X6pxeBnQ6ehJiyJ6nDjWGJfZ95WxByFXVkDxHXrqu53WCRGypk2ttuqncb"!=b.toString())return!1;var d=j.HDPublicKey.fromString("xpub6BosfCnifzxcFwrSzQiqu2DBVTshkCXacvNsWGYJVVhhawA7d4R5WSWGFNbi8Aw6ZRc1brxMyWMzG3DSSSSoekkudhUd9yLb6qx39T9nMdj");return c(b,d)}function e(){var b;try{b=g.getMnemonic()}catch(d){}var e;if(b&&(!g.mnemonicHasPassphrase||a.passphrase)){var f=new l(b);e=f.toHDPrivateKey(a.passphrase,g.network)}e||(e=new j.HDPrivateKey(g.xPrivKey)),e=e.deriveChild(g.getBaseAddressDerivationPath());var h=new j.HDPublicKey(g.xPubKey);return c(e,h)}var f=this;a=a||{};var g=f.credentials,h=!0;z||a.skipDeviceValidation||(h=d(),z=!0);var i=g.canSign()&&!g.isPrivKeyEncrypted()?e():!0;return f.keyDerivationOk=h&&i,b(null,f.keyDerivationOk)},d.prototype.seedFromRandomWithMnemonic=function(a){f.checkArgument(arguments.length<=1,"DEPRECATED: only 1 argument accepted."),f.checkArgument(e.isUndefined(a)||e.isObject(a),"DEPRECATED: argument should be an options object."),a=a||{},this.credentials=u.createWithMnemonic(a.coin||"btc",a.network||"livenet",a.passphrase,a.language||"en",a.account||0)},d.prototype.getMnemonic=function(){return this.credentials.getMnemonic()},d.prototype.mnemonicHasPassphrase=function(){return this.credentials.mnemonicHasPassphrase},d.prototype.clearMnemonic=function(){return this.credentials.clearMnemonic()},d.prototype.seedFromExtendedPrivateKey=function(a,b){b=b||{},this.credentials=u.fromExtendedPrivateKey(b.coin||"btc",a,b.account||0,b.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44,b)},d.prototype.seedFromMnemonic=function(a,b){f.checkArgument(e.isUndefined(b)||e.isObject(b),"DEPRECATED: second argument should be an options object."),b=b||{},this.credentials=u.fromMnemonic(b.coin||"btc",b.network||"livenet",a,b.passphrase,b.account||0,b.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44,b)},d.prototype.seedFromExtendedPublicKey=function(a,b,c,d){f.checkArgument(e.isUndefined(d)||e.isObject(d)),d=d||{},this.credentials=u.fromExtendedPublicKey(d.coin||"btc",a,b,c,d.account||0,d.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44)},d.prototype["export"]=function(a){f.checkState(this.credentials),a=a||{};var b,c=u.fromObj(this.credentials);return a.noSign?c.setNoSign():a.password&&c.decryptPrivateKey(a.password),b=JSON.stringify(c.toObj())},d.prototype["import"]=function(a){try{var b=u.fromObj(JSON.parse(a));this.credentials=b}catch(c){throw new x.INVALID_BACKUP}},d.prototype._import=function(a){f.checkState(this.credentials);var b=this;b.openWallet(function(c,d){return c?c instanceof x.NOT_AUTHORIZED||b.isPrivKeyExternal()?a(c):(t.info("Copayer not found, trying to add access"),void b.addAccess({},function(c){return c?a(new x.WALLET_DOES_NOT_EXIST):void b.openWallet(a)})):a(null,d)})},d.prototype.importFromMnemonic=function(a,b,c){function d(c){return u.fromMnemonic(b.coin||"btc",b.network||"livenet",a,b.passphrase,b.account||0,b.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44,{nonCompliantDerivation:c,entropySourcePath:b.entropySourcePath,walletPrivKey:b.walletPrivKey})}t.debug("Importing from 12 Words");var e=this;b=b||{};try{e.credentials=d(!1)}catch(f){return t.info("Mnemonic error:",f),c(new x.INVALID_BACKUP)}e._import(function(a,b){if(!a)return c(null,b);if(a instanceof x.INVALID_BACKUP)return c(a);if(a instanceof x.NOT_AUTHORIZED||a instanceof x.WALLET_DOES_NOT_EXIST){var f=d(!0);return f.xPubKey.toString()==e.credentials.xPubKey.toString()?c(a):(e.credentials=f,e._import(c))}return c(a)})},d.prototype.importFromExtendedPrivateKey=function(a,b,c){t.debug("Importing from Extended Private Key"),c||(c=b,b={},t.warn("DEPRECATED WARN: importFromExtendedPrivateKey should receive 3 parameters."));try{this.credentials=u.fromExtendedPrivateKey(b.coin||"btc",a,b.account||0,b.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44,b)}catch(d){return t.info("xPriv error:",d),c(new x.INVALID_BACKUP)}this._import(c)},d.prototype.importFromExtendedPublicKey=function(a,b,c,d,g){f.checkArgument(5==arguments.length,"DEPRECATED: should receive 5 arguments"),f.checkArgument(e.isUndefined(d)||e.isObject(d)),f.shouldBeFunction(g),d=d||{},t.debug("Importing from Extended Private Key");try{this.credentials=u.fromExtendedPublicKey(d.coin||"btc",a,b,c,d.account||0,d.derivationStrategy||q.DERIVATION_STRATEGIES.BIP44,d)}catch(h){return t.info("xPriv error:",h),g(new x.INVALID_BACKUP)}this._import(g)},d.prototype.decryptBIP38PrivateKey=function(b,d,e,f){var g,h=a("bip38"),i=new h;try{g=i.decrypt(b,d)}catch(k){return f(new Error("Could not decrypt BIP38 private key",k))}var l=new j.PrivateKey(g),m=l.publicKey.toAddress().toString(),n=new c(m,"ascii"),o=j.crypto.Hash.sha256sha256(n).toString("hex").substring(0,8),p=j.encoding.Base58Check.decode(b).toString("hex").substring(6,14);return o!=p?f(new Error("Incorrect passphrase")):f(null,g)},d.prototype.getBalanceFromPrivateKey=function(a,b,c){var d=this;e.isFunction(b)&&(c=b,b="btc");var f=k[b],a=new f.PrivateKey(a),g=a.publicKey.toAddress();d.getUtxos({addresses:g.toString()},function(a,b){return a?c(a):c(null,e.sumBy(b,"satoshis"))})},d.prototype.buildTxFromPrivateKey=function(a,b,c,d){var f=this;c=c||{};var g=c.coin||"btc",i=k[g],a=i.PrivateKey(a),j=a.publicKey.toAddress();h.waterfall([function(a){f.getUtxos({addresses:j.toString()},function(b,c){return a(b,c)})},function(d,f){if(!e.isArray(d)||0==d.length)return f(new Error("No utxos found"));var g=c.fee||1e4,h=e.sumBy(d,"satoshis")-g;if(0>=h)return f(new x.INSUFFICIENT_FUNDS);var j;try{var k=i.Address.fromString(b);j=(new i.Transaction).from(d).to(k,h).fee(g).sign(a),j.serialize()}catch(l){return t.error("Could not build transaction from private key",l),f(new x.COULD_NOT_BUILD_TRANSACTION)}return f(null,j)}],d)},d.prototype.openWallet=function(a){f.checkState(this.credentials);var b=this;return b.credentials.isComplete()&&b.credentials.hasWalletInfo()?a(null,!0):void b._doGetRequest("/v2/wallets/?includeExtendedInfo=1",function(c,f){if(c)return a(c);var g=f.wallet;if(b._processStatus(f),!b.credentials.hasWalletInfo()){var h=e.find(g.copayers,{id:b.credentials.copayerId});b.credentials.addWalletInfo(g.id,g.name,g.m,g.n,h.name)}if("complete"!=g.status)return a();if(b.credentials.walletPrivKey){if(!v.checkCopayers(b.credentials,g.copayers))return a(new x.SERVER_COMPROMISED)}else t.warn("Could not verify copayers key (missing wallet Private Key)");return b.credentials.addPublicKeyRing(d._extractPublicKeyRing(g.copayers)),b.emit("walletCompleted",g),a(null,f)})},d.prototype._getHeaders=function(a,b,c){var d={"x-client-version":"bwc-"+w.version};return this.supportStaffWalletId&&(d["x-wallet-id"]=this.supportStaffWalletId),d},d.prototype._doRequest=function(a,b,c,f,h){var i=this,j=i._getHeaders(a,b,c);if(i.credentials)if(j["x-identity"]=i.credentials.copayerId,f&&i.session)j["x-session"]=i.session;else{var k,l=c._requestPrivKey||i.credentials.requestPrivKey;l&&(delete c._requestPrivKey,k=d._signRequest(a,b,c,l)),j["x-signature"]=k}var m=i.request[a](i.baseUrl+b);m.accept("json"),e.each(j,function(a,b){a&&m.set(b,a)}),c&&("post"==a||"put"==a?m.send(c):m.query(c)),m.timeout(i.timeout),m.end(function(a,b){return b?(b.body&&t.debug(g.inspect(b.body,{depth:10})),200!==b.status?404===b.status?h(new x.NOT_FOUND):b.status?(t.error("HTTP Error:"+b.status),h(b.body?d._parseError(b.body):new Error(b.status))):h(new x.CONNECTION_ERROR):'{"error":"read ECONNRESET"}'===b.body?h(new x.ECONNRESET_ERROR(JSON.parse(b.body))):h(null,b.body,b.header)):h(new x.CONNECTION_ERROR)})},d.prototype._login=function(a){this._doPostRequest("/v1/login",{},a)},d.prototype._logout=function(a){this._doPostRequest("/v1/logout",{},a)},d.prototype._doRequestWithLogin=function(a,b,c,d){function e(a){f._login(function(b,c){return b?a(b):c?(f.session=c,void a()):a(new x.NOT_AUTHORIZED)})}var f=this;h.waterfall([function(a){return f.session?a():void e(a)},function(d){f._doRequest(a,b,c,!0,function(g,h,i){g&&g instanceof x.NOT_AUTHORIZED&&e(function(e){return e?d(e):f._doRequest(a,b,c,!0,d)}),d(null,h,i)})}],d)},d.prototype._doPostRequest=function(a,b,c){return this._doRequest("post",a,b,!1,c)},d.prototype._doPutRequest=function(a,b,c){return this._doRequest("put",a,b,!1,c)},d.prototype._doGetRequest=function(a,b){return a+=a.indexOf("?")>0?"&":"?",a+="r="+e.random(1e4,99999),this._doRequest("get",a,{},!1,b)},d.prototype._doGetRequestWithLogin=function(a,b){return a+=a.indexOf("?")>0?"&":"?",a+="r="+e.random(1e4,99999),this._doRequestWithLogin("get",a,{},b)},d.prototype._doDeleteRequest=function(a,b){return this._doRequest("delete",a,{},!1,b)},d._buildSecret=function(a,b,d,f){e.isString(b)&&(b=j.PrivateKey.fromString(b));var g=new c(a.replace(/-/g,""),"hex"),h=new j.encoding.Base58(g).toString();return e.padEnd(h,22,"0")+b.toWIF()+("testnet"==f?"T":"L")+d},d.parseSecret=function(a){function b(a,b){var c=[];b.push(a.length);for(var d=0;d1?j:null)})})},d.prototype.joinWallet=function(a,b,c,f){var g=this;if(f||(f=c,c={},t.warn("DEPRECATED WARN: joinWallet should receive 4 parameters.")),!g._checkKeyDerivation())return f(new Error("Cannot join wallet"));c=c||{};var h=c.coin||"btc";if(!e.includes(["btc","bch"],h))return f(new Error("Invalid coin"));try{var i=d.parseSecret(a)}catch(j){return f(j)}g.credentials||g.seedFromRandom({coin:h,network:i.network}),g.credentials.addWalletPrivateKey(i.walletPrivKey.toString()),g._doJoinWallet(i.walletId,i.walletPrivKey,g.credentials.xPubKey,g.credentials.requestPubKey,b,{coin:h,dryRun:!!c.dryRun},function(a,d){return a?f(a):(c.dryRun||g.credentials.addWalletInfo(d.id,d.name,d.m,d.n,b),f(null,d))})},d.prototype.recreateWallet=function(a){f.checkState(this.credentials),f.checkState(this.credentials.isComplete()),f.checkState(this.credentials.walletPrivKey);var b=this;this.getStatus({includeExtendedInfo:!0},function(c){if(!c)return t.info("Wallet is already created"),a();var d=b.credentials,e=j.PrivateKey.fromString(d.walletPrivKey),f=d.walletId,g=d.derivationStrategy!=q.DERIVATION_STRATEGIES.BIP45,i=r.encryptMessage(d.walletName||"recovered wallet",d.sharedEncryptingKey),k=(d.coin,{name:i,m:d.m,n:d.n,pubKey:e.toPublicKey().toString(),coin:d.coin,network:d.network,id:f,supportBIP44AndP2PKH:g});b._doPostRequest("/v2/wallets/",k,function(c,i){if(c)return c instanceof x.WALLET_ALREADY_EXISTS?b.addAccess({},function(c){return c?a(c):void b.openWallet(function(b){return a(b)})}):a(c);f||(f=i.walletId);var j=1;h.each(b.credentials.publicKeyRing,function(a,c){var h=a.copayerName||"copayer "+j++;b._doJoinWallet(f,e,a.xPubKey,a.requestPubKey,h,{coin:d.coin,supportBIP44AndP2PKH:g},function(a){return a&&a instanceof x.COPAYER_IN_WALLET?c():c(a)})},a)})})},d.prototype._processWallet=function(a){var b=this,c=b.credentials.sharedEncryptingKey,d=r.decryptMessageNoThrow(a.name,c);d!=a.name&&(a.encryptedName=a.name),a.name=d,e.each(a.copayers,function(a){var b=r.decryptMessageNoThrow(a.name,c);b!=a.name&&(a.encryptedName=a.name),a.name=b,e.each(a.requestPubKeys,function(a){if(a.name){var b=r.decryptMessageNoThrow(a.name,c);b!=a.name&&(a.encryptedName=a.name),a.name=b}})})},d.prototype._processStatus=function(a){function b(a){var b=a.wallet.copayers;if(b){var d=e.find(b,{id:c.credentials.copayerId});if(d&&d.customData){var f;try{f=JSON.parse(r.decryptMessage(d.customData,c.credentials.personalEncryptingKey))}catch(g){t.warn("Could not decrypt customData:",d.customData)}f&&(a.customData=f,!c.credentials.walletPrivKey&&f.walletPrivKey&&c.credentials.addWalletPrivateKey(f.walletPrivKey))}}}var c=this;b(a),c._processWallet(a.wallet),c._processTxps(a.pendingTxps)},d.prototype.getNotifications=function(a,b){f.checkState(this.credentials);var c=this;a=a||{};var d="/v1/notifications/";a.lastNotificationId?d+="?notificationId="+a.lastNotificationId:a.timeSpan&&(d+="?timeSpan="+a.timeSpan),c._doGetRequestWithLogin(d,function(d,f){if(d)return b(d);var g=e.filter(f,function(b){return a.includeOwn||b.creatorId!=c.credentials.copayerId});return b(null,g)})},d.prototype.getStatus=function(a,b){f.checkState(this.credentials),b||(b=a,a={},t.warn("DEPRECATED WARN: getStatus should receive 2 parameters."));var c=this;a=a||{};var e=[];e.push("includeExtendedInfo="+(a.includeExtendedInfo?"1":"0")),e.push("twoStep="+(a.twoStep?"1":"0")),c._doGetRequest("/v2/wallets/?"+e.join("&"),function(a,e){if(a)return b(a);if("pending"==e.wallet.status){var f=c.credentials;e.wallet.secret=d._buildSecret(f.walletId,f.walletPrivKey,f.coin,f.network)}return c._processStatus(e),b(a,e)})},d.prototype.getPreferences=function(a){f.checkState(this.credentials),f.checkArgument(a);var b=this;b._doGetRequest("/v1/preferences/",function(b,c){return b?a(b):a(null,c)})},d.prototype.savePreferences=function(a,b){f.checkState(this.credentials),f.checkArgument(b);var c=this;c._doPutRequest("/v1/preferences/",a,b)},d.prototype.fetchPayPro=function(a,b){f.checkArgument(a).checkArgument(a.payProUrl),s.get({url:a.payProUrl,http:this.payProHttp,coin:this.credentials.coin||"btc"},function(a,c){return a?b(a):b(null,c)})},d.prototype.getUtxos=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete()),a=a||{};var c="/v1/utxos/";a.addresses&&(c+="?"+n.stringify({addresses:[].concat(a.addresses).join(",")})),this._doGetRequest(c,b)},d.prototype._getCreateTxProposalArgs=function(a){var b=this,c=e.cloneDeep(a);return c.message=d._encryptMessage(a.message,this.credentials.sharedEncryptingKey)||null,c.payProUrl=a.payProUrl||null,e.each(c.outputs,function(a){a.message=d._encryptMessage(a.message,b.credentials.sharedEncryptingKey)||null}),c},d.prototype.createTxProposal=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete()),f.checkState(this.credentials.sharedEncryptingKey),f.checkArgument(a);var c=this,d=c._getCreateTxProposalArgs(a);c._doPostRequest("/v2/txproposals/",d,function(a,e){return a?b(a):(c._processTxps(e),v.checkProposalCreation(d,e,c.credentials.sharedEncryptingKey)?b(null,e):b(new x.SERVER_COMPROMISED))})},d.prototype.publishTxProposal=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete()),f.checkArgument(a).checkArgument(a.txp),f.checkState(parseInt(a.txp.version)>=3);var c=this,d=r.buildTx(a.txp),e=d.uncheckedSerialize(),g={proposalSignature:r.signMessage(e,c.credentials.requestPrivKey)},h="/v1/txproposals/"+a.txp.id+"/publish/";c._doPostRequest(h,g,function(a,d){return a?b(a):(c._processTxps(d),b(null,d))})},d.prototype.createAddress=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this;return b||(b=a,a={},t.warn("DEPRECATED WARN: createAddress should receive 2 parameters.")),c._checkKeyDerivation()?(a=a||{},void c._doPostRequest("/v3/addresses/",a,function(a,d){return a?b(a):v.checkAddress(c.credentials,d)?b(null,d):b(new x.SERVER_COMPROMISED)})):b(new Error("Cannot create new address for this wallet"))},d.prototype.getMainAddresses=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this;a=a||{};var d=[];a.limit&&d.push("limit="+a.limit),a.reverse&&d.push("reverse=1");var g="";d.length>0&&(g="?"+d.join("&"));var h="/v1/addresses/"+g;c._doGetRequest(h,function(d,f){if(d)return b(d);if(!a.doNotVerify){var g=e.some(f,function(a){return!v.checkAddress(c.credentials,a)});if(g)return b(new x.SERVER_COMPROMISED)}return b(null,f)})},d.prototype.getBalance=function(a,b){b||(b=a,a={},t.warn("DEPRECATED WARN: getBalance should receive 2 parameters."));a=a||{},f.checkState(this.credentials&&this.credentials.isComplete());var c=[];if(a.twoStep&&c.push("?twoStep=1"),a.coin){if(!e.includes(["btc","bch"],a.coin))return b(new Error("Invalid coin"));c.push("coin="+a.coin)}var d="";c.length>0&&(d="?"+c.join("&"));var g="/v1/balance/"+d;this._doGetRequest(g,b)},d.prototype.getTxProposals=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this;c._doGetRequest("/v1/txproposals/",function(d,e){return d?b(d):(c._processTxps(e),void h.every(e,function(b,d){return a.doNotVerify?d(!0):void c.getPayPro(b,function(a,e){var f=v.checkTxProposal(c.credentials,b,{paypro:e});return d(f)})},function(d){if(!d)return b(new x.SERVER_COMPROMISED);var f;return f=a.forAirGapped?{txps:JSON.parse(JSON.stringify(e)),encryptedPkr:a.doNotEncryptPkr?null:r.encryptMessage(JSON.stringify(c.credentials.publicKeyRing),c.credentials.personalEncryptingKey),unencryptedPkr:a.doNotEncryptPkr?JSON.stringify(c.credentials.publicKeyRing):null,m:c.credentials.m,n:c.credentials.n}:e,b(null,f)}))})},d.prototype.getPayPro=function(a,b){var c=this;return!a.payProUrl||this.doNotVerifyPayPro?b():void s.get({url:a.payProUrl,http:c.payProHttp,coin:a.coin||"btc"},function(a,c){return a?b(new Error("Cannot check transaction now:"+a)):b(null,c)})},d.prototype.signTxProposal=function(a,b,c){f.checkState(this.credentials&&this.credentials.isComplete()),f.checkArgument(a.creatorId),e.isFunction(b)&&(c=b,b=null);var d=this;if(!a.signatures){if(!d.canSign())return c(new x.MISSING_PRIVATE_KEY);if(d.isPrivKeyEncrypted()&&!b)return c(new x.ENCRYPTED_PRIVATE_KEY)}d.getPayPro(a,function(f,g){if(f)return c(f);var h=v.checkTxProposal(d.credentials,a,{paypro:g});if(!h)return c(new x.SERVER_COMPROMISED);var i=a.signatures;if(e.isEmpty(i))try{i=d._signTxp(a,b)}catch(j){return t.error("Error signing tx",j),c(j)}var k="/v1/txproposals/"+a.id+"/signatures/",l={signatures:i};d._doPostRequest(k,l,function(a,b){return a?c(a):(d._processTxps(b),c(null,b))})})},d.prototype.signTxProposalFromAirGapped=function(a,b,c,d,g){f.checkState(this.credentials);var h=this;if(!h.canSign())throw new x.MISSING_PRIVATE_KEY;if(h.isPrivKeyEncrypted()&&!g)throw new x.ENCRYPTED_PRIVATE_KEY;var i;try{i=JSON.parse(r.decryptMessage(b,h.credentials.personalEncryptingKey))}catch(j){throw new Error("Could not decrypt public key ring")}if(!e.isArray(i)||i.length!=d)throw new Error("Invalid public key ring");if(h.credentials.m=c,h.credentials.n=d,h.credentials.addressType=a.addressType,h.credentials.addPublicKeyRing(i),!v.checkTxProposalSignature(h.credentials,a))throw new Error("Fake transaction proposal");return h._signTxp(a,g)},d.signTxProposalFromAirGapped=function(a,b,c,f,g,h){h=h||{};var i=h.coin||"btc";if(!e.includes(["btc","bch"],i))return cb(new Error("Invalid coin"));var j=JSON.parse(c);if(!e.isArray(j)||j.length!=g)throw new Error("Invalid public key ring");var k=new d({baseUrl:"https://bws.example.com/bws/api"});if("xprv"===a.slice(0,4)||"tprv"===a.slice(0,4)){if("xprv"===a.slice(0,4)&&"testnet"==b.network)throw new Error("testnet HD keys must start with tprv");if("tprv"===a.slice(0,4)&&"livenet"==b.network)throw new Error("livenet HD keys must start with xprv");k.seedFromExtendedPrivateKey(a,{coin:i,account:h.account,derivationStrategy:h.derivationStrategy})}else k.seedFromMnemonic(a,{coin:i,network:b.network,passphrase:h.passphrase,account:h.account,derivationStrategy:h.derivationStrategy});if(k.credentials.m=f,k.credentials.n=g,k.credentials.addressType=b.addressType,k.credentials.addPublicKeyRing(j),!v.checkTxProposalSignature(k.credentials,b))throw new Error("Fake transaction proposal");return k._signTxp(b)},d.prototype.rejectTxProposal=function(a,b,c){f.checkState(this.credentials&&this.credentials.isComplete()),f.checkArgument(c);var e=this,g="/v1/txproposals/"+a.id+"/rejections/",h={reason:d._encryptMessage(b,e.credentials.sharedEncryptingKey)||""};e._doPostRequest(g,h,function(a,b){return a?c(a):(e._processTxps(b),c(null,b))})},d.prototype.broadcastRawTx=function(a,b){f.checkState(this.credentials),f.checkArgument(b);var c=this;a=a||{};var d="/v1/broadcast_raw/";c._doPostRequest(d,a,function(a,c){return a?b(a):b(null,c)})},d.prototype._doBroadcast=function(a,b){var c=this,d="/v1/txproposals/"+a.id+"/broadcast/";c._doPostRequest(d,{},function(a,d){return a?b(a):(c._processTxps(d),b(null,d))})},d.prototype.broadcastTxProposal=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this;c.getPayPro(a,function(d,e){if(e){var f=r.buildTx(a);c._applyAllSignatures(a,f),s.send({http:c.payProHttp,url:a.payProUrl,amountSat:a.amount,refundAddr:a.changeAddress.address,merchant_data:e.merchant_data,rawTx:f.serialize({disableSmallFees:!0,disableLargeFees:!0,disableDustOutputs:!0}),coin:a.coin||"btc"},function(d,e,f){return d?b(d):void c._doBroadcast(a,function(a,c){return b(a,c,f)})})}else c._doBroadcast(a,b)})},d.prototype.removeTxProposal=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this,d="/v1/txproposals/"+a.id;c._doDeleteRequest(d,function(a){return b(a)})},d.prototype.getTxHistory=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this,d=[];a&&(a.skip&&d.push("skip="+a.skip),a.limit&&d.push("limit="+a.limit),a.includeExtendedInfo&&d.push("includeExtendedInfo=1"));var e="";d.length>0&&(e="?"+d.join("&"));var g="/v1/txhistory/"+e;c._doGetRequest(g,function(a,d){return a?b(a):(c._processTxps(d),b(null,d))})},d.prototype.getTx=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this,d="/v1/txproposals/"+a;this._doGetRequest(d,function(a,d){return a?b(a):(c._processTxps(d),b(null,d))})},d.prototype.startScan=function(a,b){f.checkState(this.credentials&&this.credentials.isComplete());var c=this,d={includeCopayerBranches:a.includeCopayerBranches};c._doPostRequest("/v1/addresses/scan",d,function(a){return b(a)})},d.prototype.addAccess=function(a,b){ +f.checkState(this.credentials&&this.credentials.canSign()),a=a||{};var c=new j.PrivateKey(a.generateNewKey?null:this.credentials.requestPrivKey),d=c.toPublicKey().toString(),e=new j.HDPrivateKey(this.credentials.xPrivKey).deriveChild(this.credentials.getBaseAddressDerivationPath()),g=r.signRequestPubKey(d,e),h=this.credentials.copayerId,i=a.name?r.encryptMessage(a.name,this.credentials.sharedEncryptingKey):null,a={copayerId:h,requestPubKey:d,signature:g,name:i,restrictions:a.restrictions};this._doPutRequest("/v1/copayers/"+h+"/",a,function(a,d){return a?b(a):b(null,d.wallet,c)})},d.prototype.getTxNote=function(a,b){f.checkState(this.credentials);var c=this;a=a||{},c._doGetRequest("/v1/txnotes/"+a.txid+"/",function(a,d){return a?b(a):(c._processTxNotes(d),b(null,d))})},d.prototype.editTxNote=function(a,b){f.checkState(this.credentials);var c=this;a=a||{},a.body&&(a.body=d._encryptMessage(a.body,this.credentials.sharedEncryptingKey)),c._doPutRequest("/v1/txnotes/"+a.txid+"/",a,function(a,d){return a?b(a):(c._processTxNotes(d),b(null,d))})},d.prototype.getTxNotes=function(a,b){f.checkState(this.credentials);var c=this;a=a||{};var d=[];e.isNumber(a.minTs)&&d.push("minTs="+a.minTs);var g="";d.length>0&&(g="?"+d.join("&")),c._doGetRequest("/v1/txnotes/"+g,function(a,d){return a?b(a):(c._processTxNotes(d),b(null,d))})},d.prototype.getFiatRate=function(a,b){f.checkArgument(b);var c=this,a=a||{},d=[];a.ts&&d.push("ts="+a.ts),a.provider&&d.push("provider="+a.provider);var e="";d.length>0&&(e="?"+d.join("&")),c._doGetRequest("/v1/fiatrates/"+a.code+"/"+e,function(a,c){return a?b(a):b(null,c)})},d.prototype.pushNotificationsSubscribe=function(a,b){var c="/v1/pushnotifications/subscriptions/";this._doPostRequest(c,a,function(a,c){return a?b(a):b(null,c)})},d.prototype.pushNotificationsUnsubscribe=function(a,b){var c="/v2/pushnotifications/subscriptions/"+a;this._doDeleteRequest(c,b)},d.prototype.txConfirmationSubscribe=function(a,b){var c="/v1/txconfirmations/";this._doPostRequest(c,a,function(a,c){return a?b(a):b(null,c)})},d.prototype.txConfirmationUnsubscribe=function(a,b){var c="/v1/txconfirmations/"+a;this._doDeleteRequest(c,b)},d.prototype.getSendMaxInfo=function(a,b){var c=this,d=[];a=a||{},a.feeLevel&&d.push("feeLevel="+a.feeLevel),null!=a.feePerKb&&d.push("feePerKb="+a.feePerKb),a.excludeUnconfirmedUtxos&&d.push("excludeUnconfirmedUtxos=1"),a.returnInputs&&d.push("returnInputs=1");var e="";d.length>0&&(e="?"+d.join("&"));var f="/v1/sendmaxinfo/"+e;c._doGetRequest(f,function(a,c){return a?b(a):b(null,c)})},d.prototype.getStatusByIdentifier=function(a,b){f.checkState(this.credentials);var c=this;a=a||{};var e=[];e.push("includeExtendedInfo="+(a.includeExtendedInfo?"1":"0")),e.push("twoStep="+(a.twoStep?"1":"0")),c._doGetRequest("/v1/wallets/"+a.identifier+"?"+e.join("&"),function(a,e){if(a||!e||!e.wallet)return b(a);if("pending"==e.wallet.status){var f=c.credentials;e.wallet.secret=d._buildSecret(f.walletId,f.walletPrivKey,f.coin,f.network)}return c._processStatus(e),b(a,e)})},d.prototype._oldCopayDecrypt=function(a,b,c){var d,e="@#$",f="%^#@";try{var g=a+e+b;d=m.decrypt(g,c)}catch(h){g=a+f+b;try{d=m.decrypt(g,c)}catch(h){t.debug(h)}}if(!d)return null;var i;try{i=JSON.parse(d)}catch(h){}return i},d.prototype.getWalletIdsFromOldCopay=function(a,b,c){var d=this._oldCopayDecrypt(a,b,c);if(!d)return null;var f=d.walletIds.concat(e.keys(d.focusedTimestamps));return e.uniq(f)},d.prototype.createWalletFromOldCopay=function(a,b,c,d){var e=this._oldCopayDecrypt(a,b,c);return e?e.publicKeyRing.copayersExtPubKeys.length!=e.opts.totalCopayers?d(new Error("Wallet is incomplete, cannot be imported")):(this.credentials=u.fromOldCopayWallet(e),void this.recreateWallet(d)):d(new Error("Could not decrypt"))},b.exports=d}).call(this,a("buffer").Buffer)},{"../package.json":343,"./common":5,"./credentials":7,"./errors":8,"./log":11,"./paypro":12,"./verifier":13,async:30,bip38:37,"bitcore-lib":89,"bitcore-lib-cash":38,"bitcore-mnemonic":138,buffer:187,events:232,"json-stable-stringify":254,lodash:259,preconditions:276,querystring:293,sjcl:320,superagent:328,url:335,util:340}],3:[function(a,b,c){"use strict";var d={};d.SCRIPT_TYPES={P2SH:"P2SH",P2PKH:"P2PKH"},d.DERIVATION_STRATEGIES={BIP44:"BIP44",BIP45:"BIP45",BIP48:"BIP48"},d.PATHS={REQUEST_KEY:"m/1'/0",TXPROPOSAL_KEY:"m/1'/1",REQUEST_KEY_AUTH:"m/2"},d.BIP45_SHARED_INDEX=2147483647,d.UNITS={btc:{toSatoshis:1e8,full:{maxDecimals:8,minDecimals:8},"short":{maxDecimals:6,minDecimals:2}},bit:{toSatoshis:100,full:{maxDecimals:2,minDecimals:2},"short":{maxDecimals:0,minDecimals:0}}},b.exports=d},{}],4:[function(a,b,c){"use strict";var d={};d.DEFAULT_FEE_PER_KB=1e4,d.MIN_FEE_PER_KB=0,d.MAX_FEE_PER_KB=1e6,d.MAX_TX_FEE=1e8,b.exports=d},{}],5:[function(a,b,c){var d={};d.Constants=a("./constants"),d.Defaults=a("./defaults"),d.Utils=a("./utils"),b.exports=d},{"./constants":3,"./defaults":4,"./utils":6}],6:[function(a,b,c){(function(c){"use strict";function d(){}var e=a("lodash"),f=a("preconditions").singleton(),g=a("sjcl"),h=a("json-stable-stringify"),i=a("bitcore-lib"),j={btc:i,bch:a("bitcore-lib-cash")},k=i.PrivateKey,l=i.PublicKey,m=i.crypto,n=(i.encoding,a("./constants")),o=a("./defaults");d.SJCL={},d.encryptMessage=function(a,b){var c=g.codec.base64.toBits(b);return g.encrypt(c,a,e.defaults({ks:128,iter:1},d.SJCL))},d.decryptMessage=function(a,b){if(a){if(!b)throw"No key";var c=g.codec.base64.toBits(b);return g.decrypt(c,a)}},d.decryptMessageNoThrow=function(a,b){try{return d.decryptMessage(a,b)}catch(c){return a}},d.hashMessage=function(a){f.checkArgument(a);var b=new c(a),d=m.Hash.sha256sha256(b);return d=new i.encoding.BufferReader(d).readReverse()},d.signMessage=function(a,b){f.checkArgument(a);var c=new k(b),e=d.hashMessage(a);return m.ECDSA.sign(e,c,"little").toString()},d.verifyMessage=function(a,b,c){if(f.checkArgument(a),f.checkArgument(c),!b)return!1;var e=new l(c),g=d.hashMessage(a);try{var h=new m.Signature.fromString(b);return m.ECDSA.verify(g,h,e,"little")}catch(i){return!1}},d.privateKeyToAESKey=function(a){f.checkArgument(a&&e.isString(a)),f.checkArgument(i.PrivateKey.isValid(a),"The private key received is invalid");var b=i.PrivateKey.fromString(a);return i.crypto.Hash.sha256(b.toBuffer()).slice(0,16).toString("base64")},d.getCopayerHash=function(a,b,c){return[a,b,c].join("|")},d.getProposalHash=function(a){function b(a,b,c,d){return[a,b,c||"",d||""].join("|")}return arguments.length>1?b.apply(this,arguments):h(a)},d.deriveAddress=function(a,b,c,d,g,h){f.checkArgument(e.includes(e.values(n.SCRIPT_TYPES),a)),h=h||"btc";var i,k=j[h],l=e.map(b,function(a){var b=new k.HDPublicKey(a.xPubKey);return b.deriveChild(c).publicKey});switch(a){case n.SCRIPT_TYPES.P2SH:i=k.Address.createMultisig(l,d,g);break;case n.SCRIPT_TYPES.P2PKH:f.checkState(e.isArray(l)&&1==l.length),i=k.Address.fromPublicKey(l[0],g)}return{address:i.toString(),path:c,publicKeys:e.invokeMap(l,"toString")}},d.xPubToCopayerId=function(a,b){var c="btc"==a?b:a+b,d=g.hash.sha256.hash(c);return g.codec.hex.fromBits(d)},d.signRequestPubKey=function(a,b){var c=new i.HDPrivateKey(b).deriveChild(n.PATHS.REQUEST_KEY_AUTH).privateKey;return d.signMessage(a,c)},d.verifyRequestPubKey=function(a,b,c){var e=new i.HDPublicKey(c).deriveChild(n.PATHS.REQUEST_KEY_AUTH).publicKey;return d.verifyMessage(a,b,e.toString())},d.formatAmount=function(a,b,c){function d(a,b){var c=a.toString().split("."),d=(c[1]||"0").substring(0,b);return parseFloat(c[0]+"."+d)}function g(a,b,c,d){a=a.replace(".",c);var f=a.split(c),g=f[0],h=f[1];h=e.dropRightWhile(h,function(a,b){return"0"==a&&b>=d}).join("");var i=f.length>1?c+h:"";return g=g.replace(/\B(?=(\d{3})+(?!\d))/g,b),g+i}f.shouldBeNumber(a),f.checkArgument(e.includes(e.keys(n.UNITS),b)),c=c||{};var h=n.UNITS[b],i=c.fullPrecision?"full":"short",j=d(a/h.toSatoshis,h[i].maxDecimals).toFixed(h[i].maxDecimals);return g(j,c.thousandsSeparator||",",c.decimalSeparator||".",h[i].minDecimals)},d.buildTx=function(a){var b=a.coin||"btc",c=j[b],d=new c.Transaction;switch(f.checkState(e.includes(e.values(n.SCRIPT_TYPES),a.addressType)),a.addressType){case n.SCRIPT_TYPES.P2SH:e.each(a.inputs,function(b){d.from(b,b.publicKeys,a.requiredSignatures)});break;case n.SCRIPT_TYPES.P2PKH:d.from(a.inputs)}if(a.toAddress&&a.amount&&!a.outputs?d.to(a.toAddress,a.amount):a.outputs&&e.each(a.outputs,function(a){f.checkState(a.script||a.toAddress,"Output should have either toAddress or script specified"),a.script?d.addOutput(new c.Transaction.Output({script:a.script,satoshis:a.amount})):d.to(a.toAddress,a.amount)}),d.fee(a.fee),d.change(a.changeAddress.address),d.outputs.length>1){var g=e.reject(a.outputOrder,function(a){return a>=d.outputs.length});f.checkState(d.outputs.length==g.length),d.sortOutputs(function(a){return e.map(g,function(b){return a[b]})})}var h=e.reduce(a.inputs,function(a,b){return+b.satoshis+a},0),i=e.reduce(d.outputs,function(a,b){return+b.satoshis+a},0);return f.checkState(h-i>=0),f.checkState(h-i<=o.MAX_TX_FEE),d},b.exports=d}).call(this,a("buffer").Buffer)},{"./constants":3,"./defaults":4,"bitcore-lib":89,"bitcore-lib-cash":38,buffer:187,"json-stable-stringify":254,lodash:259,preconditions:276,sjcl:320}],7:[function(a,b,c){(function(c){"use strict";function d(){this.version="1.0.0",this.derivationStrategy=m.DERIVATION_STRATEGIES.BIP44,this.account=0}function e(a){if(!h.includes(["btc","bch"],a))throw new Error("Invalid coin")}function f(a){if(!h.includes(["livenet","testnet"],a))throw new Error("Invalid network")}var g=a("preconditions").singleton(),h=a("lodash"),i=a("bitcore-lib"),j=a("bitcore-mnemonic"),k=a("sjcl"),l=a("./common"),m=l.Constants,n=l.Utils,o=["coin","network","xPrivKey","xPrivKeyEncrypted","xPubKey","requestPrivKey","requestPubKey","copayerId","publicKeyRing","walletId","walletName","m","n","walletPrivKey","personalEncryptingKey","sharedEncryptingKey","copayerName","externalSource","mnemonic","mnemonicEncrypted","entropySource","mnemonicHasPassphrase","derivationStrategy","account","compliantDerivation","addressType","hwInfo","entropySourcePath"];d.create=function(a,b){e(a),f(b);var c=new d;return c.coin=a,c.network=b,c.xPrivKey=new i.HDPrivateKey(b).toString(),c.compliantDerivation=!0,c._expand(),c};var p={en:j.Words.ENGLISH,es:j.Words.SPANISH,ja:j.Words.JAPANESE,zh:j.Words.CHINESE,fr:j.Words.FRENCH,it:j.Words.ITALIAN};d.createWithMnemonic=function(a,b,c,h,i,k){if(e(a),f(b),!p[h])throw new Error("Unsupported language");g.shouldBeNumber(i),k=k||{};for(var l=new j(p[h]);!j.isValid(l.toString());)l=new j(p[h]);var m=new d;return m.coin=a,m.network=b,m.account=i,m.xPrivKey=l.toHDPrivateKey(c,b).toString(),m.compliantDerivation=!0,m._expand(),m.mnemonic=l.phrase,m.mnemonicHasPassphrase=!!c,m},d.fromExtendedPrivateKey=function(a,b,c,f,i){e(a),g.shouldBeNumber(c),g.checkArgument(h.includes(h.values(m.DERIVATION_STRATEGIES),f)),i=i||{};var j=new d;return j.coin=a,j.xPrivKey=b,j.account=c,j.derivationStrategy=f,j.compliantDerivation=!i.nonCompliantDerivation,i.walletPrivKey&&j.addWalletPrivateKey(i.walletPrivKey),j._expand(),j},d.fromMnemonic=function(a,b,c,i,k,l,n){e(a),f(b),g.shouldBeNumber(k),g.checkArgument(h.includes(h.values(m.DERIVATION_STRATEGIES),l)),n=n||{};var o=new j(c),p=new d;return p.coin=a,p.xPrivKey=o.toHDPrivateKey(i,b).toString(),p.mnemonic=c,p.mnemonicHasPassphrase=!!i,p.account=k,p.derivationStrategy=l,p.compliantDerivation=!n.nonCompliantDerivation,p.entropySourcePath=n.entropySourcePath,n.walletPrivKey&&p.addWalletPrivateKey(n.walletPrivKey),p._expand(),p},d.fromExtendedPublicKey=function(a,b,f,j,k,l,n){e(a),g.checkArgument(j),g.shouldBeNumber(k),g.checkArgument(h.includes(h.values(m.DERIVATION_STRATEGIES),l)),n=n||{};var o=new c(j,"hex");g.checkArgument(o.length>=14,"At least 112 bits of entropy are needed");var p=new d;return p.coin=a,p.xPubKey=b,p.entropySource=i.crypto.Hash.sha256sha256(o).toString("hex"),p.account=k,p.derivationStrategy=l,p.externalSource=f,p.compliantDerivation=!0,p._expand(),p},d._getNetworkFromExtendedKey=function(a){return g.checkArgument(a&&h.isString(a)),"t"==a.charAt(0)?"testnet":"livenet"},d.prototype._hashFromEntropy=function(a,b){g.checkState(a);var d=new c(this.entropySource,"hex"),e=i.crypto.Hash.sha256hmac(d,new c(a));return e.slice(0,b)},d.prototype._expand=function(){g.checkState(this.xPrivKey||this.xPubKey&&this.entropySource);var a=d._getNetworkFromExtendedKey(this.xPrivKey||this.xPubKey);if(this.network?g.checkState(this.network==a):this.network=a,this.xPrivKey){var b=new i.HDPrivateKey.fromString(this.xPrivKey),c=this.compliantDerivation?h.bind(b.deriveChild,b):h.bind(b.deriveNonCompliantChild,b),e=c(this.getBaseAddressDerivationPath());this.xPubKey=e.hdPublicKey.toString()}if(this.entropySourcePath){var f=c(this.entropySourcePath).publicKey.toBuffer();this.entropySource=i.crypto.Hash.sha256sha256(f).toString("hex")}if(this.entropySource){var f=this._hashFromEntropy("reqPrivKey",32),j=new i.PrivateKey(f.toString("hex"),a);this.requestPrivKey=j.toString(),this.requestPubKey=j.toPublicKey().toString()}else{var k=c(m.PATHS.REQUEST_KEY);this.requestPrivKey=k.privateKey.toString();var l=k.publicKey;this.requestPubKey=l.toString(),this.entropySource=i.crypto.Hash.sha256(k.privateKey.toBuffer()).toString("hex")}this.personalEncryptingKey=this._hashFromEntropy("personalKey",16).toString("base64"),g.checkState(this.coin),this.copayerId=n.xPubToCopayerId(this.coin,this.xPubKey),this.publicKeyRing=[{xPubKey:this.xPubKey,requestPubKey:this.requestPubKey}]},d.fromObj=function(a){var b=new d;return h.each(o,function(c){b[c]=a[c]}),b.coin=b.coin||"btc",b.derivationStrategy=b.derivationStrategy||m.DERIVATION_STRATEGIES.BIP45,b.addressType=b.addressType||m.SCRIPT_TYPES.P2SH,b.account=b.account||0,g.checkState(b.xPrivKey||b.xPubKey||b.xPrivKeyEncrypted,"invalid input"),b},d.prototype.toObj=function(){var a=this,b={};return h.each(o,function(c){b[c]=a[c]}),b},d.prototype.getBaseAddressDerivationPath=function(){var a;switch(this.derivationStrategy){case m.DERIVATION_STRATEGIES.BIP45:return"m/45'";case m.DERIVATION_STRATEGIES.BIP44:a="44";break;case m.DERIVATION_STRATEGIES.BIP48:a="48"}var b="livenet"==this.network?"0":"1";return"m/"+a+"'/"+b+"'/"+this.account+"'"},d.prototype.getDerivedXPrivKey=function(a){var b=this.getBaseAddressDerivationPath(),c=new i.HDPrivateKey(this.getKeys(a).xPrivKey,this.network),d=this.compliantDerivation?h.bind(c.deriveChild,c):h.bind(c.deriveNonCompliantChild,c);return d(b)},Credent.prototype.addWalletPrivateKey=function(a){this.walletPrivKey=a,this.sharedEncryptingKey=n.privateKeyToAESKey(a)},d.prototype.addWalletInfo=function(a,b,c,d,e){this.walletId=a,this.walletName=b,this.m=c,this.n=d,e&&(this.copayerName=e),"BIP44"==this.derivationStrategy&&1==d?this.addressType=m.SCRIPT_TYPES.P2PKH:this.addressType=m.SCRIPT_TYPES.P2SH,!this.xPrivKey&&this.externalSource&&d>1&&(this.derivationStrategy=m.DERIVATION_STRATEGIES.BIP48),1==d&&this.addPublicKeyRing([{xPubKey:this.xPubKey,requestPubKey:this.requestPubKey}])},d.prototype.hasWalletInfo=function(){return!!this.walletId},d.prototype.isPrivKeyEncrypted=function(){return!!this.xPrivKeyEncrypted&&!this.xPrivKey},d.prototype.encryptPrivateKey=function(a,b){if(this.xPrivKeyEncrypted)throw new Error("Private key already encrypted");if(!this.xPrivKey)throw new Error("No private key to encrypt");if(this.xPrivKeyEncrypted=k.encrypt(a,this.xPrivKey,b),!this.xPrivKeyEncrypted)throw new Error("Could not encrypt");this.mnemonic&&(this.mnemonicEncrypted=k.encrypt(a,this.mnemonic,b)),delete this.xPrivKey,delete this.mnemonic},d.prototype.decryptPrivateKey=function(a){if(!this.xPrivKeyEncrypted)throw new Error("Private key is not encrypted");try{this.xPrivKey=k.decrypt(a,this.xPrivKeyEncrypted),this.mnemonicEncrypted&&(this.mnemonic=k.decrypt(a,this.mnemonicEncrypted)),delete this.xPrivKeyEncrypted,delete this.mnemonicEncrypted}catch(b){throw new Error("Could not decrypt")}},d.prototype.getKeys=function(a){var b={};if(this.isPrivKeyEncrypted()){g.checkArgument(a,"Private keys are encrypted, a password is needed");try{b.xPrivKey=k.decrypt(a,this.xPrivKeyEncrypted),this.mnemonicEncrypted&&(b.mnemonic=k.decrypt(a,this.mnemonicEncrypted))}catch(c){throw new Error("Could not decrypt")}}else b.xPrivKey=this.xPrivKey,b.mnemonic=this.mnemonic;return b},d.prototype.addPublicKeyRing=function(a){this.publicKeyRing=h.clone(a)},d.prototype.canSign=function(){return!!this.xPrivKey||!!this.xPrivKeyEncrypted},d.prototype.setNoSign=function(){delete this.xPrivKey,delete this.xPrivKeyEncrypted,delete this.mnemonic,delete this.mnemonicEncrypted},d.prototype.isComplete=function(){return this.m&&this.n&&this.publicKeyRing&&this.publicKeyRing.length==this.n?!0:!1},d.prototype.hasExternalSource=function(){return"string"==typeof this.externalSource},d.prototype.getExternalSourceName=function(){return this.externalSource},d.prototype.getMnemonic=function(){if(this.mnemonicEncrypted&&!this.mnemonic)throw new Error("Credentials are encrypted");return this.mnemonic},d.prototype.clearMnemonic=function(){delete this.mnemonic,delete this.mnemonicEncrypted},d.fromOldCopayWallet=function(a){function b(a){var b=a.publicKeyRing.copayersExtPubKeys.sort().join(""),d=new c(b),e=new i.PrivateKey.fromBuffer(i.crypto.Hash.sha256(d));return e.toString()}var e=new d;e.coin="btc",e.derivationStrategy=m.DERIVATION_STRATEGIES.BIP45,e.xPrivKey=a.privateKey.extendedPrivateKeyString,e._expand(),e.addWalletPrivateKey(b(a)),e.addWalletInfo(a.opts.id,a.opts.name,a.opts.requiredCopayers,a.opts.totalCopayers);var f=h.map(a.publicKeyRing.copayersExtPubKeys,function(b){var c,d=b===e.xPubKey;if(d){var f=m.PATHS.REQUEST_KEY;c=new i.HDPrivateKey(e.xPrivKey).deriveChild(f).hdPublicKey}else{var f=m.PATHS.REQUEST_KEY_AUTH;c=new i.HDPublicKey(b).deriveChild(f)}var g=new i.HDPublicKey(b).deriveChild("m/2147483646/0/0"),h=g.publicKey.toString("hex"),j=a.publicKeyRing.nicknameFor[h];return d&&(e.copayerName=j),{xPubKey:b,requestPubKey:c.publicKey.toString(),copayerName:j}});return e.addPublicKeyRing(f),e},b.exports=d}).call(this,a("buffer").Buffer)},{"./common":5,"bitcore-lib":89,"bitcore-mnemonic":138,buffer:187,lodash:259,preconditions:276,sjcl:320}],8:[function(a,b,c){"use strict";function d(a,b){return a.replace("{0}",b[0]).replace("{1}",b[1]).replace("{2}",b[2])}var e=a("lodash"),f=function(a,b){var c=function(){if(e.isString(b.message))this.message=d(b.message,arguments);else{if(!e.isFunction(b.message))throw new Error("Invalid error definition for "+b.name);this.message=b.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return c.prototype=Object.create(a.prototype),c.prototype.name=a.prototype.name+b.name,a[b.name]=c,b.errors&&g(c,b.errors),c},g=function(a,b){e.each(b,function(b){f(a,b)})},h=function(a,b){return g(a,b),a},i={};i.Error=function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack},i.Error.prototype=Object.create(Error.prototype),i.Error.prototype.name="bwc.Error";var j=a("./spec");h(i.Error,j),b.exports=i.Error,b.exports.extend=function(a){return f(i.Error,a)}},{"./spec":9,lodash:259}],9:[function(a,b,c){"use strict";var d=[{name:"INVALID_BACKUP",message:"Invalid Backup."},{name:"WALLET_DOES_NOT_EXIST",message:"Wallet does not exist."},{name:"MISSING_PRIVATE_KEY",message:"Missing private keys to sign."},{name:"ENCRYPTED_PRIVATE_KEY",message:"Private key is encrypted, cannot sign transaction."},{name:"SERVER_COMPROMISED",message:"Server response could not be verified."},{name:"COULD_NOT_BUILD_TRANSACTION",message:"Could not build the transaction."},{name:"INSUFFICIENT_FUNDS",message:"Insufficient funds."},{name:"CONNECTION_ERROR",message:"Wallet service connection error."},{name:"NOT_FOUND",message:"Wallet service not found."},{name:"ECONNRESET_ERROR",message:"ECONNRESET, body: {0}"},{name:"WALLET_ALREADY_EXISTS",message:"Wallet already exists."},{name:"COPAYER_IN_WALLET",message:"Copayer in wallet."},{name:"WALLET_FULL",message:"Wallet is full."},{name:"WALLET_NOT_FOUND",message:"Wallet not found."},{name:"INSUFFICIENT_FUNDS_FOR_FEE",message:"Insufficient funds for fee."},{name:"LOCKED_FUNDS",message:"Locked funds."},{name:"DUST_AMOUNT",message:"Amount below dust threshold."},{name:"COPAYER_VOTED",message:"Copayer already voted on this transaction proposal."},{name:"NOT_AUTHORIZED",message:"Not authorized."},{name:"UNAVAILABLE_UTXOS",message:"Unavailable unspent outputs."},{name:"TX_NOT_FOUND",message:"Transaction proposal not found."},{name:"MAIN_ADDRESS_GAP_REACHED",message:"Maximum number of consecutive addresses without activity reached."},{name:"COPAYER_REGISTERED",message:"Copayer already register on server."}];b.exports=d},{}],10:[function(a,b,c){var d=b.exports=a("./api");d.Verifier=a("./verifier"),d.Utils=a("./common/utils"),d.sjcl=a("sjcl"),d.Bitcore=a("bitcore-lib"),d.BitcoreCash=a("bitcore-lib-cash")},{"./api":2,"./common/utils":6,"./verifier":13,"bitcore-lib":89,"bitcore-lib-cash":38,sjcl:320}],11:[function(a,b,c){var d=a("lodash"),e="silent",f=function(a){this.name=a||"log",this.level=e};f.prototype.getLevels=function(){return g};var g={silent:-1,debug:0,info:1,log:2,warn:3,error:4,fatal:5};d.each(g,function(a,b){"silent"!==b&&(f.prototype[b]=function(){if("silent"!==this.level&&a>=g[this.level]){if(Error.stackTraceLimit&&"debug"==this.level){var c=Error.stackTraceLimit;Error.stackTraceLimit=2;var d;try{anerror()}catch(e){d=e.stack}var f=d.split("\n"),h=f[2];h=":"+h.substr(6),Error.stackTraceLimit=c}var i,j="["+b+(h||"")+"] "+arguments[0],i=[].slice.call(arguments,1);console[b]?(i.unshift(j),console[b].apply(console,i)):(i.length&&(j+=JSON.stringify(i)),console.log(j))}})}),f.prototype.setLevel=function(a){this.level=a};var h=new f("copay");b.exports=h},{lodash:259}],12:[function(a,b,c){(function(c,d){var e=a("preconditions").singleton(),f=a("bitcore-lib"),g={btc:f,bch:a("bitcore-lib-cash")},h=a("bitcore-payment-protocol"),i={};i._nodeRequest=function(b,c){b.agent=!1;var e=b.httpNode||a("http"===b.proto?"http":"https"),f="POST"==b.method?"post":"get";e[f](b,function(a){var b=[];return 200!=a.statusCode?c(new Error("HTTP Request Error: "+a.statusCode+" "+a.statusMessage+" "+(b?b:""))):(a.on("data",function(a){b.push(a)}),void a.on("end",function(){return b=d.concat(b),c(null,b)}))})},i._browserRequest=function(a,b){var c=(a.method||"GET").toUpperCase(),d=a.url,e=a;e.headers=e.headers||{},e.body=e.body||e.data||"";var f=a.xhr||new XMLHttpRequest;f.open(c,d,!0),Object.keys(e.headers).forEach(function(a){var b=e.headers[a];"Content-Length"!==a&&"Content-Transfer-Encoding"!==a&&f.setRequestHeader(a,b)}),f.responseType="arraybuffer",f.onload=function(a){var c=f.response;return 200==f.status?b(null,new Uint8Array(c)):b("HTTP Request Error: "+f.status+" "+f.statusText+" "+c?c:"")},f.onerror=function(a){var c;return c=0!==f.status&&f.statusText?f.statusText:"HTTP Request Error",b(new Error(c))},e.body?f.send(e.body):f.send(null)};var j=function(a){a.url.match(/^((http[s]?):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/);if(a.proto=RegExp.$2,a.host=RegExp.$3,a.path=RegExp.$4+RegExp.$6,a.http)return a.http;var b=a.env;return b||(b=c&&!c.browser?"node":"browser"),"node"==b?i._nodeRequest:http=i._browserRequest};i.get=function(a,b){e.checkArgument(a&&a.url);var c=j(a),f=a.coin||"btc",i=g[f],k=f.toUpperCase(),l=new h(k);a.headers=a.headers||{Accept:h.LEGACY_PAYMENT[k].REQUEST_CONTENT_TYPE,"Content-Type":"application/octet-stream"},c(a,function(c,e){if(c)return b(c);var f,g,j,k;try{var m=h.PaymentRequest.decode(e);f=l.makePaymentRequest(m),j=f.get("signature"),k=f.get("serialized_payment_details"),g=f.verify(!0)}catch(n){return b(new Error("Could not parse payment protocol"+n))}var o=h.PaymentDetails.decode(k),p=new h;p=p.makePaymentDetails(o);var q=p.get("outputs");if(q.length>1)return b(new Error("Payment Protocol Error: Requests with more that one output are not supported"));var r=q[0],s=r.get("amount").toNumber(),t="test"==p.get("network")?"testnet":"livenet",u=r.get("script").offset,v=r.get("script").limit,w=new d(new Uint8Array(r.get("script").buffer)),x=w.slice(u,v),y=new i.Address.fromScript(new i.Script(x),t),z=p.get("merchant_data");z&&(z=z.toString());var A=g.verified;g.isChain&&(A=A&&g.chainVerified);var B={verified:A,caTrusted:g.caTrusted,caName:g.caName,selfSigned:g.selfSigned,expires:p.get("expires"),memo:p.get("memo"),time:p.get("time"),merchant_data:z,toAddress:y.toString(),amount:s,network:t,domain:a.host,url:a.url},C=p.get("required_fee_rate");return C&&(B.requiredFeeRate=C),b(null,B)})},i._getPayProRefundOutputs=function(a,b,c){b=b.toString(10);var d,e=g[c],f=new h.Output,i=new e.Address(a);if(i.isPayToPublicKeyHash())d=e.Script.buildPublicKeyHashOut(i);else{if(!i.isPayToScriptHash())throw new Error("Unrecognized address type "+i.type);d=e.Script.buildScriptHashOut(i)}return f.set("script",d.toBuffer()),f.set("amount",b),[f]},i._createPayment=function(a,b,c,e,f){var g=new h;g=g.makePayment(),a&&(a=new d(a),g.set("merchant_data",a));var i=new d(b,"hex");g.set("transactions",[i]);var j=this._getPayProRefundOutputs(c,e,f);j&&g.set("refund_to",j),g=g.serialize();for(var k=new ArrayBuffer(g.length),l=new Uint8Array(k),m=0;m=3))throw new Error("Transaction proposal not supported");var k=i.buildTx(b);return h=k.uncheckedSerialize(),j.debug("Regenerating & verifying tx proposal hash -> Hash: ",h," Signature: ",b.proposalSignature),i.verifyMessage(h,b.proposalSignature,g)&&d.checkAddress(a,b.changeAddress)?!0:!1},d.checkPaypro=function(a,b){var c,d,e;return parseInt(a.version)>=3?(c=a.outputs[0].toAddress,d=a.amount,a.feePerKb&&(e=a.feePerKb/1024)):(c=a.toAddress,d=a.amount),c==b.toAddress&&d==b.amount},d.checkTxProposal=function(a,b,c){return c=c||{},this.checkTxProposalSignature(a,b)?c.paypro&&!this.checkPaypro(b,c.paypro)?!1:!0:!1},b.exports=d},{"./common":5,"./log":11,"bitcore-lib":89,lodash:259,preconditions:276}],14:[function(a,b,c){try{var d=a("asn1.js")}catch(e){var d=a("../..")}var f=c,g={"2 5 29 9":"subjectDirectoryAttributes","2 5 29 14":"subjectKeyIdentifier","2 5 29 15":"keyUsage","2 5 29 17":"subjectAlternativeName","2 5 29 18":"issuerAlternativeName","2 5 29 19":"basicConstraints","2 5 29 20":"cRLNumber","2 5 29 21":"reasonCode","2 5 29 24":"invalidityDate","2 5 29 27":"deltaCRLIndicator","2 5 29 28":"issuingDistributionPoint","2 5 29 29":"certificateIssuer","2 5 29 30":"nameConstraints","2 5 29 31":"cRLDistributionPoints","2 5 29 32":"certificatePolicies","2 5 29 33":"policyMappings","2 5 29 35":"authorityKeyIdentifier","2 5 29 36":"policyConstraints","2 5 29 37":"extendedKeyUsage","2 5 29 46":"freshestCRL","2 5 29 54":"inhibitAnyPolicy","1 3 6 1 5 5 7 1 1":"authorityInformationAccess","1 3 6 1 5 5 7 11":"subjectInformationAccess"},h=d.define("CertificateList",function(){this.seq().obj(this.key("tbsCertList").use(p),this.key("signatureAlgorithm").use(i),this.key("signature").bitstr())});f.CertificateList=h;var i=d.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())});f.AlgorithmIdentifier=i;var j=d.define("Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(k),this.key("signatureAlgorithm").use(i),this.key("signature").bitstr())});f.Certificate=j;var k=d.define("TBSCertificate",function(){this.seq().obj(this.key("version").def("v1").explicit(0).use(l),this.key("serialNumber")["int"](),this.key("signature").use(i),this.key("issuer").use(s),this.key("validity").use(m),this.key("subject").use(s),this.key("subjectPublicKeyInfo").use(o),this.key("issuerUniqueID").optional().implicit(1).bitstr(),this.key("subjectUniqueID").optional().implicit(2).bitstr(),this.key("extensions").optional().explicit(3).seqof(r))});f.TBSCertificate=k;var l=d.define("Version",function(){this["int"]({0:"v1",1:"v2",2:"v3"})});f.Version=l;var m=d.define("Validity",function(){this.seq().obj(this.key("notBefore").use(n),this.key("notAfter").use(n))});f.Validity=m;var n=d.define("Time",function(){this.choice({utcTime:this.utctime(),genTime:this.gentime()})});f.Time=n;var o=d.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(i),this.key("subjectPublicKey").bitstr())});f.SubjectPublicKeyInfo=o;var p=d.define("TBSCertList",function(){this.seq().obj(this.key("version").optional()["int"](),this.key("signature").use(i),this.key("issuer").use(s),this.key("thisUpdate").use(n),this.key("nextUpdate").use(n),this.key("revokedCertificates").optional().seqof(q),this.key("crlExtensions").explicit(0).optional().seqof(r))});f.TBSCertList=p;var q=d.define("RevokedCertificate",function(){this.seq().obj(this.key("userCertificate").use(G),this.key("revocationDate").use(n),this.key("crlEntryExtensions").optional().seqof(r))}),r=d.define("Extension",function(){this.seq().obj(this.key("extnID").objid(g),this.key("critical").bool().def(!1),this.key("extnValue").octstr().contains(function(a){ +var b=Ha[a.extnID];return b?b:d.define("OctString",function(){this.any()})}))});f.Extension=r;var s=d.define("Name",function(){this.choice({rdnSequence:this.use(x)})});f.Name=s;var t=d.define("GeneralName",function(){this.choice({otherName:this.implicit(0).use(v),rfc822Name:this.implicit(1).ia5str(),dNSName:this.implicit(2).ia5str(),directoryName:this.explicit(4).use(s),ediPartyName:this.implicit(5).use(w),uniformResourceIdentifier:this.implicit(6).ia5str(),iPAddress:this.implicit(7).octstr(),registeredID:this.implicit(8).objid()})});f.GeneralName=t;var u=d.define("GeneralNames",function(){this.seqof(t)});f.GeneralNames=u;var v=d.define("AnotherName",function(){this.seq().obj(this.key("type-id").objid(),this.key("value").explicit(0).any())});f.AnotherName=v;var w=d.define("EDIPartyName",function(){this.seq().obj(this.key("nameAssigner").implicit(0).optional().use(D),this.key("partyName").implicit(1).use(D))});f.EDIPartyName=w;var x=d.define("RDNSequence",function(){this.seqof(y)});f.RDNSequence=x;var y=d.define("RelativeDistinguishedName",function(){this.setof(z)});f.RelativeDistinguishedName=y;var z=d.define("AttributeTypeAndValue",function(){this.seq().obj(this.key("type").use(B),this.key("value").use(C))});f.AttributeTypeAndValue=z;var A=d.define("Attribute",function(){this.seq().obj(this.key("type").use(B),this.key("values").setof(C))});f.Attribute=A;var B=d.define("AttributeType",function(){this.objid()});f.AttributeType=B;var C=d.define("AttributeValue",function(){this.any()});f.AttributeValue=C;var D=d.define("DirectoryString",function(){this.choice({teletexString:this.t61str(),printableString:this.printstr(),universalString:this.unistr(),utf8String:this.utf8str(),bmpString:this.bmpstr()})});f.DirectoryString=D;var E=d.define("AuthorityKeyIdentifier",function(){this.seq().obj(this.key("keyIdentifier").implicit(0).optional().use(F),this.key("authorityCertIssuer").implicit(1).optional().use(u),this.key("authorityCertSerialNumber").implicit(2).optional().use(G))});f.AuthorityKeyIdentifier=E;var F=d.define("KeyIdentifier",function(){this.octstr()});f.KeyIdentifier=F;var G=d.define("CertificateSerialNumber",function(){this["int"]()});f.CertificateSerialNumber=G;var H=d.define("ORAddress",function(){this.seq().obj(this.key("builtInStandardAttributes").use(I),this.key("builtInDomainDefinedAttributes").optional().use(U),this.key("extensionAttributes").optional().use(W))});f.ORAddress=H;var I=d.define("BuiltInStandardAttributes",function(){this.seq().obj(this.key("countryName").optional().use(J),this.key("administrationDomainName").optional().use(K),this.key("networkAddress").implicit(0).optional().use(L),this.key("terminalIdentifier").implicit(1).optional().use(N),this.key("privateDomainName").explicit(2).optional().use(O),this.key("organizationName").implicit(3).optional().use(P),this.key("numericUserIdentifier").implicit(4).optional().use(Q),this.key("personalName").implicit(5).optional().use(R),this.key("organizationalUnitNames").implicit(6).optional().use(S))});f.BuiltInStandardAttributes=I;var J=d.define("CountryName",function(){this.choice({x121DccCode:this.numstr(),iso3166Alpha2Code:this.printstr()})});f.CountryName=J;var K=d.define("AdministrationDomainName",function(){this.choice({numeric:this.numstr(),printable:this.printstr()})});f.AdministrationDomainName=K;var L=d.define("NetworkAddress",function(){this.use(M)});f.NetworkAddress=L;var M=d.define("X121Address",function(){this.numstr()});f.X121Address=M;var N=d.define("TerminalIdentifier",function(){this.printstr()});f.TerminalIdentifier=N;var O=d.define("PrivateDomainName",function(){this.choice({numeric:this.numstr(),printable:this.printstr()})});f.PrivateDomainName=O;var P=d.define("OrganizationName",function(){this.printstr()});f.OrganizationName=P;var Q=d.define("NumericUserIdentifier",function(){this.numstr()});f.NumericUserIdentifier=Q;var R=d.define("PersonalName",function(){this.set().obj(this.key("surname").implicit(0).printstr(),this.key("givenName").implicit(1).printstr(),this.key("initials").implicit(2).printstr(),this.key("generationQualifier").implicit(3).printstr())});f.PersonalName=R;var S=d.define("OrganizationalUnitNames",function(){this.seqof(T)});f.OrganizationalUnitNames=S;var T=d.define("OrganizationalUnitName",function(){this.printstr()});f.OrganizationalUnitName=T;var U=d.define("BuiltInDomainDefinedAttributes",function(){this.seqof(V)});f.BuiltInDomainDefinedAttributes=U;var V=d.define("BuiltInDomainDefinedAttribute",function(){this.seq().obj(this.key("type").printstr(),this.key("value").printstr())});f.BuiltInDomainDefinedAttribute=V;var W=d.define("ExtensionAttributes",function(){this.seqof(X)});f.ExtensionAttributes=W;var X=d.define("ExtensionAttribute",function(){this.seq().obj(this.key("extensionAttributeType").implicit(0)["int"](),this.key("extensionAttributeValue").any().explicit(1)["int"]())});f.ExtensionAttribute=X;var Y=d.define("SubjectKeyIdentifier",function(){this.use(F)});f.SubjectKeyIdentifier=Y;var Z=d.define("KeyUsage",function(){this.bitstr()});f.KeyUsage=Z;var $=d.define("CertificatePolicies",function(){this.seqof(_)});f.CertificatePolicies=$;var _=d.define("PolicyInformation",function(){this.seq().obj(this.key("policyIdentifier").use(aa),this.key("policyQualifiers").optional().use(ba))});f.PolicyInformation=_;var aa=d.define("CertPolicyId",function(){this.objid()});f.CertPolicyId=aa;var ba=d.define("PolicyQualifiers",function(){this.seqof(ca)});f.PolicyQualifiers=ba;var ca=d.define("PolicyQualifierInfo",function(){this.seq().obj(this.key("policyQualifierId").use(da),this.key("qualifier").any())});f.PolicyQualifierInfo=ca;var da=d.define("PolicyQualifierId",function(){this.objid()});f.PolicyQualifierId=da;var ea=d.define("PolicyMappings",function(){this.seqof(fa)});f.PolicyMappings=ea;var fa=d.define("PolicyMapping",function(){this.seq().obj(this.key("issuerDomainPolicy").use(aa),this.key("subjectDomainPolicy").use(aa))});f.PolicyMapping=fa;var ga=d.define("SubjectAlternativeName",function(){this.use(u)});f.SubjectAlternativeName=ga;var ha=d.define("IssuerAlternativeName",function(){this.use(u)});f.IssuerAlternativeName=ha;var ia=d.define("SubjectDirectoryAttributes",function(){this.seqof(A)});f.SubjectDirectoryAttributes=ia;var ja=d.define("BasicConstraints",function(){this.seq().obj(this.key("cA").bool().def(!1),this.key("pathLenConstraint").optional()["int"]())});f.BasicConstraints=ja;var ka=d.define("NameConstraints",function(){this.seq().obj(this.key("permittedSubtrees").implicit(0).optional().use(la),this.key("excludedSubtrees").implicit(1).optional().use(la))});f.NameConstraints=ka;var la=d.define("GeneralSubtrees",function(){this.seqof(ma)});f.GeneralSubtrees=la;var ma=d.define("GeneralSubtree",function(){this.seq().obj(this.key("base").use(t),this.key("minimum").implicit(0).def(0).use(na),this.key("maximum").implicit(0).optional().use(na))});f.GeneralSubtree=ma;var na=d.define("BaseDistance",function(){this["int"]()});f.BaseDistance=na;var oa=d.define("PolicyConstraints",function(){this.seq().obj(this.key("requireExplicitPolicy").implicit(0).optional().use(pa),this.key("inhibitPolicyMapping").implicit(1).optional().use(pa))});f.PolicyConstraints=oa;var pa=d.define("SkipCerts",function(){this["int"]()});f.SkipCerts=pa;var qa=d.define("ExtendedKeyUsage",function(){this.seqof(ra)});f.ExtendedKeyUsage=qa;var ra=d.define("KeyPurposeId",function(){this.objid()});f.KeyPurposeId=ra;var sa=d.define("CRLDistributionPoints",function(){this.seqof(ta)});f.CRLDistributionPoints=sa;var ta=d.define("DistributionPoint",function(){this.seq().obj(this.key("distributionPoint").optional().explicit(0).use(ua),this.key("reasons").optional().implicit(1).use(va),this.key("cRLIssuer").optional().implicit(2).use(u))});f.DistributionPoint=ta;var ua=d.define("DistributionPointName",function(){this.choice({fullName:this.implicit(0).use(u),nameRelativeToCRLIssuer:this.implicit(1).use(y)})});f.DistributionPointName=ua;var va=d.define("ReasonFlags",function(){this.bitstr()});f.ReasonFlags=va;var wa=d.define("InhibitAnyPolicy",function(){this.use(pa)});f.InhibitAnyPolicy=wa;var xa=d.define("FreshestCRL",function(){this.use(sa)});f.FreshestCRL=xa;var ya=d.define("AuthorityInfoAccessSyntax",function(){this.seqof(za)});f.AuthorityInfoAccessSyntax=ya;var za=d.define("AccessDescription",function(){this.seq().obj(this.key("accessMethod").objid(),this.key("accessLocation").use(t))});f.AccessDescription=za;var Aa=d.define("SubjectInformationAccess",function(){this.seqof(za)});f.SubjectInformationAccess=Aa;var Ba=d.define("CRLNumber",function(){this["int"]()});f.CRLNumber=Ba;var Ca=d.define("DeltaCRLIndicator",function(){this.use(Ba)});f.DeltaCRLIndicator=Ca;var Da=d.define("IssuingDistributionPoint",function(){this.seq().obj(this.key("distributionPoint").explicit(0).optional().use(ua),this.key("onlyContainsUserCerts").implicit(1).def(!1).bool(),this.key("onlyContainsCACerts").implicit(2).def(!1).bool(),this.key("onlySomeReasons").implicit(3).optional().use(va),this.key("indirectCRL").implicit(4).def(!1).bool(),this.key("onlyContainsAttributeCerts").implicit(5).def(!1).bool())});f.IssuingDistributionPoint=Da;var Ea=d.define("ReasonCode",function(){this["enum"]({0:"unspecified",1:"keyCompromise",2:"cACompromise",3:"affiliationChanged",4:"superseded",5:"cessationOfOperation",6:"certificateHold",8:"removeFromCRL",9:"privilegeWithdrawn",10:"aACompromise"})});f.ReasonCode=Ea;var Fa=d.define("InvalidityDate",function(){this.gentime()});f.InvalidityDate=Fa;var Ga=d.define("CertificateIssuer",function(){this.use(u)});f.CertificateIssuer=Ga;var Ha={subjectDirectoryAttributes:ia,subjectKeyIdentifier:Y,keyUsage:Z,subjectAlternativeName:ga,issuerAlternativeName:ha,basicConstraints:ja,cRLNumber:Ba,reasonCode:Ea,invalidityDate:Fa,deltaCRLIndicator:Ca,issuingDistributionPoint:Da,certificateIssuer:Ga,nameConstraints:ka,cRLDistributionPoints:sa,certificatePolicies:$,policyMappings:ea,authorityKeyIdentifier:E,policyConstraints:oa,extendedKeyUsage:qa,freshestCRL:xa,inhibitAnyPolicy:wa,authorityInformationAccess:ya,subjectInformationAccess:Aa}},{"../..":1,"asn1.js":15}],15:[function(a,b,c){var d=c;d.bignum=a("bn.js"),d.define=a("./asn1/api").define,d.base=a("./asn1/base"),d.constants=a("./asn1/constants"),d.decoders=a("./asn1/decoders"),d.encoders=a("./asn1/encoders")},{"./asn1/api":16,"./asn1/base":18,"./asn1/constants":22,"./asn1/decoders":24,"./asn1/encoders":27,"bn.js":153}],16:[function(a,b,c){function d(a,b){this.name=a,this.body=b,this.decoders={},this.encoders={}}var e=a("../asn1"),f=a("inherits"),g=c;g.define=function(a,b){return new d(a,b)},d.prototype._createNamed=function(b){var c;try{c=a("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(d){c=function(a){this._initNamed(a)}}return f(c,b),c.prototype._initNamed=function(a){b.call(this,a)},new c(this)},d.prototype._getDecoder=function(a){return a=a||"der",this.decoders.hasOwnProperty(a)||(this.decoders[a]=this._createNamed(e.decoders[a])),this.decoders[a]},d.prototype.decode=function(a,b,c){return this._getDecoder(b).decode(a,c)},d.prototype._getEncoder=function(a){return a=a||"der",this.encoders.hasOwnProperty(a)||(this.encoders[a]=this._createNamed(e.encoders[a])),this.encoders[a]},d.prototype.encode=function(a,b,c){return this._getEncoder(b).encode(a,c)}},{"../asn1":15,inherits:251,vm:341}],17:[function(a,b,c){function d(a,b){return g.call(this,b),h.isBuffer(a)?(this.base=a,this.offset=0,void(this.length=a.length)):void this.error("Input not Buffer")}function e(a,b){if(Array.isArray(a))this.length=0,this.value=a.map(function(a){return a instanceof e||(a=new e(a,b)),this.length+=a.length,a},this);else if("number"==typeof a){if(!(a>=0&&255>=a))return b.error("non-byte EncoderBuffer value");this.value=a,this.length=1}else if("string"==typeof a)this.value=a,this.length=h.byteLength(a);else{if(!h.isBuffer(a))return b.error("Unsupported type: "+typeof a);this.value=a,this.length=a.length}}var f=a("inherits"),g=a("../base").Reporter,h=a("buffer").Buffer;f(d,g),c.DecoderBuffer=d,d.prototype.save=function(){return{offset:this.offset,reporter:g.prototype.save.call(this)}},d.prototype.restore=function(a){var b=new d(this.base);return b.offset=a.offset,b.length=this.offset,this.offset=a.offset,g.prototype.restore.call(this,a.reporter),b},d.prototype.isEmpty=function(){return this.offset===this.length},d.prototype.readUInt8=function(a){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(a||"DecoderBuffer overrun")},d.prototype.skip=function(a,b){if(!(this.offset+a<=this.length))return this.error(b||"DecoderBuffer overrun");var c=new d(this.base);return c._reporterState=this._reporterState,c.offset=this.offset,c.length=this.offset+a,this.offset+=a,c},d.prototype.raw=function(a){return this.base.slice(a?a.offset:this.offset,this.length)},c.EncoderBuffer=e,e.prototype.join=function(a,b){return a||(a=new h(this.length)),b||(b=0),0===this.length?a:(Array.isArray(this.value)?this.value.forEach(function(c){c.join(a,b),b+=c.length}):("number"==typeof this.value?a[b]=this.value:"string"==typeof this.value?a.write(this.value,b):h.isBuffer(this.value)&&this.value.copy(a,b),b+=this.length),a)}},{"../base":18,buffer:187,inherits:251}],18:[function(a,b,c){var d=c;d.Reporter=a("./reporter").Reporter,d.DecoderBuffer=a("./buffer").DecoderBuffer,d.EncoderBuffer=a("./buffer").EncoderBuffer,d.Node=a("./node")},{"./buffer":17,"./node":19,"./reporter":20}],19:[function(a,b,c){function d(a,b){var c={};this._baseState=c,c.enc=a,c.parent=b||null,c.children=null,c.tag=null,c.args=null,c.reverseArgs=null,c.choice=null,c.optional=!1,c.any=!1,c.obj=!1,c.use=null,c.useDecoder=null,c.key=null,c["default"]=null,c.explicit=null,c.implicit=null,c.contains=null,c.parent||(c.children=[],this._wrap())}var e=a("../base").Reporter,f=a("../base").EncoderBuffer,g=a("../base").DecoderBuffer,h=a("minimalistic-assert"),i=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],j=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(i),k=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];b.exports=d;var l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];d.prototype.clone=function(){var a=this._baseState,b={};l.forEach(function(c){b[c]=a[c]});var c=new this.constructor(b.parent);return c._baseState=b,c},d.prototype._wrap=function(){var a=this._baseState;j.forEach(function(b){this[b]=function(){var c=new this.constructor(this);return a.children.push(c),c[b].apply(c,arguments)}},this)},d.prototype._init=function(a){var b=this._baseState;h(null===b.parent),a.call(this),b.children=b.children.filter(function(a){return a._baseState.parent===this},this),h.equal(b.children.length,1,"Root node can have only one child")},d.prototype._useArgs=function(a){var b=this._baseState,c=a.filter(function(a){return a instanceof this.constructor},this);a=a.filter(function(a){return!(a instanceof this.constructor)},this),0!==c.length&&(h(null===b.children),b.children=c,c.forEach(function(a){a._baseState.parent=this},this)),0!==a.length&&(h(null===b.args),b.args=a,b.reverseArgs=a.map(function(a){if("object"!=typeof a||a.constructor!==Object)return a;var b={};return Object.keys(a).forEach(function(c){c==(0|c)&&(c|=0);var d=a[c];b[d]=c}),b}))},k.forEach(function(a){d.prototype[a]=function(){var b=this._baseState;throw new Error(a+" not implemented for encoding: "+b.enc)}}),i.forEach(function(a){d.prototype[a]=function(){var b=this._baseState,c=Array.prototype.slice.call(arguments);return h(null===b.tag),b.tag=a,this._useArgs(c),this}}),d.prototype.use=function(a){h(a);var b=this._baseState;return h(null===b.use),b.use=a,this},d.prototype.optional=function(){var a=this._baseState;return a.optional=!0,this},d.prototype.def=function(a){var b=this._baseState;return h(null===b["default"]),b["default"]=a,b.optional=!0,this},d.prototype.explicit=function(a){var b=this._baseState;return h(null===b.explicit&&null===b.implicit),b.explicit=a,this},d.prototype.implicit=function(a){var b=this._baseState;return h(null===b.explicit&&null===b.implicit),b.implicit=a,this},d.prototype.obj=function(){var a=this._baseState,b=Array.prototype.slice.call(arguments);return a.obj=!0,0!==b.length&&this._useArgs(b),this},d.prototype.key=function(a){var b=this._baseState;return h(null===b.key),b.key=a,this},d.prototype.any=function(){var a=this._baseState;return a.any=!0,this},d.prototype.choice=function(a){var b=this._baseState;return h(null===b.choice),b.choice=a,this._useArgs(Object.keys(a).map(function(b){return a[b]})),this},d.prototype.contains=function(a){var b=this._baseState;return h(null===b.use),b.contains=a,this},d.prototype._decode=function(a,b){var c=this._baseState;if(null===c.parent)return a.wrapResult(c.children[0]._decode(a,b));var d=c["default"],e=!0,f=null;if(null!==c.key&&(f=a.enterKey(c.key)),c.optional){var h=null;if(null!==c.explicit?h=c.explicit:null!==c.implicit?h=c.implicit:null!==c.tag&&(h=c.tag),null!==h||c.any){if(e=this._peekTag(a,h,c.any),a.isError(e))return e}else{var i=a.save();try{null===c.choice?this._decodeGeneric(c.tag,a,b):this._decodeChoice(a,b),e=!0}catch(j){e=!1}a.restore(i)}}var k;if(c.obj&&e&&(k=a.enterObject()),e){if(null!==c.explicit){var l=this._decodeTag(a,c.explicit);if(a.isError(l))return l;a=l}var m=a.offset;if(null===c.use&&null===c.choice){if(c.any)var i=a.save();var n=this._decodeTag(a,null!==c.implicit?c.implicit:c.tag,c.any);if(a.isError(n))return n;c.any?d=a.raw(i):a=n}if(b&&b.track&&null!==c.tag&&b.track(a.path(),m,a.length,"tagged"),b&&b.track&&null!==c.tag&&b.track(a.path(),a.offset,a.length,"content"),d=c.any?d:null===c.choice?this._decodeGeneric(c.tag,a,b):this._decodeChoice(a,b),a.isError(d))return d;if(c.any||null!==c.choice||null===c.children||c.children.forEach(function(c){c._decode(a,b)}),c.contains&&("octstr"===c.tag||"bitstr"===c.tag)){var o=new g(d);d=this._getUse(c.contains,a._reporterState.obj)._decode(o,b)}}return c.obj&&e&&(d=a.leaveObject(k)),null===c.key||null===d&&e!==!0?null!==f&&a.exitKey(f):a.leaveKey(f,c.key,d),d},d.prototype._decodeGeneric=function(a,b,c){var d=this._baseState;return"seq"===a||"set"===a?null:"seqof"===a||"setof"===a?this._decodeList(b,a,d.args[0],c):/str$/.test(a)?this._decodeStr(b,a,c):"objid"===a&&d.args?this._decodeObjid(b,d.args[0],d.args[1],c):"objid"===a?this._decodeObjid(b,null,null,c):"gentime"===a||"utctime"===a?this._decodeTime(b,a,c):"null_"===a?this._decodeNull(b,c):"bool"===a?this._decodeBool(b,c):"objDesc"===a?this._decodeStr(b,a,c):"int"===a||"enum"===a?this._decodeInt(b,d.args&&d.args[0],c):null!==d.use?this._getUse(d.use,b._reporterState.obj)._decode(b,c):b.error("unknown tag: "+a)},d.prototype._getUse=function(a,b){var c=this._baseState;return c.useDecoder=this._use(a,b),h(null===c.useDecoder._baseState.parent),c.useDecoder=c.useDecoder._baseState.children[0],c.implicit!==c.useDecoder._baseState.implicit&&(c.useDecoder=c.useDecoder.clone(),c.useDecoder._baseState.implicit=c.implicit),c.useDecoder},d.prototype._decodeChoice=function(a,b){var c=this._baseState,d=null,e=!1;return Object.keys(c.choice).some(function(f){var g=a.save(),h=c.choice[f];try{var i=h._decode(a,b);if(a.isError(i))return!1;d={type:f,value:i},e=!0}catch(j){return a.restore(g),!1}return!0},this),e?d:a.error("Choice not matched")},d.prototype._createEncoderBuffer=function(a){return new f(a,this.reporter)},d.prototype._encode=function(a,b,c){var d=this._baseState;if(null===d["default"]||d["default"]!==a){var e=this._encodeValue(a,b,c);if(void 0!==e&&!this._skipDefault(e,b,c))return e}},d.prototype._encodeValue=function(a,b,c){var d=this._baseState;if(null===d.parent)return d.children[0]._encode(a,b||new e);var f=null;if(this.reporter=b,d.optional&&void 0===a){if(null===d["default"])return;a=d["default"]}var g=null,h=!1;if(d.any)f=this._createEncoderBuffer(a);else if(d.choice)f=this._encodeChoice(a,b);else if(d.contains)g=this._getUse(d.contains,c)._encode(a,b),h=!0;else if(d.children)g=d.children.map(function(c){if("null_"===c._baseState.tag)return c._encode(null,b,a);if(null===c._baseState.key)return b.error("Child should have a key");var d=b.enterKey(c._baseState.key);if("object"!=typeof a)return b.error("Child expected, but input is not object");var e=c._encode(a[c._baseState.key],b,a);return b.leaveKey(d),e},this).filter(function(a){return a}),g=this._createEncoderBuffer(g);else if("seqof"===d.tag||"setof"===d.tag){if(!d.args||1!==d.args.length)return b.error("Too many args for : "+d.tag);if(!Array.isArray(a))return b.error("seqof/setof, but data is not Array");var i=this.clone();i._baseState.implicit=null,g=this._createEncoderBuffer(a.map(function(c){var d=this._baseState;return this._getUse(d.args[0],a)._encode(c,b)},i))}else null!==d.use?f=this._getUse(d.use,c)._encode(a,b):(g=this._encodePrimitive(d.tag,a),h=!0);var f;if(!d.any&&null===d.choice){var j=null!==d.implicit?d.implicit:d.tag,k=null===d.implicit?"universal":"context";null===j?null===d.use&&b.error("Tag could be ommited only for .use()"):null===d.use&&(f=this._encodeComposite(j,h,k,g))}return null!==d.explicit&&(f=this._encodeComposite(d.explicit,!1,"context",f)),f},d.prototype._encodeChoice=function(a,b){var c=this._baseState,d=c.choice[a.type];return d||h(!1,a.type+" not found in "+JSON.stringify(Object.keys(c.choice))),d._encode(a.value,b)},d.prototype._encodePrimitive=function(a,b){var c=this._baseState;if(/str$/.test(a))return this._encodeStr(b,a);if("objid"===a&&c.args)return this._encodeObjid(b,c.reverseArgs[0],c.args[1]);if("objid"===a)return this._encodeObjid(b,null,null);if("gentime"===a||"utctime"===a)return this._encodeTime(b,a);if("null_"===a)return this._encodeNull();if("int"===a||"enum"===a)return this._encodeInt(b,c.args&&c.reverseArgs[0]);if("bool"===a)return this._encodeBool(b);if("objDesc"===a)return this._encodeStr(b,a);throw new Error("Unsupported tag: "+a)},d.prototype._isNumstr=function(a){return/^[0-9 ]*$/.test(a)},d.prototype._isPrintstr=function(a){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(a)}},{"../base":18,"minimalistic-assert":264}],20:[function(a,b,c){function d(a){this._reporterState={obj:null,path:[],options:a||{},errors:[]}}function e(a,b){this.path=a,this.rethrow(b)}var f=a("inherits");c.Reporter=d,d.prototype.isError=function(a){return a instanceof e},d.prototype.save=function(){var a=this._reporterState;return{obj:a.obj,pathLen:a.path.length}},d.prototype.restore=function(a){var b=this._reporterState;b.obj=a.obj,b.path=b.path.slice(0,a.pathLen)},d.prototype.enterKey=function(a){return this._reporterState.path.push(a)},d.prototype.exitKey=function(a){var b=this._reporterState;b.path=b.path.slice(0,a-1)},d.prototype.leaveKey=function(a,b,c){var d=this._reporterState;this.exitKey(a),null!==d.obj&&(d.obj[b]=c)},d.prototype.path=function(){return this._reporterState.path.join("/")},d.prototype.enterObject=function(){var a=this._reporterState,b=a.obj;return a.obj={},b},d.prototype.leaveObject=function(a){var b=this._reporterState,c=b.obj;return b.obj=a,c},d.prototype.error=function(a){var b,c=this._reporterState,d=a instanceof e;if(b=d?a:new e(c.path.map(function(a){return"["+JSON.stringify(a)+"]"}).join(""),a.message||a,a.stack),!c.options.partial)throw b;return d||c.errors.push(b),b},d.prototype.wrapResult=function(a){var b=this._reporterState;return b.options.partial?{result:this.isError(a)?null:a,errors:b.errors}:a},f(e,Error),e.prototype.rethrow=function(a){if(this.message=a+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,e),!this.stack)try{throw new Error(this.message)}catch(b){this.stack=b.stack}return this}},{inherits:251}],21:[function(a,b,c){var d=a("../constants");c.tagClass={0:"universal",1:"application",2:"context",3:"private"},c.tagClassByName=d._reverse(c.tagClass),c.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},c.tagByName=d._reverse(c.tag)},{"../constants":22}],22:[function(a,b,c){var d=c;d._reverse=function(a){var b={};return Object.keys(a).forEach(function(c){(0|c)==c&&(c=0|c);var d=a[c];b[d]=c}),b},d.der=a("./der")},{"./der":21}],23:[function(a,b,c){function d(a){this.enc="der",this.name=a.name,this.entity=a,this.tree=new e,this.tree._init(a.body)}function e(a){j.Node.call(this,"der",a)}function f(a,b){var c=a.readUInt8(b);if(a.isError(c))return c;var d=l.tagClass[c>>6],e=0===(32&c);if(31===(31&c)){var f=c;for(c=0;128===(128&f);){if(f=a.readUInt8(b),a.isError(f))return f;c<<=7,c|=127&f}}else c&=31;var g=l.tag[c];return{cls:d,primitive:e,tag:c,tagStr:g}}function g(a,b,c){var d=a.readUInt8(c);if(a.isError(d))return d;if(!b&&128===d)return null;if(0===(128&d))return d;var e=127&d;if(e>4)return a.error("length octect is too long");d=0;for(var f=0;e>f;f++){d<<=8;var g=a.readUInt8(c);if(a.isError(g))return g;d|=g}return d}var h=a("inherits"),i=a("../../asn1"),j=i.base,k=i.bignum,l=i.constants.der;b.exports=d,d.prototype.decode=function(a,b){return a instanceof j.DecoderBuffer||(a=new j.DecoderBuffer(a,b)),this.tree._decode(a,b)},h(e,j.Node),e.prototype._peekTag=function(a,b,c){if(a.isEmpty())return!1;var d=a.save(),e=f(a,'Failed to peek tag: "'+b+'"');return a.isError(e)?e:(a.restore(d),e.tag===b||e.tagStr===b||e.tagStr+"of"===b||c)},e.prototype._decodeTag=function(a,b,c){var d=f(a,'Failed to decode tag of "'+b+'"');if(a.isError(d))return d;var e=g(a,d.primitive,'Failed to get length of "'+b+'"');if(a.isError(e))return e;if(!c&&d.tag!==b&&d.tagStr!==b&&d.tagStr+"of"!==b)return a.error('Failed to match tag: "'+b+'"');if(d.primitive||null!==e)return a.skip(e,'Failed to match body of: "'+b+'"');var h=a.save(),i=this._skipUntilEnd(a,'Failed to skip indefinite length body: "'+this.tag+'"');return a.isError(i)?i:(e=a.offset-h.offset,a.restore(h),a.skip(e,'Failed to match body of: "'+b+'"'))},e.prototype._skipUntilEnd=function(a,b){for(;;){var c=f(a,b);if(a.isError(c))return c;var d=g(a,c.primitive,b);if(a.isError(d))return d;var e;if(e=c.primitive||null!==d?a.skip(d):this._skipUntilEnd(a,b),a.isError(e))return e;if("end"===c.tagStr)break}},e.prototype._decodeList=function(a,b,c,d){for(var e=[];!a.isEmpty();){var f=this._peekTag(a,"end");if(a.isError(f))return f;var g=c.decode(a,"der",d);if(a.isError(g)&&f)break;e.push(g)}return e},e.prototype._decodeStr=function(a,b){if("bitstr"===b){var c=a.readUInt8();return a.isError(c)?c:{unused:c,data:a.raw()}}if("bmpstr"===b){var d=a.raw();if(d.length%2===1)return a.error("Decoding of string type: bmpstr length mismatch");for(var e="",f=0;fd?2e3+d:1900+d}return Date.UTC(d,e-1,f,g,h,i,0)},e.prototype._decodeNull=function(a){return null},e.prototype._decodeBool=function(a){var b=a.readUInt8();return a.isError(b)?b:0!==b},e.prototype._decodeInt=function(a,b){var c=a.raw(),d=new k(c);return b&&(d=b[d.toString(10)]||d),d},e.prototype._use=function(a,b){return"function"==typeof a&&(a=a(b)),a._getDecoder("der").tree}},{"../../asn1":15,inherits:251}],24:[function(a,b,c){var d=c;d.der=a("./der"),d.pem=a("./pem")},{"./der":23,"./pem":25}],25:[function(a,b,c){function d(a){g.call(this,a),this.enc="pem"}var e=a("inherits"),f=a("buffer").Buffer,g=a("./der");e(d,g),b.exports=d,d.prototype.decode=function(a,b){for(var c=a.toString().split(/[\r\n]+/g),d=b.label.toUpperCase(),e=/^-----(BEGIN|END) ([^-]+)-----$/,h=-1,i=-1,j=0;ja?"0"+a:a}function g(a,b,c,d){var e;if("seqof"===a?a="seq":"setof"===a&&(a="set"),l.tagByName.hasOwnProperty(a))e=l.tagByName[a];else{if("number"!=typeof a||(0|a)!==a)return d.error("Unknown tag: "+a);e=a}return e>=31?d.error("Multi-octet tag encoding unsupported"):(b||(e|=32),e|=l.tagClassByName[c||"universal"]<<6)}var h=a("inherits"),i=a("buffer").Buffer,j=a("../../asn1"),k=j.base,l=j.constants.der;b.exports=d,d.prototype.encode=function(a,b){return this.tree._encode(a,b).join()},h(e,k.Node),e.prototype._encodeComposite=function(a,b,c,d){var e=g(a,b,c,this.reporter);if(d.length<128){var f=new i(2);return f[0]=e,f[1]=d.length,this._createEncoderBuffer([f,d])}for(var h=1,j=d.length;j>=256;j>>=8)h++;var f=new i(2+h);f[0]=e,f[1]=128|h;for(var j=1+h,k=d.length;k>0;j--,k>>=8)f[j]=255&k;return this._createEncoderBuffer([f,d])},e.prototype._encodeStr=function(a,b){if("bitstr"===b)return this._createEncoderBuffer([0|a.unused,a.data]);if("bmpstr"===b){for(var c=new i(2*a.length),d=0;d=40)return this.reporter.error("Second objid identifier OOB");a.splice(0,2,40*a[0]+a[1])}for(var e=0,d=0;d=128;f>>=7)e++}for(var g=new i(e),h=g.length-1,d=a.length-1;d>=0;d--){var f=a[d];for(g[h--]=127&f;(f>>=7)>0;)g[h--]=128|127&f}return this._createEncoderBuffer(g)},e.prototype._encodeTime=function(a,b){var c,d=new Date(a);return"gentime"===b?c=[f(d.getFullYear()),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):"utctime"===b?c=[f(d.getFullYear()%100),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+b+" time is not supported yet"),this._encodeStr(c,"octstr")},e.prototype._encodeNull=function(){return this._createEncoderBuffer("")},e.prototype._encodeInt=function(a,b){if("string"==typeof a){if(!b)return this.reporter.error("String int or enum given, but no values map");if(!b.hasOwnProperty(a))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(a));a=b[a]}if("number"!=typeof a&&!i.isBuffer(a)){var c=a.toArray();!a.sign&&128&c[0]&&c.unshift(0),a=new i(c)}if(i.isBuffer(a)){var d=a.length;0===a.length&&d++;var e=new i(d);return a.copy(e),0===a.length&&(e[0]=0),this._createEncoderBuffer(e)}if(128>a)return this._createEncoderBuffer(a);if(256>a)return this._createEncoderBuffer([0,a]);for(var d=1,f=a;f>=256;f>>=8)d++;for(var e=new Array(d),f=e.length-1;f>=0;f--)e[f]=255&a,a>>=8;return 128&e[0]&&e.unshift(0),this._createEncoderBuffer(new i(e))},e.prototype._encodeBool=function(a){return this._createEncoderBuffer(a?255:0)},e.prototype._use=function(a,b){return"function"==typeof a&&(a=a(b)),a._getEncoder("der").tree},e.prototype._skipDefault=function(a,b,c){var d,e=this._baseState;if(null===e["default"])return!1;var f=a.join();if(void 0===e.defaultBuffer&&(e.defaultBuffer=this._encodeValue(e["default"],b,c).join()),f.length!==e.defaultBuffer.length)return!1;for(d=0;de;++e)if(a[e]!==b[e]){c=a[e],d=b[e];break}return d>c?-1:c>d?1:0}function e(a){return c.Buffer&&"function"==typeof c.Buffer.isBuffer?c.Buffer.isBuffer(a):!(null==a||!a._isBuffer)}function f(a){return Object.prototype.toString.call(a)}function g(a){return e(a)?!1:"function"!=typeof c.ArrayBuffer?!1:"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(a):a?a instanceof DataView?!0:a.buffer&&a.buffer instanceof ArrayBuffer?!0:!1:!1}function h(a){if(u.isFunction(a)){if(x)return a.name;var b=a.toString(),c=b.match(z);return c&&c[1]}}function i(a,b){return"string"==typeof a?a.length=0;h--)if(i[h]!==j[h])return!1;for(h=i.length-1;h>=0;h--)if(g=i[h],!n(a[g],b[g],c,d))return!1;return!0}function q(a,b,c){n(a,b,!0)&&l(a,b,c,"notDeepStrictEqual",q)}function r(a,b){if(!a||!b)return!1;if("[object RegExp]"==Object.prototype.toString.call(b))return b.test(a);try{if(a instanceof b)return!0}catch(c){}return Error.isPrototypeOf(b)?!1:b.call({},a)===!0}function s(a){var b;try{a()}catch(c){b=c}return b}function t(a,b,c,d){var e;if("function"!=typeof b)throw new TypeError('"block" argument must be a function');"string"==typeof c&&(d=c,c=null),e=s(b),d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&l(e,c,"Missing expected exception"+d);var f="string"==typeof d,g=!a&&u.isError(e),h=!a&&e&&!c;if((g&&f&&r(e,c)||h)&&l(e,c,"Got unwanted exception"+d),a&&e&&c&&!r(e,c)||!a&&e)throw e}var u=a("util/"),v=Object.prototype.hasOwnProperty,w=Array.prototype.slice,x=function(){return"foo"===function(){}.name}(),y=b.exports=m,z=/\s*function\s+([^\(\s]*)\s*/;y.AssertionError=function(a){this.name="AssertionError",this.actual=a.actual,this.expected=a.expected,this.operator=a.operator,a.message?(this.message=a.message,this.generatedMessage=!1):(this.message=k(this),this.generatedMessage=!0);var b=a.stackStartFunction||l;if(Error.captureStackTrace)Error.captureStackTrace(this,b);else{var c=new Error;if(c.stack){var d=c.stack,e=h(b),f=d.indexOf("\n"+e);if(f>=0){var g=d.indexOf("\n",f+1);d=d.substring(g+1)}this.stack=d}}},u.inherits(y.AssertionError,Error),y.fail=l,y.ok=m,y.equal=function(a,b,c){a!=b&&l(a,b,c,"==",y.equal)},y.notEqual=function(a,b,c){a==b&&l(a,b,c,"!=",y.notEqual)},y.deepEqual=function(a,b,c){n(a,b,!1)||l(a,b,c,"deepEqual",y.deepEqual)},y.deepStrictEqual=function(a,b,c){n(a,b,!0)||l(a,b,c,"deepStrictEqual",y.deepStrictEqual)},y.notDeepEqual=function(a,b,c){n(a,b,!1)&&l(a,b,c,"notDeepEqual",y.notDeepEqual)},y.notDeepStrictEqual=q,y.strictEqual=function(a,b,c){a!==b&&l(a,b,c,"===",y.strictEqual)},y.notStrictEqual=function(a,b,c){a===b&&l(a,b,c,"!==",y.notStrictEqual)},y["throws"]=function(a,b,c){t(!0,a,b,c)},y.doesNotThrow=function(a,b,c){t(!1,a,b,c)},y.ifError=function(a){if(a)throw a};var A=Object.keys||function(a){var b=[];for(var c in a)v.call(a,c)&&b.push(c);return b}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":340}],30:[function(a,b,c){(function(a){!function(){function c(a){var b=!1;return function(){if(b)throw new Error("Callback was already called.");b=!0,a.apply(d,arguments)}}var d,e,f={};d=this,null!=d&&(e=d.async),f.noConflict=function(){return d.async=e,f};var g=Object.prototype.toString,h=Array.isArray||function(a){return"[object Array]"===g.call(a)},i=function(a,b){for(var c=0;c=a.length&&d())}if(d=d||function(){},!a.length)return d();var f=0;i(a,function(a){b(a,c(e))})},f.forEach=f.each,f.eachSeries=function(a,b,c){if(c=c||function(){},!a.length)return c();var d=0,e=function(){b(a[d],function(b){b?(c(b),c=function(){}):(d+=1,d>=a.length?c():e())})};e()},f.forEachSeries=f.eachSeries,f.eachLimit=function(a,b,c,d){var e=m(b);e.apply(null,[a,c,d])},f.forEachLimit=f.eachLimit;var m=function(a){return function(b,c,d){if(d=d||function(){},!b.length||0>=a)return d();var e=0,f=0,g=0;!function h(){if(e>=b.length)return d();for(;a>g&&f=b.length?d():h())})}()}},n=function(a){return function(){var b=Array.prototype.slice.call(arguments);return a.apply(null,[f.each].concat(b))}},o=function(a,b){return function(){var c=Array.prototype.slice.call(arguments);return b.apply(null,[m(a)].concat(c))}},p=function(a){return function(){var b=Array.prototype.slice.call(arguments);return a.apply(null,[f.eachSeries].concat(b))}},q=function(a,b,c,d){if(b=j(b,function(a,b){return{index:b,value:a}}),d){var e=[];a(b,function(a,b){c(a.value,function(c,d){e[a.index]=d,b(c)})},function(a){d(a,e)})}else a(b,function(a,b){c(a.value,function(a){b(a)})})};f.map=n(q),f.mapSeries=p(q),f.mapLimit=function(a,b,c,d){return r(b)(a,c,d)};var r=function(a){return o(a,q)};f.reduce=function(a,b,c,d){f.eachSeries(a,function(a,d){c(b,a,function(a,c){b=c,d(a)})},function(a){d(a,b)})},f.inject=f.reduce,f.foldl=f.reduce,f.reduceRight=function(a,b,c,d){var e=j(a,function(a){return a}).reverse();f.reduce(e,b,c,d)},f.foldr=f.reduceRight;var s=function(a,b,c,d){var e=[];b=j(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c&&e.push(a),b()})},function(a){d(j(e.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};f.filter=n(s),f.filterSeries=p(s),f.select=f.filter,f.selectSeries=f.filterSeries;var t=function(a,b,c,d){var e=[];b=j(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c||e.push(a),b()})},function(a){d(j(e.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};f.reject=n(t),f.rejectSeries=p(t);var u=function(a,b,c,d){a(b,function(a,b){c(a,function(c){c?(d(a),d=function(){}):b()})},function(a){d()})};f.detect=n(u),f.detectSeries=p(u),f.some=function(a,b,c){f.each(a,function(a,d){b(a,function(a){a&&(c(!0),c=function(){}),d()})},function(a){c(!1)})},f.any=f.some,f.every=function(a,b,c){f.each(a,function(a,d){b(a,function(a){a||(c(!1),c=function(){}),d()})},function(a){c(!0)})},f.all=f.every,f.sortBy=function(a,b,c){f.map(a,function(a,c){b(a,function(b,d){b?c(b):c(null,{value:a,criteria:d})})},function(a,b){if(a)return c(a);var d=function(a,b){var c=a.criteria,d=b.criteria;return d>c?-1:c>d?1:0};c(null,j(b.sort(d),function(a){return a.value}))})},f.auto=function(a,b){b=b||function(){};var c=l(a),d=c.length;if(!d)return b();var e={},g=[],j=function(a){g.unshift(a)},m=function(a){for(var b=0;bd;){var f=d+(e-d+1>>>1);c(b,a[f])>=0?d=f:e=f-1}return d}function e(a,b,e,g){return a.started||(a.started=!0),h(b)||(b=[b]),0==b.length?f.setImmediate(function(){a.drain&&a.drain()}):void i(b,function(b){var h={data:b,priority:e,callback:"function"==typeof g?g:null};a.tasks.splice(d(a.tasks,h,c)+1,0,h),a.saturated&&a.tasks.length===a.concurrency&&a.saturated(),f.setImmediate(a.process)})}var g=f.queue(a,b);return g.push=function(a,b,c){e(g,a,b,c)},delete g.unshift,g},f.cargo=function(a,b){var c=!1,d=[],e={tasks:d,payload:b,saturated:null,empty:null,drain:null,drained:!0,push:function(a,c){h(a)||(a=[a]),i(a,function(a){d.push({data:a,callback:"function"==typeof c?c:null}),e.drained=!1,e.saturated&&d.length===b&&e.saturated()}),f.setImmediate(e.process)},process:function g(){if(!c){if(0===d.length)return e.drain&&!e.drained&&e.drain(),void(e.drained=!0);var f="number"==typeof b?d.splice(0,b):d.splice(0,d.length),h=j(f,function(a){return a.data});e.empty&&e.empty(),c=!0,a(h,function(){c=!1;var a=arguments;i(f,function(b){b.callback&&b.callback.apply(null,a)}),g()})}},length:function(){return d.length},running:function(){return c}};return e};var x=function(a){return function(b){var c=Array.prototype.slice.call(arguments,1);b.apply(null,c.concat([function(b){var c=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(b?console.error&&console.error(b):console[a]&&i(c,function(b){console[a](b)}))}]))}};f.log=x("log"),f.dir=x("dir"),f.memoize=function(a,b){var c={},d={};b=b||function(a){return a};var e=function(){var e=Array.prototype.slice.call(arguments),g=e.pop(),h=b.apply(null,e);h in c?f.nextTick(function(){g.apply(null,c[h])}):h in d?d[h].push(g):(d[h]=[g],a.apply(null,e.concat([function(){c[h]=arguments;var a=d[h];delete d[h];for(var b=0,e=a.length;e>b;b++)a[b].apply(null,arguments)}])))};return e.memo=c,e.unmemoized=a,e},f.unmemoize=function(a){return function(){return(a.unmemoized||a).apply(null,arguments)}},f.times=function(a,b,c){for(var d=[],e=0;a>e;e++)d.push(e);return f.map(d,b,c)},f.timesSeries=function(a,b,c){for(var d=[],e=0;a>e;e++)d.push(e);return f.mapSeries(d,b,c)},f.seq=function(){var a=arguments;return function(){var b=this,c=Array.prototype.slice.call(arguments),d=c.pop();f.reduce(a,c,function(a,c,d){c.apply(b,a.concat([function(){var a=arguments[0],b=Array.prototype.slice.call(arguments,1);d(a,b)}]))},function(a,c){d.apply(b,[a].concat(c))})}},f.compose=function(){return f.seq.apply(null,Array.prototype.reverse.call(arguments))};var y=function(a,b){var c=function(){var c=this,d=Array.prototype.slice.call(arguments),e=d.pop();return a(b,function(a,b){a.apply(c,d.concat([b]))},e)};if(arguments.length>2){var d=Array.prototype.slice.call(arguments,2);return c.apply(this,d)}return c};f.applyEach=n(y),f.applyEachSeries=p(y),f.forever=function(a,b){function c(d){if(d){if(b)return b(d);throw d}a(c)}c()},"undefined"!=typeof b&&b.exports?b.exports=f:"undefined"!=typeof define&&define.amd?define([],function(){return f}):d.async=f}()}).call(this,a("_process"))},{_process:282}],31:[function(a,b,c){var d=a("safe-buffer").Buffer;b.exports=function(a){function b(b){if(0===b.length)return"";for(var c=[0],d=0;d0;)c.push(f%g),f=f/g|0}for(var i="",j=0;0===b[j]&&j=0;--k)i+=a[c[k]];return i}function c(a){if("string"!=typeof a)throw new TypeError("Expected String");if(0===a.length)return d.allocUnsafe(0);for(var b=[0],c=0;c>=8;for(;j>0;)b.push(255&j),j>>=8}for(var k=0;a[k]===h&&k0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===a[b-2]?2:"="===a[b-1]?1:0}function e(a){return 3*a.length/4-d(a)}function f(a){var b,c,e,f,g,h=a.length;f=d(a),g=new l(3*h/4-f),c=f>0?h-4:h;var i=0;for(b=0;c>b;b+=4)e=k[a.charCodeAt(b)]<<18|k[a.charCodeAt(b+1)]<<12|k[a.charCodeAt(b+2)]<<6|k[a.charCodeAt(b+3)],g[i++]=e>>16&255,g[i++]=e>>8&255,g[i++]=255&e;return 2===f?(e=k[a.charCodeAt(b)]<<2|k[a.charCodeAt(b+1)]>>4,g[i++]=255&e):1===f&&(e=k[a.charCodeAt(b)]<<10|k[a.charCodeAt(b+1)]<<4|k[a.charCodeAt(b+2)]>>2,g[i++]=e>>8&255,g[i++]=255&e),g}function g(a){return j[a>>18&63]+j[a>>12&63]+j[a>>6&63]+j[63&a]}function h(a,b,c){for(var d,e=[],f=b;c>f;f+=3)d=(a[f]<<16&16711680)+(a[f+1]<<8&65280)+(255&a[f+2]),e.push(g(d));return e.join("")}function i(a){for(var b,c=a.length,d=c%3,e="",f=[],g=16383,i=0,k=c-d;k>i;i+=g)f.push(h(a,i,i+g>k?k:i+g));return 1===d?(b=a[c-1],e+=j[b>>2],e+=j[b<<4&63],e+="=="):2===d&&(b=(a[c-2]<<8)+a[c-1],e+=j[b>>10],e+=j[b>>4&63],e+=j[b<<2&63],e+="="),f.push(e),f.join("")}c.byteLength=e,c.toByteArray=f,c.fromByteArray=i;for(var j=[],k=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=m.length;o>n;++n)j[n]=m[n],k[m.charCodeAt(n)]=n;k["-".charCodeAt(0)]=62,k["_".charCodeAt(0)]=63},{}],33:[function(a,b,c){function d(a,b,c){return this instanceof d?void(null!=a&&("number"==typeof a?this.fromNumber(a,b,c):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))):new d(a,b,c)}function e(a,b,c,d,e,f){for(;--f>=0;){var g=b*this[a++]+c[d]+e;e=Math.floor(g/67108864),c[d++]=67108863&g}return e}function f(a){return fb.charAt(a)}function g(a,b){var c=gb[a.charCodeAt(b)];return null==c?-1:c}function h(a){for(var b=this.t-1;b>=0;--b)a[b]=this[b];a.t=this.t,a.s=this.s}function i(a){this.t=1,this.s=0>a?-1:0,a>0?this[0]=a:-1>a?this[0]=a+bb:this.t=0}function j(a){var b=new d;return b.fromInt(a),b}function k(a,b){var c,e=this;if(16==b)c=4;else if(8==b)c=3;else if(256==b)c=8;else if(2==b)c=1;else if(32==b)c=5;else{if(4!=b)return void e.fromRadix(a,b);c=2}e.t=0,e.s=0;for(var f=a.length,h=!1,i=0;--f>=0;){var j=8==c?255&a[f]:g(a,f);0>j?"-"==a.charAt(f)&&(h=!0):(h=!1,0==i?e[e.t++]=j:i+c>e.DB?(e[e.t-1]|=(j&(1<>e.DB-i):e[e.t-1]|=j<=e.DB&&(i-=e.DB))}8==c&&0!=(128&a[0])&&(e.s=-1,i>0&&(e[e.t-1]|=(1<0&&this[this.t-1]==a;)--this.t}function m(a){var b=this;if(b.s<0)return"-"+b.negate().toString(a);var c;if(16==a)c=4;else if(8==a)c=3;else if(2==a)c=1;else if(32==a)c=5;else{if(4!=a)return b.toRadix(a);c=2}var d,e=(1<0)for(j>j)>0&&(g=!0,h=f(d));i>=0;)c>j?(d=(b[i]&(1<>(j+=b.DB-c)):(d=b[i]>>(j-=c)&e,0>=j&&(j+=b.DB,--i)),d>0&&(g=!0),g&&(h+=f(d));return g?h:"0"}function n(){var a=new d;return d.ZERO.subTo(this,a),a}function o(){return this.s<0?this.negate():this}function p(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t;if(b=c-a.t,0!=b)return this.s<0?-b:b;for(;--c>=0;)if(0!=(b=this[c]-a[c]))return b;return 0}function q(a){var b,c=1;return 0!=(b=a>>>16)&&(a=b,c+=16),0!=(b=a>>8)&&(a=b,c+=8),0!=(b=a>>4)&&(a=b,c+=4),0!=(b=a>>2)&&(a=b,c+=2),0!=(b=a>>1)&&(a=b,c+=1),c}function r(){return this.t<=0?0:this.DB*(this.t-1)+q(this[this.t-1]^this.s&this.DM)}function s(){return this.bitLength()>>3}function t(a,b){var c;for(c=this.t-1;c>=0;--c)b[c+a]=this[c];for(c=a-1;c>=0;--c)b[c]=0;b.t=this.t+a,b.s=this.s}function u(a,b){for(var c=a;c=0;--c)b[c+h+1]=d[c]>>f|i,i=(d[c]&g)<=0;--c)b[c]=0;b[h]=i,b.t=d.t+h+1,b.s=d.s,b.clamp()}function w(a,b){var c=this;b.s=c.s;var d=Math.floor(a/c.DB);if(d>=c.t)return void(b.t=0);var e=a%c.DB,f=c.DB-e,g=(1<>e;for(var h=d+1;h>e;e>0&&(b[c.t-d-1]|=(c.s&g)<d;)e+=c[d]-a[d],b[d++]=e&c.DM,e>>=c.DB;if(a.t>=c.DB;e+=c.s}else{for(e+=c.s;d>=c.DB;e-=a.s}b.s=0>e?-1:0,-1>e?b[d++]=c.DV+e:e>0&&(b[d++]=e),b.t=d,b.clamp()}function y(a,b){var c=this.abs(),e=a.abs(),f=c.t;for(b.t=f+e.t;--f>=0;)b[f]=0;for(f=0;f=0;)a[c]=0;for(c=0;c=b.DV&&(a[c+b.t]-=b.DV,a[c+b.t+1]=1)}a.t>0&&(a[a.t-1]+=b.am(c,b[c],a,2*c,0,1)),a.s=0,a.clamp()}function A(a,b,c){var e=this,f=a.abs();if(!(f.t<=0)){var g=e.abs();if(g.t0?(f.lShiftTo(k,h),g.lShiftTo(k,c)):(f.copyTo(h),g.copyTo(c));var l=h.t,m=h[l-1];if(0!=m){var n=m*(1<1?h[l-2]>>e.F2:0),o=e.FV/n,p=(1<=0&&(c[c.t++]=1,c.subTo(u,c)),d.ONE.dlShiftTo(l,u),u.subTo(h,h);h.t=0;){var v=c[--s]==m?e.DM:Math.floor(c[s]*o+(c[s-1]+r)*p);if((c[s]+=h.am(0,v,c,t,0,l))0&&c.rShiftTo(k,c),0>i&&d.ZERO.subTo(c,c)}}}function B(a){var b=new d;return this.abs().divRemTo(a,null,b),this.s<0&&b.compareTo(d.ZERO)>0&&a.subTo(b,b),b}function C(a){this.m=a}function D(a){return a.s<0||a.compareTo(this.m)>=0?a.mod(this.m):a}function E(a){return a}function F(a){a.divRemTo(this.m,null,a)}function G(a,b,c){a.multiplyTo(b,c),this.reduce(c)}function H(a,b){a.squareTo(b),this.reduce(b)}function I(){if(this.t<1)return 0;var a=this[0];if(0==(1&a))return 0;var b=3&a;return b=b*(2-(15&a)*b)&15,b=b*(2-(255&a)*b)&255,b=b*(2-((65535&a)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV,b>0?this.DV-b:-b}function J(a){this.m=a,this.mp=a.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(b,b),b}function L(a){var b=new d;return a.copyTo(b),this.reduce(b),b}function M(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var b=0;b>15)*this.mpl&this.um)<<15)&a.DM;for(c=b+this.m.t,a[c]+=this.m.am(0,d,a,b,0,this.m.t);a[c]>=a.DV;)a[c]-=a.DV,a[++c]++}a.clamp(),a.drShiftTo(this.m.t,a),a.compareTo(this.m)>=0&&a.subTo(this.m,a)}function N(a,b){a.squareTo(b),this.reduce(b)}function O(a,b,c){a.multiplyTo(b,c),this.reduce(c)}function P(){return 0==(this.t>0?1&this[0]:this.s)}function Q(a,b){if(a>4294967295||1>a)return d.ONE;var c=new d,e=new d,f=b.convert(this),g=q(a)-1;for(f.copyTo(c);--g>=0;)if(b.sqrTo(c,e),(a&1<0)b.mulTo(e,f,c);else{var h=c;c=e,e=h}return b.revert(c)}function R(a,b){var c;return c=256>a||b.isEven()?new C(b):new J(b),this.exp(a,c)}function S(){var a=new d;return this.copyTo(a),a}function T(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function V(){return 0==this.t?this.s:this[0]<<16>>16}function W(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function X(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function Y(a){if(null==a&&(a=10),0==this.signum()||2>a||a>36)return"0";var b=this.chunkSize(a),c=Math.pow(a,b),e=j(c),f=new d,g=new d,h="";for(this.divRemTo(e,f,g);f.signum()>0;)h=(c+g.intValue()).toString(a).substr(1)+h,f.divRemTo(e,f,g);return g.intValue().toString(a)+h}function Z(a,b){var c=this;c.fromInt(0),null==b&&(b=10);for(var e=c.chunkSize(b),f=Math.pow(b,e),h=!1,i=0,j=0,k=0;kl?"-"==a.charAt(k)&&0==c.signum()&&(h=!0):(j=b*j+l,++i>=e&&(c.dMultiply(f),c.dAddOffset(j,0),i=0,j=0))}i>0&&(c.dMultiply(Math.pow(b,i)),c.dAddOffset(j,0)),h&&d.ZERO.subTo(c,c)}function $(a,b,c){var e=this;if("number"==typeof b)if(2>a)e.fromInt(1);else for(e.fromNumber(a,c),e.testBit(a-1)||e.bitwiseTo(d.ONE.shiftLeft(a-1),ga,e),e.isEven()&&e.dAddOffset(1,0);!e.isProbablePrime(b);)e.dAddOffset(2,0),e.bitLength()>a&&e.subTo(d.ONE.shiftLeft(a-1),e);else{var f=new Array,g=7&a;f.length=(a>>3)+1,b.nextBytes(f),g>0?f[0]&=(1<0)for(e>e)!=(a.s&a.DM)>>e&&(c[f++]=d|a.s<=0;)8>e?(d=(a[b]&(1<>(e+=a.DB-8)):(d=a[b]>>(e-=8)&255,0>=e&&(e+=a.DB,--b)),0!=(128&d)&&(d|=-256),0===f&&(128&a.s)!=(128&d)&&++f,(f>0||d!=a.s)&&(c[f++]=d);return c}function aa(a){return 0==this.compareTo(a)}function ba(a){return this.compareTo(a)<0?this:a}function ca(a){return this.compareTo(a)>0?this:a}function da(a,b,c){var d,e,f=this,g=Math.min(a.t,f.t);for(d=0;g>d;++d)c[d]=b(f[d],a[d]);if(a.ta?this.rShiftTo(-a,b):this.lShiftTo(a,b),b}function oa(a){var b=new d;return 0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b),b}function pa(a){if(0==a)return-1;var b=0;return 0==(65535&a)&&(a>>=16,b+=16),0==(255&a)&&(a>>=8,b+=8),0==(15&a)&&(a>>=4,b+=4),0==(3&a)&&(a>>=2,b+=2),0==(1&a)&&++b,b}function qa(){for(var a=0;a=this.t?0!=this.s:0!=(this[b]&1<d;)e+=c[d]+a[d],b[d++]=e&c.DM,e>>=c.DB;if(a.t>=c.DB;e+=c.s}else{for(e+=c.s;d>=c.DB;e+=a.s}b.s=0>e?-1:0,e>0?b[d++]=e:-1>e&&(b[d++]=c.DV+e),b.t=d,b.clamp()}function za(a){var b=new d;return this.addTo(a,b),b}function Aa(a){var b=new d;return this.subTo(a,b),b}function Ba(a){var b=new d;return this.multiplyTo(a,b),b}function Ca(){var a=new d;return this.squareTo(a),a}function Da(a){var b=new d;return this.divRemTo(a,b,null),b}function Ea(a){var b=new d;return this.divRemTo(a,null,b),b}function Fa(a){var b=new d,c=new d;return this.divRemTo(a,b,c),new Array(b,c)}function Ga(a){this[this.t]=this.am(0,a-1,this,0,0,this.t),++this.t,this.clamp()}function Ha(a,b){if(0!=a){for(;this.t<=b;)this[this.t++]=0;for(this[b]+=a;this[b]>=this.DV;)this[b]-=this.DV,++b>=this.t&&(this[this.t++]=0),++this[b]}}function Ia(){}function Ja(a){return a}function Ka(a,b,c){a.multiplyTo(b,c)}function La(a,b){a.squareTo(b)}function Ma(a){return this.exp(a,new Ia)}function Na(a,b,c){var d=Math.min(this.t+a.t,b);for(c.s=0,c.t=d;d>0;)c[--d]=0;var e;for(e=c.t-this.t;e>d;++d)c[d+this.t]=this.am(0,a[d],c,d,0,this.t);for(e=Math.min(a.t,b);e>d;++d)this.am(0,a[d],c,d,0,b-d);c.clamp()}function Oa(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;--d>=0;)c[d]=0;for(d=Math.max(b-this.t,0);d2*this.m.t)return a.mod(this.m);if(a.compareTo(this.m)<0)return a;var b=new d;return a.copyTo(b), +this.reduce(b),b}function Ra(a){return a}function Sa(a){var b=this;for(a.drShiftTo(b.m.t-1,b.r2),a.t>b.m.t+1&&(a.t=b.m.t+1,a.clamp()),b.mu.multiplyUpperTo(b.r2,b.m.t+1,b.q3),b.m.multiplyLowerTo(b.q3,b.m.t+1,b.r2);a.compareTo(b.r2)<0;)a.dAddOffset(1,b.m.t+1);for(a.subTo(b.r2,a);a.compareTo(b.m)>=0;)a.subTo(b.m,a)}function Ta(a,b){a.squareTo(b),this.reduce(b)}function Ua(a,b,c){a.multiplyTo(b,c),this.reduce(c)}function Va(a,b){var c,e,f=a.bitLength(),g=j(1);if(0>=f)return g;c=18>f?1:48>f?3:144>f?4:768>f?5:6,e=8>f?new C(b):b.isEven()?new Pa(b):new J(b);var h=new Array,i=3,k=c-1,l=(1<1){var m=new d;for(e.sqrTo(h[1],m);l>=i;)h[i]=new d,e.mulTo(m,h[i-2],h[i]),i+=2}var n,o,p=a.t-1,r=!0,s=new d;for(f=q(a[p])-1;p>=0;){for(f>=k?n=a[p]>>f-k&l:(n=(a[p]&(1<0&&(n|=a[p-1]>>this.DB+f-k)),i=c;0==(1&n);)n>>=1,--i;if((f-=i)<0&&(f+=this.DB,--p),r)h[n].copyTo(g),r=!1;else{for(;i>1;)e.sqrTo(g,s),e.sqrTo(s,g),i-=2;i>0?e.sqrTo(g,s):(o=g,g=s,s=o),e.mulTo(s,h[n],g)}for(;p>=0&&0==(a[p]&1<f)return b;for(f>e&&(f=e),f>0&&(b.rShiftTo(f,b),c.rShiftTo(f,c));b.signum()>0;)(e=b.getLowestSetBit())>0&&b.rShiftTo(e,b),(e=c.getLowestSetBit())>0&&c.rShiftTo(e,c),b.compareTo(c)>=0?(b.subTo(c,b),b.rShiftTo(1,b)):(c.subTo(b,c),c.rShiftTo(1,c));return f>0&&c.lShiftTo(f,c),c}function Xa(a){if(0>=a)return 0;var b=this.DV%a,c=this.s<0?a-1:0;if(this.t>0)if(0==b)c=this[0]%a;else for(var d=this.t-1;d>=0;--d)c=(b*c+this[d])%a;return c}function Ya(a){var b=a.isEven();if(0===this.signum())throw new Error("division by zero");if(this.isEven()&&b||0==a.signum())return d.ZERO;for(var c=a.clone(),e=this.clone(),f=j(1),g=j(0),h=j(0),i=j(1);0!=c.signum();){for(;c.isEven();)c.rShiftTo(1,c),b?(f.isEven()&&g.isEven()||(f.addTo(this,f),g.subTo(a,g)),f.rShiftTo(1,f)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&i.isEven()||(h.addTo(this,h),i.subTo(a,i)),h.rShiftTo(1,h)):i.isEven()||i.subTo(a,i),i.rShiftTo(1,i);c.compareTo(e)>=0?(c.subTo(e,c),b&&f.subTo(h,f),g.subTo(i,g)):(e.subTo(c,e),b&&h.subTo(f,h),i.subTo(g,i))}if(0!=e.compareTo(d.ONE))return d.ZERO;for(;i.compareTo(a)>=0;)i.subTo(a,i);for(;i.signum()<0;)i.addTo(a,i);return i}function Za(a){var b,c=this.abs();if(1==c.t&&c[0]<=hb[hb.length-1]){for(b=0;bd;)d*=hb[e++];for(d=c.modInt(d);e>b;)if(d%hb[b++]==0)return!1}return c.millerRabin(a)}function $a(a){var b=this.subtract(d.ONE),c=b.getLowestSetBit();if(0>=c)return!1;var e=b.shiftRight(c);a=a+1>>1,a>hb.length&&(a=hb.length);for(var f,g=new d(null),h=[],i=0;a>i;++i){for(;f=hb[Math.floor(Math.random()*hb.length)],-1!=h.indexOf(f););h.push(f),g.fromInt(f);var j=g.modPow(e,this);if(0!=j.compareTo(d.ONE)&&0!=j.compareTo(b)){for(var f=1;f++=eb;++eb)gb[db++]=eb;for(db="a".charCodeAt(0),eb=10;36>eb;++eb)gb[db++]=eb;for(db="A".charCodeAt(0),eb=10;36>eb;++eb)gb[db++]=eb;C.prototype.convert=D,C.prototype.revert=E,C.prototype.reduce=F,C.prototype.mulTo=G,C.prototype.sqrTo=H,J.prototype.convert=K,J.prototype.revert=L,J.prototype.reduce=M,J.prototype.mulTo=O,J.prototype.sqrTo=N,_a.copyTo=h,_a.fromInt=i,_a.fromString=k,_a.clamp=l,_a.dlShiftTo=t,_a.drShiftTo=u,_a.lShiftTo=v,_a.rShiftTo=w,_a.subTo=x,_a.multiplyTo=y,_a.squareTo=z,_a.divRemTo=A,_a.invDigit=I,_a.isEven=P,_a.exp=Q,_a.toString=m,_a.negate=n,_a.abs=o,_a.compareTo=p,_a.bitLength=r,_a.byteLength=s,_a.mod=B,_a.modPowInt=R,Ia.prototype.convert=Ja,Ia.prototype.revert=Ja,Ia.prototype.mulTo=Ka,Ia.prototype.sqrTo=La,Pa.prototype.convert=Qa,Pa.prototype.revert=Ra,Pa.prototype.reduce=Sa,Pa.prototype.mulTo=Ua,Pa.prototype.sqrTo=Ta;var hb=[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],ib=(1<<26)/hb[hb.length-1];_a.chunkSize=W,_a.toRadix=Y,_a.fromRadix=Z,_a.fromNumber=$,_a.bitwiseTo=da,_a.changeBit=ua,_a.addTo=ya,_a.dMultiply=Ga,_a.dAddOffset=Ha,_a.multiplyLowerTo=Na,_a.multiplyUpperTo=Oa,_a.modInt=Xa,_a.millerRabin=$a,_a.clone=S,_a.intValue=T,_a.byteValue=U,_a.shortValue=V,_a.signum=X,_a.toByteArray=_,_a.equals=aa,_a.min=ba,_a.max=ca,_a.and=fa,_a.or=ha,_a.xor=ja,_a.andNot=la,_a.not=ma,_a.shiftLeft=na,_a.shiftRight=oa,_a.getLowestSetBit=qa,_a.bitCount=sa,_a.testBit=ta,_a.setBit=va,_a.clearBit=wa,_a.flipBit=xa,_a.add=za,_a.subtract=Aa,_a.multiply=Ba,_a.divide=Da,_a.remainder=Ea,_a.divideAndRemainder=Fa,_a.modPow=Va,_a.modInverse=Ya,_a.pow=Ma,_a.gcd=Wa,_a.isProbablePrime=Za,_a.square=Ca,d.ZERO=j(0),d.ONE=j(1),d.valueOf=j,b.exports=d},{"../package.json":36}],34:[function(a,b,c){(function(b){var c=a("assert"),d=a("./bigi");d.fromByteArrayUnsigned=function(a){return new d(128&a[0]?[0].concat(a):a)},d.prototype.toByteArrayUnsigned=function(){var a=this.toByteArray();return 0===a[0]?a.slice(1):a},d.fromDERInteger=function(a){return new d(a)},d.prototype.toDERInteger=d.prototype.toByteArray,d.fromBuffer=function(a){if(128&a[0]){var b=Array.prototype.slice.call(a);return new d([0].concat(b))}return new d(a)},d.fromHex=function(a){return""===a?d.ZERO:(c.equal(a,a.match(/^[A-Fa-f0-9]+/),"Invalid hex string"),c.equal(a.length%2,0,"Incomplete hex"),new d(a,16))},d.prototype.toBuffer=function(a){for(var c=this.toByteArrayUnsigned(),d=[],e=a-c.length;d.lengthd;++d)b.push(a.and(c).toNumber()),a=a.shrn(5);return b.reverse()}function h(a){for(var b=new q(1),c=new q(34359738367),d=0;d"},d.prototype.toCashBuffer=function(){var a=new c([this.network[this.type]]),b=c.concat([a,this.hashBuffer]);return b},d.prototype.toCashAddress=function(){function a(a){switch(a){case"pubkeyhash":return 0;case"scripthash":return 8;default:throw new Error("Invalid type:"+a)}}function b(a){switch(8*a.length){case 160:return 0;case 192:return 1;case 224:return 2;case 256:return 3;case 320:return 4;case 384:return 5;case 448:return 6;case 512:return 7;default:throw new Error("Invalid hash size:"+a.length)}}var c=[0,0,0,0,0,0,0,0],d=this.network.prefixArray.concat([0]),e=a(this.type)+b(this.hashBuffer),f=Array.prototype.slice.call(this.hashBuffer,0),i=s([e].concat(f),8,5),j=d.concat(i).concat(c),k=i.concat(g(h(j)));return this.network.prefix+":"+r.encode(k)};var t=i.map([656907472481,522768456162,0xf33e5fb3c4,748107326120,130178868336],function(a){return new q(a)});b.exports=d;var u=a("./script")}).call(this,a("buffer").Buffer)},{"./crypto/bn":44,"./crypto/hash":46,"./encoding/base58check":51,"./errors":55,"./networks":59,"./publickey":62,"./script":63,"./util/base32":80,"./util/convertBits":82,"./util/js":83,"./util/preconditions":84,buffer:187,lodash:87}],40:[function(a,b,c){(function(c){"use strict";function d(a){return this instanceof d?(e.extend(this,d._from(a)),this):new d(a)}var e=a("lodash"),f=a("./blockheader"),g=a("../crypto/bn"),h=a("../util/buffer"),i=a("../encoding/bufferreader"),j=a("../encoding/bufferwriter"),k=a("../crypto/hash"),l=a("../transaction"),m=a("../util/preconditions");d.MAX_BLOCK_SIZE=1e6,d._from=function(a){var b={};if(h.isBuffer(a))b=d._fromBufferReader(i(a));else{if(!e.isObject(a))throw new TypeError("Unrecognized argument for Block");b=d._fromObject(a)}return b},d._fromObject=function(a){var b=[];a.transactions.forEach(function(a){a instanceof l?b.push(a):b.push(l().fromObject(a))});var c={header:f.fromObject(a.header),transactions:b};return c},d.fromObject=function(a){var b=d._fromObject(a);return new d(b)},d._fromBufferReader=function(a){var b={};m.checkState(!a.finished(),"No block data received"),b.header=f.fromBufferReader(a);var c=a.readVarintNum();b.transactions=[];for(var d=0;c>d;d++)b.transactions.push(l().fromBufferReader(a));return b},d.fromBufferReader=function(a){m.checkArgument(a,"br is required");var b=d._fromBufferReader(a);return new d(b)},d.fromBuffer=function(a){return d.fromBufferReader(new i(a))},d.fromString=function(a){var b=new c(a,"hex");return d.fromBuffer(b)},d.fromRawBlock=function(a){h.isBuffer(a)||(a=new c(a,"binary"));var b=i(a);b.pos=d.Values.START_OF_BLOCK;var e=d._fromBufferReader(b);return new d(e)},d.prototype.toObject=d.prototype.toJSON=function(){var a=[];return this.transactions.forEach(function(b){a.push(b.toObject())}),{header:this.header.toObject(),transactions:a}},d.prototype.toBuffer=function(){return this.toBufferWriter().concat()},d.prototype.toString=function(){return this.toBuffer().toString("hex")},d.prototype.toBufferWriter=function(a){a||(a=new j),a.write(this.header.toBuffer()),a.writeVarintNum(this.transactions.length);for(var b=0;b1;d=Math.floor((d+1)/2)){for(var e=0;d>e;e+=2){var f=Math.min(e+1,d-1),g=c.concat([a[b+e],a[b+f]]);a.push(k.sha256sha256(g))}b+=d}return a},d.prototype.getMerkleRoot=function(){var a=this.getMerkleTree();return a[a.length-1]},d.prototype.validMerkleRoot=function(){var a=new g(this.header.merkleRoot.toString("hex"),"hex"),b=new g(this.getMerkleRoot().toString("hex"),"hex");return 0!==a.cmp(b)?!1:!0},d.prototype._getHash=function(){return this.header._getHash()};var n={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=this.header.id),this._id},set:e.noop};Object.defineProperty(d.prototype,"id",n),Object.defineProperty(d.prototype,"hash",n),d.prototype.inspect=function(){return""},d.Values={START_OF_BLOCK:8,NULL_HASH:new c("0000000000000000000000000000000000000000000000000000000000000000","hex")},b.exports=d}).call(this,a("buffer").Buffer)},{"../crypto/bn":44,"../crypto/hash":46,"../encoding/bufferreader":52,"../encoding/bufferwriter":53,"../transaction":66,"../util/buffer":81,"../util/preconditions":84,"./blockheader":41,buffer:187,lodash:87}],41:[function(a,b,c){(function(c){"use strict";var d=a("lodash"),e=a("../crypto/bn"),f=a("../util/buffer"),g=a("../encoding/bufferreader"),h=a("../encoding/bufferwriter"),i=a("../crypto/hash"),j=(a("../util/js"),a("../util/preconditions")),k=486604799,l=function n(a){if(!(this instanceof n))return new n(a);var b=n._from(a);return this.version=b.version,this.prevHash=b.prevHash,this.merkleRoot=b.merkleRoot,this.time=b.time,this.timestamp=b.time,this.bits=b.bits,this.nonce=b.nonce,b.hash&&j.checkState(this.hash===b.hash,"Argument object hash property does not match block hash."),this};l._from=function(a){var b={};if(f.isBuffer(a))b=l._fromBufferReader(g(a));else{if(!d.isObject(a))throw new TypeError("Unrecognized argument for BlockHeader");b=l._fromObject(a)}return b},l._fromObject=function(a){j.checkArgument(a,"data is required");var b=a.prevHash,e=a.merkleRoot;d.isString(a.prevHash)&&(b=f.reverse(new c(a.prevHash,"hex"))),d.isString(a.merkleRoot)&&(e=f.reverse(new c(a.merkleRoot,"hex")));var g={hash:a.hash,version:a.version,prevHash:b,merkleRoot:e,time:a.time,timestamp:a.time,bits:a.bits,nonce:a.nonce};return g},l.fromObject=function(a){var b=l._fromObject(a);return new l(b)},l.fromRawBlock=function(a){f.isBuffer(a)||(a=new c(a,"binary"));var b=g(a);b.pos=l.Constants.START_OF_HEADER;var d=l._fromBufferReader(b);return new l(d)},l.fromBuffer=function(a){var b=l._fromBufferReader(g(a));return new l(b)},l.fromString=function(a){var b=new c(a,"hex");return l.fromBuffer(b)},l._fromBufferReader=function(a){var b={};return b.version=a.readInt32LE(),b.prevHash=a.read(32),b.merkleRoot=a.read(32),b.time=a.readUInt32LE(),b.bits=a.readUInt32LE(),b.nonce=a.readUInt32LE(),b},l.fromBufferReader=function(a){var b=l._fromBufferReader(a);return new l(b)},l.prototype.toObject=l.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:f.reverse(this.prevHash).toString("hex"),merkleRoot:f.reverse(this.merkleRoot).toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},l.prototype.toBuffer=function(){return this.toBufferWriter().concat()},l.prototype.toString=function(){return this.toBuffer().toString("hex")},l.prototype.toBufferWriter=function(a){return a||(a=new h),a.writeInt32LE(this.version),a.write(this.prevHash),a.write(this.merkleRoot),a.writeUInt32LE(this.time),a.writeUInt32LE(this.bits),a.writeUInt32LE(this.nonce),a},l.prototype.getTargetDifficulty=function(a){a=a||this.bits;for(var b=new e(16777215&a),c=8*((a>>>24)-3);c-->0;)b=b.mul(new e(2));return b},l.prototype.getDifficulty=function(){var a=this.getTargetDifficulty(k).mul(new e(Math.pow(10,8))),b=this.getTargetDifficulty(),c=a.div(b).toString(10),d=c.length-8;return c=c.slice(0,d)+"."+c.slice(d),parseFloat(c)},l.prototype._getHash=function(){var a=this.toBuffer();return i.sha256sha256(a)};var m={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=g(this._getHash()).readReverse().toString("hex")),this._id},set:d.noop};Object.defineProperty(l.prototype,"id",m),Object.defineProperty(l.prototype,"hash",m),l.prototype.validTimestamp=function(){var a=Math.round((new Date).getTime()/1e3);return this.time>a+l.Constants.MAX_TIME_OFFSET?!1:!0},l.prototype.validProofOfWork=function(){var a=new e(this.id,"hex"),b=this.getTargetDifficulty();return a.cmp(b)>0?!1:!0},l.prototype.inspect=function(){return""},l.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new e("10000000000000000000000000000000000000000000000000000000000000000","hex")},b.exports=l}).call(this,a("buffer").Buffer)},{"../crypto/bn":44,"../crypto/hash":46,"../encoding/bufferreader":52,"../encoding/bufferwriter":53,"../util/buffer":81,"../util/js":83,"../util/preconditions":84,buffer:187,lodash:87}],42:[function(a,b,c){b.exports=a("./block"),b.exports.BlockHeader=a("./blockheader"),b.exports.MerkleBlock=a("./merkleblock")},{"./block":40,"./blockheader":41,"./merkleblock":43}],43:[function(a,b,c){(function(c){"use strict";function d(a){if(!(this instanceof d))return new d(a);var b={};if(g.isBuffer(a))b=d._fromBufferReader(h(a));else{if(!e.isObject(a))throw new TypeError("Unrecognized argument for MerkleBlock");var c;c=a.header instanceof f?a.header:f.fromObject(a.header),b={header:c,numTransactions:a.numTransactions,hashes:a.hashes,flags:a.flags}}return e.extend(this,b),this._flagBitsUsed=0,this._hashesUsed=0,this}var e=a("lodash"),f=a("./blockheader"),g=a("../util/buffer"),h=a("../encoding/bufferreader"),i=a("../encoding/bufferwriter"),j=a("../crypto/hash"),k=(a("../util/js"),a("../transaction")),l=a("../errors"),m=a("../util/preconditions");d.fromBuffer=function(a){return d.fromBufferReader(h(a))},d.fromBufferReader=function(a){return new d(d._fromBufferReader(a))},d.prototype.toBuffer=function(){return this.toBufferWriter().concat()},d.prototype.toBufferWriter=function(a){a||(a=new i),a.write(this.header.toBuffer()),a.writeUInt32LE(this.numTransactions),a.writeVarintNum(this.hashes.length);for(var b=0;bthis.numTransactions)return!1;if(8*this.flags.lengththis.numTransactions)throw new l.MerkleBlock.InvalidMerkleTree;if(8*this.flags.length8*this.flags.length)return null;var f=this.flags[d.flagBitsUsed>>3]>>>(7&d.flagBitsUsed++)&1;if(0!==a&&f){var g=this._traverseMerkleTree(a-1,2*b,d),h=g;return 2*b+1=this.hashes.length)return null;var i=this.hashes[d.hashesUsed++];return 0===a&&f&&d.txs.push(i),new c(i,"hex")},d.prototype._calcTreeWidth=function(a){return this.numTransactions+(1<>a},d.prototype._calcTreeHeight=function(){for(var a=0;this._calcTreeWidth(a)>1;)a++;return a},d.prototype.hasTransaction=function(a){m.checkArgument(!e.isUndefined(a),"tx cannot be undefined"),m.checkArgument(a instanceof k||"string"==typeof a,'Invalid tx given, tx must be a "string" or "Transaction"');var b=a;a instanceof k&&(b=g.reverse(new c(a.id,"hex")).toString("hex"));var d=[],f=this._calcTreeHeight();return this._traverseMerkleTree(f,0,{txs:d}),-1!==d.indexOf(b)},d._fromBufferReader=function(a){m.checkState(!a.finished(),"No merkleblock data received");var b={};b.header=f.fromBufferReader(a),b.numTransactions=a.readUInt32LE();var c=a.readVarintNum();b.hashes=[];for(var d=0;c>d;d++)b.hashes.push(a.read(32).toString("hex"));var e=a.readVarintNum();for(b.flags=[],d=0;e>d;d++)b.flags.push(a.readUInt8());return b},d.fromObject=function(a){return new d(a)},b.exports=d}).call(this,a("buffer").Buffer)},{"../crypto/hash":46,"../encoding/bufferreader":52,"../encoding/bufferwriter":53,"../errors":55,"../transaction":66,"../util/buffer":81,"../util/js":83,"../util/preconditions":84,"./blockheader":41,buffer:187,lodash:87}],44:[function(a,b,c){(function(c){"use strict";var d=a("bn.js"),e=a("../util/preconditions"),f=a("lodash"),g=function(a){for(var b=new c(a.length),d=0;da.size?b=d.trim(b,f):f0&&0===(127&a[a.length-1])&&(a.length<=1||0===(128&a[a.length-2])))throw new Error("non-minimally encoded script number");return d.fromSM(a,{endian:"little"})},d.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},d.prototype.gt=function(a){return this.cmp(a)>0},d.prototype.gte=function(a){return this.cmp(a)>=0},d.prototype.lt=function(a){return this.cmp(a)<0},d.trim=function(a,b){return a.slice(b-a.length,a.length)},d.pad=function(a,b,d){for(var e=new c(d),f=0;ff;f++)e[f]=0;return e},b.exports=d}).call(this,a("buffer").Buffer)},{"../util/preconditions":84,"bn.js":153,buffer:187,lodash:87}],45:[function(a,b,c){(function(c){"use strict";var d=a("./bn"),e=a("./point"),f=a("./signature"),g=a("../publickey"),h=a("./random"),i=a("./hash"),j=a("../util/buffer"),k=a("lodash"),l=a("../util/preconditions"),m=function n(a){return this instanceof n?void(a&&this.set(a)):new n(a)};m.prototype.set=function(a){return this.hashbuf=a.hashbuf||this.hashbuf,this.endian=a.endian||this.endian,this.privkey=a.privkey||this.privkey,this.pubkey=a.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),this.sig=a.sig||this.sig,this.k=a.k||this.k,this.verified=a.verified||this.verified,this},m.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},m.prototype.calci=function(){for(var a=0;4>a;a++){this.sig.i=a;var b;try{b=this.toPublicKey()}catch(c){console.error(c);continue}if(b.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},m.fromString=function(a){var b=JSON.parse(a);return new m(b)},m.prototype.randomK=function(){var a,b=e.getN();do a=d.fromBuffer(h.getRandomBuffer(32));while(!a.lt(b)||!a.gt(d.Zero));return this.k=a,this},m.prototype.deterministicK=function(a){k.isUndefined(a)&&(a=0);var b=new c(32);b.fill(1);var f=new c(32);f.fill(0);var g=this.privkey.bn.toBuffer({size:32}),h="little"===this.endian?j.reverse(this.hashbuf):this.hashbuf;f=i.sha256hmac(c.concat([b,new c([0]),g,h]),f),b=i.sha256hmac(b,f),f=i.sha256hmac(c.concat([b,new c([1]),g,h]),f),b=i.sha256hmac(b,f),b=i.sha256hmac(b,f);for(var l=d.fromBuffer(b),m=e.getN(),n=0;a>n||!l.lt(m)||!l.gt(d.Zero);n++)f=i.sha256hmac(c.concat([b,new c([0])]),f),b=i.sha256hmac(b,f),b=i.sha256hmac(b,f),l=d.fromBuffer(b);return this.k=l,this},m.prototype.toPublicKey=function(){var a=this.sig.i;l.checkArgument(0===a||1===a||2===a||3===a,new Error("i must be equal to 0, 1, 2, or 3"));var b=d.fromBuffer(this.hashbuf),c=this.sig.r,f=this.sig.s,h=1&a,i=a>>1,j=e.getN(),k=e.getG(),m=i?c.add(j):c,n=e.fromX(h,m),o=n.mul(j);if(!o.isInfinity())throw new Error("nR is not a valid curve point");var p=b.neg().umod(j),q=c.invm(j),r=n.mul(f).add(k.mul(p)).mul(q),s=g.fromPoint(r,this.sig.compressed);return s},m.prototype.sigError=function(){if(!j.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var a=this.sig.r,b=this.sig.s;if(!(a.gt(d.Zero)&&a.lt(e.getN())&&b.gt(d.Zero)&&b.lt(e.getN())))return"r and s not in range";var c=d.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),f=e.getN(),g=b.invm(f),h=g.mul(c).umod(f),i=g.mul(a).umod(f),k=e.getG().mulAdd(h,this.pubkey.point,i);return k.isInfinity()?"p is infinity":0!==k.getX().umod(f).cmp(a)?"Invalid signature":!1},m.toLowS=function(a){return a.gt(d.fromBuffer(new c("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(a=e.getN().sub(a)),a},m.prototype._findSignature=function(a,b){var c,f,g,h,i=e.getN(),j=e.getG(),k=0;do(!this.k||k>0)&&this.deterministicK(k),k++,c=this.k,f=j.mul(c),g=f.x.umod(i),h=c.invm(i).mul(b.add(a.mul(g))).umod(i);while(g.cmp(d.Zero)<=0||h.cmp(d.Zero)<=0);return h=m.toLowS(h),{s:h,r:g}},m.prototype.sign=function(){var a=this.hashbuf,b=this.privkey,c=b.bn;l.checkState(a&&b&&c,new Error("invalid parameters")),l.checkState(j.isBuffer(a)&&32===a.length,new Error("hashbuf must be a 32 byte buffer"));var e=d.fromBuffer(a,this.endian?{endian:this.endian}:void 0),g=this._findSignature(c,e);return g.compressed=this.pubkey.compressed,this.sig=new f(g),this},m.prototype.signRandomK=function(){return this.randomK(),this.sign()},m.prototype.toString=function(){var a={};return this.hashbuf&&(a.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(a.privkey=this.privkey.toString()),this.pubkey&&(a.pubkey=this.pubkey.toString()),this.sig&&(a.sig=this.sig.toString()),this.k&&(a.k=this.k.toString()),JSON.stringify(a)},m.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},m.sign=function(a,b,c){return m().set({hashbuf:a,endian:c,privkey:b}).sign().sig},m.verify=function(a,b,c,d){return m().set({hashbuf:a,endian:d,sig:b,pubkey:c}).verify().verified},b.exports=m}).call(this,a("buffer").Buffer)},{"../publickey":62,"../util/buffer":81,"../util/preconditions":84,"./bn":44,"./hash":46,"./point":47,"./random":48,"./signature":49,buffer:187,lodash:87}],46:[function(a,b,c){(function(c){"use strict";var d=a("crypto"),e=a("../util/buffer"),f=a("../util/preconditions"),g=b.exports;g.sha1=function(a){return f.checkArgument(e.isBuffer(a)),d.createHash("sha1").update(a).digest()},g.sha1.blocksize=512,g.sha256=function(a){return f.checkArgument(e.isBuffer(a)),d.createHash("sha256").update(a).digest()},g.sha256.blocksize=512,g.sha256sha256=function(a){return f.checkArgument(e.isBuffer(a)),g.sha256(g.sha256(a))},g.ripemd160=function(a){return f.checkArgument(e.isBuffer(a)),d.createHash("ripemd160").update(a).digest()},g.sha256ripemd160=function(a){return f.checkArgument(e.isBuffer(a)),g.ripemd160(g.sha256(a))},g.sha512=function(a){return f.checkArgument(e.isBuffer(a)),d.createHash("sha512").update(a).digest()},g.sha512.blocksize=1024,g.hmac=function(a,b,d){f.checkArgument(e.isBuffer(b)),f.checkArgument(e.isBuffer(d)),f.checkArgument(a.blocksize);var g=a.blocksize/8;if(d.length>g)d=a(d);else if(g>d){var h=new c(g);h.fill(0),d.copy(h),d=h}var i=new c(g);i.fill(92);var j=new c(g);j.fill(54);for(var k=new c(g),l=new c(g),m=0;g>m;m++)k[m]=i[m]^d[m],l[m]=j[m]^d[m];return a(c.concat([k,a(c.concat([l,b]))]))},g.sha256hmac=function(a,b){return g.hmac(g.sha256,a,b)},g.sha512hmac=function(a,b){return g.hmac(g.sha512,a,b)}}).call(this,a("buffer").Buffer)},{"../util/buffer":81,"../util/preconditions":84,buffer:187,crypto:200}],47:[function(a,b,c){(function(c){"use strict";var d=a("./bn"),e=a("../util/buffer"),f=a("elliptic").ec,g=new f("secp256k1"),h=g.curve.point.bind(g.curve),i=g.curve.pointFromX.bind(g.curve),j=function(a,b,c){try{var d=h(a,b,c)}catch(e){throw new Error("Invalid Point")}return d.validate(),d};j.prototype=Object.getPrototypeOf(g.curve.point()),j.fromX=function(a,b){try{var c=i(b,a)}catch(d){throw new Error("Invalid X")}return c.validate(),c},j.getG=function(){return g.curve.g},j.getN=function(){return new d(g.curve.n.toArray())},j.prototype._getX||(j.prototype._getX=j.prototype.getX),j.prototype.getX=function(){return new d(this._getX().toArray())},j.prototype._getY||(j.prototype._getY=j.prototype.getY),j.prototype.getY=function(){return new d(this._getY().toArray())},j.prototype.validate=function(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");var a;try{a=i(this.getX(),this.getY().isOdd())}catch(b){throw new Error("Point does not lie on the curve")}if(0!==a.y.cmp(this.y))throw new Error("Invalid y value for curve.");if(!this.mul(j.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},j.pointToCompressed=function(a){var b,d=a.getX().toBuffer({size:32}),f=a.getY().toBuffer({size:32}),g=f[f.length-1]%2;return b=new c(g?[3]:[2]),e.concat([b,d])},b.exports=j}).call(this,a("buffer").Buffer)},{"../util/buffer":81,"./bn":44,buffer:187,elliptic:216}],48:[function(a,b,c){(function(c,d){"use strict";function e(){}e.getRandomBuffer=function(a){return c.browser?e.getRandomBufferBrowser(a):e.getRandomBufferNode(a)},e.getRandomBufferNode=function(b){var c=a("crypto");return c.randomBytes(b)},e.getRandomBufferBrowser=function(a){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var b=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var b=window.msCrypto}var c=new Uint8Array(a);b.getRandomValues(c);var e=new d(c);return e},e.getPseudoRandomBuffer=function(a){for(var b,c=4294967296,e=new d(a),f=0;a>=f;f++){var g=Math.floor(f/4),h=f-4*g;0===h?(b=Math.random()*c,e[f]=255&b):e[f]=255&(b>>>=8)}return e},b.exports=e}).call(this,a("_process"),a("buffer").Buffer)},{_process:282,buffer:187,crypto:200}],49:[function(a,b,c){(function(c){"use strict";var d=a("./bn"),e=a("lodash"),f=a("../util/preconditions"),g=a("../util/buffer"),h=a("../util/js"),i=function j(a,b){if(!(this instanceof j))return new j(a,b);if(a instanceof d)this.set({r:a,s:b});else if(a){var c=a;this.set(c)}};i.prototype.set=function(a){return this.r=a.r||this.r||void 0,this.s=a.s||this.s||void 0,this.i="undefined"!=typeof a.i?a.i:this.i,this.compressed="undefined"!=typeof a.compressed?a.compressed:this.compressed,this.nhashtype=a.nhashtype||this.nhashtype||void 0,this},i.fromCompact=function(a){f.checkArgument(g.isBuffer(a),"Argument is expected to be a Buffer");var b=new i,c=!0,e=a.slice(0,1)[0]-27-4;0>e&&(c=!1,e+=4);var h=a.slice(1,33),j=a.slice(33,65);return f.checkArgument(0===e||1===e||2===e||3===e,new Error("i must be 0, 1, 2, or 3")),f.checkArgument(32===h.length,new Error("r must be 32 bytes")),f.checkArgument(32===j.length,new Error("s must be 32 bytes")),b.compressed=c,b.i=e,b.r=d.fromBuffer(h),b.s=d.fromBuffer(j),b},i.fromDER=i.fromBuffer=function(a,b){var c=i.parseDER(a,b),d=new i;return d.r=c.r,d.s=c.s,d},i.fromTxFormat=function(a){var b=a.readUInt8(a.length-1),c=a.slice(0,a.length-1),d=new i.fromDER(c,!1);return d.nhashtype=b,d},i.fromString=function(a){var b=new c(a,"hex");return i.fromDER(b)},i.parseDER=function(a,b){f.checkArgument(g.isBuffer(a),new Error("DER formatted signature should be a buffer")),e.isUndefined(b)&&(b=!0);var c=a[0];f.checkArgument(48===c,new Error("Header byte should be 0x30"));var h=a[1],i=a.slice(2).length;f.checkArgument(!b||h===i,new Error("Length byte should length of what follows")),h=i>h?h:i;var j=a[2];f.checkArgument(2===j,new Error("Integer byte for r should be 0x02"));var k=a[3],l=a.slice(4,4+k),m=d.fromBuffer(l),n=0===a[4]?!0:!1;f.checkArgument(k===l.length,new Error("Length of r incorrect"));var o=a[4+k+0];f.checkArgument(2===o,new Error("Integer byte for s should be 0x02"));var p=a[4+k+1],q=a.slice(4+k+2,4+k+2+p),r=d.fromBuffer(q),s=0===a[4+k+2+2]?!0:!1;f.checkArgument(p===q.length,new Error("Length of s incorrect"));var t=4+k+2+p;f.checkArgument(h===t-2,new Error("Length of signature incorrect"));var u={header:c,length:h,rheader:j,rlength:k,rneg:n,rbuf:l,r:m,sheader:o,slength:p,sneg:s,sbuf:q,s:r};return u},i.prototype.toCompact=function(a,b){if(a="number"==typeof a?a:this.i,b="boolean"==typeof b?b:this.compressed,0!==a&&1!==a&&2!==a&&3!==a)throw new Error("i must be equal to 0, 1, 2, or 3");var d=a+27+4;b===!1&&(d-=4);var e=new c([d]),f=this.r.toBuffer({size:32}),g=this.s.toBuffer({size:32});return c.concat([e,f,g])},i.prototype.toBuffer=i.prototype.toDER=function(){var a=this.r.toBuffer(),b=this.s.toBuffer(),d=128&a[0]?!0:!1,e=128&b[0]?!0:!1,f=d?c.concat([new c([0]),a]):a,g=e?c.concat([new c([0]),b]):b,h=f.length,i=g.length,j=2+h+2+i,k=2,l=2,m=48,n=c.concat([new c([m,j,k,h]),f,new c([l,i]),g]);return n},i.prototype.toString=function(){var a=this.toDER();return a.toString("hex")},i.isTxDER=function(a){if(a.length<9)return!1;if(a.length>73)return!1;if(48!==a[0])return!1;if(a[1]!==a.length-3)return!1;var b=a[3];if(5+b>=a.length)return!1;var c=a[5+b];if(b+c+7!==a.length)return!1;var d=a.slice(4);if(2!==a[2])return!1;if(0===b)return!1;if(128&d[0])return!1;if(b>1&&0===d[0]&&!(128&d[1]))return!1;var e=a.slice(6+b);return 2!==a[6+b-2]?!1:0===c?!1:128&e[0]?!1:c>1&&0===e[0]&&!(128&e[1])?!1:!0},i.prototype.hasLowS=function(){return this.s.lt(new d(1))||this.s.gt(new d("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))?!1:!0},i.prototype.hasDefinedHashtype=function(){if(!h.isNaturalNumber(this.nhashtype))return!1;var a=this.nhashtype&~i.SIGHASH_ANYONECANPAY;return ai.SIGHASH_SINGLE?!1:!0},i.prototype.toTxFormat=function(){var a=this.toDER(),b=new c(1);return b.writeUInt8(this.nhashtype,0),c.concat([a,b])},i.SIGHASH_ALL=1,i.SIGHASH_NONE=2,i.SIGHASH_SINGLE=3,i.SIGHASH_FORKID=64,i.SIGHASH_ANYONECANPAY=128,b.exports=i}).call(this,a("buffer").Buffer)},{"../util/buffer":81,"../util/js":83,"../util/preconditions":84,"./bn":44,buffer:187,lodash:87}],50:[function(a,b,c){(function(c){"use strict";var d=a("lodash"),e=a("bs58"),f=a("buffer"),g="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),h=function i(a){if(!(this instanceof i))return new i(a);if(c.isBuffer(a)){var b=a;this.fromBuffer(b)}else if("string"==typeof a){var d=a;this.fromString(d)}else a&&this.set(a)};h.validCharacters=function(a){return f.Buffer.isBuffer(a)&&(a=a.toString()),d.every(d.map(a,function(a){return d.includes(g,a)}))},h.prototype.set=function(a){return this.buf=a.buf||this.buf||void 0,this},h.encode=function(a){if(!f.Buffer.isBuffer(a))throw new Error("Input should be a buffer");return e.encode(a)},h.decode=function(a){if("string"!=typeof a)throw new Error("Input should be a string");return new c(e.decode(a))},h.prototype.fromBuffer=function(a){return this.buf=a,this},h.prototype.fromString=function(a){var b=h.decode(a);return this.buf=b,this},h.prototype.toBuffer=function(){return this.buf},h.prototype.toString=function(){return h.encode(this.buf)},b.exports=h}).call(this,a("buffer").Buffer)},{bs58:85,buffer:187,lodash:87}],51:[function(a,b,c){(function(c){"use strict";var d=a("lodash"),e=a("./base58"),f=a("buffer"),g=a("../crypto/hash").sha256sha256,h=function i(a){if(!(this instanceof i))return new i(a);if(c.isBuffer(a)){var b=a;this.fromBuffer(b)}else if("string"==typeof a){var d=a;this.fromString(d)}else a&&this.set(a)};h.prototype.set=function(a){return this.buf=a.buf||this.buf||void 0,this},h.validChecksum=function(a,b){return d.isString(a)&&(a=new f.Buffer(e.decode(a))),d.isString(b)&&(b=new f.Buffer(e.decode(b))),b||(b=a.slice(-4),a=a.slice(0,-4)),h.checksum(a).toString("hex")===b.toString("hex")},h.decode=function(a){if("string"!=typeof a)throw new Error("Input must be a string");var b=new c(e.decode(a));if(b.length<4)throw new Error("Input string too short");var d=b.slice(0,-4),f=b.slice(-4),h=g(d),i=h.slice(0,4);if(f.toString("hex")!==i.toString("hex"))throw new Error("Checksum mismatch");return d},h.checksum=function(a){return g(a).slice(0,4)},h.encode=function(a){if(!c.isBuffer(a))throw new Error("Input must be a buffer");var b=new c(a.length+4),d=h.checksum(a);return a.copy(b),d.copy(b,a.length),e.encode(b)},h.prototype.fromBuffer=function(a){return this.buf=a,this},h.prototype.fromString=function(a){var b=h.decode(a);return this.buf=b,this},h.prototype.toBuffer=function(){return this.buf},h.prototype.toString=function(){return h.encode(this.buf)},b.exports=h}).call(this,a("buffer").Buffer)},{"../crypto/hash":46,"./base58":50,buffer:187,lodash:87}],52:[function(a,b,c){(function(c){"use strict";var d=a("lodash"),e=a("../util/preconditions"),f=a("../util/buffer"),g=a("../crypto/bn"),h=function i(a){if(!(this instanceof i))return new i(a);if(!d.isUndefined(a))if(c.isBuffer(a))this.set({buf:a});else if(d.isString(a)){var b=new c(a,"hex");if(2*b.length!=a.length)throw new TypeError("Invalid hex string");this.set({buf:b})}else{if(!d.isObject(a))throw new TypeError("Unrecognized argument for BufferReader");var e=a;this.set(e)}};h.prototype.set=function(a){return this.buf=a.buf||this.buf||void 0,this.pos=a.pos||this.pos||0,this},h.prototype.eof=function(){return this.pos>=this.buf.length},h.prototype.finished=h.prototype.eof,h.prototype.read=function(a){e.checkArgument(!d.isUndefined(a),"Must specify a length");var b=this.buf.slice(this.pos,this.pos+a);return this.pos=this.pos+a,b},h.prototype.readAll=function(){var a=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,a},h.prototype.readUInt8=function(){var a=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,a},h.prototype.readUInt16BE=function(){var a=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,a},h.prototype.readUInt16LE=function(){var a=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,a},h.prototype.readUInt32BE=function(){var a=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,a},h.prototype.readUInt32LE=function(){var a=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,a},h.prototype.readInt32LE=function(){var a=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,a},h.prototype.readUInt64BEBN=function(){var a=this.buf.slice(this.pos,this.pos+8),b=g.fromBuffer(a);return this.pos=this.pos+8,b},h.prototype.readUInt64LEBN=function(){var a,b=this.buf.readUInt32LE(this.pos),c=this.buf.readUInt32LE(this.pos+4),d=4294967296*c+b;if(9007199254740991>=d)a=new g(d);else{var e=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);a=new g(e,10,"le")}return this.pos=this.pos+8,a},h.prototype.readVarintNum=function(){var a=this.readUInt8();switch(a){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var b=this.readUInt64LEBN(),c=b.toNumber();if(c<=Math.pow(2,53))return c;throw new Error("number too large to retain precision - use readVarintBN");default:return a}},h.prototype.readVarLengthBuffer=function(){var a=this.readVarintNum(),b=this.read(a);return e.checkState(b.length===a,"Invalid length while reading varlength buffer. Expected to read: "+a+" and read "+b.length),b},h.prototype.readVarintBuf=function(){var a=this.buf.readUInt8(this.pos);switch(a){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},h.prototype.readVarintBN=function(){var a=this.readUInt8();switch(a){case 253:return new g(this.readUInt16LE());case 254:return new g(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new g(a)}},h.prototype.reverse=function(){for(var a=new c(this.buf.length),b=0;ba?(b=new c(1),b.writeUInt8(a,0)):65536>a?(b=new c(3),b.writeUInt8(253,0),b.writeUInt16LE(a,1)):4294967296>a?(b=new c(5),b.writeUInt8(254,0),b.writeUInt32LE(a,1)):(b=new c(9),b.writeUInt8(255,0),b.writeInt32LE(-1&a,1),b.writeUInt32LE(Math.floor(a/4294967296),5)),b},f.varintBufBN=function(a){var b=void 0,d=a.toNumber();if(253>d)b=new c(1),b.writeUInt8(d,0);else if(65536>d)b=new c(3),b.writeUInt8(253,0),b.writeUInt16LE(d,1);else if(4294967296>d)b=new c(5),b.writeUInt8(254,0),b.writeUInt32LE(d,1);else{var e=new f;e.writeUInt8(255),e.writeUInt64LEBN(a);var b=e.concat()}return b},b.exports=f}).call(this,a("buffer").Buffer)},{"../util/buffer":81,assert:29,buffer:187}],54:[function(a,b,c){(function(c){"use strict";var d=a("./bufferwriter"),e=a("./bufferreader"),f=a("../crypto/bn"),g=function h(a){if(!(this instanceof h))return new h(a);if(c.isBuffer(a))this.buf=a;else if("number"==typeof a){var b=a;this.fromNumber(b)}else if(a instanceof f){var d=a;this.fromBN(d)}else if(a){var e=a;this.set(e)}};g.prototype.set=function(a){return this.buf=a.buf||this.buf,this},g.prototype.fromString=function(a){return this.set({buf:new c(a,"hex")}),this},g.prototype.toString=function(){return this.buf.toString("hex")},g.prototype.fromBuffer=function(a){return this.buf=a,this},g.prototype.fromBufferReader=function(a){return this.buf=a.readVarintBuf(),this},g.prototype.fromBN=function(a){return this.buf=d().writeVarintBN(a).concat(),this},g.prototype.fromNumber=function(a){return this.buf=d().writeVarintNum(a).concat(),this},g.prototype.toBuffer=function(){return this.buf},g.prototype.toBN=function(){return e(this.buf).readVarintBN()},g.prototype.toNumber=function(){return e(this.buf).readVarintNum()},b.exports=g}).call(this,a("buffer").Buffer)},{"../crypto/bn":44,"./bufferreader":52,"./bufferwriter":53,buffer:187}],55:[function(a,b,c){"use strict";function d(a,b){return a.replace("{0}",b[0]).replace("{1}",b[1]).replace("{2}",b[2])}var e=a("lodash"),f=function(a,b){var c=function(){if(e.isString(b.message))this.message=d(b.message,arguments);else{if(!e.isFunction(b.message))throw new Error("Invalid error definition for "+b.name);this.message=b.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return c.prototype=Object.create(a.prototype),c.prototype.name=a.prototype.name+b.name,a[b.name]=c,b.errors&&g(c,b.errors),c},g=function(a,b){e.each(b,function(b){f(a,b)})},h=function(a,b){return g(a,b),a},i={};i.Error=function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack},i.Error.prototype=Object.create(Error.prototype),i.Error.prototype.name="bitcore.Error";var j=a("./spec");h(i.Error,j),b.exports=i.Error,b.exports.extend=function(a){return f(i.Error,a)}},{"./spec":56,lodash:87}],56:[function(a,b,c){"use strict";var d="http://bitcore.io/";b.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+d+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"MerkleBlock",message:"Internal Error on MerkleBlock {0}",errors:[{name:"InvalidMerkleTree",message:"This MerkleBlock contain an invalid Merkle Tree"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]},{}],57:[function(a,b,c){(function(c){"use strict";function d(a){if(a instanceof d)return a;if(!(this instanceof d))return new d(a);if(!a)return this._generateRandomly();if(m.get(a))return this._generateRandomly(a);if(g.isString(a)||s.isBuffer(a))if(d.isValidSerialized(a))this._buildFromSerialized(a);else if(t.isValidJSON(a))this._buildFromJSON(a);else{if(!s.isBuffer(a)||!d.isValidSerialized(a.toString()))throw d.getSerializedError(a);this._buildFromSerialized(a.toString())}else{if(!g.isObject(a))throw new r.UnrecognizedArgument(a);this._buildFromObject(a)}}var e=a("assert"),f=a("buffer"),g=a("lodash"),h=a("./util/preconditions"),i=a("./crypto/bn"),j=a("./encoding/base58"),k=a("./encoding/base58check"),l=a("./crypto/hash"),m=a("./networks"),n=a("./crypto/point"),o=a("./privatekey"),p=a("./crypto/random"),q=a("./errors"),r=q.HDPrivateKey,s=a("./util/buffer"),t=a("./util/js"),u=128,v=1/8,w=512; d.isValidPath=function(a,b){if(g.isString(a)){var c=d._getDerivationIndexes(a);return null!==c&&g.every(c,d.isValidPath)}return g.isNumber(a)?(a=0&&a=d.Hardened?!0:b,aw*v)throw new r.InvalidEntropyArgument.TooMuchEntropy(a);var e=l.sha512hmac(a,new f.Buffer("Bitcoin seed"));return new d({network:m.get(b)||m.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:e.slice(0,32),chainCode:e.slice(32,64)})},d.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var b=a("./hdpublickey");this._hdPublicKey=new b(this)}},d.prototype._buildFromBuffers=function(a){d._validateBufferArguments(a),t.defineImmutable(this,{_buffers:a});var b=[a.version,a.depth,a.parentFingerPrint,a.childIndex,a.chainCode,s.emptyBuffer(1),a.privateKey],e=f.Buffer.concat(b);if(a.checksum&&a.checksum.length){if(a.checksum.toString()!==k.checksum(e).toString())throw new q.InvalidB58Checksum(e)}else a.checksum=k.checksum(e);var g,h=m.get(s.integerFromBuffer(a.version));g=k.encode(f.Buffer.concat(b)),a.xprivkey=new c(g);var j=new o(i.fromBuffer(a.privateKey),h),n=j.toPublicKey(),p=d.ParentFingerPrintSize,r=l.sha256ripemd160(n.toBuffer()).slice(0,p);return t.defineImmutable(this,{xprivkey:g,network:h,depth:s.integerFromSingleByteBuffer(a.depth),privateKey:j,publicKey:n,fingerPrint:r}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},d._validateBufferArguments=function(a){var b=function(b,c){var d=a[b];e(s.isBuffer(d),b+" argument is not a buffer"),e(d.length===c,b+" has not the expected size: found "+d.length+", expected "+c)};b("version",d.VersionSize),b("depth",d.DepthSize),b("parentFingerPrint",d.ParentFingerPrintSize),b("childIndex",d.ChildIndexSize),b("chainCode",d.ChainCodeSize),b("privateKey",d.PrivateKeySize),a.checksum&&a.checksum.length&&b("checksum",d.CheckSumSize)},d.prototype.toString=function(){return this.xprivkey},d.prototype.inspect=function(){return""},d.prototype.toObject=d.prototype.toJSON=function(){return{network:m.get(s.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:s.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:s.integerFromBuffer(this.fingerPrint),parentFingerPrint:s.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:s.integerFromBuffer(this._buffers.childIndex),chainCode:s.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:s.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},d.fromBuffer=function(a){return new d(a.toString())},d.prototype.toBuffer=function(){return s.copy(this._buffers.xprivkey)},d.DefaultDepth=0,d.DefaultFingerprint=0,d.DefaultChildIndex=0,d.Hardened=2147483648,d.MaxIndex=2*d.Hardened,d.RootElementAlias=["m","M","m'","M'"],d.VersionSize=4,d.DepthSize=1,d.ParentFingerPrintSize=4,d.ChildIndexSize=4,d.ChainCodeSize=32,d.PrivateKeySize=32,d.CheckSumSize=4,d.DataLength=78,d.SerializedByteSize=82,d.VersionStart=0,d.VersionEnd=d.VersionStart+d.VersionSize,d.DepthStart=d.VersionEnd,d.DepthEnd=d.DepthStart+d.DepthSize,d.ParentFingerPrintStart=d.DepthEnd,d.ParentFingerPrintEnd=d.ParentFingerPrintStart+d.ParentFingerPrintSize,d.ChildIndexStart=d.ParentFingerPrintEnd,d.ChildIndexEnd=d.ChildIndexStart+d.ChildIndexSize,d.ChainCodeStart=d.ChildIndexEnd,d.ChainCodeEnd=d.ChainCodeStart+d.ChainCodeSize,d.PrivateKeyStart=d.ChainCodeEnd+1,d.PrivateKeyEnd=d.PrivateKeyStart+d.PrivateKeySize,d.ChecksumStart=d.PrivateKeyEnd,d.ChecksumEnd=d.ChecksumStart+d.CheckSumSize,e(d.ChecksumEnd===d.SerializedByteSize),b.exports=d}).call(this,a("buffer").Buffer)},{"./crypto/bn":44,"./crypto/hash":46,"./crypto/point":47,"./crypto/random":48,"./encoding/base58":50,"./encoding/base58check":51,"./errors":55,"./hdpublickey":58,"./networks":59,"./privatekey":61,"./util/buffer":81,"./util/js":83,"./util/preconditions":84,assert:29,buffer:187,lodash:87}],58:[function(a,b,c){(function(c){"use strict";function d(a){if(a instanceof d)return a;if(!(this instanceof d))return new d(a);if(a){if(e.isString(a)||t.isBuffer(a)){var b=d.getSerializedError(a);if(b){if(t.isBuffer(a)&&!d.getSerializedError(a.toString()))return this._buildFromSerialized(a.toString());if(b instanceof q.ArgumentIsPrivateExtended)return new k(a).hdPublicKey;throw b}return this._buildFromSerialized(a)}if(e.isObject(a))return a instanceof k?this._buildFromPrivate(a):this._buildFromObject(a);throw new q.UnrecognizedArgument(a)}throw new q.MustSupplyArgument}var e=a("lodash"),f=a("./util/preconditions"),g=a("./crypto/bn"),h=a("./encoding/base58"),i=a("./encoding/base58check"),j=a("./crypto/hash"),k=a("./hdprivatekey"),l=a("./networks"),m=a("./crypto/point"),n=a("./publickey"),o=a("./errors"),p=o,q=o.HDPublicKey,r=a("assert"),s=a("./util/js"),t=a("./util/buffer");d.isValidPath=function(a){if(e.isString(a)){var b=k._getDerivationIndexes(a);return null!==b&&e.every(b,d.isValidPath)}return e.isNumber(a)?a>=0&&a=d.Hardened||b)throw new q.InvalidIndexCantDeriveHardened;if(0>a)throw new q.InvalidPath(a);var c,e=t.integerAsBuffer(a),f=t.concat([this.publicKey.toBuffer(),e]),h=j.sha512hmac(f,this._buffers.chainCode),i=g.fromBuffer(h.slice(0,32),{size:32}),k=h.slice(32,64);try{c=n.fromPoint(m.getG().mul(i).add(this.publicKey.point))}catch(l){return this._deriveWithNumber(a+1)}var o=new d({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:a,chainCode:k,publicKey:c});return o},d.prototype._deriveFromString=function(a){if(e.includes(a,"'"))throw new q.InvalidIndexCantDeriveHardened;if(!d.isValidPath(a))throw new q.InvalidPath(a);var b=k._getDerivationIndexes(a),c=b.reduce(function(a,b){return a._deriveWithNumber(b)},this);return c},d.isValidSerialized=function(a,b){return e.isNull(d.getSerializedError(a,b))},d.getSerializedError=function(a,b){if(!e.isString(a)&&!t.isBuffer(a))return new q.UnrecognizedArgument("expected buffer or string");if(!h.validCharacters(a))return new p.InvalidB58Char("(unknown)",a);try{a=i.decode(a)}catch(c){return new p.InvalidB58Checksum(a)}if(a.length!==d.DataSize)return new q.InvalidLength(a);if(!e.isUndefined(b)){var f=d._validateNetwork(a,b);if(f)return f}var g=t.integerFromBuffer(a.slice(0,4));return g===l.livenet.xprivkey||g===l.testnet.xprivkey?new q.ArgumentIsPrivateExtended:null},d._validateNetwork=function(a,b){var c=l.get(b);if(!c)return new p.InvalidNetworkArgument(b);var e=a.slice(d.VersionStart,d.VersionEnd);return t.integerFromBuffer(e)!==c.xpubkey?new p.InvalidNetwork(e):null},d.prototype._buildFromPrivate=function(a){var b=e.clone(a._buffers),c=m.getG().mul(g.fromBuffer(b.privateKey));return b.publicKey=m.pointToCompressed(c),b.version=t.integerAsBuffer(l.get(t.integerFromBuffer(b.version)).xpubkey),b.privateKey=void 0,b.checksum=void 0,b.xprivkey=void 0,this._buildFromBuffers(b)},d.prototype._buildFromObject=function(a){var b={version:a.network?t.integerAsBuffer(l.get(a.network).xpubkey):a.version,depth:e.isNumber(a.depth)?t.integerAsSingleByteBuffer(a.depth):a.depth,parentFingerPrint:e.isNumber(a.parentFingerPrint)?t.integerAsBuffer(a.parentFingerPrint):a.parentFingerPrint,childIndex:e.isNumber(a.childIndex)?t.integerAsBuffer(a.childIndex):a.childIndex,chainCode:e.isString(a.chainCode)?t.hexToBuffer(a.chainCode):a.chainCode,publicKey:e.isString(a.publicKey)?t.hexToBuffer(a.publicKey):t.isBuffer(a.publicKey)?a.publicKey:a.publicKey.toBuffer(),checksum:e.isNumber(a.checksum)?t.integerAsBuffer(a.checksum):a.checksum};return this._buildFromBuffers(b)},d.prototype._buildFromSerialized=function(a){var b=i.decode(a),c={version:b.slice(d.VersionStart,d.VersionEnd),depth:b.slice(d.DepthStart,d.DepthEnd),parentFingerPrint:b.slice(d.ParentFingerPrintStart,d.ParentFingerPrintEnd),childIndex:b.slice(d.ChildIndexStart,d.ChildIndexEnd),chainCode:b.slice(d.ChainCodeStart,d.ChainCodeEnd),publicKey:b.slice(d.PublicKeyStart,d.PublicKeyEnd),checksum:b.slice(d.ChecksumStart,d.ChecksumEnd),xpubkey:a};return this._buildFromBuffers(c)},d.prototype._buildFromBuffers=function(a){d._validateBufferArguments(a),s.defineImmutable(this,{_buffers:a});var b=[a.version,a.depth,a.parentFingerPrint,a.childIndex,a.chainCode,a.publicKey],e=t.concat(b),f=i.checksum(e);if(a.checksum&&a.checksum.length){if(a.checksum.toString("hex")!==f.toString("hex"))throw new p.InvalidB58Checksum(e,f)}else a.checksum=f;var g,h=l.get(t.integerFromBuffer(a.version));g=i.encode(t.concat(b)),a.xpubkey=new c(g);var k=new n(a.publicKey,{network:h}),m=d.ParentFingerPrintSize,o=j.sha256ripemd160(k.toBuffer()).slice(0,m);return s.defineImmutable(this,{xpubkey:g,network:h,depth:t.integerFromSingleByteBuffer(a.depth),publicKey:k,fingerPrint:o}),this},d._validateBufferArguments=function(a){var b=function(b,c){var d=a[b];r(t.isBuffer(d),b+" argument is not a buffer, it's "+typeof d),r(d.length===c,b+" has not the expected size: found "+d.length+", expected "+c)};b("version",d.VersionSize),b("depth",d.DepthSize),b("parentFingerPrint",d.ParentFingerPrintSize),b("childIndex",d.ChildIndexSize),b("chainCode",d.ChainCodeSize),b("publicKey",d.PublicKeySize),a.checksum&&a.checksum.length&&b("checksum",d.CheckSumSize)},d.fromString=function(a){return f.checkArgument(e.isString(a),"No valid string was provided"),new d(a)},d.fromObject=function(a){return f.checkArgument(e.isObject(a),"No valid argument was provided"),new d(a)},d.prototype.toString=function(){return this.xpubkey},d.prototype.inspect=function(){return""},d.prototype.toObject=d.prototype.toJSON=function(){return{network:l.get(t.integerFromBuffer(this._buffers.version)).name,depth:t.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:t.integerFromBuffer(this.fingerPrint),parentFingerPrint:t.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:t.integerFromBuffer(this._buffers.childIndex),chainCode:t.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:t.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},d.fromBuffer=function(a){return new d(a)},d.prototype.toBuffer=function(){return t.copy(this._buffers.xpubkey)},d.Hardened=2147483648,d.RootElementAlias=["m","M"],d.VersionSize=4,d.DepthSize=1,d.ParentFingerPrintSize=4,d.ChildIndexSize=4,d.ChainCodeSize=32,d.PublicKeySize=33,d.CheckSumSize=4,d.DataSize=78,d.SerializedByteSize=82,d.VersionStart=0,d.VersionEnd=d.VersionStart+d.VersionSize,d.DepthStart=d.VersionEnd,d.DepthEnd=d.DepthStart+d.DepthSize,d.ParentFingerPrintStart=d.DepthEnd,d.ParentFingerPrintEnd=d.ParentFingerPrintStart+d.ParentFingerPrintSize,d.ChildIndexStart=d.ParentFingerPrintEnd,d.ChildIndexEnd=d.ChildIndexStart+d.ChildIndexSize,d.ChainCodeStart=d.ChildIndexEnd,d.ChainCodeEnd=d.ChainCodeStart+d.ChainCodeSize,d.PublicKeyStart=d.ChainCodeEnd,d.PublicKeyEnd=d.PublicKeyStart+d.PublicKeySize,d.ChecksumStart=d.PublicKeyEnd,d.ChecksumEnd=d.ChecksumStart+d.CheckSumSize,r(d.PublicKeyEnd===d.DataSize),r(d.ChecksumEnd===d.SerializedByteSize),b.exports=d}).call(this,a("buffer").Buffer)},{"./crypto/bn":44,"./crypto/hash":46,"./crypto/point":47,"./encoding/base58":50,"./encoding/base58check":51,"./errors":55,"./hdprivatekey":57,"./networks":59,"./publickey":62,"./util/buffer":81,"./util/js":83,"./util/preconditions":84,assert:29,buffer:187,lodash:87}],59:[function(a,b,c){"use strict";function d(){}function e(a,b){if(~p.indexOf(a))return a;if(b){m.isArray(b)||(b=[b]);for(var c=0;c=0&&16>=a,"Invalid Argument: n must be between 0 and 16"),0===a?d("OP_0"):new d(d.map.OP_1+a-1)},d.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},d.reverseMap=[];for(var i in d.map)d.reverseMap[d.map[i]]=i;e.extend(d,d.map),d.isSmallIntOp=function(a){return a instanceof d&&(a=a.toNumber()),a===d.map.OP_0||a>=d.map.OP_1&&a<=d.map.OP_16},d.prototype.inspect=function(){return""},b.exports=d}).call(this,a("buffer").Buffer)},{"./util/buffer":81,"./util/js":83,"./util/preconditions":84,buffer:187,lodash:87}],61:[function(a,b,c){(function(c){"use strict";function d(a,b){if(!(this instanceof d))return new d(a,b);if(a instanceof d)return a;var c=this._classifyArguments(a,b);if(!c.bn||0===c.bn.cmp(new h(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!c.bn.lt(k.getN()))throw new TypeError("Number must be less than N");if("undefined"==typeof c.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return i.defineImmutable(this,{bn:c.bn,compressed:c.compressed,network:c.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}var e=a("lodash"),f=a("./address"),g=a("./encoding/base58check"),h=a("./crypto/bn"),i=a("./util/js"),j=a("./networks"),k=a("./crypto/point"),l=a("./publickey"),m=a("./crypto/random"),n=a("./util/preconditions");d.prototype._classifyArguments=function(a,b){var f={compressed:!0,network:b?j.get(b):j.defaultNetwork};if(e.isUndefined(a)||e.isNull(a))f.bn=d._getRandomBN();else if(a instanceof h)f.bn=a;else if(a instanceof c||a instanceof Uint8Array)f=d._transformBuffer(a,b);else if(a.bn&&a.network)f=d._transformObject(a);else if(!b&&j.get(a))f.bn=d._getRandomBN(),f.network=j.get(a);else{if("string"!=typeof a)throw new TypeError("First argument is an unrecognized data type.");i.isHexa(a)?f.bn=new h(new c(a,"hex")):f=d._transformWIF(a,b)}return f},d._getRandomBN=function(){var a,b;do{var c=m.getRandomBuffer(32);b=h.fromBuffer(c),a=b.lt(k.getN())}while(!a);return b},d._transformBuffer=function(a,b){var c={};if(32===a.length)return d._transformBNBuffer(a,b);if(c.network=j.get(a[0],"privatekey"),!c.network)throw new Error("Invalid network");if(b&&c.network!==j.get(b))throw new TypeError("Private key network mismatch");if(34===a.length&&1===a[33])c.compressed=!0;else{if(33!==a.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");c.compressed=!1}return c.bn=h.fromBuffer(a.slice(1,33)),c},d._transformBNBuffer=function(a,b){var c={};return c.network=j.get(b)||j.defaultNetwork,c.bn=h.fromBuffer(a),c.compressed=!1,c},d._transformWIF=function(a,b){return d._transformBuffer(g.decode(a),b)},d.fromBuffer=function(a,b){return new d(a,b)},d._transformObject=function(a){var b=new h(a.bn,"hex"),c=j.get(a.network);return{bn:b,network:c,compressed:a.compressed}},d.fromString=d.fromWIF=function(a){return n.checkArgument(e.isString(a),"First argument is expected to be a string."),new d(a)},d.fromObject=function(a){return n.checkArgument(e.isObject(a),"First argument is expected to be an object."),new d(a)},d.fromRandom=function(a){var b=d._getRandomBN();return new d(b,a)},d.getValidationError=function(a,b){var c;try{new d(a,b)}catch(e){c=e}return c},d.isValid=function(a,b){return a?!d.getValidationError(a,b):!1},d.prototype.toString=function(){return this.toBuffer().toString("hex")},d.prototype.toWIF=function(){var a,b=this.network,d=this.compressed;return a=d?c.concat([new c([b.privatekey]),this.bn.toBuffer({size:32}),new c([1])]):c.concat([new c([b.privatekey]),this.bn.toBuffer({size:32})]),g.encode(a)},d.prototype.toBigNumber=function(){return this.bn},d.prototype.toBuffer=function(){return this.bn.toBuffer()},d.prototype.toBufferNoPadding=function(){return this.bn.toBuffer()},d.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=l.fromPrivateKey(this)),this._pubkey},d.prototype.toAddress=function(a){var b=this.toPublicKey();return f.fromPublicKey(b,a||this.network)},d.prototype.toObject=d.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},d.prototype.inspect=function(){var a=this.compressed?"":", uncompressed";return""},b.exports=d}).call(this,a("buffer").Buffer)},{"./address":39,"./crypto/bn":44,"./crypto/point":47,"./crypto/random":48,"./encoding/base58check":51,"./networks":59,"./publickey":62,"./util/js":83,"./util/preconditions":84,buffer:187,lodash:87}],62:[function(a,b,c){(function(c){"use strict";function d(a,b){if(!(this instanceof d))return new d(a,b);if(k.checkArgument(a,"First argument is required, please include public key data."),a instanceof d)return a;b=b||{};var c=this._classifyArgs(a,b);return c.point.validate(),h.defineImmutable(this,{point:c.point,compressed:c.compressed,network:c.network||i.defaultNetwork}),this}var e=a("./crypto/bn"),f=a("./crypto/point"),g=a("./crypto/hash"),h=a("./util/js"),i=a("./networks"),j=a("lodash"),k=a("./util/preconditions");d.prototype._classifyArgs=function(a,b){var e={compressed:j.isUndefined(b.compressed)||b.compressed};if(a instanceof f)e.point=a;else if(a.x&&a.y)e=d._transformObject(a);else if("string"==typeof a)e=d._transformDER(new c(a,"hex"));else if(d._isBuffer(a))e=d._transformDER(a);else{if(!d._isPrivateKey(a))throw new TypeError("First argument is an unrecognized data format.");e=d._transformPrivateKey(a)}return e.network||(e.network=j.isUndefined(b.network)?void 0:i.get(b.network)),e},d._isPrivateKey=function(b){var c=a("./privatekey");return b instanceof c},d._isBuffer=function(a){return a instanceof c||a instanceof Uint8Array},d._transformPrivateKey=function(a){k.checkArgument(d._isPrivateKey(a),"Must be an instance of PrivateKey");var b={};return b.point=f.getG().mul(a.bn),b.compressed=a.compressed,b.network=a.network,b},d._transformDER=function(a,b){k.checkArgument(d._isBuffer(a),"Must be a hex buffer of DER encoded public key");var c={};b=j.isUndefined(b)?!0:b;var g,h,i,l;if(4!==a[0]&&(b||6!==a[0]&&7!==a[0]))if(3===a[0])i=a.slice(1),g=new e(i),c=d._transformX(!0,g),c.compressed=!0;else{if(2!==a[0])throw new TypeError("Invalid DER format public key");i=a.slice(1),g=new e(i),c=d._transformX(!1,g),c.compressed=!0}else{if(i=a.slice(1,33),l=a.slice(33,65),32!==i.length||32!==l.length||65!==a.length)throw new TypeError("Length of x and y must be 32 bytes");g=new e(i),h=new e(l),c.point=new f(g,h),c.compressed=!1}return c},d._transformX=function(a,b){k.checkArgument("boolean"==typeof a,"Must specify whether y is odd or not (true or false)");var c={};return c.point=f.fromX(a,b),c},d._transformObject=function(a){var b=new e(a.x,"hex"),c=new e(a.y,"hex"),g=new f(b,c);return new d(g,{compressed:a.compressed})},d.fromPrivateKey=function(a){k.checkArgument(d._isPrivateKey(a),"Must be an instance of PrivateKey");var b=d._transformPrivateKey(a);return new d(b.point,{compressed:b.compressed,network:b.network})},d.fromDER=d.fromBuffer=function(a,b){k.checkArgument(d._isBuffer(a),"Must be a hex buffer of DER encoded public key");var c=d._transformDER(a,b);return new d(c.point,{compressed:c.compressed})},d.fromPoint=function(a,b){return k.checkArgument(a instanceof f,"First argument must be an instance of Point."),new d(a,{compressed:b})},d.fromString=function(a,b){var e=new c(a,b||"hex"),f=d._transformDER(e);return new d(f.point,{compressed:f.compressed})},d.fromX=function(a,b){var c=d._transformX(a,b);return new d(c.point,{compressed:c.compressed})},d.getValidationError=function(a){var b;try{new d(a)}catch(c){b=c}return b},d.isValid=function(a){return!d.getValidationError(a)},d.prototype.toObject=d.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},d.prototype.toBuffer=d.prototype.toDER=function(){var a,b=this.point.getX(),d=this.point.getY(),e=b.toBuffer({size:32}),f=d.toBuffer({size:32});if(this.compressed){var g=f[f.length-1]%2;return a=new c(g?[3]:[2]),c.concat([a,e])}return a=new c([4]),c.concat([a,e,f])},d.prototype._getID=function(){return g.sha256ripemd160(this.toBuffer())},d.prototype.toAddress=function(b){var c=a("./address");return c.fromPublicKey(this,b||this.network)},d.prototype.toString=function(){return this.toDER().toString("hex")},d.prototype.inspect=function(){return""},b.exports=d}).call(this,a("buffer").Buffer)},{"./address":39,"./crypto/bn":44,"./crypto/hash":46,"./crypto/point":47,"./networks":59,"./privatekey":61,"./util/js":83,"./util/preconditions":84,buffer:187,lodash:87}],63:[function(a,b,c){b.exports=a("./script"),b.exports.Interpreter=a("./interpreter")},{"./interpreter":64,"./script":65}],64:[function(a,b,c){(function(c){"use strict";var d=a("lodash"),e=a("./script"),f=a("../opcode"),g=a("../crypto/bn"),h=a("../crypto/hash"),i=a("../crypto/signature"),j=a("../publickey"),k=function l(a){return this instanceof l?void(a?(this.initialize(),this.set(a)):this.initialize()):new l(a)};k.prototype.verify=function(b,c,f,g,h){var i=a("../transaction");d.isUndefined(f)&&(f=new i),d.isUndefined(g)&&(g=0),d.isUndefined(h)&&(h=0),this.set({script:b,tx:f,nin:g,flags:h});var j;if(0!==(h&k.SCRIPT_VERIFY_SIGPUSHONLY)&&!b.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;h&k.SCRIPT_VERIFY_P2SH&&(j=this.stack.slice());var l=this.stack;if(this.initialize(),this.set({script:c,stack:l,tx:f,nin:g,flags:h}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var m=this.stack[this.stack.length-1];if(!k.castToBool(m))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(h&k.SCRIPT_VERIFY_P2SH&&c.isScriptHashOut()){if(!b.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===j.length)throw new Error("internal error - stack copy empty");var n=j[j.length-1],o=e.fromBuffer(n);return j.pop(),this.initialize(),this.set({script:o,stack:j,tx:f,nin:g,flags:h}),this.evaluate()?0===j.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):k.castToBool(j[j.length-1])?!0:(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1):!1}return!0},b.exports=k,k.prototype.initialize=function(a){ this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},k.prototype.set=function(a){this.script=a.script||this.script,this.tx=a.tx||this.tx,this.nin="undefined"!=typeof a.nin?a.nin:this.nin,this.stack=a.stack||this.stack,this.altstack=a.altack||this.altstack,this.pc="undefined"!=typeof a.pc?a.pc:this.pc,this.pbegincodehash="undefined"!=typeof a.pbegincodehash?a.pbegincodehash:this.pbegincodehash,this.nOpCount="undefined"!=typeof a.nOpCount?a.nOpCount:this.nOpCount,this.vfExec=a.vfExec||this.vfExec,this.errstr=a.errstr||this.errstr,this.flags="undefined"!=typeof a.flags?a.flags:this.flags},k["true"]=new c([1]),k["false"]=new c([]),k.MAX_SCRIPT_ELEMENT_SIZE=520,k.LOCKTIME_THRESHOLD=5e8,k.LOCKTIME_THRESHOLD_BN=new g(k.LOCKTIME_THRESHOLD),k.SCRIPT_VERIFY_NONE=0,k.SCRIPT_VERIFY_P2SH=1,k.SCRIPT_VERIFY_STRICTENC=2,k.SCRIPT_VERIFY_DERSIG=4,k.SCRIPT_VERIFY_LOW_S=8,k.SCRIPT_VERIFY_NULLDUMMY=16,k.SCRIPT_VERIFY_SIGPUSHONLY=32,k.SCRIPT_VERIFY_MINIMALDATA=64,k.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,k.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,k.castToBool=function(a){for(var b=0;b1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(b){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+b,!1}return this.vfExec.length>0?(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1):!0},k.prototype.checkLockTime=function(a){return this.tx.nLockTime=k.LOCKTIME_THRESHOLD&&a.gte(k.LOCKTIME_THRESHOLD_BN)?a.gt(new g(this.tx.nLockTime))?!1:this.tx.inputs[this.nin].isFinal()?!0:!1:!1},k.prototype.step=function(){var a,b,c,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=0!==(this.flags&k.SCRIPT_VERIFY_MINIMALDATA),A=-1===this.vfExec.indexOf(!1),B=this.script.chunks[this.pc];this.pc++;var C=B.opcodenum;if(d.isUndefined(C))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(B.buf&&B.buf.length>k.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(C>f.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(C===f.OP_CAT||C===f.OP_SUBSTR||C===f.OP_LEFT||C===f.OP_RIGHT||C===f.OP_INVERT||C===f.OP_AND||C===f.OP_OR||C===f.OP_XOR||C===f.OP_2MUL||C===f.OP_2DIV||C===f.OP_MUL||C===f.OP_DIV||C===f.OP_MOD||C===f.OP_LSHIFT||C===f.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(A&&C>=0&&C<=f.OP_PUSHDATA4){if(z&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(B.buf){if(B.len!==B.buf.length)throw new Error("Length of push value not equal to length of data");this.stack.push(B.buf)}else this.stack.push(k["false"])}else if(A||f.OP_IF<=C&&C<=f.OP_ENDIF)switch(C){case f.OP_1NEGATE:case f.OP_1:case f.OP_2:case f.OP_3:case f.OP_4:case f.OP_5:case f.OP_6:case f.OP_7:case f.OP_8:case f.OP_9:case f.OP_10:case f.OP_11:case f.OP_12:case f.OP_13:case f.OP_14:case f.OP_15:case f.OP_16:m=C-(f.OP_1-1),a=new g(m).toScriptNumBuffer(),this.stack.push(a);break;case f.OP_NOP:break;case f.OP_NOP2:case f.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&k.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&k.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var D=g.fromScriptNumBuffer(this.stack[this.stack.length-1],z,5);if(D.lt(new g(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(D))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case f.OP_NOP1:case f.OP_NOP3:case f.OP_NOP4:case f.OP_NOP5:case f.OP_NOP6:case f.OP_NOP7:case f.OP_NOP8:case f.OP_NOP9:case f.OP_NOP10:if(this.flags&k.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case f.OP_IF:case f.OP_NOTIF:if(x=!1,A){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;a=this.stack.pop(),x=k.castToBool(a),C===f.OP_NOTIF&&(x=!x)}this.vfExec.push(x);break;case f.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case f.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case f.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(a=this.stack[this.stack.length-1],x=k.castToBool(a),!x)return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case f.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case f.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case f.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case f.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case f.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=this.stack[this.stack.length-2],c=this.stack[this.stack.length-1],this.stack.push(b),this.stack.push(c);break;case f.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=this.stack[this.stack.length-3],c=this.stack[this.stack.length-2];var E=this.stack[this.stack.length-1];this.stack.push(b),this.stack.push(c),this.stack.push(E);break;case f.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=this.stack[this.stack.length-4],c=this.stack[this.stack.length-3],this.stack.push(b),this.stack.push(c);break;case f.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack.splice(this.stack.length-6,2),this.stack.push(l[0]),this.stack.push(l[1]);break;case f.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=this.stack.splice(this.stack.length-4,2),this.stack.push(l[0]),this.stack.push(l[1]);break;case f.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;a=this.stack[this.stack.length-1],x=k.castToBool(a),x&&this.stack.push(a);break;case f.OP_DEPTH:a=new g(this.stack.length).toScriptNumBuffer(),this.stack.push(a);break;case f.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case f.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1]);break;case f.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case f.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2]);break;case f.OP_PICK:case f.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(a=this.stack[this.stack.length-1],p=g.fromScriptNumBuffer(a,z),m=p.toNumber(),this.stack.pop(),0>m||m>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;a=this.stack[this.stack.length-m-1],C===f.OP_ROLL&&this.stack.splice(this.stack.length-m-1,1),this.stack.push(a);break;case f.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;n=this.stack[this.stack.length-3],o=this.stack[this.stack.length-2];var F=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=o,this.stack[this.stack.length-2]=F,this.stack[this.stack.length-1]=n;break;case f.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;n=this.stack[this.stack.length-2],o=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=o,this.stack[this.stack.length-1]=n;break;case f.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,this.stack[this.stack.length-1]);break;case f.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=new g(this.stack[this.stack.length-1].length),this.stack.push(p.toScriptNumBuffer());break;case f.OP_EQUAL:case f.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=this.stack[this.stack.length-2],c=this.stack[this.stack.length-1];var G=b.toString("hex")===c.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(G?k["true"]:k["false"]),C===f.OP_EQUALVERIFY){if(!G)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case f.OP_1ADD:case f.OP_1SUB:case f.OP_NEGATE:case f.OP_ABS:case f.OP_NOT:case f.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(a=this.stack[this.stack.length-1],p=g.fromScriptNumBuffer(a,z),C){case f.OP_1ADD:p=p.add(g.One);break;case f.OP_1SUB:p=p.sub(g.One);break;case f.OP_NEGATE:p=p.neg();break;case f.OP_ABS:p.cmp(g.Zero)<0&&(p=p.neg());break;case f.OP_NOT:p=new g((0===p.cmp(g.Zero))+0);break;case f.OP_0NOTEQUAL:p=new g((0!==p.cmp(g.Zero))+0)}this.stack.pop(),this.stack.push(p.toScriptNumBuffer());break;case f.OP_ADD:case f.OP_SUB:case f.OP_BOOLAND:case f.OP_BOOLOR:case f.OP_NUMEQUAL:case f.OP_NUMEQUALVERIFY:case f.OP_NUMNOTEQUAL:case f.OP_LESSTHAN:case f.OP_GREATERTHAN:case f.OP_LESSTHANOREQUAL:case f.OP_GREATERTHANOREQUAL:case f.OP_MIN:case f.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(q=g.fromScriptNumBuffer(this.stack[this.stack.length-2],z),r=g.fromScriptNumBuffer(this.stack[this.stack.length-1],z),p=new g(0),C){case f.OP_ADD:p=q.add(r);break;case f.OP_SUB:p=q.sub(r);break;case f.OP_BOOLAND:p=new g((0!==q.cmp(g.Zero)&&0!==r.cmp(g.Zero))+0);break;case f.OP_BOOLOR:p=new g((0!==q.cmp(g.Zero)||0!==r.cmp(g.Zero))+0);break;case f.OP_NUMEQUAL:p=new g((0===q.cmp(r))+0);break;case f.OP_NUMEQUALVERIFY:p=new g((0===q.cmp(r))+0);break;case f.OP_NUMNOTEQUAL:p=new g((0!==q.cmp(r))+0);break;case f.OP_LESSTHAN:p=new g((q.cmp(r)<0)+0);break;case f.OP_GREATERTHAN:p=new g((q.cmp(r)>0)+0);break;case f.OP_LESSTHANOREQUAL:p=new g((q.cmp(r)<=0)+0);break;case f.OP_GREATERTHANOREQUAL:p=new g((q.cmp(r)>=0)+0);break;case f.OP_MIN:p=q.cmp(r)<0?q:r;break;case f.OP_MAX:p=q.cmp(r)>0?q:r}if(this.stack.pop(),this.stack.pop(),this.stack.push(p.toScriptNumBuffer()),C===f.OP_NUMEQUALVERIFY){if(!k.castToBool(this.stack[this.stack.length-1]))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case f.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;q=g.fromScriptNumBuffer(this.stack[this.stack.length-3],z),r=g.fromScriptNumBuffer(this.stack[this.stack.length-2],z);var H=g.fromScriptNumBuffer(this.stack[this.stack.length-1],z);x=r.cmp(q)<=0&&q.cmp(H)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(x?k["true"]:k["false"]);break;case f.OP_RIPEMD160:case f.OP_SHA1:case f.OP_SHA256:case f.OP_HASH160:case f.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;a=this.stack[this.stack.length-1];var I;C===f.OP_RIPEMD160?I=h.ripemd160(a):C===f.OP_SHA1?I=h.sha1(a):C===f.OP_SHA256?I=h.sha256(a):C===f.OP_HASH160?I=h.sha256ripemd160(a):C===f.OP_HASH256&&(I=h.sha256sha256(a)),this.stack.pop(),this.stack.push(I);break;case f.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case f.OP_CHECKSIG:case f.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=this.stack[this.stack.length-2],t=this.stack[this.stack.length-1],u=(new e).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var J=(new e).add(s);if(u.findAndDelete(J),!this.checkSignatureEncoding(s)||!this.checkPubkeyEncoding(t))return!1;try{v=i.fromTxFormat(s),w=j.fromBuffer(t,!1),y=this.tx.verifySignature(v,w,this.nin,u)}catch(K){y=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(y?k["true"]:k["false"]),C===f.OP_CHECKSIGVERIFY){if(!y)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case f.OP_CHECKMULTISIG:case f.OP_CHECKMULTISIGVERIFY:var L=1;if(this.stack.lengthM||M>20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=M,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var N=++L;if(L+=M,this.stack.lengthO||O>M)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var P=++L;if(L+=O,this.stack.lengthQ;Q++)s=this.stack[this.stack.length-P-Q],u.findAndDelete((new e).add(s));for(y=!0;y&&O>0;){if(s=this.stack[this.stack.length-P],t=this.stack[this.stack.length-N],!this.checkSignatureEncoding(s)||!this.checkPubkeyEncoding(t))return!1;var R;try{v=i.fromTxFormat(s),w=j.fromBuffer(t,!1),R=this.tx.verifySignature(v,w,this.nin,u)}catch(K){R=!1}R&&(P++,O--),N++,M--,O>M&&(y=!1)}for(;L-->1;)this.stack.pop();if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&k.SCRIPT_VERIFY_NULLDUMMY&&this.stack[this.stack.length-1].length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(y?k["true"]:k["false"]),C===f.OP_CHECKMULTISIGVERIFY){if(!y)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,a("buffer").Buffer)},{"../crypto/bn":44,"../crypto/hash":46,"../crypto/signature":49,"../opcode":60,"../publickey":62,"../transaction":66,"./script":65,buffer:187,lodash:87}],65:[function(a,b,c){(function(c){"use strict";var d=a("../address"),e=a("../encoding/bufferreader"),f=a("../encoding/bufferwriter"),g=a("../crypto/hash"),h=a("../opcode"),i=a("../publickey"),j=a("../crypto/signature"),k=a("../networks"),l=a("../util/preconditions"),m=a("lodash"),n=a("../errors"),o=a("buffer"),p=a("../util/buffer"),q=a("../util/js"),r=function s(a){return this instanceof s?(this.chunks=[],p.isBuffer(a)?s.fromBuffer(a):a instanceof d?s.fromAddress(a):a instanceof s?s.fromBuffer(a.toBuffer()):m.isString(a)?s.fromString(a):void(m.isObject(a)&&m.isArray(a.chunks)&&this.set(a))):new s(a)};r.prototype.set=function(a){return l.checkArgument(m.isObject(a)),l.checkArgument(m.isArray(a.chunks)),this.chunks=a.chunks,this},r.fromBuffer=function(a){var b=new r;b.chunks=[];for(var c=new e(a);!c.finished();)try{var d,f,g=c.readUInt8();g>0&&g0&&i0&&(e=d?e+" "+a.buf.toString("hex"):e+" "+a.len+" 0x"+a.buf.toString("hex"));else if("undefined"!=typeof h.reverseMap[c])d?0===c?e+=" 0":79===c?e+=" -1":e=e+" "+h(c).toString():e=e+" "+h(c).toString();else{var f=c.toString(16);f.length%2!==0&&(f="0"+f),e=d?e+" "+f:e+" 0x"+f}return e},r.prototype.toASM=function(){for(var a="",b=0;b"},r.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==h.OP_DUP||this.chunks[1].opcodenum!==h.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==h.OP_EQUALVERIFY||this.chunks[4].opcodenum!==h.OP_CHECKSIG)},r.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var a=this.chunks[0].buf,b=this.chunks[1].buf;if(a&&a.length&&48===a[0]&&b&&b.length){var c=b[0];if((4===c||6===c||7===c)&&65===b.length)return!0;if((3===c||2===c)&&33===b.length)return!0}}return!1},r.prototype.getPublicKey=function(){return l.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},r.prototype.getPublicKeyHash=function(){return l.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},r.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===h.OP_CHECKSIG){var a=this.chunks[0].buf,b=a[0],c=!1;if(4!==b&&6!==b&&7!==b||65!==a.length?3!==b&&2!==b||33!==a.length||(c=!0):c=!0,c)return i.isValid(a)}return!1},r.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var a=this.chunks[0].buf;if(a&&a.length&&48===a[0])return!0}return!1},r.prototype.isScriptHashOut=function(){var a=this.toBuffer();return 23===a.length&&a[0]===h.OP_HASH160&&20===a[1]&&a[a.length-1]===h.OP_EQUAL},r.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var a=this.chunks[this.chunks.length-1],b=a.buf;if(!b)return!1;var c;try{c=r.fromBuffer(b)}catch(d){if(d instanceof n.Script.InvalidBuffer)return!1;throw d}var e=c.classify();return e!==r.types.UNKNOWN},r.prototype.isMultisigOut=function(){return this.chunks.length>3&&h.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(a){return a.buf&&p.isBuffer(a.buf)})&&h.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===h.OP_CHECKMULTISIG},r.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(a){return a.buf&&p.isBuffer(a.buf)&&j.isTxDER(a.buf)})},r.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===h.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=r.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},r.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return new c(m.isUndefined(this.chunks[1])?0:this.chunks[1].buf);if(this.isPublicKeyHashOut())return new c(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},r.prototype.isPushOnly=function(){return m.every(this.chunks,function(a){return a.opcodenum<=h.OP_16})},r.types={},r.types.UNKNOWN="Unknown",r.types.PUBKEY_OUT="Pay to public key",r.types.PUBKEY_IN="Spend from public key",r.types.PUBKEYHASH_OUT="Pay to public key hash",r.types.PUBKEYHASH_IN="Spend from public key hash",r.types.SCRIPTHASH_OUT="Pay to script hash",r.types.SCRIPTHASH_IN="Spend from script hash",r.types.MULTISIG_OUT="Pay to multisig",r.types.MULTISIG_IN="Spend from multisig",r.types.DATA_OUT="Data push",r.OP_RETURN_STANDARD_SIZE=80,r.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var a=this.classifyOutput();return a!=r.types.UNKNOWN?a:this.classifyInput()},r.outputIdentifiers={},r.outputIdentifiers.PUBKEY_OUT=r.prototype.isPublicKeyOut,r.outputIdentifiers.PUBKEYHASH_OUT=r.prototype.isPublicKeyHashOut,r.outputIdentifiers.MULTISIG_OUT=r.prototype.isMultisigOut,r.outputIdentifiers.SCRIPTHASH_OUT=r.prototype.isScriptHashOut,r.outputIdentifiers.DATA_OUT=r.prototype.isDataOut,r.prototype.classifyOutput=function(){for(var a in r.outputIdentifiers)if(r.outputIdentifiers[a].bind(this)())return r.types[a];return r.types.UNKNOWN},r.inputIdentifiers={},r.inputIdentifiers.PUBKEY_IN=r.prototype.isPublicKeyIn,r.inputIdentifiers.PUBKEYHASH_IN=r.prototype.isPublicKeyHashIn,r.inputIdentifiers.MULTISIG_IN=r.prototype.isMultisigIn,r.inputIdentifiers.SCRIPTHASH_IN=r.prototype.isScriptHashIn,r.prototype.classifyInput=function(){for(var a in r.inputIdentifiers)if(r.inputIdentifiers[a].bind(this)())return r.types[a];return r.types.UNKNOWN},r.prototype.isStandard=function(){return this.classify()!==r.types.UNKNOWN},r.prototype.prepend=function(a){return this._addByType(a,!0),this},r.prototype.equals=function(a){if(l.checkState(a instanceof r,"Must provide another script"),this.chunks.length!==a.chunks.length)return!1;var b;for(b=0;b=0&&d=1&&c[0]<=16?d===h.OP_1+(c[0]-1):1===c.length&&129===c[0]?d===h.OP_1NEGATE:c.length<=75?d===c.length:c.length<=255?d===h.OP_PUSHDATA1:c.length<=65535?d===h.OP_PUSHDATA2:!0:!0},r.prototype._decodeOP_N=function(a){if(a===h.OP_0)return 0;if(a>=h.OP_1&&a<=h.OP_16)return a-(h.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(a))},r.prototype.getSignatureOperationsCount=function(a){a=m.isUndefined(a)?!0:a;var b=this,c=0,d=h.OP_INVALIDOPCODE;return m.each(b.chunks,function(e){var f=e.opcodenum;f==h.OP_CHECKSIG||f==h.OP_CHECKSIGVERIFY?c++:(f==h.OP_CHECKMULTISIG||f==h.OP_CHECKMULTISIGVERIFY)&&(c+=a&&d>=h.OP_1&&d<=h.OP_16?b._decodeOP_N(d):20),d=f}),c},b.exports=r}).call(this,a("buffer").Buffer)},{"../address":39,"../crypto/hash":46,"../crypto/signature":49,"../encoding/bufferreader":52,"../encoding/bufferwriter":53,"../errors":55,"../networks":59,"../opcode":60,"../publickey":62,"../util/buffer":81,"../util/js":83,"../util/preconditions":84,buffer:187,lodash:87}],66:[function(a,b,c){b.exports=a("./transaction"),b.exports.Input=a("./input"),b.exports.Output=a("./output"),b.exports.UnspentOutput=a("./unspentoutput"),b.exports.Signature=a("./signature"),b.exports.Sighash=a("./sighash")},{"./input":67,"./output":73,"./sighash":74,"./signature":75,"./transaction":76,"./unspentoutput":77}],67:[function(a,b,c){b.exports=a("./input"),b.exports.PublicKey=a("./publickey"),b.exports.PublicKeyHash=a("./publickeyhash"),b.exports.MultiSig=a("./multisig.js"),b.exports.MultiSigScriptHash=a("./multisigscripthash.js")},{"./input":68,"./multisig.js":69,"./multisigscripthash.js":70,"./publickey":71,"./publickeyhash":72}],68:[function(a,b,c){"use strict";function d(a){return this instanceof d?a?this._fromObject(a):void 0:new d(a)}var e=a("lodash"),f=a("../../util/preconditions"),g=a("../../errors"),h=a("../../encoding/bufferwriter"),i=a("buffer"),j=a("../../util/buffer"),k=a("../../util/js"),l=a("../../script"),m=a("../sighash"),n=a("../output"),o=4294967295,p=o-2,q=o,r=o-1;d.MAXINT=o,d.DEFAULT_SEQNUMBER=q,d.DEFAULT_LOCKTIME_SEQNUMBER=r,d.DEFAULT_RBF_SEQNUMBER=p,Object.defineProperty(d.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new l(this._scriptBuffer),this._script._isInput=!0),this._script)}}),d.fromObject=function(a){f.checkArgument(e.isObject(a));var b=new d;return b._fromObject(a)},d.prototype._fromObject=function(a){var b;if(b=e.isString(a.prevTxId)&&k.isHexa(a.prevTxId)?new i.Buffer(a.prevTxId,"hex"):a.prevTxId,this.output=a.output?a.output instanceof n?a.output:new n(a.output):void 0,this.prevTxId=b||a.txidbuf,this.outputIndex=e.isUndefined(a.outputIndex)?a.txoutnum:a.outputIndex,this.sequenceNumber=e.isUndefined(a.sequenceNumber)?e.isUndefined(a.seqnum)?q:a.seqnum:a.sequenceNumber,e.isUndefined(a.script)&&e.isUndefined(a.scriptBuffer))throw new g.Transaction.Input.MissingScript;return this.setScript(a.scriptBuffer||a.script),this},d.prototype.toObject=d.prototype.toJSON=function(){var a={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(a.scriptString=this.script.toString()), this.output&&(a.output=this.output.toObject()),a},d.fromBufferReader=function(a){var b=new d;return b.prevTxId=a.readReverse(32),b.outputIndex=a.readUInt32LE(),b._scriptBuffer=a.readVarLengthBuffer(),b.sequenceNumber=a.readUInt32LE(),b},d.prototype.toBufferWriter=function(a){a||(a=new h),a.writeReverse(this.prevTxId),a.writeUInt32LE(this.outputIndex);var b=this._scriptBuffer;return a.writeVarintNum(b.length),a.write(b),a.writeUInt32LE(this.sequenceNumber),a},d.prototype.setScript=function(a){if(this._script=null,a instanceof l)this._script=a,this._script._isInput=!0,this._scriptBuffer=a.toBuffer();else if(k.isHexa(a))this._scriptBuffer=new i.Buffer(a,"hex");else if(e.isString(a))this._script=new l(a),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!j.isBuffer(a))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new i.Buffer(a)}return this},d.prototype.getSignatures=function(){throw new g.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},d.prototype.isFullySigned=function(){throw new g.AbstractMethodInvoked("Input#isFullySigned")},d.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},d.prototype.addSignature=function(){throw new g.AbstractMethodInvoked("Input#addSignature")},d.prototype.clearSignatures=function(){throw new g.AbstractMethodInvoked("Input#clearSignatures")},d.prototype.isValidSignature=function(a,b){return b.signature.nhashtype=b.sigtype,m.verify(a,b.signature,b.publicKey,b.inputIndex,this.output.script,this.output.satoshisBN)},d.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},d.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},b.exports=d},{"../../encoding/bufferwriter":53,"../../errors":55,"../../script":63,"../../util/buffer":81,"../../util/js":83,"../../util/preconditions":84,"../output":73,"../sighash":74,buffer:187,lodash:87}],69:[function(a,b,c){"use strict";function d(a,b,c,d){g.apply(this,arguments);var f=this;b=b||a.publicKeys,c=c||a.threshold,d=d||a.signatures,this.publicKeys=e.sortBy(b,function(a){return a.toString("hex")}),i.checkState(j.buildMultisigOut(this.publicKeys,c).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},e.each(this.publicKeys,function(a,b){f.publicKeyIndex[a.toString()]=b}),this.threshold=c,this.signatures=d?this._deserializeSignatures(d):new Array(this.publicKeys.length)}var e=a("lodash"),f=a("inherits"),g=(a("../transaction"),a("./input")),h=a("../output"),i=a("../../util/preconditions"),j=a("../../script"),k=a("../../crypto/signature"),l=a("../sighash"),m=(a("../../publickey"),a("../../util/buffer")),n=a("../signature");f(d,g),d.prototype.toObject=function(){var a=g.prototype.toObject.apply(this,arguments);return a.threshold=this.threshold,a.publicKeys=e.map(this.publicKeys,function(a){return a.toString()}),a.signatures=this._serializeSignatures(),a},d.prototype._deserializeSignatures=function(a){return e.map(a,function(a){return a?new n(a):void 0})},d.prototype._serializeSignatures=function(){return e.map(this.signatures,function(a){return a?a.toObject():void 0})},d.prototype.getSignatures=function(a,b,c,d){i.checkState(this.output instanceof h),d=d||k.SIGHASH_ALL|k.SIGHASH_FORKID;var f=this,g=[];return e.each(this.publicKeys,function(e){e.toString()===b.publicKey.toString()&&g.push(new n({publicKey:b.publicKey,prevTxId:f.prevTxId,outputIndex:f.outputIndex,inputIndex:c,signature:l.sign(a,b,d,c,f.output.script,f.output.satoshisBN),sigtype:d}))}),g},d.prototype.addSignature=function(a,b){return i.checkState(!this.isFullySigned(),"All needed signatures have already been added"),i.checkArgument(!e.isUndefined(this.publicKeyIndex[b.publicKey.toString()]),"Signature has no matching public key"),i.checkState(this.isValidSignature(a,b)),this.signatures[this.publicKeyIndex[b.publicKey.toString()]]=b,this._updateScript(),this},d.prototype._updateScript=function(){return this.setScript(j.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},d.prototype._createSignatures=function(){return e.map(e.filter(this.signatures,function(a){return!e.isUndefined(a)}),function(a){return m.concat([a.signature.toDER(),m.integerAsSingleByteBuffer(a.sigtype)])})},d.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},d.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},d.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},d.prototype.countSignatures=function(){return e.reduce(this.signatures,function(a,b){return a+!!b},0)},d.prototype.publicKeysWithoutSignature=function(){var a=this;return e.filter(this.publicKeys,function(b){return!a.signatures[a.publicKeyIndex[b.toString()]]})},d.prototype.isValidSignature=function(a,b){return b.signature.nhashtype=b.sigtype,l.verify(a,b.signature,b.publicKey,b.inputIndex,this.output.script,this.output.satoshisBN)},d.normalizeSignatures=function(a,b,c,d,e){return e.map(function(e){var f=null;return d=d.filter(function(d){if(f)return!0;var g=new n({signature:k.fromTxFormat(d),publicKey:e,prevTxId:b.prevTxId,outputIndex:b.outputIndex,inputIndex:c,sigtype:k.SIGHASH_ALL});g.signature.nhashtype=g.sigtype;var h=l.verify(a,g.signature,g.publicKey,g.inputIndex,b.output.script);return h?(f=g,!1):!0}),f?f:null})},d.OPCODES_SIZE=1,d.SIGNATURE_SIZE=73,d.prototype._estimateSize=function(){return d.OPCODES_SIZE+this.threshold*d.SIGNATURE_SIZE},b.exports=d},{"../../crypto/signature":49,"../../publickey":62,"../../script":63,"../../util/buffer":81,"../../util/preconditions":84,"../output":73,"../sighash":74,"../signature":75,"../transaction":76,"./input":68,inherits:86,lodash:87}],70:[function(a,b,c){"use strict";function d(a,b,c,d){g.apply(this,arguments);var f=this;b=b||a.publicKeys,c=c||a.threshold,d=d||a.signatures,this.publicKeys=e.sortBy(b,function(a){return a.toString("hex")}),this.redeemScript=j.buildMultisigOut(this.publicKeys,c),i.checkState(j.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},e.each(this.publicKeys,function(a,b){f.publicKeyIndex[a.toString()]=b}),this.threshold=c,this.signatures=d?this._deserializeSignatures(d):new Array(this.publicKeys.length)}var e=a("lodash"),f=a("inherits"),g=a("./input"),h=a("../output"),i=a("../../util/preconditions"),j=a("../../script"),k=a("../../crypto/signature"),l=a("../sighash"),m=(a("../../publickey"),a("../../util/buffer")),n=a("../signature");f(d,g),d.prototype.toObject=function(){var a=g.prototype.toObject.apply(this,arguments);return a.threshold=this.threshold,a.publicKeys=e.map(this.publicKeys,function(a){return a.toString()}),a.signatures=this._serializeSignatures(),a},d.prototype._deserializeSignatures=function(a){return e.map(a,function(a){return a?new n(a):void 0})},d.prototype._serializeSignatures=function(){return e.map(this.signatures,function(a){return a?a.toObject():void 0})},d.prototype.getSignatures=function(a,b,c,d){i.checkState(this.output instanceof h),d=d||k.SIGHASH_ALL|k.SIGHASH_FORKID;var f=this,g=[];return e.each(this.publicKeys,function(e){e.toString()===b.publicKey.toString()&&g.push(new n({publicKey:b.publicKey,prevTxId:f.prevTxId,outputIndex:f.outputIndex,inputIndex:c,signature:l.sign(a,b,d,c,f.redeemScript,f.output.satoshisBN),sigtype:d}))}),g},d.prototype.addSignature=function(a,b){return i.checkState(!this.isFullySigned(),"All needed signatures have already been added"),i.checkArgument(!e.isUndefined(this.publicKeyIndex[b.publicKey.toString()]),"Signature has no matching public key"),i.checkState(this.isValidSignature(a,b)),this.signatures[this.publicKeyIndex[b.publicKey.toString()]]=b,this._updateScript(),this},d.prototype._updateScript=function(){return this.setScript(j.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},d.prototype._createSignatures=function(){return e.map(e.filter(this.signatures,function(a){return!e.isUndefined(a)}),function(a){return m.concat([a.signature.toDER(),m.integerAsSingleByteBuffer(a.sigtype)])})},d.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},d.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},d.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},d.prototype.countSignatures=function(){return e.reduce(this.signatures,function(a,b){return a+!!b},0)},d.prototype.publicKeysWithoutSignature=function(){var a=this;return e.filter(this.publicKeys,function(b){return!a.signatures[a.publicKeyIndex[b.toString()]]})},d.prototype.isValidSignature=function(a,b){return b.signature.nhashtype=b.sigtype,l.verify(a,b.signature,b.publicKey,b.inputIndex,this.redeemScript,this.output.satoshisBN)},d.OPCODES_SIZE=7,d.SIGNATURE_SIZE=74,d.PUBKEY_SIZE=34,d.prototype._estimateSize=function(){return d.OPCODES_SIZE+this.threshold*d.SIGNATURE_SIZE+this.publicKeys.length*d.PUBKEY_SIZE},b.exports=d},{"../../crypto/signature":49,"../../publickey":62,"../../script":63,"../../util/buffer":81,"../../util/preconditions":84,"../output":73,"../sighash":74,"../signature":75,"./input":68,inherits:86,lodash:87}],71:[function(a,b,c){"use strict";function d(){g.apply(this,arguments)}var e=a("inherits"),f=a("../../util/preconditions"),g=(a("../../util/buffer"),a("./input")),h=a("../output"),i=a("../sighash"),j=a("../../script"),k=a("../../crypto/signature"),l=a("../signature");e(d,g),d.prototype.getSignatures=function(a,b,c,d){f.checkState(this.output instanceof h),d=d||k.SIGHASH_ALL|k.SIGHASH_FORKID;var e=b.toPublicKey();return e.toString()===this.output.script.getPublicKey().toString("hex")?[new l({publicKey:e,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:c,signature:i.sign(a,b,d,c,this.output.script,this.output.satoshisBN),sigtype:d})]:[]},d.prototype.addSignature=function(a,b){return f.checkState(this.isValidSignature(a,b),"Signature is invalid"),this.setScript(j.buildPublicKeyIn(b.signature.toDER(),b.sigtype)),this},d.prototype.clearSignatures=function(){return this.setScript(j.empty()),this},d.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},d.SCRIPT_MAX_SIZE=73,d.prototype._estimateSize=function(){return d.SCRIPT_MAX_SIZE},b.exports=d},{"../../crypto/signature":49,"../../script":63,"../../util/buffer":81,"../../util/preconditions":84,"../output":73,"../sighash":74,"../signature":75,"./input":68,inherits:86}],72:[function(a,b,c){"use strict";function d(){i.apply(this,arguments)}var e=a("inherits"),f=a("../../util/preconditions"),g=a("../../util/buffer"),h=a("../../crypto/hash"),i=a("./input"),j=a("../output"),k=a("../sighash"),l=a("../../script"),m=a("../../crypto/signature"),n=a("../signature");e(d,i),d.prototype.getSignatures=function(a,b,c,d,e){return f.checkState(this.output instanceof j),e=e||h.sha256ripemd160(b.publicKey.toBuffer()),d=d||m.SIGHASH_ALL|m.SIGHASH_FORKID,g.equals(e,this.output.script.getPublicKeyHash())?[new n({publicKey:b.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:c,signature:k.sign(a,b,d,c,this.output.script,this.output.satoshisBN),sigtype:d})]:[]},d.prototype.addSignature=function(a,b){return f.checkState(this.isValidSignature(a,b),"Signature is invalid"),this.setScript(l.buildPublicKeyHashIn(b.publicKey,b.signature.toDER(),b.sigtype)),this},d.prototype.clearSignatures=function(){return this.setScript(l.empty()),this},d.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},d.SCRIPT_MAX_SIZE=107,d.prototype._estimateSize=function(){return d.SCRIPT_MAX_SIZE},b.exports=d},{"../../crypto/hash":46,"../../crypto/signature":49,"../../script":63,"../../util/buffer":81,"../../util/preconditions":84,"../output":73,"../sighash":74,"../signature":75,"./input":68,inherits:86}],73:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);if(!e.isObject(a))throw new TypeError("Unrecognized argument for Output");if(this.satoshis=a.satoshis,h.isBuffer(a.script))this._scriptBuffer=a.script;else{var b;b=e.isString(a.script)&&i.isHexa(a.script)?new g.Buffer(a.script,"hex"):a.script,this.setScript(b)}}var e=a("lodash"),f=a("../crypto/bn"),g=a("buffer"),h=a("../util/buffer"),i=a("../util/js"),j=a("../encoding/bufferwriter"),k=a("../script"),l=a("../util/preconditions"),m=a("../errors"),n=9007199254740991;Object.defineProperty(d.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(d.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(a){a instanceof f?(this._satoshisBN=a,this._satoshis=a.toNumber()):e.isString(a)?(this._satoshis=parseInt(a),this._satoshisBN=f.fromNumber(this._satoshis)):(l.checkArgument(i.isNaturalNumber(a),"Output satoshis is not a natural number"),this._satoshisBN=f.fromNumber(a),this._satoshis=a),l.checkState(i.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),d.prototype.invalidSatoshis=function(){return this._satoshis>n?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0?"transaction txout negative":!1},Object.defineProperty(d.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(a){this._satoshisBN=a,this._satoshis=a.toNumber(),l.checkState(i.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),d.prototype.toObject=d.prototype.toJSON=function(){var a={satoshis:this.satoshis};return a.script=this._scriptBuffer.toString("hex"),a},d.fromObject=function(a){return new d(a)},d.prototype.setScriptFromBuffer=function(a){this._scriptBuffer=a;try{this._script=k.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(b){if(!(b instanceof m.Script.InvalidBuffer))throw b;this._script=null}},d.prototype.setScript=function(a){if(a instanceof k)this._scriptBuffer=a.toBuffer(),this._script=a,this._script._isOutput=!0;else if(e.isString(a))this._script=k.fromString(a),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!h.isBuffer(a))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(a)}return this},d.prototype.inspect=function(){var a;return a=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},d.fromBufferReader=function(a){var b={};b.satoshis=a.readUInt64LEBN();var c=a.readVarintNum();return 0!==c?b.script=a.read(c):b.script=new g.Buffer([]),new d(b)},d.prototype.toBufferWriter=function(a){a||(a=new j),a.writeUInt64LEBN(this._satoshisBN);var b=this._scriptBuffer;return a.writeVarintNum(b.length),a.write(b),a},b.exports=d},{"../crypto/bn":44,"../encoding/bufferwriter":53,"../errors":55,"../script":63,"../util/buffer":81,"../util/js":83,"../util/preconditions":84,buffer:187,lodash:87}],74:[function(a,b,c){(function(c){"use strict";function d(a,b,c,d,e,f){var g=v(a,c,d,e,f),h=n.sign(g,b,"little").set({nhashtype:c});return h}function e(a,b,c,d,e,f){o.checkArgument(!q.isUndefined(a)),o.checkArgument(!q.isUndefined(b)&&!q.isUndefined(b.nhashtype));var g=v(a,b.nhashtype,d,e,f);return n.verify(g,b,c,"little")}var f=a("buffer"),g=a("../crypto/signature"),h=a("../script"),i=a("./output"),j=a("../encoding/bufferreader"),k=a("../encoding/bufferwriter"),l=a("../crypto/bn"),m=a("../crypto/hash"),n=a("../crypto/ecdsa"),o=a("../util/preconditions"),p=a("../util/buffer"),q=a("lodash"),r="0000000000000000000000000000000000000000000000000000000000000001",s="ffffffffffffffff",t=!0,u=function(a,b,c,d,e){function f(a){var b=new k;q.each(a.inputs,function(a){b.writeReverse(a.prevTxId),b.writeUInt32LE(a.outputIndex)});var c=b.toBuffer(),d=m.sha256sha256(c);return d}function h(a){var b=new k;q.each(a.inputs,function(a){b.writeUInt32LE(a.sequenceNumber)});var c=b.toBuffer(),d=m.sha256sha256(c);return d}function i(a,b){var c=new k;q.isUndefined(b)?q.each(a.outputs,function(a){a.toBufferWriter(c)}):a.outputs[b].toBufferWriter(c);var d=c.toBuffer(),e=m.sha256sha256(d);return e}var n=a.inputs[c];o.checkArgument(e instanceof l,"For ForkId=0 signatures, satoshis or complete input must be provided");var r=p.emptyBuffer(32),s=p.emptyBuffer(32),t=p.emptyBuffer(32);b&g.SIGHASH_ANYONECANPAY||(r=f(a)),b&g.SIGHASH_ANYONECANPAY||(31&b)==g.SIGHASH_SINGLE||(31&b)==g.SIGHASH_NONE||(s=h(a)),(31&b)!=g.SIGHASH_SINGLE&&(31&b)!=g.SIGHASH_NONE?t=i(a):(31&b)==g.SIGHASH_SINGLE&&c>>0);var w=u.toBuffer(),x=m.sha256sha256(w);return x=new j(x).readReverse()},v=function(b,d,e,n,o){var p=a("./transaction"),q=a("./input"),v=p.shallowCopy(b);if(n=new h(n),d&g.SIGHASH_FORKID&&t)return u(v,d,e,n,o);n.removeCodeseparators();var w;for(w=0;w=v.outputs.length)return new c(r,"hex");for(v.outputs.length=e+1,w=0;e>w;w++)v.outputs[w]=new i({satoshis:l.fromBuffer(new f.Buffer(s,"hex")),script:h.empty()})}d&g.SIGHASH_ANYONECANPAY&&(v.inputs=[v.inputs[e]]);var x=(new k).write(v.toBuffer()).writeInt32LE(d).toBuffer(),y=m.sha256sha256(x);return y=new j(y).readReverse()};b.exports={sighash:v,sign:d,verify:e}}).call(this,a("buffer").Buffer)},{"../crypto/bn":44,"../crypto/ecdsa":45,"../crypto/hash":46,"../crypto/signature":49,"../encoding/bufferreader":52,"../encoding/bufferwriter":53,"../script":63,"../util/buffer":81,"../util/preconditions":84,"./input":67,"./output":73,"./transaction":76,buffer:187,lodash:87}],75:[function(a,b,c){(function(c){"use strict";function d(a){if(!(this instanceof d))return new d(a);if(a instanceof d)return a;if(e.isObject(a))return this._fromObject(a);throw new k.InvalidArgument("TransactionSignatures must be instantiated from an object")}var e=a("lodash"),f=a("../util/preconditions"),g=a("inherits"),h=a("../util/buffer"),i=a("../util/js"),j=a("../publickey"),k=a("../errors"),l=a("../crypto/signature");g(d,l),d.prototype._fromObject=function(a){return this._checkObjectArgs(a),this.publicKey=new j(a.publicKey),this.prevTxId=h.isBuffer(a.prevTxId)?a.prevTxId:new c(a.prevTxId,"hex"),this.outputIndex=a.outputIndex,this.inputIndex=a.inputIndex,this.signature=a.signature instanceof l?a.signature:h.isBuffer(a.signature)?l.fromBuffer(a.signature):l.fromString(a.signature),this.sigtype=a.sigtype,this},d.prototype._checkObjectArgs=function(a){f.checkArgument(j(a.publicKey),"publicKey"),f.checkArgument(!e.isUndefined(a.inputIndex),"inputIndex"),f.checkArgument(!e.isUndefined(a.outputIndex),"outputIndex"),f.checkState(e.isNumber(a.inputIndex),"inputIndex must be a number"),f.checkState(e.isNumber(a.outputIndex),"outputIndex must be a number"),f.checkArgument(a.signature,"signature"),f.checkArgument(a.prevTxId,"prevTxId"),f.checkState(a.signature instanceof l||h.isBuffer(a.signature)||i.isHexa(a.signature),"signature must be a buffer or hexa value"),f.checkState(h.isBuffer(a.prevTxId)||i.isHexa(a.prevTxId),"prevTxId must be a buffer or hexa value"),f.checkArgument(a.sigtype,"sigtype"),f.checkState(e.isNumber(a.sigtype),"sigtype must be a number")},d.prototype.toObject=d.prototype.toJSON=function(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},d.fromObject=function(a){return f.checkArgument(a),new d(a)},b.exports=d}).call(this,a("buffer").Buffer)},{"../crypto/signature":49,"../errors":55,"../publickey":62,"../util/buffer":81,"../util/js":83,"../util/preconditions":84,buffer:187,inherits:86,lodash:87}],76:[function(a,b,c){(function(c){"use strict";function d(a){if(!(this instanceof d))return new d(a);if(this.inputs=[],this.outputs=[],this._inputAmount=void 0,this._outputAmount=void 0,a){if(a instanceof d)return d.shallowCopy(a);if(k.isHexa(a))this.fromString(a);else if(j.isBuffer(a))this.fromBuffer(a);else{if(!e.isObject(a))throw new i.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(a)}}else this._newTransaction()}var e=a("lodash"),f=a("../util/preconditions"),g=a("buffer"),h=c.compare||a("buffer-compare"),i=a("../errors"),j=a("../util/buffer"),k=a("../util/js"),l=a("../encoding/bufferreader"),m=a("../encoding/bufferwriter"),n=a("../crypto/hash"),o=a("../crypto/signature"),p=a("./sighash"),q=a("../address"),r=a("./unspentoutput"),s=a("./input"),t=s.PublicKeyHash,u=s.PublicKey,v=s.MultiSigScriptHash,w=s.MultiSig,x=a("./output"),y=a("../script"),z=a("../privatekey"),A=a("../crypto/bn"),B=1,C=0,D=1e6;d.DUST_AMOUNT=546,d.FEE_SECURITY_MARGIN=150,d.MAX_MONEY=21e14,d.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,d.NLOCKTIME_MAX_VALUE=4294967295,d.FEE_PER_KB=1e5,d.CHANGE_OUTPUT_MAX_SIZE=62,d.MAXIMUM_EXTRA_SIZE=26,d.shallowCopy=function(a){var b=new d(a.toBuffer());return b};var E={configurable:!1,enumerable:!0,get:function(){return new l(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(d.prototype,"hash",E),Object.defineProperty(d.prototype,"id",E);var F={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(d.prototype,"inputAmount",F),F.get=function(){return this._getOutputAmount()},Object.defineProperty(d.prototype,"outputAmount",F),d.prototype._getHash=function(){return n.sha256sha256(this.toBuffer())},d.prototype.serialize=function(a){return!0===a||a&&a.disableAll?this.uncheckedSerialize():this.checkedSerialize(a)},d.prototype.uncheckedSerialize=d.prototype.toString=function(){return this.toBuffer().toString("hex")},d.prototype.checkedSerialize=function(a){var b=this.getSerializationError(a);if(b)throw b.message+=" - For more information please see: https://bitcore.io/api/lib/transaction#serialization-checks",b;return this.uncheckedSerialize()},d.prototype.invalidSatoshis=function(){for(var a=!1,b=0;bc?a.disableMoreOutputThanInput||(b=new i.Transaction.InvalidOutputAmountSum):b=this._hasFeeError(a,c),b||this._hasDustOutputs(a)||this._isMissingSignatures(a)},d.prototype._hasFeeError=function(a,b){if(!e.isUndefined(this._fee)&&this._fee!==b)return new i.Transaction.FeeError.Different("Unspent value is "+b+" but specified fee is "+this._fee);if(!a.disableLargeFees){var c=Math.floor(d.FEE_SECURITY_MARGIN*this._estimateFee());if(b>c)return this._missingChange()?new i.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new i.Transaction.FeeError.TooLarge("expected less than "+c+" but got "+b)}},d.prototype._missingChange=function(){return!this._changeScript},d.prototype._hasDustOutputs=function(a){if(!a.disableDustOutputs){var b,c;for(b in this.outputs)if(c=this.outputs[b],c.satoshis"},d.prototype.toBuffer=function(){var a=new m;return this.toBufferWriter(a).toBuffer()},d.prototype.toBufferWriter=function(a){return a.writeInt32LE(this.version),a.writeVarintNum(this.inputs.length),e.each(this.inputs,function(b){b.toBufferWriter(a)}),a.writeVarintNum(this.outputs.length),e.each(this.outputs,function(b){b.toBufferWriter(a)}),a.writeUInt32LE(this.nLockTime),a},d.prototype.fromBuffer=function(a){var b=new l(a);return this.fromBufferReader(b)},d.prototype.fromBufferReader=function(a){f.checkArgument(!a.finished(),"No transaction data received");var b,c,d;for(this.version=a.readInt32LE(),c=a.readVarintNum(),b=0;c>b;b++){var e=s.fromBufferReader(a);this.inputs.push(e)}for(d=a.readVarintNum(),b=0;d>b;b++)this.outputs.push(x.fromBufferReader(a));return this.nLockTime=a.readUInt32LE(),this},d.prototype.toObject=d.prototype.toJSON=function(){var a=[];this.inputs.forEach(function(b){a.push(b.toObject())});var b=[];this.outputs.forEach(function(a){b.push(a.toObject())});var c={hash:this.hash,version:this.version,inputs:a,outputs:b,nLockTime:this.nLockTime};return this._changeScript&&(c.changeScript=this._changeScript.toString()),e.isUndefined(this._changeIndex)||(c.changeIndex=this._changeIndex),e.isUndefined(this._fee)||(c.fee=this._fee),c},d.prototype.fromObject=function(a){f.checkArgument(e.isObject(a)||a instanceof d);var b,c=this;return b=a instanceof d?b.toObject():a,e.each(b.inputs,function(a){if(!a.output||!a.output.script)return void c.uncheckedAddInput(new s(a));var b,d=new y(a.output.script);if(d.isPublicKeyHashOut())b=new s.PublicKeyHash(a);else if(d.isScriptHashOut()&&a.publicKeys&&a.threshold)b=new s.MultiSigScriptHash(a,a.publicKeys,a.threshold,a.signatures);else{if(!d.isPublicKeyOut())throw new i.Transaction.Input.UnsupportedScript(a.output.script);b=new s.PublicKey(a)}c.addInput(b)}),e.each(b.outputs,function(a){c.addOutput(new x(a))}),b.changeIndex&&(this._changeIndex=b.changeIndex),b.changeScript&&(this._changeScript=new y(b.changeScript)),b.fee&&(this._fee=b.fee),this.nLockTime=b.nLockTime,this.version=b.version,this._checkConsistency(a),this},d.prototype._checkConsistency=function(a){e.isUndefined(this._changeIndex)||(f.checkState(this._changeScript,"Change script is expected."),f.checkState(this.outputs[this._changeIndex],"Change index points to undefined output."),f.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString(),"Change output has an unexpected script.")),a&&a.hash&&f.checkState(a.hash===this.hash,"Hash in object does not match transaction hash.")},d.prototype.lockUntilDate=function(a){if(f.checkArgument(a),e.isNumber(a)&&a=d.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new i.Transaction.BlockHeightTooHigh;if(0>a)throw new i.Transaction.NLockTimeOutOfRange;for(var b=0;b0?(this._changeIndex=this.outputs.length,this._addOutput(new x({script:this._changeScript,satoshis:c}))):this._changeIndex=void 0}},d.prototype.getFee=function(){return this.isCoinbase()?0:e.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},d.prototype._estimateFee=function(){var a=this._estimateSize(),b=this._getUnspentValue();return d._estimateFee(a,b,this._feePerKb)},d.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},d.prototype._clearSignatures=function(){e.each(this.inputs,function(a){ @@ -53,4 +53,4 @@ this.b=n.hash.sha256.hash(this.b.concat(f)),this.A=new n.cipher.aes(this.b),c=0; },12800:{12800:[[40,4352,41],256],12801:[[40,4354,41],256],12802:[[40,4355,41],256],12803:[[40,4357,41],256],12804:[[40,4358,41],256],12805:[[40,4359,41],256],12806:[[40,4361,41],256],12807:[[40,4363,41],256],12808:[[40,4364,41],256],12809:[[40,4366,41],256],12810:[[40,4367,41],256],12811:[[40,4368,41],256],12812:[[40,4369,41],256],12813:[[40,4370,41],256],12814:[[40,4352,4449,41],256],12815:[[40,4354,4449,41],256],12816:[[40,4355,4449,41],256],12817:[[40,4357,4449,41],256],12818:[[40,4358,4449,41],256],12819:[[40,4359,4449,41],256],12820:[[40,4361,4449,41],256],12821:[[40,4363,4449,41],256],12822:[[40,4364,4449,41],256],12823:[[40,4366,4449,41],256],12824:[[40,4367,4449,41],256],12825:[[40,4368,4449,41],256],12826:[[40,4369,4449,41],256],12827:[[40,4370,4449,41],256],12828:[[40,4364,4462,41],256],12829:[[40,4363,4457,4364,4453,4523,41],256],12830:[[40,4363,4457,4370,4462,41],256],12832:[[40,19968,41],256],12833:[[40,20108,41],256],12834:[[40,19977,41],256],12835:[[40,22235,41],256],12836:[[40,20116,41],256],12837:[[40,20845,41],256],12838:[[40,19971,41],256],12839:[[40,20843,41],256],12840:[[40,20061,41],256],12841:[[40,21313,41],256],12842:[[40,26376,41],256],12843:[[40,28779,41],256],12844:[[40,27700,41],256],12845:[[40,26408,41],256],12846:[[40,37329,41],256],12847:[[40,22303,41],256],12848:[[40,26085,41],256],12849:[[40,26666,41],256],12850:[[40,26377,41],256],12851:[[40,31038,41],256],12852:[[40,21517,41],256],12853:[[40,29305,41],256],12854:[[40,36001,41],256],12855:[[40,31069,41],256],12856:[[40,21172,41],256],12857:[[40,20195,41],256],12858:[[40,21628,41],256],12859:[[40,23398,41],256],12860:[[40,30435,41],256],12861:[[40,20225,41],256],12862:[[40,36039,41],256],12863:[[40,21332,41],256],12864:[[40,31085,41],256],12865:[[40,20241,41],256],12866:[[40,33258,41],256],12867:[[40,33267,41],256],12868:[[21839],256],12869:[[24188],256],12870:[[25991],256],12871:[[31631],256],12880:[[80,84,69],256],12881:[[50,49],256],12882:[[50,50],256],12883:[[50,51],256],12884:[[50,52],256],12885:[[50,53],256],12886:[[50,54],256],12887:[[50,55],256],12888:[[50,56],256],12889:[[50,57],256],12890:[[51,48],256],12891:[[51,49],256],12892:[[51,50],256],12893:[[51,51],256],12894:[[51,52],256],12895:[[51,53],256],12896:[[4352],256],12897:[[4354],256],12898:[[4355],256],12899:[[4357],256],12900:[[4358],256],12901:[[4359],256],12902:[[4361],256],12903:[[4363],256],12904:[[4364],256],12905:[[4366],256],12906:[[4367],256],12907:[[4368],256],12908:[[4369],256],12909:[[4370],256],12910:[[4352,4449],256],12911:[[4354,4449],256],12912:[[4355,4449],256],12913:[[4357,4449],256],12914:[[4358,4449],256],12915:[[4359,4449],256],12916:[[4361,4449],256],12917:[[4363,4449],256],12918:[[4364,4449],256],12919:[[4366,4449],256],12920:[[4367,4449],256],12921:[[4368,4449],256],12922:[[4369,4449],256],12923:[[4370,4449],256],12924:[[4366,4449,4535,4352,4457],256],12925:[[4364,4462,4363,4468],256],12926:[[4363,4462],256],12928:[[19968],256],12929:[[20108],256],12930:[[19977],256],12931:[[22235],256],12932:[[20116],256],12933:[[20845],256],12934:[[19971],256],12935:[[20843],256],12936:[[20061],256],12937:[[21313],256],12938:[[26376],256],12939:[[28779],256],12940:[[27700],256],12941:[[26408],256],12942:[[37329],256],12943:[[22303],256],12944:[[26085],256],12945:[[26666],256],12946:[[26377],256],12947:[[31038],256],12948:[[21517],256],12949:[[29305],256],12950:[[36001],256],12951:[[31069],256],12952:[[21172],256],12953:[[31192],256],12954:[[30007],256],12955:[[22899],256],12956:[[36969],256],12957:[[20778],256],12958:[[21360],256],12959:[[27880],256],12960:[[38917],256],12961:[[20241],256],12962:[[20889],256],12963:[[27491],256],12964:[[19978],256],12965:[[20013],256],12966:[[19979],256],12967:[[24038],256],12968:[[21491],256],12969:[[21307],256],12970:[[23447],256],12971:[[23398],256],12972:[[30435],256],12973:[[20225],256],12974:[[36039],256],12975:[[21332],256],12976:[[22812],256],12977:[[51,54],256],12978:[[51,55],256],12979:[[51,56],256],12980:[[51,57],256],12981:[[52,48],256],12982:[[52,49],256],12983:[[52,50],256],12984:[[52,51],256],12985:[[52,52],256],12986:[[52,53],256],12987:[[52,54],256],12988:[[52,55],256],12989:[[52,56],256],12990:[[52,57],256],12991:[[53,48],256],12992:[[49,26376],256],12993:[[50,26376],256],12994:[[51,26376],256],12995:[[52,26376],256],12996:[[53,26376],256],12997:[[54,26376],256],12998:[[55,26376],256],12999:[[56,26376],256],13e3:[[57,26376],256],13001:[[49,48,26376],256],13002:[[49,49,26376],256],13003:[[49,50,26376],256],13004:[[72,103],256],13005:[[101,114,103],256],13006:[[101,86],256],13007:[[76,84,68],256],13008:[[12450],256],13009:[[12452],256],13010:[[12454],256],13011:[[12456],256],13012:[[12458],256],13013:[[12459],256],13014:[[12461],256],13015:[[12463],256],13016:[[12465],256],13017:[[12467],256],13018:[[12469],256],13019:[[12471],256],13020:[[12473],256],13021:[[12475],256],13022:[[12477],256],13023:[[12479],256],13024:[[12481],256],13025:[[12484],256],13026:[[12486],256],13027:[[12488],256],13028:[[12490],256],13029:[[12491],256],13030:[[12492],256],13031:[[12493],256],13032:[[12494],256],13033:[[12495],256],13034:[[12498],256],13035:[[12501],256],13036:[[12504],256],13037:[[12507],256],13038:[[12510],256],13039:[[12511],256],13040:[[12512],256],13041:[[12513],256],13042:[[12514],256],13043:[[12516],256],13044:[[12518],256],13045:[[12520],256],13046:[[12521],256],13047:[[12522],256],13048:[[12523],256],13049:[[12524],256],13050:[[12525],256],13051:[[12527],256],13052:[[12528],256],13053:[[12529],256],13054:[[12530],256]},13056:{13056:[[12450,12497,12540,12488],256],13057:[[12450,12523,12501,12449],256],13058:[[12450,12531,12506,12450],256],13059:[[12450,12540,12523],256],13060:[[12452,12491,12531,12464],256],13061:[[12452,12531,12481],256],13062:[[12454,12457,12531],256],13063:[[12456,12473,12463,12540,12489],256],13064:[[12456,12540,12459,12540],256],13065:[[12458,12531,12473],256],13066:[[12458,12540,12512],256],13067:[[12459,12452,12522],256],13068:[[12459,12521,12483,12488],256],13069:[[12459,12525,12522,12540],256],13070:[[12460,12525,12531],256],13071:[[12460,12531,12510],256],13072:[[12462,12460],256],13073:[[12462,12491,12540],256],13074:[[12461,12517,12522,12540],256],13075:[[12462,12523,12480,12540],256],13076:[[12461,12525],256],13077:[[12461,12525,12464,12521,12512],256],13078:[[12461,12525,12513,12540,12488,12523],256],13079:[[12461,12525,12527,12483,12488],256],13080:[[12464,12521,12512],256],13081:[[12464,12521,12512,12488,12531],256],13082:[[12463,12523,12476,12452,12525],256],13083:[[12463,12525,12540,12493],256],13084:[[12465,12540,12473],256],13085:[[12467,12523,12490],256],13086:[[12467,12540,12509],256],13087:[[12469,12452,12463,12523],256],13088:[[12469,12531,12481,12540,12512],256],13089:[[12471,12522,12531,12464],256],13090:[[12475,12531,12481],256],13091:[[12475,12531,12488],256],13092:[[12480,12540,12473],256],13093:[[12487,12471],256],13094:[[12489,12523],256],13095:[[12488,12531],256],13096:[[12490,12494],256],13097:[[12494,12483,12488],256],13098:[[12495,12452,12484],256],13099:[[12497,12540,12475,12531,12488],256],13100:[[12497,12540,12484],256],13101:[[12496,12540,12524,12523],256],13102:[[12500,12450,12473,12488,12523],256],13103:[[12500,12463,12523],256],13104:[[12500,12467],256],13105:[[12499,12523],256],13106:[[12501,12449,12521,12483,12489],256],13107:[[12501,12451,12540,12488],256],13108:[[12502,12483,12471,12455,12523],256],13109:[[12501,12521,12531],256],13110:[[12504,12463,12479,12540,12523],256],13111:[[12506,12477],256],13112:[[12506,12491,12498],256],13113:[[12504,12523,12484],256],13114:[[12506,12531,12473],256],13115:[[12506,12540,12472],256],13116:[[12505,12540,12479],256],13117:[[12509,12452,12531,12488],256],13118:[[12508,12523,12488],256],13119:[[12507,12531],256],13120:[[12509,12531,12489],256],13121:[[12507,12540,12523],256],13122:[[12507,12540,12531],256],13123:[[12510,12452,12463,12525],256],13124:[[12510,12452,12523],256],13125:[[12510,12483,12495],256],13126:[[12510,12523,12463],256],13127:[[12510,12531,12471,12519,12531],256],13128:[[12511,12463,12525,12531],256],13129:[[12511,12522],256],13130:[[12511,12522,12496,12540,12523],256],13131:[[12513,12460],256],13132:[[12513,12460,12488,12531],256],13133:[[12513,12540,12488,12523],256],13134:[[12516,12540,12489],256],13135:[[12516,12540,12523],256],13136:[[12518,12450,12531],256],13137:[[12522,12483,12488,12523],256],13138:[[12522,12521],256],13139:[[12523,12500,12540],256],13140:[[12523,12540,12502,12523],256],13141:[[12524,12512],256],13142:[[12524,12531,12488,12466,12531],256],13143:[[12527,12483,12488],256],13144:[[48,28857],256],13145:[[49,28857],256],13146:[[50,28857],256],13147:[[51,28857],256],13148:[[52,28857],256],13149:[[53,28857],256],13150:[[54,28857],256],13151:[[55,28857],256],13152:[[56,28857],256],13153:[[57,28857],256],13154:[[49,48,28857],256],13155:[[49,49,28857],256],13156:[[49,50,28857],256],13157:[[49,51,28857],256],13158:[[49,52,28857],256],13159:[[49,53,28857],256],13160:[[49,54,28857],256],13161:[[49,55,28857],256],13162:[[49,56,28857],256],13163:[[49,57,28857],256],13164:[[50,48,28857],256],13165:[[50,49,28857],256],13166:[[50,50,28857],256],13167:[[50,51,28857],256],13168:[[50,52,28857],256],13169:[[104,80,97],256],13170:[[100,97],256],13171:[[65,85],256],13172:[[98,97,114],256],13173:[[111,86],256],13174:[[112,99],256],13175:[[100,109],256],13176:[[100,109,178],256],13177:[[100,109,179],256],13178:[[73,85],256],13179:[[24179,25104],256],13180:[[26157,21644],256],13181:[[22823,27491],256],13182:[[26126,27835],256],13183:[[26666,24335,20250,31038],256],13184:[[112,65],256],13185:[[110,65],256],13186:[[956,65],256],13187:[[109,65],256],13188:[[107,65],256],13189:[[75,66],256],13190:[[77,66],256],13191:[[71,66],256],13192:[[99,97,108],256],13193:[[107,99,97,108],256],13194:[[112,70],256],13195:[[110,70],256],13196:[[956,70],256],13197:[[956,103],256],13198:[[109,103],256],13199:[[107,103],256],13200:[[72,122],256],13201:[[107,72,122],256],13202:[[77,72,122],256],13203:[[71,72,122],256],13204:[[84,72,122],256],13205:[[956,8467],256],13206:[[109,8467],256],13207:[[100,8467],256],13208:[[107,8467],256],13209:[[102,109],256],13210:[[110,109],256],13211:[[956,109],256],13212:[[109,109],256],13213:[[99,109],256],13214:[[107,109],256],13215:[[109,109,178],256],13216:[[99,109,178],256],13217:[[109,178],256],13218:[[107,109,178],256],13219:[[109,109,179],256],13220:[[99,109,179],256],13221:[[109,179],256],13222:[[107,109,179],256],13223:[[109,8725,115],256],13224:[[109,8725,115,178],256],13225:[[80,97],256],13226:[[107,80,97],256],13227:[[77,80,97],256],13228:[[71,80,97],256],13229:[[114,97,100],256],13230:[[114,97,100,8725,115],256],13231:[[114,97,100,8725,115,178],256],13232:[[112,115],256],13233:[[110,115],256],13234:[[956,115],256],13235:[[109,115],256],13236:[[112,86],256],13237:[[110,86],256],13238:[[956,86],256],13239:[[109,86],256],13240:[[107,86],256],13241:[[77,86],256],13242:[[112,87],256],13243:[[110,87],256],13244:[[956,87],256],13245:[[109,87],256],13246:[[107,87],256],13247:[[77,87],256],13248:[[107,937],256],13249:[[77,937],256],13250:[[97,46,109,46],256],13251:[[66,113],256],13252:[[99,99],256],13253:[[99,100],256],13254:[[67,8725,107,103],256],13255:[[67,111,46],256],13256:[[100,66],256],13257:[[71,121],256],13258:[[104,97],256],13259:[[72,80],256],13260:[[105,110],256],13261:[[75,75],256],13262:[[75,77],256],13263:[[107,116],256],13264:[[108,109],256],13265:[[108,110],256],13266:[[108,111,103],256],13267:[[108,120],256],13268:[[109,98],256],13269:[[109,105,108],256],13270:[[109,111,108],256],13271:[[80,72],256],13272:[[112,46,109,46],256],13273:[[80,80,77],256],13274:[[80,82],256],13275:[[115,114],256],13276:[[83,118],256],13277:[[87,98],256],13278:[[86,8725,109],256],13279:[[65,8725,109],256],13280:[[49,26085],256],13281:[[50,26085],256],13282:[[51,26085],256],13283:[[52,26085],256],13284:[[53,26085],256],13285:[[54,26085],256],13286:[[55,26085],256],13287:[[56,26085],256],13288:[[57,26085],256],13289:[[49,48,26085],256],13290:[[49,49,26085],256],13291:[[49,50,26085],256],13292:[[49,51,26085],256],13293:[[49,52,26085],256],13294:[[49,53,26085],256],13295:[[49,54,26085],256],13296:[[49,55,26085],256],13297:[[49,56,26085],256],13298:[[49,57,26085],256],13299:[[50,48,26085],256],13300:[[50,49,26085],256],13301:[[50,50,26085],256],13302:[[50,51,26085],256],13303:[[50,52,26085],256],13304:[[50,53,26085],256],13305:[[50,54,26085],256],13306:[[50,55,26085],256],13307:[[50,56,26085],256],13308:[[50,57,26085],256],13309:[[51,48,26085],256],13310:[[51,49,26085],256],13311:[[103,97,108],256]},27136:{92912:[,1],92913:[,1],92914:[,1],92915:[,1],92916:[,1]},27392:{92976:[,230],92977:[,230],92978:[,230],92979:[,230],92980:[,230],92981:[,230],92982:[,230]},42496:{42607:[,230],42612:[,230],42613:[,230],42614:[,230],42615:[,230],42616:[,230],42617:[,230],42618:[,230],42619:[,230],42620:[,230],42621:[,230],42652:[[1098],256],42653:[[1100],256],42655:[,230],42736:[,230],42737:[,230]},42752:{42864:[[42863],256],43e3:[[294],256],43001:[[339],256]},43008:{43014:[,9],43204:[,9],43232:[,230],43233:[,230],43234:[,230],43235:[,230],43236:[,230],43237:[,230],43238:[,230],43239:[,230],43240:[,230],43241:[,230],43242:[,230],43243:[,230],43244:[,230],43245:[,230],43246:[,230],43247:[,230],43248:[,230],43249:[,230]},43264:{43307:[,220],43308:[,220],43309:[,220],43347:[,9],43443:[,7],43456:[,9]},43520:{43696:[,230],43698:[,230],43699:[,230],43700:[,220],43703:[,230],43704:[,230],43710:[,230],43711:[,230],43713:[,230],43766:[,9]},43776:{43868:[[42791],256],43869:[[43831],256],43870:[[619],256],43871:[[43858],256],44013:[,9]},48128:{113822:[,1]},53504:{119134:[[119127,119141],512],119135:[[119128,119141],512],119136:[[119135,119150],512],119137:[[119135,119151],512],119138:[[119135,119152],512],119139:[[119135,119153],512],119140:[[119135,119154],512],119141:[,216],119142:[,216],119143:[,1],119144:[,1],119145:[,1],119149:[,226],119150:[,216],119151:[,216],119152:[,216],119153:[,216],119154:[,216],119163:[,220],119164:[,220],119165:[,220],119166:[,220],119167:[,220],119168:[,220],119169:[,220],119170:[,220],119173:[,230],119174:[,230],119175:[,230],119176:[,230],119177:[,230],119178:[,220],119179:[,220],119210:[,230],119211:[,230],119212:[,230],119213:[,230],119227:[[119225,119141],512],119228:[[119226,119141],512],119229:[[119227,119150],512],119230:[[119228,119150],512],119231:[[119227,119151],512],119232:[[119228,119151],512]},53760:{119362:[,230],119363:[,230],119364:[,230]},54272:{119808:[[65],256],119809:[[66],256],119810:[[67],256],119811:[[68],256],119812:[[69],256],119813:[[70],256],119814:[[71],256],119815:[[72],256],119816:[[73],256],119817:[[74],256],119818:[[75],256],119819:[[76],256],119820:[[77],256],119821:[[78],256],119822:[[79],256],119823:[[80],256],119824:[[81],256],119825:[[82],256],119826:[[83],256],119827:[[84],256],119828:[[85],256],119829:[[86],256],119830:[[87],256],119831:[[88],256],119832:[[89],256],119833:[[90],256],119834:[[97],256],119835:[[98],256],119836:[[99],256],119837:[[100],256],119838:[[101],256],119839:[[102],256],119840:[[103],256],119841:[[104],256],119842:[[105],256],119843:[[106],256],119844:[[107],256],119845:[[108],256],119846:[[109],256],119847:[[110],256],119848:[[111],256],119849:[[112],256],119850:[[113],256],119851:[[114],256],119852:[[115],256],119853:[[116],256],119854:[[117],256],119855:[[118],256],119856:[[119],256],119857:[[120],256],119858:[[121],256],119859:[[122],256],119860:[[65],256],119861:[[66],256],119862:[[67],256],119863:[[68],256],119864:[[69],256],119865:[[70],256],119866:[[71],256],119867:[[72],256],119868:[[73],256],119869:[[74],256],119870:[[75],256],119871:[[76],256],119872:[[77],256],119873:[[78],256],119874:[[79],256],119875:[[80],256],119876:[[81],256],119877:[[82],256],119878:[[83],256],119879:[[84],256],119880:[[85],256],119881:[[86],256],119882:[[87],256],119883:[[88],256],119884:[[89],256],119885:[[90],256],119886:[[97],256],119887:[[98],256],119888:[[99],256],119889:[[100],256],119890:[[101],256],119891:[[102],256],119892:[[103],256],119894:[[105],256],119895:[[106],256],119896:[[107],256],119897:[[108],256],119898:[[109],256],119899:[[110],256],119900:[[111],256],119901:[[112],256],119902:[[113],256],119903:[[114],256],119904:[[115],256],119905:[[116],256],119906:[[117],256],119907:[[118],256],119908:[[119],256],119909:[[120],256],119910:[[121],256],119911:[[122],256],119912:[[65],256],119913:[[66],256],119914:[[67],256],119915:[[68],256],119916:[[69],256],119917:[[70],256],119918:[[71],256],119919:[[72],256],119920:[[73],256],119921:[[74],256],119922:[[75],256],119923:[[76],256],119924:[[77],256],119925:[[78],256],119926:[[79],256],119927:[[80],256],119928:[[81],256],119929:[[82],256],119930:[[83],256],119931:[[84],256],119932:[[85],256],119933:[[86],256],119934:[[87],256],119935:[[88],256],119936:[[89],256],119937:[[90],256],119938:[[97],256],119939:[[98],256],119940:[[99],256],119941:[[100],256],119942:[[101],256],119943:[[102],256],119944:[[103],256],119945:[[104],256],119946:[[105],256],119947:[[106],256],119948:[[107],256],119949:[[108],256],119950:[[109],256],119951:[[110],256],119952:[[111],256],119953:[[112],256],119954:[[113],256],119955:[[114],256],119956:[[115],256],119957:[[116],256],119958:[[117],256],119959:[[118],256],119960:[[119],256],119961:[[120],256],119962:[[121],256],119963:[[122],256],119964:[[65],256],119966:[[67],256],119967:[[68],256],119970:[[71],256],119973:[[74],256],119974:[[75],256],119977:[[78],256],119978:[[79],256],119979:[[80],256],119980:[[81],256],119982:[[83],256],119983:[[84],256],119984:[[85],256],119985:[[86],256],119986:[[87],256],119987:[[88],256],119988:[[89],256],119989:[[90],256],119990:[[97],256],119991:[[98],256],119992:[[99],256],119993:[[100],256],119995:[[102],256],119997:[[104],256],119998:[[105],256],119999:[[106],256],12e4:[[107],256],120001:[[108],256],120002:[[109],256],120003:[[110],256],120005:[[112],256],120006:[[113],256],120007:[[114],256],120008:[[115],256],120009:[[116],256],120010:[[117],256],120011:[[118],256],120012:[[119],256],120013:[[120],256],120014:[[121],256],120015:[[122],256],120016:[[65],256],120017:[[66],256],120018:[[67],256],120019:[[68],256],120020:[[69],256],120021:[[70],256],120022:[[71],256],120023:[[72],256],120024:[[73],256],120025:[[74],256],120026:[[75],256],120027:[[76],256],120028:[[77],256],120029:[[78],256],120030:[[79],256],120031:[[80],256],120032:[[81],256],120033:[[82],256],120034:[[83],256],120035:[[84],256],120036:[[85],256],120037:[[86],256],120038:[[87],256],120039:[[88],256],120040:[[89],256],120041:[[90],256],120042:[[97],256],120043:[[98],256],120044:[[99],256],120045:[[100],256],120046:[[101],256],120047:[[102],256],120048:[[103],256],120049:[[104],256],120050:[[105],256],120051:[[106],256],120052:[[107],256],120053:[[108],256],120054:[[109],256],120055:[[110],256],120056:[[111],256],120057:[[112],256],120058:[[113],256],120059:[[114],256],120060:[[115],256],120061:[[116],256],120062:[[117],256],120063:[[118],256]},54528:{120064:[[119],256],120065:[[120],256],120066:[[121],256],120067:[[122],256],120068:[[65],256],120069:[[66],256],120071:[[68],256],120072:[[69],256],120073:[[70],256],120074:[[71],256],120077:[[74],256],120078:[[75],256],120079:[[76],256],120080:[[77],256],120081:[[78],256],120082:[[79],256],120083:[[80],256],120084:[[81],256],120086:[[83],256],120087:[[84],256],120088:[[85],256],120089:[[86],256],120090:[[87],256],120091:[[88],256],120092:[[89],256],120094:[[97],256],120095:[[98],256],120096:[[99],256],120097:[[100],256],120098:[[101],256],120099:[[102],256],120100:[[103],256],120101:[[104],256],120102:[[105],256],120103:[[106],256],120104:[[107],256],120105:[[108],256],120106:[[109],256],120107:[[110],256],120108:[[111],256],120109:[[112],256],120110:[[113],256],120111:[[114],256],120112:[[115],256],120113:[[116],256],120114:[[117],256],120115:[[118],256],120116:[[119],256],120117:[[120],256],120118:[[121],256],120119:[[122],256],120120:[[65],256],120121:[[66],256],120123:[[68],256],120124:[[69],256],120125:[[70],256],120126:[[71],256],120128:[[73],256],120129:[[74],256],120130:[[75],256],120131:[[76],256],120132:[[77],256],120134:[[79],256],120138:[[83],256],120139:[[84],256],120140:[[85],256],120141:[[86],256],120142:[[87],256],120143:[[88],256],120144:[[89],256],120146:[[97],256],120147:[[98],256],120148:[[99],256],120149:[[100],256],120150:[[101],256],120151:[[102],256],120152:[[103],256],120153:[[104],256],120154:[[105],256],120155:[[106],256],120156:[[107],256],120157:[[108],256],120158:[[109],256],120159:[[110],256],120160:[[111],256],120161:[[112],256],120162:[[113],256],120163:[[114],256],120164:[[115],256],120165:[[116],256],120166:[[117],256],120167:[[118],256],120168:[[119],256],120169:[[120],256],120170:[[121],256],120171:[[122],256],120172:[[65],256],120173:[[66],256],120174:[[67],256],120175:[[68],256],120176:[[69],256],120177:[[70],256],120178:[[71],256],120179:[[72],256],120180:[[73],256],120181:[[74],256],120182:[[75],256],120183:[[76],256],120184:[[77],256],120185:[[78],256],120186:[[79],256],120187:[[80],256],120188:[[81],256],120189:[[82],256],120190:[[83],256],120191:[[84],256],120192:[[85],256],120193:[[86],256],120194:[[87],256],120195:[[88],256],120196:[[89],256],120197:[[90],256],120198:[[97],256],120199:[[98],256],120200:[[99],256],120201:[[100],256],120202:[[101],256],120203:[[102],256],120204:[[103],256],120205:[[104],256],120206:[[105],256],120207:[[106],256],120208:[[107],256],120209:[[108],256],120210:[[109],256],120211:[[110],256],120212:[[111],256],120213:[[112],256],120214:[[113],256],120215:[[114],256],120216:[[115],256],120217:[[116],256],120218:[[117],256],120219:[[118],256],120220:[[119],256],120221:[[120],256],120222:[[121],256],120223:[[122],256],120224:[[65],256],120225:[[66],256],120226:[[67],256],120227:[[68],256],120228:[[69],256],120229:[[70],256],120230:[[71],256],120231:[[72],256],120232:[[73],256],120233:[[74],256],120234:[[75],256],120235:[[76],256],120236:[[77],256],120237:[[78],256],120238:[[79],256],120239:[[80],256],120240:[[81],256],120241:[[82],256],120242:[[83],256],120243:[[84],256],120244:[[85],256],120245:[[86],256],120246:[[87],256],120247:[[88],256],120248:[[89],256],120249:[[90],256],120250:[[97],256],120251:[[98],256],120252:[[99],256],120253:[[100],256],120254:[[101],256],120255:[[102],256],120256:[[103],256],120257:[[104],256],120258:[[105],256],120259:[[106],256],120260:[[107],256],120261:[[108],256],120262:[[109],256],120263:[[110],256],120264:[[111],256],120265:[[112],256],120266:[[113],256],120267:[[114],256],120268:[[115],256],120269:[[116],256],120270:[[117],256],120271:[[118],256],120272:[[119],256],120273:[[120],256],120274:[[121],256],120275:[[122],256],120276:[[65],256],120277:[[66],256],120278:[[67],256],120279:[[68],256],120280:[[69],256],120281:[[70],256],120282:[[71],256],120283:[[72],256],120284:[[73],256],120285:[[74],256],120286:[[75],256],120287:[[76],256],120288:[[77],256],120289:[[78],256],120290:[[79],256],120291:[[80],256],120292:[[81],256],120293:[[82],256],120294:[[83],256],120295:[[84],256],120296:[[85],256],120297:[[86],256],120298:[[87],256],120299:[[88],256],120300:[[89],256],120301:[[90],256],120302:[[97],256],120303:[[98],256],120304:[[99],256],120305:[[100],256],120306:[[101],256],120307:[[102],256],120308:[[103],256],120309:[[104],256],120310:[[105],256],120311:[[106],256],120312:[[107],256],120313:[[108],256],120314:[[109],256],120315:[[110],256],120316:[[111],256],120317:[[112],256],120318:[[113],256],120319:[[114],256]},54784:{120320:[[115],256],120321:[[116],256],120322:[[117],256],120323:[[118],256],120324:[[119],256],120325:[[120],256],120326:[[121],256],120327:[[122],256],120328:[[65],256],120329:[[66],256],120330:[[67],256],120331:[[68],256],120332:[[69],256],120333:[[70],256],120334:[[71],256],120335:[[72],256],120336:[[73],256],120337:[[74],256],120338:[[75],256],120339:[[76],256],120340:[[77],256],120341:[[78],256],120342:[[79],256],120343:[[80],256],120344:[[81],256],120345:[[82],256],120346:[[83],256],120347:[[84],256],120348:[[85],256],120349:[[86],256],120350:[[87],256],120351:[[88],256],120352:[[89],256],120353:[[90],256],120354:[[97],256],120355:[[98],256],120356:[[99],256],120357:[[100],256],120358:[[101],256],120359:[[102],256],120360:[[103],256],120361:[[104],256],120362:[[105],256],120363:[[106],256],120364:[[107],256],120365:[[108],256],120366:[[109],256],120367:[[110],256],120368:[[111],256],120369:[[112],256],120370:[[113],256],120371:[[114],256],120372:[[115],256],120373:[[116],256],120374:[[117],256],120375:[[118],256],120376:[[119],256],120377:[[120],256],120378:[[121],256],120379:[[122],256],120380:[[65],256],120381:[[66],256],120382:[[67],256],120383:[[68],256],120384:[[69],256],120385:[[70],256],120386:[[71],256],120387:[[72],256],120388:[[73],256],120389:[[74],256],120390:[[75],256],120391:[[76],256],120392:[[77],256],120393:[[78],256],120394:[[79],256],120395:[[80],256],120396:[[81],256],120397:[[82],256],120398:[[83],256],120399:[[84],256],120400:[[85],256],120401:[[86],256],120402:[[87],256],120403:[[88],256],120404:[[89],256],120405:[[90],256],120406:[[97],256],120407:[[98],256],120408:[[99],256],120409:[[100],256],120410:[[101],256],120411:[[102],256],120412:[[103],256],120413:[[104],256],120414:[[105],256],120415:[[106],256],120416:[[107],256],120417:[[108],256],120418:[[109],256],120419:[[110],256],120420:[[111],256],120421:[[112],256],120422:[[113],256],120423:[[114],256],120424:[[115],256],120425:[[116],256],120426:[[117],256],120427:[[118],256],120428:[[119],256],120429:[[120],256],120430:[[121],256],120431:[[122],256],120432:[[65],256],120433:[[66],256],120434:[[67],256],120435:[[68],256],120436:[[69],256],120437:[[70],256],120438:[[71],256],120439:[[72],256],120440:[[73],256],120441:[[74],256],120442:[[75],256],120443:[[76],256],120444:[[77],256],120445:[[78],256],120446:[[79],256],120447:[[80],256],120448:[[81],256],120449:[[82],256],120450:[[83],256],120451:[[84],256],120452:[[85],256],120453:[[86],256],120454:[[87],256],120455:[[88],256],120456:[[89],256],120457:[[90],256],120458:[[97],256],120459:[[98],256],120460:[[99],256],120461:[[100],256],120462:[[101],256],120463:[[102],256],120464:[[103],256],120465:[[104],256],120466:[[105],256],120467:[[106],256],120468:[[107],256],120469:[[108],256],120470:[[109],256],120471:[[110],256],120472:[[111],256],120473:[[112],256],120474:[[113],256],120475:[[114],256],120476:[[115],256],120477:[[116],256],120478:[[117],256],120479:[[118],256],120480:[[119],256],120481:[[120],256],120482:[[121],256],120483:[[122],256],120484:[[305],256],120485:[[567],256],120488:[[913],256],120489:[[914],256],120490:[[915],256],120491:[[916],256],120492:[[917],256],120493:[[918],256],120494:[[919],256],120495:[[920],256],120496:[[921],256],120497:[[922],256],120498:[[923],256],120499:[[924],256],120500:[[925],256],120501:[[926],256],120502:[[927],256],120503:[[928],256],120504:[[929],256],120505:[[1012],256],120506:[[931],256],120507:[[932],256],120508:[[933],256],120509:[[934],256],120510:[[935],256],120511:[[936],256],120512:[[937],256],120513:[[8711],256],120514:[[945],256],120515:[[946],256],120516:[[947],256],120517:[[948],256],120518:[[949],256],120519:[[950],256],120520:[[951],256],120521:[[952],256],120522:[[953],256],120523:[[954],256],120524:[[955],256],120525:[[956],256],120526:[[957],256],120527:[[958],256],120528:[[959],256],120529:[[960],256],120530:[[961],256],120531:[[962],256],120532:[[963],256],120533:[[964],256],120534:[[965],256],120535:[[966],256],120536:[[967],256],120537:[[968],256],120538:[[969],256],120539:[[8706],256],120540:[[1013],256],120541:[[977],256],120542:[[1008],256],120543:[[981],256],120544:[[1009],256],120545:[[982],256],120546:[[913],256],120547:[[914],256],120548:[[915],256],120549:[[916],256],120550:[[917],256],120551:[[918],256],120552:[[919],256],120553:[[920],256],120554:[[921],256],120555:[[922],256],120556:[[923],256],120557:[[924],256],120558:[[925],256],120559:[[926],256],120560:[[927],256],120561:[[928],256],120562:[[929],256],120563:[[1012],256],120564:[[931],256],120565:[[932],256],120566:[[933],256],120567:[[934],256],120568:[[935],256],120569:[[936],256],120570:[[937],256],120571:[[8711],256],120572:[[945],256],120573:[[946],256],120574:[[947],256],120575:[[948],256]},55040:{120576:[[949],256],120577:[[950],256],120578:[[951],256],120579:[[952],256],120580:[[953],256],120581:[[954],256],120582:[[955],256],120583:[[956],256],120584:[[957],256],120585:[[958],256],120586:[[959],256],120587:[[960],256],120588:[[961],256],120589:[[962],256],120590:[[963],256],120591:[[964],256],120592:[[965],256],120593:[[966],256],120594:[[967],256],120595:[[968],256],120596:[[969],256],120597:[[8706],256],120598:[[1013],256],120599:[[977],256],120600:[[1008],256],120601:[[981],256],120602:[[1009],256],120603:[[982],256],120604:[[913],256],120605:[[914],256],120606:[[915],256],120607:[[916],256],120608:[[917],256],120609:[[918],256],120610:[[919],256],120611:[[920],256],120612:[[921],256],120613:[[922],256],120614:[[923],256],120615:[[924],256],120616:[[925],256],120617:[[926],256],120618:[[927],256],120619:[[928],256],120620:[[929],256],120621:[[1012],256],120622:[[931],256],120623:[[932],256],120624:[[933],256],120625:[[934],256],120626:[[935],256],120627:[[936],256],120628:[[937],256],120629:[[8711],256],120630:[[945],256],120631:[[946],256],120632:[[947],256],120633:[[948],256],120634:[[949],256],120635:[[950],256],120636:[[951],256],120637:[[952],256],120638:[[953],256],120639:[[954],256],120640:[[955],256],120641:[[956],256],120642:[[957],256],120643:[[958],256],120644:[[959],256],120645:[[960],256],120646:[[961],256],120647:[[962],256],120648:[[963],256],120649:[[964],256],120650:[[965],256],120651:[[966],256],120652:[[967],256],120653:[[968],256],120654:[[969],256],120655:[[8706],256],120656:[[1013],256],120657:[[977],256],120658:[[1008],256],120659:[[981],256],120660:[[1009],256],120661:[[982],256],120662:[[913],256],120663:[[914],256],120664:[[915],256],120665:[[916],256],120666:[[917],256],120667:[[918],256],120668:[[919],256],120669:[[920],256],120670:[[921],256],120671:[[922],256],120672:[[923],256],120673:[[924],256],120674:[[925],256],120675:[[926],256],120676:[[927],256],120677:[[928],256],120678:[[929],256],120679:[[1012],256],120680:[[931],256],120681:[[932],256],120682:[[933],256],120683:[[934],256],120684:[[935],256],120685:[[936],256],120686:[[937],256],120687:[[8711],256],120688:[[945],256],120689:[[946],256],120690:[[947],256],120691:[[948],256],120692:[[949],256],120693:[[950],256],120694:[[951],256],120695:[[952],256],120696:[[953],256],120697:[[954],256],120698:[[955],256],120699:[[956],256],120700:[[957],256],120701:[[958],256],120702:[[959],256],120703:[[960],256],120704:[[961],256],120705:[[962],256],120706:[[963],256],120707:[[964],256],120708:[[965],256],120709:[[966],256],120710:[[967],256],120711:[[968],256],120712:[[969],256],120713:[[8706],256],120714:[[1013],256],120715:[[977],256],120716:[[1008],256],120717:[[981],256],120718:[[1009],256],120719:[[982],256],120720:[[913],256],120721:[[914],256],120722:[[915],256],120723:[[916],256],120724:[[917],256],120725:[[918],256],120726:[[919],256],120727:[[920],256],120728:[[921],256],120729:[[922],256],120730:[[923],256],120731:[[924],256],120732:[[925],256],120733:[[926],256],120734:[[927],256],120735:[[928],256],120736:[[929],256],120737:[[1012],256],120738:[[931],256],120739:[[932],256],120740:[[933],256],120741:[[934],256],120742:[[935],256],120743:[[936],256],120744:[[937],256],120745:[[8711],256],120746:[[945],256],120747:[[946],256],120748:[[947],256],120749:[[948],256],120750:[[949],256],120751:[[950],256],120752:[[951],256],120753:[[952],256],120754:[[953],256],120755:[[954],256],120756:[[955],256],120757:[[956],256],120758:[[957],256],120759:[[958],256],120760:[[959],256],120761:[[960],256],120762:[[961],256],120763:[[962],256],120764:[[963],256],120765:[[964],256],120766:[[965],256],120767:[[966],256],120768:[[967],256],120769:[[968],256],120770:[[969],256],120771:[[8706],256],120772:[[1013],256], 120773:[[977],256],120774:[[1008],256],120775:[[981],256],120776:[[1009],256],120777:[[982],256],120778:[[988],256],120779:[[989],256],120782:[[48],256],120783:[[49],256],120784:[[50],256],120785:[[51],256],120786:[[52],256],120787:[[53],256],120788:[[54],256],120789:[[55],256],120790:[[56],256],120791:[[57],256],120792:[[48],256],120793:[[49],256],120794:[[50],256],120795:[[51],256],120796:[[52],256],120797:[[53],256],120798:[[54],256],120799:[[55],256],120800:[[56],256],120801:[[57],256],120802:[[48],256],120803:[[49],256],120804:[[50],256],120805:[[51],256],120806:[[52],256],120807:[[53],256],120808:[[54],256],120809:[[55],256],120810:[[56],256],120811:[[57],256],120812:[[48],256],120813:[[49],256],120814:[[50],256],120815:[[51],256],120816:[[52],256],120817:[[53],256],120818:[[54],256],120819:[[55],256],120820:[[56],256],120821:[[57],256],120822:[[48],256],120823:[[49],256],120824:[[50],256],120825:[[51],256],120826:[[52],256],120827:[[53],256],120828:[[54],256],120829:[[55],256],120830:[[56],256],120831:[[57],256]},59392:{125136:[,220],125137:[,220],125138:[,220],125139:[,220],125140:[,220],125141:[,220],125142:[,220]},60928:{126464:[[1575],256],126465:[[1576],256],126466:[[1580],256],126467:[[1583],256],126469:[[1608],256],126470:[[1586],256],126471:[[1581],256],126472:[[1591],256],126473:[[1610],256],126474:[[1603],256],126475:[[1604],256],126476:[[1605],256],126477:[[1606],256],126478:[[1587],256],126479:[[1593],256],126480:[[1601],256],126481:[[1589],256],126482:[[1602],256],126483:[[1585],256],126484:[[1588],256],126485:[[1578],256],126486:[[1579],256],126487:[[1582],256],126488:[[1584],256],126489:[[1590],256],126490:[[1592],256],126491:[[1594],256],126492:[[1646],256],126493:[[1722],256],126494:[[1697],256],126495:[[1647],256],126497:[[1576],256],126498:[[1580],256],126500:[[1607],256],126503:[[1581],256],126505:[[1610],256],126506:[[1603],256],126507:[[1604],256],126508:[[1605],256],126509:[[1606],256],126510:[[1587],256],126511:[[1593],256],126512:[[1601],256],126513:[[1589],256],126514:[[1602],256],126516:[[1588],256],126517:[[1578],256],126518:[[1579],256],126519:[[1582],256],126521:[[1590],256],126523:[[1594],256],126530:[[1580],256],126535:[[1581],256],126537:[[1610],256],126539:[[1604],256],126541:[[1606],256],126542:[[1587],256],126543:[[1593],256],126545:[[1589],256],126546:[[1602],256],126548:[[1588],256],126551:[[1582],256],126553:[[1590],256],126555:[[1594],256],126557:[[1722],256],126559:[[1647],256],126561:[[1576],256],126562:[[1580],256],126564:[[1607],256],126567:[[1581],256],126568:[[1591],256],126569:[[1610],256],126570:[[1603],256],126572:[[1605],256],126573:[[1606],256],126574:[[1587],256],126575:[[1593],256],126576:[[1601],256],126577:[[1589],256],126578:[[1602],256],126580:[[1588],256],126581:[[1578],256],126582:[[1579],256],126583:[[1582],256],126585:[[1590],256],126586:[[1592],256],126587:[[1594],256],126588:[[1646],256],126590:[[1697],256],126592:[[1575],256],126593:[[1576],256],126594:[[1580],256],126595:[[1583],256],126596:[[1607],256],126597:[[1608],256],126598:[[1586],256],126599:[[1581],256],126600:[[1591],256],126601:[[1610],256],126603:[[1604],256],126604:[[1605],256],126605:[[1606],256],126606:[[1587],256],126607:[[1593],256],126608:[[1601],256],126609:[[1589],256],126610:[[1602],256],126611:[[1585],256],126612:[[1588],256],126613:[[1578],256],126614:[[1579],256],126615:[[1582],256],126616:[[1584],256],126617:[[1590],256],126618:[[1592],256],126619:[[1594],256],126625:[[1576],256],126626:[[1580],256],126627:[[1583],256],126629:[[1608],256],126630:[[1586],256],126631:[[1581],256],126632:[[1591],256],126633:[[1610],256],126635:[[1604],256],126636:[[1605],256],126637:[[1606],256],126638:[[1587],256],126639:[[1593],256],126640:[[1601],256],126641:[[1589],256],126642:[[1602],256],126643:[[1585],256],126644:[[1588],256],126645:[[1578],256],126646:[[1579],256],126647:[[1582],256],126648:[[1584],256],126649:[[1590],256],126650:[[1592],256],126651:[[1594],256]},61696:{127232:[[48,46],256],127233:[[48,44],256],127234:[[49,44],256],127235:[[50,44],256],127236:[[51,44],256],127237:[[52,44],256],127238:[[53,44],256],127239:[[54,44],256],127240:[[55,44],256],127241:[[56,44],256],127242:[[57,44],256],127248:[[40,65,41],256],127249:[[40,66,41],256],127250:[[40,67,41],256],127251:[[40,68,41],256],127252:[[40,69,41],256],127253:[[40,70,41],256],127254:[[40,71,41],256],127255:[[40,72,41],256],127256:[[40,73,41],256],127257:[[40,74,41],256],127258:[[40,75,41],256],127259:[[40,76,41],256],127260:[[40,77,41],256],127261:[[40,78,41],256],127262:[[40,79,41],256],127263:[[40,80,41],256],127264:[[40,81,41],256],127265:[[40,82,41],256],127266:[[40,83,41],256],127267:[[40,84,41],256],127268:[[40,85,41],256],127269:[[40,86,41],256],127270:[[40,87,41],256],127271:[[40,88,41],256],127272:[[40,89,41],256],127273:[[40,90,41],256],127274:[[12308,83,12309],256],127275:[[67],256],127276:[[82],256],127277:[[67,68],256],127278:[[87,90],256],127280:[[65],256],127281:[[66],256],127282:[[67],256],127283:[[68],256],127284:[[69],256],127285:[[70],256],127286:[[71],256],127287:[[72],256],127288:[[73],256],127289:[[74],256],127290:[[75],256],127291:[[76],256],127292:[[77],256],127293:[[78],256],127294:[[79],256],127295:[[80],256],127296:[[81],256],127297:[[82],256],127298:[[83],256],127299:[[84],256],127300:[[85],256],127301:[[86],256],127302:[[87],256],127303:[[88],256],127304:[[89],256],127305:[[90],256],127306:[[72,86],256],127307:[[77,86],256],127308:[[83,68],256],127309:[[83,83],256],127310:[[80,80,86],256],127311:[[87,67],256],127338:[[77,67],256],127339:[[77,68],256],127376:[[68,74],256]},61952:{127488:[[12411,12363],256],127489:[[12467,12467],256],127490:[[12469],256],127504:[[25163],256],127505:[[23383],256],127506:[[21452],256],127507:[[12487],256],127508:[[20108],256],127509:[[22810],256],127510:[[35299],256],127511:[[22825],256],127512:[[20132],256],127513:[[26144],256],127514:[[28961],256],127515:[[26009],256],127516:[[21069],256],127517:[[24460],256],127518:[[20877],256],127519:[[26032],256],127520:[[21021],256],127521:[[32066],256],127522:[[29983],256],127523:[[36009],256],127524:[[22768],256],127525:[[21561],256],127526:[[28436],256],127527:[[25237],256],127528:[[25429],256],127529:[[19968],256],127530:[[19977],256],127531:[[36938],256],127532:[[24038],256],127533:[[20013],256],127534:[[21491],256],127535:[[25351],256],127536:[[36208],256],127537:[[25171],256],127538:[[31105],256],127539:[[31354],256],127540:[[21512],256],127541:[[28288],256],127542:[[26377],256],127543:[[26376],256],127544:[[30003],256],127545:[[21106],256],127546:[[21942],256],127552:[[12308,26412,12309],256],127553:[[12308,19977,12309],256],127554:[[12308,20108,12309],256],127555:[[12308,23433,12309],256],127556:[[12308,28857,12309],256],127557:[[12308,25171,12309],256],127558:[[12308,30423,12309],256],127559:[[12308,21213,12309],256],127560:[[12308,25943,12309],256],127568:[[24471],256],127569:[[21487],256]},63488:{194560:[[20029]],194561:[[20024]],194562:[[20033]],194563:[[131362]],194564:[[20320]],194565:[[20398]],194566:[[20411]],194567:[[20482]],194568:[[20602]],194569:[[20633]],194570:[[20711]],194571:[[20687]],194572:[[13470]],194573:[[132666]],194574:[[20813]],194575:[[20820]],194576:[[20836]],194577:[[20855]],194578:[[132380]],194579:[[13497]],194580:[[20839]],194581:[[20877]],194582:[[132427]],194583:[[20887]],194584:[[20900]],194585:[[20172]],194586:[[20908]],194587:[[20917]],194588:[[168415]],194589:[[20981]],194590:[[20995]],194591:[[13535]],194592:[[21051]],194593:[[21062]],194594:[[21106]],194595:[[21111]],194596:[[13589]],194597:[[21191]],194598:[[21193]],194599:[[21220]],194600:[[21242]],194601:[[21253]],194602:[[21254]],194603:[[21271]],194604:[[21321]],194605:[[21329]],194606:[[21338]],194607:[[21363]],194608:[[21373]],194609:[[21375]],194610:[[21375]],194611:[[21375]],194612:[[133676]],194613:[[28784]],194614:[[21450]],194615:[[21471]],194616:[[133987]],194617:[[21483]],194618:[[21489]],194619:[[21510]],194620:[[21662]],194621:[[21560]],194622:[[21576]],194623:[[21608]],194624:[[21666]],194625:[[21750]],194626:[[21776]],194627:[[21843]],194628:[[21859]],194629:[[21892]],194630:[[21892]],194631:[[21913]],194632:[[21931]],194633:[[21939]],194634:[[21954]],194635:[[22294]],194636:[[22022]],194637:[[22295]],194638:[[22097]],194639:[[22132]],194640:[[20999]],194641:[[22766]],194642:[[22478]],194643:[[22516]],194644:[[22541]],194645:[[22411]],194646:[[22578]],194647:[[22577]],194648:[[22700]],194649:[[136420]],194650:[[22770]],194651:[[22775]],194652:[[22790]],194653:[[22810]],194654:[[22818]],194655:[[22882]],194656:[[136872]],194657:[[136938]],194658:[[23020]],194659:[[23067]],194660:[[23079]],194661:[[23e3]],194662:[[23142]],194663:[[14062]],194664:[[14076]],194665:[[23304]],194666:[[23358]],194667:[[23358]],194668:[[137672]],194669:[[23491]],194670:[[23512]],194671:[[23527]],194672:[[23539]],194673:[[138008]],194674:[[23551]],194675:[[23558]],194676:[[24403]],194677:[[23586]],194678:[[14209]],194679:[[23648]],194680:[[23662]],194681:[[23744]],194682:[[23693]],194683:[[138724]],194684:[[23875]],194685:[[138726]],194686:[[23918]],194687:[[23915]],194688:[[23932]],194689:[[24033]],194690:[[24034]],194691:[[14383]],194692:[[24061]],194693:[[24104]],194694:[[24125]],194695:[[24169]],194696:[[14434]],194697:[[139651]],194698:[[14460]],194699:[[24240]],194700:[[24243]],194701:[[24246]],194702:[[24266]],194703:[[172946]],194704:[[24318]],194705:[[140081]],194706:[[140081]],194707:[[33281]],194708:[[24354]],194709:[[24354]],194710:[[14535]],194711:[[144056]],194712:[[156122]],194713:[[24418]],194714:[[24427]],194715:[[14563]],194716:[[24474]],194717:[[24525]],194718:[[24535]],194719:[[24569]],194720:[[24705]],194721:[[14650]],194722:[[14620]],194723:[[24724]],194724:[[141012]],194725:[[24775]],194726:[[24904]],194727:[[24908]],194728:[[24910]],194729:[[24908]],194730:[[24954]],194731:[[24974]],194732:[[25010]],194733:[[24996]],194734:[[25007]],194735:[[25054]],194736:[[25074]],194737:[[25078]],194738:[[25104]],194739:[[25115]],194740:[[25181]],194741:[[25265]],194742:[[25300]],194743:[[25424]],194744:[[142092]],194745:[[25405]],194746:[[25340]],194747:[[25448]],194748:[[25475]],194749:[[25572]],194750:[[142321]],194751:[[25634]],194752:[[25541]],194753:[[25513]],194754:[[14894]],194755:[[25705]],194756:[[25726]],194757:[[25757]],194758:[[25719]],194759:[[14956]],194760:[[25935]],194761:[[25964]],194762:[[143370]],194763:[[26083]],194764:[[26360]],194765:[[26185]],194766:[[15129]],194767:[[26257]],194768:[[15112]],194769:[[15076]],194770:[[20882]],194771:[[20885]],194772:[[26368]],194773:[[26268]],194774:[[32941]],194775:[[17369]],194776:[[26391]],194777:[[26395]],194778:[[26401]],194779:[[26462]],194780:[[26451]],194781:[[144323]],194782:[[15177]],194783:[[26618]],194784:[[26501]],194785:[[26706]],194786:[[26757]],194787:[[144493]],194788:[[26766]],194789:[[26655]],194790:[[26900]],194791:[[15261]],194792:[[26946]],194793:[[27043]],194794:[[27114]],194795:[[27304]],194796:[[145059]],194797:[[27355]],194798:[[15384]],194799:[[27425]],194800:[[145575]],194801:[[27476]],194802:[[15438]],194803:[[27506]],194804:[[27551]],194805:[[27578]],194806:[[27579]],194807:[[146061]],194808:[[138507]],194809:[[146170]],194810:[[27726]],194811:[[146620]],194812:[[27839]],194813:[[27853]],194814:[[27751]],194815:[[27926]]},63744:{63744:[[35912]],63745:[[26356]],63746:[[36554]],63747:[[36040]],63748:[[28369]],63749:[[20018]],63750:[[21477]],63751:[[40860]],63752:[[40860]],63753:[[22865]],63754:[[37329]],63755:[[21895]],63756:[[22856]],63757:[[25078]],63758:[[30313]],63759:[[32645]],63760:[[34367]],63761:[[34746]],63762:[[35064]],63763:[[37007]],63764:[[27138]],63765:[[27931]],63766:[[28889]],63767:[[29662]],63768:[[33853]],63769:[[37226]],63770:[[39409]],63771:[[20098]],63772:[[21365]],63773:[[27396]],63774:[[29211]],63775:[[34349]],63776:[[40478]],63777:[[23888]],63778:[[28651]],63779:[[34253]],63780:[[35172]],63781:[[25289]],63782:[[33240]],63783:[[34847]],63784:[[24266]],63785:[[26391]],63786:[[28010]],63787:[[29436]],63788:[[37070]],63789:[[20358]],63790:[[20919]],63791:[[21214]],63792:[[25796]],63793:[[27347]],63794:[[29200]],63795:[[30439]],63796:[[32769]],63797:[[34310]],63798:[[34396]],63799:[[36335]],63800:[[38706]],63801:[[39791]],63802:[[40442]],63803:[[30860]],63804:[[31103]],63805:[[32160]],63806:[[33737]],63807:[[37636]],63808:[[40575]],63809:[[35542]],63810:[[22751]],63811:[[24324]],63812:[[31840]],63813:[[32894]],63814:[[29282]],63815:[[30922]],63816:[[36034]],63817:[[38647]],63818:[[22744]],63819:[[23650]],63820:[[27155]],63821:[[28122]],63822:[[28431]],63823:[[32047]],63824:[[32311]],63825:[[38475]],63826:[[21202]],63827:[[32907]],63828:[[20956]],63829:[[20940]],63830:[[31260]],63831:[[32190]],63832:[[33777]],63833:[[38517]],63834:[[35712]],63835:[[25295]],63836:[[27138]],63837:[[35582]],63838:[[20025]],63839:[[23527]],63840:[[24594]],63841:[[29575]],63842:[[30064]],63843:[[21271]],63844:[[30971]],63845:[[20415]],63846:[[24489]],63847:[[19981]],63848:[[27852]],63849:[[25976]],63850:[[32034]],63851:[[21443]],63852:[[22622]],63853:[[30465]],63854:[[33865]],63855:[[35498]],63856:[[27578]],63857:[[36784]],63858:[[27784]],63859:[[25342]],63860:[[33509]],63861:[[25504]],63862:[[30053]],63863:[[20142]],63864:[[20841]],63865:[[20937]],63866:[[26753]],63867:[[31975]],63868:[[33391]],63869:[[35538]],63870:[[37327]],63871:[[21237]],63872:[[21570]],63873:[[22899]],63874:[[24300]],63875:[[26053]],63876:[[28670]],63877:[[31018]],63878:[[38317]],63879:[[39530]],63880:[[40599]],63881:[[40654]],63882:[[21147]],63883:[[26310]],63884:[[27511]],63885:[[36706]],63886:[[24180]],63887:[[24976]],63888:[[25088]],63889:[[25754]],63890:[[28451]],63891:[[29001]],63892:[[29833]],63893:[[31178]],63894:[[32244]],63895:[[32879]],63896:[[36646]],63897:[[34030]],63898:[[36899]],63899:[[37706]],63900:[[21015]],63901:[[21155]],63902:[[21693]],63903:[[28872]],63904:[[35010]],63905:[[35498]],63906:[[24265]],63907:[[24565]],63908:[[25467]],63909:[[27566]],63910:[[31806]],63911:[[29557]],63912:[[20196]],63913:[[22265]],63914:[[23527]],63915:[[23994]],63916:[[24604]],63917:[[29618]],63918:[[29801]],63919:[[32666]],63920:[[32838]],63921:[[37428]],63922:[[38646]],63923:[[38728]],63924:[[38936]],63925:[[20363]],63926:[[31150]],63927:[[37300]],63928:[[38584]],63929:[[24801]],63930:[[20102]],63931:[[20698]],63932:[[23534]],63933:[[23615]],63934:[[26009]],63935:[[27138]],63936:[[29134]],63937:[[30274]],63938:[[34044]],63939:[[36988]],63940:[[40845]],63941:[[26248]],63942:[[38446]],63943:[[21129]],63944:[[26491]],63945:[[26611]],63946:[[27969]],63947:[[28316]],63948:[[29705]],63949:[[30041]],63950:[[30827]],63951:[[32016]],63952:[[39006]],63953:[[20845]],63954:[[25134]],63955:[[38520]],63956:[[20523]],63957:[[23833]],63958:[[28138]],63959:[[36650]],63960:[[24459]],63961:[[24900]],63962:[[26647]],63963:[[29575]],63964:[[38534]],63965:[[21033]],63966:[[21519]],63967:[[23653]],63968:[[26131]],63969:[[26446]],63970:[[26792]],63971:[[27877]],63972:[[29702]],63973:[[30178]],63974:[[32633]],63975:[[35023]],63976:[[35041]],63977:[[37324]],63978:[[38626]],63979:[[21311]],63980:[[28346]],63981:[[21533]],63982:[[29136]],63983:[[29848]],63984:[[34298]],63985:[[38563]],63986:[[40023]],63987:[[40607]],63988:[[26519]],63989:[[28107]],63990:[[33256]],63991:[[31435]],63992:[[31520]],63993:[[31890]],63994:[[29376]],63995:[[28825]],63996:[[35672]],63997:[[20160]],63998:[[33590]],63999:[[21050]],194816:[[27966]],194817:[[28023]],194818:[[27969]],194819:[[28009]],194820:[[28024]],194821:[[28037]],194822:[[146718]],194823:[[27956]],194824:[[28207]],194825:[[28270]],194826:[[15667]],194827:[[28363]],194828:[[28359]],194829:[[147153]],194830:[[28153]],194831:[[28526]],194832:[[147294]],194833:[[147342]],194834:[[28614]],194835:[[28729]],194836:[[28702]],194837:[[28699]],194838:[[15766]],194839:[[28746]],194840:[[28797]],194841:[[28791]],194842:[[28845]],194843:[[132389]],194844:[[28997]],194845:[[148067]],194846:[[29084]],194847:[[148395]],194848:[[29224]],194849:[[29237]],194850:[[29264]],194851:[[149e3]],194852:[[29312]],194853:[[29333]],194854:[[149301]],194855:[[149524]],194856:[[29562]],194857:[[29579]],194858:[[16044]],194859:[[29605]],194860:[[16056]],194861:[[16056]],194862:[[29767]],194863:[[29788]],194864:[[29809]],194865:[[29829]],194866:[[29898]],194867:[[16155]],194868:[[29988]],194869:[[150582]],194870:[[30014]],194871:[[150674]],194872:[[30064]],194873:[[139679]],194874:[[30224]],194875:[[151457]],194876:[[151480]],194877:[[151620]],194878:[[16380]],194879:[[16392]],194880:[[30452]],194881:[[151795]],194882:[[151794]],194883:[[151833]],194884:[[151859]],194885:[[30494]],194886:[[30495]],194887:[[30495]],194888:[[30538]],194889:[[16441]],194890:[[30603]],194891:[[16454]],194892:[[16534]],194893:[[152605]],194894:[[30798]],194895:[[30860]],194896:[[30924]],194897:[[16611]],194898:[[153126]],194899:[[31062]],194900:[[153242]],194901:[[153285]],194902:[[31119]],194903:[[31211]],194904:[[16687]],194905:[[31296]],194906:[[31306]],194907:[[31311]],194908:[[153980]],194909:[[154279]],194910:[[154279]],194911:[[31470]],194912:[[16898]],194913:[[154539]],194914:[[31686]],194915:[[31689]],194916:[[16935]],194917:[[154752]],194918:[[31954]],194919:[[17056]],194920:[[31976]],194921:[[31971]],194922:[[32e3]],194923:[[155526]],194924:[[32099]],194925:[[17153]],194926:[[32199]],194927:[[32258]],194928:[[32325]],194929:[[17204]],194930:[[156200]],194931:[[156231]],194932:[[17241]],194933:[[156377]],194934:[[32634]],194935:[[156478]],194936:[[32661]],194937:[[32762]],194938:[[32773]],194939:[[156890]],194940:[[156963]],194941:[[32864]],194942:[[157096]],194943:[[32880]],194944:[[144223]],194945:[[17365]],194946:[[32946]],194947:[[33027]],194948:[[17419]],194949:[[33086]],194950:[[23221]],194951:[[157607]],194952:[[157621]],194953:[[144275]],194954:[[144284]],194955:[[33281]],194956:[[33284]],194957:[[36766]],194958:[[17515]],194959:[[33425]],194960:[[33419]],194961:[[33437]],194962:[[21171]],194963:[[33457]],194964:[[33459]],194965:[[33469]],194966:[[33510]],194967:[[158524]],194968:[[33509]],194969:[[33565]],194970:[[33635]],194971:[[33709]],194972:[[33571]],194973:[[33725]],194974:[[33767]],194975:[[33879]],194976:[[33619]],194977:[[33738]],194978:[[33740]],194979:[[33756]],194980:[[158774]],194981:[[159083]],194982:[[158933]],194983:[[17707]],194984:[[34033]],194985:[[34035]],194986:[[34070]],194987:[[160714]],194988:[[34148]],194989:[[159532]],194990:[[17757]],194991:[[17761]],194992:[[159665]],194993:[[159954]],194994:[[17771]],194995:[[34384]],194996:[[34396]],194997:[[34407]],194998:[[34409]],194999:[[34473]],195e3:[[34440]],195001:[[34574]],195002:[[34530]],195003:[[34681]],195004:[[34600]],195005:[[34667]],195006:[[34694]],195007:[[17879]],195008:[[34785]],195009:[[34817]],195010:[[17913]],195011:[[34912]],195012:[[34915]],195013:[[161383]],195014:[[35031]],195015:[[35038]],195016:[[17973]],195017:[[35066]],195018:[[13499]],195019:[[161966]],195020:[[162150]],195021:[[18110]],195022:[[18119]],195023:[[35488]],195024:[[35565]],195025:[[35722]],195026:[[35925]],195027:[[162984]],195028:[[36011]],195029:[[36033]],195030:[[36123]],195031:[[36215]],195032:[[163631]],195033:[[133124]],195034:[[36299]],195035:[[36284]],195036:[[36336]],195037:[[133342]],195038:[[36564]],195039:[[36664]],195040:[[165330]],195041:[[165357]],195042:[[37012]],195043:[[37105]],195044:[[37137]],195045:[[165678]],195046:[[37147]],195047:[[37432]],195048:[[37591]],195049:[[37592]],195050:[[37500]],195051:[[37881]],195052:[[37909]],195053:[[166906]],195054:[[38283]],195055:[[18837]],195056:[[38327]],195057:[[167287]],195058:[[18918]],195059:[[38595]],195060:[[23986]],195061:[[38691]],195062:[[168261]],195063:[[168474]],195064:[[19054]],195065:[[19062]],195066:[[38880]],195067:[[168970]],195068:[[19122]],195069:[[169110]],195070:[[38923]],195071:[[38923]]},64e3:{64e3:[[20999]],64001:[[24230]],64002:[[25299]],64003:[[31958]],64004:[[23429]],64005:[[27934]],64006:[[26292]],64007:[[36667]],64008:[[34892]],64009:[[38477]],64010:[[35211]],64011:[[24275]],64012:[[20800]],64013:[[21952]],64016:[[22618]],64018:[[26228]],64021:[[20958]],64022:[[29482]],64023:[[30410]],64024:[[31036]],64025:[[31070]],64026:[[31077]],64027:[[31119]],64028:[[38742]],64029:[[31934]],64030:[[32701]],64032:[[34322]],64034:[[35576]],64037:[[36920]],64038:[[37117]],64042:[[39151]],64043:[[39164]],64044:[[39208]],64045:[[40372]],64046:[[37086]],64047:[[38583]],64048:[[20398]],64049:[[20711]],64050:[[20813]],64051:[[21193]],64052:[[21220]],64053:[[21329]],64054:[[21917]],64055:[[22022]],64056:[[22120]],64057:[[22592]],64058:[[22696]],64059:[[23652]],64060:[[23662]],64061:[[24724]],64062:[[24936]],64063:[[24974]],64064:[[25074]],64065:[[25935]],64066:[[26082]],64067:[[26257]],64068:[[26757]],64069:[[28023]],64070:[[28186]],64071:[[28450]],64072:[[29038]],64073:[[29227]],64074:[[29730]],64075:[[30865]],64076:[[31038]],64077:[[31049]],64078:[[31048]],64079:[[31056]],64080:[[31062]],64081:[[31069]],64082:[[31117]],64083:[[31118]],64084:[[31296]],64085:[[31361]],64086:[[31680]],64087:[[32244]],64088:[[32265]],64089:[[32321]],64090:[[32626]],64091:[[32773]],64092:[[33261]],64093:[[33401]],64094:[[33401]],64095:[[33879]],64096:[[35088]],64097:[[35222]],64098:[[35585]],64099:[[35641]],64100:[[36051]],64101:[[36104]],64102:[[36790]],64103:[[36920]],64104:[[38627]],64105:[[38911]],64106:[[38971]],64107:[[24693]],64108:[[148206]],64109:[[33304]],64112:[[20006]],64113:[[20917]],64114:[[20840]],64115:[[20352]],64116:[[20805]],64117:[[20864]],64118:[[21191]],64119:[[21242]],64120:[[21917]],64121:[[21845]],64122:[[21913]],64123:[[21986]],64124:[[22618]],64125:[[22707]],64126:[[22852]],64127:[[22868]],64128:[[23138]],64129:[[23336]],64130:[[24274]],64131:[[24281]],64132:[[24425]],64133:[[24493]],64134:[[24792]],64135:[[24910]],64136:[[24840]],64137:[[24974]],64138:[[24928]],64139:[[25074]],64140:[[25140]],64141:[[25540]],64142:[[25628]],64143:[[25682]],64144:[[25942]],64145:[[26228]],64146:[[26391]],64147:[[26395]],64148:[[26454]],64149:[[27513]],64150:[[27578]],64151:[[27969]],64152:[[28379]],64153:[[28363]],64154:[[28450]],64155:[[28702]],64156:[[29038]],64157:[[30631]],64158:[[29237]],64159:[[29359]],64160:[[29482]],64161:[[29809]],64162:[[29958]],64163:[[30011]],64164:[[30237]],64165:[[30239]],64166:[[30410]],64167:[[30427]],64168:[[30452]],64169:[[30538]],64170:[[30528]],64171:[[30924]],64172:[[31409]],64173:[[31680]],64174:[[31867]],64175:[[32091]],64176:[[32244]],64177:[[32574]],64178:[[32773]],64179:[[33618]],64180:[[33775]],64181:[[34681]],64182:[[35137]],64183:[[35206]],64184:[[35222]],64185:[[35519]],64186:[[35576]],64187:[[35531]],64188:[[35585]],64189:[[35582]],64190:[[35565]],64191:[[35641]],64192:[[35722]],64193:[[36104]],64194:[[36664]],64195:[[36978]],64196:[[37273]],64197:[[37494]],64198:[[38524]],64199:[[38627]],64200:[[38742]],64201:[[38875]],64202:[[38911]],64203:[[38923]],64204:[[38971]],64205:[[39698]],64206:[[40860]],64207:[[141386]],64208:[[141380]],64209:[[144341]],64210:[[15261]],64211:[[16408]],64212:[[16441]],64213:[[152137]],64214:[[154832]],64215:[[163539]],64216:[[40771]],64217:[[40846]],195072:[[38953]],195073:[[169398]],195074:[[39138]],195075:[[19251]],195076:[[39209]],195077:[[39335]],195078:[[39362]],195079:[[39422]],195080:[[19406]],195081:[[170800]],195082:[[39698]],195083:[[4e4]],195084:[[40189]],195085:[[19662]],195086:[[19693]],195087:[[40295]],195088:[[172238]],195089:[[19704]],195090:[[172293]],195091:[[172558]],195092:[[172689]],195093:[[40635]],195094:[[19798]],195095:[[40697]],195096:[[40702]],195097:[[40709]],195098:[[40719]],195099:[[40726]],195100:[[40763]],195101:[[173568]]},64256:{64256:[[102,102],256],64257:[[102,105],256],64258:[[102,108],256],64259:[[102,102,105],256],64260:[[102,102,108],256],64261:[[383,116],256],64262:[[115,116],256],64275:[[1396,1398],256],64276:[[1396,1381],256],64277:[[1396,1387],256],64278:[[1406,1398],256],64279:[[1396,1389],256],64285:[[1497,1460],512],64286:[,26],64287:[[1522,1463],512],64288:[[1506],256],64289:[[1488],256],64290:[[1491],256],64291:[[1492],256],64292:[[1499],256],64293:[[1500],256],64294:[[1501],256],64295:[[1512],256],64296:[[1514],256],64297:[[43],256],64298:[[1513,1473],512],64299:[[1513,1474],512],64300:[[64329,1473],512],64301:[[64329,1474],512],64302:[[1488,1463],512],64303:[[1488,1464],512],64304:[[1488,1468],512],64305:[[1489,1468],512],64306:[[1490,1468],512],64307:[[1491,1468],512],64308:[[1492,1468],512],64309:[[1493,1468],512],64310:[[1494,1468],512],64312:[[1496,1468],512],64313:[[1497,1468],512],64314:[[1498,1468],512],64315:[[1499,1468],512],64316:[[1500,1468],512],64318:[[1502,1468],512],64320:[[1504,1468],512],64321:[[1505,1468],512],64323:[[1507,1468],512],64324:[[1508,1468],512],64326:[[1510,1468],512],64327:[[1511,1468],512],64328:[[1512,1468],512],64329:[[1513,1468],512],64330:[[1514,1468],512],64331:[[1493,1465],512],64332:[[1489,1471],512],64333:[[1499,1471],512],64334:[[1508,1471],512],64335:[[1488,1500],256],64336:[[1649],256],64337:[[1649],256],64338:[[1659],256],64339:[[1659],256],64340:[[1659],256],64341:[[1659],256],64342:[[1662],256],64343:[[1662],256],64344:[[1662],256],64345:[[1662],256],64346:[[1664],256],64347:[[1664],256],64348:[[1664],256],64349:[[1664],256],64350:[[1658],256],64351:[[1658],256],64352:[[1658],256],64353:[[1658],256],64354:[[1663],256],64355:[[1663],256],64356:[[1663],256],64357:[[1663],256],64358:[[1657],256],64359:[[1657],256],64360:[[1657],256],64361:[[1657],256],64362:[[1700],256],64363:[[1700],256],64364:[[1700],256],64365:[[1700],256],64366:[[1702],256],64367:[[1702],256],64368:[[1702],256],64369:[[1702],256],64370:[[1668],256],64371:[[1668],256],64372:[[1668],256],64373:[[1668],256],64374:[[1667],256],64375:[[1667],256],64376:[[1667],256],64377:[[1667],256],64378:[[1670],256],64379:[[1670],256],64380:[[1670],256],64381:[[1670],256],64382:[[1671],256],64383:[[1671],256],64384:[[1671],256],64385:[[1671],256],64386:[[1677],256],64387:[[1677],256],64388:[[1676],256],64389:[[1676],256],64390:[[1678],256],64391:[[1678],256],64392:[[1672],256],64393:[[1672],256],64394:[[1688],256],64395:[[1688],256],64396:[[1681],256],64397:[[1681],256],64398:[[1705],256],64399:[[1705],256],64400:[[1705],256],64401:[[1705],256],64402:[[1711],256],64403:[[1711],256],64404:[[1711],256],64405:[[1711],256],64406:[[1715],256],64407:[[1715],256],64408:[[1715],256],64409:[[1715],256],64410:[[1713],256],64411:[[1713],256],64412:[[1713],256],64413:[[1713],256],64414:[[1722],256],64415:[[1722],256],64416:[[1723],256],64417:[[1723],256],64418:[[1723],256],64419:[[1723],256],64420:[[1728],256],64421:[[1728],256],64422:[[1729],256],64423:[[1729],256],64424:[[1729],256],64425:[[1729],256],64426:[[1726],256],64427:[[1726],256],64428:[[1726],256],64429:[[1726],256],64430:[[1746],256],64431:[[1746],256],64432:[[1747],256],64433:[[1747],256],64467:[[1709],256],64468:[[1709],256],64469:[[1709],256],64470:[[1709],256],64471:[[1735],256],64472:[[1735],256],64473:[[1734],256],64474:[[1734],256],64475:[[1736],256],64476:[[1736],256],64477:[[1655],256],64478:[[1739],256],64479:[[1739],256],64480:[[1733],256],64481:[[1733],256],64482:[[1737],256],64483:[[1737],256],64484:[[1744],256],64485:[[1744],256],64486:[[1744],256],64487:[[1744],256],64488:[[1609],256],64489:[[1609],256],64490:[[1574,1575],256],64491:[[1574,1575],256],64492:[[1574,1749],256],64493:[[1574,1749],256],64494:[[1574,1608],256],64495:[[1574,1608],256],64496:[[1574,1735],256],64497:[[1574,1735],256],64498:[[1574,1734],256],64499:[[1574,1734],256],64500:[[1574,1736],256],64501:[[1574,1736],256],64502:[[1574,1744],256],64503:[[1574,1744],256],64504:[[1574,1744],256],64505:[[1574,1609],256],64506:[[1574,1609],256],64507:[[1574,1609],256],64508:[[1740],256],64509:[[1740],256],64510:[[1740],256],64511:[[1740],256]},64512:{64512:[[1574,1580],256],64513:[[1574,1581],256],64514:[[1574,1605],256],64515:[[1574,1609],256],64516:[[1574,1610],256],64517:[[1576,1580],256],64518:[[1576,1581],256],64519:[[1576,1582],256],64520:[[1576,1605],256],64521:[[1576,1609],256],64522:[[1576,1610],256],64523:[[1578,1580],256],64524:[[1578,1581],256],64525:[[1578,1582],256],64526:[[1578,1605],256],64527:[[1578,1609],256],64528:[[1578,1610],256],64529:[[1579,1580],256],64530:[[1579,1605],256],64531:[[1579,1609],256],64532:[[1579,1610],256],64533:[[1580,1581],256],64534:[[1580,1605],256],64535:[[1581,1580],256],64536:[[1581,1605],256],64537:[[1582,1580],256],64538:[[1582,1581],256],64539:[[1582,1605],256],64540:[[1587,1580],256],64541:[[1587,1581],256],64542:[[1587,1582],256],64543:[[1587,1605],256],64544:[[1589,1581],256],64545:[[1589,1605],256],64546:[[1590,1580],256],64547:[[1590,1581],256],64548:[[1590,1582],256],64549:[[1590,1605],256],64550:[[1591,1581],256],64551:[[1591,1605],256],64552:[[1592,1605],256],64553:[[1593,1580],256],64554:[[1593,1605],256],64555:[[1594,1580],256],64556:[[1594,1605],256],64557:[[1601,1580],256],64558:[[1601,1581],256],64559:[[1601,1582],256],64560:[[1601,1605],256],64561:[[1601,1609],256],64562:[[1601,1610],256],64563:[[1602,1581],256],64564:[[1602,1605],256],64565:[[1602,1609],256],64566:[[1602,1610],256],64567:[[1603,1575],256],64568:[[1603,1580],256],64569:[[1603,1581],256],64570:[[1603,1582],256],64571:[[1603,1604],256],64572:[[1603,1605],256],64573:[[1603,1609],256],64574:[[1603,1610],256],64575:[[1604,1580],256],64576:[[1604,1581],256],64577:[[1604,1582],256],64578:[[1604,1605],256],64579:[[1604,1609],256],64580:[[1604,1610],256],64581:[[1605,1580],256],64582:[[1605,1581],256],64583:[[1605,1582],256],64584:[[1605,1605],256],64585:[[1605,1609],256],64586:[[1605,1610],256],64587:[[1606,1580],256],64588:[[1606,1581],256],64589:[[1606,1582],256],64590:[[1606,1605],256],64591:[[1606,1609],256],64592:[[1606,1610],256],64593:[[1607,1580],256],64594:[[1607,1605],256],64595:[[1607,1609],256],64596:[[1607,1610],256],64597:[[1610,1580],256],64598:[[1610,1581],256],64599:[[1610,1582],256],64600:[[1610,1605],256],64601:[[1610,1609],256],64602:[[1610,1610],256],64603:[[1584,1648],256],64604:[[1585,1648],256],64605:[[1609,1648],256],64606:[[32,1612,1617],256],64607:[[32,1613,1617],256],64608:[[32,1614,1617],256],64609:[[32,1615,1617],256],64610:[[32,1616,1617],256],64611:[[32,1617,1648],256],64612:[[1574,1585],256],64613:[[1574,1586],256],64614:[[1574,1605],256],64615:[[1574,1606],256],64616:[[1574,1609],256],64617:[[1574,1610],256],64618:[[1576,1585],256],64619:[[1576,1586],256],64620:[[1576,1605],256],64621:[[1576,1606],256],64622:[[1576,1609],256],64623:[[1576,1610],256],64624:[[1578,1585],256],64625:[[1578,1586],256],64626:[[1578,1605],256],64627:[[1578,1606],256],64628:[[1578,1609],256],64629:[[1578,1610],256],64630:[[1579,1585],256],64631:[[1579,1586],256],64632:[[1579,1605],256],64633:[[1579,1606],256],64634:[[1579,1609],256],64635:[[1579,1610],256],64636:[[1601,1609],256],64637:[[1601,1610],256],64638:[[1602,1609],256],64639:[[1602,1610],256],64640:[[1603,1575],256],64641:[[1603,1604],256],64642:[[1603,1605],256],64643:[[1603,1609],256],64644:[[1603,1610],256],64645:[[1604,1605],256],64646:[[1604,1609],256],64647:[[1604,1610],256],64648:[[1605,1575],256],64649:[[1605,1605],256],64650:[[1606,1585],256],64651:[[1606,1586],256],64652:[[1606,1605],256],64653:[[1606,1606],256],64654:[[1606,1609],256],64655:[[1606,1610],256],64656:[[1609,1648],256],64657:[[1610,1585],256],64658:[[1610,1586],256],64659:[[1610,1605],256],64660:[[1610,1606],256],64661:[[1610,1609],256],64662:[[1610,1610],256],64663:[[1574,1580],256],64664:[[1574,1581],256],64665:[[1574,1582],256],64666:[[1574,1605],256],64667:[[1574,1607],256],64668:[[1576,1580],256],64669:[[1576,1581],256],64670:[[1576,1582],256],64671:[[1576,1605],256],64672:[[1576,1607],256],64673:[[1578,1580],256],64674:[[1578,1581],256],64675:[[1578,1582],256],64676:[[1578,1605],256],64677:[[1578,1607],256],64678:[[1579,1605],256],64679:[[1580,1581],256],64680:[[1580,1605],256],64681:[[1581,1580],256],64682:[[1581,1605],256],64683:[[1582,1580],256],64684:[[1582,1605],256],64685:[[1587,1580],256],64686:[[1587,1581],256],64687:[[1587,1582],256], 64688:[[1587,1605],256],64689:[[1589,1581],256],64690:[[1589,1582],256],64691:[[1589,1605],256],64692:[[1590,1580],256],64693:[[1590,1581],256],64694:[[1590,1582],256],64695:[[1590,1605],256],64696:[[1591,1581],256],64697:[[1592,1605],256],64698:[[1593,1580],256],64699:[[1593,1605],256],64700:[[1594,1580],256],64701:[[1594,1605],256],64702:[[1601,1580],256],64703:[[1601,1581],256],64704:[[1601,1582],256],64705:[[1601,1605],256],64706:[[1602,1581],256],64707:[[1602,1605],256],64708:[[1603,1580],256],64709:[[1603,1581],256],64710:[[1603,1582],256],64711:[[1603,1604],256],64712:[[1603,1605],256],64713:[[1604,1580],256],64714:[[1604,1581],256],64715:[[1604,1582],256],64716:[[1604,1605],256],64717:[[1604,1607],256],64718:[[1605,1580],256],64719:[[1605,1581],256],64720:[[1605,1582],256],64721:[[1605,1605],256],64722:[[1606,1580],256],64723:[[1606,1581],256],64724:[[1606,1582],256],64725:[[1606,1605],256],64726:[[1606,1607],256],64727:[[1607,1580],256],64728:[[1607,1605],256],64729:[[1607,1648],256],64730:[[1610,1580],256],64731:[[1610,1581],256],64732:[[1610,1582],256],64733:[[1610,1605],256],64734:[[1610,1607],256],64735:[[1574,1605],256],64736:[[1574,1607],256],64737:[[1576,1605],256],64738:[[1576,1607],256],64739:[[1578,1605],256],64740:[[1578,1607],256],64741:[[1579,1605],256],64742:[[1579,1607],256],64743:[[1587,1605],256],64744:[[1587,1607],256],64745:[[1588,1605],256],64746:[[1588,1607],256],64747:[[1603,1604],256],64748:[[1603,1605],256],64749:[[1604,1605],256],64750:[[1606,1605],256],64751:[[1606,1607],256],64752:[[1610,1605],256],64753:[[1610,1607],256],64754:[[1600,1614,1617],256],64755:[[1600,1615,1617],256],64756:[[1600,1616,1617],256],64757:[[1591,1609],256],64758:[[1591,1610],256],64759:[[1593,1609],256],64760:[[1593,1610],256],64761:[[1594,1609],256],64762:[[1594,1610],256],64763:[[1587,1609],256],64764:[[1587,1610],256],64765:[[1588,1609],256],64766:[[1588,1610],256],64767:[[1581,1609],256]},64768:{64768:[[1581,1610],256],64769:[[1580,1609],256],64770:[[1580,1610],256],64771:[[1582,1609],256],64772:[[1582,1610],256],64773:[[1589,1609],256],64774:[[1589,1610],256],64775:[[1590,1609],256],64776:[[1590,1610],256],64777:[[1588,1580],256],64778:[[1588,1581],256],64779:[[1588,1582],256],64780:[[1588,1605],256],64781:[[1588,1585],256],64782:[[1587,1585],256],64783:[[1589,1585],256],64784:[[1590,1585],256],64785:[[1591,1609],256],64786:[[1591,1610],256],64787:[[1593,1609],256],64788:[[1593,1610],256],64789:[[1594,1609],256],64790:[[1594,1610],256],64791:[[1587,1609],256],64792:[[1587,1610],256],64793:[[1588,1609],256],64794:[[1588,1610],256],64795:[[1581,1609],256],64796:[[1581,1610],256],64797:[[1580,1609],256],64798:[[1580,1610],256],64799:[[1582,1609],256],64800:[[1582,1610],256],64801:[[1589,1609],256],64802:[[1589,1610],256],64803:[[1590,1609],256],64804:[[1590,1610],256],64805:[[1588,1580],256],64806:[[1588,1581],256],64807:[[1588,1582],256],64808:[[1588,1605],256],64809:[[1588,1585],256],64810:[[1587,1585],256],64811:[[1589,1585],256],64812:[[1590,1585],256],64813:[[1588,1580],256],64814:[[1588,1581],256],64815:[[1588,1582],256],64816:[[1588,1605],256],64817:[[1587,1607],256],64818:[[1588,1607],256],64819:[[1591,1605],256],64820:[[1587,1580],256],64821:[[1587,1581],256],64822:[[1587,1582],256],64823:[[1588,1580],256],64824:[[1588,1581],256],64825:[[1588,1582],256],64826:[[1591,1605],256],64827:[[1592,1605],256],64828:[[1575,1611],256],64829:[[1575,1611],256],64848:[[1578,1580,1605],256],64849:[[1578,1581,1580],256],64850:[[1578,1581,1580],256],64851:[[1578,1581,1605],256],64852:[[1578,1582,1605],256],64853:[[1578,1605,1580],256],64854:[[1578,1605,1581],256],64855:[[1578,1605,1582],256],64856:[[1580,1605,1581],256],64857:[[1580,1605,1581],256],64858:[[1581,1605,1610],256],64859:[[1581,1605,1609],256],64860:[[1587,1581,1580],256],64861:[[1587,1580,1581],256],64862:[[1587,1580,1609],256],64863:[[1587,1605,1581],256],64864:[[1587,1605,1581],256],64865:[[1587,1605,1580],256],64866:[[1587,1605,1605],256],64867:[[1587,1605,1605],256],64868:[[1589,1581,1581],256],64869:[[1589,1581,1581],256],64870:[[1589,1605,1605],256],64871:[[1588,1581,1605],256],64872:[[1588,1581,1605],256],64873:[[1588,1580,1610],256],64874:[[1588,1605,1582],256],64875:[[1588,1605,1582],256],64876:[[1588,1605,1605],256],64877:[[1588,1605,1605],256],64878:[[1590,1581,1609],256],64879:[[1590,1582,1605],256],64880:[[1590,1582,1605],256],64881:[[1591,1605,1581],256],64882:[[1591,1605,1581],256],64883:[[1591,1605,1605],256],64884:[[1591,1605,1610],256],64885:[[1593,1580,1605],256],64886:[[1593,1605,1605],256],64887:[[1593,1605,1605],256],64888:[[1593,1605,1609],256],64889:[[1594,1605,1605],256],64890:[[1594,1605,1610],256],64891:[[1594,1605,1609],256],64892:[[1601,1582,1605],256],64893:[[1601,1582,1605],256],64894:[[1602,1605,1581],256],64895:[[1602,1605,1605],256],64896:[[1604,1581,1605],256],64897:[[1604,1581,1610],256],64898:[[1604,1581,1609],256],64899:[[1604,1580,1580],256],64900:[[1604,1580,1580],256],64901:[[1604,1582,1605],256],64902:[[1604,1582,1605],256],64903:[[1604,1605,1581],256],64904:[[1604,1605,1581],256],64905:[[1605,1581,1580],256],64906:[[1605,1581,1605],256],64907:[[1605,1581,1610],256],64908:[[1605,1580,1581],256],64909:[[1605,1580,1605],256],64910:[[1605,1582,1580],256],64911:[[1605,1582,1605],256],64914:[[1605,1580,1582],256],64915:[[1607,1605,1580],256],64916:[[1607,1605,1605],256],64917:[[1606,1581,1605],256],64918:[[1606,1581,1609],256],64919:[[1606,1580,1605],256],64920:[[1606,1580,1605],256],64921:[[1606,1580,1609],256],64922:[[1606,1605,1610],256],64923:[[1606,1605,1609],256],64924:[[1610,1605,1605],256],64925:[[1610,1605,1605],256],64926:[[1576,1582,1610],256],64927:[[1578,1580,1610],256],64928:[[1578,1580,1609],256],64929:[[1578,1582,1610],256],64930:[[1578,1582,1609],256],64931:[[1578,1605,1610],256],64932:[[1578,1605,1609],256],64933:[[1580,1605,1610],256],64934:[[1580,1581,1609],256],64935:[[1580,1605,1609],256],64936:[[1587,1582,1609],256],64937:[[1589,1581,1610],256],64938:[[1588,1581,1610],256],64939:[[1590,1581,1610],256],64940:[[1604,1580,1610],256],64941:[[1604,1605,1610],256],64942:[[1610,1581,1610],256],64943:[[1610,1580,1610],256],64944:[[1610,1605,1610],256],64945:[[1605,1605,1610],256],64946:[[1602,1605,1610],256],64947:[[1606,1581,1610],256],64948:[[1602,1605,1581],256],64949:[[1604,1581,1605],256],64950:[[1593,1605,1610],256],64951:[[1603,1605,1610],256],64952:[[1606,1580,1581],256],64953:[[1605,1582,1610],256],64954:[[1604,1580,1605],256],64955:[[1603,1605,1605],256],64956:[[1604,1580,1605],256],64957:[[1606,1580,1581],256],64958:[[1580,1581,1610],256],64959:[[1581,1580,1610],256],64960:[[1605,1580,1610],256],64961:[[1601,1605,1610],256],64962:[[1576,1581,1610],256],64963:[[1603,1605,1605],256],64964:[[1593,1580,1605],256],64965:[[1589,1605,1605],256],64966:[[1587,1582,1610],256],64967:[[1606,1580,1610],256],65008:[[1589,1604,1746],256],65009:[[1602,1604,1746],256],65010:[[1575,1604,1604,1607],256],65011:[[1575,1603,1576,1585],256],65012:[[1605,1581,1605,1583],256],65013:[[1589,1604,1593,1605],256],65014:[[1585,1587,1608,1604],256],65015:[[1593,1604,1610,1607],256],65016:[[1608,1587,1604,1605],256],65017:[[1589,1604,1609],256],65018:[[1589,1604,1609,32,1575,1604,1604,1607,32,1593,1604,1610,1607,32,1608,1587,1604,1605],256],65019:[[1580,1604,32,1580,1604,1575,1604,1607],256],65020:[[1585,1740,1575,1604],256]},65024:{65040:[[44],256],65041:[[12289],256],65042:[[12290],256],65043:[[58],256],65044:[[59],256],65045:[[33],256],65046:[[63],256],65047:[[12310],256],65048:[[12311],256],65049:[[8230],256],65056:[,230],65057:[,230],65058:[,230],65059:[,230],65060:[,230],65061:[,230],65062:[,230],65063:[,220],65064:[,220],65065:[,220],65066:[,220],65067:[,220],65068:[,220],65069:[,220],65072:[[8229],256],65073:[[8212],256],65074:[[8211],256],65075:[[95],256],65076:[[95],256],65077:[[40],256],65078:[[41],256],65079:[[123],256],65080:[[125],256],65081:[[12308],256],65082:[[12309],256],65083:[[12304],256],65084:[[12305],256],65085:[[12298],256],65086:[[12299],256],65087:[[12296],256],65088:[[12297],256],65089:[[12300],256],65090:[[12301],256],65091:[[12302],256],65092:[[12303],256],65095:[[91],256],65096:[[93],256],65097:[[8254],256],65098:[[8254],256],65099:[[8254],256],65100:[[8254],256],65101:[[95],256],65102:[[95],256],65103:[[95],256],65104:[[44],256],65105:[[12289],256],65106:[[46],256],65108:[[59],256],65109:[[58],256],65110:[[63],256],65111:[[33],256],65112:[[8212],256],65113:[[40],256],65114:[[41],256],65115:[[123],256],65116:[[125],256],65117:[[12308],256],65118:[[12309],256],65119:[[35],256],65120:[[38],256],65121:[[42],256],65122:[[43],256],65123:[[45],256],65124:[[60],256],65125:[[62],256],65126:[[61],256],65128:[[92],256],65129:[[36],256],65130:[[37],256],65131:[[64],256],65136:[[32,1611],256],65137:[[1600,1611],256],65138:[[32,1612],256],65140:[[32,1613],256],65142:[[32,1614],256],65143:[[1600,1614],256],65144:[[32,1615],256],65145:[[1600,1615],256],65146:[[32,1616],256],65147:[[1600,1616],256],65148:[[32,1617],256],65149:[[1600,1617],256],65150:[[32,1618],256],65151:[[1600,1618],256],65152:[[1569],256],65153:[[1570],256],65154:[[1570],256],65155:[[1571],256],65156:[[1571],256],65157:[[1572],256],65158:[[1572],256],65159:[[1573],256],65160:[[1573],256],65161:[[1574],256],65162:[[1574],256],65163:[[1574],256],65164:[[1574],256],65165:[[1575],256],65166:[[1575],256],65167:[[1576],256],65168:[[1576],256],65169:[[1576],256],65170:[[1576],256],65171:[[1577],256],65172:[[1577],256],65173:[[1578],256],65174:[[1578],256],65175:[[1578],256],65176:[[1578],256],65177:[[1579],256],65178:[[1579],256],65179:[[1579],256],65180:[[1579],256],65181:[[1580],256],65182:[[1580],256],65183:[[1580],256],65184:[[1580],256],65185:[[1581],256],65186:[[1581],256],65187:[[1581],256],65188:[[1581],256],65189:[[1582],256],65190:[[1582],256],65191:[[1582],256],65192:[[1582],256],65193:[[1583],256],65194:[[1583],256],65195:[[1584],256],65196:[[1584],256],65197:[[1585],256],65198:[[1585],256],65199:[[1586],256],65200:[[1586],256],65201:[[1587],256],65202:[[1587],256],65203:[[1587],256],65204:[[1587],256],65205:[[1588],256],65206:[[1588],256],65207:[[1588],256],65208:[[1588],256],65209:[[1589],256],65210:[[1589],256],65211:[[1589],256],65212:[[1589],256],65213:[[1590],256],65214:[[1590],256],65215:[[1590],256],65216:[[1590],256],65217:[[1591],256],65218:[[1591],256],65219:[[1591],256],65220:[[1591],256],65221:[[1592],256],65222:[[1592],256],65223:[[1592],256],65224:[[1592],256],65225:[[1593],256],65226:[[1593],256],65227:[[1593],256],65228:[[1593],256],65229:[[1594],256],65230:[[1594],256],65231:[[1594],256],65232:[[1594],256],65233:[[1601],256],65234:[[1601],256],65235:[[1601],256],65236:[[1601],256],65237:[[1602],256],65238:[[1602],256],65239:[[1602],256],65240:[[1602],256],65241:[[1603],256],65242:[[1603],256],65243:[[1603],256],65244:[[1603],256],65245:[[1604],256],65246:[[1604],256],65247:[[1604],256],65248:[[1604],256],65249:[[1605],256],65250:[[1605],256],65251:[[1605],256],65252:[[1605],256],65253:[[1606],256],65254:[[1606],256],65255:[[1606],256],65256:[[1606],256],65257:[[1607],256],65258:[[1607],256],65259:[[1607],256],65260:[[1607],256],65261:[[1608],256],65262:[[1608],256],65263:[[1609],256],65264:[[1609],256],65265:[[1610],256],65266:[[1610],256],65267:[[1610],256],65268:[[1610],256],65269:[[1604,1570],256],65270:[[1604,1570],256],65271:[[1604,1571],256],65272:[[1604,1571],256],65273:[[1604,1573],256],65274:[[1604,1573],256],65275:[[1604,1575],256],65276:[[1604,1575],256]},65280:{65281:[[33],256],65282:[[34],256],65283:[[35],256],65284:[[36],256],65285:[[37],256],65286:[[38],256],65287:[[39],256],65288:[[40],256],65289:[[41],256],65290:[[42],256],65291:[[43],256],65292:[[44],256],65293:[[45],256],65294:[[46],256],65295:[[47],256],65296:[[48],256],65297:[[49],256],65298:[[50],256],65299:[[51],256],65300:[[52],256],65301:[[53],256],65302:[[54],256],65303:[[55],256],65304:[[56],256],65305:[[57],256],65306:[[58],256],65307:[[59],256],65308:[[60],256],65309:[[61],256],65310:[[62],256],65311:[[63],256],65312:[[64],256],65313:[[65],256],65314:[[66],256],65315:[[67],256],65316:[[68],256],65317:[[69],256],65318:[[70],256],65319:[[71],256],65320:[[72],256],65321:[[73],256],65322:[[74],256],65323:[[75],256],65324:[[76],256],65325:[[77],256],65326:[[78],256],65327:[[79],256],65328:[[80],256],65329:[[81],256],65330:[[82],256],65331:[[83],256],65332:[[84],256],65333:[[85],256],65334:[[86],256],65335:[[87],256],65336:[[88],256],65337:[[89],256],65338:[[90],256],65339:[[91],256],65340:[[92],256],65341:[[93],256],65342:[[94],256],65343:[[95],256],65344:[[96],256],65345:[[97],256],65346:[[98],256],65347:[[99],256],65348:[[100],256],65349:[[101],256],65350:[[102],256],65351:[[103],256],65352:[[104],256],65353:[[105],256],65354:[[106],256],65355:[[107],256],65356:[[108],256],65357:[[109],256],65358:[[110],256],65359:[[111],256],65360:[[112],256],65361:[[113],256],65362:[[114],256],65363:[[115],256],65364:[[116],256],65365:[[117],256],65366:[[118],256],65367:[[119],256],65368:[[120],256],65369:[[121],256],65370:[[122],256],65371:[[123],256],65372:[[124],256],65373:[[125],256],65374:[[126],256],65375:[[10629],256],65376:[[10630],256],65377:[[12290],256],65378:[[12300],256],65379:[[12301],256],65380:[[12289],256],65381:[[12539],256],65382:[[12530],256],65383:[[12449],256],65384:[[12451],256],65385:[[12453],256],65386:[[12455],256],65387:[[12457],256],65388:[[12515],256],65389:[[12517],256],65390:[[12519],256],65391:[[12483],256],65392:[[12540],256],65393:[[12450],256],65394:[[12452],256],65395:[[12454],256],65396:[[12456],256],65397:[[12458],256],65398:[[12459],256],65399:[[12461],256],65400:[[12463],256],65401:[[12465],256],65402:[[12467],256],65403:[[12469],256],65404:[[12471],256],65405:[[12473],256],65406:[[12475],256],65407:[[12477],256],65408:[[12479],256],65409:[[12481],256],65410:[[12484],256],65411:[[12486],256],65412:[[12488],256],65413:[[12490],256],65414:[[12491],256],65415:[[12492],256],65416:[[12493],256],65417:[[12494],256],65418:[[12495],256],65419:[[12498],256],65420:[[12501],256],65421:[[12504],256],65422:[[12507],256],65423:[[12510],256],65424:[[12511],256],65425:[[12512],256],65426:[[12513],256],65427:[[12514],256],65428:[[12516],256],65429:[[12518],256],65430:[[12520],256],65431:[[12521],256],65432:[[12522],256],65433:[[12523],256],65434:[[12524],256],65435:[[12525],256],65436:[[12527],256],65437:[[12531],256],65438:[[12441],256],65439:[[12442],256],65440:[[12644],256],65441:[[12593],256],65442:[[12594],256],65443:[[12595],256],65444:[[12596],256],65445:[[12597],256],65446:[[12598],256],65447:[[12599],256],65448:[[12600],256],65449:[[12601],256],65450:[[12602],256],65451:[[12603],256],65452:[[12604],256],65453:[[12605],256],65454:[[12606],256],65455:[[12607],256],65456:[[12608],256],65457:[[12609],256],65458:[[12610],256],65459:[[12611],256],65460:[[12612],256],65461:[[12613],256],65462:[[12614],256],65463:[[12615],256],65464:[[12616],256],65465:[[12617],256],65466:[[12618],256],65467:[[12619],256],65468:[[12620],256],65469:[[12621],256],65470:[[12622],256],65474:[[12623],256],65475:[[12624],256],65476:[[12625],256],65477:[[12626],256],65478:[[12627],256],65479:[[12628],256],65482:[[12629],256],65483:[[12630],256],65484:[[12631],256],65485:[[12632],256],65486:[[12633],256],65487:[[12634],256],65490:[[12635],256],65491:[[12636],256],65492:[[12637],256],65493:[[12638],256],65494:[[12639],256],65495:[[12640],256],65498:[[12641],256],65499:[[12642],256],65500:[[12643],256],65504:[[162],256],65505:[[163],256],65506:[[172],256],65507:[[175],256],65508:[[166],256],65509:[[165],256],65510:[[8361],256],65512:[[9474],256],65513:[[8592],256],65514:[[8593],256],65515:[[8594],256],65516:[[8595],256],65517:[[9632],256],65518:[[9675],256]}};var H={nfc:j,nfd:h,nfkc:k,nfkd:i};"object"==typeof b?b.exports=H:"function"==typeof define&&define.amd?define("unorm",function(){return H}):a.unorm=H,H.shimApplied=!1,String.prototype.normalize||(String.prototype.normalize=function(a){var b=""+this;if(a=void 0===a?"NFC":a,"NFC"===a)return H.nfc(b);if("NFD"===a)return H.nfd(b);if("NFKC"===a)return H.nfkc(b);if("NFKD"===a)return H.nfkd(b);throw new RangeError("Invalid normalization form: "+a)},H.shimApplied=!0)}(this)},{}],335:[function(a,b,c){"use strict";function d(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function e(a,b,c){if(a&&j.isObject(a)&&a instanceof d)return a;var e=new d;return e.parse(a,b,c),e}function f(a){return j.isString(a)&&(a=e(a)),a instanceof d?a.format():d.prototype.format.call(a)}function g(a,b){return e(a,!1,!0).resolve(b)}function h(a,b){return a?e(a,!1,!0).resolveObject(b):b}var i=a("punycode"),j=a("./util");c.parse=e,c.resolve=g,c.resolveObject=h,c.format=f,c.Url=d;var k=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,m=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,n=["<",">",'"',"`"," ","\r","\n"," "],o=["{","}","|","\\","^","`"].concat(n),p=["'"].concat(o),q=["%","/","?",";","#"].concat(p),r=["/","?","#"],s=255,t=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=a("querystring");d.prototype.parse=function(a,b,c){if(!j.isString(a))throw new TypeError("Parameter 'url' must be a string, not "+typeof a);var d=a.indexOf("?"),e=-1!==d&&dC)&&(A=C)}var D,E;E=-1===A?h.lastIndexOf("@"):h.lastIndexOf("@",A),-1!==E&&(D=h.slice(0,E),h=h.slice(E+1),this.auth=decodeURIComponent(D)),A=-1;for(var B=0;BC)&&(A=C)}-1===A&&(A=h.length),this.host=h.slice(0,A),h=h.slice(A),this.parseHost(),this.hostname=this.hostname||"";var F="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!F)for(var G=this.hostname.split(/\./),B=0,H=G.length;H>B;B++){var I=G[B];if(I&&!I.match(t)){for(var J="",K=0,L=I.length;L>K;K++)J+=I.charCodeAt(K)>127?"x":I[K];if(!J.match(t)){var M=G.slice(0,B),N=G.slice(B+1),O=I.match(u);O&&(M.push(O[1]),N.unshift(O[2])),N.length&&(h="/"+N.join(".")+h),this.hostname=M.join(".");break}}}this.hostname.length>s?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=i.toASCII(this.hostname));var P=this.port?":"+this.port:"",Q=this.hostname||"";this.host=Q+P,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!v[o])for(var B=0,H=p.length;H>B;B++){var R=p[B];if(-1!==h.indexOf(R)){var S=encodeURIComponent(R);S===R&&(S=escape(R)),h=h.split(R).join(S)}}var T=h.indexOf("#");-1!==T&&(this.hash=h.substr(T),h=h.slice(0,T));var U=h.indexOf("?");if(-1!==U?(this.search=h.substr(U),this.query=h.substr(U+1),b&&(this.query=y.parse(this.query)),h=h.slice(0,U)):b&&(this.search="",this.query={}),h&&(this.pathname=h),x[o]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var P=this.pathname||"",V=this.search||"";this.path=P+V}return this.href=this.format(),this},d.prototype.format=function(){var a=this.auth||"";a&&(a=encodeURIComponent(a),a=a.replace(/%3A/i,":"),a+="@");var b=this.protocol||"",c=this.pathname||"",d=this.hash||"",e=!1,f="";this.host?e=a+this.host:this.hostname&&(e=a+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(e+=":"+this.port)),this.query&&j.isObject(this.query)&&Object.keys(this.query).length&&(f=y.stringify(this.query));var g=this.search||f&&"?"+f||"";return b&&":"!==b.substr(-1)&&(b+=":"),this.slashes||(!b||x[b])&&e!==!1?(e="//"+(e||""),c&&"/"!==c.charAt(0)&&(c="/"+c)):e||(e=""),d&&"#"!==d.charAt(0)&&(d="#"+d),g&&"?"!==g.charAt(0)&&(g="?"+g),c=c.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),g=g.replace("#","%23"),b+e+c+g+d},d.prototype.resolve=function(a){return this.resolveObject(e(a,!1,!0)).format()},d.prototype.resolveObject=function(a){if(j.isString(a)){var b=new d;b.parse(a,!1,!0),a=b}for(var c=new d,e=Object.keys(this),f=0;f0?c.host.split("@"):!1;z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return c.search=a.search,c.query=a.query,j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.href=c.format(),c}if(!v.length)return c.pathname=null,c.search?c.path="/"+c.search:c.path=null,c.href=c.format(),c;for(var A=v.slice(-1)[0],B=(c.host||a.host||v.length>1)&&("."===A||".."===A)||""===A,C=0,D=v.length;D>=0;D--)A=v[D],"."===A?v.splice(D,1):".."===A?(v.splice(D,1),C++):C&&(v.splice(D,1),C--);if(!t&&!u)for(;C--;C)v.unshift("..");!t||""===v[0]||v[0]&&"/"===v[0].charAt(0)||v.unshift(""),B&&"/"!==v.join("/").substr(-1)&&v.push("");var E=""===v[0]||v[0]&&"/"===v[0].charAt(0);if(y){c.hostname=c.host=E?"":v.length?v.shift():"";var z=c.host&&c.host.indexOf("@")>0?c.host.split("@"):!1;z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return t=t||c.host&&v.length,t&&!E&&v.unshift(""),v.length?c.pathname=v.join("/"):(c.pathname=null,c.path=null),j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.auth=a.auth||c.auth,c.slashes=c.slashes||a.slashes,c.href=c.format(),c},d.prototype.parseHost=function(){var a=this.host,b=l.exec(a);b&&(b=b[0],":"!==b&&(this.port=b.substr(1)),a=a.substr(0,a.length-b.length)),a&&(this.hostname=a)}},{"./util":336,punycode:290,querystring:293}],336:[function(a,b,c){"use strict";b.exports={isString:function(a){return"string"==typeof a},isObject:function(a){return"object"==typeof a&&null!==a},isNull:function(a){return null===a},isNullOrUndefined:function(a){return null==a}}},{}],337:[function(a,b,c){(function(a){function c(a,b){function c(){if(!e){if(d("throwDeprecation"))throw new Error(b);d("traceDeprecation")?console.trace(b):console.warn(b),e=!0}return a.apply(this,arguments)}if(d("noDeprecation"))return a;var e=!1;return c}function d(b){try{if(!a.localStorage)return!1}catch(c){return!1}var d=a.localStorage[b];return null==d?!1:"true"===String(d).toLowerCase()}b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],338:[function(a,b,c){arguments[4][86][0].apply(c,arguments)},{dup:86}],339:[function(a,b,c){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],340:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a,b){return a}function h(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)F(b,String(g))?f.push(m(a,b,c,d,String(g),!0)):f.push("");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":339,_process:282,inherits:338}],341:[function(require,module,exports){function Context(){}var indexOf=require("indexof"),Object_keys=function(a){if(Object.keys)return Object.keys(a);var b=[];for(var c in a)b.push(c);return b},forEach=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;c= 8.0.0",main:"index.js",repository:{url:"git@github.com:bitpay/bitcore-wallet-client.git",type:"git"},bugs:{url:"https://github.com/bitpay/bitcore-wallet-client/issues"},dependencies:{async:"^0.9.0",bip38:"^1.3.0","bitcore-lib":"^0.15.0","bitcore-lib-cash":"^0.16.1","bitcore-mnemonic":"^1.3.0","bitcore-payment-protocol":"^1.7.0","json-stable-stringify":"^1.0.0",lodash:"^4.17.4",preconditions:"^1.0.8",sjcl:"1.0.3",superagent:"^3.4.1"},devDependencies:{"bitcore-wallet-service":"2.3.0",browserify:"^13.1.0",chai:"^1.9.1",coveralls:"^2.11.2",istanbul:"*",mocha:"^1.18.2",sinon:"^1.10.3",supertest:"^3.0.0",tingodb:"^0.3.4",uglify:"^0.1.1",uuid:"^2.0.1","grunt-jsdox":"matiu/grunt-jsdox#update/jsdoc-4.10"},scripts:{start:"node app.js",coverage:"./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter spec test",test:"./node_modules/.bin/mocha",coveralls:"./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",docs:"./node_modules/.bin/jsdox lib/* lib/common lib/errors -o docs && cat README.header.md docs/*.md LICENSE > README.md"}}},{}]},{},[1]); \ No newline at end of file +};Script.prototype.runInContext=function(a){if(!(a instanceof Context))throw new TypeError("needs a 'context' argument.");var b=document.createElement("iframe");b.style||(b.style={}),b.style.display="none",document.body.appendChild(b);var c=b.contentWindow,d=c.eval,e=c.execScript;!d&&e&&(e.call(c,"null"),d=c.eval),forEach(Object_keys(a),function(b){c[b]=a[b]}),forEach(globals,function(b){a[b]&&(c[b]=a[b])});var f=Object_keys(c),g=d.call(c,this.code);return forEach(Object_keys(c),function(b){(b in a||-1===indexOf(f,b))&&(a[b]=c[b])}),forEach(globals,function(b){b in a||defineProp(a,b,c[b])}),document.body.removeChild(b),g},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(a){var b=Script.createContext(a),c=this.runInContext(b);return forEach(Object_keys(b),function(c){a[c]=b[c]}),c},forEach(Object_keys(Script.prototype),function(a){exports[a]=Script[a]=function(b){var c=Script(b);return c[a].apply(c,[].slice.call(arguments,1))}}),exports.createScript=function(a){return exports.Script(a)},exports.createContext=Script.createContext=function(a){var b=new Context;return"object"==typeof a&&forEach(Object_keys(a),function(c){b[c]=a[c]}),b}},{indexof:250}],342:[function(a,b,c){function d(){for(var a={},b=0;b= 8.0.0",main:"index.js",repository:{url:"git@github.com:bitpay/bitcore-wallet-client.git",type:"git"},bugs:{url:"https://github.com/bitpay/bitcore-wallet-client/issues"},dependencies:{async:"^0.9.0",bip38:"^1.3.0","bitcore-lib":"^0.15.0","bitcore-lib-cash":"^0.16.1","bitcore-mnemonic":"^1.3.0","bitcore-payment-protocol":"^1.7.0","json-stable-stringify":"^1.0.0",lodash:"^4.17.4",preconditions:"^1.0.8",sjcl:"1.0.3",superagent:"^3.4.1"},devDependencies:{"bitcore-wallet-service":"2.3.0",browserify:"^13.1.0",chai:"^1.9.1",coveralls:"^2.11.2",istanbul:"*",mocha:"^1.18.2",sinon:"^1.10.3",supertest:"^3.0.0",tingodb:"^0.3.4",uglify:"^0.1.1",uuid:"^2.0.1","grunt-jsdox":"matiu/grunt-jsdox#update/jsdoc-4.10"},scripts:{start:"node app.js",coverage:"./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter spec test",test:"./node_modules/.bin/mocha",coveralls:"./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",docs:"./node_modules/.bin/jsdox lib/* lib/common lib/errors -o docs && cat README.header.md docs/*.md LICENSE > README.md"}}},{}]},{},[1]); \ No newline at end of file diff --git a/lib/credentials.js b/lib/credentials.js index 7b3e11e8..90ea617c 100644 --- a/lib/credentials.js +++ b/lib/credentials.js @@ -313,7 +313,7 @@ Credentials.prototype.getDerivedXPrivKey = function(password) { return deriveFn(path); }; -Credent.prototype.addWalletPrivateKey = function(walletPrivKey) { +Credentials.prototype.addWalletPrivateKey = function(walletPrivKey) { this.walletPrivKey = walletPrivKey; this.sharedEncryptingKey = Utils.privateKeyToAESKey(walletPrivKey); };