From eefed6520275397c8d47c4b0be46805ffa6ddd63 Mon Sep 17 00:00:00 2001 From: Anders Rune Jensen Date: Tue, 5 Jan 2021 12:02:16 +0100 Subject: [PATCH] 6.0.0 --- dist/bundle-core.js | 2399 +++++++++++++++++++++++-------------------- package.json | 4 +- 2 files changed, 1275 insertions(+), 1128 deletions(-) diff --git a/dist/bundle-core.js b/dist/bundle-core.js index fca72ee..d8c0cce 100644 --- a/dist/bundle-core.js +++ b/dist/bundle-core.js @@ -1,192 +1,242 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i{if(e)return console.error(e);r.destroy()})}exports.getPeer=function(){let e=Array.from(SSB.net.conn.hub().entries());var t=(e=e.filter(([,e])=>!!e.key).map(([e,t])=>({address:e,data:t}))).find(e=>"room"!=e.data.type);let r=Object.values(SSB.net.peers).flat();return t?r.find(e=>e.id==t.data.key):r.length>0?r[0]:null},exports.removeIndexes=function(e){SSB.db.clearIndexes()},exports.removeDB=function(){deleteDatabaseFile("log.bipf"),new(require("idb-kv-store"))(path.join(SSB.dir,"indexes")).clear()},exports.removeBlobs=function(){window.webkitRequestFileSystem(window.PERSISTENT,0,function(e){!function e(t,r){t.root.getDirectory(r,{},function(r){r.createReader().readEntries(function(r){for(var n=0;n{if(t)return console.error(t);e.destroy()})}}})})}(e,"/.ssb-lite/blobs")})},exports.EBTSync=function(e){console.log("doing ebt with",e.id),SSB.db.contacts.getGraphForFeed(SSB.net.id,(t,r)=>{SSB.net.ebt.updateClock(()=>{SSB.net.ebt.request(SSB.net.id,!0),r.following.forEach(e=>SSB.net.ebt.request(e,!0)),r.extended.forEach(e=>SSB.net.ebt.request(e,!0)),SSB.net.ebt.startEBT(e)})})},exports.fullSync=function(e){SSB.db.feedSyncer.syncFeeds(e,exports.EBTSync)}; +},{"./core":3,"os":322,"path":331}],2:[function(require,module,exports){ +const validate=require("ssb-validate"),keys=require("ssb-keys"),pull=require("pull-stream"),raf=require("polyraf"),path=require("path");function deleteDatabaseFile(e){const t=require("path"),r=raf(t.join(SSB.dir,e));r.open((e,t)=>{if(e)return console.error(e);r.destroy()})}exports.getPeer=function(){let e=Array.from(SSB.net.conn.hub().entries());var t=(e=e.filter(([,e])=>!!e.key).map(([e,t])=>({address:e,data:t}))).find(e=>"room"!=e.data.type);let r=Object.values(SSB.net.peers).flat();return t?r.find(e=>e.id==t.data.key):r.length>0?r[0]:null},exports.removeIndexes=function(e){SSB.db.clearIndexes()},exports.removeDB=function(){deleteDatabaseFile("log.bipf"),new(require("idb-kv-store"))(path.join(SSB.dir,"indexes")).clear()},exports.removeBlobs=function(){window.webkitRequestFileSystem(window.PERSISTENT,0,function(e){!function e(t,r){t.root.getDirectory(r,{},function(r){r.createReader().readEntries(function(r){for(var n=0;n{if(t)return console.error(t);e.destroy()})}}})})}(e,"/.ssb-lite/blobs")})},exports.EBTSync=function(e){console.log("doing ebt with",e.id),SSB.db.getIndex("contacts").getGraphForFeed(SSB.net.id,(t,r)=>{SSB.net.ebt.updateClock(()=>{SSB.net.ebt.request(SSB.net.id,!0),r.following.forEach(e=>SSB.net.ebt.request(e,!0)),r.extended.forEach(e=>SSB.net.ebt.request(e,!0)),SSB.net.ebt.startEBT(e)})})},exports.fullSync=function(e){SSB.feedSyncer.syncFeeds(e,exports.EBTSync)}; -},{"idb-kv-store":191,"path":265,"polyraf":281,"pull-stream":353,"ssb-keys":503,"ssb-validate":518}],3:[function(require,module,exports){ -exports.init=function(e,o){require("pull-stream");const r=require("events");if(SSB={events:new r},"undefined"==typeof localStorage||null===localStorage){const o=require("path"),r=require("fs");r.existsSync(e)||r.mkdirSync(e);var t=require("node-localstorage").LocalStorage;localStorage=new t(o.join(e,"localstorage"))}require("sodium-browserify").events.on("sodium-browserify:wasm loaded",function(){console.log("wasm loaded");var r=require("./net").init(e,o),t=require("./db").init(e,o);console.log("my id: ",r.id);var i=require("./core-helpers"),s=require("ssb-validate"),n=s.initial();t.getAllLatest((e,o)=>{for(var r in o)n.feeds[r]={id:o[r].id,timestamp:o[r].timestamp,sequence:o[r].sequence,queue:[]}}),SSB=Object.assign(SSB,{db:t,net:r,dir:e,getPeer:i.getPeer,validate:s,state:n,removeDB:i.removeDB,removeIndexes:i.removeIndexes,removeBlobs:i.removeBlobs,box:require("ssb-keys").box,blobFiles:require("ssb-blob-files"),publish:function(e,o){n.queue=[],n=s.appendNew(n,null,r.config.keys,e,Date.now()),t.add(n.queue[0].value,(e,t)=>{r.post(t.value),o(e,t)})},hops:1}),SSB.net.friends={hops:function(e){t.contacts.getGraphForFeed(SSB.net.id,(o,r)=>{let t={};r.following.forEach(e=>t[e]=1),r.extended.forEach(e=>t[e]=2),e(o,t)})}},SSB.net.conn.start(),SSB.events.emit("SSB: loaded")})}; +},{"idb-kv-store":216,"path":331,"polyraf":347,"pull-stream":428,"ssb-keys":586,"ssb-validate":601}],3:[function(require,module,exports){ +exports.init=function(e,r){const o=require("./feed-syncer"),s=require("events");SSB={events:new s,dbOperators:require("ssb-db2/operators")},SSB.dbOperators.mentions=require("ssb-db2/operators/full-mentions"),require("sodium-browserify").events.on("sodium-browserify:wasm loaded",function(){console.log("wasm loaded");var s=require("./net").init(e,r);console.log("my id: ",s.id);var n=require("./core-helpers");const t=require("./partial")(e);SSB=Object.assign(SSB,{db:s.db,net:s,dir:e,feedSyncer:o(s.id,t,s.db),getPeer:n.getPeer,removeDB:n.removeDB,removeIndexes:n.removeIndexes,removeBlobs:n.removeBlobs,box:require("ssb-keys").box,blobFiles:require("ssb-blob-files"),partial:t,hops:1}),SSB.net.friends={hops:function(e){s.db.getIndex("contacts").getGraphForFeed(SSB.net.id,(r,o)=>{let s={};o.following.forEach(e=>s[e]=1),o.extended.forEach(e=>s[e]=2),e(r,s)})}},SSB.net.conn.start(),SSB.events.emit("SSB: loaded")})}; -},{"./core-helpers":2,"./db":4,"./net":10,"events":149,"fs":87,"node-localstorage":249,"path":265,"pull-stream":353,"sodium-browserify":475,"ssb-blob-files":480,"ssb-keys":503,"ssb-validate":518}],4:[function(require,module,exports){ -const push=require("push-stream"),hash=require("ssb-keys/util").hash,validate=require("ssb-validate"),keys=require("ssb-keys"),path=require("path"),Log=require("./log"),FullScanIndexes=require("./indexes/full-scan"),Partial=require("./indexes/partial"),JITDb=require("jitdb"),FeedSyncer=require("./feed-syncer");function getId(e){return"%"+hash(JSON.stringify(e,null,2))}exports.init=function(e,t){const n=Log(e,t),a=JITDb(n,path.join(e,"indexes")),s=FullScanIndexes(n,e),r=s.contacts,i=Partial(e),o=FeedSyncer(i,r);function l(e,t){s.getDataFromKey(e,(e,n)=>{n?t(null,n.value):t(e)})}function u(e,t){var a=getId(e);s.getDataFromKey(a,(s,r)=>{if(r)t(null,r.value);else{if("string"==typeof e.content){const t=keys.unbox(e.content,SSB.net.config.keys.private);if(t){const n=e.content;e.content=t,e.meta={private:"true",original:{content:n}}}}n.add(a,e,t)}})}function d(e,t){s.keyToSeq(e,(e,a)=>e?t(e):null==a?t(new Error("seq is null!")):void n.del(a,t))}const c=null;return{get:l,getSync:function(e,t){if(s.seq.value===n.since.value)l(e,t);else var a=s.seq(()=>{s.seq.value===n.since.value&&(a(),l(e,t))})},add:u,del:d,deleteFeed:function(e,t){SSB.db.jitdb.onReady(()=>{SSB.db.jitdb.query({type:"EQUAL",data:{seek:SSB.db.jitdb.seekAuthor,value:e,indexType:"author"}},(n,a)=>{push(push.values(a),push.asyncMap((e,t)=>{d(e.key,t)}),push.collect(n=>{n||(delete SSB.state.feeds[e],s.removeFeedFromLatest(e)),t(n)}))})})},validateAndAdd:function(e,t){const n=e.author in SSB.state.feeds;try{if(SSB.state=n?validate.append(SSB.state,c,e):validate.appendOOO(SSB.state,c,e),SSB.state.error)return t(SSB.state.error);u(e,t)}catch(e){return t(e)}},validateAndAddOOO:function(e,t){try{if(validate.initial(),validate.appendOOO(SSB.state,c,e),SSB.state.error)return t(SSB.state.error);u(e,t)}catch(e){return t(e)}},getStatus:function(){const e=i.getSync(),t=r.getGraphForFeedSync(SSB.net.id);let a=0,o=0,l=0,u=0,d=0,c=0;return t.following.forEach(t=>{e[t]&&e[t].full&&(d+=1),c+=1}),t.extended.forEach(t=>{e[t]&&e[t].syncedProfile&&(a+=1),e[t]&&e[t].syncedContacts&&(o+=1),e[t]&&e[t].syncedMessages&&(l+=1),u+=1}),{log:n.since.value,indexes:s.seq.value,partial:{totalPartial:u,profilesSynced:a,contactsSynced:o,messagesSynced:l,totalFull:c,fullSynced:d}}},getAllLatest:s.getAllLatest,getDataFromAuthorSequence:s.getDataFromAuthorSequence,contacts:r,profiles:s.profiles,getMessagesByRoot:s.getMessagesByRoot,getMessagesByMention:s.getMessagesByMention,getMessagesByVoteLink:s.getMessagesByVoteLink,jitdb:a,onDrain:n.onDrain,getLatest:s.getLatest,clearIndexes:function(){s.remove(()=>{})},partial:i,feedSyncer:o}}; +},{"./core-helpers":2,"./feed-syncer":4,"./net":7,"./partial":679,"events":172,"sodium-browserify":541,"ssb-blob-files":546,"ssb-db2/operators":584,"ssb-db2/operators/full-mentions":583,"ssb-keys":586}],4:[function(require,module,exports){ +module.exports=function(e,t,n){const s=require("pull-stream"),l=require("pull-paramap"),a=require("ssb-validate"),c=n.getIndex("contacts");function i(e,n,l,c,i){if(c[e]&&c[e][n])i(null,e);else{let c=SSB.db.addOOO;if("syncedMessages"==n){const e=a.initial();c=((t,n)=>SSB.db.addOOOStrictOrder(t,e,n))}else c=((e,t)=>{const n=a.initial();SSB.db.addOOOStrictOrder(e,n,t)});s(l(),s.asyncMap(c),s.collect((s,l)=>{if(s)return console.error(s.message),i(s);var a={};a[n]=!0,t.updateState(e,a,t=>{i(t,e)})}))}}var o=!1;return{syncFeeds:function e(a,d){o=!0,console.log("syncing feeds"),t.get((r,f)=>{c.getGraphForFeed(SSB.net.id,(r,y)=>{console.time("full feeds"),s(s.values(y.following),s.asyncMap((e,l)=>{f[e]&&f[e].full?l():n.getAllLatest((n,c)=>{const i=c[e]?c[e].sequence+1:0;s(a.partialReplication.getFeed({id:e,seq:i,keys:!1}),s.asyncMap(SSB.db.add),s.collect(n=>{if(n)throw n;t.updateState(e,{full:!0},l)}))})}),s.collect(()=>{console.timeEnd("full feeds"),console.time("partial feeds"),c.getGraphForFeed(SSB.net.id,(t,n)=>{s(s.values(n.extended),l((e,t)=>{i(e,"syncedMessages",()=>a.partialReplication.getFeedReverse({id:e,keys:!1,limit:25}),f,t)},5),l((e,t)=>{i(e,"syncedProfile",()=>a.partialReplication.getMessagesOfType({id:e,type:"about"}),f,t)},5),l((e,t)=>{i(e,"syncedContacts",()=>a.partialReplication.getMessagesOfType({id:e,type:"contact"}),f,t)},5),s.collect(()=>{console.timeEnd("partial feeds"),c.getGraphForFeed(SSB.net.id,(t,s)=>{JSON.stringify(n)===JSON.stringify(s)?(o=!1,d&&d(a)):e(a,d)})}))})}))})})},syncing:o,status:function(){const n=t.getSync(),s=c.getGraphForFeedSync(e);let l=0,a=0,i=0,o=0,d=0,r=0;return s.following.forEach(e=>{n[e]&&n[e].full&&(l+=1),a+=1}),s.extended.forEach(e=>{n[e]&&n[e].syncedProfile&&(i+=1),n[e]&&n[e].syncedContacts&&(o+=1),n[e]&&n[e].syncedMessages&&(d+=1),r+=1}),{totalPartial:r,profilesSynced:i,contactsSynced:o,messagesSynced:d,totalFull:a,fullSynced:l}},inSync:function(){const e=t.getSync(),n=c.getGraphForFeedSync(SSB.net.id);let s=0,l=0,a=0,i=0,o=0,d=0;return n.following.forEach(t=>{e[t]&&e[t].full&&(o+=1),d+=1}),n.extended.forEach(t=>{e[t]&&e[t].syncedProfile&&(l+=1),e[t]&&e[t].syncedContacts&&(a+=1),e[t]&&e[t].syncedMessages&&(i+=1),s+=1}),(0!==s||0!==d)&&(s==i&&s==a&&s==l&&d==o)}}}; -},{"./feed-syncer":5,"./indexes/full-scan":6,"./indexes/partial":7,"./log":8,"jitdb":205,"path":265,"push-stream":399,"ssb-keys":503,"ssb-keys/util":511,"ssb-validate":518}],5:[function(require,module,exports){ -module.exports=function(e,t){const n=require("pull-stream"),a=require("pull-paramap");function s(t,a,s,l,i){l[t]&&l[t][a]?i(null,t):n(s(),n.asyncMap(SSB.db.validateAndAddOOO),n.collect((n,s)=>{if(n)return console.error(n.message),i(n);SSB.state.queue=[];var l={};l[a]=!0,e.updateState(t,l,e=>{i(e,t)})}))}var l=!1;return{syncFeeds:function i(d,o){l=!0,console.log("syncing feeds"),e.get((c,r)=>{t.getGraphForFeed(SSB.net.id,(c,p)=>{console.time("full feeds"),n(n.values(p.following),n.asyncMap((t,a)=>{r[t]&&r[t].full?a():(delete SSB.state.feeds[t],n(d.partialReplication.getFeed({id:t,seq:0,keys:!1}),n.asyncMap(SSB.db.validateAndAdd),n.collect(n=>{if(n)throw n;SSB.state.queue=[],e.updateState(t,{full:!0},a)})))}),n.collect(()=>{console.timeEnd("full feeds"),console.time("partial feeds"),t.getGraphForFeed(SSB.net.id,(e,c)=>{n(n.values(c.extended),a((e,t)=>{s(e,"syncedMessages",()=>d.partialReplication.getFeedReverse({id:e,keys:!1,limit:25}),r,t)},5),a((e,t)=>{s(e,"syncedProfile",()=>d.partialReplication.getMessagesOfType({id:e,type:"about"}),r,t)},5),a((e,t)=>{s(e,"syncedContacts",()=>d.partialReplication.getMessagesOfType({id:e,type:"contact"}),r,t)},5),n.collect(()=>{console.timeEnd("partial feeds"),t.getGraphForFeed(SSB.net.id,(e,t)=>{JSON.stringify(c)===JSON.stringify(t)?(l=!1,o&&o(d)):i(d,o)})}))})}))})})},syncing:l,inSync:function(){const n=e.getSync(),a=t.getGraphForFeedSync(SSB.net.id);let s=0,l=0,i=0,d=0,o=0,c=0;return a.following.forEach(e=>{n[e]&&n[e].full&&(o+=1),c+=1}),a.extended.forEach(e=>{n[e]&&n[e].syncedProfile&&(l+=1),n[e]&&n[e].syncedContacts&&(i+=1),n[e]&&n[e].syncedMessages&&(d+=1),s+=1}),(0!==s||0!==c)&&(s==d&&s==i&&s==l&&c==o)}}}; +},{"pull-paramap":421,"pull-stream":428,"ssb-validate":601}],5:[function(require,module,exports){ +(function (Buffer){(function (){ +const bipf=require("bipf"),pull=require("pull-stream"),pl=require("pull-level"),jsonCodec=require("flumecodec/json"),Plugin=require("ssb-db2/indexes/plugin"),isFeed=require("ssb-ref").isFeed;module.exports=function(e,n){const t=Buffer.from("value"),i=Buffer.from("author"),o=Buffer.from("content"),r=Buffer.from("type"),f=Buffer.from("about");let l=[];const{level:u,offset:s,stateLoaded:c,onData:a,writeBatch:p}=Plugin(n,"profiles",1,function(e,n){if(e.offset{d={},t.forEach(e=>d[e.key]=e.value),e()}))});let d={};return{offset:s,stateLoaded:c,onData:a,writeBatch:p,name:"profiles",remove:u.clear,close:u.close.bind(u),getProfile:function(e){return d[e]||{}},getProfiles:function(){return d}}}; -},{"pull-paramap":346,"pull-stream":353}],6:[function(require,module,exports){ -(function (Buffer){ -const bipf=require("bipf"),Obv=require("obv"),AtomicFile=require("atomic-file"),debounce=require("lodash.debounce"),path=require("path"),sort=require("ssb-sort"),push=require("push-stream"),isFeed=require("ssb-ref").isFeed;module.exports=function(e,n){var i=Obv();i.set(-1);const o=require("../waiting-queue")(),t=require("../waiting-queue")(),r=require("../waiting-queue")(),u=require("../waiting-queue")(e,i),s=require("../waiting-queue")(e,i),f=require("../waiting-queue")(e,i),a=require("../waiting-queue")(e,i),l=require("../waiting-queue")(e,i);var c={},d={},p={},g={},v={},m={},q={},b={},y=[],h=AtomicFile(path.join(n,"indexes/all.json")),k=AtomicFile(path.join(n,"indexes/hops.json")),F=AtomicFile(path.join(n,"indexes/profiles.json"));var B=debounce(function(){h.set({seq:i.value,keyToSeq:c,authorSequenceToSeq:d,authorLatest:p,mentions:g,roots:v,links:m},e=>{e&&console.error("error saving full index",e)})},1e3,{leading:!0});var w=debounce(function(){k.set({seq:i.value,hops:q},e=>{e&&console.error("error saving full index",e)})},1e3,{leading:!0});var S,K=debounce(function(){F.set({seq:i.value,profiles:b},e=>{e&&console.error("error saving full index",e)})},1e3,{leading:!0});function x(n,i,o){n.get((n,t)=>{t&&t[i]&&push(push.values(t[i]),push.asyncMap(e.get),push.collect((e,n)=>{const i=n.map(e=>bipf.decode(e,0));sort(i),i.reverse(),o(null,i)}))})}S=(()=>{var n=0;const h=Date.now(),k=Buffer.from("value"),F=Buffer.from("key"),S=Buffer.from("author"),x=Buffer.from("sequence"),A=Buffer.from("timestamp"),j=Buffer.from("content"),L=Buffer.from("root"),M=Buffer.from("mentions"),T=Buffer.from("type"),D=Buffer.from("contact"),G=Buffer.from("about"),O=Buffer.from("vote"),$=Buffer.from("link");function C(e){var o=0;o=bipf.seekKey(e.value,o,F);const t=bipf.decode(e.value,o);if(c[t]=e.seq,o=0,~(o=bipf.seekKey(e.value,o,k))){var r=bipf.seekKey(e.value,o,S);const n=bipf.decode(e.value,r);var u=bipf.seekKey(e.value,o,x);const i=bipf.decode(e.value,u);var s=bipf.seekKey(e.value,o,A);const c=bipf.decode(e.value,s);d[[n,i]]=e.seq;var f=0;p[n]&&(f=p[n].sequence),i>f&&(p[n]={id:t,sequence:i,timestamp:c});var a=bipf.seekKey(e.value,o,j);if(~a){var l=bipf.seekKey(e.value,a,L);if(~l){const n=bipf.decode(e.value,l);if(n){let i=v[n]||[];i.push(e.seq),v[n]=i}}if(~bipf.seekKey(e.value,a,M)){const n=bipf.decode(e.value,a);Array.isArray(n)&&n.forEach(n=>{if(n.link&&"string"==typeof n.link&&("@"===n.link[0]||"%"===n.link[0])){let i=g[n.link]||[];i.push(e.seq),g[n.link]=i}})}var h=bipf.seekKey(e.value,a,T);if(~h)if(0===bipf.compareString(e.value,h,D))!function(e,n){var i=n.contact,o=n.blocking||n.flagged?-1:!0===n.following?1:-2;if(isFeed(e)&&isFeed(i)){if(q[e]=q[e]||{},q[e][i]=o,e==SSB.net.id)for(var t=0;t{console.log(`key index full scan time: ${Date.now()-h}ms, total items: ${n}`),e.stream({gt:i.value,live:!0}).pipe({paused:!1,write:C}),o.done(null,p),t.done(null,c),r.done(null,d),u.done(null,g),s.done(null,v),f.done(null,m),a.done(null,q),l.done(null,b)}})}),h.get((e,n)=>{e||(i.set(n.seq),c=n.keyToSeq,d=n.authorSequenceToSeq,p=n.authorLatest,g=n.mentions,v=n.roots,m=n.links),k.get((e,n)=>{e||(q=n.hops),F.get((e,n)=>{e||(b=n.profiles),S()})})});var A={contacts:{onGraphChange:function(e){return y.push(e),function(){y=y.filter(n=>n!=e)}},isFollowing:function(e,n){return!!q[e]&&1===q[e][n]},isBlocking:function(e,n){return!!q[e]&&-1===q[e][n]},getGraphForFeed:function(e,n){a.getFullySynced((i,o)=>{n(i,A.contacts.getGraphForFeedSync(e))})},getGraphForFeedSync:function(e){let n=[],i=[],o=[];for(var t in q[e])A.contacts.isFollowing(e,t)?n.push(t):A.contacts.isBlocking(e,t)&&i.push(t);for(var r in q)if(r!==e&&n.includes(r))for(var t in q[r])if(A.contacts.isFollowing(r,t)){if(t===e)continue;if(n.includes(t))continue;if(i.includes(t))continue;o.push(t)}return{following:n,blocking:i,extended:[...new Set(o)]}}},profiles:{get:l.get},getMessagesByMention:function(e,n){x(u,e,n)},getMessagesByRoot:function(e,n){x(s,e,n)},getMessagesByVoteLink:function(e,n){x(f,e,n)},getDataFromKey:function(n,i){t.get(()=>{c[n]?e.get(c[n],(e,n)=>{if(e)return i(e);i(null,bipf.decode(n,0))}):i("Key not found:"+n)})},getDataFromAuthorSequence:function(n,i){r.get(()=>{d[n]?e.get(d[n],(e,n)=>{if(e)return i(e);i(null,bipf.decode(n,0))}):i("Key not found:"+n)})},getLatest:function(e,n){o.get(()=>{p[e]?n(null,p[e]):n("Author not found:"+e)})},getAllLatest:function(e){o.get(e)},seq:i,keyToSeq(e,n){t.get(()=>{c[e]?n(null,c[e]):n("Key not found:"+e)})},removeFeedFromLatest:function(e){delete p[e]},remove:function(e){h.destroy(n=>{if(n)return e(n);k.destroy(n=>{if(n)return e(n);F.destroy(e)})})}};return A}; +}).call(this)}).call(this,require("buffer").Buffer) +},{"bipf":54,"buffer":101,"flumecodec/json":176,"pull-level":411,"pull-stream":428,"ssb-db2/indexes/plugin":578,"ssb-ref":596}],6:[function(require,module,exports){ +(function (Buffer){(function (){ +const bipf=require("bipf"),pull=require("pull-stream"),pl=require("pull-level"),jsonCodec=require("flumecodec/json"),Plugin=require("ssb-db2/indexes/plugin"),promisify=require("promisify-4loc"),isFeed=require("ssb-ref").isFeed;module.exports=function(e,n){const t=Buffer.from("value"),o=Buffer.from("author"),i=Buffer.from("content"),r=Buffer.from("type"),l=Buffer.from("contact");let f=[];const{level:u,offset:c,stateLoaded:s,onData:a,writeBatch:p}=Plugin(n,"contacts",1,function(e,n){if(e.offset{let o={};if(t.forEach(e=>o[e.key[1]]=parseInt(e.value,10)),e)return n(e);n(null,o)}))}function h(e,n){return!!y[e]&&1===y[e][n]}function b(e,n){return!!y[e]&&-1===y[e][n]}let y={};function m(e){let n=[],t=[],o=[];for(let o in y[e])h(e,o)?n.push(o):b(e,o)&&t.push(o);for(let i in y)if(i!==e&&n.includes(i))for(let r in y[i])if(h(i,r)){if(r===e)continue;if(n.includes(r))continue;if(t.includes(r))continue;o.push(r)}return{following:n,blocking:t,extended:[...new Set(o)]}}return{offset:c,stateLoaded:s,onData:a,writeBatch:p,name:"contacts",remove:u.clear,close:u.close.bind(u),get:function(e,n,t){u.get([e,n],(e,n)=>{e?t(e):t(null,parseInt(n,10))})},getGraphForFeedHops1:function(e,n){g(e,(t,o)=>{y[e]=o,n(t,m(e))})},getGraphForFeed:function(e,n){SSB.db.onDrain("contacts",()=>{g(e,(t,o)=>{y[e]=o;let i=[];for(var r in o)if(o[r]>0){const e=r;y[e]||i.push(promisify(n=>{g(e,(t,o)=>{!t&&Object.keys(o).length>0&&(y[e]=o),n()})})())}Promise.all(i).then(()=>n(t,m(e)))})})},getGraphForFeedSync:m,isFollowing:h,isBlocking:b}}; -}).call(this,require("buffer").Buffer) -},{"../waiting-queue":584,"atomic-file":34,"bipf":40,"buffer":88,"lodash.debounce":211,"obv":252,"path":265,"push-stream":399,"ssb-ref":513,"ssb-sort":517}],7:[function(require,module,exports){ -module.exports=function(e){const t=require("atomic-file"),n=require("lodash.debounce"),r=require("path"),o=require("../waiting-queue")();var i={},u=t(r.join(e,"indexes/partial.json"));u.get((e,t)=>{t&&(i=t.state),o.done(null,i)});var a=n(function(){u.set({state:i},e=>{e&&console.error("error saving partial",e)})},1e3,{leading:!0});function c(e){a(),e()}return{updateState:function(e,t,n){o.get(()=>{let r=i[e]||{};i[e]=Object.assign(r,t),c(n)})},removeFeed:function(e,t){o.get(()=>{delete i[e],c(t)})},get:o.get,getSync:function(){return i},remove:function(e){u.destroy(e)}}}; +}).call(this)}).call(this,require("buffer").Buffer) +},{"bipf":54,"buffer":101,"flumecodec/json":176,"promisify-4loc":350,"pull-level":411,"pull-stream":428,"ssb-db2/indexes/plugin":578,"ssb-ref":596}],7:[function(require,module,exports){ +(function (Buffer){(function (){ +const SecretStack=require("secret-stack"),caps=require("ssb-caps"),ssbKeys=require("ssb-keys"),helpers=require("./core-helpers"),path=require("path");exports.init=function(e,n){var s,r=ssbKeys.loadOrCreateSync(path.join(e,"secret")),t=Object.assign({caps:{shs:Buffer.from(caps.shs,"base64")},keys:r,connections:{incoming:{tunnel:[{scope:"public",transform:"shs"}]},outgoing:{net:[{transform:"shs"}],ws:[{transform:"shs"},{transform:"noauth"}],tunnel:[{transform:"shs"}]}},path:e,timers:{inactivity:3e4},conn:{autostart:!1,hops:1,populatePubs:!1},ebt:{logging:!1},blobs:{sympathy:0,stingy:!1,pushy:3,max:262144}},n),i=SecretStack(t).use(require("ssb-db2/db")).use(require("ssb-db2/compat")).use({init:function(e,n){e.db.registerIndex(require("ssb-db2/indexes/full-mentions"))}}).use({init:function(e,n){e.db.registerIndex(require("./indexes/contacts"))}}).use({init:function(e,n){e.db.registerIndex(require("./indexes/about-profile"))}}).use(require("./ssb-partial-replication")).use(require("./simple-ooo")).use(require("ssb-ws")).use(require("./simple-ebt")).use(require("ssb-conn")).use(require("ssb-room/tunnel/client")).use(require("ssb-no-auth")).use(require("./simple-blobs"))();return i.sync=function(e){SSB.feedSyncer.syncing||(SSB.feedSyncer.inSync()?helpers.EBTSync(e):helpers.fullSync(e))},i.on("rpc:connect",function(e,n){console.log("connected to:",e.id);let r=Array.from(SSB.net.conn.hub().entries());var t=(r=r.filter(([,e])=>!!e.key).map(([e,n])=>({address:e,data:n}))).find(n=>n.data.key==e.id);t&&"room"!==t.data.type&&(n&&(console.log("syncing with",e.id),i.sync(e)),function n(){e.tunnel.ping(function(e,r){if(e)return console.error(e);clearTimeout(s),s=setTimeout(n,1e4)})}())}),i.on("replicate:finish",function(){console.log("finished ebt replicate")}),i.connectAndRemember=function(e,n){i.conn.connect(e,n,(s,r)=>{i.conn.remember(e,Object.assign(n,{autoconnect:!0}))})},i.directConnect=function(e,n){i.conn.connect(e,n)},i}; -},{"../waiting-queue":584,"atomic-file":34,"lodash.debounce":211,"path":265}],8:[function(require,module,exports){ -(function (Buffer){ -var OffsetLog=require("async-flumelog"),bipf=require("bipf"),path=require("path");module.exports=function(e,n){n=n||{};var f=OffsetLog(path.join(e,"log.bipf"),{blockSize:65536});return f.add=function(e,n,i){var o={key:e,value:n,timestamp:Date.now()},t=Buffer.alloc(bipf.encodingLength(o));bipf.encode(o,t,0),f.append(t,function(e){e?i(e):i(null,o)})},f}; +}).call(this)}).call(this,require("buffer").Buffer) +},{"./core-helpers":2,"./indexes/about-profile":5,"./indexes/contacts":6,"./simple-blobs":680,"./simple-ebt":681,"./simple-ooo":682,"./ssb-partial-replication":683,"buffer":101,"path":331,"secret-stack":522,"ssb-caps":550,"ssb-conn":565,"ssb-db2/compat":572,"ssb-db2/db":573,"ssb-db2/indexes/full-mentions":577,"ssb-keys":586,"ssb-no-auth":595,"ssb-room/tunnel/client":598,"ssb-ws":608}],8:[function(require,module,exports){ +var nextTick=require("./next-tick");function AbstractChainedBatch(t){if("object"!=typeof t||null===t)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=t,this._operations=[],this._written=!1}AbstractChainedBatch.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},AbstractChainedBatch.prototype.put=function(t,e){this._checkWritten();var i=this.db._checkKey(t)||this.db._checkValue(e);if(i)throw i;return t=this.db._serializeKey(t),e=this.db._serializeValue(e),this._put(t,e),this},AbstractChainedBatch.prototype._put=function(t,e){this._operations.push({type:"put",key:t,value:e})},AbstractChainedBatch.prototype.del=function(t){this._checkWritten();var e=this.db._checkKey(t);if(e)throw e;return t=this.db._serializeKey(t),this._del(t),this},AbstractChainedBatch.prototype._del=function(t){this._operations.push({type:"del",key:t})},AbstractChainedBatch.prototype.clear=function(){return this._checkWritten(),this._clear(),this},AbstractChainedBatch.prototype._clear=function(){this._operations=[]},AbstractChainedBatch.prototype.write=function(t,e){if(this._checkWritten(),"function"==typeof t&&(e=t),"function"!=typeof e)throw new Error("write() requires a callback argument");"object"==typeof t&&null!==t||(t={}),this._written=!0,this._write(t,e)},AbstractChainedBatch.prototype._write=function(t,e){this.db._batch(this._operations,t,e)},AbstractChainedBatch.prototype._nextTick=nextTick,module.exports=AbstractChainedBatch; -}).call(this,require("buffer").Buffer) -},{"async-flumelog":30,"bipf":40,"buffer":88,"path":265}],9:[function(require,module,exports){ -function isString(t){return"string"==typeof t}exports.originalValue=function(t){var i={};for(let r in t)"meta"!==r&&"cyphertext"!==r&&"private"!==r&&"unbox"!==r&&(i[r]=t[r]);if(t.meta&&t.meta.original)for(let r in t.meta.original)i[r]=t.meta.original[r];return i},exports.originalData=function(t){return t.value=exports.originalValue(t.value),t}; +},{"./next-tick":12}],9:[function(require,module,exports){ +var nextTick=require("./next-tick");function AbstractIterator(t){if("object"!=typeof t||null===t)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=t,this._ended=!1,this._nexting=!1}AbstractIterator.prototype.next=function(t){var e=this;if("function"!=typeof t)throw new Error("next() requires a callback argument");return e._ended?(nextTick(t,new Error("cannot call next() after end()")),e):e._nexting?(nextTick(t,new Error("cannot call next() before previous next() has completed")),e):(e._nexting=!0,e._next(function(){e._nexting=!1,t.apply(null,arguments)}),e)},AbstractIterator.prototype._next=function(t){nextTick(t)},AbstractIterator.prototype.seek=function(t){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");t=this.db._serializeKey(t),this._seek(t)},AbstractIterator.prototype._seek=function(t){},AbstractIterator.prototype.end=function(t){if("function"!=typeof t)throw new Error("end() requires a callback argument");if(this._ended)return nextTick(t,new Error("end() already called on iterator"));this._ended=!0,this._end(t)},AbstractIterator.prototype._end=function(t){nextTick(t)},AbstractIterator.prototype._nextTick=nextTick,module.exports=AbstractIterator; -},{}],10:[function(require,module,exports){ -(function (Buffer){ -const SecretStack=require("secret-stack"),caps=require("ssb-caps"),ssbKeys=require("ssb-keys"),helpers=require("./core-helpers"),path=require("path");exports.init=function(e,n){var s,r=ssbKeys.loadOrCreateSync(path.join(e,"secret")),t=Object.assign({caps:{shs:Buffer.from(caps.shs,"base64")},keys:r,connections:{incoming:{tunnel:[{scope:"public",transform:"shs"}]},outgoing:{net:[{transform:"shs"}],ws:[{transform:"shs"},{transform:"noauth"}],tunnel:[{transform:"shs"}]}},path:e,timers:{inactivity:3e4},conn:{autostart:!1,hops:1,populatePubs:!1},ebt:{logging:!1},blobs:{sympathy:0,stingy:!1,pushy:3,max:262144}},n),o=SecretStack(t).use(require("./ssb-db")).use(require("./ssb-partial-replication")).use(require("./simple-ooo")).use(require("ssb-ws")).use(require("./simple-ebt")).use(require("ssb-conn")).use(require("ssb-room/tunnel/client")).use(require("ssb-no-auth")).use(require("./simple-blobs"))();return o.sync=function(e){SSB.db.feedSyncer.syncing||(SSB.db.feedSyncer.inSync()?helpers.EBTSync(e):helpers.fullSync(e))},o.on("rpc:connect",function(e,n){console.log("connected to:",e.id);let r=Array.from(SSB.net.conn.hub().entries());var t=(r=r.filter(([,e])=>!!e.key).map(([e,n])=>({address:e,data:n}))).find(n=>n.data.key==e.id);t&&"room"!==t.data.type&&(n&&(console.log("syncing with",e.id),o.sync(e)),function n(){e.tunnel.ping(function(e,r){if(e)return console.error(e);clearTimeout(s),s=setTimeout(n,1e4)})}())}),o.on("replicate:finish",function(){console.log("finished ebt replicate")}),o.connectAndRemember=function(e,n){o.conn.connect(e,n,(s,r)=>{o.conn.remember(e,Object.assign(n,{autoconnect:!0}))})},o.directConnect=function(e,n){o.conn.connect(e,n)},o}; +},{"./next-tick":12}],10:[function(require,module,exports){ +var xtend=require("xtend"),supports=require("level-supports"),Buffer=require("buffer").Buffer,AbstractIterator=require("./abstract-iterator"),AbstractChainedBatch=require("./abstract-chained-batch"),nextTick=require("./next-tick"),hasOwnProperty=Object.prototype.hasOwnProperty,rangeOptions="start end gt gte lt lte".split(" ");function AbstractLevelDOWN(t){this.status="new",this.supports=supports(t,{status:!0})}function cleanRangeOptions(t,e){var r={};for(var n in e)if(hasOwnProperty.call(e,n)){var i=e[n];isRangeOption(n)&&(i=t._serializeKey(i)),r[n]=i}return r}function isRangeOption(t){return-1!==rangeOptions.indexOf(t)}AbstractLevelDOWN.prototype.open=function(t,e){var r=this,n=this.status;if("function"==typeof t&&(e=t),"function"!=typeof e)throw new Error("open() requires a callback argument");"object"==typeof t&&null!==t||(t={}),t.createIfMissing=!1!==t.createIfMissing,t.errorIfExists=!!t.errorIfExists,this.status="opening",this._open(t,function(t){if(t)return r.status=n,e(t);r.status="open",e()})},AbstractLevelDOWN.prototype._open=function(t,e){nextTick(e)},AbstractLevelDOWN.prototype.close=function(t){var e=this,r=this.status;if("function"!=typeof t)throw new Error("close() requires a callback argument");this.status="closing",this._close(function(n){if(n)return e.status=r,t(n);e.status="closed",t()})},AbstractLevelDOWN.prototype._close=function(t){nextTick(t)},AbstractLevelDOWN.prototype.get=function(t,e,r){if("function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("get() requires a callback argument");var n=this._checkKey(t);if(n)return nextTick(r,n);t=this._serializeKey(t),"object"==typeof e&&null!==e||(e={}),e.asBuffer=!1!==e.asBuffer,this._get(t,e,r)},AbstractLevelDOWN.prototype._get=function(t,e,r){nextTick(function(){r(new Error("NotFound"))})},AbstractLevelDOWN.prototype.put=function(t,e,r,n){if("function"==typeof r&&(n=r),"function"!=typeof n)throw new Error("put() requires a callback argument");var i=this._checkKey(t)||this._checkValue(e);if(i)return nextTick(n,i);t=this._serializeKey(t),e=this._serializeValue(e),"object"==typeof r&&null!==r||(r={}),this._put(t,e,r,n)},AbstractLevelDOWN.prototype._put=function(t,e,r,n){nextTick(n)},AbstractLevelDOWN.prototype.del=function(t,e,r){if("function"==typeof e&&(r=e),"function"!=typeof r)throw new Error("del() requires a callback argument");var n=this._checkKey(t);if(n)return nextTick(r,n);t=this._serializeKey(t),"object"==typeof e&&null!==e||(e={}),this._del(t,e,r)},AbstractLevelDOWN.prototype._del=function(t,e,r){nextTick(r)},AbstractLevelDOWN.prototype.batch=function(t,e,r){if(!arguments.length)return this._chainedBatch();if("function"==typeof e&&(r=e),"function"==typeof t&&(r=t),"function"!=typeof r)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(t))return nextTick(r,new Error("batch(array) requires an array argument"));if(0===t.length)return nextTick(r);"object"==typeof e&&null!==e||(e={});for(var n=new Array(t.length),i=0;i>6],o=0==(32&t);if(31==(31&t)){var n=t;for(t=0;128==(128&n);){if(n=r.readUInt8(e),r.isError(n))return n;t<<=7,t|=127&n}}else t&=31;return{cls:i,primitive:o,tag:t,tagStr:der.tag[t]}}function derDecodeLen(r,e,t){var i=r.readUInt8(t);if(r.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;var o=127&i;if(o>4)return r.error("length octect is too long");i=0;for(var n=0;n=31?n.error("Multi-octet tag encoding unsupported"):(r||(o|=32),o|=der.tagClassByName[t||"universal"]<<6)}module.exports=DEREncoder,DEREncoder.prototype.encode=function(e,r){return this.tree._encode(e,r).join()},inherits(DERNode,base.Node),DERNode.prototype._encodeComposite=function(e,r,t,n){var o,i=encodeTag(e,r,t,this.reporter);if(n.length<128)return(o=new Buffer(2))[0]=i,o[1]=n.length,this._createEncoderBuffer([o,n]);for(var f=1,s=n.length;s>=256;s>>=8)f++;(o=new Buffer(2+f))[0]=i,o[1]=128|f;s=1+f;for(var u=n.length;u>0;s--,u>>=8)o[s]=255&u;return this._createEncoderBuffer([o,n])},DERNode.prototype._encodeStr=function(e,r){if("bitstr"===r)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===r){for(var t=new Buffer(2*e.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var o=0;for(n=0;n=128;i>>=7)o++}var f=new Buffer(o),s=f.length-1;for(n=e.length-1;n>=0;n--){i=e[n];for(f[s--]=127&i;(i>>=7)>0;)f[s--]=128|127&i}return this._createEncoderBuffer(f)},DERNode.prototype._encodeTime=function(e,r){var t,n=new Date(e);return"gentime"===r?t=[two(n.getFullYear()),two(n.getUTCMonth()+1),two(n.getUTCDate()),two(n.getUTCHours()),two(n.getUTCMinutes()),two(n.getUTCSeconds()),"Z"].join(""):"utctime"===r?t=[two(n.getFullYear()%100),two(n.getUTCMonth()+1),two(n.getUTCDate()),two(n.getUTCHours()),two(n.getUTCMinutes()),two(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(t,"octstr")},DERNode.prototype._encodeNull=function(){return this._createEncoderBuffer("")},DERNode.prototype._encodeInt=function(e,r){if("string"==typeof e){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=r[e]}if("number"!=typeof e&&!Buffer.isBuffer(e)){var t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=new Buffer(t)}if(Buffer.isBuffer(e)){var n=e.length;0===e.length&&n++;var o=new Buffer(n);return e.copy(o),0===e.length&&(o[0]=0),this._createEncoderBuffer(o)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);n=1;for(var i=e;i>=256;i>>=8)n++;for(i=(o=new Array(n)).length-1;i>=0;i--)o[i]=255&e,e>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new Buffer(o))},DERNode.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},DERNode.prototype._use=function(e,r){return"function"==typeof e&&(e=e(r)),e._getEncoder("der").tree},DERNode.prototype._skipDefault=function(e,r,t){var n,o=this._baseState;if(null===o.default)return!1;var i=e.join();if(void 0===o.defaultBuffer&&(o.defaultBuffer=this._encodeValue(o.default,r,t).join()),i.length!==o.defaultBuffer.length)return!1;for(n=0;n>6],i=0==(32&t);if(31==(31&t)){let o=t;for(t=0;128==(128&o);){if(o=e.readUInt8(r),e.isError(o))return o;t<<=7,t|=127&o}}else t&=31;return{cls:o,primitive:i,tag:t,tagStr:der.tag[t]}}function derDecodeLen(e,r,t){let o=e.readUInt8(t);if(e.isError(o))return o;if(!r&&128===o)return null;if(0==(128&o))return o;const i=127&o;if(i>4)return e.error("length octect is too long");o=0;for(let r=0;r=31?o.error("Multi-octet tag encoding unsupported"):(t||(n|=32),n|=der.tagClassByName[r||"universal"]<<6)}module.exports=DEREncoder,DEREncoder.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},inherits(DERNode,Node),DERNode.prototype._encodeComposite=function(e,t,r,o){const n=encodeTag(e,t,r,this.reporter);if(o.length<128){const e=Buffer.alloc(2);return e[0]=n,e[1]=o.length,this._createEncoderBuffer([e,o])}let i=1;for(let e=o.length;e>=256;e>>=8)i++;const s=Buffer.alloc(2+i);s[0]=n,s[1]=128|i;for(let e=1+i,t=o.length;t>0;e--,t>>=8)s[e]=255&t;return this._createEncoderBuffer([s,o])},DERNode.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=Buffer.alloc(2*e.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let o=0;for(let t=0;t=128;r>>=7)o++}const n=Buffer.alloc(o);let i=n.length-1;for(let t=e.length-1;t>=0;t--){let r=e[t];for(n[i--]=127&r;(r>>=7)>0;)n[i--]=128|127&r}return this._createEncoderBuffer(n)},DERNode.prototype._encodeTime=function(e,t){let r;const o=new Date(e);return"gentime"===t?r=[two(o.getUTCFullYear()),two(o.getUTCMonth()+1),two(o.getUTCDate()),two(o.getUTCHours()),two(o.getUTCMinutes()),two(o.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[two(o.getUTCFullYear()%100),two(o.getUTCMonth()+1),two(o.getUTCDate()),two(o.getUTCHours()),two(o.getUTCMinutes()),two(o.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},DERNode.prototype._encodeNull=function(){return this._createEncoderBuffer("")},DERNode.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!Buffer.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=Buffer.from(t)}if(Buffer.isBuffer(e)){let t=e.length;0===e.length&&t++;const r=Buffer.alloc(t);return e.copy(r),0===e.length&&(r[0]=0),this._createEncoderBuffer(r)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let r=1;for(let t=e;t>=256;t>>=8)r++;const o=new Array(r);for(let t=o.length-1;t>=0;t--)o[t]=255&e,e>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(Buffer.from(o))},DERNode.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},DERNode.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},DERNode.prototype._skipDefault=function(e,t,r){const o=this._baseState;let n;if(null===o.default)return!1;const i=e.join();if(void 0===o.defaultBuffer&&(o.defaultBuffer=this._encodeValue(o.default,t,r).join()),i.length!==o.defaultBuffer.length)return!1;for(n=0;n=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return h}function s(t,i,r,h){for(var n=0,e=Math.min(t.length,r),o=i;o=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,i){return t.cmp(i)>0?t:i},n.min=function(t,i){return t.cmp(i)<0?t:i},n.prototype._init=function(t,i,h){if("number"==typeof t)return this._initNumber(t,i,h);if("object"==typeof t)return this._initArray(t,i,h);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===i?this._parseHex(t,n):this._parseBase(t,i,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initNumber=function(t,i,h){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initArray=function(t,i,h){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[e]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===h)for(n=0,e=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this.strip()},n.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r=i;r-=6)n=o(t,r,r+6),this.words[h]|=n<>>26-e&4194303,(e+=24)>=26&&(e-=26,h++);r+6!==i&&(n=o(t,i,r+6),this.words[h]|=n<>>26-e&4194303),this.strip()},n.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var h=0,n=1;n<=67108863;n*=i)h++;h--,n=n/i|0;for(var e=t.length-r,o=e%h,u=Math.min(e,e-o)+r,a=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],a=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,i,r){r.negative=i.negative^t.negative;var h=t.length+i.length|0;r.length=h,h=h-1|0;var n=0|t.words[0],e=0|i.words[0],o=n*e,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(n=0|t.words[p])*(e=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,i){var h;if(i=0|i||1,16===(t=t||10)||"hex"===t){h="";for(var n=0,e=0,o=0;o>>24-n&16777215)||o!==this.length-1?u[6-m.length]+m+h:m+h,(n+=2)>=26&&(n-=26,o--)}for(0!==e&&(h=e.toString(16)+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}if(t===(0|t)&&t>=2&&t<=36){var f=a[t],d=l[t];h="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modn(d).toString(t);h=(p=p.idivn(d)).isZero()?M+h:u[f-M.length]+M+h}for(this.isZero()&&(h="0"+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,i){return r(void 0!==e),this.toArrayLike(e,t,i)},n.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},n.prototype.toArrayLike=function(t,i,h){var n=this.byteLength(),e=h||Math.max(1,n);r(n<=e,"byte array longer than desired length"),r(e>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===i,a=new t(e),l=this.clone();if(u){for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[s]=o;for(;s=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},n.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var h=0;ht.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),h=t%26;this._expand(i),h>0&&i--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-h),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var h=t/26|0,n=t%26;return this._expand(h+1),this.words[h]=i?this.words[h]|1<t.length?(r=this,h=t):(r=t,h=this);for(var n=0,e=0;e>>26;for(;0!==n&&e>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;et.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,h,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,h=t):(r=t,h=this);for(var e=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==e&&o>26,this.words[o]=67108863&i;if(0===e&&o>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],g=8191&v,c=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,x=0|o[5],S=8191&x,Z=x>>>13,q=0|o[6],R=8191&q,B=q>>>13,N=0|o[7],L=8191&N,I=N>>>13,z=0|o[8],T=8191&z,E=z>>>13,O=0|o[9],j=8191&O,K=O>>>13,P=0|s[0],F=8191&P,C=P>>>13,D=0|s[1],H=8191&D,J=D>>>13,U=0|s[2],G=8191&U,Q=U>>>13,V=0|s[3],W=8191&V,X=V>>>13,Y=0|s[4],$=8191&Y,tt=Y>>>13,it=0|s[5],rt=8191&it,ht=it>>>13,nt=0|s[6],et=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(h=Math.imul(m,F))|0)+((8191&(n=(n=Math.imul(m,C))+Math.imul(f,F)|0))<<13)|0;a=((e=Math.imul(f,C))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,h=Math.imul(p,F),n=(n=Math.imul(p,C))+Math.imul(M,F)|0,e=Math.imul(M,C);var gt=(a+(h=h+Math.imul(m,H)|0)|0)+((8191&(n=(n=n+Math.imul(m,J)|0)+Math.imul(f,H)|0))<<13)|0;a=((e=e+Math.imul(f,J)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,h=Math.imul(g,F),n=(n=Math.imul(g,C))+Math.imul(c,F)|0,e=Math.imul(c,C),h=h+Math.imul(p,H)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(M,H)|0,e=e+Math.imul(M,J)|0;var ct=(a+(h=h+Math.imul(m,G)|0)|0)+((8191&(n=(n=n+Math.imul(m,Q)|0)+Math.imul(f,G)|0))<<13)|0;a=((e=e+Math.imul(f,Q)|0)+(n>>>13)|0)+(ct>>>26)|0,ct&=67108863,h=Math.imul(y,F),n=(n=Math.imul(y,C))+Math.imul(b,F)|0,e=Math.imul(b,C),h=h+Math.imul(g,H)|0,n=(n=n+Math.imul(g,J)|0)+Math.imul(c,H)|0,e=e+Math.imul(c,J)|0,h=h+Math.imul(p,G)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(M,G)|0,e=e+Math.imul(M,Q)|0;var wt=(a+(h=h+Math.imul(m,W)|0)|0)+((8191&(n=(n=n+Math.imul(m,X)|0)+Math.imul(f,W)|0))<<13)|0;a=((e=e+Math.imul(f,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,h=Math.imul(k,F),n=(n=Math.imul(k,C))+Math.imul(A,F)|0,e=Math.imul(A,C),h=h+Math.imul(y,H)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,H)|0,e=e+Math.imul(b,J)|0,h=h+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Q)|0)+Math.imul(c,G)|0,e=e+Math.imul(c,Q)|0,h=h+Math.imul(p,W)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(M,W)|0,e=e+Math.imul(M,X)|0;var yt=(a+(h=h+Math.imul(m,$)|0)|0)+((8191&(n=(n=n+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((e=e+Math.imul(f,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,h=Math.imul(S,F),n=(n=Math.imul(S,C))+Math.imul(Z,F)|0,e=Math.imul(Z,C),h=h+Math.imul(k,H)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,H)|0,e=e+Math.imul(A,J)|0,h=h+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,G)|0,e=e+Math.imul(b,Q)|0,h=h+Math.imul(g,W)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(c,W)|0,e=e+Math.imul(c,X)|0,h=h+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(M,$)|0,e=e+Math.imul(M,tt)|0;var bt=(a+(h=h+Math.imul(m,rt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ht)|0)+Math.imul(f,rt)|0))<<13)|0;a=((e=e+Math.imul(f,ht)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,h=Math.imul(R,F),n=(n=Math.imul(R,C))+Math.imul(B,F)|0,e=Math.imul(B,C),h=h+Math.imul(S,H)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(Z,H)|0,e=e+Math.imul(Z,J)|0,h=h+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Q)|0)+Math.imul(A,G)|0,e=e+Math.imul(A,Q)|0,h=h+Math.imul(y,W)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(b,W)|0,e=e+Math.imul(b,X)|0,h=h+Math.imul(g,$)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(c,$)|0,e=e+Math.imul(c,tt)|0,h=h+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(M,rt)|0,e=e+Math.imul(M,ht)|0;var _t=(a+(h=h+Math.imul(m,et)|0)|0)+((8191&(n=(n=n+Math.imul(m,ot)|0)+Math.imul(f,et)|0))<<13)|0;a=((e=e+Math.imul(f,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,h=Math.imul(L,F),n=(n=Math.imul(L,C))+Math.imul(I,F)|0,e=Math.imul(I,C),h=h+Math.imul(R,H)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,H)|0,e=e+Math.imul(B,J)|0,h=h+Math.imul(S,G)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(Z,G)|0,e=e+Math.imul(Z,Q)|0,h=h+Math.imul(k,W)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(A,W)|0,e=e+Math.imul(A,X)|0,h=h+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|0,e=e+Math.imul(b,tt)|0,h=h+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(c,rt)|0,e=e+Math.imul(c,ht)|0,h=h+Math.imul(p,et)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(M,et)|0,e=e+Math.imul(M,ot)|0;var kt=(a+(h=h+Math.imul(m,ut)|0)|0)+((8191&(n=(n=n+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((e=e+Math.imul(f,at)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,h=Math.imul(T,F),n=(n=Math.imul(T,C))+Math.imul(E,F)|0,e=Math.imul(E,C),h=h+Math.imul(L,H)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(I,H)|0,e=e+Math.imul(I,J)|0,h=h+Math.imul(R,G)|0,n=(n=n+Math.imul(R,Q)|0)+Math.imul(B,G)|0,e=e+Math.imul(B,Q)|0,h=h+Math.imul(S,W)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(Z,W)|0,e=e+Math.imul(Z,X)|0,h=h+Math.imul(k,$)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,$)|0,e=e+Math.imul(A,tt)|0,h=h+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(b,rt)|0,e=e+Math.imul(b,ht)|0,h=h+Math.imul(g,et)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(c,et)|0,e=e+Math.imul(c,ot)|0,h=h+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(M,ut)|0,e=e+Math.imul(M,at)|0;var At=(a+(h=h+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((e=e+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,h=Math.imul(j,F),n=(n=Math.imul(j,C))+Math.imul(K,F)|0,e=Math.imul(K,C),h=h+Math.imul(T,H)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(E,H)|0,e=e+Math.imul(E,J)|0,h=h+Math.imul(L,G)|0,n=(n=n+Math.imul(L,Q)|0)+Math.imul(I,G)|0,e=e+Math.imul(I,Q)|0,h=h+Math.imul(R,W)|0,n=(n=n+Math.imul(R,X)|0)+Math.imul(B,W)|0,e=e+Math.imul(B,X)|0,h=h+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(Z,$)|0,e=e+Math.imul(Z,tt)|0,h=h+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,rt)|0,e=e+Math.imul(A,ht)|0,h=h+Math.imul(y,et)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,et)|0,e=e+Math.imul(b,ot)|0,h=h+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(c,ut)|0,e=e+Math.imul(c,at)|0,h=h+Math.imul(p,mt)|0,n=(n=n+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,e=e+Math.imul(M,ft)|0;var xt=(a+(h=h+Math.imul(m,pt)|0)|0)+((8191&(n=(n=n+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((e=e+Math.imul(f,Mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h=Math.imul(j,H),n=(n=Math.imul(j,J))+Math.imul(K,H)|0,e=Math.imul(K,J),h=h+Math.imul(T,G)|0,n=(n=n+Math.imul(T,Q)|0)+Math.imul(E,G)|0,e=e+Math.imul(E,Q)|0,h=h+Math.imul(L,W)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(I,W)|0,e=e+Math.imul(I,X)|0,h=h+Math.imul(R,$)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(B,$)|0,e=e+Math.imul(B,tt)|0,h=h+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(Z,rt)|0,e=e+Math.imul(Z,ht)|0,h=h+Math.imul(k,et)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(A,et)|0,e=e+Math.imul(A,ot)|0,h=h+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,e=e+Math.imul(b,at)|0,h=h+Math.imul(g,mt)|0,n=(n=n+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,e=e+Math.imul(c,ft)|0;var St=(a+(h=h+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((e=e+Math.imul(M,Mt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,h=Math.imul(j,G),n=(n=Math.imul(j,Q))+Math.imul(K,G)|0,e=Math.imul(K,Q),h=h+Math.imul(T,W)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(E,W)|0,e=e+Math.imul(E,X)|0,h=h+Math.imul(L,$)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(I,$)|0,e=e+Math.imul(I,tt)|0,h=h+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(B,rt)|0,e=e+Math.imul(B,ht)|0,h=h+Math.imul(S,et)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(Z,et)|0,e=e+Math.imul(Z,ot)|0,h=h+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ut)|0,e=e+Math.imul(A,at)|0,h=h+Math.imul(y,mt)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,e=e+Math.imul(b,ft)|0;var Zt=(a+(h=h+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,Mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((e=e+Math.imul(c,Mt)|0)+(n>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,h=Math.imul(j,W),n=(n=Math.imul(j,X))+Math.imul(K,W)|0,e=Math.imul(K,X),h=h+Math.imul(T,$)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(E,$)|0,e=e+Math.imul(E,tt)|0,h=h+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(I,rt)|0,e=e+Math.imul(I,ht)|0,h=h+Math.imul(R,et)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(B,et)|0,e=e+Math.imul(B,ot)|0,h=h+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul(Z,ut)|0,e=e+Math.imul(Z,at)|0,h=h+Math.imul(k,mt)|0,n=(n=n+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,e=e+Math.imul(A,ft)|0;var qt=(a+(h=h+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((e=e+Math.imul(b,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,h=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(K,$)|0,e=Math.imul(K,tt),h=h+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(E,rt)|0,e=e+Math.imul(E,ht)|0,h=h+Math.imul(L,et)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(I,et)|0,e=e+Math.imul(I,ot)|0,h=h+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(B,ut)|0,e=e+Math.imul(B,at)|0,h=h+Math.imul(S,mt)|0,n=(n=n+Math.imul(S,ft)|0)+Math.imul(Z,mt)|0,e=e+Math.imul(Z,ft)|0;var Rt=(a+(h=h+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((e=e+Math.imul(A,Mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,h=Math.imul(j,rt),n=(n=Math.imul(j,ht))+Math.imul(K,rt)|0,e=Math.imul(K,ht),h=h+Math.imul(T,et)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(E,et)|0,e=e+Math.imul(E,ot)|0,h=h+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,at)|0)+Math.imul(I,ut)|0,e=e+Math.imul(I,at)|0,h=h+Math.imul(R,mt)|0,n=(n=n+Math.imul(R,ft)|0)+Math.imul(B,mt)|0,e=e+Math.imul(B,ft)|0;var Bt=(a+(h=h+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,Mt)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((e=e+Math.imul(Z,Mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,h=Math.imul(j,et),n=(n=Math.imul(j,ot))+Math.imul(K,et)|0,e=Math.imul(K,ot),h=h+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(E,ut)|0,e=e+Math.imul(E,at)|0,h=h+Math.imul(L,mt)|0,n=(n=n+Math.imul(L,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Nt=(a+(h=h+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,Mt)|0)+Math.imul(B,pt)|0))<<13)|0;a=((e=e+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h=Math.imul(j,ut),n=(n=Math.imul(j,at))+Math.imul(K,ut)|0,e=Math.imul(K,at),h=h+Math.imul(T,mt)|0,n=(n=n+Math.imul(T,ft)|0)+Math.imul(E,mt)|0,e=e+Math.imul(E,ft)|0;var Lt=(a+(h=h+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h=Math.imul(j,mt),n=(n=Math.imul(j,ft))+Math.imul(K,mt)|0,e=Math.imul(K,ft);var It=(a+(h=h+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,Mt)|0)+Math.imul(E,pt)|0))<<13)|0;a=((e=e+Math.imul(E,Mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var zt=(a+(h=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(K,pt)|0))<<13)|0;return a=((e=Math.imul(K,Mt))+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863,u[0]=vt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=xt,u[10]=St,u[11]=Zt,u[12]=qt,u[13]=Rt,u[14]=Bt,u[15]=Nt,u[16]=Lt,u[17]=It,u[18]=zt,0!==a&&(u[19]=a,r.length++),r};function d(t,i,r){return(new p).mulp(t,i,r)}function p(t,i){this.x=t,this.y=i}Math.imul||(f=m),n.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,i):r<63?m(this,t,i):r<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var h=0,n=0,e=0;e>>26)|0)>>>26,o&=67108863}r.words[e]=s,h=o,o=n}return 0!==h?r.words[e]=h:r.length--,r.strip()}(this,t,i):d(this,t,i)},p.prototype.makeRBT=function(t){for(var i=new Array(t),r=n.prototype._countBits(t)-1,h=0;h>=1;return h},p.prototype.permute=function(t,i,r,h,n,e){for(var o=0;o>>=1)n++;return 1<>>=13,h[2*o+1]=8191&e,e>>>=13;for(o=2*i;o>=26,i+=n/67108864|0,i+=e>>>26,this.words[h]=67108863&e}return 0!==i&&(this.words[h]=i,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r>>n}return i}(t);if(0===i.length)return new n(1);for(var r=this,h=0;h=0);var i,h=t%26,n=(t-h)/26,e=67108863>>>26-h<<26-h;if(0!==h){var o=0;for(i=0;i>>26-h}o&&(this.words[i]=o,this.length++)}if(0!==n){for(i=this.length-1;i>=0;i--)this.words[i+n]=this.words[i];for(i=0;i=0),n=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<o)for(this.length-=o,a=0;a=0&&(0!==l||a>=n);a--){var m=0|this.words[a];this.words[a]=l<<26-e|m>>>e,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,i,h){return r(0===this.negative),this.iushrn(t,i,h)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,h=(t-i)/26,n=1<=0);var i=t%26,h=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=h)return this;if(0!==i&&h++,this.length=Math.min(h,this.length),0!==i){var n=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(u/67108864|0),this.words[n+h]=67108863&e}for(;n>26,this.words[n+h]=67108863&e;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n>26,this.words[n]=67108863&e;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,i){var r=(this.length,t.length),h=this.clone(),e=t,o=0|e.words[e.length-1];0!==(r=26-this._countBits(o))&&(e=e.ushln(r),h.iushln(r),o=0|e.words[e.length-1]);var s,u=h.length-e.length;if("mod"!==i){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a=0;m--){var f=67108864*(0|h.words[e.length+m])+(0|h.words[e.length+m-1]);for(f=Math.min(f/o|0,67108863),h._ishlnsubmul(e,f,m);0!==h.negative;)f--,h.negative=0,h._ishlnsubmul(e,1,m),h.isZero()||(h.negative^=1);s&&(s.words[m]=f)}return s&&s.strip(),h.strip(),"div"!==i&&0!==r&&h.iushrn(r),{div:s||null,mod:h}},n.prototype.divmod=function(t,i,h){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,h=t.ushrn(1),n=t.andln(1),e=r.cmp(h);return e<0||1===n&&0===e?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var i=(1<<26)%t,h=0,n=this.length-1;n>=0;n--)h=(i*h+(0|this.words[n]))%t;return h},n.prototype.idivn=function(t){r(t<=67108863);for(var i=0,h=this.length-1;h>=0;h--){var n=(0|this.words[h])+67108864*i;this.words[h]=n/t|0,i=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new n(1),o=new n(0),s=new n(0),u=new n(1),a=0;i.isEven()&&h.isEven();)i.iushrn(1),h.iushrn(1),++a;for(var l=h.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(m)),e.iushrn(1),o.iushrn(1);for(var p=0,M=1;0==(h.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(h.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(h)>=0?(i.isub(h),e.isub(s),o.isub(u)):(h.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:h.iushln(a)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new n(1),s=new n(0),u=h.clone();i.cmpn(1)>0&&h.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(h.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(h.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(h)>=0?(i.isub(h),o.isub(s)):(h.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var h=0;i.isEven()&&r.isEven();h++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=i.cmp(r);if(n<0){var e=i;i=r,r=e}else if(0===n||0===r.cmpn(1))break;i.isub(r)}return r.iushln(h)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,h=(t-i)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var i,h=t<0;if(0!==this.negative&&!h)return-1;if(0===this.negative&&h)return 1;if(this.strip(),this.length>1)i=1;else{h&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:nt.length)return 1;if(this.length=0;r--){var h=0|this.words[r],n=0|t.words[r];if(h!==n){hn&&(i=1);break}}return i},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new b(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};function v(t,i){this.name=t,this.p=new n(i,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function c(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function b(t){if("string"==typeof t){var i=n._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){b.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var h=i0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,i){t.iushrn(this.n,0,i)},v.prototype.imulK=function(t){return t.imul(this.k)},h(g,v),g.prototype.split=function(t,i){for(var r=Math.min(t.length,9),h=0;h>>22,n=e}n>>>=22,t.words[h-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r>>=26,t.words[r]=n,i=h}return 0!==i&&(t.words[t.length++]=i),t},n._prime=function(t){if(M[t])return M[t];var i;if("k256"===t)i=new g;else if("p224"===t)i=new c;else if("p192"===t)i=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new y}return M[t]=i,i},b.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},b.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},b.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},b.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},b.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},b.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},b.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},b.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},b.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},b.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},b.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},b.prototype.isqr=function(t){return this.imul(t,t.clone())},b.prototype.sqr=function(t){return this.mul(t,t)},b.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var h=this.m.add(new n(1)).iushrn(2);return this.pow(t,h)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new n(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,e),f=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();r(v=0;h--){for(var a=i.words[h],l=u-1;l>=0;l--){var m=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===h&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},b.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},b.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},n.mont=function(t){return new _(t)},h(_,b),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},_.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(h).iushrn(this.shift),e=n;return n.cmp(this.m)>=0?e=n.isub(this.m):n.cmpn(0)<0&&(e=n.iadd(this.m)),e._forceRed(this)},_.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new n(0)._forceRed(this);var r=t.mul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(h).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof module||module,this); -},{"buffer":43}],26:[function(require,module,exports){ -(function (global){ +},{"buffer":57}],29:[function(require,module,exports){ +(function (global){(function (){ "use strict";var objectAssign=require("object-assign");function compare(t,e){if(t===e)return 0;for(var r=t.length,i=e.length,n=0,a=Math.min(r,i);n=0;u--)if(o[u]!==c[u])return!1;for(u=o.length-1;u>=0;u--)if(!_deepEqual(t[s=o[u]],e[s],r,i))return!1;return!0}function notDeepStrictEqual(t,e,r){_deepEqual(t,e,!0)&&fail(t,e,r,"notDeepStrictEqual",notDeepStrictEqual)}function expectedException(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function _tryBlock(t){var e;try{t()}catch(t){e=t}return e}function _throws(t,e,r,i){var n;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=_tryBlock(e),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!n&&fail(n,r,"Missing expected exception"+i);var a="string"==typeof i,s=!t&&n&&!r;if((!t&&util.isError(n)&&a&&expectedException(n,r)||s)&&fail(n,r,"Got unwanted exception"+i),t&&n&&r&&!expectedException(n,r)||!t&&n)throw n}function strict(t,e){t||fail(t,!0,e,"==",strict)}assert.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=getMessage(this),this.generatedMessage=!0);var e=t.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,n=getName(e),a=i.indexOf("\n"+n);if(a>=0){var s=i.indexOf("\n",a+1);i=i.substring(s+1)}this.stack=i}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(t,e,r){t!=e&&fail(t,e,r,"==",assert.equal)},assert.notEqual=function(t,e,r){t==e&&fail(t,e,r,"!=",assert.notEqual)},assert.deepEqual=function(t,e,r){_deepEqual(t,e,!1)||fail(t,e,r,"deepEqual",assert.deepEqual)},assert.deepStrictEqual=function(t,e,r){_deepEqual(t,e,!0)||fail(t,e,r,"deepStrictEqual",assert.deepStrictEqual)},assert.notDeepEqual=function(t,e,r){_deepEqual(t,e,!1)&&fail(t,e,r,"notDeepEqual",assert.notDeepEqual)},assert.notDeepStrictEqual=notDeepStrictEqual,assert.strictEqual=function(t,e,r){t!==e&&fail(t,e,r,"===",assert.strictEqual)},assert.notStrictEqual=function(t,e,r){t===e&&fail(t,e,r,"!==",assert.notStrictEqual)},assert.throws=function(t,e,r){_throws(!0,t,e,r)},assert.doesNotThrow=function(t,e,r){_throws(!1,t,e,r)},assert.ifError=function(t){if(t)throw t},assert.strict=objectAssign(strict,assert,{equal:assert.strictEqual,deepEqual:assert.deepStrictEqual,notEqual:assert.notStrictEqual,notDeepEqual:assert.notDeepStrictEqual}),assert.strict.strict=assert.strict;var objectKeys=Object.keys||function(t){var e=[];for(var r in t)hasOwn.call(t,r)&&e.push(r);return e}; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"object-assign":251,"util/":29}],27:[function(require,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"object-assign":316,"util/":32}],30:[function(require,module,exports){ "function"==typeof Object.create?module.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}; -},{}],28:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ module.exports=function(o){return o&&"object"==typeof o&&"function"==typeof o.copy&&"function"==typeof o.fill&&"function"==typeof o.readUInt8}; -},{}],29:[function(require,module,exports){ -(function (process,global){ +},{}],32:[function(require,module,exports){ +(function (process,global){(function (){ var formatRegExp=/%[sdj%]/g;exports.format=function(e){if(!isString(e)){for(var r=[],t=0;t=i)return e;switch(e){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch(e){return"[Circular]"}default:return e}}),s=n[t];t=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),isBoolean(r)?t.showHidden=r:r&&exports._extend(t,r),isUndefined(t.showHidden)&&(t.showHidden=!1),isUndefined(t.depth)&&(t.depth=2),isUndefined(t.colors)&&(t.colors=!1),isUndefined(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=stylizeWithColor),formatValue(t,e,t.depth)}function stylizeWithColor(e,r){var t=inspect.styles[r];return t?"["+inspect.colors[t][0]+"m"+e+"["+inspect.colors[t][1]+"m":e}function stylizeNoColor(e,r){return e}function arrayToHash(e){var r={};return e.forEach(function(e,t){r[e]=!0}),r}function formatValue(e,r,t){if(e.customInspect&&r&&isFunction(r.inspect)&&r.inspect!==exports.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(t,e);return isString(n)||(n=formatValue(e,n,t)),n}var i=formatPrimitive(e,r);if(i)return i;var o=Object.keys(r),s=arrayToHash(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),isError(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(r);if(0===o.length){if(isFunction(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(isRegExp(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(isDate(r))return e.stylize(Date.prototype.toString.call(r),"date");if(isError(r))return formatError(r)}var c,a="",l=!1,p=["{","}"];(isArray(r)&&(l=!0,p=["[","]"]),isFunction(r))&&(a=" [Function"+(r.name?": "+r.name:"")+"]");return isRegExp(r)&&(a=" "+RegExp.prototype.toString.call(r)),isDate(r)&&(a=" "+Date.prototype.toUTCString.call(r)),isError(r)&&(a=" "+formatError(r)),0!==o.length||l&&0!=r.length?t<0?isRegExp(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=l?formatArray(e,r,t,s,o):o.map(function(n){return formatProperty(e,r,t,s,n,l)}),e.seen.pop(),reduceToSingleString(c,a,p)):p[0]+a+p[1]}function formatPrimitive(e,r){if(isUndefined(r))return e.stylize("undefined","undefined");if(isString(r)){var t="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(t,"string")}return isNumber(r)?e.stylize(""+r,"number"):isBoolean(r)?e.stylize(""+r,"boolean"):isNull(r)?e.stylize("null","null"):void 0}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatArray(e,r,t,n,i){for(var o=[],s=0,u=r.length;s-1&&(u=o?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n")):u=e.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return u;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+u}function reduceToSingleString(e,r,t){return e.reduce(function(e,r){return 0,r.indexOf("\n")>=0&&0,e+r.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?t[0]+(""===r?"":r+"\n ")+" "+e.join(",\n ")+" "+t[1]:t[0]+r+" "+e.join(", ")+" "+t[1]}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNullOrUndefined(e){return null==e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isSymbol(e){return"symbol"==typeof e}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"==typeof e&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return e<10?"0"+e.toString(10):e.toString(10)}exports.debuglog=function(e){if(isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),e=e.toUpperCase(),!debugs[e])if(new RegExp("\\b"+e+"\\b","i").test(debugEnviron)){var r=process.pid;debugs[e]=function(){var t=exports.format.apply(exports,arguments);console.error("%s %d: %s",e,r,t)}}else debugs[e]=function(){};return debugs[e]},exports.inspect=inspect,inspect.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]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=isNullOrUndefined,exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=isSymbol,exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=isPrimitive,exports.isBuffer=require("./support/isBuffer");var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var e=new Date,r=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),months[e.getMonth()],r].join(" ")}function hasOwnProperty(e,r){return Object.prototype.hasOwnProperty.call(e,r)}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))},exports.inherits=require("inherits"),exports._extend=function(e,r){if(!r||!isObject(r))return e;for(var t=Object.keys(r),n=t.length;n--;)e[t[n]]=r[t[n]];return e}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":28,"_process":284,"inherits":27}],30:[function(require,module,exports){ -(function (Buffer){ -const Cache=require("hashlru"),RAF=require("polyraf"),Obv=require("obz"),debounce=require("lodash.debounce"),debug=require("debug")("async-flumelog"),Stream=require("./stream");function id(e){return e}var _codec={encode:id,decode:id,buffer:!0};module.exports=function(e,t){var n,r=new Cache(1024),o=RAF(e),i=t&&t.blockSize||65536,u=t&&t.codec||_codec,f=t&&t.writeTimeout||250,c=Obv(),l=[],a=[],s=new Map,d=null,g=null,h=null;function b(e){return e%i}function v(e){return(e-b(e))/i}function m(e){return(v(e)+1)*i}function w(e,t){var n=e-b(e),u=n/i,f=r.get(u);f?(debug("getting offset %d from cache",e),t(null,f)):(debug("getting offset %d from disc",e),o.read(n,i,(n,o)=>{r.set(v(e),o),t(n,o)}))}function p(e){return e.length+2}function y(e){let t=u.encode(e);if("string"==typeof t&&(t=Buffer.from(t)),p(t)+2>i)throw new Error("data larger than block size");if(h+p(t)+2>i){var n=Buffer.alloc(i);d=n,g+=1,h=0,debug("data doesn't fit current block, creating new")}!function(e,t,n){e.writeUInt16LE(t.length,n),t.copy(e,n+2)}(d,t,h),r.set(g,d);const o=h+g*i;return h+=p(t),s[g]={block:d,fileOffset:o},k(),debug("data inserted at offset %d",o),o}o.stat(function(t,n){t&&console.error("failed to stat "+e,t);var u=n?n.size:-1;if(u<=0)for(debug("empty file"),d=Buffer.alloc(i),g=0,h=0,r.set(0,d),c.set(-1);l.length;)l.shift()();else o.read(u-i,i,(e,t)=>{if(e)throw e;var n=function(e){for(var t=0,n=0;t{if(t)throw debug("failed to write block %d",e),t;c.set(r),n.streams.forEach(e=>{e.ended||!e.live||e.writing||(-1===e.cursor?e.cursor=0:e.skipFirst=!0,e.writing=!0,e.resume())});for(var o=a.length,i=0;i{if(n)return t(n);!function(e,t,n){var r=e.readUInt16LE(t),o=e.slice(t+2,t+2+r);if(o.every(e=>0===e)){const e=new Error("item has been deleted");return e.code="flumelog:deleted",n(e)}n(null,u.decode(o))}(r,b(e),t)})}),del:L(function(e,t){w(e,(n,r)=>{if(n)return t(n);const i=b(e),u=r.readUInt16LE(i);Buffer.alloc(u).copy(r,i+2),o.write(e-i,r,t)})}),append:L(function(e,t){if(Array.isArray(e)){for(var n=0,r=0,o=e.length;rc.value?a=-1:0==l&&(a=0),f.every(e=>0===e)?[a,null]:[a,u.decode(f)]},getBlock:w,stream:function(e){var t=new Stream(n,e);return n.streams.push(t),t},streams:[]}}; +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":31,"_process":349,"inherits":30}],33:[function(require,module,exports){ +(function (Buffer){(function (){ +const Cache=require("hashlru"),RAF=require("polyraf"),Obv=require("obz"),debounce=require("lodash.debounce"),debug=require("debug")("async-flumelog"),Stream=require("./stream");function alwaysTrue(){return!0}function id(e){return e}var _codec={encode:id,decode:id,buffer:!0};module.exports=function(e,t){var n,r=new Cache(1024),o=RAF(e),i=t&&t.blockSize||65536,u=t&&t.codec||_codec,l=t&&t.writeTimeout||250,f=t&&t.validateRecord||alwaysTrue,c=Obv(),a=[];const s=new Map,d=new Map;var g=null,h=null,b=null;function v(e){return e%i}function w(e){return(e-v(e))/i}function m(e){return(w(e)+1)*i}function p(e,t,n,r,u){debug("found record that does not validate, fixing last block",t);var l=e.slice(0,t);const f=Buffer.alloc(i);l.copy(f,0),o.write(n,f,()=>{u(null,r)})}function y(e,t){var n=e-v(e),u=n/i,l=r.get(u);l?(debug("getting offset %d from cache",e),t(null,l)):(debug("getting offset %d from disc",e),o.read(n,i,(n,o)=>{r.set(w(e),o),t(n,o)}))}function k(e){return e.length+2}function E(e){let t=u.encode(e);if("string"==typeof t&&(t=Buffer.from(t)),k(t)+2>i)throw new Error("data larger than block size");if(b+k(t)+2>i){var n=Buffer.alloc(i);g=n,h+=1,b=0,debug("data doesn't fit current block, creating new")}!function(e,t,n){e.writeUInt16LE(t.length,n),t.copy(e,n+2)}(g,t,b),r.set(h,g);const o=b+h*i;return b+=k(t),d.set(h,{block:g,fileOffset:o}),I(),debug("data inserted at offset %d",o),o}o.stat(function(t,n){t&&debug("failed to stat "+e,t);var u=n?n.size:-1;if(u<=0)for(debug("empty file"),g=Buffer.alloc(i),h=0,b=0,r.set(0,g),c.set(-1);a.length;)a.shift()();else o.read(u-i,i,(e,t)=>{if(e)throw e;!function(e,t,n){for(var r=0,o=0;ri)return p(e,r,t,o,n);var l=e.slice(r+2,r+2+u);if(!f(l))return p(e,r,t,o,n);o=r,r+=2+u}n(null,o)}(t,u-i,(e,n)=>{c.set(u-i+n),g=t;var r=t.readUInt16LE(n);for(b=n+2+r,h=u/i-1,debug("opened file, since: %d",c.value);a.length;)a.shift()()})})});var I=debounce(B,l);function q(e){if(!d.has(e))return;const{block:t,fileOffset:r}=d.get(e);d.delete(e);const u=(s.get(e)||[]).slice(0);debug("writing block of size: %d, to offset: %d",t.length,e*i),o.write(e*i,t,t=>{if(t)throw debug("failed to write block %d",e),t;{c.set(r),n.streams.forEach(e=>{e.ended||!e.live||e.writing||(-1===e.cursor?e.cursor=0:e.skipFirst=!0,e.writing=!0,e.resume())}),debug("draining the waiting queue for %d, items: %d",e,u.length);for(var o=0;o{if(n)return t(n);!function(e,t,n){var r=e.readUInt16LE(t),o=e.slice(t+2,t+2+r);if(o.every(e=>0===e)){const e=new Error("item has been deleted");return e.code="flumelog:deleted",n(e)}n(null,u.decode(o))}(r,v(e),t)})}),del:L(function(e,t){y(e,(n,r)=>{if(n)return t(n);const i=v(e),u=r.readUInt16LE(i);Buffer.alloc(u).copy(r,i+2),o.write(e-i,r,t)})}),append:L(function(e,t){if(Array.isArray(e)){for(var n=0,r=0,o=e.length;rc.value?a=-1:0==f&&(a=0),l.every(e=>0===e)?[a,null]:[a,u.decode(l)]},getBlock:y,stream:function(e){var t=new Stream(n,e);return n.streams.push(t),t},streams:[]}}; -}).call(this,require("buffer").Buffer) -},{"./stream":33,"buffer":88,"debug":31,"hashlru":187,"lodash.debounce":211,"obz":253,"polyraf":281}],31:[function(require,module,exports){ -(function (process){ -function useColors(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+module.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;e.splice(1,0,o,"color: inherit");let C=0,t=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(C++,"%c"===e&&(t=C))}),e.splice(t,0,o)}function save(e){try{e?exports.storage.setItem("debug",e):exports.storage.removeItem("debug")}catch(e){}}function load(){let e;try{e=exports.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}function localstorage(){try{return localStorage}catch(e){}}exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage=localstorage(),exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],exports.log=console.debug||console.log||(()=>{}),module.exports=require("./common")(exports);const{formatters:formatters}=module.exports;formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}; +}).call(this)}).call(this,require("buffer").Buffer) +},{"./stream":36,"buffer":101,"debug":34,"hashlru":212,"lodash.debounce":277,"obz":318,"polyraf":347}],34:[function(require,module,exports){ +(function (process){(function (){ +function useColors(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+module.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;e.splice(1,0,o,"color: inherit");let t=0,C=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(t++,"%c"===e&&(C=t))}),e.splice(C,0,o)}function save(e){try{e?exports.storage.setItem("debug",e):exports.storage.removeItem("debug")}catch(e){}}function load(){let e;try{e=exports.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}function localstorage(){try{return localStorage}catch(e){}}exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage=localstorage(),exports.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],exports.log=console.debug||console.log||(()=>{}),module.exports=require("./common")(exports);const{formatters:formatters}=module.exports;formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}; -}).call(this,require('_process')) -},{"./common":32,"_process":284}],32:[function(require,module,exports){ -function setup(e){function n(e){let r;function o(...e){if(!o.enabled)return;const t=o,s=Number(new Date),i=s-(r||s);t.diff=i,t.prev=r,t.curr=s,r=s,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(s,r)=>{if("%%"===s)return s;a++;const o=n.formatters[r];if("function"==typeof o){const n=e[a];s=o.call(t,n),e.splice(a,1),a--}return s}),n.formatArgs.call(t,e),(t.log||n.log).apply(t,e)}return o.namespace=e,o.enabled=n.enabled(e),o.useColors=n.useColors(),o.color=n.selectColor(e),o.destroy=t,o.extend=s,"function"==typeof n.init&&n.init(o),n.instances.push(o),o}function t(){const e=n.instances.indexOf(this);return-1!==e&&(n.instances.splice(e,1),!0)}function s(e,t){const s=n(this.namespace+(void 0===t?":":t)+e);return s.log=this.log,s}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names.map(r),...n.skips.map(r).map(e=>"-"+e)].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const s=("string"==typeof e?e:"").split(/[\s,]+/),r=s.length;for(t=0;t{n[t]=e[t]}),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n{if("%%"===r)return"%";i++;const s=n.formatters[o];if("function"==typeof s){const n=e[i];r=s.call(t,n),e.splice(i,1),i--}return r}),n.formatArgs.call(t,e),(t.log||n.log).apply(t,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=t,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null===o?n.enabled(e):o,set:e=>{o=e}}),"function"==typeof n.init&&n.init(s),s}function t(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names.map(r),...n.skips.map(r).map(e=>"-"+e)].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(t=0;t{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n=0&&(this.skipFirst=!0),this.live||0!==this.cursor||-1!=this.blocks.since.value||(this.ended=!0),this.live&&0===this.cursor&&-1==this.blocks.since.value&&(this.cursor=-1),this.resume()},Stream.prototype._writeToSink=function(i){this.values?null!=i&&(this.seqs?this.sink.write({seq:this.cursor,value:i}):this.sink.write(i)):this.sink.write(this.cursor)},Stream.prototype._handleBlock=function(i){for(;;){const t=this.blocks.getDataNextOffset(i,this.cursor),s=this.cursor;if(this.skipFirst){if(this.skipFirst=!1,t[0]>0){this.cursor=t[0];continue}if(0==t[0])return!0;if(-1==t[0])return!0===this.live&&(this.writing=!1),!1}if(this.count++,!(null===this.min||this.mins||this.max_inclusive===s))return!1;if(this._writeToSink(t[1]),t[0]>0)this.cursor=t[0];else{if(0==t[0])return!0;if(-1==t[0])return!0===this.live&&(this.writing=!1),!1}if(this.limit>0&&this.count>=this.limit)return!1}},Stream.prototype._resume=function(){if(this.sink&&!this.sink.paused)return this.ended&&!this.sink.ended?this.sink.end(!0===this.ended?null:this.ended):void(-1!==this.cursor&&(this.live&&!this.writing&&this.cursor>0||(this.writing=!0,this.blocks.getBlock(this.cursor,(i,t)=>{i?console.error(i):this._handleBlock(t)?(this.cursor=this.blocks.getNextBlockIndex(this.cursor),this._next()):!0!==this.live&&this.abort()}))))},Stream.prototype.resume=function(){this._next=looper(this._resume.bind(this)),this._next()},Stream.prototype.abort=function(i){this.ended=i||!0;var t=this.blocks.streams.indexOf(this);~t&&this.blocks.streams.splice(t,1),this.sink.ended||this.sink.end(!0===i?null:i)},Stream.prototype.pipe=require("push-stream/pipe"); +},{"ms":294}],36:[function(require,module,exports){ +var ltgt=require("ltgt"),looper=require("looper");function Stream(i,t){t=t||{},this.blocks=i,this.live=!!t.live,this.offsets=!1!==t.offsets,this.values=!1!==t.values,this.limit=t.limit||0,this.min=this.max=this.min_inclusive=this.max_inclusive=null,this.cursor=-1,this.count=0,this.writing=!1,this.ended=!1,this.skipFirst=!1;this.opts=t,this.blocks.onReady(this._ready.bind(this))}module.exports=Stream,Stream.prototype._ready=function(){this.min=ltgt.lowerBound(this.opts,null),ltgt.lowerBoundInclusive(this.opts)&&(this.min_inclusive=this.min),this.max=ltgt.upperBound(this.opts,null),ltgt.upperBoundInclusive(this.opts)&&(this.max_inclusive=this.max),this.cursor=ltgt.lowerBound(this.opts,0),this.cursor<0&&(this.cursor=0),this.opts.gt>=0&&(this.skipFirst=!0),this.live||0!==this.cursor||-1!=this.blocks.since.value||(this.ended=!0),this.live&&0===this.cursor&&-1==this.blocks.since.value&&(this.cursor=-1),this.resume()},Stream.prototype._writeToSink=function(i){this.values?this.offsets?this.sink.write({offset:this.cursor,value:i}):this.sink.write(i):this.sink.write(this.cursor)},Stream.prototype._handleBlock=function(i){for(;;){const t=this.blocks.getDataNextOffset(i,this.cursor),s=this.cursor;if(this.skipFirst){if(this.skipFirst=!1,t[0]>0){this.cursor=t[0];continue}if(0==t[0])return!0;if(-1==t[0])return!0===this.live&&(this.writing=!1),!1}if(this.count++,!(null===this.min||this.mins||this.max_inclusive===s))return!1;if(this._writeToSink(t[1]),t[0]>0)this.cursor=t[0];else{if(0==t[0])return!0;if(-1==t[0])return!0===this.live&&(this.writing=!1),!1}if(this.limit>0&&this.count>=this.limit)return!1}},Stream.prototype._resume=function(){if(this.sink&&!this.sink.paused)return this.ended&&!this.sink.ended?!0!==this.ended||this.live?this.sink.end(!0===this.ended?null:this.ended):this.abort():void(-1!==this.cursor&&(this.live&&!this.writing&&this.cursor>0||(this.writing=!0,this.blocks.getBlock(this.cursor,(i,t)=>{i?console.error(i):this._handleBlock(t)?(this.cursor=this.blocks.getNextBlockIndex(this.cursor),this._next()):!0!==this.live&&this.abort()}))))},Stream.prototype.resume=function(){this._next=looper(this._resume.bind(this)),this._next()},Stream.prototype.abort=function(i){this.ended=i||!0;var t=this.blocks.streams.indexOf(this);~t&&this.blocks.streams.splice(t,1),!this.sink.ended&&this.sink.end&&this.sink.end(!0===i?null:i)},Stream.prototype.pipe=require("push-stream/pipe"); -},{"looper":212,"ltgt":213,"push-stream/pipe":400}],34:[function(require,module,exports){ +},{"looper":278,"ltgt":279,"push-stream/pipe":478}],37:[function(require,module,exports){ const Store=require("./store/idb"),Inject=require("./inject");module.exports=function(e,r,t){return Inject(Store(e,r,t&&t.buffer),t)}; -},{"./inject":37,"./store/idb":38}],35:[function(require,module,exports){ -module.exports=function(e,r){return require("./index")(e,r,require("./codec/buffer"))}; - -},{"./codec/buffer":36,"./index":34}],36:[function(require,module,exports){ -function id(e){return e}module.exports={encode:id,decode:id,buffer:!0}; - -},{}],37:[function(require,module,exports){ +},{"./inject":38,"./store/idb":39}],38:[function(require,module,exports){ "use strict";var mutexify=require("mutexify");module.exports=function(n,t){var e,u=t||require("flumecodec/json"),r=mutexify();return{get:function(t){if(e)return t(null,e);n.get(function(n,r){if(n)return t(n);try{e=u.decode(r)}catch(n){return t(n)}t(null,e)})},set:function(t,i){r(function(r){n.set(u.encode(t),function(n){n||(e=t),r(i,n,t)})})},destroy:function(t){r(function(u){n.destroy(function(n){e=null,u(t,n)})})}}}; -},{"flumecodec/json":152,"mutexify":239}],38:[function(require,module,exports){ -(function (Buffer){ +},{"flumecodec/json":176,"mutexify":305}],39:[function(require,module,exports){ +(function (Buffer){(function (){ const IdbKvStore=require("idb-kv-store");module.exports=function(o,t,e){const n=o.split("/"),r=n.pop(),s=n.join("/"),i=new IdbKvStore(s,{disableBroadcast:!0});return{set:function(o,t){i.set(r,e?o.toString("base64"):o,t)},get:function(o){i.get(r,function(t,n){t?o(t):n?o(null,n&&(e?Buffer.from(n,"base64"):n)):o(new Error("not found"))})},destroy:function(o){i.remove(r,o)}}}; -}).call(this,require("buffer").Buffer) -},{"buffer":88,"idb-kv-store":191}],39:[function(require,module,exports){ +}).call(this)}).call(this,require("buffer").Buffer) +},{"buffer":101,"idb-kv-store":216}],40:[function(require,module,exports){ +(function (Buffer){(function (){ +if("undefined"==typeof localStorage||null===localStorage)module.exports=require("atomically");else{const e=require("idb-kv-store"),r=require("promisify-4loc");function getStoreAndKey(r){const t=r.split("/"),n=t.pop(),o=t.join("/");return{store:new e(o,{disableBroadcast:!0}),key:n}}function isUint8Array(e){return-1!==toString.call(e).indexOf("Uint8Array")}module.exports={readFile:function(e){const{store:t,key:n}=getStoreAndKey(e),o=t.get.bind(t);return r(function(e,r){o(e,(e,t)=>{if(e)return r(e);r(null,isUint8Array(t)?Buffer.from(t):t)})})(n)},writeFile:function(e,t){const{store:n,key:o}=getStoreAndKey(e);return r(n.set.bind(n))(o,t)}}} + +}).call(this)}).call(this,require("buffer").Buffer) +},{"atomically":42,"buffer":101,"idb-kv-store":216,"promisify-4loc":350}],41:[function(require,module,exports){ +(function (process){(function (){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NOOP=exports.LIMIT_FILES_DESCRIPTORS=exports.LIMIT_BASENAME_LENGTH=exports.IS_USER_ROOT=exports.IS_POSIX=exports.DEFAULT_TIMEOUT_SYNC=exports.DEFAULT_TIMEOUT_ASYNC=exports.DEFAULT_WRITE_OPTIONS=exports.DEFAULT_READ_OPTIONS=exports.DEFAULT_FOLDER_MODE=exports.DEFAULT_FILE_MODE=exports.DEFAULT_ENCODING=void 0;const DEFAULT_ENCODING="utf8";exports.DEFAULT_ENCODING="utf8";const DEFAULT_FILE_MODE=438;exports.DEFAULT_FILE_MODE=438;const DEFAULT_FOLDER_MODE=511;exports.DEFAULT_FOLDER_MODE=511;const DEFAULT_READ_OPTIONS={};exports.DEFAULT_READ_OPTIONS=DEFAULT_READ_OPTIONS;const DEFAULT_WRITE_OPTIONS={};exports.DEFAULT_WRITE_OPTIONS=DEFAULT_WRITE_OPTIONS;const DEFAULT_TIMEOUT_ASYNC=5e3;exports.DEFAULT_TIMEOUT_ASYNC=5e3;const DEFAULT_TIMEOUT_SYNC=100;exports.DEFAULT_TIMEOUT_SYNC=100;const IS_POSIX=!!process.getuid;exports.IS_POSIX=IS_POSIX;const IS_USER_ROOT=!!process.getuid&&!process.getuid();exports.IS_USER_ROOT=IS_USER_ROOT;const LIMIT_BASENAME_LENGTH=128;exports.LIMIT_BASENAME_LENGTH=128;const LIMIT_FILES_DESCRIPTORS=1e4;exports.LIMIT_FILES_DESCRIPTORS=1e4;const NOOP=()=>{};exports.NOOP=NOOP; + +}).call(this)}).call(this,require('_process')) +},{"_process":349}],42:[function(require,module,exports){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.writeFileSync=exports.writeFile=exports.readFileSync=exports.readFile=void 0;const path=require("path"),consts_1=require("./consts"),fs_1=require("./utils/fs"),lang_1=require("./utils/lang"),scheduler_1=require("./utils/scheduler"),temp_1=require("./utils/temp");function readFile(e,t=consts_1.DEFAULT_READ_OPTIONS){var n;if(lang_1.default.isString(t))return readFile(e,{encoding:t});const a=Date.now()+(null!==(n=t.timeout)&&void 0!==n?n:consts_1.DEFAULT_TIMEOUT_ASYNC);return fs_1.default.readFileRetry(a)(e,t)}function readFileSync(e,t=consts_1.DEFAULT_READ_OPTIONS){var n;if(lang_1.default.isString(t))return readFileSync(e,{encoding:t});const a=Date.now()+(null!==(n=t.timeout)&&void 0!==n?n:consts_1.DEFAULT_TIMEOUT_SYNC);return fs_1.default.readFileSyncRetry(a)(e,t)}exports.readFile=readFile,exports.readFileSync=readFileSync;const writeFile=(e,t,n,a)=>{if(lang_1.default.isFunction(n))return writeFile(e,t,consts_1.DEFAULT_WRITE_OPTIONS,n);const l=writeFileAsync(e,t,n);return a&&l.then(a,a),l};exports.writeFile=writeFile;const writeFileAsync=async(e,t,n=consts_1.DEFAULT_WRITE_OPTIONS)=>{var a;if(lang_1.default.isString(n))return writeFileAsync(e,t,{encoding:n});const l=Date.now()+(null!==(a=n.timeout)&&void 0!==a?a:consts_1.DEFAULT_TIMEOUT_ASYNC);let i=null,s=null,d=null,r=null,c=null;try{n.schedule&&(i=await n.schedule(e)),s=await scheduler_1.default.schedule(e),e=await fs_1.default.realpathAttempt(e)||e,[r,d]=temp_1.default.get(e,n.tmpCreate||temp_1.default.create,!(!1===n.tmpPurge));const a=consts_1.IS_POSIX&&lang_1.default.isUndefined(n.chown),u=lang_1.default.isUndefined(n.mode);if(a||u){const t=await fs_1.default.statAttempt(e);t&&(n={...n},a&&(n.chown={uid:t.uid,gid:t.gid}),u&&(n.mode=t.mode))}const f=path.dirname(e);await fs_1.default.mkdirAttempt(f,{mode:consts_1.DEFAULT_FOLDER_MODE,recursive:!0}),c=await fs_1.default.openRetry(l)(r,"w",n.mode||consts_1.DEFAULT_FILE_MODE),n.tmpCreated&&n.tmpCreated(r),lang_1.default.isString(t)?await fs_1.default.writeRetry(l)(c,t,0,n.encoding||consts_1.DEFAULT_ENCODING):lang_1.default.isUndefined(t)||await fs_1.default.writeRetry(l)(c,t,0,t.length,0),!1!==n.fsync&&(!1!==n.fsyncWait?await fs_1.default.fsyncRetry(l)(c):fs_1.default.fsyncAttempt(c)),await fs_1.default.closeRetry(l)(c),c=null,n.chown&&await fs_1.default.chownAttempt(r,n.chown.uid,n.chown.gid),n.mode&&await fs_1.default.chmodAttempt(r,n.mode);try{await fs_1.default.renameRetry(l)(r,e)}catch(t){if("ENAMETOOLONG"!==t.code)throw t;await fs_1.default.renameRetry(l)(r,temp_1.default.truncate(e))}d(),r=null}finally{c&&await fs_1.default.closeAttempt(c),r&&temp_1.default.purge(r),i&&i(),s&&s()}},writeFileSync=(e,t,n=consts_1.DEFAULT_WRITE_OPTIONS)=>{var a;if(lang_1.default.isString(n))return writeFileSync(e,t,{encoding:n});const l=Date.now()+(null!==(a=n.timeout)&&void 0!==a?a:consts_1.DEFAULT_TIMEOUT_SYNC);let i=null,s=null,d=null;try{e=fs_1.default.realpathSyncAttempt(e)||e,[s,i]=temp_1.default.get(e,n.tmpCreate||temp_1.default.create,!(!1===n.tmpPurge));const a=consts_1.IS_POSIX&&lang_1.default.isUndefined(n.chown),r=lang_1.default.isUndefined(n.mode);if(a||r){const t=fs_1.default.statSyncAttempt(e);t&&(n={...n},a&&(n.chown={uid:t.uid,gid:t.gid}),r&&(n.mode=t.mode))}const c=path.dirname(e);fs_1.default.mkdirSyncAttempt(c,{mode:consts_1.DEFAULT_FOLDER_MODE,recursive:!0}),d=fs_1.default.openSyncRetry(l)(s,"w",n.mode||consts_1.DEFAULT_FILE_MODE),n.tmpCreated&&n.tmpCreated(s),lang_1.default.isString(t)?fs_1.default.writeSyncRetry(l)(d,t,0,n.encoding||consts_1.DEFAULT_ENCODING):lang_1.default.isUndefined(t)||fs_1.default.writeSyncRetry(l)(d,t,0,t.length,0),!1!==n.fsync&&(!1!==n.fsyncWait?fs_1.default.fsyncSyncRetry(l)(d):fs_1.default.fsyncAttempt(d)),fs_1.default.closeSyncRetry(l)(d),d=null,n.chown&&fs_1.default.chownSyncAttempt(s,n.chown.uid,n.chown.gid),n.mode&&fs_1.default.chmodSyncAttempt(s,n.mode);try{fs_1.default.renameSyncRetry(l)(s,e)}catch(t){if("ENAMETOOLONG"!==t.code)throw t;fs_1.default.renameSyncRetry(l)(s,temp_1.default.truncate(e))}i(),s=null}finally{d&&fs_1.default.closeSyncAttempt(d),s&&temp_1.default.purge(s)}};exports.writeFileSync=writeFileSync; + +},{"./consts":41,"./utils/fs":44,"./utils/lang":46,"./utils/scheduler":49,"./utils/temp":50,"path":331}],43:[function(require,module,exports){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.attemptifySync=exports.attemptifyAsync=void 0;const consts_1=require("../consts"),attemptifyAsync=(t,e=consts_1.NOOP)=>(function(){return t.apply(void 0,arguments).catch(e)});exports.attemptifyAsync=attemptifyAsync;const attemptifySync=(t,e=consts_1.NOOP)=>(function(){try{return t.apply(void 0,arguments)}catch(t){return e(t)}});exports.attemptifySync=attemptifySync; + +},{"../consts":41}],44:[function(require,module,exports){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const fs=require("fs"),util_1=require("util"),attemptify_1=require("./attemptify"),fs_handlers_1=require("./fs_handlers"),retryify_1=require("./retryify"),FS={chmodAttempt:attemptify_1.attemptifyAsync(util_1.promisify(fs.chmod),fs_handlers_1.default.onChangeError),chownAttempt:attemptify_1.attemptifyAsync(util_1.promisify(fs.chown),fs_handlers_1.default.onChangeError),closeAttempt:attemptify_1.attemptifyAsync(util_1.promisify(fs.close)),fsyncAttempt:attemptify_1.attemptifyAsync(util_1.promisify(fs.fsync)),mkdirAttempt:attemptify_1.attemptifyAsync(util_1.promisify(fs.mkdir)),realpathAttempt:attemptify_1.attemptifyAsync(util_1.promisify(fs.realpath)),statAttempt:attemptify_1.attemptifyAsync(util_1.promisify(fs.stat)),unlinkAttempt:attemptify_1.attemptifyAsync(util_1.promisify(fs.unlink)),closeRetry:retryify_1.retryifyAsync(util_1.promisify(fs.close),fs_handlers_1.default.isRetriableError),fsyncRetry:retryify_1.retryifyAsync(util_1.promisify(fs.fsync),fs_handlers_1.default.isRetriableError),openRetry:retryify_1.retryifyAsync(util_1.promisify(fs.open),fs_handlers_1.default.isRetriableError),readFileRetry:retryify_1.retryifyAsync(util_1.promisify(fs.readFile),fs_handlers_1.default.isRetriableError),renameRetry:retryify_1.retryifyAsync(util_1.promisify(fs.rename),fs_handlers_1.default.isRetriableError),statRetry:retryify_1.retryifyAsync(util_1.promisify(fs.stat),fs_handlers_1.default.isRetriableError),writeRetry:retryify_1.retryifyAsync(util_1.promisify(fs.write),fs_handlers_1.default.isRetriableError),chmodSyncAttempt:attemptify_1.attemptifySync(fs.chmodSync,fs_handlers_1.default.onChangeError),chownSyncAttempt:attemptify_1.attemptifySync(fs.chownSync,fs_handlers_1.default.onChangeError),closeSyncAttempt:attemptify_1.attemptifySync(fs.closeSync),mkdirSyncAttempt:attemptify_1.attemptifySync(fs.mkdirSync),realpathSyncAttempt:attemptify_1.attemptifySync(fs.realpathSync),statSyncAttempt:attemptify_1.attemptifySync(fs.statSync),unlinkSyncAttempt:attemptify_1.attemptifySync(fs.unlinkSync),closeSyncRetry:retryify_1.retryifySync(fs.closeSync,fs_handlers_1.default.isRetriableError),fsyncSyncRetry:retryify_1.retryifySync(fs.fsyncSync,fs_handlers_1.default.isRetriableError),openSyncRetry:retryify_1.retryifySync(fs.openSync,fs_handlers_1.default.isRetriableError),readFileSyncRetry:retryify_1.retryifySync(fs.readFileSync,fs_handlers_1.default.isRetriableError),renameSyncRetry:retryify_1.retryifySync(fs.renameSync,fs_handlers_1.default.isRetriableError),statSyncRetry:retryify_1.retryifySync(fs.statSync,fs_handlers_1.default.isRetriableError),writeSyncRetry:retryify_1.retryifySync(fs.writeSync,fs_handlers_1.default.isRetriableError)};exports.default=FS; + +},{"./attemptify":43,"./fs_handlers":45,"./retryify":47,"fs":100,"util":669}],45:[function(require,module,exports){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const consts_1=require("../consts"),Handlers={isChangeErrorOk:r=>{const{code:e}=r;return"ENOSYS"===e||!(consts_1.IS_USER_ROOT||"EINVAL"!==e&&"EPERM"!==e)},isRetriableError:r=>{const{code:e}=r;return"EMFILE"===e||"ENFILE"===e||"EAGAIN"===e||"EBUSY"===e||"EACCESS"===e||"EACCS"===e||"EPERM"===e},onChangeError:r=>{if(!Handlers.isChangeErrorOk(r))throw r}};exports.default=Handlers; + +},{"../consts":41}],46:[function(require,module,exports){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const Lang={isFunction:e=>"function"==typeof e,isString:e=>"string"==typeof e,isUndefined:e=>void 0===e};exports.default=Lang; + +},{}],47:[function(require,module,exports){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.retryifySync=exports.retryifyAsync=void 0;const retryify_queue_1=require("./retryify_queue"),retryifyAsync=(r,e)=>(function(t){return function y(){return retryify_queue_1.default.schedule().then(n=>r.apply(void 0,arguments).then(r=>(n(),r),r=>{if(n(),Date.now()>=t)throw r;if(e(r)){const r=Math.round(100+400*Math.random());return new Promise(e=>setTimeout(e,r)).then(()=>y.apply(void 0,arguments))}throw r}))}});exports.retryifyAsync=retryifyAsync;const retryifySync=(r,e)=>(function(t){return function y(){try{return r.apply(void 0,arguments)}catch(r){if(Date.now()>t)throw r;if(e(r))return y.apply(void 0,arguments);throw r}}});exports.retryifySync=retryifySync; + +},{"./retryify_queue":48}],48:[function(require,module,exports){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const consts_1=require("../consts"),RetryfyQueue={interval:25,intervalId:void 0,limit:consts_1.LIMIT_FILES_DESCRIPTORS,queueActive:new Set,queueWaiting:new Set,init:()=>{RetryfyQueue.intervalId||(RetryfyQueue.intervalId=setInterval(RetryfyQueue.tick,RetryfyQueue.interval))},reset:()=>{RetryfyQueue.intervalId&&(clearInterval(RetryfyQueue.intervalId),delete RetryfyQueue.intervalId)},add:e=>{RetryfyQueue.queueWaiting.add(e),RetryfyQueue.queueActive.size{RetryfyQueue.queueWaiting.delete(e),RetryfyQueue.queueActive.delete(e)},schedule:()=>new Promise(e=>{const u=()=>RetryfyQueue.remove(t),t=()=>e(u);RetryfyQueue.add(t)}),tick:()=>{if(!(RetryfyQueue.queueActive.size>=RetryfyQueue.limit)){if(!RetryfyQueue.queueWaiting.size)return RetryfyQueue.reset();for(const e of RetryfyQueue.queueWaiting){if(RetryfyQueue.queueActive.size>=RetryfyQueue.limit)break;RetryfyQueue.queueWaiting.delete(e),RetryfyQueue.queueActive.add(e),e()}}}};exports.default=RetryfyQueue; + +},{"../consts":41}],49:[function(require,module,exports){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const Queues={},Scheduler={next:e=>{const u=Queues[e];if(!u)return;u.shift();const t=u[0];t?t(()=>Scheduler.next(e)):delete Queues[e]},schedule:e=>new Promise(u=>{let t=Queues[e];t||(t=Queues[e]=[]),t.push(u),t.length>1||u(()=>Scheduler.next(e))})};exports.default=Scheduler; + +},{}],50:[function(require,module,exports){ +(function (process){(function (){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const path=require("path"),consts_1=require("../consts"),fs_1=require("./fs"),Temp={store:{},create:e=>{const t=`000000${Math.floor(16777215*Math.random()).toString(16)}`.slice(-6);return`${e}${`.tmp-${Date.now().toString().slice(-10)}${t}`}`},get:(e,t,r=!0)=>{const n=Temp.truncate(t(e));if(n in Temp.store)return Temp.get(e,t,r);Temp.store[n]=r;return[n,()=>delete Temp.store[n]]},purge:e=>{Temp.store[e]&&(delete Temp.store[e],fs_1.default.unlinkAttempt(e))},purgeSync:e=>{Temp.store[e]&&(delete Temp.store[e],fs_1.default.unlinkSyncAttempt(e))},purgeSyncAll:()=>{for(const e in Temp.store)Temp.purgeSync(e)},truncate:e=>{const t=path.basename(e);if(t.length<=consts_1.LIMIT_BASENAME_LENGTH)return e;const r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!r)return e;const n=t.length-consts_1.LIMIT_BASENAME_LENGTH;return`${e.slice(0,-t.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};process.on("exit",Temp.purgeSyncAll),exports.default=Temp; + +}).call(this)}).call(this,require('_process')) +},{"../consts":41,"./fs":44,"_process":349,"path":331}],51:[function(require,module,exports){ +(function (global){(function (){ +"use strict";var filter=require("array-filter");module.exports=function(){return filter(["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],function(r){return"function"==typeof global[r]})}; + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"array-filter":13}],52:[function(require,module,exports){ "use strict";exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var e=o.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function byteLength(o){var r=getLens(o),e=r[0],t=r[1];return 3*(e+t)/4-t}function _byteLength(o,r,e){return 3*(r+e)/4-e}function toByteArray(o){var r,e,t=getLens(o),n=t[0],u=t[1],p=new Arr(_byteLength(o,n,u)),a=0,h=u>0?n-4:n;for(e=0;e>16&255,p[a++]=r>>8&255,p[a++]=255&r;return 2===u&&(r=revLookup[o.charCodeAt(e)]<<2|revLookup[o.charCodeAt(e+1)]>>4,p[a++]=255&r),1===u&&(r=revLookup[o.charCodeAt(e)]<<10|revLookup[o.charCodeAt(e+1)]<<4|revLookup[o.charCodeAt(e+2)]>>2,p[a++]=r>>8&255,p[a++]=255&r),p}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]}function encodeChunk(o,r,e){for(var t,n=[],u=r;up?p:u+16383));return 1===t?(r=o[e-1],n.push(lookup[r>>2]+lookup[r<<4&63]+"==")):2===t&&(r=(o[e-2]<<8)+o[e-1],n.push(lookup[r>>10]+lookup[r>>4&63]+lookup[r<<2&63]+"=")),n.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63; -},{}],40:[function(require,module,exports){ -(function (Buffer){ -var varint=require("varint"),STRING=0,BUFFER=1,INT=2,DOUBLE=3,ARRAY=4,OBJECT=5,BOOLNULL=6,RESERVED=7,TAG_SIZE=3,TAG_MASK=7,bytes=0,encoders=[function(e,r,n){return r.write(e,n)},function(e,r,n){return e.copy(r,n,0,e.length),e.length},function(e,r,n){return r.writeInt32LE(e,n),4},function(e,r,n){return r.writeDoubleLE(e,n),8},function(e,r,n){for(var t=n,o=0;o>TAG_SIZE,a=decode_type(i,e,r+(o+=varint.decode.bytes),c);t.push(a),o+=c}return t}function decode_object(e,r,n){for(var t={},o=0;o>TAG_SIZE;if(o+=varint.decode.bytes,7===i)throw new Error("reserved type:key");var a=decode_type(i,e,r+o,c);o+=c;var u=varint.decode(e,r+o),f=u&TAG_MASK;if(7===f)throw new Error("reserved type:value");var v=u>>TAG_SIZE,s=decode_type(f,e,r+(o+=varint.decode.bytes),v);o+=v,t[a]=s}return t}function decode_boolnull(e,r,n){if(0===n)return null;if(e[r]>2)throw new Error("invalid boolnull");if(n>1)throw new Error("invalid boolnull, length must = 1");return 0!==e[r]&&(1===e[r]||void 0)}function getType(e){return"string"==typeof e||e instanceof Date?STRING:Buffer.isBuffer(e)?BUFFER:Number.isInteger(e)&&Math.abs(e)<=4294967296?INT:"number"==typeof e&&Number.isFinite(e)?DOUBLE:Array.isArray(e)?ARRAY:e&&"object"==typeof e?OBJECT:"boolean"==typeof e||null==e?BOOLNULL:void 0}function encodingLength(e){var r=getType(e),n=encodingLengthers[r](e);return varint.encodingLength(n<>TAG_SIZE;return e.slice(r+varint.decode.bytes,r+varint.decode.bytes+n)}function getEncodedLength(e,r){return varint.decode(e,r)>>TAG_SIZE}function getEncodedType(e,r){return varint.decode(e,r)&TAG_MASK}function encode(e,r,n,t){n|=0;var o=getType(e);if("function"!=typeof encodingLengthers[o])throw new Error("unknown type:"+o+", "+JSON.stringify(e));var d=void 0===t?encodingLengthers[o](e):t;if(7===o)throw new Error("reserved type");varint.encode(d<>TAG_SIZE,d=varint.decode.bytes,i=decode_type(t,e,r+=d,o);return decode.bytes=o+d,i}function seekKey(e,r,n){if(-1===r)return-1;var t=(n=Buffer.isBuffer(n)?n:Buffer.from(n)).length,o=varint.decode(e,r),d=o>>TAG_SIZE;if((o&TAG_MASK)!=OBJECT)return-1;for(var i=varint.decode.bytes;i>TAG_SIZE;if((c&TAG_MASK)===STRING&&t===a&&0===e.compare(n,0,t,r+i,r+i+t))return r+i+a;i+=a;var u=varint.decode(e,r+i);i+=varint.decode.bytes,i+=u>>TAG_SIZE}return-1}function seekKey2(e,r,n,t){var o=varint.decode(e,r),d=varint.decode.bytes,i=o>>TAG_SIZE,c=o&TAG_MASK,a=varint.decode(n,t),u=(a>>TAG_SIZE)+varint.decode.bytes;if(c!=OBJECT)return-1;for(;d+u>TAG_SIZE)+varint.decode.bytes;d+=(f>>TAG_SIZE)+varint.decode.bytes,d+=(varint.decode(e,r+d)>>TAG_SIZE)+varint.decode.bytes}return-1}function seekPath(e,r,n,t){var o=decode(n,t=t||0);if(!Array.isArray(o))throw new Error("path must be encoded array");for(var d=0;d>TAG_SIZE,d=Math.min(n.length,o);return e.compare(n,0,d,r+varint.decode.bytes,r+varint.decode.bytes+d)||n.length-o}function isNull(e){return 6===e}function isUndefined(e,r){return 14===e&&2===r}function compare(e,r,n,t){if(-1===r||-1===t)return r-t;var o=varint.decode(e,r),d=varint.decode.bytes,i=varint.decode(n,t),c=varint.decode.bytes,a=o&TAG_MASK,u=i&TAG_MASK;if(isNull(o))return isNull(i)?0:-1;if(isNull(i))return 1;if(isUndefined(o,e[r+1]))return isUndefined(i,n[t+1])?0:1;if(isUndefined(i,n[t+1]))return-1;if(a===INT&&u===DOUBLE)return e.readInt32LE(r+d)-n.readDoubleLE(t+c);if(a===DOUBLE&&a===INT)return e.readDoubleLE(r+d)-n.readInt32LE(t+c);if(a!==u)return a-u;if(a===DOUBLE)return e.readDoubleLE(r+d)-n.readDoubleLE(t+c);if(a===INT)return e.readInt32LE(r+d)-n.readInt32LE(t+c);if(a!==STRING){var f=a-u;if(f)return f}return e.compare(n,t+c,t+c+(i>>TAG_SIZE),r+d,r+d+(o>>TAG_SIZE))}function iterate(e,r,n){var t=varint.decode(e,r),o=t>>TAG_SIZE,d=t&TAG_MASK;if(d==OBJECT)for(var i=varint.decode.bytes;i>TAG_SIZE),f=varint.decode(e,u),v=varint.decode.bytes+(f>>TAG_SIZE);n(e,u,c),i+=v}else if(d==ARRAY)for(i=varint.decode.bytes;i>TAG_SIZE);f=varint.decode(e,r+i);i+=varint.decode.bytes+(f>>TAG_SIZE)}return-1}function createCompareAt(e){var r=e.map(createSeekPath);return function(e,n){for(var t=0;t>>1,x=a[m]"];return n?c.indexOf("c")<0?h.push(";if(x===y){return m}else if(x<=y){"):h.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):h.push(";if(",c,"){i=m;"),i?h.push("l=m+1}else{h=m-1}"):h.push("h=m-1}else{l=m+1}"),h.push("}"),n?h.push("return -1};"):h.push("return i};"),h.join("")}function compileBoundsSearch(e,c,i,r){return new Function([compileSearch("A","x"+e+"y",c,["y"],r),compileSearch("P","c(x,y)"+e+"0",c,["y","c"],r),"function dispatchBsearch",i,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",i].join(""))()}module.exports={ge:compileBoundsSearch(">=",!1,"GE"),gt:compileBoundsSearch(">",!1,"GT"),lt:compileBoundsSearch("<",!0,"LT"),le:compileBoundsSearch("<=",!0,"LE"),eq:compileBoundsSearch("-",!0,"EQ",!0)}; + +},{}],54:[function(require,module,exports){ +(function (Buffer){(function (){ +var varint=require("varint"),STRING=0,BUFFER=1,INT=2,DOUBLE=3,ARRAY=4,OBJECT=5,BOOLNULL=6,RESERVED=7,TAG_SIZE=3,TAG_MASK=7,bytes=0,encoders=[function(e,r,n){return r.write(e,n)},function(e,r,n){return e.copy(r,n,0,e.length),e.length},function(e,r,n){return r.writeInt32LE(e,n),4},function(e,r,n){return r.writeDoubleLE(e,n),8},function(e,r,n){for(var t=n,o=0;o>TAG_SIZE,a=decode_type(i,e,r+(o+=varint.decode.bytes),c);t.push(a),o+=c}return t}function decode_object(e,r,n){for(var t={},o=0;o>TAG_SIZE;if(o+=varint.decode.bytes,7===i)throw new Error("reserved type:key");var a=decode_type(i,e,r+o,c);o+=c;var u=varint.decode(e,r+o),f=u&TAG_MASK;if(7===f)throw new Error("reserved type:value");var v=u>>TAG_SIZE,s=decode_type(f,e,r+(o+=varint.decode.bytes),v);o+=v,t[a]=s}return t}function decode_boolnull(e,r,n){if(0===n)return null;if(e[r]>2)throw new Error("invalid boolnull");if(n>1)throw new Error("invalid boolnull, length must = 1");return 0!==e[r]&&(1===e[r]||void 0)}function getType(e){return"string"==typeof e||e instanceof Date?STRING:Buffer.isBuffer(e)?BUFFER:Number.isInteger(e)&&Math.abs(e)<=4294967296?INT:"number"==typeof e&&Number.isFinite(e)?DOUBLE:Array.isArray(e)?ARRAY:e&&"object"==typeof e?OBJECT:"boolean"==typeof e||null==e?BOOLNULL:void 0}function encodingLength(e){var r=getType(e),n=encodingLengthers[r](e);return varint.encodingLength(n<>TAG_SIZE;return e.slice(r+varint.decode.bytes,r+varint.decode.bytes+n)}function getEncodedLength(e,r){return varint.decode(e,r)>>TAG_SIZE}function getEncodedType(e,r){return varint.decode(e,r)&TAG_MASK}function encode(e,r,n,t){n|=0;var o=getType(e);if("function"!=typeof encodingLengthers[o])throw new Error("unknown type:"+o+", "+JSON.stringify(e));var d=void 0===t?encodingLengthers[o](e):t;if(7===o)throw new Error("reserved type");varint.encode(d<>TAG_SIZE,d=varint.decode.bytes,i=decode_type(t,e,r+=d,o);return decode.bytes=o+d,i}function seekKey(e,r,n){if(-1===r)return-1;var t=(n=Buffer.isBuffer(n)?n:Buffer.from(n)).length,o=varint.decode(e,r),d=o>>TAG_SIZE;if((o&TAG_MASK)!=OBJECT)return-1;for(var i=varint.decode.bytes;i>TAG_SIZE;if((c&TAG_MASK)===STRING&&t===a&&0===e.compare(n,0,t,r+i,r+i+t))return r+i+a;i+=a;var u=varint.decode(e,r+i);i+=varint.decode.bytes,i+=u>>TAG_SIZE}return-1}function seekKey2(e,r,n,t){var o=varint.decode(e,r),d=varint.decode.bytes,i=o>>TAG_SIZE,c=o&TAG_MASK,a=varint.decode(n,t),u=(a>>TAG_SIZE)+varint.decode.bytes;if(c!=OBJECT)return-1;for(;d+u>TAG_SIZE)+varint.decode.bytes;d+=(f>>TAG_SIZE)+varint.decode.bytes,d+=(varint.decode(e,r+d)>>TAG_SIZE)+varint.decode.bytes}return-1}function seekPath(e,r,n,t){var o=decode(n,t=t||0);if(!Array.isArray(o))throw new Error("path must be encoded array");for(var d=0;d>TAG_SIZE,d=Math.min(n.length,o);return e.compare(n,0,d,r+varint.decode.bytes,r+varint.decode.bytes+d)||n.length-o}function isNull(e){return 6===e}function isUndefined(e,r){return 14===e&&2===r}function compare(e,r,n,t){if(-1===r||-1===t)return r-t;var o=varint.decode(e,r),d=varint.decode.bytes,i=varint.decode(n,t),c=varint.decode.bytes,a=o&TAG_MASK,u=i&TAG_MASK;if(isNull(o))return isNull(i)?0:-1;if(isNull(i))return 1;if(isUndefined(o,e[r+1]))return isUndefined(i,n[t+1])?0:1;if(isUndefined(i,n[t+1]))return-1;if(a===INT&&u===DOUBLE)return e.readInt32LE(r+d)-n.readDoubleLE(t+c);if(a===DOUBLE&&a===INT)return e.readDoubleLE(r+d)-n.readInt32LE(t+c);if(a!==u)return a-u;if(a===DOUBLE)return e.readDoubleLE(r+d)-n.readDoubleLE(t+c);if(a===INT)return e.readInt32LE(r+d)-n.readInt32LE(t+c);if(a!==STRING){var f=a-u;if(f)return f}return e.compare(n,t+c,t+c+(i>>TAG_SIZE),r+d,r+d+(o>>TAG_SIZE))}function iterate(e,r,n){var t=varint.decode(e,r),o=t>>TAG_SIZE,d=t&TAG_MASK;if(d===OBJECT){for(var i=varint.decode.bytes;i>TAG_SIZE),f=varint.decode(e,u),v=varint.decode.bytes+(f>>TAG_SIZE);if(n(e,u,c))return r;i+=v}return r}if(d===ARRAY){var s=0;for(i=varint.decode.bytes;i>TAG_SIZE)}return r}return-1}function createCompareAt(e){var r=e.map(createSeekPath);return function(e,n){for(var t=0;t=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:a,o|=u}return r(!(240&o),"Invalid character in "+t),h}function s(t,i,n,h){for(var e=0,o=0,s=Math.min(t.length,n),u=i;u=49?a-49+10:a>=17?a-17+10:a,r(a>=0&&o"}h.isBN=function(t){return t instanceof h||null!==t&&"object"==typeof t&&t.constructor.wordSize===h.wordSize&&Array.isArray(t.words)},h.max=function(t,i){return t.cmp(i)>0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if("number"==typeof t)return this._initNumber(t,i,n);if("object"==typeof t)return this._initArray(t,i,n);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var h=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&h++,16===i?this._parseHex(t,h):this._parseBase(t,i,h),"-"===t[0]&&(this.negative=1),this._strip(),"le"===n&&this._initArray(this.toArray(),i,n)},h.prototype._initNumber=function(t,i,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),i,n)},h.prototype._initArray=function(t,i,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var h=0;h=0;h-=3)o=t[h]|t[h-1]<<8|t[h-2]<<16,this.words[e]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===n)for(h=0,e=0;h>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this._strip()},h.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r=i;r-=6)h=o(t,r,r+6),this.words[n]|=h<>>26-e&4194303,(e+=24)>=26&&(e-=26,n++);r+6!==i&&(h=o(t,i,r+6),this.words[n]|=h<>>26-e&4194303),this._strip()},h.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var n=0,h=1;h<=67108863;h*=i)n++;n--,h=h/i|0;for(var e=t.length-r,o=e%n,u=Math.min(e,e-o)+r,a=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},h.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?h.prototype[Symbol.for("nodejs.util.inspect.custom")]=a:h.prototype.inspect=a;var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],m=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(t,i){var n;if(i=0|i||1,16===(t=t||10)||"hex"===t){n="";for(var h=0,e=0,o=0;o>>24-h&16777215)||o!==this.length-1?l[6-u.length]+u+n:u+n,(h+=2)>=26&&(h-=26,o--)}for(0!==e&&(n=e.toString(16)+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var a=m[t],d=f[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modrn(d).toString(t);n=(p=p.idivn(d)).isZero()?M+n:l[a-M.length]+M+n}for(this.isZero()&&(n="0"+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},h.prototype.toJSON=function(){return this.toString(16,2)},e&&(h.prototype.toBuffer=function(t,i){return this.toArrayLike(e,t,i)}),h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)};function d(t,i,r){r.negative=i.negative^t.negative;var n=t.length+i.length|0;r.length=n,n=n-1|0;var h=0|t.words[0],e=0|i.words[0],o=h*e,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(h=0|t.words[p])*(e=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r._strip()}h.prototype.toArrayLike=function(t,i,n){this._strip();var h=this.byteLength(),e=n||Math.max(1,h);r(h<=e,"byte array longer than desired length"),r(e>0,"Requested array length <= 0");var o=function(t,i){return t.allocUnsafe?t.allocUnsafe(i):new t(i)}(t,e);return this["_toArrayLike"+("le"===i?"LE":"BE")](o,h),o},h.prototype._toArrayLikeLE=function(t,i){for(var r=0,n=0,h=0,e=0;h>8&255),r>16&255),6===e?(r>24&255),n=0,e=0):(n=o>>>24,e+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===e?(r>=0&&(t[r--]=o>>24&255),n=0,e=0):(n=o>>>24,e+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?h.prototype._countBits=function(t){return 32-Math.clz32(t)}:h.prototype._countBits=function(t){var i=t,r=0;return i>=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},h.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),n=t%26;this._expand(i),n>0&&i--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-n),this._strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var n=t/26|0,h=t%26;return this._expand(n+1),this.words[n]=i?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var h=0,e=0;e>>26;for(;0!==h&&e>>26;if(this.length=r.length,0!==h)this.words[this.length]=h,this.length++;else if(r!==this)for(;et.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,h=this.cmp(t);if(0===h)return this.negative=0,this.length=1,this.words[0]=0,this;h>0?(r=this,n=t):(r=t,n=this);for(var e=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==e&&o>26,this.words[o]=67108863&i;if(0===e&&o>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],g=8191&v,c=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,S=0|o[5],x=8191&S,q=S>>>13,B=0|o[6],R=8191&B,Z=B>>>13,L=0|o[7],N=8191&L,I=L>>>13,E=0|o[8],z=8191&E,T=E>>>13,O=0|o[9],j=8191&O,K=O>>>13,P=0|s[0],F=8191&P,U=P>>>13,C=0|s[1],D=8191&C,H=C>>>13,J=0|s[2],G=8191&J,Q=J>>>13,V=0|s[3],W=8191&V,X=V>>>13,Y=0|s[4],$=8191&Y,tt=Y>>>13,it=0|s[5],rt=8191&it,nt=it>>>13,ht=0|s[6],et=8191&ht,ot=ht>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(n=Math.imul(m,F))|0)+((8191&(h=(h=Math.imul(m,U))+Math.imul(f,F)|0))<<13)|0;a=((e=Math.imul(f,U))+(h>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,F),h=(h=Math.imul(p,U))+Math.imul(M,F)|0,e=Math.imul(M,U);var gt=(a+(n=n+Math.imul(m,D)|0)|0)+((8191&(h=(h=h+Math.imul(m,H)|0)+Math.imul(f,D)|0))<<13)|0;a=((e=e+Math.imul(f,H)|0)+(h>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),h=(h=Math.imul(g,U))+Math.imul(c,F)|0,e=Math.imul(c,U),n=n+Math.imul(p,D)|0,h=(h=h+Math.imul(p,H)|0)+Math.imul(M,D)|0,e=e+Math.imul(M,H)|0;var ct=(a+(n=n+Math.imul(m,G)|0)|0)+((8191&(h=(h=h+Math.imul(m,Q)|0)+Math.imul(f,G)|0))<<13)|0;a=((e=e+Math.imul(f,Q)|0)+(h>>>13)|0)+(ct>>>26)|0,ct&=67108863,n=Math.imul(y,F),h=(h=Math.imul(y,U))+Math.imul(b,F)|0,e=Math.imul(b,U),n=n+Math.imul(g,D)|0,h=(h=h+Math.imul(g,H)|0)+Math.imul(c,D)|0,e=e+Math.imul(c,H)|0,n=n+Math.imul(p,G)|0,h=(h=h+Math.imul(p,Q)|0)+Math.imul(M,G)|0,e=e+Math.imul(M,Q)|0;var wt=(a+(n=n+Math.imul(m,W)|0)|0)+((8191&(h=(h=h+Math.imul(m,X)|0)+Math.imul(f,W)|0))<<13)|0;a=((e=e+Math.imul(f,X)|0)+(h>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,F),h=(h=Math.imul(k,U))+Math.imul(A,F)|0,e=Math.imul(A,U),n=n+Math.imul(y,D)|0,h=(h=h+Math.imul(y,H)|0)+Math.imul(b,D)|0,e=e+Math.imul(b,H)|0,n=n+Math.imul(g,G)|0,h=(h=h+Math.imul(g,Q)|0)+Math.imul(c,G)|0,e=e+Math.imul(c,Q)|0,n=n+Math.imul(p,W)|0,h=(h=h+Math.imul(p,X)|0)+Math.imul(M,W)|0,e=e+Math.imul(M,X)|0;var yt=(a+(n=n+Math.imul(m,$)|0)|0)+((8191&(h=(h=h+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((e=e+Math.imul(f,tt)|0)+(h>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,F),h=(h=Math.imul(x,U))+Math.imul(q,F)|0,e=Math.imul(q,U),n=n+Math.imul(k,D)|0,h=(h=h+Math.imul(k,H)|0)+Math.imul(A,D)|0,e=e+Math.imul(A,H)|0,n=n+Math.imul(y,G)|0,h=(h=h+Math.imul(y,Q)|0)+Math.imul(b,G)|0,e=e+Math.imul(b,Q)|0,n=n+Math.imul(g,W)|0,h=(h=h+Math.imul(g,X)|0)+Math.imul(c,W)|0,e=e+Math.imul(c,X)|0,n=n+Math.imul(p,$)|0,h=(h=h+Math.imul(p,tt)|0)+Math.imul(M,$)|0,e=e+Math.imul(M,tt)|0;var bt=(a+(n=n+Math.imul(m,rt)|0)|0)+((8191&(h=(h=h+Math.imul(m,nt)|0)+Math.imul(f,rt)|0))<<13)|0;a=((e=e+Math.imul(f,nt)|0)+(h>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(R,F),h=(h=Math.imul(R,U))+Math.imul(Z,F)|0,e=Math.imul(Z,U),n=n+Math.imul(x,D)|0,h=(h=h+Math.imul(x,H)|0)+Math.imul(q,D)|0,e=e+Math.imul(q,H)|0,n=n+Math.imul(k,G)|0,h=(h=h+Math.imul(k,Q)|0)+Math.imul(A,G)|0,e=e+Math.imul(A,Q)|0,n=n+Math.imul(y,W)|0,h=(h=h+Math.imul(y,X)|0)+Math.imul(b,W)|0,e=e+Math.imul(b,X)|0,n=n+Math.imul(g,$)|0,h=(h=h+Math.imul(g,tt)|0)+Math.imul(c,$)|0,e=e+Math.imul(c,tt)|0,n=n+Math.imul(p,rt)|0,h=(h=h+Math.imul(p,nt)|0)+Math.imul(M,rt)|0,e=e+Math.imul(M,nt)|0;var _t=(a+(n=n+Math.imul(m,et)|0)|0)+((8191&(h=(h=h+Math.imul(m,ot)|0)+Math.imul(f,et)|0))<<13)|0;a=((e=e+Math.imul(f,ot)|0)+(h>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(N,F),h=(h=Math.imul(N,U))+Math.imul(I,F)|0,e=Math.imul(I,U),n=n+Math.imul(R,D)|0,h=(h=h+Math.imul(R,H)|0)+Math.imul(Z,D)|0,e=e+Math.imul(Z,H)|0,n=n+Math.imul(x,G)|0,h=(h=h+Math.imul(x,Q)|0)+Math.imul(q,G)|0,e=e+Math.imul(q,Q)|0,n=n+Math.imul(k,W)|0,h=(h=h+Math.imul(k,X)|0)+Math.imul(A,W)|0,e=e+Math.imul(A,X)|0,n=n+Math.imul(y,$)|0,h=(h=h+Math.imul(y,tt)|0)+Math.imul(b,$)|0,e=e+Math.imul(b,tt)|0,n=n+Math.imul(g,rt)|0,h=(h=h+Math.imul(g,nt)|0)+Math.imul(c,rt)|0,e=e+Math.imul(c,nt)|0,n=n+Math.imul(p,et)|0,h=(h=h+Math.imul(p,ot)|0)+Math.imul(M,et)|0,e=e+Math.imul(M,ot)|0;var kt=(a+(n=n+Math.imul(m,ut)|0)|0)+((8191&(h=(h=h+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((e=e+Math.imul(f,at)|0)+(h>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(z,F),h=(h=Math.imul(z,U))+Math.imul(T,F)|0,e=Math.imul(T,U),n=n+Math.imul(N,D)|0,h=(h=h+Math.imul(N,H)|0)+Math.imul(I,D)|0,e=e+Math.imul(I,H)|0,n=n+Math.imul(R,G)|0,h=(h=h+Math.imul(R,Q)|0)+Math.imul(Z,G)|0,e=e+Math.imul(Z,Q)|0,n=n+Math.imul(x,W)|0,h=(h=h+Math.imul(x,X)|0)+Math.imul(q,W)|0,e=e+Math.imul(q,X)|0,n=n+Math.imul(k,$)|0,h=(h=h+Math.imul(k,tt)|0)+Math.imul(A,$)|0,e=e+Math.imul(A,tt)|0,n=n+Math.imul(y,rt)|0,h=(h=h+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,e=e+Math.imul(b,nt)|0,n=n+Math.imul(g,et)|0,h=(h=h+Math.imul(g,ot)|0)+Math.imul(c,et)|0,e=e+Math.imul(c,ot)|0,n=n+Math.imul(p,ut)|0,h=(h=h+Math.imul(p,at)|0)+Math.imul(M,ut)|0,e=e+Math.imul(M,at)|0;var At=(a+(n=n+Math.imul(m,mt)|0)|0)+((8191&(h=(h=h+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((e=e+Math.imul(f,ft)|0)+(h>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,F),h=(h=Math.imul(j,U))+Math.imul(K,F)|0,e=Math.imul(K,U),n=n+Math.imul(z,D)|0,h=(h=h+Math.imul(z,H)|0)+Math.imul(T,D)|0,e=e+Math.imul(T,H)|0,n=n+Math.imul(N,G)|0,h=(h=h+Math.imul(N,Q)|0)+Math.imul(I,G)|0,e=e+Math.imul(I,Q)|0,n=n+Math.imul(R,W)|0,h=(h=h+Math.imul(R,X)|0)+Math.imul(Z,W)|0,e=e+Math.imul(Z,X)|0,n=n+Math.imul(x,$)|0,h=(h=h+Math.imul(x,tt)|0)+Math.imul(q,$)|0,e=e+Math.imul(q,tt)|0,n=n+Math.imul(k,rt)|0,h=(h=h+Math.imul(k,nt)|0)+Math.imul(A,rt)|0,e=e+Math.imul(A,nt)|0,n=n+Math.imul(y,et)|0,h=(h=h+Math.imul(y,ot)|0)+Math.imul(b,et)|0,e=e+Math.imul(b,ot)|0,n=n+Math.imul(g,ut)|0,h=(h=h+Math.imul(g,at)|0)+Math.imul(c,ut)|0,e=e+Math.imul(c,at)|0,n=n+Math.imul(p,mt)|0,h=(h=h+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,e=e+Math.imul(M,ft)|0;var St=(a+(n=n+Math.imul(m,pt)|0)|0)+((8191&(h=(h=h+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((e=e+Math.imul(f,Mt)|0)+(h>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,D),h=(h=Math.imul(j,H))+Math.imul(K,D)|0,e=Math.imul(K,H),n=n+Math.imul(z,G)|0,h=(h=h+Math.imul(z,Q)|0)+Math.imul(T,G)|0,e=e+Math.imul(T,Q)|0,n=n+Math.imul(N,W)|0,h=(h=h+Math.imul(N,X)|0)+Math.imul(I,W)|0,e=e+Math.imul(I,X)|0,n=n+Math.imul(R,$)|0,h=(h=h+Math.imul(R,tt)|0)+Math.imul(Z,$)|0,e=e+Math.imul(Z,tt)|0,n=n+Math.imul(x,rt)|0,h=(h=h+Math.imul(x,nt)|0)+Math.imul(q,rt)|0,e=e+Math.imul(q,nt)|0,n=n+Math.imul(k,et)|0,h=(h=h+Math.imul(k,ot)|0)+Math.imul(A,et)|0,e=e+Math.imul(A,ot)|0,n=n+Math.imul(y,ut)|0,h=(h=h+Math.imul(y,at)|0)+Math.imul(b,ut)|0,e=e+Math.imul(b,at)|0,n=n+Math.imul(g,mt)|0,h=(h=h+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,e=e+Math.imul(c,ft)|0;var xt=(a+(n=n+Math.imul(p,pt)|0)|0)+((8191&(h=(h=h+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((e=e+Math.imul(M,Mt)|0)+(h>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,G),h=(h=Math.imul(j,Q))+Math.imul(K,G)|0,e=Math.imul(K,Q),n=n+Math.imul(z,W)|0,h=(h=h+Math.imul(z,X)|0)+Math.imul(T,W)|0,e=e+Math.imul(T,X)|0,n=n+Math.imul(N,$)|0,h=(h=h+Math.imul(N,tt)|0)+Math.imul(I,$)|0,e=e+Math.imul(I,tt)|0,n=n+Math.imul(R,rt)|0,h=(h=h+Math.imul(R,nt)|0)+Math.imul(Z,rt)|0,e=e+Math.imul(Z,nt)|0,n=n+Math.imul(x,et)|0,h=(h=h+Math.imul(x,ot)|0)+Math.imul(q,et)|0,e=e+Math.imul(q,ot)|0,n=n+Math.imul(k,ut)|0,h=(h=h+Math.imul(k,at)|0)+Math.imul(A,ut)|0,e=e+Math.imul(A,at)|0,n=n+Math.imul(y,mt)|0,h=(h=h+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,e=e+Math.imul(b,ft)|0;var qt=(a+(n=n+Math.imul(g,pt)|0)|0)+((8191&(h=(h=h+Math.imul(g,Mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((e=e+Math.imul(c,Mt)|0)+(h>>>13)|0)+(qt>>>26)|0,qt&=67108863,n=Math.imul(j,W),h=(h=Math.imul(j,X))+Math.imul(K,W)|0,e=Math.imul(K,X),n=n+Math.imul(z,$)|0,h=(h=h+Math.imul(z,tt)|0)+Math.imul(T,$)|0,e=e+Math.imul(T,tt)|0,n=n+Math.imul(N,rt)|0,h=(h=h+Math.imul(N,nt)|0)+Math.imul(I,rt)|0,e=e+Math.imul(I,nt)|0,n=n+Math.imul(R,et)|0,h=(h=h+Math.imul(R,ot)|0)+Math.imul(Z,et)|0,e=e+Math.imul(Z,ot)|0,n=n+Math.imul(x,ut)|0,h=(h=h+Math.imul(x,at)|0)+Math.imul(q,ut)|0,e=e+Math.imul(q,at)|0,n=n+Math.imul(k,mt)|0,h=(h=h+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,e=e+Math.imul(A,ft)|0;var Bt=(a+(n=n+Math.imul(y,pt)|0)|0)+((8191&(h=(h=h+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((e=e+Math.imul(b,Mt)|0)+(h>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,$),h=(h=Math.imul(j,tt))+Math.imul(K,$)|0,e=Math.imul(K,tt),n=n+Math.imul(z,rt)|0,h=(h=h+Math.imul(z,nt)|0)+Math.imul(T,rt)|0,e=e+Math.imul(T,nt)|0,n=n+Math.imul(N,et)|0,h=(h=h+Math.imul(N,ot)|0)+Math.imul(I,et)|0,e=e+Math.imul(I,ot)|0,n=n+Math.imul(R,ut)|0,h=(h=h+Math.imul(R,at)|0)+Math.imul(Z,ut)|0,e=e+Math.imul(Z,at)|0,n=n+Math.imul(x,mt)|0,h=(h=h+Math.imul(x,ft)|0)+Math.imul(q,mt)|0,e=e+Math.imul(q,ft)|0;var Rt=(a+(n=n+Math.imul(k,pt)|0)|0)+((8191&(h=(h=h+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((e=e+Math.imul(A,Mt)|0)+(h>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,rt),h=(h=Math.imul(j,nt))+Math.imul(K,rt)|0,e=Math.imul(K,nt),n=n+Math.imul(z,et)|0,h=(h=h+Math.imul(z,ot)|0)+Math.imul(T,et)|0,e=e+Math.imul(T,ot)|0,n=n+Math.imul(N,ut)|0,h=(h=h+Math.imul(N,at)|0)+Math.imul(I,ut)|0,e=e+Math.imul(I,at)|0,n=n+Math.imul(R,mt)|0,h=(h=h+Math.imul(R,ft)|0)+Math.imul(Z,mt)|0,e=e+Math.imul(Z,ft)|0;var Zt=(a+(n=n+Math.imul(x,pt)|0)|0)+((8191&(h=(h=h+Math.imul(x,Mt)|0)+Math.imul(q,pt)|0))<<13)|0;a=((e=e+Math.imul(q,Mt)|0)+(h>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,n=Math.imul(j,et),h=(h=Math.imul(j,ot))+Math.imul(K,et)|0,e=Math.imul(K,ot),n=n+Math.imul(z,ut)|0,h=(h=h+Math.imul(z,at)|0)+Math.imul(T,ut)|0,e=e+Math.imul(T,at)|0,n=n+Math.imul(N,mt)|0,h=(h=h+Math.imul(N,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Lt=(a+(n=n+Math.imul(R,pt)|0)|0)+((8191&(h=(h=h+Math.imul(R,Mt)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((e=e+Math.imul(Z,Mt)|0)+(h>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,ut),h=(h=Math.imul(j,at))+Math.imul(K,ut)|0,e=Math.imul(K,at),n=n+Math.imul(z,mt)|0,h=(h=h+Math.imul(z,ft)|0)+Math.imul(T,mt)|0,e=e+Math.imul(T,ft)|0;var Nt=(a+(n=n+Math.imul(N,pt)|0)|0)+((8191&(h=(h=h+Math.imul(N,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(h>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(j,mt),h=(h=Math.imul(j,ft))+Math.imul(K,mt)|0,e=Math.imul(K,ft);var It=(a+(n=n+Math.imul(z,pt)|0)|0)+((8191&(h=(h=h+Math.imul(z,Mt)|0)+Math.imul(T,pt)|0))<<13)|0;a=((e=e+Math.imul(T,Mt)|0)+(h>>>13)|0)+(It>>>26)|0,It&=67108863;var Et=(a+(n=Math.imul(j,pt))|0)+((8191&(h=(h=Math.imul(j,Mt))+Math.imul(K,pt)|0))<<13)|0;return a=((e=Math.imul(K,Mt))+(h>>>13)|0)+(Et>>>26)|0,Et&=67108863,u[0]=vt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=St,u[10]=xt,u[11]=qt,u[12]=Bt,u[13]=Rt,u[14]=Zt,u[15]=Lt,u[16]=Nt,u[17]=It,u[18]=Et,0!==a&&(u[19]=a,r.length++),r};function M(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var n=0,h=0,e=0;e>>26)|0)>>>26,o&=67108863}r.words[e]=s,n=o,o=h}return 0!==n?r.words[e]=n:r.length--,r._strip()}function v(t,i,r){return M(t,i,r)}function g(t,i){this.x=t,this.y=i}Math.imul||(p=d),h.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,i):r<63?d(this,t,i):r<1024?M(this,t,i):v(this,t,i)},g.prototype.makeRBT=function(t){for(var i=new Array(t),r=h.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,i,r,n,h,e){for(var o=0;o>>=1)h++;return 1<>>=13,n[2*o+1]=8191&e,e>>>=13;for(o=2*i;o>=26,n+=e/67108864|0,n+=o>>>26,this.words[h]=67108863&o}return 0!==n&&(this.words[h]=n,this.length++),i?this.ineg():this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r>>h&1}return i}(t);if(0===i.length)return new h(1);for(var r=this,n=0;n=0);var i,n=t%26,h=(t-n)/26,e=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(i=0;i>>26-n}o&&(this.words[i]=o,this.length++)}if(0!==h){for(i=this.length-1;i>=0;i--)this.words[i+h]=this.words[i];for(i=0;i=0),h=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<o)for(this.length-=o,a=0;a=0&&(0!==l||a>=h);a--){var m=0|this.words[a];this.words[a]=l<<26-e|m>>>e,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},h.prototype.ishrn=function(t,i,n){return r(0===this.negative),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,n=(t-i)/26,h=1<=0);var i=t%26,n=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==i&&n++,this.length=Math.min(n,this.length),0!==i){var h=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(u/67108864|0),this.words[h+n]=67108863&e}for(;h>26,this.words[h+n]=67108863&e;if(0===s)return this._strip();for(r(-1===s),s=0,h=0;h>26,this.words[h]=67108863&e;return this.negative=1,this._strip()},h.prototype._wordDiv=function(t,i){var r=(this.length,t.length),n=this.clone(),e=t,o=0|e.words[e.length-1];0!==(r=26-this._countBits(o))&&(e=e.ushln(r),n.iushln(r),o=0|e.words[e.length-1]);var s,u=n.length-e.length;if("mod"!==i){(s=new h(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a=0;m--){var f=67108864*(0|n.words[e.length+m])+(0|n.words[e.length+m-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(e,f,m);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(e,1,m),n.isZero()||(n.negative^=1);s&&(s.words[m]=f)}return s&&s._strip(),n._strip(),"div"!==i&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},h.prototype.divmod=function(t,i,n){return r(!t.isZero()),this.isZero()?{div:new h(0),mod:new h(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new h(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modrn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,n=t.ushrn(1),h=t.andln(1),e=r.cmp(n);return e<0||1===h&&0===e?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modrn=function(t){var i=t<0;i&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,h=0,e=this.length-1;e>=0;e--)h=(n*h+(0|this.words[e]))%t;return i?-h:h},h.prototype.modn=function(t){return this.modrn(t)},h.prototype.idivn=function(t){var i=t<0;i&&(t=-t),r(t<=67108863);for(var n=0,h=this.length-1;h>=0;h--){var e=(0|this.words[h])+67108864*n;this.words[h]=e/t|0,n=e%t}return this._strip(),i?this.ineg():this},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,n=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new h(1),o=new h(0),s=new h(0),u=new h(1),a=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++a;for(var l=n.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(m)),e.iushrn(1),o.iushrn(1);for(var p=0,M=1;0==(n.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(n)>=0?(i.isub(n),e.isub(s),o.isub(u)):(n.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:n.iushln(a)}},h.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,n=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new h(1),s=new h(0),u=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(n.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(n.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(n)>=0?(i.isub(n),o.isub(s)):(n.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var n=0;i.isEven()&&r.isEven();n++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var h=i.cmp(r);if(h<0){var e=i;i=r,r=e}else if(0===h||0===r.cmpn(1))break;i.isub(r)}return r.iushln(n)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,n=(t-i)/26,h=1<>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(t){var i,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var h=0|this.words[0];i=h===t?0:ht.length)return 1;if(this.length=0;r--){var n=0|this.words[r],h=0|t.words[r];if(n!==h){nh&&(i=1);break}}return i},h.prototype.gtn=function(t){return 1===this.cmpn(t)},h.prototype.gt=function(t){return 1===this.cmp(t)},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return-1===this.cmpn(t)},h.prototype.lt=function(t){return-1===this.cmp(t)},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return 0===this.cmpn(t)},h.prototype.eq=function(t){return 0===this.cmp(t)},h.red=function(t){return new A(t)},h.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var c={k256:null,p224:null,p192:null,p25519:null};function w(t,i){this.name=t,this.p=new h(i,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var i=h._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var n=i0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,i){t.iushrn(this.n,0,i)},w.prototype.imulK=function(t){return t.imul(this.k)},n(y,w),y.prototype.split=function(t,i){for(var r=Math.min(t.length,9),n=0;n>>22,h=e}h>>>=22,t.words[n-10]=h,0===h&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r>>=26,t.words[r]=h,i=n}return 0!==i&&(t.words[t.length++]=i),t},h._prime=function(t){if(c[t])return c[t];var i;if("k256"===t)i=new y;else if("p224"===t)i=new b;else if("p192"===t)i=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new k}return c[t]=i,i},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},A.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},A.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new h(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new h(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,e),f=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();r(v=0;n--){for(var a=i.words[n],l=u-1;l>=0;l--){var m=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===n&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},A.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},A.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new S(t)},n(S,A),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},S.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=r.isub(n).iushrn(this.shift),e=h;return h.cmp(this.m)>=0?e=h.isub(this.m):h.cmpn(0)<0&&(e=h.iadd(this.m)),e._forceRed(this)},S.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var r=t.mul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(n).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof module||module,this); +}).call(this)}).call(this,require("buffer").Buffer) +},{"buffer":101,"varint":672}],55:[function(require,module,exports){ +!function(t,i){"use strict";function r(t,i){if(!t)throw new Error(i||"Assertion failed")}function n(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function h(t,i,r){if(h.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var e;"object"==typeof t?t.exports=h:i.BN=h,h.BN=h,h.wordSize=26;try{e=require("buffer").Buffer}catch(t){}function o(t,i,n){for(var h=0,e=Math.min(t.length,n),o=0,s=i;s=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:a,o|=u}return r(!(240&o),"Invalid character in "+t),h}function s(t,i,n,h){for(var e=0,o=0,s=Math.min(t.length,n),u=i;u=49?a-49+10:a>=17?a-17+10:a,r(a>=0&&o0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if("number"==typeof t)return this._initNumber(t,i,n);if("object"==typeof t)return this._initArray(t,i,n);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var h=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&h++,16===i?this._parseHex(t,h):this._parseBase(t,i,h),"-"===t[0]&&(this.negative=1),this._strip(),"le"===n&&this._initArray(this.toArray(),i,n)},h.prototype._initNumber=function(t,i,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),i,n)},h.prototype._initArray=function(t,i,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var h=0;h=0;h-=3)o=t[h]|t[h-1]<<8|t[h-2]<<16,this.words[e]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===n)for(h=0,e=0;h>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this._strip()},h.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r=i;r-=6)h=o(t,r,r+6),this.words[n]|=h<>>26-e&4194303,(e+=24)>=26&&(e-=26,n++);r+6!==i&&(h=o(t,i,r+6),this.words[n]|=h<>>26-e&4194303),this._strip()},h.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var n=0,h=1;h<=67108863;h*=i)n++;n--,h=h/i|0;for(var e=t.length-r,o=e%n,u=Math.min(e,e-o)+r,a=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},h.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{h.prototype[Symbol.for("nodejs.util.inspect.custom")]=a}catch(t){h.prototype.inspect=a}else h.prototype.inspect=a;function a(){return(this.red?""}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],m=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];h.prototype.toString=function(t,i){var n;if(i=0|i||1,16===(t=t||10)||"hex"===t){n="";for(var h=0,e=0,o=0;o>>24-h&16777215)||o!==this.length-1?l[6-u.length]+u+n:u+n,(h+=2)>=26&&(h-=26,o--)}for(0!==e&&(n=e.toString(16)+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var a=m[t],d=f[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modrn(d).toString(t);n=(p=p.idivn(d)).isZero()?M+n:l[a-M.length]+M+n}for(this.isZero()&&(n="0"+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},h.prototype.toJSON=function(){return this.toString(16,2)},e&&(h.prototype.toBuffer=function(t,i){return this.toArrayLike(e,t,i)}),h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)};function d(t,i,r){r.negative=i.negative^t.negative;var n=t.length+i.length|0;r.length=n,n=n-1|0;var h=0|t.words[0],e=0|i.words[0],o=h*e,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(h=0|t.words[p])*(e=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r._strip()}h.prototype.toArrayLike=function(t,i,n){this._strip();var h=this.byteLength(),e=n||Math.max(1,h);r(h<=e,"byte array longer than desired length"),r(e>0,"Requested array length <= 0");var o=function(t,i){return t.allocUnsafe?t.allocUnsafe(i):new t(i)}(t,e);return this["_toArrayLike"+("le"===i?"LE":"BE")](o,h),o},h.prototype._toArrayLikeLE=function(t,i){for(var r=0,n=0,h=0,e=0;h>8&255),r>16&255),6===e?(r>24&255),n=0,e=0):(n=o>>>24,e+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===e?(r>=0&&(t[r--]=o>>24&255),n=0,e=0):(n=o>>>24,e+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?h.prototype._countBits=function(t){return 32-Math.clz32(t)}:h.prototype._countBits=function(t){var i=t,r=0;return i>=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},h.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),n=t%26;this._expand(i),n>0&&i--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-n),this._strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var n=t/26|0,h=t%26;return this._expand(n+1),this.words[n]=i?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var h=0,e=0;e>>26;for(;0!==h&&e>>26;if(this.length=r.length,0!==h)this.words[this.length]=h,this.length++;else if(r!==this)for(;et.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,h=this.cmp(t);if(0===h)return this.negative=0,this.length=1,this.words[0]=0,this;h>0?(r=this,n=t):(r=t,n=this);for(var e=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==e&&o>26,this.words[o]=67108863&i;if(0===e&&o>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],g=8191&v,c=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,S=0|o[5],x=8191&S,q=S>>>13,B=0|o[6],R=8191&B,Z=B>>>13,L=0|o[7],N=8191&L,I=L>>>13,E=0|o[8],z=8191&E,T=E>>>13,O=0|o[9],j=8191&O,K=O>>>13,P=0|s[0],F=8191&P,U=P>>>13,C=0|s[1],D=8191&C,H=C>>>13,J=0|s[2],G=8191&J,Q=J>>>13,V=0|s[3],W=8191&V,X=V>>>13,Y=0|s[4],$=8191&Y,tt=Y>>>13,it=0|s[5],rt=8191&it,nt=it>>>13,ht=0|s[6],et=8191&ht,ot=ht>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(n=Math.imul(m,F))|0)+((8191&(h=(h=Math.imul(m,U))+Math.imul(f,F)|0))<<13)|0;a=((e=Math.imul(f,U))+(h>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,F),h=(h=Math.imul(p,U))+Math.imul(M,F)|0,e=Math.imul(M,U);var gt=(a+(n=n+Math.imul(m,D)|0)|0)+((8191&(h=(h=h+Math.imul(m,H)|0)+Math.imul(f,D)|0))<<13)|0;a=((e=e+Math.imul(f,H)|0)+(h>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),h=(h=Math.imul(g,U))+Math.imul(c,F)|0,e=Math.imul(c,U),n=n+Math.imul(p,D)|0,h=(h=h+Math.imul(p,H)|0)+Math.imul(M,D)|0,e=e+Math.imul(M,H)|0;var ct=(a+(n=n+Math.imul(m,G)|0)|0)+((8191&(h=(h=h+Math.imul(m,Q)|0)+Math.imul(f,G)|0))<<13)|0;a=((e=e+Math.imul(f,Q)|0)+(h>>>13)|0)+(ct>>>26)|0,ct&=67108863,n=Math.imul(y,F),h=(h=Math.imul(y,U))+Math.imul(b,F)|0,e=Math.imul(b,U),n=n+Math.imul(g,D)|0,h=(h=h+Math.imul(g,H)|0)+Math.imul(c,D)|0,e=e+Math.imul(c,H)|0,n=n+Math.imul(p,G)|0,h=(h=h+Math.imul(p,Q)|0)+Math.imul(M,G)|0,e=e+Math.imul(M,Q)|0;var wt=(a+(n=n+Math.imul(m,W)|0)|0)+((8191&(h=(h=h+Math.imul(m,X)|0)+Math.imul(f,W)|0))<<13)|0;a=((e=e+Math.imul(f,X)|0)+(h>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,F),h=(h=Math.imul(k,U))+Math.imul(A,F)|0,e=Math.imul(A,U),n=n+Math.imul(y,D)|0,h=(h=h+Math.imul(y,H)|0)+Math.imul(b,D)|0,e=e+Math.imul(b,H)|0,n=n+Math.imul(g,G)|0,h=(h=h+Math.imul(g,Q)|0)+Math.imul(c,G)|0,e=e+Math.imul(c,Q)|0,n=n+Math.imul(p,W)|0,h=(h=h+Math.imul(p,X)|0)+Math.imul(M,W)|0,e=e+Math.imul(M,X)|0;var yt=(a+(n=n+Math.imul(m,$)|0)|0)+((8191&(h=(h=h+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((e=e+Math.imul(f,tt)|0)+(h>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,F),h=(h=Math.imul(x,U))+Math.imul(q,F)|0,e=Math.imul(q,U),n=n+Math.imul(k,D)|0,h=(h=h+Math.imul(k,H)|0)+Math.imul(A,D)|0,e=e+Math.imul(A,H)|0,n=n+Math.imul(y,G)|0,h=(h=h+Math.imul(y,Q)|0)+Math.imul(b,G)|0,e=e+Math.imul(b,Q)|0,n=n+Math.imul(g,W)|0,h=(h=h+Math.imul(g,X)|0)+Math.imul(c,W)|0,e=e+Math.imul(c,X)|0,n=n+Math.imul(p,$)|0,h=(h=h+Math.imul(p,tt)|0)+Math.imul(M,$)|0,e=e+Math.imul(M,tt)|0;var bt=(a+(n=n+Math.imul(m,rt)|0)|0)+((8191&(h=(h=h+Math.imul(m,nt)|0)+Math.imul(f,rt)|0))<<13)|0;a=((e=e+Math.imul(f,nt)|0)+(h>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(R,F),h=(h=Math.imul(R,U))+Math.imul(Z,F)|0,e=Math.imul(Z,U),n=n+Math.imul(x,D)|0,h=(h=h+Math.imul(x,H)|0)+Math.imul(q,D)|0,e=e+Math.imul(q,H)|0,n=n+Math.imul(k,G)|0,h=(h=h+Math.imul(k,Q)|0)+Math.imul(A,G)|0,e=e+Math.imul(A,Q)|0,n=n+Math.imul(y,W)|0,h=(h=h+Math.imul(y,X)|0)+Math.imul(b,W)|0,e=e+Math.imul(b,X)|0,n=n+Math.imul(g,$)|0,h=(h=h+Math.imul(g,tt)|0)+Math.imul(c,$)|0,e=e+Math.imul(c,tt)|0,n=n+Math.imul(p,rt)|0,h=(h=h+Math.imul(p,nt)|0)+Math.imul(M,rt)|0,e=e+Math.imul(M,nt)|0;var _t=(a+(n=n+Math.imul(m,et)|0)|0)+((8191&(h=(h=h+Math.imul(m,ot)|0)+Math.imul(f,et)|0))<<13)|0;a=((e=e+Math.imul(f,ot)|0)+(h>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(N,F),h=(h=Math.imul(N,U))+Math.imul(I,F)|0,e=Math.imul(I,U),n=n+Math.imul(R,D)|0,h=(h=h+Math.imul(R,H)|0)+Math.imul(Z,D)|0,e=e+Math.imul(Z,H)|0,n=n+Math.imul(x,G)|0,h=(h=h+Math.imul(x,Q)|0)+Math.imul(q,G)|0,e=e+Math.imul(q,Q)|0,n=n+Math.imul(k,W)|0,h=(h=h+Math.imul(k,X)|0)+Math.imul(A,W)|0,e=e+Math.imul(A,X)|0,n=n+Math.imul(y,$)|0,h=(h=h+Math.imul(y,tt)|0)+Math.imul(b,$)|0,e=e+Math.imul(b,tt)|0,n=n+Math.imul(g,rt)|0,h=(h=h+Math.imul(g,nt)|0)+Math.imul(c,rt)|0,e=e+Math.imul(c,nt)|0,n=n+Math.imul(p,et)|0,h=(h=h+Math.imul(p,ot)|0)+Math.imul(M,et)|0,e=e+Math.imul(M,ot)|0;var kt=(a+(n=n+Math.imul(m,ut)|0)|0)+((8191&(h=(h=h+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((e=e+Math.imul(f,at)|0)+(h>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(z,F),h=(h=Math.imul(z,U))+Math.imul(T,F)|0,e=Math.imul(T,U),n=n+Math.imul(N,D)|0,h=(h=h+Math.imul(N,H)|0)+Math.imul(I,D)|0,e=e+Math.imul(I,H)|0,n=n+Math.imul(R,G)|0,h=(h=h+Math.imul(R,Q)|0)+Math.imul(Z,G)|0,e=e+Math.imul(Z,Q)|0,n=n+Math.imul(x,W)|0,h=(h=h+Math.imul(x,X)|0)+Math.imul(q,W)|0,e=e+Math.imul(q,X)|0,n=n+Math.imul(k,$)|0,h=(h=h+Math.imul(k,tt)|0)+Math.imul(A,$)|0,e=e+Math.imul(A,tt)|0,n=n+Math.imul(y,rt)|0,h=(h=h+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,e=e+Math.imul(b,nt)|0,n=n+Math.imul(g,et)|0,h=(h=h+Math.imul(g,ot)|0)+Math.imul(c,et)|0,e=e+Math.imul(c,ot)|0,n=n+Math.imul(p,ut)|0,h=(h=h+Math.imul(p,at)|0)+Math.imul(M,ut)|0,e=e+Math.imul(M,at)|0;var At=(a+(n=n+Math.imul(m,mt)|0)|0)+((8191&(h=(h=h+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((e=e+Math.imul(f,ft)|0)+(h>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,F),h=(h=Math.imul(j,U))+Math.imul(K,F)|0,e=Math.imul(K,U),n=n+Math.imul(z,D)|0,h=(h=h+Math.imul(z,H)|0)+Math.imul(T,D)|0,e=e+Math.imul(T,H)|0,n=n+Math.imul(N,G)|0,h=(h=h+Math.imul(N,Q)|0)+Math.imul(I,G)|0,e=e+Math.imul(I,Q)|0,n=n+Math.imul(R,W)|0,h=(h=h+Math.imul(R,X)|0)+Math.imul(Z,W)|0,e=e+Math.imul(Z,X)|0,n=n+Math.imul(x,$)|0,h=(h=h+Math.imul(x,tt)|0)+Math.imul(q,$)|0,e=e+Math.imul(q,tt)|0,n=n+Math.imul(k,rt)|0,h=(h=h+Math.imul(k,nt)|0)+Math.imul(A,rt)|0,e=e+Math.imul(A,nt)|0,n=n+Math.imul(y,et)|0,h=(h=h+Math.imul(y,ot)|0)+Math.imul(b,et)|0,e=e+Math.imul(b,ot)|0,n=n+Math.imul(g,ut)|0,h=(h=h+Math.imul(g,at)|0)+Math.imul(c,ut)|0,e=e+Math.imul(c,at)|0,n=n+Math.imul(p,mt)|0,h=(h=h+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,e=e+Math.imul(M,ft)|0;var St=(a+(n=n+Math.imul(m,pt)|0)|0)+((8191&(h=(h=h+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((e=e+Math.imul(f,Mt)|0)+(h>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,D),h=(h=Math.imul(j,H))+Math.imul(K,D)|0,e=Math.imul(K,H),n=n+Math.imul(z,G)|0,h=(h=h+Math.imul(z,Q)|0)+Math.imul(T,G)|0,e=e+Math.imul(T,Q)|0,n=n+Math.imul(N,W)|0,h=(h=h+Math.imul(N,X)|0)+Math.imul(I,W)|0,e=e+Math.imul(I,X)|0,n=n+Math.imul(R,$)|0,h=(h=h+Math.imul(R,tt)|0)+Math.imul(Z,$)|0,e=e+Math.imul(Z,tt)|0,n=n+Math.imul(x,rt)|0,h=(h=h+Math.imul(x,nt)|0)+Math.imul(q,rt)|0,e=e+Math.imul(q,nt)|0,n=n+Math.imul(k,et)|0,h=(h=h+Math.imul(k,ot)|0)+Math.imul(A,et)|0,e=e+Math.imul(A,ot)|0,n=n+Math.imul(y,ut)|0,h=(h=h+Math.imul(y,at)|0)+Math.imul(b,ut)|0,e=e+Math.imul(b,at)|0,n=n+Math.imul(g,mt)|0,h=(h=h+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,e=e+Math.imul(c,ft)|0;var xt=(a+(n=n+Math.imul(p,pt)|0)|0)+((8191&(h=(h=h+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((e=e+Math.imul(M,Mt)|0)+(h>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,G),h=(h=Math.imul(j,Q))+Math.imul(K,G)|0,e=Math.imul(K,Q),n=n+Math.imul(z,W)|0,h=(h=h+Math.imul(z,X)|0)+Math.imul(T,W)|0,e=e+Math.imul(T,X)|0,n=n+Math.imul(N,$)|0,h=(h=h+Math.imul(N,tt)|0)+Math.imul(I,$)|0,e=e+Math.imul(I,tt)|0,n=n+Math.imul(R,rt)|0,h=(h=h+Math.imul(R,nt)|0)+Math.imul(Z,rt)|0,e=e+Math.imul(Z,nt)|0,n=n+Math.imul(x,et)|0,h=(h=h+Math.imul(x,ot)|0)+Math.imul(q,et)|0,e=e+Math.imul(q,ot)|0,n=n+Math.imul(k,ut)|0,h=(h=h+Math.imul(k,at)|0)+Math.imul(A,ut)|0,e=e+Math.imul(A,at)|0,n=n+Math.imul(y,mt)|0,h=(h=h+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,e=e+Math.imul(b,ft)|0;var qt=(a+(n=n+Math.imul(g,pt)|0)|0)+((8191&(h=(h=h+Math.imul(g,Mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((e=e+Math.imul(c,Mt)|0)+(h>>>13)|0)+(qt>>>26)|0,qt&=67108863,n=Math.imul(j,W),h=(h=Math.imul(j,X))+Math.imul(K,W)|0,e=Math.imul(K,X),n=n+Math.imul(z,$)|0,h=(h=h+Math.imul(z,tt)|0)+Math.imul(T,$)|0,e=e+Math.imul(T,tt)|0,n=n+Math.imul(N,rt)|0,h=(h=h+Math.imul(N,nt)|0)+Math.imul(I,rt)|0,e=e+Math.imul(I,nt)|0,n=n+Math.imul(R,et)|0,h=(h=h+Math.imul(R,ot)|0)+Math.imul(Z,et)|0,e=e+Math.imul(Z,ot)|0,n=n+Math.imul(x,ut)|0,h=(h=h+Math.imul(x,at)|0)+Math.imul(q,ut)|0,e=e+Math.imul(q,at)|0,n=n+Math.imul(k,mt)|0,h=(h=h+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,e=e+Math.imul(A,ft)|0;var Bt=(a+(n=n+Math.imul(y,pt)|0)|0)+((8191&(h=(h=h+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((e=e+Math.imul(b,Mt)|0)+(h>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,$),h=(h=Math.imul(j,tt))+Math.imul(K,$)|0,e=Math.imul(K,tt),n=n+Math.imul(z,rt)|0,h=(h=h+Math.imul(z,nt)|0)+Math.imul(T,rt)|0,e=e+Math.imul(T,nt)|0,n=n+Math.imul(N,et)|0,h=(h=h+Math.imul(N,ot)|0)+Math.imul(I,et)|0,e=e+Math.imul(I,ot)|0,n=n+Math.imul(R,ut)|0,h=(h=h+Math.imul(R,at)|0)+Math.imul(Z,ut)|0,e=e+Math.imul(Z,at)|0,n=n+Math.imul(x,mt)|0,h=(h=h+Math.imul(x,ft)|0)+Math.imul(q,mt)|0,e=e+Math.imul(q,ft)|0;var Rt=(a+(n=n+Math.imul(k,pt)|0)|0)+((8191&(h=(h=h+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((e=e+Math.imul(A,Mt)|0)+(h>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,rt),h=(h=Math.imul(j,nt))+Math.imul(K,rt)|0,e=Math.imul(K,nt),n=n+Math.imul(z,et)|0,h=(h=h+Math.imul(z,ot)|0)+Math.imul(T,et)|0,e=e+Math.imul(T,ot)|0,n=n+Math.imul(N,ut)|0,h=(h=h+Math.imul(N,at)|0)+Math.imul(I,ut)|0,e=e+Math.imul(I,at)|0,n=n+Math.imul(R,mt)|0,h=(h=h+Math.imul(R,ft)|0)+Math.imul(Z,mt)|0,e=e+Math.imul(Z,ft)|0;var Zt=(a+(n=n+Math.imul(x,pt)|0)|0)+((8191&(h=(h=h+Math.imul(x,Mt)|0)+Math.imul(q,pt)|0))<<13)|0;a=((e=e+Math.imul(q,Mt)|0)+(h>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,n=Math.imul(j,et),h=(h=Math.imul(j,ot))+Math.imul(K,et)|0,e=Math.imul(K,ot),n=n+Math.imul(z,ut)|0,h=(h=h+Math.imul(z,at)|0)+Math.imul(T,ut)|0,e=e+Math.imul(T,at)|0,n=n+Math.imul(N,mt)|0,h=(h=h+Math.imul(N,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Lt=(a+(n=n+Math.imul(R,pt)|0)|0)+((8191&(h=(h=h+Math.imul(R,Mt)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((e=e+Math.imul(Z,Mt)|0)+(h>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,ut),h=(h=Math.imul(j,at))+Math.imul(K,ut)|0,e=Math.imul(K,at),n=n+Math.imul(z,mt)|0,h=(h=h+Math.imul(z,ft)|0)+Math.imul(T,mt)|0,e=e+Math.imul(T,ft)|0;var Nt=(a+(n=n+Math.imul(N,pt)|0)|0)+((8191&(h=(h=h+Math.imul(N,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(h>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(j,mt),h=(h=Math.imul(j,ft))+Math.imul(K,mt)|0,e=Math.imul(K,ft);var It=(a+(n=n+Math.imul(z,pt)|0)|0)+((8191&(h=(h=h+Math.imul(z,Mt)|0)+Math.imul(T,pt)|0))<<13)|0;a=((e=e+Math.imul(T,Mt)|0)+(h>>>13)|0)+(It>>>26)|0,It&=67108863;var Et=(a+(n=Math.imul(j,pt))|0)+((8191&(h=(h=Math.imul(j,Mt))+Math.imul(K,pt)|0))<<13)|0;return a=((e=Math.imul(K,Mt))+(h>>>13)|0)+(Et>>>26)|0,Et&=67108863,u[0]=vt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=St,u[10]=xt,u[11]=qt,u[12]=Bt,u[13]=Rt,u[14]=Zt,u[15]=Lt,u[16]=Nt,u[17]=It,u[18]=Et,0!==a&&(u[19]=a,r.length++),r};function M(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var n=0,h=0,e=0;e>>26)|0)>>>26,o&=67108863}r.words[e]=s,n=o,o=h}return 0!==n?r.words[e]=n:r.length--,r._strip()}function v(t,i,r){return M(t,i,r)}function g(t,i){this.x=t,this.y=i}Math.imul||(p=d),h.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,i):r<63?d(this,t,i):r<1024?M(this,t,i):v(this,t,i)},g.prototype.makeRBT=function(t){for(var i=new Array(t),r=h.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,i,r,n,h,e){for(var o=0;o>>=1)h++;return 1<>>=13,n[2*o+1]=8191&e,e>>>=13;for(o=2*i;o>=26,n+=e/67108864|0,n+=o>>>26,this.words[h]=67108863&o}return 0!==n&&(this.words[h]=n,this.length++),i?this.ineg():this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r>>h&1}return i}(t);if(0===i.length)return new h(1);for(var r=this,n=0;n=0);var i,n=t%26,h=(t-n)/26,e=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(i=0;i>>26-n}o&&(this.words[i]=o,this.length++)}if(0!==h){for(i=this.length-1;i>=0;i--)this.words[i+h]=this.words[i];for(i=0;i=0),h=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<o)for(this.length-=o,a=0;a=0&&(0!==l||a>=h);a--){var m=0|this.words[a];this.words[a]=l<<26-e|m>>>e,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},h.prototype.ishrn=function(t,i,n){return r(0===this.negative),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,n=(t-i)/26,h=1<=0);var i=t%26,n=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==i&&n++,this.length=Math.min(n,this.length),0!==i){var h=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(u/67108864|0),this.words[h+n]=67108863&e}for(;h>26,this.words[h+n]=67108863&e;if(0===s)return this._strip();for(r(-1===s),s=0,h=0;h>26,this.words[h]=67108863&e;return this.negative=1,this._strip()},h.prototype._wordDiv=function(t,i){var r=(this.length,t.length),n=this.clone(),e=t,o=0|e.words[e.length-1];0!==(r=26-this._countBits(o))&&(e=e.ushln(r),n.iushln(r),o=0|e.words[e.length-1]);var s,u=n.length-e.length;if("mod"!==i){(s=new h(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a=0;m--){var f=67108864*(0|n.words[e.length+m])+(0|n.words[e.length+m-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(e,f,m);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(e,1,m),n.isZero()||(n.negative^=1);s&&(s.words[m]=f)}return s&&s._strip(),n._strip(),"div"!==i&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},h.prototype.divmod=function(t,i,n){return r(!t.isZero()),this.isZero()?{div:new h(0),mod:new h(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new h(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modrn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,n=t.ushrn(1),h=t.andln(1),e=r.cmp(n);return e<0||1===h&&0===e?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modrn=function(t){var i=t<0;i&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,h=0,e=this.length-1;e>=0;e--)h=(n*h+(0|this.words[e]))%t;return i?-h:h},h.prototype.modn=function(t){return this.modrn(t)},h.prototype.idivn=function(t){var i=t<0;i&&(t=-t),r(t<=67108863);for(var n=0,h=this.length-1;h>=0;h--){var e=(0|this.words[h])+67108864*n;this.words[h]=e/t|0,n=e%t}return this._strip(),i?this.ineg():this},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,n=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new h(1),o=new h(0),s=new h(0),u=new h(1),a=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++a;for(var l=n.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(m)),e.iushrn(1),o.iushrn(1);for(var p=0,M=1;0==(n.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(n)>=0?(i.isub(n),e.isub(s),o.isub(u)):(n.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:n.iushln(a)}},h.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,n=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new h(1),s=new h(0),u=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(n.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(n.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(n)>=0?(i.isub(n),o.isub(s)):(n.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var n=0;i.isEven()&&r.isEven();n++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var h=i.cmp(r);if(h<0){var e=i;i=r,r=e}else if(0===h||0===r.cmpn(1))break;i.isub(r)}return r.iushln(n)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,n=(t-i)/26,h=1<>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(t){var i,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var h=0|this.words[0];i=h===t?0:ht.length)return 1;if(this.length=0;r--){var n=0|this.words[r],h=0|t.words[r];if(n!==h){nh&&(i=1);break}}return i},h.prototype.gtn=function(t){return 1===this.cmpn(t)},h.prototype.gt=function(t){return 1===this.cmp(t)},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return-1===this.cmpn(t)},h.prototype.lt=function(t){return-1===this.cmp(t)},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return 0===this.cmpn(t)},h.prototype.eq=function(t){return 0===this.cmp(t)},h.red=function(t){return new A(t)},h.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var c={k256:null,p224:null,p192:null,p25519:null};function w(t,i){this.name=t,this.p=new h(i,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var i=h._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var n=i0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,i){t.iushrn(this.n,0,i)},w.prototype.imulK=function(t){return t.imul(this.k)},n(y,w),y.prototype.split=function(t,i){for(var r=Math.min(t.length,9),n=0;n>>22,h=e}h>>>=22,t.words[n-10]=h,0===h&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r>>=26,t.words[r]=h,i=n}return 0!==i&&(t.words[t.length++]=i),t},h._prime=function(t){if(c[t])return c[t];var i;if("k256"===t)i=new y;else if("p224"===t)i=new b;else if("p192"===t)i=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new k}return c[t]=i,i},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},A.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},A.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new h(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new h(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,e),f=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();r(v=0;n--){for(var a=i.words[n],l=u-1;l>=0;l--){var m=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===n&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},A.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},A.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new S(t)},n(S,A),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},S.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=r.isub(n).iushrn(this.shift),e=h;return h.cmp(this.m)>=0?e=h.isub(this.m):h.cmpn(0)<0&&(e=h.iadd(this.m)),e._forceRed(this)},S.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var r=t.mul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(n).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof module||module,this); -},{"buffer":43}],42:[function(require,module,exports){ +},{"buffer":57}],56:[function(require,module,exports){ var r;function Rand(t){this.rand=t}if(module.exports=function(t){return r||(r=new Rand(null)),r.generate(t)},module.exports.Rand=Rand,Rand.prototype.generate=function(t){return this._rand(t)},Rand.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var r=new Uint8Array(t),e=0;e>>24]^f[_>>>16&255]^a[I>>>8&255]^s[255&l]^e[X++],B=u[_>>>24]^f[I>>>16&255]^a[l>>>8&255]^s[255&y]^e[X++],c=u[I>>>24]^f[l>>>16&255]^a[y>>>8&255]^s[255&_]^e[X++],i=u[l>>>24]^f[y>>>16&255]^a[_>>>8&255]^s[255&I]^e[X++],y=S,_=B,I=c,l=i;return S=(n[y>>>24]<<24|n[_>>>16&255]<<16|n[I>>>8&255]<<8|n[255&l])^e[X++],B=(n[_>>>24]<<24|n[I>>>16&255]<<16|n[l>>>8&255]<<8|n[255&y])^e[X++],c=(n[I>>>24]<<24|n[l>>>16&255]<<16|n[y>>>8&255]<<8|n[255&_])^e[X++],i=(n[l>>>24]<<24|n[y>>>16&255]<<16|n[_>>>8&255]<<8|n[255&I])^e[X++],[S>>>=0,B>>>=0,c>>>=0,i>>>=0]}var RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var r=new Array(256),e=0;e<256;e++)r[e]=e<128?e<<1:e<<1^283;for(var t=[],n=[],o=[[],[],[],[]],S=[[],[],[],[]],B=0,c=0,i=0;i<256;++i){var u=c^c<<1^c<<2^c<<3^c<<4;u=u>>>8^255&u^99,t[B]=u,n[u]=B;var f=r[B],a=r[f],s=r[a],y=257*r[u]^16843008*u;o[0][B]=y<<24|y>>>8,o[1][B]=y<<16|y>>>16,o[2][B]=y<<8|y>>>24,o[3][B]=y,y=16843009*s^65537*a^257*f^16843008*B,S[0][u]=y<<24|y>>>8,S[1][u]=y<<16|y>>>16,S[2][u]=y<<8|y>>>24,S[3][u]=y,0===B?B=c=1:(B=f^r[r[r[s^f]]],c^=r[r[c]])}return{SBOX:t,INV_SBOX:n,SUB_MIX:o,INV_SUB_MIX:S}}();function AES(r){this._key=asUInt32Array(r),this._reset()}AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var r=this._key,e=r.length,t=e+6,n=4*(t+1),o=[],S=0;S>>24,B=G.SBOX[B>>>24]<<24|G.SBOX[B>>>16&255]<<16|G.SBOX[B>>>8&255]<<8|G.SBOX[255&B],B^=RCON[S/e|0]<<24):e>6&&S%e==4&&(B=G.SBOX[B>>>24]<<24|G.SBOX[B>>>16&255]<<16|G.SBOX[B>>>8&255]<<8|G.SBOX[255&B]),o[S]=o[S-e]^B}for(var c=[],i=0;i>>24]]^G.INV_SUB_MIX[1][G.SBOX[f>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[f>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[255&f]]}this._nRounds=t,this._keySchedule=o,this._invKeySchedule=c},AES.prototype.encryptBlockRaw=function(r){return cryptBlock(r=asUInt32Array(r),this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(r){var e=this.encryptBlockRaw(r),t=Buffer.allocUnsafe(16);return t.writeUInt32BE(e[0],0),t.writeUInt32BE(e[1],4),t.writeUInt32BE(e[2],8),t.writeUInt32BE(e[3],12),t},AES.prototype.decryptBlock=function(r){var e=(r=asUInt32Array(r))[1];r[1]=r[3],r[3]=e;var t=cryptBlock(r,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),n=Buffer.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[3],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[1],12),n},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},module.exports.AES=AES; -},{"safe-buffer":446}],45:[function(require,module,exports){ +},{"safe-buffer":511}],59:[function(require,module,exports){ var aes=require("./aes"),Buffer=require("safe-buffer").Buffer,Transform=require("cipher-base"),inherits=require("inherits"),GHASH=require("./ghash"),xor=require("buffer-xor"),incr32=require("./incr32");function xorTest(t,e){var r=0;t.length!==e.length&&r++;for(var a=Math.min(t.length,e.length),i=0;i16)throw new Error("unable to decrypt data");for(var t=-1;++t16)return r=this.cache.slice(0,16),this.cache=this.cache.slice(16),r}else if(this.cache.length>=16)return r=this.cache.slice(0,16),this.cache=this.cache.slice(16),r;return null},Splitter.prototype.flush=function(){if(this.cache.length)return this.cache},exports.createDecipher=createDecipher,exports.createDecipheriv=createDecipheriv; -},{"./aes":44,"./authCipher":45,"./modes":57,"./streamCipher":60,"cipher-base":96,"evp_bytestokey":150,"inherits":195,"safe-buffer":446}],48:[function(require,module,exports){ +},{"./aes":58,"./authCipher":59,"./modes":71,"./streamCipher":74,"cipher-base":109,"evp_bytestokey":173,"inherits":225,"safe-buffer":511}],62:[function(require,module,exports){ var MODES=require("./modes"),AuthCipher=require("./authCipher"),Buffer=require("safe-buffer").Buffer,StreamCipher=require("./streamCipher"),Transform=require("cipher-base"),aes=require("./aes"),ebtk=require("evp_bytestokey"),inherits=require("inherits");function Cipher(e,r,t){Transform.call(this),this._cache=new Splitter,this._cipher=new aes.AES(r),this._prev=Buffer.from(t),this._mode=e,this._autopadding=!0}inherits(Cipher,Transform),Cipher.prototype._update=function(e){var r,t;this._cache.add(e);for(var i=[];r=this._cache.get();)t=this._mode.encrypt(this,r),i.push(t);return Buffer.concat(i)};var PADDING=Buffer.alloc(16,16);function Splitter(){this.cache=Buffer.allocUnsafe(0)}function createCipheriv(e,r,t){var i=MODES[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=Buffer.from(r)),r.length!==i.key/8)throw new TypeError("invalid key length "+r.length);if("string"==typeof t&&(t=Buffer.from(t)),"GCM"!==i.mode&&t.length!==i.iv)throw new TypeError("invalid iv length "+t.length);return"stream"===i.type?new StreamCipher(i.module,r,t):"auth"===i.type?new AuthCipher(i.module,r,t):new Cipher(i.module,r,t)}function createCipher(e,r){var t=MODES[e.toLowerCase()];if(!t)throw new TypeError("invalid suite type");var i=ebtk(r,!1,t.key,t.iv);return createCipheriv(e,i.key,i.iv)}Cipher.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")},Cipher.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},Splitter.prototype.add=function(e){this.cache=Buffer.concat([this.cache,e])},Splitter.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},Splitter.prototype.flush=function(){for(var e=16-this.cache.length,r=Buffer.allocUnsafe(e),t=-1;++t>>0,0),r.writeUInt32BE(t[1]>>>0,4),r.writeUInt32BE(t[2]>>>0,8),r.writeUInt32BE(t[3]>>>0,12),r}function GHASH(t){this.h=t,this.state=Buffer.alloc(16,0),this.cache=Buffer.allocUnsafe(0)}GHASH.prototype.ghash=function(t){for(var r=-1;++r0;t--)e[t]=e[t]>>>1|(1&e[t-1])<<31;e[0]=e[0]>>>1,r&&(e[0]=e[0]^225<<24)}this.state=fromArray(a)},GHASH.prototype.update=function(t){var r;for(this.cache=Buffer.concat([this.cache,t]);this.cache.length>=16;)r=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(r)},GHASH.prototype.final=function(t,r){return this.cache.length&&this.ghash(Buffer.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,t,0,r])),this.state},module.exports=GHASH; -},{"safe-buffer":446}],50:[function(require,module,exports){ +},{"safe-buffer":511}],64:[function(require,module,exports){ function incr32(r){for(var n,t=r.length;t--;){if(255!==(n=r.readUInt8(t))){n++,r.writeUInt8(n,t);break}r.writeUInt8(0,t)}}module.exports=incr32; -},{}],51:[function(require,module,exports){ +},{}],65:[function(require,module,exports){ var xor=require("buffer-xor");exports.encrypt=function(r,e){var p=xor(e,r._prev);return r._prev=r._cipher.encryptBlock(p),r._prev},exports.decrypt=function(r,e){var p=r._prev;r._prev=e;var c=r._cipher.decryptBlock(e);return xor(c,p)}; -},{"buffer-xor":93}],52:[function(require,module,exports){ +},{"buffer-xor":106}],66:[function(require,module,exports){ var Buffer=require("safe-buffer").Buffer,xor=require("buffer-xor");function encryptStart(e,r,c){var f=r.length,t=xor(r,e._cache);return e._cache=e._cache.slice(f),e._prev=Buffer.concat([e._prev,c?r:t]),t}exports.encrypt=function(e,r,c){for(var f,t=Buffer.allocUnsafe(0);r.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=Buffer.allocUnsafe(0)),!(e._cache.length<=r.length)){t=Buffer.concat([t,encryptStart(e,r,c)]);break}f=e._cache.length,t=Buffer.concat([t,encryptStart(e,r.slice(0,f),c)]),r=r.slice(f)}return t}; -},{"buffer-xor":93,"safe-buffer":446}],53:[function(require,module,exports){ +},{"buffer-xor":106,"safe-buffer":511}],67:[function(require,module,exports){ var Buffer=require("safe-buffer").Buffer;function encryptByte(r,e,f){for(var n,t,u=-1,c=0;++u<8;)n=e&1<<7-u?128:0,c+=(128&(t=r._cipher.encryptBlock(r._prev)[0]^n))>>u%8,r._prev=shiftIn(r._prev,f?n:t);return c}function shiftIn(r,e){var f=r.length,n=-1,t=Buffer.allocUnsafe(r.length);for(r=Buffer.concat([r,Buffer.from([e])]);++n>7;return t}exports.encrypt=function(r,e,f){for(var n=e.length,t=Buffer.allocUnsafe(n),u=-1;++u=0||!r.umod(e.prime1)||!r.umod(e.prime2);)r=new bn(randomBytes(n));return r}module.exports=crt,crt.getr=getr; - -}).call(this,require("buffer").Buffer) -},{"bn.js":65,"buffer":88,"randombytes":428}],65:[function(require,module,exports){ -!function(t,i){"use strict";function r(t,i){if(!t)throw new Error(i||"Assertion failed")}function h(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,i,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var e;"object"==typeof t?t.exports=n:i.BN=n,n.BN=n,n.wordSize=26;try{e=require("buffer").Buffer}catch(t){}function o(t,i,r){for(var h=0,n=Math.min(t.length,r),e=i;e=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return h}function s(t,i,r,h){for(var n=0,e=Math.min(t.length,r),o=i;o=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,i){return t.cmp(i)>0?t:i},n.min=function(t,i){return t.cmp(i)<0?t:i},n.prototype._init=function(t,i,h){if("number"==typeof t)return this._initNumber(t,i,h);if("object"==typeof t)return this._initArray(t,i,h);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===i?this._parseHex(t,n):this._parseBase(t,i,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initNumber=function(t,i,h){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initArray=function(t,i,h){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[e]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===h)for(n=0,e=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this.strip()},n.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r=i;r-=6)n=o(t,r,r+6),this.words[h]|=n<>>26-e&4194303,(e+=24)>=26&&(e-=26,h++);r+6!==i&&(n=o(t,i,r+6),this.words[h]|=n<>>26-e&4194303),this.strip()},n.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var h=0,n=1;n<=67108863;n*=i)h++;h--,n=n/i|0;for(var e=t.length-r,o=e%h,u=Math.min(e,e-o)+r,a=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],a=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,i,r){r.negative=i.negative^t.negative;var h=t.length+i.length|0;r.length=h,h=h-1|0;var n=0|t.words[0],e=0|i.words[0],o=n*e,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(n=0|t.words[p])*(e=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,i){var h;if(i=0|i||1,16===(t=t||10)||"hex"===t){h="";for(var n=0,e=0,o=0;o>>24-n&16777215)||o!==this.length-1?u[6-m.length]+m+h:m+h,(n+=2)>=26&&(n-=26,o--)}for(0!==e&&(h=e.toString(16)+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}if(t===(0|t)&&t>=2&&t<=36){var f=a[t],d=l[t];h="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modn(d).toString(t);h=(p=p.idivn(d)).isZero()?M+h:u[f-M.length]+M+h}for(this.isZero()&&(h="0"+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,i){return r(void 0!==e),this.toArrayLike(e,t,i)},n.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},n.prototype.toArrayLike=function(t,i,h){var n=this.byteLength(),e=h||Math.max(1,n);r(n<=e,"byte array longer than desired length"),r(e>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===i,a=new t(e),l=this.clone();if(u){for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[s]=o;for(;s=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},n.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var h=0;ht.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),h=t%26;this._expand(i),h>0&&i--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-h),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var h=t/26|0,n=t%26;return this._expand(h+1),this.words[h]=i?this.words[h]|1<t.length?(r=this,h=t):(r=t,h=this);for(var n=0,e=0;e>>26;for(;0!==n&&e>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;et.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,h,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,h=t):(r=t,h=this);for(var e=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==e&&o>26,this.words[o]=67108863&i;if(0===e&&o>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],g=8191&v,c=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,x=0|o[5],S=8191&x,Z=x>>>13,q=0|o[6],R=8191&q,B=q>>>13,N=0|o[7],L=8191&N,I=N>>>13,z=0|o[8],T=8191&z,E=z>>>13,O=0|o[9],j=8191&O,K=O>>>13,P=0|s[0],F=8191&P,C=P>>>13,D=0|s[1],H=8191&D,J=D>>>13,U=0|s[2],G=8191&U,Q=U>>>13,V=0|s[3],W=8191&V,X=V>>>13,Y=0|s[4],$=8191&Y,tt=Y>>>13,it=0|s[5],rt=8191&it,ht=it>>>13,nt=0|s[6],et=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(h=Math.imul(m,F))|0)+((8191&(n=(n=Math.imul(m,C))+Math.imul(f,F)|0))<<13)|0;a=((e=Math.imul(f,C))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,h=Math.imul(p,F),n=(n=Math.imul(p,C))+Math.imul(M,F)|0,e=Math.imul(M,C);var gt=(a+(h=h+Math.imul(m,H)|0)|0)+((8191&(n=(n=n+Math.imul(m,J)|0)+Math.imul(f,H)|0))<<13)|0;a=((e=e+Math.imul(f,J)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,h=Math.imul(g,F),n=(n=Math.imul(g,C))+Math.imul(c,F)|0,e=Math.imul(c,C),h=h+Math.imul(p,H)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(M,H)|0,e=e+Math.imul(M,J)|0;var ct=(a+(h=h+Math.imul(m,G)|0)|0)+((8191&(n=(n=n+Math.imul(m,Q)|0)+Math.imul(f,G)|0))<<13)|0;a=((e=e+Math.imul(f,Q)|0)+(n>>>13)|0)+(ct>>>26)|0,ct&=67108863,h=Math.imul(y,F),n=(n=Math.imul(y,C))+Math.imul(b,F)|0,e=Math.imul(b,C),h=h+Math.imul(g,H)|0,n=(n=n+Math.imul(g,J)|0)+Math.imul(c,H)|0,e=e+Math.imul(c,J)|0,h=h+Math.imul(p,G)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(M,G)|0,e=e+Math.imul(M,Q)|0;var wt=(a+(h=h+Math.imul(m,W)|0)|0)+((8191&(n=(n=n+Math.imul(m,X)|0)+Math.imul(f,W)|0))<<13)|0;a=((e=e+Math.imul(f,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,h=Math.imul(k,F),n=(n=Math.imul(k,C))+Math.imul(A,F)|0,e=Math.imul(A,C),h=h+Math.imul(y,H)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,H)|0,e=e+Math.imul(b,J)|0,h=h+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Q)|0)+Math.imul(c,G)|0,e=e+Math.imul(c,Q)|0,h=h+Math.imul(p,W)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(M,W)|0,e=e+Math.imul(M,X)|0;var yt=(a+(h=h+Math.imul(m,$)|0)|0)+((8191&(n=(n=n+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((e=e+Math.imul(f,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,h=Math.imul(S,F),n=(n=Math.imul(S,C))+Math.imul(Z,F)|0,e=Math.imul(Z,C),h=h+Math.imul(k,H)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,H)|0,e=e+Math.imul(A,J)|0,h=h+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,G)|0,e=e+Math.imul(b,Q)|0,h=h+Math.imul(g,W)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(c,W)|0,e=e+Math.imul(c,X)|0,h=h+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(M,$)|0,e=e+Math.imul(M,tt)|0;var bt=(a+(h=h+Math.imul(m,rt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ht)|0)+Math.imul(f,rt)|0))<<13)|0;a=((e=e+Math.imul(f,ht)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,h=Math.imul(R,F),n=(n=Math.imul(R,C))+Math.imul(B,F)|0,e=Math.imul(B,C),h=h+Math.imul(S,H)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(Z,H)|0,e=e+Math.imul(Z,J)|0,h=h+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Q)|0)+Math.imul(A,G)|0,e=e+Math.imul(A,Q)|0,h=h+Math.imul(y,W)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(b,W)|0,e=e+Math.imul(b,X)|0,h=h+Math.imul(g,$)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(c,$)|0,e=e+Math.imul(c,tt)|0,h=h+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(M,rt)|0,e=e+Math.imul(M,ht)|0;var _t=(a+(h=h+Math.imul(m,et)|0)|0)+((8191&(n=(n=n+Math.imul(m,ot)|0)+Math.imul(f,et)|0))<<13)|0;a=((e=e+Math.imul(f,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,h=Math.imul(L,F),n=(n=Math.imul(L,C))+Math.imul(I,F)|0,e=Math.imul(I,C),h=h+Math.imul(R,H)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,H)|0,e=e+Math.imul(B,J)|0,h=h+Math.imul(S,G)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(Z,G)|0,e=e+Math.imul(Z,Q)|0,h=h+Math.imul(k,W)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(A,W)|0,e=e+Math.imul(A,X)|0,h=h+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|0,e=e+Math.imul(b,tt)|0,h=h+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(c,rt)|0,e=e+Math.imul(c,ht)|0,h=h+Math.imul(p,et)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(M,et)|0,e=e+Math.imul(M,ot)|0;var kt=(a+(h=h+Math.imul(m,ut)|0)|0)+((8191&(n=(n=n+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((e=e+Math.imul(f,at)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,h=Math.imul(T,F),n=(n=Math.imul(T,C))+Math.imul(E,F)|0,e=Math.imul(E,C),h=h+Math.imul(L,H)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(I,H)|0,e=e+Math.imul(I,J)|0,h=h+Math.imul(R,G)|0,n=(n=n+Math.imul(R,Q)|0)+Math.imul(B,G)|0,e=e+Math.imul(B,Q)|0,h=h+Math.imul(S,W)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(Z,W)|0,e=e+Math.imul(Z,X)|0,h=h+Math.imul(k,$)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,$)|0,e=e+Math.imul(A,tt)|0,h=h+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(b,rt)|0,e=e+Math.imul(b,ht)|0,h=h+Math.imul(g,et)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(c,et)|0,e=e+Math.imul(c,ot)|0,h=h+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(M,ut)|0,e=e+Math.imul(M,at)|0;var At=(a+(h=h+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((e=e+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,h=Math.imul(j,F),n=(n=Math.imul(j,C))+Math.imul(K,F)|0,e=Math.imul(K,C),h=h+Math.imul(T,H)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(E,H)|0,e=e+Math.imul(E,J)|0,h=h+Math.imul(L,G)|0,n=(n=n+Math.imul(L,Q)|0)+Math.imul(I,G)|0,e=e+Math.imul(I,Q)|0,h=h+Math.imul(R,W)|0,n=(n=n+Math.imul(R,X)|0)+Math.imul(B,W)|0,e=e+Math.imul(B,X)|0,h=h+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(Z,$)|0,e=e+Math.imul(Z,tt)|0,h=h+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,rt)|0,e=e+Math.imul(A,ht)|0,h=h+Math.imul(y,et)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,et)|0,e=e+Math.imul(b,ot)|0,h=h+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(c,ut)|0,e=e+Math.imul(c,at)|0,h=h+Math.imul(p,mt)|0,n=(n=n+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,e=e+Math.imul(M,ft)|0;var xt=(a+(h=h+Math.imul(m,pt)|0)|0)+((8191&(n=(n=n+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((e=e+Math.imul(f,Mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h=Math.imul(j,H),n=(n=Math.imul(j,J))+Math.imul(K,H)|0,e=Math.imul(K,J),h=h+Math.imul(T,G)|0,n=(n=n+Math.imul(T,Q)|0)+Math.imul(E,G)|0,e=e+Math.imul(E,Q)|0,h=h+Math.imul(L,W)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(I,W)|0,e=e+Math.imul(I,X)|0,h=h+Math.imul(R,$)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(B,$)|0,e=e+Math.imul(B,tt)|0,h=h+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(Z,rt)|0,e=e+Math.imul(Z,ht)|0,h=h+Math.imul(k,et)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(A,et)|0,e=e+Math.imul(A,ot)|0,h=h+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,e=e+Math.imul(b,at)|0,h=h+Math.imul(g,mt)|0,n=(n=n+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,e=e+Math.imul(c,ft)|0;var St=(a+(h=h+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((e=e+Math.imul(M,Mt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,h=Math.imul(j,G),n=(n=Math.imul(j,Q))+Math.imul(K,G)|0,e=Math.imul(K,Q),h=h+Math.imul(T,W)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(E,W)|0,e=e+Math.imul(E,X)|0,h=h+Math.imul(L,$)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(I,$)|0,e=e+Math.imul(I,tt)|0,h=h+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(B,rt)|0,e=e+Math.imul(B,ht)|0,h=h+Math.imul(S,et)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(Z,et)|0,e=e+Math.imul(Z,ot)|0,h=h+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ut)|0,e=e+Math.imul(A,at)|0,h=h+Math.imul(y,mt)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,e=e+Math.imul(b,ft)|0;var Zt=(a+(h=h+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,Mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((e=e+Math.imul(c,Mt)|0)+(n>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,h=Math.imul(j,W),n=(n=Math.imul(j,X))+Math.imul(K,W)|0,e=Math.imul(K,X),h=h+Math.imul(T,$)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(E,$)|0,e=e+Math.imul(E,tt)|0,h=h+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(I,rt)|0,e=e+Math.imul(I,ht)|0,h=h+Math.imul(R,et)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(B,et)|0,e=e+Math.imul(B,ot)|0,h=h+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul(Z,ut)|0,e=e+Math.imul(Z,at)|0,h=h+Math.imul(k,mt)|0,n=(n=n+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,e=e+Math.imul(A,ft)|0;var qt=(a+(h=h+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((e=e+Math.imul(b,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,h=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(K,$)|0,e=Math.imul(K,tt),h=h+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(E,rt)|0,e=e+Math.imul(E,ht)|0,h=h+Math.imul(L,et)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(I,et)|0,e=e+Math.imul(I,ot)|0,h=h+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(B,ut)|0,e=e+Math.imul(B,at)|0,h=h+Math.imul(S,mt)|0,n=(n=n+Math.imul(S,ft)|0)+Math.imul(Z,mt)|0,e=e+Math.imul(Z,ft)|0;var Rt=(a+(h=h+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((e=e+Math.imul(A,Mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,h=Math.imul(j,rt),n=(n=Math.imul(j,ht))+Math.imul(K,rt)|0,e=Math.imul(K,ht),h=h+Math.imul(T,et)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(E,et)|0,e=e+Math.imul(E,ot)|0,h=h+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,at)|0)+Math.imul(I,ut)|0,e=e+Math.imul(I,at)|0,h=h+Math.imul(R,mt)|0,n=(n=n+Math.imul(R,ft)|0)+Math.imul(B,mt)|0,e=e+Math.imul(B,ft)|0;var Bt=(a+(h=h+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,Mt)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((e=e+Math.imul(Z,Mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,h=Math.imul(j,et),n=(n=Math.imul(j,ot))+Math.imul(K,et)|0,e=Math.imul(K,ot),h=h+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(E,ut)|0,e=e+Math.imul(E,at)|0,h=h+Math.imul(L,mt)|0,n=(n=n+Math.imul(L,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Nt=(a+(h=h+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,Mt)|0)+Math.imul(B,pt)|0))<<13)|0;a=((e=e+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h=Math.imul(j,ut),n=(n=Math.imul(j,at))+Math.imul(K,ut)|0,e=Math.imul(K,at),h=h+Math.imul(T,mt)|0,n=(n=n+Math.imul(T,ft)|0)+Math.imul(E,mt)|0,e=e+Math.imul(E,ft)|0;var Lt=(a+(h=h+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h=Math.imul(j,mt),n=(n=Math.imul(j,ft))+Math.imul(K,mt)|0,e=Math.imul(K,ft);var It=(a+(h=h+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,Mt)|0)+Math.imul(E,pt)|0))<<13)|0;a=((e=e+Math.imul(E,Mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var zt=(a+(h=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(K,pt)|0))<<13)|0;return a=((e=Math.imul(K,Mt))+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863,u[0]=vt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=xt,u[10]=St,u[11]=Zt,u[12]=qt,u[13]=Rt,u[14]=Bt,u[15]=Nt,u[16]=Lt,u[17]=It,u[18]=zt,0!==a&&(u[19]=a,r.length++),r};function d(t,i,r){return(new p).mulp(t,i,r)}function p(t,i){this.x=t,this.y=i}Math.imul||(f=m),n.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,i):r<63?m(this,t,i):r<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var h=0,n=0,e=0;e>>26)|0)>>>26,o&=67108863}r.words[e]=s,h=o,o=n}return 0!==h?r.words[e]=h:r.length--,r.strip()}(this,t,i):d(this,t,i)},p.prototype.makeRBT=function(t){for(var i=new Array(t),r=n.prototype._countBits(t)-1,h=0;h>=1;return h},p.prototype.permute=function(t,i,r,h,n,e){for(var o=0;o>>=1)n++;return 1<>>=13,h[2*o+1]=8191&e,e>>>=13;for(o=2*i;o>=26,i+=n/67108864|0,i+=e>>>26,this.words[h]=67108863&e}return 0!==i&&(this.words[h]=i,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r>>n}return i}(t);if(0===i.length)return new n(1);for(var r=this,h=0;h=0);var i,h=t%26,n=(t-h)/26,e=67108863>>>26-h<<26-h;if(0!==h){var o=0;for(i=0;i>>26-h}o&&(this.words[i]=o,this.length++)}if(0!==n){for(i=this.length-1;i>=0;i--)this.words[i+n]=this.words[i];for(i=0;i=0),n=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<o)for(this.length-=o,a=0;a=0&&(0!==l||a>=n);a--){var m=0|this.words[a];this.words[a]=l<<26-e|m>>>e,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,i,h){return r(0===this.negative),this.iushrn(t,i,h)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,h=(t-i)/26,n=1<=0);var i=t%26,h=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=h)return this;if(0!==i&&h++,this.length=Math.min(h,this.length),0!==i){var n=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(u/67108864|0),this.words[n+h]=67108863&e}for(;n>26,this.words[n+h]=67108863&e;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n>26,this.words[n]=67108863&e;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,i){var r=(this.length,t.length),h=this.clone(),e=t,o=0|e.words[e.length-1];0!==(r=26-this._countBits(o))&&(e=e.ushln(r),h.iushln(r),o=0|e.words[e.length-1]);var s,u=h.length-e.length;if("mod"!==i){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a=0;m--){var f=67108864*(0|h.words[e.length+m])+(0|h.words[e.length+m-1]);for(f=Math.min(f/o|0,67108863),h._ishlnsubmul(e,f,m);0!==h.negative;)f--,h.negative=0,h._ishlnsubmul(e,1,m),h.isZero()||(h.negative^=1);s&&(s.words[m]=f)}return s&&s.strip(),h.strip(),"div"!==i&&0!==r&&h.iushrn(r),{div:s||null,mod:h}},n.prototype.divmod=function(t,i,h){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,h=t.ushrn(1),n=t.andln(1),e=r.cmp(h);return e<0||1===n&&0===e?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var i=(1<<26)%t,h=0,n=this.length-1;n>=0;n--)h=(i*h+(0|this.words[n]))%t;return h},n.prototype.idivn=function(t){r(t<=67108863);for(var i=0,h=this.length-1;h>=0;h--){var n=(0|this.words[h])+67108864*i;this.words[h]=n/t|0,i=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new n(1),o=new n(0),s=new n(0),u=new n(1),a=0;i.isEven()&&h.isEven();)i.iushrn(1),h.iushrn(1),++a;for(var l=h.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(m)),e.iushrn(1),o.iushrn(1);for(var p=0,M=1;0==(h.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(h.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(h)>=0?(i.isub(h),e.isub(s),o.isub(u)):(h.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:h.iushln(a)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new n(1),s=new n(0),u=h.clone();i.cmpn(1)>0&&h.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(h.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(h.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(h)>=0?(i.isub(h),o.isub(s)):(h.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var h=0;i.isEven()&&r.isEven();h++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=i.cmp(r);if(n<0){var e=i;i=r,r=e}else if(0===n||0===r.cmpn(1))break;i.isub(r)}return r.iushln(h)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,h=(t-i)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var i,h=t<0;if(0!==this.negative&&!h)return-1;if(0===this.negative&&h)return 1;if(this.strip(),this.length>1)i=1;else{h&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:nt.length)return 1;if(this.length=0;r--){var h=0|this.words[r],n=0|t.words[r];if(h!==n){hn&&(i=1);break}}return i},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new b(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};function v(t,i){this.name=t,this.p=new n(i,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function c(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function b(t){if("string"==typeof t){var i=n._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){b.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var h=i0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,i){t.iushrn(this.n,0,i)},v.prototype.imulK=function(t){return t.imul(this.k)},h(g,v),g.prototype.split=function(t,i){for(var r=Math.min(t.length,9),h=0;h>>22,n=e}n>>>=22,t.words[h-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r>>=26,t.words[r]=n,i=h}return 0!==i&&(t.words[t.length++]=i),t},n._prime=function(t){if(M[t])return M[t];var i;if("k256"===t)i=new g;else if("p224"===t)i=new c;else if("p192"===t)i=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new y}return M[t]=i,i},b.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},b.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},b.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},b.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},b.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},b.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},b.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},b.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},b.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},b.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},b.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},b.prototype.isqr=function(t){return this.imul(t,t.clone())},b.prototype.sqr=function(t){return this.mul(t,t)},b.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var h=this.m.add(new n(1)).iushrn(2);return this.pow(t,h)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new n(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,e),f=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();r(v=0;h--){for(var a=i.words[h],l=u-1;l>=0;l--){var m=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===h&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},b.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},b.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},n.mont=function(t){return new _(t)},h(_,b),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},_.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(h).iushrn(this.shift),e=n;return n.cmp(this.m)>=0?e=n.isub(this.m):n.cmpn(0)<0&&(e=n.iadd(this.m)),e._forceRed(this)},_.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new n(0)._forceRed(this);var r=t.mul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(h).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof module||module,this); +},{}],78:[function(require,module,exports){ +(function (Buffer){(function (){ +var BN=require("bn.js"),randomBytes=require("randombytes");function blind(e){var r=getr(e);return{blinder:r.toRed(BN.mont(e.modulus)).redPow(new BN(e.publicExponent)).fromRed(),unblinder:r.invm(e.modulus)}}function getr(e){var r,o=e.modulus.byteLength();do{r=new BN(randomBytes(o))}while(r.cmp(e.modulus)>=0||!r.umod(e.prime1)||!r.umod(e.prime2));return r}function crt(e,r){var o=blind(r),n=r.modulus.byteLength(),u=new BN(e).mul(o.blinder).umod(r.modulus),d=u.toRed(BN.mont(r.prime1)),m=u.toRed(BN.mont(r.prime2)),t=r.coefficient,i=r.prime1,l=r.prime2,b=d.redPow(r.exponent1).fromRed(),s=m.redPow(r.exponent2).fromRed(),p=b.isub(s).imul(t).umod(i).imul(l);return s.iadd(p).imul(o.unblinder).umod(r.modulus).toArrayLike(Buffer,"be",n)}crt.getr=getr,module.exports=crt; -},{"buffer":43}],66:[function(require,module,exports){ +}).call(this)}).call(this,require("buffer").Buffer) +},{"bn.js":55,"buffer":101,"randombytes":507}],79:[function(require,module,exports){ module.exports=require("./browser/algorithms.json"); -},{"./browser/algorithms.json":67}],67:[function(require,module,exports){ +},{"./browser/algorithms.json":80}],80:[function(require,module,exports){ module.exports={ "sha224WithRSAEncryption": { "sign": "rsa", @@ -561,7 +608,7 @@ module.exports={ } } -},{}],68:[function(require,module,exports){ +},{}],81:[function(require,module,exports){ module.exports={ "1.3.132.0.10": "secp256k1", "1.3.132.0.33": "p224", @@ -571,414 +618,204 @@ module.exports={ "1.3.132.0.35": "p521" } -},{}],69:[function(require,module,exports){ +},{}],82:[function(require,module,exports){ var Buffer=require("safe-buffer").Buffer,createHash=require("create-hash"),stream=require("readable-stream"),inherits=require("inherits"),sign=require("./sign"),verify=require("./verify"),algorithms=require("./algorithms.json");function Sign(e){stream.Writable.call(this);var t=algorithms[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=createHash(t.hash),this._tag=t.id,this._signType=t.sign}function Verify(e){stream.Writable.call(this);var t=algorithms[e];if(!t)throw new Error("Unknown message digest");this._hash=createHash(t.hash),this._tag=t.id,this._signType=t.sign}function createSign(e){return new Sign(e)}function createVerify(e){return new Verify(e)}Object.keys(algorithms).forEach(function(e){algorithms[e].id=Buffer.from(algorithms[e].id,"hex"),algorithms[e.toLowerCase()]=algorithms[e]}),inherits(Sign,stream.Writable),Sign.prototype._write=function(e,t,r){this._hash.update(e),r()},Sign.prototype.update=function(e,t){return"string"==typeof e&&(e=Buffer.from(e,t)),this._hash.update(e),this},Sign.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),i=sign(r,e,this._hashType,this._signType,this._tag);return t?i.toString(t):i},inherits(Verify,stream.Writable),Verify.prototype._write=function(e,t,r){this._hash.update(e),r()},Verify.prototype.update=function(e,t){return"string"==typeof e&&(e=Buffer.from(e,t)),this._hash.update(e),this},Verify.prototype.verify=function(e,t,r){"string"==typeof t&&(t=Buffer.from(t,r)),this.end();var i=this._hash.digest();return verify(t,i,e,this._signType,this._tag)},module.exports={Sign:createSign,Verify:createVerify,createSign:createSign,createVerify:createVerify}; -},{"./algorithms.json":67,"./sign":70,"./verify":71,"create-hash":101,"inherits":195,"readable-stream":86,"safe-buffer":446}],70:[function(require,module,exports){ +},{"./algorithms.json":80,"./sign":83,"./verify":84,"create-hash":112,"inherits":225,"readable-stream":99,"safe-buffer":511}],83:[function(require,module,exports){ var Buffer=require("safe-buffer").Buffer,createHmac=require("create-hmac"),crt=require("browserify-rsa"),EC=require("elliptic").ec,BN=require("bn.js"),parseKeys=require("parse-asn1"),curves=require("./curves.json");function sign(e,r,t,a,n){var u=parseKeys(r);if(u.curve){if("ecdsa"!==a&&"ecdsa/rsa"!==a)throw new Error("wrong private key type");return ecSign(e,u)}if("dsa"===u.type){if("dsa"!==a)throw new Error("wrong private key type");return dsaSign(e,u,t)}if("rsa"!==a&&"ecdsa/rsa"!==a)throw new Error("wrong private key type");e=Buffer.concat([n,e]);for(var o=u.modulus.byteLength(),f=[0,1];e.length+f.length+10&&t.ishrn(a),t}function bits2octets(e,r){e=(e=bits2int(e,r)).mod(r);var t=Buffer.from(e.toArray());if(t.length=r)throw new Error("invalid sig")}module.exports=verify; -},{"./curves.json":68,"bn.js":41,"elliptic":127,"parse-asn1":264,"safe-buffer":446}],72:[function(require,module,exports){ +},{"./curves.json":81,"bn.js":55,"elliptic":141,"parse-asn1":330,"safe-buffer":511}],85:[function(require,module,exports){ "use strict";function _inheritsLoose(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r}var codes={};function createErrorType(e,r,t){t||(t=Error);var n=function(e){function t(t,n,o){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,o))||this}return _inheritsLoose(t,e),t}(t);n.prototype.name=t.name,n.prototype.code=e,codes[e]=n}function oneOf(e,r){if(Array.isArray(e)){var t=e.length;return e=e.map(function(e){return String(e)}),t>2?"one of ".concat(r," ").concat(e.slice(0,t-1).join(", "),", or ")+e[t-1]:2===t?"one of ".concat(r," ").concat(e[0]," or ").concat(e[1]):"of ".concat(r," ").concat(e[0])}return"of ".concat(r," ").concat(String(e))}function startsWith(e,r,t){return e.substr(!t||t<0?0:+t,r.length)===r}function endsWith(e,r,t){return(void 0===t||t>e.length)&&(t=e.length),e.substring(t-r.length,t)===r}function includes(e,r,t){return"number"!=typeof t&&(t=0),!(t+r.length>e.length)&&-1!==e.indexOf(r,t)}createErrorType("ERR_INVALID_OPT_VALUE",function(e,r){return'The value "'+r+'" is invalid for option "'+e+'"'},TypeError),createErrorType("ERR_INVALID_ARG_TYPE",function(e,r,t){var n,o;if("string"==typeof r&&startsWith(r,"not ")?(n="must not be",r=r.replace(/^not /,"")):n="must be",endsWith(e," argument"))o="The ".concat(e," ").concat(n," ").concat(oneOf(r,"type"));else{var c=includes(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(c," ").concat(n," ").concat(oneOf(r,"type"))}return o+=". Received type ".concat(typeof t)},TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),module.exports.codes=codes; -},{}],73:[function(require,module,exports){ -(function (process){ +},{}],86:[function(require,module,exports){ +(function (process){(function (){ "use strict";var objectKeys=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};module.exports=Duplex;var Readable=require("./_stream_readable"),Writable=require("./_stream_writable");require("inherits")(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v0)if("string"==typeof t||d.objectMode||Object.getPrototypeOf(t)===Buffer.prototype||(t=_uint8ArrayToBuffer(t)),a)d.endEmitted?errorOrDestroy(e,new ERR_STREAM_UNSHIFT_AFTER_END_EVENT):addChunk(e,d,t,!0);else if(d.ended)errorOrDestroy(e,new ERR_STREAM_PUSH_AFTER_EOF);else{if(d.destroyed)return!1;d.reading=!1,d.decoder&&!r?(t=d.decoder.write(t),d.objectMode||0!==t.length?addChunk(e,d,t,!1):maybeReadMore(e,d)):addChunk(e,d,t,!1)}else a||(d.reading=!1,maybeReadMore(e,d));return!d.ended&&(d.length=MAX_HWM?e=MAX_HWM:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function howMuchToRead(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=computeNewHighWaterMark(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function onEofChunk(e,t){if(debug("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}}function emitReadable(e){var t=e._readableState;debug("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(debug("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;debug("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){debug("readable nexttick read 0"),e.read(0)}function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(resume_,e,t))}function resume_(e,t){debug("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(debug("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function endReadable(e){var t=e._readableState;debug("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(debug("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return debug("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return debug("need readable",n),(0===t.length||t.length-e0?fromList(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){errorOrDestroy(this,new ERR_METHOD_NOT_IMPLEMENTED("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,debug("pipe count=%d opts=%j",a.pipesCount,t);var n=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?d:f;function i(t,n){debug("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,debug("cleanup"),e.removeListener("close",b),e.removeListener("finish",p),e.removeListener("drain",o),e.removeListener("error",u),e.removeListener("unpipe",i),r.removeListener("end",d),r.removeListener("end",f),r.removeListener("data",l),s=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||o())}function d(){debug("onend"),e.end()}a.endEmitted?process.nextTick(n):r.once("end",n),e.on("unpipe",i);var o=pipeOnDrain(r);e.on("drain",o);var s=!1;function l(t){debug("ondata");var n=e.write(t);debug("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!s&&(debug("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function u(t){debug("onerror",t),f(),e.removeListener("error",u),0===EElistenerCount(e,"error")&&errorOrDestroy(e,t)}function b(){e.removeListener("finish",p),f()}function p(){debug("onfinish"),e.removeListener("close",b),f()}function f(){debug("unpipe"),r.unpipe(e)}return r.on("data",l),prependListener(e,"error",u),e.once("close",b),e.once("finish",p),e.emit("pipe",r),a.flowing||(debug("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,debug("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||process.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=Stream.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=Stream.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(debug("resume"),e.flowing=!e.readableListening,resume(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return debug("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(debug("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",function(){if(debug("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(n){(debug("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))}),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var i=0;i-1))throw new ERR_UNKNOWN_ENCODING(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new ERR_METHOD_NOT_IMPLEMENTED("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var i=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||endWritable(this,i,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=destroyImpl.destroy,Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(e,t){t(e)}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":72,"./_stream_duplex":73,"./internal/streams/destroy":80,"./internal/streams/state":84,"./internal/streams/stream":85,"_process":284,"buffer":88,"inherits":195,"util-deprecate":566}],78:[function(require,module,exports){ -(function (process){ +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":85,"./_stream_duplex":86,"./internal/streams/destroy":93,"./internal/streams/state":97,"./internal/streams/stream":98,"_process":349,"buffer":101,"inherits":225,"util-deprecate":666}],91:[function(require,module,exports){ +(function (process){(function (){ "use strict";var _Object$setPrototypeO;function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var finished=require("./end-of-stream"),kLastResolve=Symbol("lastResolve"),kLastReject=Symbol("lastReject"),kError=Symbol("error"),kEnded=Symbol("ended"),kLastPromise=Symbol("lastPromise"),kHandlePromise=Symbol("handlePromise"),kStream=Symbol("stream");function createIterResult(e,t){return{value:e,done:t}}function readAndResolve(e){var t=e[kLastResolve];if(null!==t){var r=e[kStream].read();null!==r&&(e[kLastPromise]=null,e[kLastResolve]=null,e[kLastReject]=null,t(createIterResult(r,!1)))}}function onReadable(e){process.nextTick(readAndResolve,e)}function wrapForNext(e,t){return function(r,o){e.then(function(){t[kEnded]?r(createIterResult(void 0,!0)):t[kHandlePromise](r,o)},o)}}var AsyncIteratorPrototype=Object.getPrototypeOf(function(){}),ReadableStreamAsyncIteratorPrototype=Object.setPrototypeOf((_defineProperty(_Object$setPrototypeO={get stream(){return this[kStream]},next:function(){var e=this,t=this[kError];if(null!==t)return Promise.reject(t);if(this[kEnded])return Promise.resolve(createIterResult(void 0,!0));if(this[kStream].destroyed)return new Promise(function(t,r){process.nextTick(function(){e[kError]?r(e[kError]):t(createIterResult(void 0,!0))})});var r,o=this[kLastPromise];if(o)r=new Promise(wrapForNext(o,this));else{var n=this[kStream].read();if(null!==n)return Promise.resolve(createIterResult(n,!1));r=new Promise(this[kHandlePromise])}return this[kLastPromise]=r,r}},Symbol.asyncIterator,function(){return this}),_defineProperty(_Object$setPrototypeO,"return",function(){var e=this;return new Promise(function(t,r){e[kStream].destroy(null,function(e){e?r(e):t(createIterResult(void 0,!0))})})}),_Object$setPrototypeO),AsyncIteratorPrototype),createReadableStreamAsyncIterator=function(e){var t,r=Object.create(ReadableStreamAsyncIteratorPrototype,(_defineProperty(t={},kStream,{value:e,writable:!0}),_defineProperty(t,kLastResolve,{value:null,writable:!0}),_defineProperty(t,kLastReject,{value:null,writable:!0}),_defineProperty(t,kError,{value:null,writable:!0}),_defineProperty(t,kEnded,{value:e._readableState.endEmitted,writable:!0}),_defineProperty(t,kHandlePromise,{value:function(e,t){var o=r[kStream].read();o?(r[kLastPromise]=null,r[kLastResolve]=null,r[kLastReject]=null,e(createIterResult(o,!1))):(r[kLastResolve]=e,r[kLastReject]=t)},writable:!0}),t));return r[kLastPromise]=null,finished(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[kLastReject];return null!==t&&(r[kLastPromise]=null,r[kLastResolve]=null,r[kLastReject]=null,t(e)),void(r[kError]=e)}var o=r[kLastResolve];null!==o&&(r[kLastPromise]=null,r[kLastResolve]=null,r[kLastReject]=null,o(createIterResult(void 0,!0))),r[kEnded]=!0}),e.on("readable",onReadable.bind(null,r)),r};module.exports=createReadableStreamAsyncIterator; -}).call(this,require('_process')) -},{"./end-of-stream":81,"_process":284}],79:[function(require,module,exports){ +}).call(this)}).call(this,require('_process')) +},{"./end-of-stream":94,"_process":349}],92:[function(require,module,exports){ "use strict";function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return Buffer.alloc(0);for(var t=Buffer.allocUnsafe(e>>>0),n=this.head,r=0;n;)copyBuffer(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return ea.length?a.length:e;if(i===a.length?r+=a:r+=a.slice(0,e),0===(e-=i)){i===a.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=a.slice(i));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=Buffer.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var a=n.data,i=e>a.length?a.length:e;if(a.copy(t,t.length-e,0,i),0===(e-=i)){i===a.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(i));break}++r}return this.length-=r,t}},{key:custom,value:function(e,t){return inspect(this,_objectSpread({},t,{depth:0,customInspect:!1}))}}]),e}(); -},{"buffer":88,"util":43}],80:[function(require,module,exports){ -(function (process){ +},{"buffer":101,"util":57}],93:[function(require,module,exports){ +(function (process){(function (){ "use strict";function destroy(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(emitErrorNT,this,t)):process.nextTick(emitErrorNT,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?r._writableState?r._writableState.errorEmitted?process.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,process.nextTick(emitErrorAndCloseNT,r,t)):process.nextTick(emitErrorAndCloseNT,r,t):e?(process.nextTick(emitCloseNT,r),e(t)):process.nextTick(emitCloseNT,r)}),this)}function emitErrorAndCloseNT(t,e){emitErrorNT(t,e),emitCloseNT(t)}function emitCloseNT(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(t,e){t.emit("error",e)}function errorOrDestroy(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy}; -}).call(this,require('_process')) -},{"_process":284}],81:[function(require,module,exports){ +}).call(this)}).call(this,require('_process')) +},{"_process":349}],94:[function(require,module,exports){ "use strict";var ERR_STREAM_PREMATURE_CLOSE=require("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function once(e){var r=!1;return function(){if(!r){r=!0;for(var t=arguments.length,n=new Array(t),o=0;o0,function(e){o||(o=e),e&&i.forEach(call),u||(i.forEach(call),t(o))})});return r.reduce(pipe)}module.exports=pipeline; -},{"../../../errors":72,"./end-of-stream":81}],84:[function(require,module,exports){ +},{"../../../errors":85,"./end-of-stream":94}],97:[function(require,module,exports){ "use strict";var ERR_INVALID_OPT_VALUE=require("../../../errors").codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(r,e,t){return null!=r.highWaterMark?r.highWaterMark:e?r[t]:null}function getHighWaterMark(r,e,t,a){var i=highWaterMarkFrom(e,a,t);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new ERR_INVALID_OPT_VALUE(a?t:"highWaterMark",i);return Math.floor(i)}return r.objectMode?16:16384}module.exports={getHighWaterMark:getHighWaterMark}; -},{"../../../errors":72}],85:[function(require,module,exports){ +},{"../../../errors":85}],98:[function(require,module,exports){ module.exports=require("events").EventEmitter; -},{"events":149}],86:[function(require,module,exports){ +},{"events":172}],99:[function(require,module,exports){ exports=module.exports=require("./lib/_stream_readable.js"),exports.Stream=exports,exports.Readable=exports,exports.Writable=require("./lib/_stream_writable.js"),exports.Duplex=require("./lib/_stream_duplex.js"),exports.Transform=require("./lib/_stream_transform.js"),exports.PassThrough=require("./lib/_stream_passthrough.js"),exports.finished=require("./lib/internal/streams/end-of-stream.js"),exports.pipeline=require("./lib/internal/streams/pipeline.js"); -},{"./lib/_stream_duplex.js":73,"./lib/_stream_passthrough.js":74,"./lib/_stream_readable.js":75,"./lib/_stream_transform.js":76,"./lib/_stream_writable.js":77,"./lib/internal/streams/end-of-stream.js":81,"./lib/internal/streams/pipeline.js":83}],87:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":86,"./lib/_stream_passthrough.js":87,"./lib/_stream_readable.js":88,"./lib/_stream_transform.js":89,"./lib/_stream_writable.js":90,"./lib/internal/streams/end-of-stream.js":94,"./lib/internal/streams/pipeline.js":96}],100:[function(require,module,exports){ -},{}],88:[function(require,module,exports){ -(function (Buffer){ +},{}],101:[function(require,module,exports){ +(function (Buffer){(function (){ "use strict";var base64=require("base64-js"),ieee754=require("ieee754");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;function typedArraySupport(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}function createBuffer(e){if(e>K_MAX_LENGTH)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=Buffer.prototype,t}function Buffer(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return fromString(e,t);if(ArrayBuffer.isView(e))return fromArrayLike(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return Buffer.from(n,t,r);var f=fromObject(e);if(f)return f;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function assertSize(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function alloc(e,t,r){return assertSize(e),e<=0?createBuffer(e):void 0!==t?"string"==typeof r?createBuffer(e).fill(t,r):createBuffer(e).fill(t):createBuffer(e)}function allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromString(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),n=createBuffer(r),f=n.write(e,t);return f!==r&&(n=n.slice(0,f)),n}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),n=0;n=K_MAX_LENGTH)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return 0|e}function SlowBuffer(e){return+e!=e&&(e=0),Buffer.alloc(+e)}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var f=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(f)return n?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),f=!0}}function slowToString(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function swap(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function bidirectionalIndexOf(e,t,r,n,f){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=f?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(f)return-1;r=e.length-1}else if(r<0){if(!f)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,n)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,n,f);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,n,f);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,n,f){var i,o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}function a(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(f){var h=-1;for(i=r;iu&&(r=u-s),i=r;i>=0;i--){for(var c=!0,l=0;lf&&(n=f):n=f;var i=t.length;n>i/2&&(n=i/2);for(var o=0;o239?4:a>223?3:a>191?2:1;if(f+c<=r)switch(c){case 1:a<128&&(h=a);break;case 2:128==(192&(i=e[f+1]))&&(s=(31&a)<<6|63&i)>127&&(h=s);break;case 3:i=e[f+1],o=e[f+2],128==(192&i)&&128==(192&o)&&(s=(15&a)<<12|(63&i)<<6|63&o)>2047&&(s<55296||s>57343)&&(h=s);break;case 4:i=e[f+1],o=e[f+2],u=e[f+3],128==(192&i)&&128==(192&o)&&128==(192&u)&&(s=(15&a)<<18|(63&i)<<12|(63&o)<<6|63&u)>65535&&s<1114112&&(h=s)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),f+=c}return decodeCodePointsArray(n)}exports.kMaxLength=K_MAX_LENGTH,Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport(),Buffer.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(Buffer.prototype,"parent",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.buffer}}),Object.defineProperty(Buffer.prototype,"offset",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),Buffer.poolSize=8192,Buffer.from=function(e,t,r){return from(e,t,r)},Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,Buffer.alloc=function(e,t,r){return alloc(e,t,r)},Buffer.allocUnsafe=function(e){return allocUnsafe(e)},Buffer.allocUnsafeSlow=function(e){return allocUnsafe(e)},Buffer.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==Buffer.prototype},Buffer.compare=function(e,t){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),isInstance(t,Uint8Array)&&(t=Buffer.from(t,t.offset,t.byteLength)),!Buffer.isBuffer(e)||!Buffer.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,f=0,i=Math.min(r,n);ft&&(e+=" ... "),""},Buffer.prototype.compare=function(e,t,r,n,f){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===f&&(f=this.length),t<0||r>e.length||n<0||f>this.length)throw new RangeError("out of range index");if(n>=f&&t>=r)return 0;if(n>=f)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(f>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),u=Math.min(i,o),s=this.slice(n,f),a=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":return asciiWrite(this,e,t,r);case"latin1":case"binary":return latin1Write(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(e){var t=e.length;if(t<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var f="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,n,f,i){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>f||te.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,n,f,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,n,f){return t=+t,r>>>=0,f||checkIEEE754(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(e,t,r,n,23,4),r+4}function writeDouble(e,t,r,n,f){return t=+t,r>>>=0,f||checkIEEE754(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(e,t,r,n,52,8),r+8}Buffer.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=this[e],f=1,i=0;++i>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=this[e+--t],f=1;t>0&&(f*=256);)n+=this[e+--t]*f;return n},Buffer.prototype.readUInt8=function(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUInt16LE=function(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUInt16BE=function(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUInt32LE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUInt32BE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=this[e],f=1,i=0;++i=(f*=128)&&(n-=Math.pow(2,8*t)),n},Buffer.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=t,f=1,i=this[e+--n];n>0&&(f*=256);)i+=this[e+--n]*f;return i>=(f*=128)&&(i-=Math.pow(2,8*t)),i},Buffer.prototype.readInt8=function(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),ieee754.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),ieee754.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function(e,t){return e>>>=0,t||checkOffset(e,8,this.length),ieee754.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function(e,t){return e>>>=0,t||checkOffset(e,8,this.length),ieee754.read(this,e,!1,52,8)},Buffer.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var f=1,i=0;for(this[t]=255&e;++i>>=0,r>>>=0,n)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var f=r-1,i=1;for(this[t+f]=255&e;--f>=0&&(i*=256);)this[t+f]=e/i&255;return t+r},Buffer.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},Buffer.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,e,t,r,f-1,-f)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},Buffer.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,e,t,r,f-1,-f)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},Buffer.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},Buffer.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeFloatLE=function(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function(e,t,r,n){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return f},Buffer.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Buffer.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var f=e.charCodeAt(0);("utf8"===n&&f<128||"latin1"===n)&&(e=f)}}else"number"==typeof e&&(e&=255);if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!f){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}f=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),f=r;continue}r=65536+(f-55296<<10|r-56320)}else f&&(t-=3)>-1&&i.push(239,191,189);if(f=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function asciiToBytes(e){for(var t=[],r=0;r>8,f=r%256,i.push(f),i.push(n);return i}function base64ToBytes(e){return base64.toByteArray(base64clean(e))}function blitBuffer(e,t,r,n){for(var f=0;f=t.length||f>=e.length);++f)t[f+r]=e[f];return f}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e} -}).call(this,require("buffer").Buffer) -},{"base64-js":39,"buffer":88,"ieee754":192}],89:[function(require,module,exports){ -(function (Buffer){ +}).call(this)}).call(this,require("buffer").Buffer) +},{"base64-js":52,"buffer":101,"ieee754":217}],102:[function(require,module,exports){ +(function (Buffer){(function (){ function allocUnsafe(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative');return Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e)}module.exports=allocUnsafe; -}).call(this,require("buffer").Buffer) -},{"buffer":88}],90:[function(require,module,exports){ -(function (Buffer){ +}).call(this)}).call(this,require("buffer").Buffer) +},{"buffer":101}],103:[function(require,module,exports){ +(function (Buffer){(function (){ var bufferFill=require("buffer-fill"),allocUnsafe=require("buffer-alloc-unsafe");module.exports=function(e,r,f){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative');if(Buffer.alloc)return Buffer.alloc(e,r,f);var u=allocUnsafe(e);return 0===e?u:void 0===r?bufferFill(u,0):("string"!=typeof f&&(f=void 0),bufferFill(u,r,f))}; -}).call(this,require("buffer").Buffer) -},{"buffer":88,"buffer-alloc-unsafe":89,"buffer-fill":91}],91:[function(require,module,exports){ -(function (Buffer){ +}).call(this)}).call(this,require("buffer").Buffer) +},{"buffer":101,"buffer-alloc-unsafe":102,"buffer-fill":104}],104:[function(require,module,exports){ +(function (Buffer){(function (){ var hasFullSupport=function(){try{if(!Buffer.isEncoding("latin1"))return!1;var r=Buffer.alloc?Buffer.alloc(4):new Buffer(4);return r.fill("ab","ucs2"),"61006200"===r.toString("hex")}catch(r){return!1}}();function isSingleByte(r){return 1===r.length&&r.charCodeAt(0)<256}function fillWithNumber(r,e,n,t){if(n<0||t>r.length)throw new RangeError("Out of range index");return n>>>=0,(t=void 0===t?r.length:t>>>0)>n&&r.fill(e,n,t),r}function fillWithBuffer(r,e,n,t){if(n<0||t>r.length)throw new RangeError("Out of range index");if(t<=n)return r;n>>>=0,t=void 0===t?r.length:t>>>0;for(var i=n,f=e.length;i<=t-f;)e.copy(r,i),i+=f;return i!==t&&e.copy(r,i,0,t-i),r}function fill(r,e,n,t,i){if(hasFullSupport)return r.fill(e,n,t,i);if("number"==typeof e)return fillWithNumber(r,e,n,t);if("string"==typeof e){if("string"==typeof n?(i=n,n=0,t=r.length):"string"==typeof t&&(i=t,t=r.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("latin1"===i&&(i="binary"),"string"==typeof i&&!Buffer.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(""===e)return fillWithNumber(r,0,n,t);if(isSingleByte(e))return fillWithNumber(r,e.charCodeAt(0),n,t);e=new Buffer(e,i)}return Buffer.isBuffer(e)?fillWithBuffer(r,e,n,t):fillWithNumber(r,0,n,t)}module.exports=fill; -}).call(this,require("buffer").Buffer) -},{"buffer":88}],92:[function(require,module,exports){ -(function (Buffer){ +}).call(this)}).call(this,require("buffer").Buffer) +},{"buffer":101}],105:[function(require,module,exports){ +(function (Buffer){(function (){ var toString=Object.prototype.toString,isModern="function"==typeof Buffer.alloc&&"function"==typeof Buffer.allocUnsafe&&"function"==typeof Buffer.from;function isArrayBuffer(r){return"ArrayBuffer"===toString.call(r).slice(8,-1)}function fromArrayBuffer(r,f,e){f>>>=0;var n=r.byteLength-f;if(n<0)throw new RangeError("'offset' is out of bounds");if(void 0===e)e=n;else if((e>>>=0)>n)throw new RangeError("'length' is out of bounds");return isModern?Buffer.from(r.slice(f,f+e)):new Buffer(new Uint8Array(r.slice(f,f+e)))}function fromString(r,f){if("string"==typeof f&&""!==f||(f="utf8"),!Buffer.isEncoding(f))throw new TypeError('"encoding" must be a valid string encoding');return isModern?Buffer.from(r,f):new Buffer(r,f)}function bufferFrom(r,f,e){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return isArrayBuffer(r)?fromArrayBuffer(r,f,e):"string"==typeof r?fromString(r,f):isModern?Buffer.from(r):new Buffer(r)}module.exports=bufferFrom; -}).call(this,require("buffer").Buffer) -},{"buffer":88}],93:[function(require,module,exports){ -(function (Buffer){ +}).call(this)}).call(this,require("buffer").Buffer) +},{"buffer":101}],106:[function(require,module,exports){ +(function (Buffer){(function (){ module.exports=function(e,n){for(var r=Math.min(e.length,n.length),t=new Buffer(r),f=0;f=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return h}function s(t,i,r,h){for(var n=0,e=Math.min(t.length,r),o=i;o=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,i){return t.cmp(i)>0?t:i},n.min=function(t,i){return t.cmp(i)<0?t:i},n.prototype._init=function(t,i,h){if("number"==typeof t)return this._initNumber(t,i,h);if("object"==typeof t)return this._initArray(t,i,h);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===i?this._parseHex(t,n):this._parseBase(t,i,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initNumber=function(t,i,h){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initArray=function(t,i,h){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[e]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===h)for(n=0,e=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this.strip()},n.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r=i;r-=6)n=o(t,r,r+6),this.words[h]|=n<>>26-e&4194303,(e+=24)>=26&&(e-=26,h++);r+6!==i&&(n=o(t,i,r+6),this.words[h]|=n<>>26-e&4194303),this.strip()},n.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var h=0,n=1;n<=67108863;n*=i)h++;h--,n=n/i|0;for(var e=t.length-r,o=e%h,u=Math.min(e,e-o)+r,a=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],a=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,i,r){r.negative=i.negative^t.negative;var h=t.length+i.length|0;r.length=h,h=h-1|0;var n=0|t.words[0],e=0|i.words[0],o=n*e,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(n=0|t.words[p])*(e=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,i){var h;if(i=0|i||1,16===(t=t||10)||"hex"===t){h="";for(var n=0,e=0,o=0;o>>24-n&16777215)||o!==this.length-1?u[6-m.length]+m+h:m+h,(n+=2)>=26&&(n-=26,o--)}for(0!==e&&(h=e.toString(16)+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}if(t===(0|t)&&t>=2&&t<=36){var f=a[t],d=l[t];h="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modn(d).toString(t);h=(p=p.idivn(d)).isZero()?M+h:u[f-M.length]+M+h}for(this.isZero()&&(h="0"+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,i){return r(void 0!==e),this.toArrayLike(e,t,i)},n.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},n.prototype.toArrayLike=function(t,i,h){var n=this.byteLength(),e=h||Math.max(1,n);r(n<=e,"byte array longer than desired length"),r(e>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===i,a=new t(e),l=this.clone();if(u){for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[s]=o;for(;s=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},n.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var h=0;ht.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),h=t%26;this._expand(i),h>0&&i--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-h),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var h=t/26|0,n=t%26;return this._expand(h+1),this.words[h]=i?this.words[h]|1<t.length?(r=this,h=t):(r=t,h=this);for(var n=0,e=0;e>>26;for(;0!==n&&e>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;et.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,h,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,h=t):(r=t,h=this);for(var e=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==e&&o>26,this.words[o]=67108863&i;if(0===e&&o>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],g=8191&v,c=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,x=0|o[5],S=8191&x,Z=x>>>13,q=0|o[6],R=8191&q,B=q>>>13,N=0|o[7],L=8191&N,I=N>>>13,z=0|o[8],T=8191&z,E=z>>>13,O=0|o[9],j=8191&O,K=O>>>13,P=0|s[0],F=8191&P,C=P>>>13,D=0|s[1],H=8191&D,J=D>>>13,U=0|s[2],G=8191&U,Q=U>>>13,V=0|s[3],W=8191&V,X=V>>>13,Y=0|s[4],$=8191&Y,tt=Y>>>13,it=0|s[5],rt=8191&it,ht=it>>>13,nt=0|s[6],et=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(h=Math.imul(m,F))|0)+((8191&(n=(n=Math.imul(m,C))+Math.imul(f,F)|0))<<13)|0;a=((e=Math.imul(f,C))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,h=Math.imul(p,F),n=(n=Math.imul(p,C))+Math.imul(M,F)|0,e=Math.imul(M,C);var gt=(a+(h=h+Math.imul(m,H)|0)|0)+((8191&(n=(n=n+Math.imul(m,J)|0)+Math.imul(f,H)|0))<<13)|0;a=((e=e+Math.imul(f,J)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,h=Math.imul(g,F),n=(n=Math.imul(g,C))+Math.imul(c,F)|0,e=Math.imul(c,C),h=h+Math.imul(p,H)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(M,H)|0,e=e+Math.imul(M,J)|0;var ct=(a+(h=h+Math.imul(m,G)|0)|0)+((8191&(n=(n=n+Math.imul(m,Q)|0)+Math.imul(f,G)|0))<<13)|0;a=((e=e+Math.imul(f,Q)|0)+(n>>>13)|0)+(ct>>>26)|0,ct&=67108863,h=Math.imul(y,F),n=(n=Math.imul(y,C))+Math.imul(b,F)|0,e=Math.imul(b,C),h=h+Math.imul(g,H)|0,n=(n=n+Math.imul(g,J)|0)+Math.imul(c,H)|0,e=e+Math.imul(c,J)|0,h=h+Math.imul(p,G)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(M,G)|0,e=e+Math.imul(M,Q)|0;var wt=(a+(h=h+Math.imul(m,W)|0)|0)+((8191&(n=(n=n+Math.imul(m,X)|0)+Math.imul(f,W)|0))<<13)|0;a=((e=e+Math.imul(f,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,h=Math.imul(k,F),n=(n=Math.imul(k,C))+Math.imul(A,F)|0,e=Math.imul(A,C),h=h+Math.imul(y,H)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,H)|0,e=e+Math.imul(b,J)|0,h=h+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Q)|0)+Math.imul(c,G)|0,e=e+Math.imul(c,Q)|0,h=h+Math.imul(p,W)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(M,W)|0,e=e+Math.imul(M,X)|0;var yt=(a+(h=h+Math.imul(m,$)|0)|0)+((8191&(n=(n=n+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((e=e+Math.imul(f,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,h=Math.imul(S,F),n=(n=Math.imul(S,C))+Math.imul(Z,F)|0,e=Math.imul(Z,C),h=h+Math.imul(k,H)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,H)|0,e=e+Math.imul(A,J)|0,h=h+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,G)|0,e=e+Math.imul(b,Q)|0,h=h+Math.imul(g,W)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(c,W)|0,e=e+Math.imul(c,X)|0,h=h+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(M,$)|0,e=e+Math.imul(M,tt)|0;var bt=(a+(h=h+Math.imul(m,rt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ht)|0)+Math.imul(f,rt)|0))<<13)|0;a=((e=e+Math.imul(f,ht)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,h=Math.imul(R,F),n=(n=Math.imul(R,C))+Math.imul(B,F)|0,e=Math.imul(B,C),h=h+Math.imul(S,H)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(Z,H)|0,e=e+Math.imul(Z,J)|0,h=h+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Q)|0)+Math.imul(A,G)|0,e=e+Math.imul(A,Q)|0,h=h+Math.imul(y,W)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(b,W)|0,e=e+Math.imul(b,X)|0,h=h+Math.imul(g,$)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(c,$)|0,e=e+Math.imul(c,tt)|0,h=h+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(M,rt)|0,e=e+Math.imul(M,ht)|0;var _t=(a+(h=h+Math.imul(m,et)|0)|0)+((8191&(n=(n=n+Math.imul(m,ot)|0)+Math.imul(f,et)|0))<<13)|0;a=((e=e+Math.imul(f,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,h=Math.imul(L,F),n=(n=Math.imul(L,C))+Math.imul(I,F)|0,e=Math.imul(I,C),h=h+Math.imul(R,H)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,H)|0,e=e+Math.imul(B,J)|0,h=h+Math.imul(S,G)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(Z,G)|0,e=e+Math.imul(Z,Q)|0,h=h+Math.imul(k,W)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(A,W)|0,e=e+Math.imul(A,X)|0,h=h+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|0,e=e+Math.imul(b,tt)|0,h=h+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(c,rt)|0,e=e+Math.imul(c,ht)|0,h=h+Math.imul(p,et)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(M,et)|0,e=e+Math.imul(M,ot)|0;var kt=(a+(h=h+Math.imul(m,ut)|0)|0)+((8191&(n=(n=n+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((e=e+Math.imul(f,at)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,h=Math.imul(T,F),n=(n=Math.imul(T,C))+Math.imul(E,F)|0,e=Math.imul(E,C),h=h+Math.imul(L,H)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(I,H)|0,e=e+Math.imul(I,J)|0,h=h+Math.imul(R,G)|0,n=(n=n+Math.imul(R,Q)|0)+Math.imul(B,G)|0,e=e+Math.imul(B,Q)|0,h=h+Math.imul(S,W)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(Z,W)|0,e=e+Math.imul(Z,X)|0,h=h+Math.imul(k,$)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,$)|0,e=e+Math.imul(A,tt)|0,h=h+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(b,rt)|0,e=e+Math.imul(b,ht)|0,h=h+Math.imul(g,et)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(c,et)|0,e=e+Math.imul(c,ot)|0,h=h+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(M,ut)|0,e=e+Math.imul(M,at)|0;var At=(a+(h=h+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((e=e+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,h=Math.imul(j,F),n=(n=Math.imul(j,C))+Math.imul(K,F)|0,e=Math.imul(K,C),h=h+Math.imul(T,H)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(E,H)|0,e=e+Math.imul(E,J)|0,h=h+Math.imul(L,G)|0,n=(n=n+Math.imul(L,Q)|0)+Math.imul(I,G)|0,e=e+Math.imul(I,Q)|0,h=h+Math.imul(R,W)|0,n=(n=n+Math.imul(R,X)|0)+Math.imul(B,W)|0,e=e+Math.imul(B,X)|0,h=h+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(Z,$)|0,e=e+Math.imul(Z,tt)|0,h=h+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,rt)|0,e=e+Math.imul(A,ht)|0,h=h+Math.imul(y,et)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,et)|0,e=e+Math.imul(b,ot)|0,h=h+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(c,ut)|0,e=e+Math.imul(c,at)|0,h=h+Math.imul(p,mt)|0,n=(n=n+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,e=e+Math.imul(M,ft)|0;var xt=(a+(h=h+Math.imul(m,pt)|0)|0)+((8191&(n=(n=n+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((e=e+Math.imul(f,Mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h=Math.imul(j,H),n=(n=Math.imul(j,J))+Math.imul(K,H)|0,e=Math.imul(K,J),h=h+Math.imul(T,G)|0,n=(n=n+Math.imul(T,Q)|0)+Math.imul(E,G)|0,e=e+Math.imul(E,Q)|0,h=h+Math.imul(L,W)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(I,W)|0,e=e+Math.imul(I,X)|0,h=h+Math.imul(R,$)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(B,$)|0,e=e+Math.imul(B,tt)|0,h=h+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(Z,rt)|0,e=e+Math.imul(Z,ht)|0,h=h+Math.imul(k,et)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(A,et)|0,e=e+Math.imul(A,ot)|0,h=h+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,e=e+Math.imul(b,at)|0,h=h+Math.imul(g,mt)|0,n=(n=n+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,e=e+Math.imul(c,ft)|0;var St=(a+(h=h+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((e=e+Math.imul(M,Mt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,h=Math.imul(j,G),n=(n=Math.imul(j,Q))+Math.imul(K,G)|0,e=Math.imul(K,Q),h=h+Math.imul(T,W)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(E,W)|0,e=e+Math.imul(E,X)|0,h=h+Math.imul(L,$)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(I,$)|0,e=e+Math.imul(I,tt)|0,h=h+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(B,rt)|0,e=e+Math.imul(B,ht)|0,h=h+Math.imul(S,et)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(Z,et)|0,e=e+Math.imul(Z,ot)|0,h=h+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ut)|0,e=e+Math.imul(A,at)|0,h=h+Math.imul(y,mt)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,e=e+Math.imul(b,ft)|0;var Zt=(a+(h=h+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,Mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((e=e+Math.imul(c,Mt)|0)+(n>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,h=Math.imul(j,W),n=(n=Math.imul(j,X))+Math.imul(K,W)|0,e=Math.imul(K,X),h=h+Math.imul(T,$)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(E,$)|0,e=e+Math.imul(E,tt)|0,h=h+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(I,rt)|0,e=e+Math.imul(I,ht)|0,h=h+Math.imul(R,et)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(B,et)|0,e=e+Math.imul(B,ot)|0,h=h+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul(Z,ut)|0,e=e+Math.imul(Z,at)|0,h=h+Math.imul(k,mt)|0,n=(n=n+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,e=e+Math.imul(A,ft)|0;var qt=(a+(h=h+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((e=e+Math.imul(b,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,h=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(K,$)|0,e=Math.imul(K,tt),h=h+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(E,rt)|0,e=e+Math.imul(E,ht)|0,h=h+Math.imul(L,et)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(I,et)|0,e=e+Math.imul(I,ot)|0,h=h+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(B,ut)|0,e=e+Math.imul(B,at)|0,h=h+Math.imul(S,mt)|0,n=(n=n+Math.imul(S,ft)|0)+Math.imul(Z,mt)|0,e=e+Math.imul(Z,ft)|0;var Rt=(a+(h=h+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((e=e+Math.imul(A,Mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,h=Math.imul(j,rt),n=(n=Math.imul(j,ht))+Math.imul(K,rt)|0,e=Math.imul(K,ht),h=h+Math.imul(T,et)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(E,et)|0,e=e+Math.imul(E,ot)|0,h=h+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,at)|0)+Math.imul(I,ut)|0,e=e+Math.imul(I,at)|0,h=h+Math.imul(R,mt)|0,n=(n=n+Math.imul(R,ft)|0)+Math.imul(B,mt)|0,e=e+Math.imul(B,ft)|0;var Bt=(a+(h=h+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,Mt)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((e=e+Math.imul(Z,Mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,h=Math.imul(j,et),n=(n=Math.imul(j,ot))+Math.imul(K,et)|0,e=Math.imul(K,ot),h=h+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(E,ut)|0,e=e+Math.imul(E,at)|0,h=h+Math.imul(L,mt)|0,n=(n=n+Math.imul(L,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Nt=(a+(h=h+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,Mt)|0)+Math.imul(B,pt)|0))<<13)|0;a=((e=e+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h=Math.imul(j,ut),n=(n=Math.imul(j,at))+Math.imul(K,ut)|0,e=Math.imul(K,at),h=h+Math.imul(T,mt)|0,n=(n=n+Math.imul(T,ft)|0)+Math.imul(E,mt)|0,e=e+Math.imul(E,ft)|0;var Lt=(a+(h=h+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h=Math.imul(j,mt),n=(n=Math.imul(j,ft))+Math.imul(K,mt)|0,e=Math.imul(K,ft);var It=(a+(h=h+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,Mt)|0)+Math.imul(E,pt)|0))<<13)|0;a=((e=e+Math.imul(E,Mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var zt=(a+(h=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(K,pt)|0))<<13)|0;return a=((e=Math.imul(K,Mt))+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863,u[0]=vt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=xt,u[10]=St,u[11]=Zt,u[12]=qt,u[13]=Rt,u[14]=Bt,u[15]=Nt,u[16]=Lt,u[17]=It,u[18]=zt,0!==a&&(u[19]=a,r.length++),r};function d(t,i,r){return(new p).mulp(t,i,r)}function p(t,i){this.x=t,this.y=i}Math.imul||(f=m),n.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,i):r<63?m(this,t,i):r<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var h=0,n=0,e=0;e>>26)|0)>>>26,o&=67108863}r.words[e]=s,h=o,o=n}return 0!==h?r.words[e]=h:r.length--,r.strip()}(this,t,i):d(this,t,i)},p.prototype.makeRBT=function(t){for(var i=new Array(t),r=n.prototype._countBits(t)-1,h=0;h>=1;return h},p.prototype.permute=function(t,i,r,h,n,e){for(var o=0;o>>=1)n++;return 1<>>=13,h[2*o+1]=8191&e,e>>>=13;for(o=2*i;o>=26,i+=n/67108864|0,i+=e>>>26,this.words[h]=67108863&e}return 0!==i&&(this.words[h]=i,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r>>n}return i}(t);if(0===i.length)return new n(1);for(var r=this,h=0;h=0);var i,h=t%26,n=(t-h)/26,e=67108863>>>26-h<<26-h;if(0!==h){var o=0;for(i=0;i>>26-h}o&&(this.words[i]=o,this.length++)}if(0!==n){for(i=this.length-1;i>=0;i--)this.words[i+n]=this.words[i];for(i=0;i=0),n=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<o)for(this.length-=o,a=0;a=0&&(0!==l||a>=n);a--){var m=0|this.words[a];this.words[a]=l<<26-e|m>>>e,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,i,h){return r(0===this.negative),this.iushrn(t,i,h)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,h=(t-i)/26,n=1<=0);var i=t%26,h=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=h)return this;if(0!==i&&h++,this.length=Math.min(h,this.length),0!==i){var n=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(u/67108864|0),this.words[n+h]=67108863&e}for(;n>26,this.words[n+h]=67108863&e;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n>26,this.words[n]=67108863&e;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,i){var r=(this.length,t.length),h=this.clone(),e=t,o=0|e.words[e.length-1];0!==(r=26-this._countBits(o))&&(e=e.ushln(r),h.iushln(r),o=0|e.words[e.length-1]);var s,u=h.length-e.length;if("mod"!==i){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a=0;m--){var f=67108864*(0|h.words[e.length+m])+(0|h.words[e.length+m-1]);for(f=Math.min(f/o|0,67108863),h._ishlnsubmul(e,f,m);0!==h.negative;)f--,h.negative=0,h._ishlnsubmul(e,1,m),h.isZero()||(h.negative^=1);s&&(s.words[m]=f)}return s&&s.strip(),h.strip(),"div"!==i&&0!==r&&h.iushrn(r),{div:s||null,mod:h}},n.prototype.divmod=function(t,i,h){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,h=t.ushrn(1),n=t.andln(1),e=r.cmp(h);return e<0||1===n&&0===e?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var i=(1<<26)%t,h=0,n=this.length-1;n>=0;n--)h=(i*h+(0|this.words[n]))%t;return h},n.prototype.idivn=function(t){r(t<=67108863);for(var i=0,h=this.length-1;h>=0;h--){var n=(0|this.words[h])+67108864*i;this.words[h]=n/t|0,i=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new n(1),o=new n(0),s=new n(0),u=new n(1),a=0;i.isEven()&&h.isEven();)i.iushrn(1),h.iushrn(1),++a;for(var l=h.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(m)),e.iushrn(1),o.iushrn(1);for(var p=0,M=1;0==(h.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(h.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(h)>=0?(i.isub(h),e.isub(s),o.isub(u)):(h.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:h.iushln(a)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new n(1),s=new n(0),u=h.clone();i.cmpn(1)>0&&h.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(h.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(h.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(h)>=0?(i.isub(h),o.isub(s)):(h.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var h=0;i.isEven()&&r.isEven();h++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=i.cmp(r);if(n<0){var e=i;i=r,r=e}else if(0===n||0===r.cmpn(1))break;i.isub(r)}return r.iushln(h)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,h=(t-i)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var i,h=t<0;if(0!==this.negative&&!h)return-1;if(0===this.negative&&h)return 1;if(this.strip(),this.length>1)i=1;else{h&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:nt.length)return 1;if(this.length=0;r--){var h=0|this.words[r],n=0|t.words[r];if(h!==n){hn&&(i=1);break}}return i},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new b(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};function v(t,i){this.name=t,this.p=new n(i,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function c(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function b(t){if("string"==typeof t){var i=n._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){b.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var h=i0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,i){t.iushrn(this.n,0,i)},v.prototype.imulK=function(t){return t.imul(this.k)},h(g,v),g.prototype.split=function(t,i){for(var r=Math.min(t.length,9),h=0;h>>22,n=e}n>>>=22,t.words[h-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r>>=26,t.words[r]=n,i=h}return 0!==i&&(t.words[t.length++]=i),t},n._prime=function(t){if(M[t])return M[t];var i;if("k256"===t)i=new g;else if("p224"===t)i=new c;else if("p192"===t)i=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new y}return M[t]=i,i},b.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},b.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},b.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},b.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},b.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},b.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},b.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},b.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},b.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},b.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},b.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},b.prototype.isqr=function(t){return this.imul(t,t.clone())},b.prototype.sqr=function(t){return this.mul(t,t)},b.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var h=this.m.add(new n(1)).iushrn(2);return this.pow(t,h)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new n(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,e),f=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();r(v=0;h--){for(var a=i.words[h],l=u-1;l>=0;l--){var m=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===h&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},b.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},b.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},n.mont=function(t){return new _(t)},h(_,b),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},_.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(h).iushrn(this.shift),e=n;return n.cmp(this.m)>=0?e=n.isub(this.m):n.cmpn(0)<0&&(e=n.iadd(this.m)),e._forceRed(this)},_.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new n(0)._forceRed(this);var r=t.mul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(h).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof module||module,this); -},{"buffer":43}],101:[function(require,module,exports){ +},{"buffer":57}],112:[function(require,module,exports){ "use strict";var inherits=require("inherits"),MD5=require("md5.js"),RIPEMD160=require("ripemd160"),sha=require("sha.js"),Base=require("cipher-base");function Hash(e){Base.call(this,"digest"),this._hash=e}inherits(Hash,Base),Hash.prototype._update=function(e){this._hash.update(e)},Hash.prototype._final=function(){return this._hash.digest()},module.exports=function(e){return"md5"===(e=e.toLowerCase())?new MD5:"rmd160"===e||"ripemd160"===e?new RIPEMD160:new Hash(sha(e))}; -},{"cipher-base":96,"inherits":195,"md5.js":215,"ripemd160":445,"sha.js":462}],102:[function(require,module,exports){ +},{"cipher-base":109,"inherits":225,"md5.js":281,"ripemd160":510,"sha.js":528}],113:[function(require,module,exports){ var MD5=require("md5.js");module.exports=function(e){return(new MD5).update(e).digest()}; -},{"md5.js":215}],103:[function(require,module,exports){ +},{"md5.js":281}],114:[function(require,module,exports){ "use strict";var inherits=require("inherits"),Legacy=require("./legacy"),Base=require("cipher-base"),Buffer=require("safe-buffer").Buffer,md5=require("create-hash/md5"),RIPEMD160=require("ripemd160"),sha=require("sha.js"),ZEROS=Buffer.alloc(128);function Hmac(e,a){Base.call(this,"digest"),"string"==typeof a&&(a=Buffer.from(a));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=a,a.length>r)?a=("rmd160"===e?new RIPEMD160:sha(e)).update(a).digest():a.lengthblocksize?s=e(s):s.length=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=8*this._len;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var s=(4294967295&e)>>>0,h=(e-s)/4294967296;this._block.writeUInt32BE(h,this._blockSize-8),this._block.writeUInt32BE(s,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},module.exports=Hash; -},{"safe-buffer":446}],106:[function(require,module,exports){ +},{"safe-buffer":511}],117:[function(require,module,exports){ var exports=module.exports=function(e){e=e.toLowerCase();var r=exports[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};exports.sha=require("./sha"),exports.sha1=require("./sha1"),exports.sha224=require("./sha224"),exports.sha256=require("./sha256"),exports.sha384=require("./sha384"),exports.sha512=require("./sha512"); -},{"./sha":107,"./sha1":108,"./sha224":109,"./sha256":110,"./sha384":111,"./sha512":112}],107:[function(require,module,exports){ +},{"./sha":118,"./sha1":119,"./sha224":120,"./sha256":121,"./sha384":122,"./sha512":123}],118:[function(require,module,exports){ var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);function Sha(){this.init(),this._w=W,Hash.call(this,64,56)}function rotl5(t){return t<<5|t>>>27}function rotl30(t){return t<<30|t>>>2}function ft(t,i,r,h){return 0===t?i&r|~i&h:2===t?i&r|i&h|r&h:i^r^h}inherits(Sha,Hash),Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha.prototype._update=function(t){for(var i=this._w,r=0|this._a,h=0|this._b,s=0|this._c,e=0|this._d,n=0|this._e,_=0;_<16;++_)i[_]=t.readInt32BE(4*_);for(;_<80;++_)i[_]=i[_-3]^i[_-8]^i[_-14]^i[_-16];for(var a=0;a<80;++a){var o=~~(a/20),f=rotl5(r)+ft(o,h,s,e)+n+i[a]+K[o]|0;n=e,e=s,s=rotl30(h),h=r,r=f}this._a=r+this._a|0,this._b=h+this._b|0,this._c=s+this._c|0,this._d=e+this._d|0,this._e=n+this._e|0},Sha.prototype._hash=function(){var t=Buffer.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},module.exports=Sha; -},{"./hash":105,"inherits":195,"safe-buffer":446}],108:[function(require,module,exports){ +},{"./hash":116,"inherits":225,"safe-buffer":511}],119:[function(require,module,exports){ var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);function Sha1(){this.init(),this._w=W,Hash.call(this,64,56)}function rotl1(t){return t<<1|t>>>31}function rotl5(t){return t<<5|t>>>27}function rotl30(t){return t<<30|t>>>2}function ft(t,i,r,h){return 0===t?i&r|~i&h:2===t?i&r|i&h|r&h:i^r^h}inherits(Sha1,Hash),Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha1.prototype._update=function(t){for(var i=this._w,r=0|this._a,h=0|this._b,s=0|this._c,e=0|this._d,n=0|this._e,_=0;_<16;++_)i[_]=t.readInt32BE(4*_);for(;_<80;++_)i[_]=rotl1(i[_-3]^i[_-8]^i[_-14]^i[_-16]);for(var a=0;a<80;++a){var o=~~(a/20),f=rotl5(r)+ft(o,h,s,e)+n+i[a]+K[o]|0;n=e,e=s,s=rotl30(h),h=r,r=f}this._a=r+this._a|0,this._b=h+this._b|0,this._c=s+this._c|0,this._d=e+this._d|0,this._e=n+this._e|0},Sha1.prototype._hash=function(){var t=Buffer.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},module.exports=Sha1; -},{"./hash":105,"inherits":195,"safe-buffer":446}],109:[function(require,module,exports){ +},{"./hash":116,"inherits":225,"safe-buffer":511}],120:[function(require,module,exports){ var inherits=require("inherits"),Sha256=require("./sha256"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,W=new Array(64);function Sha224(){this.init(),this._w=W,Hash.call(this,64,56)}inherits(Sha224,Sha256),Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},Sha224.prototype._hash=function(){var t=Buffer.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},module.exports=Sha224; -},{"./hash":105,"./sha256":110,"inherits":195,"safe-buffer":446}],110:[function(require,module,exports){ +},{"./hash":116,"./sha256":121,"inherits":225,"safe-buffer":511}],121:[function(require,module,exports){ var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],W=new Array(64);function Sha256(){this.init(),this._w=W,Hash.call(this,64,56)}function ch(t,i,h){return h^t&(i^h)}function maj(t,i,h){return t&i|h&(t|i)}function sigma0(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function sigma1(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function gamma0(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function gamma1(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}inherits(Sha256,Hash),Sha256.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Sha256.prototype._update=function(t){for(var i=this._w,h=0|this._a,s=0|this._b,r=0|this._c,e=0|this._d,n=0|this._e,_=0|this._f,a=0|this._g,f=0|this._h,u=0;u<16;++u)i[u]=t.readInt32BE(4*u);for(;u<64;++u)i[u]=gamma1(i[u-2])+i[u-7]+gamma0(i[u-15])+i[u-16]|0;for(var o=0;o<64;++o){var c=f+sigma1(n)+ch(n,_,a)+K[o]+i[o]|0,m=sigma0(h)+maj(h,s,r)|0;f=a,a=_,_=n,n=e+c|0,e=r,r=s,s=h,h=c+m|0}this._a=h+this._a|0,this._b=s+this._b|0,this._c=r+this._c|0,this._d=e+this._d|0,this._e=n+this._e|0,this._f=_+this._f|0,this._g=a+this._g|0,this._h=f+this._h|0},Sha256.prototype._hash=function(){var t=Buffer.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},module.exports=Sha256; -},{"./hash":105,"inherits":195,"safe-buffer":446}],111:[function(require,module,exports){ +},{"./hash":116,"inherits":225,"safe-buffer":511}],122:[function(require,module,exports){ var inherits=require("inherits"),SHA512=require("./sha512"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash.call(this,128,112)}inherits(Sha384,SHA512),Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},Sha384.prototype._hash=function(){var h=Buffer.allocUnsafe(48);function i(i,t,s){h.writeInt32BE(i,s),h.writeInt32BE(t,s+4)}return i(this._ah,this._al,0),i(this._bh,this._bl,8),i(this._ch,this._cl,16),i(this._dh,this._dl,24),i(this._eh,this._el,32),i(this._fh,this._fl,40),h},module.exports=Sha384; -},{"./hash":105,"./sha512":112,"inherits":195,"safe-buffer":446}],112:[function(require,module,exports){ +},{"./hash":116,"./sha512":123,"inherits":225,"safe-buffer":511}],123:[function(require,module,exports){ var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],W=new Array(160);function Sha512(){this.init(),this._w=W,Hash.call(this,128,112)}function Ch(h,t,i){return i^h&(t^i)}function maj(h,t,i){return h&t|i&(h|t)}function sigma0(h,t){return(h>>>28|t<<4)^(t>>>2|h<<30)^(t>>>7|h<<25)}function sigma1(h,t){return(h>>>14|t<<18)^(h>>>18|t<<14)^(t>>>9|h<<23)}function Gamma0(h,t){return(h>>>1|t<<31)^(h>>>8|t<<24)^h>>>7}function Gamma0l(h,t){return(h>>>1|t<<31)^(h>>>8|t<<24)^(h>>>7|t<<25)}function Gamma1(h,t){return(h>>>19|t<<13)^(t>>>29|h<<3)^h>>>6}function Gamma1l(h,t){return(h>>>19|t<<13)^(t>>>29|h<<3)^(h>>>6|t<<26)}function getCarry(h,t){return h>>>0>>0?1:0}inherits(Sha512,Hash),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sha512.prototype._update=function(h){for(var t=this._w,i=0|this._ah,s=0|this._bh,r=0|this._ch,_=0|this._dh,a=0|this._eh,e=0|this._fh,l=0|this._gh,n=0|this._hh,f=0|this._al,g=0|this._bl,u=0|this._cl,c=0|this._dl,m=0|this._el,o=0|this._fl,y=0|this._gl,C=0|this._hl,d=0;d<32;d+=2)t[d]=h.readInt32BE(4*d),t[d+1]=h.readInt32BE(4*d+4);for(;d<160;d+=2){var b=t[d-30],p=t[d-30+1],G=Gamma0(b,p),v=Gamma0l(p,b),B=Gamma1(b=t[d-4],p=t[d-4+1]),S=Gamma1l(p,b),w=t[d-14],E=t[d-14+1],I=t[d-32],j=t[d-32+1],q=v+E|0,H=G+w+getCarry(q,v)|0;H=(H=H+B+getCarry(q=q+S|0,S)|0)+I+getCarry(q=q+j|0,j)|0,t[d]=H,t[d+1]=q}for(var W=0;W<160;W+=2){H=t[W],q=t[W+1];var x=maj(i,s,r),A=maj(f,g,u),U=sigma0(i,f),k=sigma0(f,i),z=sigma1(a,m),D=sigma1(m,a),F=K[W],J=K[W+1],L=Ch(a,e,l),M=Ch(m,o,y),N=C+D|0,O=n+z+getCarry(N,C)|0;O=(O=(O=O+L+getCarry(N=N+M|0,M)|0)+F+getCarry(N=N+J|0,J)|0)+H+getCarry(N=N+q|0,q)|0;var P=k+A|0,Q=U+x+getCarry(P,k)|0;n=l,C=y,l=e,y=o,e=a,o=m,a=_+O+getCarry(m=c+N|0,c)|0,_=r,c=u,r=s,u=g,s=i,g=f,i=O+Q+getCarry(f=N+P|0,N)|0}this._al=this._al+f|0,this._bl=this._bl+g|0,this._cl=this._cl+u|0,this._dl=this._dl+c|0,this._el=this._el+m|0,this._fl=this._fl+o|0,this._gl=this._gl+y|0,this._hl=this._hl+C|0,this._ah=this._ah+i+getCarry(this._al,f)|0,this._bh=this._bh+s+getCarry(this._bl,g)|0,this._ch=this._ch+r+getCarry(this._cl,u)|0,this._dh=this._dh+_+getCarry(this._dl,c)|0,this._eh=this._eh+a+getCarry(this._el,m)|0,this._fh=this._fh+e+getCarry(this._fl,o)|0,this._gh=this._gh+l+getCarry(this._gl,y)|0,this._hh=this._hh+n+getCarry(this._hl,C)|0},Sha512.prototype._hash=function(){var h=Buffer.allocUnsafe(64);function t(t,i,s){h.writeInt32BE(t,s),h.writeInt32BE(i,s+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),h},module.exports=Sha512; -},{"./hash":105,"inherits":195,"safe-buffer":446}],113:[function(require,module,exports){ +},{"./hash":116,"inherits":225,"safe-buffer":511}],124:[function(require,module,exports){ "use strict";exports.randomBytes=exports.rng=exports.pseudoRandomBytes=exports.prng=require("randombytes"),exports.createHash=exports.Hash=require("create-hash"),exports.createHmac=exports.Hmac=require("create-hmac");var algos=require("browserify-sign/algos"),algoKeys=Object.keys(algos),hashes=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(algoKeys);exports.getHashes=function(){return hashes};var p=require("pbkdf2");exports.pbkdf2=p.pbkdf2,exports.pbkdf2Sync=p.pbkdf2Sync;var aes=require("browserify-cipher");exports.Cipher=aes.Cipher,exports.createCipher=aes.createCipher,exports.Cipheriv=aes.Cipheriv,exports.createCipheriv=aes.createCipheriv,exports.Decipher=aes.Decipher,exports.createDecipher=aes.createDecipher,exports.Decipheriv=aes.Decipheriv,exports.createDecipheriv=aes.createDecipheriv,exports.getCiphers=aes.getCiphers,exports.listCiphers=aes.listCiphers;var dh=require("diffie-hellman");exports.DiffieHellmanGroup=dh.DiffieHellmanGroup,exports.createDiffieHellmanGroup=dh.createDiffieHellmanGroup,exports.getDiffieHellman=dh.getDiffieHellman,exports.createDiffieHellman=dh.createDiffieHellman,exports.DiffieHellman=dh.DiffieHellman;var sign=require("browserify-sign");exports.createSign=sign.createSign,exports.Sign=sign.Sign,exports.createVerify=sign.createVerify,exports.Verify=sign.Verify,exports.createECDH=require("create-ecdh");var publicEncrypt=require("public-encrypt");exports.publicEncrypt=publicEncrypt.publicEncrypt,exports.privateEncrypt=publicEncrypt.privateEncrypt,exports.publicDecrypt=publicEncrypt.publicDecrypt,exports.privateDecrypt=publicEncrypt.privateDecrypt;var rf=require("randomfill");exports.randomFill=rf.randomFill,exports.randomFillSync=rf.randomFillSync,exports.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},exports.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}; -},{"browserify-cipher":61,"browserify-sign":69,"browserify-sign/algos":66,"create-ecdh":99,"create-hash":101,"create-hmac":103,"diffie-hellman":122,"pbkdf2":266,"public-encrypt":287,"randombytes":428,"randomfill":429}],114:[function(require,module,exports){ -(function (process){ +},{"browserify-cipher":75,"browserify-sign":82,"browserify-sign/algos":79,"create-ecdh":110,"create-hash":112,"create-hmac":114,"diffie-hellman":135,"pbkdf2":332,"public-encrypt":354,"randombytes":507,"randomfill":508}],125:[function(require,module,exports){ +(function (process){(function (){ function useColors(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+module.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;e.splice(1,0,o,"color: inherit");let C=0,t=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(C++,"%c"===e&&(t=C))}),e.splice(t,0,o)}function log(...e){return"object"==typeof console&&console.log&&console.log(...e)}function save(e){try{e?exports.storage.setItem("debug",e):exports.storage.removeItem("debug")}catch(e){}}function load(){let e;try{e=exports.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}function localstorage(){try{return localStorage}catch(e){}}exports.log=log,exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage=localstorage(),exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],module.exports=require("./common")(exports);const{formatters:formatters}=module.exports;formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}; -}).call(this,require('_process')) -},{"./common":115,"_process":284}],115:[function(require,module,exports){ +}).call(this)}).call(this,require('_process')) +},{"./common":126,"_process":349}],126:[function(require,module,exports){ function setup(e){function n(e){let n=0;for(let t=0;t{if("%%"===s)return s;a++;const o=t.formatters[r];if("function"==typeof o){const t=e[a];s=o.call(n,t),e.splice(a,1),a--}return s}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return i.namespace=e,i.enabled=t.enabled(e),i.useColors=t.useColors(),i.color=n(e),i.destroy=s,i.extend=r,"function"==typeof t.init&&t.init(i),t.instances.push(i),i}function s(){const e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}function r(e,n){const s=t(this.namespace+(void 0===n?":":n)+e);return s.log=this.log,s}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(o),...t.skips.map(o).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const s=("string"==typeof e?e:"").split(/[\s,]+/),r=s.length;for(n=0;n{t[n]=e[n]}),t.instances=[],t.names=[],t.skips=[],t.formatters={},t.selectColor=n,t.enable(t.load()),t}module.exports=setup; -},{"ms":228}],116:[function(require,module,exports){ +},{"ms":294}],127:[function(require,module,exports){ +var AbstractIterator=require("abstract-leveldown").AbstractIterator,inherits=require("inherits");function DeferredIterator(t,r){AbstractIterator.call(this,t),this._options=r,this._iterator=null,this._operations=[]}inherits(DeferredIterator,AbstractIterator),DeferredIterator.prototype.setDb=function(t){var r=this._iterator=t.iterator(this._options);this._operations.forEach(function(t){r[t.method].apply(r,t.args)})},DeferredIterator.prototype._operation=function(t,r){if(this._iterator)return this._iterator[t].apply(this._iterator,r);this._operations.push({method:t,args:r})},"next end".split(" ").forEach(function(t){DeferredIterator.prototype["_"+t]=function(){this._operation(t,arguments)}}),DeferredIterator.prototype.seek=function(){this._operation("seek",arguments)},module.exports=DeferredIterator; + +},{"abstract-leveldown":11,"inherits":225}],128:[function(require,module,exports){ +var AbstractLevelDOWN=require("abstract-leveldown").AbstractLevelDOWN,inherits=require("inherits"),DeferredIterator=require("./deferred-iterator"),deferrables="put get del batch clear".split(" "),optionalDeferrables="approximateSize compactRange".split(" ");function DeferredLevelDOWN(e){AbstractLevelDOWN.call(this,e.supports||{}),optionalDeferrables.forEach(function(t){"function"!=typeof e[t]||this.supports.additionalMethods[t]||(this.supports.additionalMethods[t]=!0)},this),this._db=e,this._operations=[],closed(this)}function open(e){deferrables.concat("iterator").forEach(function(t){e["_"+t]=function(){return this._db[t].apply(this._db,arguments)}}),Object.keys(e.supports.additionalMethods).forEach(function(t){e[t]=function(){return this._db[t].apply(this._db,arguments)}})}function closed(e){deferrables.forEach(function(t){e["_"+t]=function(){this._operations.push({method:t,args:arguments})}}),Object.keys(e.supports.additionalMethods).forEach(function(t){e[t]=function(){this._operations.push({method:t,args:arguments})}}),e._iterator=function(t){var r=new DeferredIterator(e,t);return this._operations.push({iterator:r}),r}}inherits(DeferredLevelDOWN,AbstractLevelDOWN),DeferredLevelDOWN.prototype.type="deferred-leveldown",DeferredLevelDOWN.prototype._open=function(e,t){var r=this;this._db.open(e,function(e){if(e)return t(e);r._operations.forEach(function(e){e.iterator?e.iterator.setDb(r._db):r._db[e.method].apply(r._db,e.args)}),r._operations=[],open(r),t()})},DeferredLevelDOWN.prototype._close=function(e){var t=this;this._db.close(function(r){if(r)return e(r);closed(t),e()})},DeferredLevelDOWN.prototype._serializeKey=function(e){return e},DeferredLevelDOWN.prototype._serializeValue=function(e){return e},module.exports=DeferredLevelDOWN,module.exports.DeferredIterator=DeferredIterator; + +},{"./deferred-iterator":127,"abstract-leveldown":11,"inherits":225}],129:[function(require,module,exports){ "use strict";exports.utils=require("./des/utils"),exports.Cipher=require("./des/cipher"),exports.DES=require("./des/des"),exports.CBC=require("./des/cbc"),exports.EDE=require("./des/ede"); -},{"./des/cbc":117,"./des/cipher":118,"./des/des":119,"./des/ede":120,"./des/utils":121}],117:[function(require,module,exports){ +},{"./des/cbc":130,"./des/cipher":131,"./des/des":132,"./des/ede":133,"./des/utils":134}],130:[function(require,module,exports){ "use strict";var assert=require("minimalistic-assert"),inherits=require("inherits"),proto={};function CBCState(t){assert.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var i=0;i0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(f,r);return e+=this._buffer(t,e),f},Cipher.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},Cipher.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=utils.r28shl(r,n),i=utils.r28shl(i,n),utils.pc2(r,i,t.keys,s)}},DES.prototype._update=function(t,e,r,i){var s=this._desState,n=utils.readUInt32BE(t,e),p=utils.readUInt32BE(t,e+4);utils.ip(n,p,s.tmp,0),n=s.tmp[0],p=s.tmp[1],"encrypt"===this.type?this._encrypt(s,n,p,s.tmp,0):this._decrypt(s,n,p,s.tmp,0),n=s.tmp[0],p=s.tmp[1],utils.writeUInt32BE(r,n,i),utils.writeUInt32BE(r,p,i+4)},DES.prototype._pad=function(t,e){for(var r=t.length-e,i=e;i>>0,n=o}utils.rip(p,n,i,s)},DES.prototype._decrypt=function(t,e,r,i,s){for(var n=r,p=e,u=t.keys.length-2;u>=0;u-=2){var l=t.keys[u],a=t.keys[u+1];utils.expand(n,t.tmp,0),l^=t.tmp[0],a^=t.tmp[1];var h=utils.substitute(l,a),o=n;n=(p^utils.permute(h))>>>0,p=o}utils.rip(n,p,i,s)}; -},{"./cipher":118,"./utils":121,"inherits":195,"minimalistic-assert":218}],120:[function(require,module,exports){ +},{"./cipher":131,"./utils":134,"inherits":225,"minimalistic-assert":284}],133:[function(require,module,exports){ "use strict";var assert=require("minimalistic-assert"),inherits=require("inherits"),Cipher=require("./cipher"),DES=require("./des");function EDEState(e,t){assert.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),p=t.slice(8,16),i=t.slice(16,24);this.ciphers="encrypt"===e?[DES.create({type:"encrypt",key:r}),DES.create({type:"decrypt",key:p}),DES.create({type:"encrypt",key:i})]:[DES.create({type:"decrypt",key:i}),DES.create({type:"encrypt",key:p}),DES.create({type:"decrypt",key:r})]}function EDE(e){Cipher.call(this,e);var t=new EDEState(this.type,this.options.key);this._edeState=t}inherits(EDE,Cipher),module.exports=EDE,EDE.create=function(e){return new EDE(e)},EDE.prototype._update=function(e,t,r,p){var i=this._edeState;i.ciphers[0]._update(e,t,r,p),i.ciphers[1]._update(r,p,r,p),i.ciphers[2]._update(r,p,r,p)},EDE.prototype._pad=DES.prototype._pad,EDE.prototype._unpad=DES.prototype._unpad; -},{"./cipher":118,"./des":119,"inherits":195,"minimalistic-assert":218}],121:[function(require,module,exports){ +},{"./cipher":131,"./des":132,"inherits":225,"minimalistic-assert":284}],134:[function(require,module,exports){ "use strict";exports.readUInt32BE=function(r,o){return(r[0+o]<<24|r[1+o]<<16|r[2+o]<<8|r[3+o])>>>0},exports.writeUInt32BE=function(r,o,t){r[0+t]=o>>>24,r[1+t]=o>>>16&255,r[2+t]=o>>>8&255,r[3+t]=255&o},exports.ip=function(r,o,t,e){for(var f=0,n=0,a=6;a>=0;a-=2){for(var p=0;p<=24;p+=8)f<<=1,f|=o>>>p+a&1;for(p=0;p<=24;p+=8)f<<=1,f|=r>>>p+a&1}for(a=6;a>=0;a-=2){for(p=1;p<=25;p+=8)n<<=1,n|=o>>>p+a&1;for(p=1;p<=25;p+=8)n<<=1,n|=r>>>p+a&1}t[e+0]=f>>>0,t[e+1]=n>>>0},exports.rip=function(r,o,t,e){for(var f=0,n=0,a=0;a<4;a++)for(var p=24;p>=0;p-=8)f<<=1,f|=o>>>p+a&1,f<<=1,f|=r>>>p+a&1;for(a=4;a<8;a++)for(p=24;p>=0;p-=8)n<<=1,n|=o>>>p+a&1,n<<=1,n|=r>>>p+a&1;t[e+0]=f>>>0,t[e+1]=n>>>0},exports.pc1=function(r,o,t,e){for(var f=0,n=0,a=7;a>=5;a--){for(var p=0;p<=24;p+=8)f<<=1,f|=o>>p+a&1;for(p=0;p<=24;p+=8)f<<=1,f|=r>>p+a&1}for(p=0;p<=24;p+=8)f<<=1,f|=o>>p+a&1;for(a=1;a<=3;a++){for(p=0;p<=24;p+=8)n<<=1,n|=o>>p+a&1;for(p=0;p<=24;p+=8)n<<=1,n|=r>>p+a&1}for(p=0;p<=24;p+=8)n<<=1,n|=r>>p+a&1;t[e+0]=f>>>0,t[e+1]=n>>>0},exports.r28shl=function(r,o){return r<>>28-o};var pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];exports.pc2=function(r,o,t,e){for(var f=0,n=0,a=pc2table.length>>>1,p=0;p>>pc2table[p]&1;for(p=a;p>>pc2table[p]&1;t[e+0]=f>>>0,t[e+1]=n>>>0},exports.expand=function(r,o,t){var e=0,f=0;e=(1&r)<<5|r>>>27;for(var n=23;n>=15;n-=4)e<<=6,e|=r>>>n&63;for(n=11;n>=3;n-=4)f|=r>>>n&63,f<<=6;f|=(31&r)<<1|r>>>31,o[t+0]=e>>>0,o[t+1]=f>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];exports.substitute=function(r,o){for(var t=0,e=0;e<4;e++){t<<=4,t|=sTable[64*e+(r>>>18-6*e&63)]}for(e=0;e<4;e++){t<<=4,t|=sTable[256+64*e+(o>>>18-6*e&63)]}return t>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];exports.permute=function(r){for(var o=0,t=0;t>>permuteTable[t]&1;return o>>>0},exports.padSplit=function(r,o,t){for(var e=r.toString(2);e.lengthe;)i.ishrn(1);if(i.isEven()&&i.iadd(ONE),i.testn(1)||i.iadd(TWO),r.cmp(TWO)){if(!r.cmp(FIVE))for(;i.mod(TEN).cmp(THREE);)i.iadd(FOUR)}else for(;i.mod(TWENTYFOUR).cmp(ELEVEN);)i.iadd(FOUR);if(simpleSieve(n=i.shrn(1))&&simpleSieve(i)&&fermatTest(n)&&fermatTest(i)&&millerRabin.test(n)&&millerRabin.test(i))return i}} -},{"bn.js":126,"miller-rabin":216,"randombytes":428}],125:[function(require,module,exports){ +},{"bn.js":139,"miller-rabin":282,"randombytes":507}],138:[function(require,module,exports){ module.exports={ "modp1": { "gen": "02", @@ -1013,58 +850,61 @@ module.exports={ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff" } } -},{}],126:[function(require,module,exports){ +},{}],139:[function(require,module,exports){ !function(t,i){"use strict";function r(t,i){if(!t)throw new Error(i||"Assertion failed")}function h(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,i,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var e;"object"==typeof t?t.exports=n:i.BN=n,n.BN=n,n.wordSize=26;try{e=require("buffer").Buffer}catch(t){}function o(t,i,r){for(var h=0,n=Math.min(t.length,r),e=i;e=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return h}function s(t,i,r,h){for(var n=0,e=Math.min(t.length,r),o=i;o=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,i){return t.cmp(i)>0?t:i},n.min=function(t,i){return t.cmp(i)<0?t:i},n.prototype._init=function(t,i,h){if("number"==typeof t)return this._initNumber(t,i,h);if("object"==typeof t)return this._initArray(t,i,h);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===i?this._parseHex(t,n):this._parseBase(t,i,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initNumber=function(t,i,h){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initArray=function(t,i,h){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[e]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===h)for(n=0,e=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this.strip()},n.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r=i;r-=6)n=o(t,r,r+6),this.words[h]|=n<>>26-e&4194303,(e+=24)>=26&&(e-=26,h++);r+6!==i&&(n=o(t,i,r+6),this.words[h]|=n<>>26-e&4194303),this.strip()},n.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var h=0,n=1;n<=67108863;n*=i)h++;h--,n=n/i|0;for(var e=t.length-r,o=e%h,u=Math.min(e,e-o)+r,a=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],a=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,i,r){r.negative=i.negative^t.negative;var h=t.length+i.length|0;r.length=h,h=h-1|0;var n=0|t.words[0],e=0|i.words[0],o=n*e,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(n=0|t.words[p])*(e=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,i){var h;if(i=0|i||1,16===(t=t||10)||"hex"===t){h="";for(var n=0,e=0,o=0;o>>24-n&16777215)||o!==this.length-1?u[6-m.length]+m+h:m+h,(n+=2)>=26&&(n-=26,o--)}for(0!==e&&(h=e.toString(16)+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}if(t===(0|t)&&t>=2&&t<=36){var f=a[t],d=l[t];h="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modn(d).toString(t);h=(p=p.idivn(d)).isZero()?M+h:u[f-M.length]+M+h}for(this.isZero()&&(h="0"+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,i){return r(void 0!==e),this.toArrayLike(e,t,i)},n.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},n.prototype.toArrayLike=function(t,i,h){var n=this.byteLength(),e=h||Math.max(1,n);r(n<=e,"byte array longer than desired length"),r(e>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===i,a=new t(e),l=this.clone();if(u){for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[s]=o;for(;s=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},n.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var h=0;ht.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),h=t%26;this._expand(i),h>0&&i--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-h),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var h=t/26|0,n=t%26;return this._expand(h+1),this.words[h]=i?this.words[h]|1<t.length?(r=this,h=t):(r=t,h=this);for(var n=0,e=0;e>>26;for(;0!==n&&e>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;et.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,h,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,h=t):(r=t,h=this);for(var e=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==e&&o>26,this.words[o]=67108863&i;if(0===e&&o>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],g=8191&v,c=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,x=0|o[5],S=8191&x,Z=x>>>13,q=0|o[6],R=8191&q,B=q>>>13,N=0|o[7],L=8191&N,I=N>>>13,z=0|o[8],T=8191&z,E=z>>>13,O=0|o[9],j=8191&O,K=O>>>13,P=0|s[0],F=8191&P,C=P>>>13,D=0|s[1],H=8191&D,J=D>>>13,U=0|s[2],G=8191&U,Q=U>>>13,V=0|s[3],W=8191&V,X=V>>>13,Y=0|s[4],$=8191&Y,tt=Y>>>13,it=0|s[5],rt=8191&it,ht=it>>>13,nt=0|s[6],et=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(h=Math.imul(m,F))|0)+((8191&(n=(n=Math.imul(m,C))+Math.imul(f,F)|0))<<13)|0;a=((e=Math.imul(f,C))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,h=Math.imul(p,F),n=(n=Math.imul(p,C))+Math.imul(M,F)|0,e=Math.imul(M,C);var gt=(a+(h=h+Math.imul(m,H)|0)|0)+((8191&(n=(n=n+Math.imul(m,J)|0)+Math.imul(f,H)|0))<<13)|0;a=((e=e+Math.imul(f,J)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,h=Math.imul(g,F),n=(n=Math.imul(g,C))+Math.imul(c,F)|0,e=Math.imul(c,C),h=h+Math.imul(p,H)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(M,H)|0,e=e+Math.imul(M,J)|0;var ct=(a+(h=h+Math.imul(m,G)|0)|0)+((8191&(n=(n=n+Math.imul(m,Q)|0)+Math.imul(f,G)|0))<<13)|0;a=((e=e+Math.imul(f,Q)|0)+(n>>>13)|0)+(ct>>>26)|0,ct&=67108863,h=Math.imul(y,F),n=(n=Math.imul(y,C))+Math.imul(b,F)|0,e=Math.imul(b,C),h=h+Math.imul(g,H)|0,n=(n=n+Math.imul(g,J)|0)+Math.imul(c,H)|0,e=e+Math.imul(c,J)|0,h=h+Math.imul(p,G)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(M,G)|0,e=e+Math.imul(M,Q)|0;var wt=(a+(h=h+Math.imul(m,W)|0)|0)+((8191&(n=(n=n+Math.imul(m,X)|0)+Math.imul(f,W)|0))<<13)|0;a=((e=e+Math.imul(f,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,h=Math.imul(k,F),n=(n=Math.imul(k,C))+Math.imul(A,F)|0,e=Math.imul(A,C),h=h+Math.imul(y,H)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,H)|0,e=e+Math.imul(b,J)|0,h=h+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Q)|0)+Math.imul(c,G)|0,e=e+Math.imul(c,Q)|0,h=h+Math.imul(p,W)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(M,W)|0,e=e+Math.imul(M,X)|0;var yt=(a+(h=h+Math.imul(m,$)|0)|0)+((8191&(n=(n=n+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((e=e+Math.imul(f,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,h=Math.imul(S,F),n=(n=Math.imul(S,C))+Math.imul(Z,F)|0,e=Math.imul(Z,C),h=h+Math.imul(k,H)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,H)|0,e=e+Math.imul(A,J)|0,h=h+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,G)|0,e=e+Math.imul(b,Q)|0,h=h+Math.imul(g,W)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(c,W)|0,e=e+Math.imul(c,X)|0,h=h+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(M,$)|0,e=e+Math.imul(M,tt)|0;var bt=(a+(h=h+Math.imul(m,rt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ht)|0)+Math.imul(f,rt)|0))<<13)|0;a=((e=e+Math.imul(f,ht)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,h=Math.imul(R,F),n=(n=Math.imul(R,C))+Math.imul(B,F)|0,e=Math.imul(B,C),h=h+Math.imul(S,H)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(Z,H)|0,e=e+Math.imul(Z,J)|0,h=h+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Q)|0)+Math.imul(A,G)|0,e=e+Math.imul(A,Q)|0,h=h+Math.imul(y,W)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(b,W)|0,e=e+Math.imul(b,X)|0,h=h+Math.imul(g,$)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(c,$)|0,e=e+Math.imul(c,tt)|0,h=h+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(M,rt)|0,e=e+Math.imul(M,ht)|0;var _t=(a+(h=h+Math.imul(m,et)|0)|0)+((8191&(n=(n=n+Math.imul(m,ot)|0)+Math.imul(f,et)|0))<<13)|0;a=((e=e+Math.imul(f,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,h=Math.imul(L,F),n=(n=Math.imul(L,C))+Math.imul(I,F)|0,e=Math.imul(I,C),h=h+Math.imul(R,H)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,H)|0,e=e+Math.imul(B,J)|0,h=h+Math.imul(S,G)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(Z,G)|0,e=e+Math.imul(Z,Q)|0,h=h+Math.imul(k,W)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(A,W)|0,e=e+Math.imul(A,X)|0,h=h+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|0,e=e+Math.imul(b,tt)|0,h=h+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(c,rt)|0,e=e+Math.imul(c,ht)|0,h=h+Math.imul(p,et)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(M,et)|0,e=e+Math.imul(M,ot)|0;var kt=(a+(h=h+Math.imul(m,ut)|0)|0)+((8191&(n=(n=n+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((e=e+Math.imul(f,at)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,h=Math.imul(T,F),n=(n=Math.imul(T,C))+Math.imul(E,F)|0,e=Math.imul(E,C),h=h+Math.imul(L,H)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(I,H)|0,e=e+Math.imul(I,J)|0,h=h+Math.imul(R,G)|0,n=(n=n+Math.imul(R,Q)|0)+Math.imul(B,G)|0,e=e+Math.imul(B,Q)|0,h=h+Math.imul(S,W)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(Z,W)|0,e=e+Math.imul(Z,X)|0,h=h+Math.imul(k,$)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,$)|0,e=e+Math.imul(A,tt)|0,h=h+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(b,rt)|0,e=e+Math.imul(b,ht)|0,h=h+Math.imul(g,et)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(c,et)|0,e=e+Math.imul(c,ot)|0,h=h+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(M,ut)|0,e=e+Math.imul(M,at)|0;var At=(a+(h=h+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((e=e+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,h=Math.imul(j,F),n=(n=Math.imul(j,C))+Math.imul(K,F)|0,e=Math.imul(K,C),h=h+Math.imul(T,H)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(E,H)|0,e=e+Math.imul(E,J)|0,h=h+Math.imul(L,G)|0,n=(n=n+Math.imul(L,Q)|0)+Math.imul(I,G)|0,e=e+Math.imul(I,Q)|0,h=h+Math.imul(R,W)|0,n=(n=n+Math.imul(R,X)|0)+Math.imul(B,W)|0,e=e+Math.imul(B,X)|0,h=h+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(Z,$)|0,e=e+Math.imul(Z,tt)|0,h=h+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,rt)|0,e=e+Math.imul(A,ht)|0,h=h+Math.imul(y,et)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,et)|0,e=e+Math.imul(b,ot)|0,h=h+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(c,ut)|0,e=e+Math.imul(c,at)|0,h=h+Math.imul(p,mt)|0,n=(n=n+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,e=e+Math.imul(M,ft)|0;var xt=(a+(h=h+Math.imul(m,pt)|0)|0)+((8191&(n=(n=n+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((e=e+Math.imul(f,Mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h=Math.imul(j,H),n=(n=Math.imul(j,J))+Math.imul(K,H)|0,e=Math.imul(K,J),h=h+Math.imul(T,G)|0,n=(n=n+Math.imul(T,Q)|0)+Math.imul(E,G)|0,e=e+Math.imul(E,Q)|0,h=h+Math.imul(L,W)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(I,W)|0,e=e+Math.imul(I,X)|0,h=h+Math.imul(R,$)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(B,$)|0,e=e+Math.imul(B,tt)|0,h=h+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(Z,rt)|0,e=e+Math.imul(Z,ht)|0,h=h+Math.imul(k,et)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(A,et)|0,e=e+Math.imul(A,ot)|0,h=h+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,e=e+Math.imul(b,at)|0,h=h+Math.imul(g,mt)|0,n=(n=n+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,e=e+Math.imul(c,ft)|0;var St=(a+(h=h+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((e=e+Math.imul(M,Mt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,h=Math.imul(j,G),n=(n=Math.imul(j,Q))+Math.imul(K,G)|0,e=Math.imul(K,Q),h=h+Math.imul(T,W)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(E,W)|0,e=e+Math.imul(E,X)|0,h=h+Math.imul(L,$)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(I,$)|0,e=e+Math.imul(I,tt)|0,h=h+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(B,rt)|0,e=e+Math.imul(B,ht)|0,h=h+Math.imul(S,et)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(Z,et)|0,e=e+Math.imul(Z,ot)|0,h=h+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ut)|0,e=e+Math.imul(A,at)|0,h=h+Math.imul(y,mt)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,e=e+Math.imul(b,ft)|0;var Zt=(a+(h=h+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,Mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((e=e+Math.imul(c,Mt)|0)+(n>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,h=Math.imul(j,W),n=(n=Math.imul(j,X))+Math.imul(K,W)|0,e=Math.imul(K,X),h=h+Math.imul(T,$)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(E,$)|0,e=e+Math.imul(E,tt)|0,h=h+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(I,rt)|0,e=e+Math.imul(I,ht)|0,h=h+Math.imul(R,et)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(B,et)|0,e=e+Math.imul(B,ot)|0,h=h+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul(Z,ut)|0,e=e+Math.imul(Z,at)|0,h=h+Math.imul(k,mt)|0,n=(n=n+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,e=e+Math.imul(A,ft)|0;var qt=(a+(h=h+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((e=e+Math.imul(b,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,h=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(K,$)|0,e=Math.imul(K,tt),h=h+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(E,rt)|0,e=e+Math.imul(E,ht)|0,h=h+Math.imul(L,et)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(I,et)|0,e=e+Math.imul(I,ot)|0,h=h+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(B,ut)|0,e=e+Math.imul(B,at)|0,h=h+Math.imul(S,mt)|0,n=(n=n+Math.imul(S,ft)|0)+Math.imul(Z,mt)|0,e=e+Math.imul(Z,ft)|0;var Rt=(a+(h=h+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((e=e+Math.imul(A,Mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,h=Math.imul(j,rt),n=(n=Math.imul(j,ht))+Math.imul(K,rt)|0,e=Math.imul(K,ht),h=h+Math.imul(T,et)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(E,et)|0,e=e+Math.imul(E,ot)|0,h=h+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,at)|0)+Math.imul(I,ut)|0,e=e+Math.imul(I,at)|0,h=h+Math.imul(R,mt)|0,n=(n=n+Math.imul(R,ft)|0)+Math.imul(B,mt)|0,e=e+Math.imul(B,ft)|0;var Bt=(a+(h=h+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,Mt)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((e=e+Math.imul(Z,Mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,h=Math.imul(j,et),n=(n=Math.imul(j,ot))+Math.imul(K,et)|0,e=Math.imul(K,ot),h=h+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(E,ut)|0,e=e+Math.imul(E,at)|0,h=h+Math.imul(L,mt)|0,n=(n=n+Math.imul(L,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Nt=(a+(h=h+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,Mt)|0)+Math.imul(B,pt)|0))<<13)|0;a=((e=e+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h=Math.imul(j,ut),n=(n=Math.imul(j,at))+Math.imul(K,ut)|0,e=Math.imul(K,at),h=h+Math.imul(T,mt)|0,n=(n=n+Math.imul(T,ft)|0)+Math.imul(E,mt)|0,e=e+Math.imul(E,ft)|0;var Lt=(a+(h=h+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h=Math.imul(j,mt),n=(n=Math.imul(j,ft))+Math.imul(K,mt)|0,e=Math.imul(K,ft);var It=(a+(h=h+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,Mt)|0)+Math.imul(E,pt)|0))<<13)|0;a=((e=e+Math.imul(E,Mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var zt=(a+(h=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(K,pt)|0))<<13)|0;return a=((e=Math.imul(K,Mt))+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863,u[0]=vt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=xt,u[10]=St,u[11]=Zt,u[12]=qt,u[13]=Rt,u[14]=Bt,u[15]=Nt,u[16]=Lt,u[17]=It,u[18]=zt,0!==a&&(u[19]=a,r.length++),r};function d(t,i,r){return(new p).mulp(t,i,r)}function p(t,i){this.x=t,this.y=i}Math.imul||(f=m),n.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,i):r<63?m(this,t,i):r<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var h=0,n=0,e=0;e>>26)|0)>>>26,o&=67108863}r.words[e]=s,h=o,o=n}return 0!==h?r.words[e]=h:r.length--,r.strip()}(this,t,i):d(this,t,i)},p.prototype.makeRBT=function(t){for(var i=new Array(t),r=n.prototype._countBits(t)-1,h=0;h>=1;return h},p.prototype.permute=function(t,i,r,h,n,e){for(var o=0;o>>=1)n++;return 1<>>=13,h[2*o+1]=8191&e,e>>>=13;for(o=2*i;o>=26,i+=n/67108864|0,i+=e>>>26,this.words[h]=67108863&e}return 0!==i&&(this.words[h]=i,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r>>n}return i}(t);if(0===i.length)return new n(1);for(var r=this,h=0;h=0);var i,h=t%26,n=(t-h)/26,e=67108863>>>26-h<<26-h;if(0!==h){var o=0;for(i=0;i>>26-h}o&&(this.words[i]=o,this.length++)}if(0!==n){for(i=this.length-1;i>=0;i--)this.words[i+n]=this.words[i];for(i=0;i=0),n=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<o)for(this.length-=o,a=0;a=0&&(0!==l||a>=n);a--){var m=0|this.words[a];this.words[a]=l<<26-e|m>>>e,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,i,h){return r(0===this.negative),this.iushrn(t,i,h)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,h=(t-i)/26,n=1<=0);var i=t%26,h=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=h)return this;if(0!==i&&h++,this.length=Math.min(h,this.length),0!==i){var n=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(u/67108864|0),this.words[n+h]=67108863&e}for(;n>26,this.words[n+h]=67108863&e;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n>26,this.words[n]=67108863&e;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,i){var r=(this.length,t.length),h=this.clone(),e=t,o=0|e.words[e.length-1];0!==(r=26-this._countBits(o))&&(e=e.ushln(r),h.iushln(r),o=0|e.words[e.length-1]);var s,u=h.length-e.length;if("mod"!==i){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a=0;m--){var f=67108864*(0|h.words[e.length+m])+(0|h.words[e.length+m-1]);for(f=Math.min(f/o|0,67108863),h._ishlnsubmul(e,f,m);0!==h.negative;)f--,h.negative=0,h._ishlnsubmul(e,1,m),h.isZero()||(h.negative^=1);s&&(s.words[m]=f)}return s&&s.strip(),h.strip(),"div"!==i&&0!==r&&h.iushrn(r),{div:s||null,mod:h}},n.prototype.divmod=function(t,i,h){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,h=t.ushrn(1),n=t.andln(1),e=r.cmp(h);return e<0||1===n&&0===e?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var i=(1<<26)%t,h=0,n=this.length-1;n>=0;n--)h=(i*h+(0|this.words[n]))%t;return h},n.prototype.idivn=function(t){r(t<=67108863);for(var i=0,h=this.length-1;h>=0;h--){var n=(0|this.words[h])+67108864*i;this.words[h]=n/t|0,i=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new n(1),o=new n(0),s=new n(0),u=new n(1),a=0;i.isEven()&&h.isEven();)i.iushrn(1),h.iushrn(1),++a;for(var l=h.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(m)),e.iushrn(1),o.iushrn(1);for(var p=0,M=1;0==(h.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(h.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(h)>=0?(i.isub(h),e.isub(s),o.isub(u)):(h.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:h.iushln(a)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new n(1),s=new n(0),u=h.clone();i.cmpn(1)>0&&h.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(h.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(h.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(h)>=0?(i.isub(h),o.isub(s)):(h.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var h=0;i.isEven()&&r.isEven();h++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=i.cmp(r);if(n<0){var e=i;i=r,r=e}else if(0===n||0===r.cmpn(1))break;i.isub(r)}return r.iushln(h)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,h=(t-i)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var i,h=t<0;if(0!==this.negative&&!h)return-1;if(0===this.negative&&h)return 1;if(this.strip(),this.length>1)i=1;else{h&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:nt.length)return 1;if(this.length=0;r--){var h=0|this.words[r],n=0|t.words[r];if(h!==n){hn&&(i=1);break}}return i},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new b(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};function v(t,i){this.name=t,this.p=new n(i,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function c(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function b(t){if("string"==typeof t){var i=n._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){b.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var h=i0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,i){t.iushrn(this.n,0,i)},v.prototype.imulK=function(t){return t.imul(this.k)},h(g,v),g.prototype.split=function(t,i){for(var r=Math.min(t.length,9),h=0;h>>22,n=e}n>>>=22,t.words[h-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r>>=26,t.words[r]=n,i=h}return 0!==i&&(t.words[t.length++]=i),t},n._prime=function(t){if(M[t])return M[t];var i;if("k256"===t)i=new g;else if("p224"===t)i=new c;else if("p192"===t)i=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new y}return M[t]=i,i},b.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},b.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},b.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},b.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},b.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},b.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},b.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},b.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},b.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},b.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},b.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},b.prototype.isqr=function(t){return this.imul(t,t.clone())},b.prototype.sqr=function(t){return this.mul(t,t)},b.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var h=this.m.add(new n(1)).iushrn(2);return this.pow(t,h)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new n(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,e),f=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();r(v=0;h--){for(var a=i.words[h],l=u-1;l>=0;l--){var m=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===h&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},b.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},b.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},n.mont=function(t){return new _(t)},h(_,b),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},_.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(h).iushrn(this.shift),e=n;return n.cmp(this.m)>=0?e=n.isub(this.m):n.cmpn(0)<0&&(e=n.iadd(this.m)),e._forceRed(this)},_.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new n(0)._forceRed(this);var r=t.mul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(h).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof module||module,this); -},{"buffer":43}],127:[function(require,module,exports){ +},{"buffer":57}],140:[function(require,module,exports){ +!function(r,n){"use strict";"undefined"!=typeof module&&module.exports?module.exports=n(require("tweetnacl/nacl-fast")):r.ed2curve=n(r.nacl)}(this,function(r){"use strict";if(!r)throw new Error("tweetnacl not loaded");var n=function(r){var n,o=new Float64Array(16);if(r)for(n=0;n=0;e--)c(t,t),2!==e&&4!==e&&f(t,t,o);for(e=0;e<16;e++)r[e]=t[e]}(l,l),f(a,a,l),function(r,o){var f,c,u,i=n(),a=n();for(f=0;f<16;f++)a[f]=o[f];for(e(a),e(a),e(a),c=0;c<2;c++){for(i[0]=a[0]-65517,f=1;f<15;f++)i[f]=a[f]-65535-(i[f-1]>>16&1),i[f-1]&=65535;i[15]=a[15]-32767-(i[14]>>16&1),u=i[15]>>16&1,i[14]&=65535,t(a,i,1-u)}for(f=0;f<16;f++)r[2*f]=255&a[f],r[2*f+1]=a[f]>>8}(u,a),u}function i(n){var o,e=new Uint8Array(64),t=new Uint8Array(32);for(r.lowlevel.crypto_hash(e,n,32),e[0]&=248,e[31]&=127,e[31]|=64,o=0;o<32;o++)t[o]=e[o];for(o=0;o<64;o++)e[o]=0;return t}return{convertPublicKey:u,convertSecretKey:i,convertKeyPair:function(r){return{publicKey:u(r.publicKey),secretKey:i(r.secretKey)}}}}); + +},{"tweetnacl/nacl-fast":660}],141:[function(require,module,exports){ "use strict";var elliptic=exports;elliptic.version=require("../package.json").version,elliptic.utils=require("./elliptic/utils"),elliptic.rand=require("brorand"),elliptic.curve=require("./elliptic/curve"),elliptic.curves=require("./elliptic/curves"),elliptic.ec=require("./elliptic/ec"),elliptic.eddsa=require("./elliptic/eddsa"); -},{"../package.json":143,"./elliptic/curve":130,"./elliptic/curves":133,"./elliptic/ec":134,"./elliptic/eddsa":137,"./elliptic/utils":141,"brorand":42}],128:[function(require,module,exports){ +},{"../package.json":157,"./elliptic/curve":144,"./elliptic/curves":147,"./elliptic/ec":148,"./elliptic/eddsa":151,"./elliptic/utils":155,"brorand":56}],142:[function(require,module,exports){ "use strict";var BN=require("bn.js"),utils=require("../utils"),getNAF=utils.getNAF,getJSF=utils.getJSF,assert=utils.assert;function BaseCurve(t,e){this.type=t,this.p=new BN(e.p,16),this.red=e.prime?BN.red(e.prime):BN.mont(this.p),this.zero=new BN(0).toRed(this.red),this.one=new BN(1).toRed(this.red),this.two=new BN(2).toRed(this.red),this.n=e.n&&new BN(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(t,e){this.curve=t,this.type=e,this.precomputed=null}module.exports=BaseCurve,BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(t,e){assert(t.precomputed);var n=t._getDoubles(),r=getNAF(e,1,this._bitLength),i=(1<=s;e--)a=(a<<1)+r[e];o.push(a)}for(var u=this.jpoint(null,null,null),p=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;a--){for(e=0;a>=0&&0===o[a];a--)e++;if(a>=0&&e++,s=s.dblp(e),a<0)break;var u=o[a];assert(0!==u),s="affine"===t.type?u>0?s.mixedAdd(i[u-1>>1]):s.mixedAdd(i[-u-1>>1].neg()):u>0?s.add(i[u-1>>1]):s.add(i[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},BaseCurve.prototype._wnafMulAdd=function(t,e,n,r,i){for(var o=this._wnafT1,s=this._wnafT2,a=this._wnafT3,u=0,p=0;p=1;p-=2){var d=p-1,l=p;if(1===o[d]&&1===o[l]){var f=[e[d],null,null,e[l]];0===e[d].y.cmp(e[l].y)?(f[1]=e[d].add(e[l]),f[2]=e[d].toJ().mixedAdd(e[l].neg())):0===e[d].y.cmp(e[l].y.redNeg())?(f[1]=e[d].toJ().mixedAdd(e[l]),f[2]=e[d].add(e[l].neg())):(f[1]=e[d].toJ().mixedAdd(e[l]),f[2]=e[d].toJ().mixedAdd(e[l].neg()));var c=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF(n[d],n[l]);u=Math.max(g[0].length,u),a[d]=new Array(u),a[l]=new Array(u);for(var v=0;v=0;p--){for(var b=0;p>=0;){var A=!0;for(v=0;v=0&&b++,w=w.dblp(b),p<0)break;for(v=0;v0?_=s[v][N-1>>1]:N<0&&(_=s[v][-N-1>>1].neg()),w="affine"===_.type?w.mixedAdd(_):w.add(_))}}for(p=0;p=Math.ceil((t.bitLength()+1)/e.step)},BasePoint.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i":""},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Point.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),e=this.z.redSqr();e=e.redIAdd(e);var i=this.curve._mulA(t),d=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),s=i.redAdd(r),u=s.redSub(e),n=i.redSub(r),h=d.redMul(u),o=s.redMul(n),l=d.redMul(n),c=u.redMul(s);return this.curve.point(h,o,c,l)},Point.prototype._projDbl=function(){var t,r,e,i=this.x.redAdd(this.y).redSqr(),d=this.x.redSqr(),s=this.y.redSqr();if(this.curve.twisted){var u=(o=this.curve._mulA(d)).redAdd(s);if(this.zOne)t=i.redSub(d).redSub(s).redMul(u.redSub(this.curve.two)),r=u.redMul(o.redSub(s)),e=u.redSqr().redSub(u).redSub(u);else{var n=this.z.redSqr(),h=u.redSub(n).redISub(n);t=i.redSub(d).redISub(s).redMul(h),r=u.redMul(o.redSub(s)),e=u.redMul(h)}}else{var o=d.redAdd(s);n=this.curve._mulC(this.z).redSqr(),h=o.redSub(n).redSub(n);t=this.curve._mulC(i.redISub(o)).redMul(h),r=this.curve._mulC(o).redMul(d.redISub(s)),e=o.redMul(h)}return this.curve.point(t,r,e)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),e=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),d=this.z.redMul(t.z.redAdd(t.z)),s=e.redSub(r),u=d.redSub(i),n=d.redAdd(i),h=e.redAdd(r),o=s.redMul(u),l=n.redMul(h),c=s.redMul(h),p=u.redMul(n);return this.curve.point(o,l,p,c)},Point.prototype._projAdd=function(t){var r,e,i=this.z.redMul(t.z),d=i.redSqr(),s=this.x.redMul(t.x),u=this.y.redMul(t.y),n=this.curve.d.redMul(s).redMul(u),h=d.redSub(n),o=d.redAdd(n),l=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(u),c=i.redMul(h).redMul(l);return this.curve.twisted?(r=i.redMul(o).redMul(u.redSub(this.curve._mulA(s))),e=h.redMul(o)):(r=i.redMul(o).redMul(u.redSub(s)),e=this.curve._mulC(h).redMul(o)),this.curve.point(c,r,e)},Point.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},Point.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},Point.prototype.mulAdd=function(t,r,e){return this.curve._wnafMulAdd(1,[this,r],[t,e],2,!1)},Point.prototype.jmulAdd=function(t,r,e){return this.curve._wnafMulAdd(1,[this,r],[t,e],2,!0)},Point.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},Point.prototype.eqXToP=function(t){var r=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(r))return!0;for(var e=t.clone(),i=this.curve.redN.redMul(this.z);;){if(e.iadd(this.curve.n),e.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add; -},{"../utils":141,"./base":128,"bn.js":142,"inherits":195}],130:[function(require,module,exports){ +},{"../utils":155,"./base":142,"bn.js":156,"inherits":225}],144:[function(require,module,exports){ "use strict";var curve=exports;curve.base=require("./base"),curve.short=require("./short"),curve.mont=require("./mont"),curve.edwards=require("./edwards"); -},{"./base":128,"./edwards":129,"./mont":131,"./short":132}],131:[function(require,module,exports){ +},{"./base":142,"./edwards":143,"./mont":145,"./short":146}],145:[function(require,module,exports){ "use strict";var BN=require("bn.js"),inherits=require("inherits"),Base=require("./base"),utils=require("../utils");function MontCurve(t){Base.call(this,"mont",t),this.a=new BN(t.a,16).toRed(this.red),this.b=new BN(t.b,16).toRed(this.red),this.i4=new BN(4).toRed(this.red).redInvm(),this.two=new BN(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function Point(t,r,e){Base.BasePoint.call(this,t,"projective"),null===r&&null===e?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN(r,16),this.z=new BN(e,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits(MontCurve,Base),module.exports=MontCurve,MontCurve.prototype.validate=function(t){var r=t.normalize().x,e=r.redSqr(),i=e.redMul(r).redAdd(e.redMul(this.a)).redAdd(r);return 0===i.redSqrt().redSqr().cmp(i)},inherits(Point,Base.BasePoint),MontCurve.prototype.decodePoint=function(t,r){return this.point(utils.toArray(t,r),1)},MontCurve.prototype.point=function(t,r){return new Point(this,t,r)},MontCurve.prototype.pointFromJSON=function(t){return Point.fromJSON(this,t)},Point.prototype.precompute=function(){},Point.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point.fromJSON=function(t,r){return new Point(t,r[0],r[1]||t.one)},Point.prototype.inspect=function(){return this.isInfinity()?"":""},Point.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),r=this.x.redSub(this.z).redSqr(),e=t.redSub(r),i=t.redMul(r),o=e.redMul(r.redAdd(this.curve.a24.redMul(e)));return this.curve.point(i,o)},Point.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(t,r){var e=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),n=t.x.redSub(t.z).redMul(e),d=o.redMul(i),u=r.z.redMul(n.redAdd(d).redSqr()),s=r.x.redMul(n.redISub(d).redSqr());return this.curve.point(u,s)},Point.prototype.mul=function(t){for(var r=t.clone(),e=this,i=this.curve.point(null,null),o=[];0!==r.cmpn(0);r.iushrn(1))o.push(r.andln(1));for(var n=o.length-1;n>=0;n--)0===o[n]?(e=e.diffAdd(i,this),i=i.dbl()):(i=e.diffAdd(i,this),e=e.dbl());return i},Point.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},Point.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()}; -},{"../utils":141,"./base":128,"bn.js":142,"inherits":195}],132:[function(require,module,exports){ +},{"../utils":155,"./base":142,"bn.js":156,"inherits":225}],146:[function(require,module,exports){ "use strict";var utils=require("../utils"),BN=require("bn.js"),inherits=require("inherits"),Base=require("./base"),assert=utils.assert;function ShortCurve(r){Base.call(this,"short",r),this.a=new BN(r.a,16).toRed(this.red),this.b=new BN(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function Point(r,e,t,d){Base.BasePoint.call(this,r,"affine"),null===e&&null===t?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN(e,16),this.y=new BN(t,16),d&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(r,e,t,d){Base.BasePoint.call(this,r,"jacobian"),null===e&&null===t&&null===d?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN(0)):(this.x=new BN(e,16),this.y=new BN(t,16),this.z=new BN(d,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits(ShortCurve,Base),module.exports=ShortCurve,ShortCurve.prototype._getEndomorphism=function(r){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,t;if(r.beta)e=new BN(r.beta,16).toRed(this.red);else{var d=this._getEndoRoots(this.p);e=(e=d[0].cmp(d[1])<0?d[0]:d[1]).toRed(this.red)}if(r.lambda)t=new BN(r.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?t=i[0]:(t=i[1],assert(0===this.g.mul(t).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:t,basis:r.basis?r.basis.map(function(r){return{a:new BN(r.a,16),b:new BN(r.b,16)}}):this._getEndoBasis(t)}}},ShortCurve.prototype._getEndoRoots=function(r){var e=r===this.p?this.red:BN.mont(r),t=new BN(2).toRed(e).redInvm(),d=t.redNeg(),i=new BN(3).toRed(e).redNeg().redSqrt().redMul(t);return[d.redAdd(i).fromRed(),d.redSub(i).fromRed()]},ShortCurve.prototype._getEndoBasis=function(r){for(var e,t,d,i,n,u,s,o,h,p=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=r,a=this.n.clone(),f=new BN(1),c=new BN(0),S=new BN(0),v=new BN(1),b=0;0!==l.cmpn(0);){var I=a.div(l);o=a.sub(I.mul(l)),h=S.sub(I.mul(f));var y=v.sub(I.mul(c));if(!d&&o.cmp(p)<0)e=s.neg(),t=f,d=o.neg(),i=h;else if(d&&2==++b)break;s=o,a=l,l=o,S=f,f=h,v=c,c=y}n=o.neg(),u=h;var A=d.sqr().add(i.sqr());return n.sqr().add(u.sqr()).cmp(A)>=0&&(n=e,u=t),d.negative&&(d=d.neg(),i=i.neg()),n.negative&&(n=n.neg(),u=u.neg()),[{a:d,b:i},{a:n,b:u}]},ShortCurve.prototype._endoSplit=function(r){var e=this.endo.basis,t=e[0],d=e[1],i=d.b.mul(r).divRound(this.n),n=t.b.neg().mul(r).divRound(this.n),u=i.mul(t.a),s=n.mul(d.a),o=i.mul(t.b),h=n.mul(d.b);return{k1:r.sub(u).sub(s),k2:o.add(h).neg()}},ShortCurve.prototype.pointFromX=function(r,e){(r=new BN(r,16)).red||(r=r.toRed(this.red));var t=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),d=t.redSqrt();if(0!==d.redSqr().redSub(t).cmp(this.zero))throw new Error("invalid point");var i=d.fromRed().isOdd();return(e&&!i||!e&&i)&&(d=d.redNeg()),this.point(r,d)},ShortCurve.prototype.validate=function(r){if(r.inf)return!0;var e=r.x,t=r.y,d=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(d).redIAdd(this.b);return 0===t.redSqr().redISub(i).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(r,e,t){for(var d=this._endoWnafT1,i=this._endoWnafT2,n=0;n":""},Point.prototype.isInfinity=function(){return this.inf},Point.prototype.add=function(r){if(this.inf)return r;if(r.inf)return this;if(this.eq(r))return this.dbl();if(this.neg().eq(r))return this.curve.point(null,null);if(0===this.x.cmp(r.x))return this.curve.point(null,null);var e=this.y.redSub(r.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(r.x).redInvm()));var t=e.redSqr().redISub(this.x).redISub(r.x),d=e.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,d)},Point.prototype.dbl=function(){if(this.inf)return this;var r=this.y.redAdd(this.y);if(0===r.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,t=this.x.redSqr(),d=r.redInvm(),i=t.redAdd(t).redIAdd(t).redIAdd(e).redMul(d),n=i.redSqr().redISub(this.x.redAdd(this.x)),u=i.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,u)},Point.prototype.getX=function(){return this.x.fromRed()},Point.prototype.getY=function(){return this.y.fromRed()},Point.prototype.mul=function(r){return r=new BN(r,16),this.isInfinity()?this:this._hasDoubles(r)?this.curve._fixedNafMul(this,r):this.curve.endo?this.curve._endoWnafMulAdd([this],[r]):this.curve._wnafMul(this,r)},Point.prototype.mulAdd=function(r,e,t){var d=[this,e],i=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(d,i):this.curve._wnafMulAdd(1,d,i,2)},Point.prototype.jmulAdd=function(r,e,t){var d=[this,e],i=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(d,i,!0):this.curve._wnafMulAdd(1,d,i,2,!0)},Point.prototype.eq=function(r){return this===r||this.inf===r.inf&&(this.inf||0===this.x.cmp(r.x)&&0===this.y.cmp(r.y))},Point.prototype.neg=function(r){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(r&&this.precomputed){var t=this.precomputed,d=function(r){return r.neg()};e.precomputed={naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(d)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(d)}}}return e},Point.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits(JPoint,Base.BasePoint),ShortCurve.prototype.jpoint=function(r,e,t){return new JPoint(this,r,e,t)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var r=this.z.redInvm(),e=r.redSqr(),t=this.x.redMul(e),d=this.y.redMul(e).redMul(r);return this.curve.point(t,d)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(r){if(this.isInfinity())return r;if(r.isInfinity())return this;var e=r.z.redSqr(),t=this.z.redSqr(),d=this.x.redMul(e),i=r.x.redMul(t),n=this.y.redMul(e.redMul(r.z)),u=r.y.redMul(t.redMul(this.z)),s=d.redSub(i),o=n.redSub(u);if(0===s.cmpn(0))return 0!==o.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),p=h.redMul(s),l=d.redMul(h),a=o.redSqr().redIAdd(p).redISub(l).redISub(l),f=o.redMul(l.redISub(a)).redISub(n.redMul(p)),c=this.z.redMul(r.z).redMul(s);return this.curve.jpoint(a,f,c)},JPoint.prototype.mixedAdd=function(r){if(this.isInfinity())return r.toJ();if(r.isInfinity())return this;var e=this.z.redSqr(),t=this.x,d=r.x.redMul(e),i=this.y,n=r.y.redMul(e).redMul(this.z),u=t.redSub(d),s=i.redSub(n);if(0===u.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var o=u.redSqr(),h=o.redMul(u),p=t.redMul(o),l=s.redSqr().redIAdd(h).redISub(p).redISub(p),a=s.redMul(p.redISub(l)).redISub(i.redMul(h)),f=this.z.redMul(u);return this.curve.jpoint(l,a,f)},JPoint.prototype.dblp=function(r){if(0===r)return this;if(this.isInfinity())return this;if(!r)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,t=0;t=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},JPoint.prototype.inspect=function(){return this.isInfinity()?"":""},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}; -},{"../utils":141,"./base":128,"bn.js":142,"inherits":195}],133:[function(require,module,exports){ +},{"../utils":155,"./base":142,"bn.js":156,"inherits":225}],147:[function(require,module,exports){ "use strict";var pre,curves=exports,hash=require("hash.js"),curve=require("./curve"),utils=require("./utils"),assert=utils.assert;function PresetCurve(f){"short"===f.type?this.curve=new curve.short(f):"edwards"===f.type?this.curve=new curve.edwards(f):this.curve=new curve.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,assert(this.g.validate(),"Invalid curve"),assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(f,e){Object.defineProperty(curves,f,{configurable:!0,enumerable:!0,get:function(){var a=new PresetCurve(e);return Object.defineProperty(curves,f,{configurable:!0,enumerable:!0,value:a}),a}})}curves.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{pre=require("./precomputed/secp256k1")}catch(f){pre=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",pre]}); -},{"./curve":130,"./precomputed/secp256k1":140,"./utils":141,"hash.js":175}],134:[function(require,module,exports){ +},{"./curve":144,"./precomputed/secp256k1":154,"./utils":155,"hash.js":200}],148:[function(require,module,exports){ "use strict";var BN=require("bn.js"),HmacDRBG=require("hmac-drbg"),utils=require("../utils"),curves=require("../curves"),rand=require("brorand"),assert=utils.assert,KeyPair=require("./key"),Signature=require("./signature");function EC(r){if(!(this instanceof EC))return new EC(r);"string"==typeof r&&(assert(curves.hasOwnProperty(r),"Unknown curve "+r),r=curves[r]),r instanceof curves.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}module.exports=EC,EC.prototype.keyPair=function(r){return new KeyPair(this,r)},EC.prototype.keyFromPrivate=function(r,e){return KeyPair.fromPrivate(this,r,e)},EC.prototype.keyFromPublic=function(r,e){return KeyPair.fromPublic(this,r,e)},EC.prototype.genKeyPair=function(r){r||(r={});for(var e=new HmacDRBG({hash:this.hash,pers:r.pers,persEnc:r.persEnc||"utf8",entropy:r.entropy||rand(this.hash.hmacStrength),entropyEnc:r.entropy&&r.entropyEnc||"utf8",nonce:this.n.toArray()}),t=this.n.byteLength(),n=this.n.sub(new BN(2));;){var i=new BN(e.generate(t));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},EC.prototype._truncateToN=function(r,e){var t=8*r.byteLength()-this.n.bitLength();return t>0&&(r=r.ushrn(t)),!e&&r.cmp(this.n)>=0?r.sub(this.n):r},EC.prototype.sign=function(r,e,t,n){"object"==typeof t&&(n=t,t=null),n||(n={}),e=this.keyFromPrivate(e,t),r=this._truncateToN(new BN(r,16));for(var i=this.n.byteLength(),s=e.getPrivate().toArray("be",i),u=r.toArray("be",i),o=new HmacDRBG({hash:this.hash,entropy:s,nonce:u,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new BN(1)),a=0;;a++){var c=n.k?n.k(a):new BN(o.generate(this.n.byteLength()));if(!((c=this._truncateToN(c,!0)).cmpn(1)<=0||c.cmp(h)>=0)){var m=this.g.mul(c);if(!m.isInfinity()){var v=m.getX(),p=v.umod(this.n);if(0!==p.cmpn(0)){var y=c.invm(this.n).mul(p.mul(e.getPrivate()).iadd(r));if(0!==(y=y.umod(this.n)).cmpn(0)){var f=(m.getY().isOdd()?1:0)|(0!==v.cmp(p)?2:0);return n.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),f^=1),new Signature({r:p,s:y,recoveryParam:f})}}}}}},EC.prototype.verify=function(r,e,t,n){r=this._truncateToN(new BN(r,16)),t=this.keyFromPublic(t,n);var i=(e=new Signature(e,"hex")).r,s=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var u,o=s.invm(this.n),h=o.mul(r).umod(this.n),a=o.mul(i).umod(this.n);return this.curve._maxwellTrick?!(u=this.g.jmulAdd(h,t.getPublic(),a)).isInfinity()&&u.eqXToP(i):!(u=this.g.mulAdd(h,t.getPublic(),a)).isInfinity()&&0===u.getX().umod(this.n).cmp(i)},EC.prototype.recoverPubKey=function(r,e,t,n){assert((3&t)===t,"The recovery param is more than two bits"),e=new Signature(e,n);var i=this.n,s=new BN(r),u=e.r,o=e.s,h=1&t,a=t>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&a)throw new Error("Unable to find sencond key candinate");u=a?this.curve.pointFromX(u.add(this.curve.n),h):this.curve.pointFromX(u,h);var c=e.r.invm(i),m=i.sub(s).mul(c).umod(i),v=o.mul(c).umod(i);return this.g.mulAdd(m,u,v)},EC.prototype.getKeyRecoveryParam=function(r,e,t,n){if(null!==(e=new Signature(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(r,e,i)}catch(r){continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")}; -},{"../curves":133,"../utils":141,"./key":135,"./signature":136,"bn.js":142,"brorand":42,"hmac-drbg":188}],135:[function(require,module,exports){ +},{"../curves":147,"../utils":155,"./key":149,"./signature":150,"bn.js":156,"brorand":56,"hmac-drbg":213}],149:[function(require,module,exports){ "use strict";var BN=require("bn.js"),utils=require("../utils"),assert=utils.assert;function KeyPair(i,t){this.ec=i,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}module.exports=KeyPair,KeyPair.fromPublic=function(i,t,e){return t instanceof KeyPair?t:new KeyPair(i,{pub:t,pubEnc:e})},KeyPair.fromPrivate=function(i,t,e){return t instanceof KeyPair?t:new KeyPair(i,{priv:t,privEnc:e})},KeyPair.prototype.validate=function(){var i=this.getPublic();return i.isInfinity()?{result:!1,reason:"Invalid public key"}:i.validate()?i.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function(i,t){return"string"==typeof i&&(t=i,i=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,i):this.pub},KeyPair.prototype.getPrivate=function(i){return"hex"===i?this.priv.toString(16,2):this.priv},KeyPair.prototype._importPrivate=function(i,t){this.priv=new BN(i,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair.prototype._importPublic=function(i,t){if(i.x||i.y)return"mont"===this.ec.curve.type?assert(i.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert(i.x&&i.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(i.x,i.y));this.pub=this.ec.curve.decodePoint(i,t)},KeyPair.prototype.derive=function(i){return i.mul(this.priv).getX()},KeyPair.prototype.sign=function(i,t,e){return this.ec.sign(i,this,t,e)},KeyPair.prototype.verify=function(i,t){return this.ec.verify(i,t,this)},KeyPair.prototype.inspect=function(){return""}; -},{"../utils":141,"bn.js":142}],136:[function(require,module,exports){ +},{"../utils":155,"bn.js":156}],150:[function(require,module,exports){ "use strict";var BN=require("bn.js"),utils=require("../utils"),assert=utils.assert;function Signature(r,t){if(r instanceof Signature)return r;this._importDER(r,t)||(assert(r.r&&r.s,"Signature without r or s"),this.r=new BN(r.r,16),this.s=new BN(r.s,16),void 0===r.recoveryParam?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}function Position(){this.place=0}function getLength(r,t){var e=r[t.place++];if(!(128&e))return e;var n=15&e;if(0===n||n>4)return!1;for(var i=0,a=0,c=t.place;a>>=0;return!(i<=127)&&(t.place=c,i)}function rmPadding(r){for(var t=0,e=r.length-1;!r[t]&&!(128&r[t+1])&&t>>3);for(r.push(128|e);--e;)r.push(t>>>(e<<3)&255);r.push(t)}}module.exports=Signature,Signature.prototype._importDER=function(r,t){r=utils.toArray(r,t);var e=new Position;if(48!==r[e.place++])return!1;var n=getLength(r,e);if(!1===n)return!1;if(n+e.place!==r.length)return!1;if(2!==r[e.place++])return!1;var i=getLength(r,e);if(!1===i)return!1;var a=r.slice(e.place,i+e.place);if(e.place+=i,2!==r[e.place++])return!1;var c=getLength(r,e);if(!1===c)return!1;if(r.length!==c+e.place)return!1;var s=r.slice(e.place,c+e.place);if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new BN(a),this.s=new BN(s),this.recoveryParam=null,!0},Signature.prototype.toDER=function(r){var t=this.r.toArray(),e=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&e[0]&&(e=[0].concat(e)),t=rmPadding(t),e=rmPadding(e);!(e[0]||128&e[1]);)e=e.slice(1);var n=[2];constructLength(n,t.length),(n=n.concat(t)).push(2),constructLength(n,e.length);var i=n.concat(e),a=[48];return constructLength(a,i.length),a=a.concat(i),utils.encode(a,r)}; -},{"../utils":141,"bn.js":142}],137:[function(require,module,exports){ +},{"../utils":155,"bn.js":156}],151:[function(require,module,exports){ "use strict";var hash=require("hash.js"),curves=require("../curves"),utils=require("../utils"),assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=require("./key"),Signature=require("./signature");function EDDSA(t){if(assert("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(t);t=curves[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=hash.sha512}module.exports=EDDSA,EDDSA.prototype.sign=function(t,e){t=parseBytes(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),s=this.encodePoint(n),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),u=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:u,Rencoded:s})},EDDSA.prototype.verify=function(t,e,r){t=parseBytes(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(s)},EDDSA.prototype.hashInt=function(){for(var t=this.hash(),e=0;e(n>>1)-1?(n>>1)-o:o,s.isubn(u)):u=0,e[l]=u,s.iushrn(1)}return e}function getJSF(t,i){var r=[[],[]];t=t.clone(),i=i.clone();for(var e=0,n=0;t.cmpn(-e)>0||i.cmpn(-n)>0;){var s,l,u,o=t.andln(3)+e&3,a=i.andln(3)+n&3;if(3===o&&(o=-1),3===a&&(a=-1),0==(1&o))s=0;else s=3!==(u=t.andln(7)+e&7)&&5!==u||2!==a?o:-o;if(r[0].push(s),0==(1&a))l=0;else l=3!==(u=i.andln(7)+n&7)&&5!==u||2!==o?a:-a;r[1].push(l),2*e===s+1&&(e=1-e),2*n===l+1&&(n=1-n),t.iushrn(1),i.iushrn(1)}return r}function cachedProperty(t,i,r){var e="_"+i;t.prototype[i]=function(){return void 0!==this[e]?this[e]:this[e]=r.call(this)}}function parseBytes(t){return"string"==typeof t?utils.toArray(t,"hex"):t}function intFromLE(t){return new BN(t,"hex","le")}utils.assert=minAssert,utils.toArray=minUtils.toArray,utils.zero2=minUtils.zero2,utils.toHex=minUtils.toHex,utils.encode=minUtils.encode,utils.getNAF=getNAF,utils.getJSF=getJSF,utils.cachedProperty=cachedProperty,utils.parseBytes=parseBytes,utils.intFromLE=intFromLE; -},{"bn.js":142,"minimalistic-assert":218,"minimalistic-crypto-utils":219}],142:[function(require,module,exports){ +},{"bn.js":156,"minimalistic-assert":284,"minimalistic-crypto-utils":285}],156:[function(require,module,exports){ !function(t,i){"use strict";function r(t,i){if(!t)throw new Error(i||"Assertion failed")}function h(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,i,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var e;"object"==typeof t?t.exports=n:i.BN=n,n.BN=n,n.wordSize=26;try{e=require("buffer").Buffer}catch(t){}function o(t,i,r){for(var h=0,n=Math.min(t.length,r),e=i;e=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return h}function s(t,i,r,h){for(var n=0,e=Math.min(t.length,r),o=i;o=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,i){return t.cmp(i)>0?t:i},n.min=function(t,i){return t.cmp(i)<0?t:i},n.prototype._init=function(t,i,h){if("number"==typeof t)return this._initNumber(t,i,h);if("object"==typeof t)return this._initArray(t,i,h);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===i?this._parseHex(t,n):this._parseBase(t,i,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initNumber=function(t,i,h){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===h&&this._initArray(this.toArray(),i,h)},n.prototype._initArray=function(t,i,h){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[e]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===h)for(n=0,e=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this.strip()},n.prototype._parseHex=function(t,i){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var r=0;r=i;r-=6)n=o(t,r,r+6),this.words[h]|=n<>>26-e&4194303,(e+=24)>=26&&(e-=26,h++);r+6!==i&&(n=o(t,i,r+6),this.words[h]|=n<>>26-e&4194303),this.strip()},n.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var h=0,n=1;n<=67108863;n*=i)h++;h--,n=n/i|0;for(var e=t.length-r,o=e%h,u=Math.min(e,e-o)+r,a=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],a=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(t,i,r){r.negative=i.negative^t.negative;var h=t.length+i.length|0;r.length=h,h=h-1|0;var n=0|t.words[0],e=0|i.words[0],o=n*e,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(n=0|t.words[p])*(e=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,i){var h;if(i=0|i||1,16===(t=t||10)||"hex"===t){h="";for(var n=0,e=0,o=0;o>>24-n&16777215)||o!==this.length-1?u[6-m.length]+m+h:m+h,(n+=2)>=26&&(n-=26,o--)}for(0!==e&&(h=e.toString(16)+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}if(t===(0|t)&&t>=2&&t<=36){var f=a[t],d=l[t];h="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modn(d).toString(t);h=(p=p.idivn(d)).isZero()?M+h:u[f-M.length]+M+h}for(this.isZero()&&(h="0"+h);h.length%i!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,i){return r(void 0!==e),this.toArrayLike(e,t,i)},n.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},n.prototype.toArrayLike=function(t,i,h){var n=this.byteLength(),e=h||Math.max(1,n);r(n<=e,"byte array longer than desired length"),r(e>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===i,a=new t(e),l=this.clone();if(u){for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[s]=o;for(;s=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},n.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;it.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var h=0;ht.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),h=t%26;this._expand(i),h>0&&i--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-h),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var h=t/26|0,n=t%26;return this._expand(h+1),this.words[h]=i?this.words[h]|1<t.length?(r=this,h=t):(r=t,h=this);for(var n=0,e=0;e>>26;for(;0!==n&&e>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;et.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,h,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,h=t):(r=t,h=this);for(var e=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==e&&o>26,this.words[o]=67108863&i;if(0===e&&o>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],g=8191&v,c=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,x=0|o[5],S=8191&x,Z=x>>>13,q=0|o[6],R=8191&q,B=q>>>13,N=0|o[7],L=8191&N,I=N>>>13,z=0|o[8],T=8191&z,E=z>>>13,O=0|o[9],j=8191&O,K=O>>>13,P=0|s[0],F=8191&P,C=P>>>13,D=0|s[1],H=8191&D,J=D>>>13,U=0|s[2],G=8191&U,Q=U>>>13,V=0|s[3],W=8191&V,X=V>>>13,Y=0|s[4],$=8191&Y,tt=Y>>>13,it=0|s[5],rt=8191&it,ht=it>>>13,nt=0|s[6],et=8191&nt,ot=nt>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(h=Math.imul(m,F))|0)+((8191&(n=(n=Math.imul(m,C))+Math.imul(f,F)|0))<<13)|0;a=((e=Math.imul(f,C))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,h=Math.imul(p,F),n=(n=Math.imul(p,C))+Math.imul(M,F)|0,e=Math.imul(M,C);var gt=(a+(h=h+Math.imul(m,H)|0)|0)+((8191&(n=(n=n+Math.imul(m,J)|0)+Math.imul(f,H)|0))<<13)|0;a=((e=e+Math.imul(f,J)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,h=Math.imul(g,F),n=(n=Math.imul(g,C))+Math.imul(c,F)|0,e=Math.imul(c,C),h=h+Math.imul(p,H)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(M,H)|0,e=e+Math.imul(M,J)|0;var ct=(a+(h=h+Math.imul(m,G)|0)|0)+((8191&(n=(n=n+Math.imul(m,Q)|0)+Math.imul(f,G)|0))<<13)|0;a=((e=e+Math.imul(f,Q)|0)+(n>>>13)|0)+(ct>>>26)|0,ct&=67108863,h=Math.imul(y,F),n=(n=Math.imul(y,C))+Math.imul(b,F)|0,e=Math.imul(b,C),h=h+Math.imul(g,H)|0,n=(n=n+Math.imul(g,J)|0)+Math.imul(c,H)|0,e=e+Math.imul(c,J)|0,h=h+Math.imul(p,G)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(M,G)|0,e=e+Math.imul(M,Q)|0;var wt=(a+(h=h+Math.imul(m,W)|0)|0)+((8191&(n=(n=n+Math.imul(m,X)|0)+Math.imul(f,W)|0))<<13)|0;a=((e=e+Math.imul(f,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,h=Math.imul(k,F),n=(n=Math.imul(k,C))+Math.imul(A,F)|0,e=Math.imul(A,C),h=h+Math.imul(y,H)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(b,H)|0,e=e+Math.imul(b,J)|0,h=h+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Q)|0)+Math.imul(c,G)|0,e=e+Math.imul(c,Q)|0,h=h+Math.imul(p,W)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(M,W)|0,e=e+Math.imul(M,X)|0;var yt=(a+(h=h+Math.imul(m,$)|0)|0)+((8191&(n=(n=n+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((e=e+Math.imul(f,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,h=Math.imul(S,F),n=(n=Math.imul(S,C))+Math.imul(Z,F)|0,e=Math.imul(Z,C),h=h+Math.imul(k,H)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,H)|0,e=e+Math.imul(A,J)|0,h=h+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Q)|0)+Math.imul(b,G)|0,e=e+Math.imul(b,Q)|0,h=h+Math.imul(g,W)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(c,W)|0,e=e+Math.imul(c,X)|0,h=h+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(M,$)|0,e=e+Math.imul(M,tt)|0;var bt=(a+(h=h+Math.imul(m,rt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ht)|0)+Math.imul(f,rt)|0))<<13)|0;a=((e=e+Math.imul(f,ht)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,h=Math.imul(R,F),n=(n=Math.imul(R,C))+Math.imul(B,F)|0,e=Math.imul(B,C),h=h+Math.imul(S,H)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(Z,H)|0,e=e+Math.imul(Z,J)|0,h=h+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Q)|0)+Math.imul(A,G)|0,e=e+Math.imul(A,Q)|0,h=h+Math.imul(y,W)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(b,W)|0,e=e+Math.imul(b,X)|0,h=h+Math.imul(g,$)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(c,$)|0,e=e+Math.imul(c,tt)|0,h=h+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(M,rt)|0,e=e+Math.imul(M,ht)|0;var _t=(a+(h=h+Math.imul(m,et)|0)|0)+((8191&(n=(n=n+Math.imul(m,ot)|0)+Math.imul(f,et)|0))<<13)|0;a=((e=e+Math.imul(f,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,h=Math.imul(L,F),n=(n=Math.imul(L,C))+Math.imul(I,F)|0,e=Math.imul(I,C),h=h+Math.imul(R,H)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,H)|0,e=e+Math.imul(B,J)|0,h=h+Math.imul(S,G)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(Z,G)|0,e=e+Math.imul(Z,Q)|0,h=h+Math.imul(k,W)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(A,W)|0,e=e+Math.imul(A,X)|0,h=h+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|0,e=e+Math.imul(b,tt)|0,h=h+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(c,rt)|0,e=e+Math.imul(c,ht)|0,h=h+Math.imul(p,et)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(M,et)|0,e=e+Math.imul(M,ot)|0;var kt=(a+(h=h+Math.imul(m,ut)|0)|0)+((8191&(n=(n=n+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((e=e+Math.imul(f,at)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,h=Math.imul(T,F),n=(n=Math.imul(T,C))+Math.imul(E,F)|0,e=Math.imul(E,C),h=h+Math.imul(L,H)|0,n=(n=n+Math.imul(L,J)|0)+Math.imul(I,H)|0,e=e+Math.imul(I,J)|0,h=h+Math.imul(R,G)|0,n=(n=n+Math.imul(R,Q)|0)+Math.imul(B,G)|0,e=e+Math.imul(B,Q)|0,h=h+Math.imul(S,W)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(Z,W)|0,e=e+Math.imul(Z,X)|0,h=h+Math.imul(k,$)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,$)|0,e=e+Math.imul(A,tt)|0,h=h+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(b,rt)|0,e=e+Math.imul(b,ht)|0,h=h+Math.imul(g,et)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(c,et)|0,e=e+Math.imul(c,ot)|0,h=h+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(M,ut)|0,e=e+Math.imul(M,at)|0;var At=(a+(h=h+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((e=e+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,h=Math.imul(j,F),n=(n=Math.imul(j,C))+Math.imul(K,F)|0,e=Math.imul(K,C),h=h+Math.imul(T,H)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(E,H)|0,e=e+Math.imul(E,J)|0,h=h+Math.imul(L,G)|0,n=(n=n+Math.imul(L,Q)|0)+Math.imul(I,G)|0,e=e+Math.imul(I,Q)|0,h=h+Math.imul(R,W)|0,n=(n=n+Math.imul(R,X)|0)+Math.imul(B,W)|0,e=e+Math.imul(B,X)|0,h=h+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(Z,$)|0,e=e+Math.imul(Z,tt)|0,h=h+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,rt)|0,e=e+Math.imul(A,ht)|0,h=h+Math.imul(y,et)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(b,et)|0,e=e+Math.imul(b,ot)|0,h=h+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(c,ut)|0,e=e+Math.imul(c,at)|0,h=h+Math.imul(p,mt)|0,n=(n=n+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,e=e+Math.imul(M,ft)|0;var xt=(a+(h=h+Math.imul(m,pt)|0)|0)+((8191&(n=(n=n+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((e=e+Math.imul(f,Mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h=Math.imul(j,H),n=(n=Math.imul(j,J))+Math.imul(K,H)|0,e=Math.imul(K,J),h=h+Math.imul(T,G)|0,n=(n=n+Math.imul(T,Q)|0)+Math.imul(E,G)|0,e=e+Math.imul(E,Q)|0,h=h+Math.imul(L,W)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(I,W)|0,e=e+Math.imul(I,X)|0,h=h+Math.imul(R,$)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(B,$)|0,e=e+Math.imul(B,tt)|0,h=h+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(Z,rt)|0,e=e+Math.imul(Z,ht)|0,h=h+Math.imul(k,et)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(A,et)|0,e=e+Math.imul(A,ot)|0,h=h+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,e=e+Math.imul(b,at)|0,h=h+Math.imul(g,mt)|0,n=(n=n+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,e=e+Math.imul(c,ft)|0;var St=(a+(h=h+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((e=e+Math.imul(M,Mt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,h=Math.imul(j,G),n=(n=Math.imul(j,Q))+Math.imul(K,G)|0,e=Math.imul(K,Q),h=h+Math.imul(T,W)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(E,W)|0,e=e+Math.imul(E,X)|0,h=h+Math.imul(L,$)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(I,$)|0,e=e+Math.imul(I,tt)|0,h=h+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(B,rt)|0,e=e+Math.imul(B,ht)|0,h=h+Math.imul(S,et)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(Z,et)|0,e=e+Math.imul(Z,ot)|0,h=h+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ut)|0,e=e+Math.imul(A,at)|0,h=h+Math.imul(y,mt)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,e=e+Math.imul(b,ft)|0;var Zt=(a+(h=h+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,Mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((e=e+Math.imul(c,Mt)|0)+(n>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,h=Math.imul(j,W),n=(n=Math.imul(j,X))+Math.imul(K,W)|0,e=Math.imul(K,X),h=h+Math.imul(T,$)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(E,$)|0,e=e+Math.imul(E,tt)|0,h=h+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,ht)|0)+Math.imul(I,rt)|0,e=e+Math.imul(I,ht)|0,h=h+Math.imul(R,et)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(B,et)|0,e=e+Math.imul(B,ot)|0,h=h+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul(Z,ut)|0,e=e+Math.imul(Z,at)|0,h=h+Math.imul(k,mt)|0,n=(n=n+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,e=e+Math.imul(A,ft)|0;var qt=(a+(h=h+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((e=e+Math.imul(b,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,h=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(K,$)|0,e=Math.imul(K,tt),h=h+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(E,rt)|0,e=e+Math.imul(E,ht)|0,h=h+Math.imul(L,et)|0,n=(n=n+Math.imul(L,ot)|0)+Math.imul(I,et)|0,e=e+Math.imul(I,ot)|0,h=h+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(B,ut)|0,e=e+Math.imul(B,at)|0,h=h+Math.imul(S,mt)|0,n=(n=n+Math.imul(S,ft)|0)+Math.imul(Z,mt)|0,e=e+Math.imul(Z,ft)|0;var Rt=(a+(h=h+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((e=e+Math.imul(A,Mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,h=Math.imul(j,rt),n=(n=Math.imul(j,ht))+Math.imul(K,rt)|0,e=Math.imul(K,ht),h=h+Math.imul(T,et)|0,n=(n=n+Math.imul(T,ot)|0)+Math.imul(E,et)|0,e=e+Math.imul(E,ot)|0,h=h+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,at)|0)+Math.imul(I,ut)|0,e=e+Math.imul(I,at)|0,h=h+Math.imul(R,mt)|0,n=(n=n+Math.imul(R,ft)|0)+Math.imul(B,mt)|0,e=e+Math.imul(B,ft)|0;var Bt=(a+(h=h+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,Mt)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((e=e+Math.imul(Z,Mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,h=Math.imul(j,et),n=(n=Math.imul(j,ot))+Math.imul(K,et)|0,e=Math.imul(K,ot),h=h+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(E,ut)|0,e=e+Math.imul(E,at)|0,h=h+Math.imul(L,mt)|0,n=(n=n+Math.imul(L,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Nt=(a+(h=h+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,Mt)|0)+Math.imul(B,pt)|0))<<13)|0;a=((e=e+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h=Math.imul(j,ut),n=(n=Math.imul(j,at))+Math.imul(K,ut)|0,e=Math.imul(K,at),h=h+Math.imul(T,mt)|0,n=(n=n+Math.imul(T,ft)|0)+Math.imul(E,mt)|0,e=e+Math.imul(E,ft)|0;var Lt=(a+(h=h+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h=Math.imul(j,mt),n=(n=Math.imul(j,ft))+Math.imul(K,mt)|0,e=Math.imul(K,ft);var It=(a+(h=h+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,Mt)|0)+Math.imul(E,pt)|0))<<13)|0;a=((e=e+Math.imul(E,Mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var zt=(a+(h=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(K,pt)|0))<<13)|0;return a=((e=Math.imul(K,Mt))+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863,u[0]=vt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=xt,u[10]=St,u[11]=Zt,u[12]=qt,u[13]=Rt,u[14]=Bt,u[15]=Nt,u[16]=Lt,u[17]=It,u[18]=zt,0!==a&&(u[19]=a,r.length++),r};function d(t,i,r){return(new p).mulp(t,i,r)}function p(t,i){this.x=t,this.y=i}Math.imul||(f=m),n.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,i):r<63?m(this,t,i):r<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var h=0,n=0,e=0;e>>26)|0)>>>26,o&=67108863}r.words[e]=s,h=o,o=n}return 0!==h?r.words[e]=h:r.length--,r.strip()}(this,t,i):d(this,t,i)},p.prototype.makeRBT=function(t){for(var i=new Array(t),r=n.prototype._countBits(t)-1,h=0;h>=1;return h},p.prototype.permute=function(t,i,r,h,n,e){for(var o=0;o>>=1)n++;return 1<>>=13,h[2*o+1]=8191&e,e>>>=13;for(o=2*i;o>=26,i+=n/67108864|0,i+=e>>>26,this.words[h]=67108863&e}return 0!==i&&(this.words[h]=i,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r>>n}return i}(t);if(0===i.length)return new n(1);for(var r=this,h=0;h=0);var i,h=t%26,n=(t-h)/26,e=67108863>>>26-h<<26-h;if(0!==h){var o=0;for(i=0;i>>26-h}o&&(this.words[i]=o,this.length++)}if(0!==n){for(i=this.length-1;i>=0;i--)this.words[i+n]=this.words[i];for(i=0;i=0),n=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<o)for(this.length-=o,a=0;a=0&&(0!==l||a>=n);a--){var m=0|this.words[a];this.words[a]=l<<26-e|m>>>e,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,i,h){return r(0===this.negative),this.iushrn(t,i,h)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,h=(t-i)/26,n=1<=0);var i=t%26,h=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=h)return this;if(0!==i&&h++,this.length=Math.min(h,this.length),0!==i){var n=67108863^67108863>>>i<=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i>26)-(u/67108864|0),this.words[n+h]=67108863&e}for(;n>26,this.words[n+h]=67108863&e;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n>26,this.words[n]=67108863&e;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,i){var r=(this.length,t.length),h=this.clone(),e=t,o=0|e.words[e.length-1];0!==(r=26-this._countBits(o))&&(e=e.ushln(r),h.iushln(r),o=0|e.words[e.length-1]);var s,u=h.length-e.length;if("mod"!==i){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a=0;m--){var f=67108864*(0|h.words[e.length+m])+(0|h.words[e.length+m-1]);for(f=Math.min(f/o|0,67108863),h._ishlnsubmul(e,f,m);0!==h.negative;)f--,h.negative=0,h._ishlnsubmul(e,1,m),h.isZero()||(h.negative^=1);s&&(s.words[m]=f)}return s&&s.strip(),h.strip(),"div"!==i&&0!==r&&h.iushrn(r),{div:s||null,mod:h}},n.prototype.divmod=function(t,i,h){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),h&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,h=t.ushrn(1),n=t.andln(1),e=r.cmp(h);return e<0||1===n&&0===e?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var i=(1<<26)%t,h=0,n=this.length-1;n>=0;n--)h=(i*h+(0|this.words[n]))%t;return h},n.prototype.idivn=function(t){r(t<=67108863);for(var i=0,h=this.length-1;h>=0;h--){var n=(0|this.words[h])+67108864*i;this.words[h]=n/t|0,i=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new n(1),o=new n(0),s=new n(0),u=new n(1),a=0;i.isEven()&&h.isEven();)i.iushrn(1),h.iushrn(1),++a;for(var l=h.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(m)),e.iushrn(1),o.iushrn(1);for(var p=0,M=1;0==(h.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(h.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(h)>=0?(i.isub(h),e.isub(s),o.isub(u)):(h.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:h.iushln(a)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,h=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new n(1),s=new n(0),u=h.clone();i.cmpn(1)>0&&h.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(h.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(h.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(h)>=0?(i.isub(h),o.isub(s)):(h.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var h=0;i.isEven()&&r.isEven();h++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=i.cmp(r);if(n<0){var e=i;i=r,r=e}else if(0===n||0===r.cmpn(1))break;i.isub(r)}return r.iushln(h)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,h=(t-i)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var i,h=t<0;if(0!==this.negative&&!h)return-1;if(0===this.negative&&h)return 1;if(this.strip(),this.length>1)i=1;else{h&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:nt.length)return 1;if(this.length=0;r--){var h=0|this.words[r],n=0|t.words[r];if(h!==n){hn&&(i=1);break}}return i},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new b(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};function v(t,i){this.name=t,this.p=new n(i,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function c(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function b(t){if("string"==typeof t){var i=n._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){b.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var h=i0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,i){t.iushrn(this.n,0,i)},v.prototype.imulK=function(t){return t.imul(this.k)},h(g,v),g.prototype.split=function(t,i){for(var r=Math.min(t.length,9),h=0;h>>22,n=e}n>>>=22,t.words[h-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r>>=26,t.words[r]=n,i=h}return 0!==i&&(t.words[t.length++]=i),t},n._prime=function(t){if(M[t])return M[t];var i;if("k256"===t)i=new g;else if("p224"===t)i=new c;else if("p192"===t)i=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new y}return M[t]=i,i},b.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},b.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},b.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},b.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},b.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},b.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},b.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},b.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},b.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},b.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},b.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},b.prototype.isqr=function(t){return this.imul(t,t.clone())},b.prototype.sqr=function(t){return this.mul(t,t)},b.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var h=this.m.add(new n(1)).iushrn(2);return this.pow(t,h)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new n(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,e),f=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();r(v=0;h--){for(var a=i.words[h],l=u-1;l>=0;l--){var m=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===h&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},b.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},b.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},n.mont=function(t){return new _(t)},h(_,b),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},_.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(h).iushrn(this.shift),e=n;return n.cmp(this.m)>=0?e=n.isub(this.m):n.cmpn(0)<0&&(e=n.iadd(this.m)),e._forceRed(this)},_.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new n(0)._forceRed(this);var r=t.mul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(h).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof module||module,this); -},{"buffer":43}],143:[function(require,module,exports){ +},{"buffer":57}],157:[function(require,module,exports){ module.exports={ "_args": [ [ @@ -1157,403 +997,587 @@ module.exports={ "version": "6.5.3" } -},{}],144:[function(require,module,exports){ +},{}],158:[function(require,module,exports){ +"use strict";var AbstractLevelDOWN=require("abstract-leveldown").AbstractLevelDOWN,AbstractChainedBatch=require("abstract-leveldown").AbstractChainedBatch,AbstractIterator=require("abstract-leveldown").AbstractIterator,inherits=require("inherits"),Codec=require("level-codec"),EncodingError=require("level-errors").EncodingError,rangeMethods=["approximateSize","compactRange"];function DB(t,e){if(!(this instanceof DB))return new DB(t,e);var o=t.supports||{},c=o.additionalMethods||{};AbstractLevelDOWN.call(this,o),this.supports.encodings=!0,this.supports.additionalMethods={},rangeMethods.forEach(function(e){var o="function"==typeof t[e];(c[e]||o)&&(this.supports.additionalMethods[e]=!0,this[e]=function(t,o,c,i){return t=this.codec.encodeKey(t,c),o=this.codec.encodeKey(o,c),this.db[e](t,o,c,i)})},this),void 0===(e=e||{}).keyEncoding&&(e.keyEncoding="utf8"),void 0===e.valueEncoding&&(e.valueEncoding="utf8"),this.db=t,this.codec=new Codec(e)}function Iterator(t,e){AbstractIterator.call(this,t),this.codec=t.codec,this.keys=e.keys,this.values=e.values,this.opts=this.codec.encodeLtgt(e),this.it=t.db.iterator(this.opts)}function Batch(t,e){AbstractChainedBatch.call(this,t),this.codec=t.codec,this.batch=t.db.batch()}module.exports=DB.default=DB,inherits(DB,AbstractLevelDOWN),DB.prototype.type="encoding-down",DB.prototype._serializeKey=DB.prototype._serializeValue=function(t){return t},DB.prototype._open=function(t,e){this.db.open(t,e)},DB.prototype._close=function(t){this.db.close(t)},DB.prototype._put=function(t,e,o,c){t=this.codec.encodeKey(t,o),e=this.codec.encodeValue(e,o),this.db.put(t,e,o,c)},DB.prototype._get=function(t,e,o){var c=this;t=this.codec.encodeKey(t,e),e.asBuffer=this.codec.valueAsBuffer(e),this.db.get(t,e,function(t,i){if(t)return o(t);try{i=c.codec.decodeValue(i,e)}catch(t){return o(new EncodingError(t))}o(null,i)})},DB.prototype._del=function(t,e,o){t=this.codec.encodeKey(t,e),this.db.del(t,e,o)},DB.prototype._chainedBatch=function(){return new Batch(this)},DB.prototype._batch=function(t,e,o){t=this.codec.encodeBatch(t,e),this.db.batch(t,e,o)},DB.prototype._iterator=function(t){return t.keyAsBuffer=this.codec.keyAsBuffer(t),t.valueAsBuffer=this.codec.valueAsBuffer(t),new Iterator(this,t)},DB.prototype._clear=function(t,e){t=this.codec.encodeLtgt(t),this.db.clear(t,e)},inherits(Iterator,AbstractIterator),Iterator.prototype._next=function(t){var e=this;this.it.next(function(o,c,i){if(o)return t(o);try{c=e.keys&&void 0!==c?e.codec.decodeKey(c,e.opts):void 0,i=e.values&&void 0!==i?e.codec.decodeValue(i,e.opts):void 0}catch(o){return t(new EncodingError(o))}t(null,c,i)})},Iterator.prototype._seek=function(t){t=this.codec.encodeKey(t,this.opts),this.it.seek(t)},Iterator.prototype._end=function(t){this.it.end(t)},inherits(Batch,AbstractChainedBatch),Batch.prototype._put=function(t,e){t=this.codec.encodeKey(t),e=this.codec.encodeValue(e),this.batch.put(t,e)},Batch.prototype._del=function(t){t=this.codec.encodeKey(t),this.batch.del(t)},Batch.prototype._clear=function(){this.batch.clear()},Batch.prototype._write=function(t,e){this.batch.write(t,e)}; + +},{"abstract-leveldown":11,"inherits":225,"level-codec":159,"level-errors":243}],159:[function(require,module,exports){ +var encodings=require("./lib/encodings");function Codec(e){if(!(this instanceof Codec))return new Codec(e);this.opts=e||{},this.encodings=encodings}module.exports=Codec,Codec.prototype._encoding=function(e){return"string"==typeof e&&(e=encodings[e]),e||(e=encodings.id),e},Codec.prototype._keyEncoding=function(e,n){return this._encoding(n&&n.keyEncoding||e&&e.keyEncoding||this.opts.keyEncoding)},Codec.prototype._valueEncoding=function(e,n){return this._encoding(n&&(n.valueEncoding||n.encoding)||e&&(e.valueEncoding||e.encoding)||this.opts.valueEncoding||this.opts.encoding)},Codec.prototype.encodeKey=function(e,n,o){return this._keyEncoding(n,o).encode(e)},Codec.prototype.encodeValue=function(e,n,o){return this._valueEncoding(n,o).encode(e)},Codec.prototype.decodeKey=function(e,n){return this._keyEncoding(n).decode(e)},Codec.prototype.decodeValue=function(e,n){return this._valueEncoding(n).decode(e)},Codec.prototype.encodeBatch=function(e,n){var o=this;return e.map(function(e){var t={type:e.type,key:o.encodeKey(e.key,n,e)};return o.keyAsBuffer(n,e)&&(t.keyEncoding="binary"),e.prefix&&(t.prefix=e.prefix),"value"in e&&(t.value=o.encodeValue(e.value,n,e),o.valueAsBuffer(n,e)&&(t.valueEncoding="binary")),t})};var ltgtKeys=["lt","gt","lte","gte","start","end"];Codec.prototype.encodeLtgt=function(e){var n=this,o={};return Object.keys(e).forEach(function(t){o[t]=ltgtKeys.indexOf(t)>-1?n.encodeKey(e[t],e):e[t]}),o},Codec.prototype.createStreamDecoder=function(e){var n=this;return e.keys&&e.values?function(o,t){return{key:n.decodeKey(o,e),value:n.decodeValue(t,e)}}:e.keys?function(o){return n.decodeKey(o,e)}:e.values?function(o,t){return n.decodeValue(t,e)}:function(){}},Codec.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},Codec.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}; + +},{"./lib/encodings":160}],160:[function(require,module,exports){ +var Buffer=require("buffer").Buffer;exports.utf8=exports["utf-8"]={encode:function(e){return isBinary(e)?e:String(e)},decode:identity,buffer:!1,type:"utf8"},exports.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},exports.binary={encode:function(e){return isBinary(e)?e:Buffer.from(e)},decode:identity,buffer:!0,type:"binary"},exports.none={encode:identity,decode:identity,buffer:!1,type:"id"},exports.id=exports.none;var bufferEncodings=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];function identity(e){return e}function isBinary(e){return null==e||Buffer.isBuffer(e)}bufferEncodings.forEach(function(e){exports[e]={encode:function(r){return isBinary(r)?r:Buffer.from(r,e)},decode:function(r){return r.toString(e)},buffer:!0,type:e}}); + +},{"buffer":101}],161:[function(require,module,exports){ "use strict";module.exports=function(e){const{note:r,getReceive:t,getReplicate:i,getSequence:n}=e;var c={note:r,getReceive:t,getReplicate:i,getSequence:n};function o(e,r,t){return e.blocks[r]&&e.blocks[r][t]}function l(e,r,t){return e.follows[r]&&!o(e,r,t)}function s(e,r,i){for(var n in e.peers)if(n!==i){var c=e.peers[n];if(c.notes&&t(c.notes[n]))return n;var o=c.replicating&&c.replicating[n]&&-1!=c.replicating[n].sent;if(c.replicating&&c.replicating[r]&&c.replicating[r].rx&&o)return n}return!1}function a(e,r,t){for(var i in e.peers)if(i!=t){var n=e.peers[i];if((n.clock&&n.clock[r]||0)>(e.clock[r]||0)&&l(e,r,i))return!0}}function u(e,r,t){var i=e.indexOf(r);if(~i)for(var n=1;nf?(u.msgs.push(r),g.sent++):(n=s,-1!==(o=f)&&(null==o||n>o)&&(g?!g.tx&&null!=g.sent:e.follows[t])&&p(u,t,i,!1))}}return e},c.receive=function(e,r){var t=r.value;if(!e.peers[r.id])throw new Error("lost peer state:"+r.id);const i=c.getMsgAuthor(t),n=c.getMsgSequence(t);var o=e.peers[r.id],s=o.replicating[i];return s?(o.clock[i]=Math.max(o.clock[i],n),s.sent=Math.max(s.sent,n),e.clock[i]>=n?(s.rx&&p(o,i,e.clock[i],!1),e):(e.peers[r.id].ts=r.ts,l(e,c.getMsgAuthor(r.value),r.id)&&e.receive.push(r),e)):e},c.notes=function(e,r){var o,a=r.value;(o=r.value.clock)&&"object"==typeof o&&(a=r.value.clock);var u=e.peers[r.id];if(!u)throw new Error("lost state of peer:"+r.id);if(!u.clock)throw new Error("received notes, but has not set the peer's clock yet");var f,g,v=0;for(var d in u.replicating||(u.replicating={},e=c.peerClock(e,{id:r.id,value:e.peers[r.id].clock})),a){v++;var k=u.clock[d]=(f=u.clock[d],g=n(a[d]),null==f?g:-1==f||-1==g?g:Math.max(f,g)),x=t(a[d]),h=i(a[d]),b=e.clock[d]||0;if(l(e,d,r.id)){var w=u.replicating[d],q=s(e,d,r.id);if(w){if(!w.rx&&k>b)if(q){var M=e.peers[q];k>(M.clock[d]||0)&&(u.ts=r.ts,p(u,d,b,!0),p(M,d,b,!1))}else u.ts=r.ts,p(u,d,b,!0)}else w=u.replicating[d]={tx:!0,rx:!0,sent:k,requested:b},p(u,d,b,bk&&(x?u.retrive.push(d):h&&p(u,d,b,w.rx))}else u.replicating[d]||p(u,d,-1),u.replicating[d]={tx:!1,rx:!1,sent:-1,requested:-1}}return u.recvNotes=(u.recvNotes||0)+v,e},c.timeout=function(e,r){var t={};for(var i in e.peers){var n=e.peers[i];if((n.ts||0)+e.timeoute.clock[l])return i.replicating=i.replicating||{},i.replicating[l]=i.replicating[l]||{tx:!1,rx:!0,sent:-1,requested:e.clock[l]},p(i,l,e.clock[l],!0),i.ts=r.ts,!0})}return e},c.block=function(e,r){for(var t in r.value?(e.blocks[r.id]=e.blocks[r.id]||{},e.blocks[r.id][r.target]=!0):(e.blocks[r.id]&&delete e.blocks[r.id][r.target],function(e){for(var r in e)return!1;return!0}(e.blocks[r.id])&&delete e.blocks[r.id]),e.id===r.id&&e.peers[r.target]&&(e.peers[r.target].blocked=r.value),e.peers){var i=e.peers[t];i.replicating&&(t===r.target&&i.replicating[r.id]&&p(i,r.id,-1,!1))}return e},c}; -},{}],145:[function(require,module,exports){ +},{}],162:[function(require,module,exports){ var events=require("./events")(require("./v3")),Stream=require("./stream")(events),progress=require("./progress");function timestamp(){return Date.now()}function createValidate(e){return function(t){for(var r in t)if(!e(r)){var s={};for(var n in t)e(n)&&(s[n]=t[n]);return s}return t}}module.exports=function(e){var t=events.initialize(e.id,e.getMsgAuthor,e.getMsgSequence);t.timeout=e.timeout||3e3,t.clock={},e.isMsg||(e.isMsg=function(e){return Number.isInteger(e.sequence)&&e.sequence>0&&"string"==typeof e.author&&e.content});var r={id:e.id,streams:{},state:t,logging:e.logging,progress:function(){return progress(t)},request:function(t,s){e.isFeed&&!e.isFeed(t)||(r.state=events.follow(r.state,{id:t,value:!1!==s,ts:timestamp()}),r.update())},pause:function(e,t){r.state=events.pause(r.state,{id:e,paused:!1!==t}),r.update()},block:function(e,t,s){r.state=events.block(r.state,{id:e,target:t,value:!1!==s,ts:timestamp()}),r.update()},createStream:function(t,s,n){this.streams[t]&&this.streams[t].end(new Error("reconnected to peer")),this.logging&&console.log("EBT:conn",t);var i=this.streams[t]=new Stream(this,t,s,n,e.isMsg,function(r){e.setClock(t,r.clock)});return e.isFeed&&(i._validate=createValidate(e.isFeed)),e.getClock(t,function(e,s){r.state.peers[t]&&i.clock(e?{}:s)}),i},_retrive:function(e,t){t?(r.state=events.retrive(r.state,t),r.update()):console.log("could not retrive msg:",e)},onAppend:function(e){r.state=events.append(r.state,e),r.update()},update:function(){for(var t in this.state.peers)for(var s=this.state.peers[t];s.retrive.length;){var n=s.retrive.shift();s.replicating[n]&&e.getAt({id:n,sequence:s.replicating[n].sent+1},this._retrive)}if(this.state.receive.length){var i=this.state.receive.shift();e.append(i.value,function(e){e?(this.logging&&console.error("EBT:err",e),r.block(i.value.author,i.id,!0)):r.onAppend(i.value)})}for(var a in this.streams)this.streams[a].resume()}},s=setInterval(function(){r.state=events.timeout(r.state,{ts:timestamp()}),r.update()},t.timeout);return s.unref&&s.unref(),r}; -},{"./events":144,"./progress":146,"./stream":147,"./v3":148}],146:[function(require,module,exports){ +},{"./events":161,"./progress":163,"./stream":164,"./v3":165}],163:[function(require,module,exports){ module.exports=function(r){var e={start:0,current:0,target:0};for(var t in r.peers){var n=r.peers[t];for(var u in n.replicating){var a=n.replicating[u];e.target++,null!=a.sent&&e.current++,e.target++,null!=a.requested&&e.current++;var c=n.clock[u],l=r.clock[u]||0;a.rx&&null!=a.requested&&a.requested>-1&&l-1&&c>1:-1},exports.getReplicate=function(e){return-1!==e},exports.getReceive=function(e){return!(1&e)}; -},{}],149:[function(require,module,exports){ -var objectCreate=Object.create||objectCreatePolyfill,objectKeys=Object.keys||objectKeysPolyfill,bind=Function.prototype.bind||functionBindPolyfill;function EventEmitter(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=objectCreate(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0;var hasDefineProperty,defaultMaxListeners=10;try{var o={};Object.defineProperty&&Object.defineProperty(o,"x",{value:0}),hasDefineProperty=0===o.x}catch(e){hasDefineProperty=!1}function $getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function emitNone(e,t,n){if(t)e.call(n);else for(var r=e.length,i=arrayClone(e,r),s=0;s0&&o.length>i){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",a.name,a.message)}}else o=s[t]=n,++e._eventsCount;return e}function onceWrapper(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var l=new Error('Unhandled "error" event. ('+t+")");throw l.context=t,l}if(!(n=o[e]))return!1;var u="function"==typeof n;switch(r=arguments.length){case 1:emitNone(n,u,this);break;case 2:emitOne(n,u,this,arguments[1]);break;case 3:emitTwo(n,u,this,arguments[1],arguments[2]);break;case 4:emitThree(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),s=1;s=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():spliceOne(n,i),1===n.length&&(r[e]=n[0]),r.removeListener&&this.emit("removeListener",e,o||t)}return this},EventEmitter.prototype.removeAllListeners=function(e){var t,n,r;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=objectCreate(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=objectCreate(null):delete n[e]),this;if(0===arguments.length){var i,s=objectKeys(n);for(r=0;r=0;r--)this.removeListener(e,t[r]);return this},EventEmitter.prototype.listeners=function(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}; +},{}],166:[function(require,module,exports){ +var prr=require("prr");function init(r,t,e){t&&"string"!=typeof t&&(t=t.message||t.name),prr(this,{type:r,name:r,cause:"string"!=typeof t?t:e,message:t},"ewr")}function CustomError(r,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),init.call(this,"CustomError",r,t)}function createError(r,t,e){var s=function(e,o){init.call(this,t,e,o),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(r.errno[this.cause.errno]?r.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,s)};return s.prototype=e?new e:new CustomError,s}CustomError.prototype=new Error,module.exports=function(r){var t=function(t,e){return createError(r,t,e)};return{CustomError:CustomError,FilesystemError:t("FilesystemError"),createError:t}}; + +},{"prr":353}],167:[function(require,module,exports){ +var all=module.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];module.exports.errno={},module.exports.code={},all.forEach(function(e){module.exports.errno[e.errno]=e,module.exports.code[e.code]=e}),module.exports.custom=require("./custom")(module.exports),module.exports.create=module.exports.custom.createError; + +},{"./custom":166}],168:[function(require,module,exports){ +"use strict";var undefined,$TypeError=TypeError,$gOPD=Object.getOwnPropertyDescriptor;if($gOPD)try{$gOPD({},"")}catch(e){$gOPD=null}var generator,asyncFn,asyncGen,throwTypeError=function(){throw new $TypeError},ThrowTypeError=$gOPD?function(){try{return arguments.callee,throwTypeError}catch(e){try{return $gOPD(arguments,"callee").get}catch(e){return throwTypeError}}}():throwTypeError,hasSymbols=require("has-symbols")(),getProto=Object.getPrototypeOf||function(e){return e.__proto__},generatorFunction=generator?getProto(generator):undefined,asyncFunction=asyncFn?asyncFn.constructor:undefined,asyncGenFunction=asyncGen?getProto(asyncGen):undefined,asyncGenIterator=asyncGen?asyncGen():undefined,TypedArray="undefined"==typeof Uint8Array?undefined:getProto(Uint8Array),INTRINSICS={"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?undefined:ArrayBuffer,"%ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?undefined:ArrayBuffer.prototype,"%ArrayIteratorPrototype%":hasSymbols?getProto([][Symbol.iterator]()):undefined,"%ArrayPrototype%":Array.prototype,"%ArrayProto_entries%":Array.prototype.entries,"%ArrayProto_forEach%":Array.prototype.forEach,"%ArrayProto_keys%":Array.prototype.keys,"%ArrayProto_values%":Array.prototype.values,"%AsyncFromSyncIteratorPrototype%":undefined,"%AsyncFunction%":asyncFunction,"%AsyncFunctionPrototype%":asyncFunction?asyncFunction.prototype:undefined,"%AsyncGenerator%":asyncGen?getProto(asyncGenIterator):undefined,"%AsyncGeneratorFunction%":asyncGenFunction,"%AsyncGeneratorPrototype%":asyncGenFunction?asyncGenFunction.prototype:undefined,"%AsyncIteratorPrototype%":asyncGenIterator&&hasSymbols&&Symbol.asyncIterator?asyncGenIterator[Symbol.asyncIterator]():undefined,"%Atomics%":"undefined"==typeof Atomics?undefined:Atomics,"%Boolean%":Boolean,"%BooleanPrototype%":Boolean.prototype,"%DataView%":"undefined"==typeof DataView?undefined:DataView,"%DataViewPrototype%":"undefined"==typeof DataView?undefined:DataView.prototype,"%Date%":Date,"%DatePrototype%":Date.prototype,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%ErrorPrototype%":Error.prototype,"%eval%":eval,"%EvalError%":EvalError,"%EvalErrorPrototype%":EvalError.prototype,"%Float32Array%":"undefined"==typeof Float32Array?undefined:Float32Array,"%Float32ArrayPrototype%":"undefined"==typeof Float32Array?undefined:Float32Array.prototype,"%Float64Array%":"undefined"==typeof Float64Array?undefined:Float64Array,"%Float64ArrayPrototype%":"undefined"==typeof Float64Array?undefined:Float64Array.prototype,"%Function%":Function,"%FunctionPrototype%":Function.prototype,"%Generator%":generator?getProto(generator()):undefined,"%GeneratorFunction%":generatorFunction,"%GeneratorPrototype%":generatorFunction?generatorFunction.prototype:undefined,"%Int8Array%":"undefined"==typeof Int8Array?undefined:Int8Array,"%Int8ArrayPrototype%":"undefined"==typeof Int8Array?undefined:Int8Array.prototype,"%Int16Array%":"undefined"==typeof Int16Array?undefined:Int16Array,"%Int16ArrayPrototype%":"undefined"==typeof Int16Array?undefined:Int8Array.prototype,"%Int32Array%":"undefined"==typeof Int32Array?undefined:Int32Array,"%Int32ArrayPrototype%":"undefined"==typeof Int32Array?undefined:Int32Array.prototype,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols?getProto(getProto([][Symbol.iterator]())):undefined,"%JSON%":"object"==typeof JSON?JSON:undefined,"%JSONParse%":"object"==typeof JSON?JSON.parse:undefined,"%Map%":"undefined"==typeof Map?undefined:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&hasSymbols?getProto((new Map)[Symbol.iterator]()):undefined,"%MapPrototype%":"undefined"==typeof Map?undefined:Map.prototype,"%Math%":Math,"%Number%":Number,"%NumberPrototype%":Number.prototype,"%Object%":Object,"%ObjectPrototype%":Object.prototype,"%ObjProto_toString%":Object.prototype.toString,"%ObjProto_valueOf%":Object.prototype.valueOf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?undefined:Promise,"%PromisePrototype%":"undefined"==typeof Promise?undefined:Promise.prototype,"%PromiseProto_then%":"undefined"==typeof Promise?undefined:Promise.prototype.then,"%Promise_all%":"undefined"==typeof Promise?undefined:Promise.all,"%Promise_reject%":"undefined"==typeof Promise?undefined:Promise.reject,"%Promise_resolve%":"undefined"==typeof Promise?undefined:Promise.resolve,"%Proxy%":"undefined"==typeof Proxy?undefined:Proxy,"%RangeError%":RangeError,"%RangeErrorPrototype%":RangeError.prototype,"%ReferenceError%":ReferenceError,"%ReferenceErrorPrototype%":ReferenceError.prototype,"%Reflect%":"undefined"==typeof Reflect?undefined:Reflect,"%RegExp%":RegExp,"%RegExpPrototype%":RegExp.prototype,"%Set%":"undefined"==typeof Set?undefined:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&hasSymbols?getProto((new Set)[Symbol.iterator]()):undefined,"%SetPrototype%":"undefined"==typeof Set?undefined:Set.prototype,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?undefined:SharedArrayBuffer,"%SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?undefined:SharedArrayBuffer.prototype,"%String%":String,"%StringIteratorPrototype%":hasSymbols?getProto(""[Symbol.iterator]()):undefined,"%StringPrototype%":String.prototype,"%Symbol%":hasSymbols?Symbol:undefined,"%SymbolPrototype%":hasSymbols?Symbol.prototype:undefined,"%SyntaxError%":SyntaxError,"%SyntaxErrorPrototype%":SyntaxError.prototype,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypedArrayPrototype%":TypedArray?TypedArray.prototype:undefined,"%TypeError%":$TypeError,"%TypeErrorPrototype%":$TypeError.prototype,"%Uint8Array%":"undefined"==typeof Uint8Array?undefined:Uint8Array,"%Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?undefined:Uint8Array.prototype,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?undefined:Uint8ClampedArray,"%Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?undefined:Uint8ClampedArray.prototype,"%Uint16Array%":"undefined"==typeof Uint16Array?undefined:Uint16Array,"%Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?undefined:Uint16Array.prototype,"%Uint32Array%":"undefined"==typeof Uint32Array?undefined:Uint32Array,"%Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?undefined:Uint32Array.prototype,"%URIError%":URIError,"%URIErrorPrototype%":URIError.prototype,"%WeakMap%":"undefined"==typeof WeakMap?undefined:WeakMap,"%WeakMapPrototype%":"undefined"==typeof WeakMap?undefined:WeakMap.prototype,"%WeakSet%":"undefined"==typeof WeakSet?undefined:WeakSet,"%WeakSetPrototype%":"undefined"==typeof WeakSet?undefined:WeakSet.prototype},bind=require("function-bind"),$replace=bind.call(Function.call,String.prototype.replace),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function(e){var r=[];return $replace(e,rePropName,function(e,t,o,n){r[r.length]=o?$replace(n,reEscapeChar,"$1"):t||e}),r},getBaseIntrinsic=function(e,r){if(!(e in INTRINSICS))throw new SyntaxError("intrinsic "+e+" does not exist!");if(void 0===INTRINSICS[e]&&!r)throw new $TypeError("intrinsic "+e+" exists, but is not available. Please file an issue!");return INTRINSICS[e]};module.exports=function(e,r){if("string"!=typeof e||0===e.length)throw new TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof r)throw new TypeError('"allowMissing" argument must be a boolean');for(var t=stringToPath(e),o=getBaseIntrinsic("%"+(t.length>0?t[0]:"")+"%",r),n=1;n=t.length){var y=$gOPD(o,t[n]);if(!(r||t[n]in o))throw new $TypeError("base intrinsic for "+e+" exists, but the property is not available.");o=y?y.get||y.value:o[t[n]]}else o=o[t[n]];return o}; + +},{"function-bind":179,"has-symbols":182}],169:[function(require,module,exports){ +"use strict";var bind=require("function-bind"),GetIntrinsic=require("../GetIntrinsic"),$apply=GetIntrinsic("%Function.prototype.apply%"),$call=GetIntrinsic("%Function.prototype.call%"),$reflectApply=GetIntrinsic("%Reflect.apply%",!0)||bind.call($call,$apply);module.exports=function(){return $reflectApply(bind,$call,arguments)},module.exports.apply=function(){return $reflectApply(bind,$apply,arguments)}; + +},{"../GetIntrinsic":168,"function-bind":179}],170:[function(require,module,exports){ +"use strict";var GetIntrinsic=require("../GetIntrinsic"),callBind=require("./callBind"),$indexOf=callBind(GetIntrinsic("String.prototype.indexOf"));module.exports=function(i,n){var t=GetIntrinsic(i,!!n);return"function"==typeof t&&$indexOf(i,".prototype.")?callBind(t):t}; + +},{"../GetIntrinsic":168,"./callBind":169}],171:[function(require,module,exports){ +"use strict";var GetIntrinsic=require("../GetIntrinsic"),$gOPD=GetIntrinsic("%Object.getOwnPropertyDescriptor%");if($gOPD)try{$gOPD([],"length")}catch(t){$gOPD=null}module.exports=$gOPD; -},{}],150:[function(require,module,exports){ +},{"../GetIntrinsic":168}],172:[function(require,module,exports){ +"use strict";var ReflectOwnKeys,R="object"==typeof Reflect?Reflect:null,ReflectApply=R&&"function"==typeof R.apply?R.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}ReflectOwnKeys=R&&"function"==typeof R.ownKeys?R.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var NumberIsNaN=Number.isNaN||function(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}module.exports=EventEmitter,module.exports.once=once,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function _addListener(e,t,n,r){var i,s,o;if(checkListener(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=_getMaxListeners(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,ProcessEmitWarning(u)}return e}function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=onceWrapper.bind(r);return i.listener=n,r.wrapFn=i,i}function _listeners(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?unwrapListeners(i):arrayClone(i,i.length)}function listenerCount(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function arrayClone(e,t){for(var n=new Array(t),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)ReflectApply(u,this,t);else{var v=u.length,a=arrayClone(u,v);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():spliceOne(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,s=Object.keys(n);for(r=0;r=0;r--)this.removeListener(e,t[r]);return this},EventEmitter.prototype.listeners=function(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]}; + +},{}],173:[function(require,module,exports){ var Buffer=require("safe-buffer").Buffer,MD5=require("md5.js");function EVP_BytesToKey(e,f,r,t){if(Buffer.isBuffer(e)||(e=Buffer.from(e,"binary")),f&&(Buffer.isBuffer(f)||(f=Buffer.from(f,"binary")),8!==f.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var u=r/8,a=Buffer.alloc(u),l=Buffer.alloc(t||0),n=Buffer.alloc(0);u>0||t>0;){var i=new MD5;i.update(n),i.update(e),f&&i.update(f),n=i.digest();var o=0;if(u>0){var B=a.length-u;o=Math.min(u,n.length),n.copy(a,B,0,o),u-=o}if(o0){var h=l.length-t,s=Math.min(t,n.length-o);n.copy(l,h,o,o+s),t-=s}}return n.fill(0),{key:a,iv:l}}module.exports=EVP_BytesToKey; -},{"md5.js":215,"safe-buffer":446}],151:[function(require,module,exports){ +},{"md5.js":281,"safe-buffer":511}],174:[function(require,module,exports){ function getStack(e){return e.stack&&e.name&&e.message?e.stack.substring(e.name.length+3+e.message.length).split("\n"):e.stack?e.stack.split("\n"):void 0}function removePrefix(e,r){return e.filter(function(e){return!~r.indexOf(e)})}var explain=module.exports=function(e,r){if(!(e.stack&&e.name&&e.message))return console.error(new Error("stackless error")),e;var n=new Error(r),t=removePrefix(getStack(n).slice(1),getStack(e)).join("\n");return n.__proto__=e,n.stack=n.name+": "+n.message+"\n"+t+"\n "+e.stack,n}; -},{}],152:[function(require,module,exports){ -module.exports=require("level-codec/lib/encodings").json; +},{}],175:[function(require,module,exports){ +"use strict";function FastIntegerCompression(){}function bytelog(e){return e<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5}function zigzag_encode(e){return e+e^e>>31}function zigzag_decode(e){return e>>1^-(1&e)}FastIntegerCompression.computeCompressedSizeInBytes=function(e){for(var n=e.length,r=0,t=0;t>>7):g<1<<21?(t[o++]=127&g|128,t[o++]=g>>>7&127|128,t[o++]=g>>>14):g<1<<28?(t[o++]=127&g|128,t[o++]=g>>>7&127|128,t[o++]=g>>>14&127|128,t[o++]=g>>>21):(t[o++]=127&g|128,t[o++]=g>>>7&127|128,t[o++]=g>>>14&127|128,t[o++]=g>>>21&127|128,t[o++]=g>>>28)}return r},FastIntegerCompression.computeHowManyIntegers=function(e){for(var n=new Int8Array(e).length,r=0,t=0;t>>7;return n-r},FastIntegerCompression.uncompress=function(e){for(var n=[],r=new Int8Array(e),t=r.length,o=0;t>o;){var s=r[o++],g=127&s;s>=0?n.push(g):(g|=(127&(s=r[o++]))<<7,s>=0?n.push(g):(g|=(127&(s=r[o++]))<<14,s>=0?n.push(g):(g|=(127&(s=r[o++]))<<21,s>=0?n.push(g):(g|=(s=r[o++])<<28,g>>>=0,n.push(g)))))}return n},FastIntegerCompression.compressSigned=function(e){for(var n=e.length,r=new ArrayBuffer(FastIntegerCompression.computeCompressedSizeInBytesSigned(e)),t=new Int8Array(r),o=0,s=0;s>>7):g<1<<21?(t[o++]=127&g|128,t[o++]=g>>>7&127|128,t[o++]=g>>>14):g<1<<28?(t[o++]=127&g|128,t[o++]=g>>>7&127|128,t[o++]=g>>>14&127|128,t[o++]=g>>>21):(t[o++]=127&g|128,t[o++]=g>>>7&127|128,t[o++]=g>>>14&127|128,t[o++]=g>>>21&127|128,t[o++]=g>>>28)}return r},FastIntegerCompression.uncompressSigned=function(e){for(var n=[],r=new Int8Array(e),t=r.length,o=0;t>o;){var s=r[o++],g=127&s;s>=0?n.push(zigzag_decode(g)):(g|=(127&(s=r[o++]))<<7,s>=0?n.push(zigzag_decode(g)):(g|=(127&(s=r[o++]))<<14,s>=0?n.push(zigzag_decode(g)):(g|=(127&(s=r[o++]))<<21,s>=0?n.push(zigzag_decode(g)):(g|=(s=r[o++])<<28,n.push(zigzag_decode(g))))))}return n},module.exports=FastIntegerCompression; -},{"level-codec/lib/encodings":208}],153:[function(require,module,exports){ -"use strict";var Obv=require("obv"),STATES={queried:1,checking:2,checked:3,responded:5,processing:6,processed:7};function each(e,t){for(var r in e)t(e[r],r,e)}function isEmpty(e){for(var t in e)return!1;return!0}module.exports=function(e){var t={},r={},n=e.initialWeight||-1,u=e.increment||function(e){return Number(e)-1},s=e.isRequest||function(e){return"number"==typeof e&&e<0},o=e.isResponse||function(e){return!s(e)},i=e.isQuery||function(){return!0},c=e.process||function(e,t,r){r(null,t)},a=e.compare||function(e,t){return t-e},d=e.maximum||-3,f=e.timeout||3e4,l=Obv();function T(e){e?l.once(e,!1):l.set(t)}function S(){return Date.now()}function v(e,t,n){if(r[e]){var u=r[e];for(delete r[e];u.length;)u.shift()(n,t)}}function p(e){return{state:STATES.queried,weight:e,value:null,requestedBy:{},requestedFrom:{},respondedTo:{},ts:S()}}return l.set(t),l(function(){each(t,function(r,n){r.state===STATES.queried&&(r.state=STATES.checking,r.ts=S(),e.check(n,function(e,u){u&&!r.value?(r.state=STATES.processed,v(n,r.value=u)):r.state=STATES.checked,r.ts=S(),l.set(t)})),null!=r.value&&r.state===STATES.responded&&(r.state=STATES.processing,r.ts=S(),c(n,r.value,function(e,u){e||(r.state=STATES.processed,r.ts=S(),u&&v(n,r.value=u),l.set(t))}))})}),{state:t,createStream:function(e){return{source:function(r,n){if(r)for(var u in t)delete t[u].respondedTo[e],delete t[u].requestedFrom[e];else!function r(){var u={};for(var s in t)t[s].state===STATES.processed&&t[s].requestedBy[e]&&!t[s].respondedTo[e]?(t[s].respondedTo[e]=!0,u[s]=t[s].value):t[s].state!==STATES.checked||t[s].requestedFrom[e]||(t[s].requestedFrom[e]=!0,u[s]=t[s].weight);isEmpty(u)?T(r):n(null,u)}()},sink:function(r){r(null,function n(c,f){if(c)for(var l in t)delete t[l].requestedBy[e];else{var S=!1;for(var l in f){var v=f[l];i(l)&&(s(v)||o(v,l))&&(s(f[l])?a(f[l],d)<0&&(t[l]?a(f[l],t[l].weight)<0&&(S=!0,t[l].requestedBy[e]=!0,t[l].weight=u(f[l])):(S=!0,t[l]=p(u(f[l])),t[l].requestedBy[e]=!0)):o(f[l])&&t[l].state==STATES.checked&&(t[l].state=STATES.responded,t[l].value=f[l],S=!0))}S&&T(),r(null,n)}})}}},query:function(e,u){var s;t[e]?t[e].state==STATES.processed?u(null,t[e].value):(r[e]=r[e]||[]).push(u):(s=!0,t[e]=p(n),r[e]=[u]),s&&T()},checkTimeout:function(){var e,r=Date.now();for(var n in t)t[n].ts+fthis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick(function(){r._read()});t.open(this.path,this.flags,this.mode,function(t,e){if(t)return r.emit("error",t),void(r.readable=!1);r.fd=e,r.emit("open",e),r._read()})},WriteStream:function e(i,s){if(!(this instanceof e))return new e(i,s);Stream.call(this);this.path=i;this.fd=null;this.writable=!0;this.flags="w";this.encoding="binary";this.mode=438;this.bytesWritten=0;s=s||{};var r=Object.keys(s);for(var h=0,a=r.length;h= zero");this.pos=this.start}this.busy=!1;this._queue=[];null===this.fd&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}}module.exports=legacy; +},{}],179:[function(require,module,exports){ +"use strict";var implementation=require("./implementation");module.exports=Function.prototype.bind||implementation; -}).call(this,require('_process')) -},{"_process":284,"stream":531}],157:[function(require,module,exports){ -(function (process){ -var constants=require("constants"),origCwd=process.cwd,cwd=null,platform=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return cwd||(cwd=origCwd.call(process)),cwd};try{process.cwd()}catch(n){}var chdir=process.chdir;function patch(n){var c,t;function o(c){return c?function(t,o,r){return c.call(n,t,o,function(n){l(n)&&(n=null),r&&r.apply(this,arguments)})}:c}function r(c){return c?function(t,o){try{return c.call(n,t,o)}catch(n){if(!l(n))throw n}}:c}function e(c){return c?function(t,o,r,e){return c.call(n,t,o,r,function(n){l(n)&&(n=null),e&&e.apply(this,arguments)})}:c}function i(c){return c?function(t,o,r){try{return c.call(n,t,o,r)}catch(n){if(!l(n))throw n}}:c}function u(c){return c?function(t,o,r){function e(n,c){c&&(c.uid<0&&(c.uid+=4294967296),c.gid<0&&(c.gid+=4294967296)),r&&r.apply(this,arguments)}return"function"==typeof o&&(r=o,o=null),o?c.call(n,t,o,e):c.call(n,t,e)}:c}function s(c){return c?function(t,o){var r=o?c.call(n,t,o):c.call(n,t);return r.uid<0&&(r.uid+=4294967296),r.gid<0&&(r.gid+=4294967296),r}:c}function l(n){return!n||("ENOSYS"===n.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==n.code&&"EPERM"!==n.code))}constants.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(n){n.lchmod=function(c,t,o){n.open(c,constants.O_WRONLY|constants.O_SYMLINK,t,function(c,r){c?o&&o(c):n.fchmod(r,t,function(c){n.close(r,function(n){o&&o(c||n)})})})},n.lchmodSync=function(c,t){var o,r=n.openSync(c,constants.O_WRONLY|constants.O_SYMLINK,t),e=!0;try{o=n.fchmodSync(r,t),e=!1}finally{if(e)try{n.closeSync(r)}catch(n){}else n.closeSync(r)}return o}}(n),n.lutimes||function(n){constants.hasOwnProperty("O_SYMLINK")?(n.lutimes=function(c,t,o,r){n.open(c,constants.O_SYMLINK,function(c,e){c?r&&r(c):n.futimes(e,t,o,function(c){n.close(e,function(n){r&&r(c||n)})})})},n.lutimesSync=function(c,t,o){var r,e=n.openSync(c,constants.O_SYMLINK),i=!0;try{r=n.futimesSync(e,t,o),i=!1}finally{if(i)try{n.closeSync(e)}catch(n){}else n.closeSync(e)}return r}):(n.lutimes=function(n,c,t,o){o&&process.nextTick(o)},n.lutimesSync=function(){})}(n),n.chown=e(n.chown),n.fchown=e(n.fchown),n.lchown=e(n.lchown),n.chmod=o(n.chmod),n.fchmod=o(n.fchmod),n.lchmod=o(n.lchmod),n.chownSync=i(n.chownSync),n.fchownSync=i(n.fchownSync),n.lchownSync=i(n.lchownSync),n.chmodSync=r(n.chmodSync),n.fchmodSync=r(n.fchmodSync),n.lchmodSync=r(n.lchmodSync),n.stat=u(n.stat),n.fstat=u(n.fstat),n.lstat=u(n.lstat),n.statSync=s(n.statSync),n.fstatSync=s(n.fstatSync),n.lstatSync=s(n.lstatSync),n.lchmod||(n.lchmod=function(n,c,t){t&&process.nextTick(t)},n.lchmodSync=function(){}),n.lchown||(n.lchown=function(n,c,t,o){o&&process.nextTick(o)},n.lchownSync=function(){}),"win32"===platform&&(n.rename=(c=n.rename,function(t,o,r){var e=Date.now(),i=0;c(t,o,function u(s){if(s&&("EACCES"===s.code||"EPERM"===s.code)&&Date.now()-e<6e4)return setTimeout(function(){n.stat(o,function(n,e){n&&"ENOENT"===n.code?c(t,o,u):r(s)})},i),void(i<100&&(i+=10));r&&r(s)})})),n.read=function(c){function t(t,o,r,e,i,u){var s;if(u&&"function"==typeof u){var l=0;s=function(f,a,d){if(f&&"EAGAIN"===f.code&&l<10)return l++,c.call(n,t,o,r,e,i,s);u.apply(this,arguments)}}return c.call(n,t,o,r,e,i,s)}return t.__proto__=c,t}(n.read),n.readSync=(t=n.readSync,function(c,o,r,e,i){for(var u=0;;)try{return t.call(n,c,o,r,e,i)}catch(n){if("EAGAIN"===n.code&&u<10){u++;continue}throw n}})}process.chdir=function(n){cwd=null,chdir.call(process,n)},module.exports=patch; +},{"./implementation":178}],180:[function(require,module,exports){ +"use strict";var Obv=require("obv"),STATES={queried:1,checking:2,checked:3,responded:5,processing:6,processed:7};function each(e,t){for(var r in e)t(e[r],r,e)}function isEmpty(e){for(var t in e)return!1;return!0}module.exports=function(e){var t={},r={},n=e.initialWeight||-1,u=e.increment||function(e){return Number(e)-1},s=e.isRequest||function(e){return"number"==typeof e&&e<0},o=e.isResponse||function(e){return!s(e)},i=e.isQuery||function(){return!0},c=e.process||function(e,t,r){r(null,t)},a=e.compare||function(e,t){return t-e},d=e.maximum||-3,f=e.timeout||3e4,l=Obv();function T(e){e?l.once(e,!1):l.set(t)}function S(){return Date.now()}function v(e,t,n){if(r[e]){var u=r[e];for(delete r[e];u.length;)u.shift()(n,t)}}function p(e){return{state:STATES.queried,weight:e,value:null,requestedBy:{},requestedFrom:{},respondedTo:{},ts:S()}}return l.set(t),l(function(){each(t,function(r,n){r.state===STATES.queried&&(r.state=STATES.checking,r.ts=S(),e.check(n,function(e,u){u&&!r.value?(r.state=STATES.processed,v(n,r.value=u)):r.state=STATES.checked,r.ts=S(),l.set(t)})),null!=r.value&&r.state===STATES.responded&&(r.state=STATES.processing,r.ts=S(),c(n,r.value,function(e,u){e||(r.state=STATES.processed,r.ts=S(),u&&v(n,r.value=u),l.set(t))}))})}),{state:t,createStream:function(e){return{source:function(r,n){if(r)for(var u in t)delete t[u].respondedTo[e],delete t[u].requestedFrom[e];else!function r(){var u={};for(var s in t)t[s].state===STATES.processed&&t[s].requestedBy[e]&&!t[s].respondedTo[e]?(t[s].respondedTo[e]=!0,u[s]=t[s].value):t[s].state!==STATES.checked||t[s].requestedFrom[e]||(t[s].requestedFrom[e]=!0,u[s]=t[s].weight);isEmpty(u)?T(r):n(null,u)}()},sink:function(r){r(null,function n(c,f){if(c)for(var l in t)delete t[l].requestedBy[e];else{var S=!1;for(var l in f){var v=f[l];i(l)&&(s(v)||o(v,l))&&(s(f[l])?a(f[l],d)<0&&(t[l]?a(f[l],t[l].weight)<0&&(S=!0,t[l].requestedBy[e]=!0,t[l].weight=u(f[l])):(S=!0,t[l]=p(u(f[l])),t[l].requestedBy[e]=!0)):o(f[l])&&t[l].state==STATES.checked&&(t[l].state=STATES.responded,t[l].value=f[l],S=!0))}S&&T(),r(null,n)}})}}},query:function(e,u){var s;t[e]?t[e].state==STATES.processed?u(null,t[e].value):(r[e]=r[e]||[]).push(u):(s=!0,t[e]=p(n),r[e]=[u]),s&&T()},checkTimeout:function(){var e,r=Date.now();for(var n in t)t[n].ts+f=this._blockSize;){for(var i=this._blockOffset;i0;++f)this._length[f]+=o,(o=this._length[f]/4294967296|0)>0&&(this._length[f]-=4294967296*o);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},module.exports=HashBase; -},{"inherits":195,"readable-stream":174,"safe-buffer":446}],160:[function(require,module,exports){ +},{"inherits":225,"readable-stream":199,"safe-buffer":511}],185:[function(require,module,exports){ "use strict";function _inheritsLoose(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r}var codes={};function createErrorType(e,r,t){t||(t=Error);var n=function(e){function t(t,n,o){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,o))||this}return _inheritsLoose(t,e),t}(t);n.prototype.name=t.name,n.prototype.code=e,codes[e]=n}function oneOf(e,r){if(Array.isArray(e)){var t=e.length;return e=e.map(function(e){return String(e)}),t>2?"one of ".concat(r," ").concat(e.slice(0,t-1).join(", "),", or ")+e[t-1]:2===t?"one of ".concat(r," ").concat(e[0]," or ").concat(e[1]):"of ".concat(r," ").concat(e[0])}return"of ".concat(r," ").concat(String(e))}function startsWith(e,r,t){return e.substr(!t||t<0?0:+t,r.length)===r}function endsWith(e,r,t){return(void 0===t||t>e.length)&&(t=e.length),e.substring(t-r.length,t)===r}function includes(e,r,t){return"number"!=typeof t&&(t=0),!(t+r.length>e.length)&&-1!==e.indexOf(r,t)}createErrorType("ERR_INVALID_OPT_VALUE",function(e,r){return'The value "'+r+'" is invalid for option "'+e+'"'},TypeError),createErrorType("ERR_INVALID_ARG_TYPE",function(e,r,t){var n,o;if("string"==typeof r&&startsWith(r,"not ")?(n="must not be",r=r.replace(/^not /,"")):n="must be",endsWith(e," argument"))o="The ".concat(e," ").concat(n," ").concat(oneOf(r,"type"));else{var c=includes(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(c," ").concat(n," ").concat(oneOf(r,"type"))}return o+=". Received type ".concat(typeof t)},TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),module.exports.codes=codes; -},{}],161:[function(require,module,exports){ -(function (process){ +},{}],186:[function(require,module,exports){ +(function (process){(function (){ "use strict";var objectKeys=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};module.exports=Duplex;var Readable=require("./_stream_readable"),Writable=require("./_stream_writable");require("inherits")(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v0)if("string"==typeof t||d.objectMode||Object.getPrototypeOf(t)===Buffer.prototype||(t=_uint8ArrayToBuffer(t)),a)d.endEmitted?errorOrDestroy(e,new ERR_STREAM_UNSHIFT_AFTER_END_EVENT):addChunk(e,d,t,!0);else if(d.ended)errorOrDestroy(e,new ERR_STREAM_PUSH_AFTER_EOF);else{if(d.destroyed)return!1;d.reading=!1,d.decoder&&!r?(t=d.decoder.write(t),d.objectMode||0!==t.length?addChunk(e,d,t,!1):maybeReadMore(e,d)):addChunk(e,d,t,!1)}else a||(d.reading=!1,maybeReadMore(e,d));return!d.ended&&(d.length=MAX_HWM?e=MAX_HWM:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function howMuchToRead(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=computeNewHighWaterMark(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function onEofChunk(e,t){if(debug("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}}function emitReadable(e){var t=e._readableState;debug("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(debug("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;debug("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){debug("readable nexttick read 0"),e.read(0)}function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(resume_,e,t))}function resume_(e,t){debug("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(debug("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function endReadable(e){var t=e._readableState;debug("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(debug("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return debug("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return debug("need readable",n),(0===t.length||t.length-e0?fromList(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){errorOrDestroy(this,new ERR_METHOD_NOT_IMPLEMENTED("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,debug("pipe count=%d opts=%j",a.pipesCount,t);var n=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?d:f;function i(t,n){debug("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,debug("cleanup"),e.removeListener("close",b),e.removeListener("finish",p),e.removeListener("drain",o),e.removeListener("error",u),e.removeListener("unpipe",i),r.removeListener("end",d),r.removeListener("end",f),r.removeListener("data",l),s=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||o())}function d(){debug("onend"),e.end()}a.endEmitted?process.nextTick(n):r.once("end",n),e.on("unpipe",i);var o=pipeOnDrain(r);e.on("drain",o);var s=!1;function l(t){debug("ondata");var n=e.write(t);debug("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!s&&(debug("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function u(t){debug("onerror",t),f(),e.removeListener("error",u),0===EElistenerCount(e,"error")&&errorOrDestroy(e,t)}function b(){e.removeListener("finish",p),f()}function p(){debug("onfinish"),e.removeListener("close",b),f()}function f(){debug("unpipe"),r.unpipe(e)}return r.on("data",l),prependListener(e,"error",u),e.once("close",b),e.once("finish",p),e.emit("pipe",r),a.flowing||(debug("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,debug("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||process.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=Stream.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=Stream.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(debug("resume"),e.flowing=!e.readableListening,resume(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return debug("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(debug("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",function(){if(debug("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(n){(debug("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))}),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var i=0;i-1))throw new ERR_UNKNOWN_ENCODING(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new ERR_METHOD_NOT_IMPLEMENTED("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var i=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||endWritable(this,i,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=destroyImpl.destroy,Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(e,t){t(e)}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":160,"./_stream_duplex":161,"./internal/streams/destroy":168,"./internal/streams/state":172,"./internal/streams/stream":173,"_process":284,"buffer":88,"inherits":195,"util-deprecate":566}],166:[function(require,module,exports){ -(function (process){ +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":185,"./_stream_duplex":186,"./internal/streams/destroy":193,"./internal/streams/state":197,"./internal/streams/stream":198,"_process":349,"buffer":101,"inherits":225,"util-deprecate":666}],191:[function(require,module,exports){ +(function (process){(function (){ "use strict";var _Object$setPrototypeO;function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var finished=require("./end-of-stream"),kLastResolve=Symbol("lastResolve"),kLastReject=Symbol("lastReject"),kError=Symbol("error"),kEnded=Symbol("ended"),kLastPromise=Symbol("lastPromise"),kHandlePromise=Symbol("handlePromise"),kStream=Symbol("stream");function createIterResult(e,t){return{value:e,done:t}}function readAndResolve(e){var t=e[kLastResolve];if(null!==t){var r=e[kStream].read();null!==r&&(e[kLastPromise]=null,e[kLastResolve]=null,e[kLastReject]=null,t(createIterResult(r,!1)))}}function onReadable(e){process.nextTick(readAndResolve,e)}function wrapForNext(e,t){return function(r,o){e.then(function(){t[kEnded]?r(createIterResult(void 0,!0)):t[kHandlePromise](r,o)},o)}}var AsyncIteratorPrototype=Object.getPrototypeOf(function(){}),ReadableStreamAsyncIteratorPrototype=Object.setPrototypeOf((_defineProperty(_Object$setPrototypeO={get stream(){return this[kStream]},next:function(){var e=this,t=this[kError];if(null!==t)return Promise.reject(t);if(this[kEnded])return Promise.resolve(createIterResult(void 0,!0));if(this[kStream].destroyed)return new Promise(function(t,r){process.nextTick(function(){e[kError]?r(e[kError]):t(createIterResult(void 0,!0))})});var r,o=this[kLastPromise];if(o)r=new Promise(wrapForNext(o,this));else{var n=this[kStream].read();if(null!==n)return Promise.resolve(createIterResult(n,!1));r=new Promise(this[kHandlePromise])}return this[kLastPromise]=r,r}},Symbol.asyncIterator,function(){return this}),_defineProperty(_Object$setPrototypeO,"return",function(){var e=this;return new Promise(function(t,r){e[kStream].destroy(null,function(e){e?r(e):t(createIterResult(void 0,!0))})})}),_Object$setPrototypeO),AsyncIteratorPrototype),createReadableStreamAsyncIterator=function(e){var t,r=Object.create(ReadableStreamAsyncIteratorPrototype,(_defineProperty(t={},kStream,{value:e,writable:!0}),_defineProperty(t,kLastResolve,{value:null,writable:!0}),_defineProperty(t,kLastReject,{value:null,writable:!0}),_defineProperty(t,kError,{value:null,writable:!0}),_defineProperty(t,kEnded,{value:e._readableState.endEmitted,writable:!0}),_defineProperty(t,kHandlePromise,{value:function(e,t){var o=r[kStream].read();o?(r[kLastPromise]=null,r[kLastResolve]=null,r[kLastReject]=null,e(createIterResult(o,!1))):(r[kLastResolve]=e,r[kLastReject]=t)},writable:!0}),t));return r[kLastPromise]=null,finished(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[kLastReject];return null!==t&&(r[kLastPromise]=null,r[kLastResolve]=null,r[kLastReject]=null,t(e)),void(r[kError]=e)}var o=r[kLastResolve];null!==o&&(r[kLastPromise]=null,r[kLastResolve]=null,r[kLastReject]=null,o(createIterResult(void 0,!0))),r[kEnded]=!0}),e.on("readable",onReadable.bind(null,r)),r};module.exports=createReadableStreamAsyncIterator; -}).call(this,require('_process')) -},{"./end-of-stream":169,"_process":284}],167:[function(require,module,exports){ +}).call(this)}).call(this,require('_process')) +},{"./end-of-stream":194,"_process":349}],192:[function(require,module,exports){ "use strict";function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return Buffer.alloc(0);for(var t=Buffer.allocUnsafe(e>>>0),n=this.head,r=0;n;)copyBuffer(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return ea.length?a.length:e;if(i===a.length?r+=a:r+=a.slice(0,e),0===(e-=i)){i===a.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=a.slice(i));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=Buffer.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var a=n.data,i=e>a.length?a.length:e;if(a.copy(t,t.length-e,0,i),0===(e-=i)){i===a.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(i));break}++r}return this.length-=r,t}},{key:custom,value:function(e,t){return inspect(this,_objectSpread({},t,{depth:0,customInspect:!1}))}}]),e}(); -},{"buffer":88,"util":43}],168:[function(require,module,exports){ -(function (process){ +},{"buffer":101,"util":57}],193:[function(require,module,exports){ +(function (process){(function (){ "use strict";function destroy(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(emitErrorNT,this,t)):process.nextTick(emitErrorNT,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?r._writableState?r._writableState.errorEmitted?process.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,process.nextTick(emitErrorAndCloseNT,r,t)):process.nextTick(emitErrorAndCloseNT,r,t):e?(process.nextTick(emitCloseNT,r),e(t)):process.nextTick(emitCloseNT,r)}),this)}function emitErrorAndCloseNT(t,e){emitErrorNT(t,e),emitCloseNT(t)}function emitCloseNT(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(t,e){t.emit("error",e)}function errorOrDestroy(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy}; -}).call(this,require('_process')) -},{"_process":284}],169:[function(require,module,exports){ +}).call(this)}).call(this,require('_process')) +},{"_process":349}],194:[function(require,module,exports){ "use strict";var ERR_STREAM_PREMATURE_CLOSE=require("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function once(e){var r=!1;return function(){if(!r){r=!0;for(var t=arguments.length,n=new Array(t),o=0;o0,function(e){o||(o=e),e&&i.forEach(call),u||(i.forEach(call),t(o))})});return r.reduce(pipe)}module.exports=pipeline; -},{"../../../errors":160,"./end-of-stream":169}],172:[function(require,module,exports){ +},{"../../../errors":185,"./end-of-stream":194}],197:[function(require,module,exports){ "use strict";var ERR_INVALID_OPT_VALUE=require("../../../errors").codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(r,e,t){return null!=r.highWaterMark?r.highWaterMark:e?r[t]:null}function getHighWaterMark(r,e,t,a){var i=highWaterMarkFrom(e,a,t);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new ERR_INVALID_OPT_VALUE(a?t:"highWaterMark",i);return Math.floor(i)}return r.objectMode?16:16384}module.exports={getHighWaterMark:getHighWaterMark}; -},{"../../../errors":160}],173:[function(require,module,exports){ +},{"../../../errors":185}],198:[function(require,module,exports){ module.exports=require("events").EventEmitter; -},{"events":149}],174:[function(require,module,exports){ +},{"events":172}],199:[function(require,module,exports){ exports=module.exports=require("./lib/_stream_readable.js"),exports.Stream=exports,exports.Readable=exports,exports.Writable=require("./lib/_stream_writable.js"),exports.Duplex=require("./lib/_stream_duplex.js"),exports.Transform=require("./lib/_stream_transform.js"),exports.PassThrough=require("./lib/_stream_passthrough.js"),exports.finished=require("./lib/internal/streams/end-of-stream.js"),exports.pipeline=require("./lib/internal/streams/pipeline.js"); -},{"./lib/_stream_duplex.js":161,"./lib/_stream_passthrough.js":162,"./lib/_stream_readable.js":163,"./lib/_stream_transform.js":164,"./lib/_stream_writable.js":165,"./lib/internal/streams/end-of-stream.js":169,"./lib/internal/streams/pipeline.js":171}],175:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":186,"./lib/_stream_passthrough.js":187,"./lib/_stream_readable.js":188,"./lib/_stream_transform.js":189,"./lib/_stream_writable.js":190,"./lib/internal/streams/end-of-stream.js":194,"./lib/internal/streams/pipeline.js":196}],200:[function(require,module,exports){ var hash=exports;hash.utils=require("./hash/utils"),hash.common=require("./hash/common"),hash.sha=require("./hash/sha"),hash.ripemd=require("./hash/ripemd"),hash.hmac=require("./hash/hmac"),hash.sha1=hash.sha.sha1,hash.sha256=hash.sha.sha256,hash.sha224=hash.sha.sha224,hash.sha384=hash.sha.sha384,hash.sha512=hash.sha.sha512,hash.ripemd160=hash.ripemd.ripemd160; -},{"./hash/common":176,"./hash/hmac":177,"./hash/ripemd":178,"./hash/sha":179,"./hash/utils":186}],176:[function(require,module,exports){ +},{"./hash/common":201,"./hash/hmac":202,"./hash/ripemd":203,"./hash/sha":204,"./hash/utils":211}],201:[function(require,module,exports){ "use strict";var utils=require("./utils"),assert=require("minimalistic-assert");function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}exports.BlockHash=BlockHash,BlockHash.prototype.update=function(t,i){if(t=utils.toArray(t,i),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=utils.join32(t,0,t.length-n,this.endian);for(var s=0;s>>24&255,s[e++]=t>>>16&255,s[e++]=t>>>8&255,s[e++]=255&t}else for(s[e++]=255&t,s[e++]=t>>>8&255,s[e++]=t>>>16&255,s[e++]=t>>>24&255,s[e++]=0,s[e++]=0,s[e++]=0,s[e++]=0,h=8;hthis.blockSize&&(t=(new this.Hash).update(t).digest()),assert(t.length<=this.blockSize);for(var i=t.length;i>>3}function g1_256(r){return rotr32(r,17)^rotr32(r,19)^r>>>10}exports.ft_1=ft_1,exports.ch32=ch32,exports.maj32=maj32,exports.p32=p32,exports.s0_256=s0_256,exports.s1_256=s1_256,exports.g0_256=g0_256,exports.g1_256=g1_256; -},{"../utils":186}],186:[function(require,module,exports){ +},{"../utils":211}],211:[function(require,module,exports){ "use strict";var assert=require("minimalistic-assert"),inherits=require("inherits");function isSurrogatePair(r,t){return 55296==(64512&r.charCodeAt(t))&&(!(t<0||t+1>=r.length)&&56320==(64512&r.charCodeAt(t+1)))}function toArray(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var o=[];if("string"==typeof r)if(t){if("hex"===t)for((r=r.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(r="0"+r),n=0;n>6|192,o[e++]=63&u|128):isSurrogatePair(r,n)?(u=65536+((1023&u)<<10)+(1023&r.charCodeAt(++n)),o[e++]=u>>18|240,o[e++]=u>>12&63|128,o[e++]=u>>6&63|128,o[e++]=63&u|128):(o[e++]=u>>12|224,o[e++]=u>>6&63|128,o[e++]=63&u|128)}else for(n=0;n>>24|r>>>8&65280|r<<8&16711680|(255&r)<<24)>>>0}function toHex32(r,t){for(var o="",e=0;e>>0}return u}function split32(r,t){for(var o=new Array(4*r.length),e=0,n=0;e>>24,o[n+1]=u>>>16&255,o[n+2]=u>>>8&255,o[n+3]=255&u):(o[n+3]=u>>>24,o[n+2]=u>>>16&255,o[n+1]=u>>>8&255,o[n]=255&u)}return o}function rotr32(r,t){return r>>>t|r<<32-t}function rotl32(r,t){return r<>>32-t}function sum32(r,t){return r+t>>>0}function sum32_3(r,t,o){return r+t+o>>>0}function sum32_4(r,t,o,e){return r+t+o+e>>>0}function sum32_5(r,t,o,e,n){return r+t+o+e+n>>>0}function sum64(r,t,o,e){var n=r[t],u=e+r[t+1]>>>0,s=(u>>0,r[t+1]=u}function sum64_hi(r,t,o,e){return(t+e>>>0>>0}function sum64_lo(r,t,o,e){return t+e>>>0}function sum64_4_hi(r,t,o,e,n,u,s,i){var h=0,_=t;return h+=(_=_+e>>>0)>>0)>>0)>>0}function sum64_4_lo(r,t,o,e,n,u,s,i){return t+e+u+i>>>0}function sum64_5_hi(r,t,o,e,n,u,s,i,h,_){var l=0,f=t;return l+=(f=f+e>>>0)>>0)>>0)>>0)<_?1:0)>>>0}function sum64_5_lo(r,t,o,e,n,u,s,i,h,_){return t+e+u+i+_>>>0}function rotr64_hi(r,t,o){return(t<<32-o|r>>>o)>>>0}function rotr64_lo(r,t,o){return(r<<32-o|t>>>o)>>>0}function shr64_hi(r,t,o){return r>>>o}function shr64_lo(r,t,o){return(r<<32-o|t>>>o)>>>0}exports.inherits=inherits,exports.toArray=toArray,exports.toHex=toHex,exports.htonl=htonl,exports.toHex32=toHex32,exports.zero2=zero2,exports.zero8=zero8,exports.join32=join32,exports.split32=split32,exports.rotr32=rotr32,exports.rotl32=rotl32,exports.sum32=sum32,exports.sum32_3=sum32_3,exports.sum32_4=sum32_4,exports.sum32_5=sum32_5,exports.sum64=sum64,exports.sum64_hi=sum64_hi,exports.sum64_lo=sum64_lo,exports.sum64_4_hi=sum64_4_hi,exports.sum64_4_lo=sum64_4_lo,exports.sum64_5_hi=sum64_5_hi,exports.sum64_5_lo=sum64_5_lo,exports.rotr64_hi=rotr64_hi,exports.rotr64_lo=rotr64_lo,exports.shr64_hi=shr64_hi,exports.shr64_lo=shr64_lo; -},{"inherits":195,"minimalistic-assert":218}],187:[function(require,module,exports){ +},{"inherits":225,"minimalistic-assert":284}],212:[function(require,module,exports){ module.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,n=Object.create(null),r=Object.create(null);function o(o,u){n[o]=u,++t>=e&&(t=0,r=n,n=Object.create(null))}return{has:function(e){return void 0!==n[e]||void 0!==r[e]},remove:function(e){void 0!==n[e]&&(n[e]=void 0),void 0!==r[e]&&(r[e]=void 0)},get:function(e){var t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(o(e,t),t):void 0},set:function(e,t){void 0!==n[e]?n[e]=t:o(e,t)},clear:function(){n=Object.create(null),r=Object.create(null)}}}; -},{}],188:[function(require,module,exports){ +},{}],213:[function(require,module,exports){ "use strict";var hash=require("hash.js"),utils=require("minimalistic-crypto-utils"),assert=require("minimalistic-assert");function HmacDRBG(t){if(!(this instanceof HmacDRBG))return new HmacDRBG(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=utils.toArray(t.entropy,t.entropyEnc||"hex"),i=utils.toArray(t.nonce,t.nonceEnc||"hex"),s=utils.toArray(t.pers,t.persEnc||"hex");assert(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,i,s)}module.exports=HmacDRBG,HmacDRBG.prototype._init=function(t,e,i){var s=t.concat(e).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var h=0;h=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(i||[])),this._reseed=1},HmacDRBG.prototype.generate=function(t,e,i,s){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(s=i,i=e,e=null),i&&(i=utils.toArray(i,s||"hex"),this._update(i));for(var h=[];h.lengtho[i];)if(++i===o.length)return void r(null,a());n===o[i]?(s[n]=e.value,e.continue()):e.continue(o[i])}else r(null,a())}}),r.promise)},Transaction.prototype.json=function(t,r){if("function"==typeof t)return this.json(null,t);r=promisize(r);var e={};return this.iterator(t,function(t,n){if(t)return r(t);n?(e[n.key]=n.value,n.continue()):r(null,e)}),r.promise},Transaction.prototype.keys=function(t,r){if("function"==typeof t)return this.keys(null,t);r=promisize(r);var e=[];return this.iterator(t,function(t,n){if(t)return r(t);n?(e.push(n.key),n.continue()):r(null,e)}),r.promise},Transaction.prototype.values=function(t,r){if("function"==typeof t)return this.values(null,t);r=promisize(r);var e=[];return this.iterator(t,function(t,n){if(t)return r(t);n?(e.push(n.value),n.continue()):r(null,e)}),r.promise},Transaction.prototype.remove=function(t,r){var e=this;if(null==t)throw new Error("A key must be given as an argument");return r=promisize(r),e._getObjectStore(function(n,o){if(n)return r(n);try{var i=o.delete(t)}catch(t){return r(t)}i.onerror=handleError.bind(this,r),i.onsuccess=function(){e._kvStore._channel&&e._kvStore._channel.postMessage({method:"remove",key:t}),r(null)}}),r.promise},Transaction.prototype.clear=function(t){return t=promisize(t),this._getObjectStore(function(r,e){if(r)return t(r);try{var n=e.clear()}catch(r){return t(r)}n.onerror=handleError.bind(this,t),n.onsuccess=function(){t(null)}}),t.promise},Transaction.prototype.count=function(t,r){return"function"==typeof t?this.count(null,t):(r=promisize(r),this._getObjectStore(function(e,n){if(e)return r(e);try{var o=null==t?n.count():n.count(t)}catch(t){return r(t)}o.onerror=handleError.bind(this,r),o.onsuccess=function(t){r(null,t.target.result)}}),r.promise)},Transaction.prototype.iterator=function(t,r){if("function"==typeof t)return this.iterator(null,t);if("function"!=typeof r)throw new Error("A function must be given");this._getObjectStore(function(e,n){if(e)return r(e);try{var o=null==t?n.openCursor():n.openCursor(t)}catch(t){return r(t)}o.onerror=handleError.bind(this,r),o.onsuccess=function(t){var e=t.target.result;r(null,e)}})},Transaction.prototype.abort=function(){if(this.finished)throw new Error("Transaction is finished");this._objectStore&&this._objectStore.transaction.abort(),this._close(new Error("Transaction aborted"))},Transaction.prototype._close=function(t){if(!this.finished){for(var r in this.finished=!0,this._kvStore=null,this._objectStore=null,this._waiters)this._waiters[r](t||new Error("Transaction is finished"));this._waiters=null,this.onfinish&&this.onfinish(t),this.onfinish=null}}; -},{"events":149,"inherits":195,"promisize":286}],192:[function(require,module,exports){ +},{"events":172,"inherits":225,"promisize":352}],217:[function(require,module,exports){ exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),(o+=p+N>=1?n/f:n*Math.pow(2,1-N))*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l}; -},{}],193:[function(require,module,exports){ -!function(){var t;function e(h,r){var s=this instanceof e?this:t;if(s.reset(r),"string"==typeof h&&h.length>0&&s.hash(h),s!==this)return s}e.prototype.hash=function(t){var e,h,r,s,i;switch(i=t.length,this.len+=i,h=this.k1,r=0,this.rem){case 0:h^=i>r?65535&t.charCodeAt(r++):0;case 1:h^=i>r?(65535&t.charCodeAt(r++))<<8:0;case 2:h^=i>r?(65535&t.charCodeAt(r++))<<16:0;case 3:h^=i>r?(255&t.charCodeAt(r))<<24:0,h^=i>r?(65280&t.charCodeAt(r++))>>8:0}if(this.rem=i+this.rem&3,(i-=this.rem)>0){for(e=this.h1;e=5*(e=(e^=h=13715*(h=(h=11601*h+3432906752*(65535&h)&4294967295)<<15|h>>>17)+461832192*(65535&h)&4294967295)<<13|e>>>19)+3864292196&4294967295,!(r>=i);)h=65535&t.charCodeAt(r++)^(65535&t.charCodeAt(r++))<<8^(65535&t.charCodeAt(r++))<<16,h^=(255&(s=t.charCodeAt(r++)))<<24^(65280&s)>>8;switch(h=0,this.rem){case 3:h^=(65535&t.charCodeAt(r+2))<<16;case 2:h^=(65535&t.charCodeAt(r+1))<<8;case 1:h^=65535&t.charCodeAt(r)}this.h1=e}return this.k1=h,this},e.prototype.result=function(){var t,e;return t=this.k1,e=this.h1,t>0&&(e^=t=13715*(t=(t=11601*t+3432906752*(65535&t)&4294967295)<<15|t>>>17)+461832192*(65535&t)&4294967295),e^=this.len,e=51819*(e^=e>>>16)+2246770688*(65535&e)&4294967295,e=44597*(e^=e>>>13)+3266445312*(65535&e)&4294967295,(e^=e>>>16)>>>0},e.prototype.reset=function(t){return this.h1="number"==typeof t?t:0,this.rem=this.k1=this.len=0,this},t=new e,"undefined"!=typeof module?module.exports=e:this.MurmurHash3=e}(); +},{}],218:[function(require,module,exports){ +"use strict";var draining,currentQueue,scheduleDrain,types=[require("./nextTick"),require("./queueMicrotask"),require("./mutation.js"),require("./messageChannel"),require("./stateChange"),require("./timeout")],queueIndex=-1,queue=[],scheduled=!1;function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&nextTick())}function nextTick(){if(!draining){scheduled=!1,draining=!0;for(var e=queue.length,u=setTimeout(cleanUpNextTick);e;){for(currentQueue=queue,queue=[];currentQueue&&++queueIndex1)for(var n=1;n=0&&255===r[e];e--)r[e]=0;return~e&&(r[e]=r[e]+1),r}; -},{}],195:[function(require,module,exports){ +},{}],225:[function(require,module,exports){ "function"==typeof Object.create?module.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:module.exports=function(t,e){if(e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}}; -},{}],196:[function(require,module,exports){ +},{}],226:[function(require,module,exports){ "use strict";var ip=exports,Buffer=require("buffer").Buffer,os=require("os");ip.toBuffer=function(r,t,e){var i;if(e=~~e,this.isV4Format(r))i=t||new Buffer(e+4),r.split(/\./g).map(function(r){i[e++]=255&parseInt(r,10)});else if(this.isV6Format(r)){var n,f=r.split(":",8);for(n=0;n0;n--)s.push("0");f.splice.apply(f,s)}for(i=t||new Buffer(e+16),n=0;n>8&255,i[e++]=255&a}}if(!i)throw Error("Invalid ip address: "+r);return i},ip.toString=function(r,t,e){t=~~t;var i=[];if(4===(e=e||r.length-t)){for(var n=0;n32?"ipv6":_normalizeFamily(t))&&(e=16);for(var i=new Buffer(e),n=0,f=i.length;n>o)}return ip.toString(i)},ip.mask=function(r,t){r=ip.toBuffer(r),t=ip.toBuffer(t);var e=new Buffer(Math.max(r.length,t.length)),i=0;if(r.length===t.length)for(i=0;ir.length&&(i=t,n=r);var f=i.length-n.length;for(e=f;e>>0},ip.fromLong=function(r){return(r>>>24)+"."+(r>>16&255)+"."+(r>>8&255)+"."+(255&r)}; -},{"buffer":88,"os":257}],197:[function(require,module,exports){ +},{"buffer":101,"os":322}],227:[function(require,module,exports){ +"use strict";var hasToStringTag="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,toStr=Object.prototype.toString,isStandardArguments=function(t){return!(hasToStringTag&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===toStr.call(t)},isLegacyArguments=function(t){return!!isStandardArguments(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==toStr.call(t)&&"[object Function]"===toStr.call(t.callee)},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments,module.exports=supportsStandardArguments?isStandardArguments:isLegacyArguments; + +},{}],228:[function(require,module,exports){ function isBuffer(f){return!!f.constructor&&"function"==typeof f.constructor.isBuffer&&f.constructor.isBuffer(f)}function isSlowBuffer(f){return"function"==typeof f.readFloatLE&&"function"==typeof f.slice&&isBuffer(f.slice(0,0))}module.exports=function(f){return null!=f&&(isBuffer(f)||isSlowBuffer(f)||!!f._isBuffer)}; -},{}],198:[function(require,module,exports){ +},{}],229:[function(require,module,exports){ var char="[a-zA-Z0-9/+]",trail2="[AQgw]==",trail4="[AEIMQUYcgkosw048]=",rx="(?:"+char+"{4})*(?:"+char+"(?:(?:"+trail2+")|(?:"+char+trail4+")))?";module.exports=function(r,a,e){if(!Number.isInteger(e))return new RegExp("^"+(r||"")+rx+(a||"")+"$");var t=e%3;return new RegExp("^"+(r||"")+char+"{"+~~(8*e/6)+"}"+(0===t?"":1===t?trail2:trail4)+(a||"")+"$")}; -},{}],199:[function(require,module,exports){ -(function (process){ +},{}],230:[function(require,module,exports){ +(function (process){(function (){ function isElectron(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}module.exports=isElectron; -}).call(this,require('_process')) -},{"_process":284}],200:[function(require,module,exports){ -(function (Buffer){ +}).call(this)}).call(this,require('_process')) +},{"_process":349}],231:[function(require,module,exports){ +"use strict";var toStr=Object.prototype.toString,fnToStr=Function.prototype.toString,isFnRegex=/^\s*(?:function)?\*/,hasToStringTag="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,getProto=Object.getPrototypeOf,getGeneratorFunc=function(){if(!hasToStringTag)return!1;try{return Function("return function*() {}")()}catch(t){}},generatorFunc=getGeneratorFunc(),GeneratorFunction=!(!getProto||!generatorFunc)&&getProto(generatorFunc);module.exports=function(t){return"function"==typeof t&&(!!isFnRegex.test(fnToStr.call(t))||(hasToStringTag?getProto&&getProto(t)===GeneratorFunction:"[object GeneratorFunction]"===toStr.call(t)))}; + +},{}],232:[function(require,module,exports){ +(function (Buffer){(function (){ function isOptions(e){return"object"==typeof e&&e&&!Buffer.isBuffer(e)}module.exports=isOptions; -}).call(this,{"isBuffer":require("../is-buffer/index.js")}) -},{"../is-buffer/index.js":197}],201:[function(require,module,exports){ -module.exports=isTypedArray,isTypedArray.strict=isStrictTypedArray,isTypedArray.loose=isLooseTypedArray;var toString=Object.prototype.toString,names={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function isTypedArray(r){return isStrictTypedArray(r)||isLooseTypedArray(r)}function isStrictTypedArray(r){return r instanceof Int8Array||r instanceof Int16Array||r instanceof Int32Array||r instanceof Uint8Array||r instanceof Uint8ClampedArray||r instanceof Uint16Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array}function isLooseTypedArray(r){return names[toString.call(r)]} +}).call(this)}).call(this,{"isBuffer":require("../is-buffer/index.js")}) +},{"../is-buffer/index.js":228}],233:[function(require,module,exports){ +(function (global){(function (){ +"use strict";var forEach=require("foreach"),availableTypedArrays=require("available-typed-arrays"),callBound=require("es-abstract/helpers/callBound"),$toString=callBound("Object.prototype.toString"),hasSymbols=require("has-symbols")(),hasToStringTag=hasSymbols&&"symbol"==typeof Symbol.toStringTag,typedArrays=availableTypedArrays(),$indexOf=callBound("Array.prototype.indexOf",!0)||function(r,t){for(var e=0;e-1}return!!gOPD&&tryTypedArrays(r)}; -},{}],202:[function(require,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"available-typed-arrays":51,"es-abstract/helpers/callBound":170,"es-abstract/helpers/getOwnPropertyDescriptor":171,"foreach":177,"has-symbols":182}],234:[function(require,module,exports){ module.exports={"com.ac":!0,"net.ac":!0,"gov.ac":!0,"org.ac":!0,"mil.ac":!0,"co.ae":!0,"net.ae":!0,"gov.ae":!0,"ac.ae":!0,"sch.ae":!0,"org.ae":!0,"mil.ae":!0,"pro.ae":!0,"name.ae":!0,"com.af":!0,"edu.af":!0,"gov.af":!0,"net.af":!0,"org.af":!0,"com.al":!0,"edu.al":!0,"gov.al":!0,"mil.al":!0,"net.al":!0,"org.al":!0,"ed.ao":!0,"gv.ao":!0,"og.ao":!0,"co.ao":!0,"pb.ao":!0,"it.ao":!0,"com.ar":!0,"edu.ar":!0,"gob.ar":!0,"gov.ar":!0,"int.ar":!0,"mil.ar":!0,"net.ar":!0,"org.ar":!0,"tur.ar":!0,"gv.at":!0,"ac.at":!0,"co.at":!0,"or.at":!0,"com.au":!0,"net.au":!0,"org.au":!0,"edu.au":!0,"gov.au":!0,"csiro.au":!0,"asn.au":!0,"id.au":!0,"vic.au":!0,"sa.au":!0,"wa.au":!0,"nt.au":!0,"tas.au":!0,"qld.au":!0,"act.au":!0,"conf.au":!0,"oz.au":!0,"org.ba":!0,"net.ba":!0,"edu.ba":!0,"gov.ba":!0,"mil.ba":!0,"unsa.ba":!0,"untz.ba":!0,"unmo.ba":!0,"unbi.ba":!0,"unze.ba":!0,"co.ba":!0,"com.ba":!0,"rs.ba":!0,"co.bb":!0,"com.bb":!0,"net.bb":!0,"org.bb":!0,"gov.bb":!0,"edu.bb":!0,"info.bb":!0,"store.bb":!0,"tv.bb":!0,"biz.bb":!0,"com.bh":!0,"info.bh":!0,"cc.bh":!0,"edu.bh":!0,"biz.bh":!0,"net.bh":!0,"org.bh":!0,"gov.bh":!0,"com.bn":!0,"edu.bn":!0,"gov.bn":!0,"net.bn":!0,"org.bn":!0,"com.bo":!0,"net.bo":!0,"org.bo":!0,"tv.bo":!0,"mil.bo":!0,"int.bo":!0,"gob.bo":!0,"gov.bo":!0,"edu.bo":!0,"adm.br":!0,"adv.br":!0,"agr.br":!0,"am.br":!0,"arq.br":!0,"art.br":!0,"ato.br":!0,"b.br":!0,"bio.br":!0,"blog.br":!0,"bmd.br":!0,"cim.br":!0,"cng.br":!0,"cnt.br":!0,"com.br":!0,"coop.br":!0,"ecn.br":!0,"edu.br":!0,"eng.br":!0,"esp.br":!0,"etc.br":!0,"eti.br":!0,"far.br":!0,"flog.br":!0,"fm.br":!0,"fnd.br":!0,"fot.br":!0,"fst.br":!0,"g12.br":!0,"ggf.br":!0,"gov.br":!0,"imb.br":!0,"ind.br":!0,"inf.br":!0,"jor.br":!0,"jus.br":!0,"lel.br":!0,"mat.br":!0,"med.br":!0,"mil.br":!0,"mus.br":!0,"net.br":!0,"nom.br":!0,"not.br":!0,"ntr.br":!0,"odo.br":!0,"org.br":!0,"ppg.br":!0,"pro.br":!0,"psc.br":!0,"psi.br":!0,"qsl.br":!0,"rec.br":!0,"slg.br":!0,"srv.br":!0,"tmp.br":!0,"trd.br":!0,"tur.br":!0,"tv.br":!0,"vet.br":!0,"vlog.br":!0,"wiki.br":!0,"zlg.br":!0,"com.bs":!0,"net.bs":!0,"org.bs":!0,"edu.bs":!0,"gov.bs":!0,"om.bz":!0,"du.bz":!0,"ov.bz":!0,"et.bz":!0,"rg.bz":!0,"ab.ca":!0,"bc.ca":!0,"mb.ca":!0,"nb.ca":!0,"nf.ca":!0,"nl.ca":!0,"ns.ca":!0,"nt.ca":!0,"nu.ca":!0,"on.ca":!0,"pe.ca":!0,"qc.ca":!0,"sk.ca":!0,"yk.ca":!0,"co.ck":!0,"org.ck":!0,"edu.ck":!0,"gov.ck":!0,"net.ck":!0,"gen.ck":!0,"biz.ck":!0,"info.ck":!0,"ac.cn":!0,"com.cn":!0,"edu.cn":!0,"gov.cn":!0,"mil.cn":!0,"net.cn":!0,"org.cn":!0,"ah.cn":!0,"bj.cn":!0,"cq.cn":!0,"fj.cn":!0,"gd.cn":!0,"gs.cn":!0,"gz.cn":!0,"gx.cn":!0,"ha.cn":!0,"hb.cn":!0,"he.cn":!0,"hi.cn":!0,"hl.cn":!0,"hn.cn":!0,"jl.cn":!0,"js.cn":!0,"jx.cn":!0,"ln.cn":!0,"nm.cn":!0,"nx.cn":!0,"qh.cn":!0,"sc.cn":!0,"sd.cn":!0,"sh.cn":!0,"sn.cn":!0,"sx.cn":!0,"tj.cn":!0,"tw.cn":!0,"xj.cn":!0,"xz.cn":!0,"yn.cn":!0,"zj.cn":!0,"com.co":!0,"org.co":!0,"edu.co":!0,"gov.co":!0,"net.co":!0,"mil.co":!0,"nom.co":!0,"ac.cr":!0,"co.cr":!0,"ed.cr":!0,"fi.cr":!0,"go.cr":!0,"or.cr":!0,"sa.cr":!0,cr:!0,"ac.cy":!0,"net.cy":!0,"gov.cy":!0,"org.cy":!0,"pro.cy":!0,"name.cy":!0,"ekloges.cy":!0,"tm.cy":!0,"ltd.cy":!0,"biz.cy":!0,"press.cy":!0,"parliament.cy":!0,"com.cy":!0,"edu.do":!0,"gob.do":!0,"gov.do":!0,"com.do":!0,"sld.do":!0,"org.do":!0,"net.do":!0,"web.do":!0,"mil.do":!0,"art.do":!0,"com.dz":!0,"org.dz":!0,"net.dz":!0,"gov.dz":!0,"edu.dz":!0,"asso.dz":!0,"pol.dz":!0,"art.dz":!0,"com.ec":!0,"info.ec":!0,"net.ec":!0,"fin.ec":!0,"med.ec":!0,"pro.ec":!0,"org.ec":!0,"edu.ec":!0,"gov.ec":!0,"mil.ec":!0,"com.eg":!0,"edu.eg":!0,"eun.eg":!0,"gov.eg":!0,"mil.eg":!0,"name.eg":!0,"net.eg":!0,"org.eg":!0,"sci.eg":!0,"com.er":!0,"edu.er":!0,"gov.er":!0,"mil.er":!0,"net.er":!0,"org.er":!0,"ind.er":!0,"rochest.er":!0,"w.er":!0,"com.es":!0,"nom.es":!0,"org.es":!0,"gob.es":!0,"edu.es":!0,"com.et":!0,"gov.et":!0,"org.et":!0,"edu.et":!0,"net.et":!0,"biz.et":!0,"name.et":!0,"info.et":!0,"ac.fj":!0,"biz.fj":!0,"com.fj":!0,"info.fj":!0,"mil.fj":!0,"name.fj":!0,"net.fj":!0,"org.fj":!0,"pro.fj":!0,"co.fk":!0,"org.fk":!0,"gov.fk":!0,"ac.fk":!0,"nom.fk":!0,"net.fk":!0,fr:!0,"tm.fr":!0,"asso.fr":!0,"nom.fr":!0,"prd.fr":!0,"presse.fr":!0,"com.fr":!0,"gouv.fr":!0,"co.gg":!0,"net.gg":!0,"org.gg":!0,"com.gh":!0,"edu.gh":!0,"gov.gh":!0,"org.gh":!0,"mil.gh":!0,"com.gn":!0,"ac.gn":!0,"gov.gn":!0,"org.gn":!0,"net.gn":!0,"com.gr":!0,"edu.gr":!0,"net.gr":!0,"org.gr":!0,"gov.gr":!0,"mil.gr":!0,"com.gt":!0,"edu.gt":!0,"net.gt":!0,"gob.gt":!0,"org.gt":!0,"mil.gt":!0,"ind.gt":!0,"com.gu":!0,"net.gu":!0,"gov.gu":!0,"org.gu":!0,"edu.gu":!0,"com.hk":!0,"edu.hk":!0,"gov.hk":!0,"idv.hk":!0,"net.hk":!0,"org.hk":!0,"2000.hu":!0,"agrar.hu":!0,"bolt.hu":!0,"casino.hu":!0,"city.hu":!0,"co.hu":!0,"erotica.hu":!0,"erotika.hu":!0,"film.hu":!0,"forum.hu":!0,"games.hu":!0,"hotel.hu":!0,"info.hu":!0,"ingatlan.hu":!0,"jogasz.hu":!0,"konyvelo.hu":!0,"lakas.hu":!0,"media.hu":!0,"news.hu":!0,"org.hu":!0,"priv.hu":!0,"reklam.hu":!0,"sex.hu":!0,"shop.hu":!0,"sport.hu":!0,"suli.huv":!0,"szex.hu":!0,"tm.hu":!0,"tozsde.hu":!0,"utazas.hu":!0,"video.hu":!0,"ac.id":!0,"co.id":!0,"net.id":!0,"or.id":!0,"web.id":!0,"sch.id":!0,"mil.id":!0,"go.id":!0,"war.net.id":!0,"ac.il":!0,"co.il":!0,"org.il":!0,"net.il":!0,"k12.il":!0,"gov.il":!0,"muni.il":!0,"idf.il":!0,in:!0,"4fd.in":!0,"co.in":!0,"firm.in":!0,"net.in":!0,"org.in":!0,"gen.in":!0,"ind.in":!0,"ac.in":!0,"edu.in":!0,"res.in":!0,"ernet.in":!0,"gov.in":!0,"mil.in":!0,"nic.in":!0,iq:!0,"gov.iq":!0,"edu.iq":!0,"com.iq":!0,"mil.iq":!0,"org.iq":!0,"net.iq":!0,ir:!0,"ac.ir":!0,"co.ir":!0,"gov.ir":!0,"id.ir":!0,"net.ir":!0,"org.ir":!0,"sch.ir":!0,"dnssec.ir":!0,"gov.it":!0,"edu.it":!0,"co.je":!0,"net.je":!0,"org.je":!0,"com.jo":!0,"net.jo":!0,"gov.jo":!0,"edu.jo":!0,"org.jo":!0,"mil.jo":!0,"name.jo":!0,"sch.jo":!0,"ac.jp":!0,"ad.jp":!0,"co.jp":!0,"ed.jp":!0,"go.jp":!0,"gr.jp":!0,"lg.jp":!0,"ne.jp":!0,"or.jp":!0,"co.ke":!0,"or.ke":!0,"ne.ke":!0,"go.ke":!0,"ac.ke":!0,"sc.ke":!0,"me.ke":!0,"mobi.ke":!0,"info.ke":!0,"per.kh":!0,"com.kh":!0,"edu.kh":!0,"gov.kh":!0,"mil.kh":!0,"net.kh":!0,"org.kh":!0,"com.ki":!0,"biz.ki":!0,"de.ki":!0,"net.ki":!0,"info.ki":!0,"org.ki":!0,"gov.ki":!0,"edu.ki":!0,"mob.ki":!0,"tel.ki":!0,km:!0,"com.km":!0,"coop.km":!0,"asso.km":!0,"nom.km":!0,"presse.km":!0,"tm.km":!0,"medecin.km":!0,"notaires.km":!0,"pharmaciens.km":!0,"veterinaire.km":!0,"edu.km":!0,"gouv.km":!0,"mil.km":!0,"net.kn":!0,"org.kn":!0,"edu.kn":!0,"gov.kn":!0,kr:!0,"co.kr":!0,"ne.kr":!0,"or.kr":!0,"re.kr":!0,"pe.kr":!0,"go.kr":!0,"mil.kr":!0,"ac.kr":!0,"hs.kr":!0,"ms.kr":!0,"es.kr":!0,"sc.kr":!0,"kg.kr":!0,"seoul.kr":!0,"busan.kr":!0,"daegu.kr":!0,"incheon.kr":!0,"gwangju.kr":!0,"daejeon.kr":!0,"ulsan.kr":!0,"gyeonggi.kr":!0,"gangwon.kr":!0,"chungbuk.kr":!0,"chungnam.kr":!0,"jeonbuk.kr":!0,"jeonnam.kr":!0,"gyeongbuk.kr":!0,"gyeongnam.kr":!0,"jeju.kr":!0,"edu.kw":!0,"com.kw":!0,"net.kw":!0,"org.kw":!0,"gov.kw":!0,"com.ky":!0,"org.ky":!0,"net.ky":!0,"edu.ky":!0,"gov.ky":!0,"com.kz":!0,"edu.kz":!0,"gov.kz":!0,"mil.kz":!0,"net.kz":!0,"org.kz":!0,"com.lb":!0,"edu.lb":!0,"gov.lb":!0,"net.lb":!0,"org.lb":!0,"gov.lk":!0,"sch.lk":!0,"net.lk":!0,"int.lk":!0,"com.lk":!0,"org.lk":!0,"edu.lk":!0,"ngo.lk":!0,"soc.lk":!0,"web.lk":!0,"ltd.lk":!0,"assn.lk":!0,"grp.lk":!0,"hotel.lk":!0,"com.lr":!0,"edu.lr":!0,"gov.lr":!0,"org.lr":!0,"net.lr":!0,"com.lv":!0,"edu.lv":!0,"gov.lv":!0,"org.lv":!0,"mil.lv":!0,"id.lv":!0,"net.lv":!0,"asn.lv":!0,"conf.lv":!0,"com.ly":!0,"net.ly":!0,"gov.ly":!0,"plc.ly":!0,"edu.ly":!0,"sch.ly":!0,"med.ly":!0,"org.ly":!0,"id.ly":!0,ma:!0,"net.ma":!0,"ac.ma":!0,"org.ma":!0,"gov.ma":!0,"press.ma":!0,"co.ma":!0,"tm.mc":!0,"asso.mc":!0,"co.me":!0,"net.me":!0,"org.me":!0,"edu.me":!0,"ac.me":!0,"gov.me":!0,"its.me":!0,"priv.me":!0,"org.mg":!0,"nom.mg":!0,"gov.mg":!0,"prd.mg":!0,"tm.mg":!0,"edu.mg":!0,"mil.mg":!0,"com.mg":!0,"com.mk":!0,"org.mk":!0,"net.mk":!0,"edu.mk":!0,"gov.mk":!0,"inf.mk":!0,"name.mk":!0,"pro.mk":!0,"com.ml":!0,"net.ml":!0,"org.ml":!0,"edu.ml":!0,"gov.ml":!0,"presse.ml":!0,"gov.mn":!0,"edu.mn":!0,"org.mn":!0,"com.mo":!0,"edu.mo":!0,"gov.mo":!0,"net.mo":!0,"org.mo":!0,"com.mt":!0,"org.mt":!0,"net.mt":!0,"edu.mt":!0,"gov.mt":!0,"aero.mv":!0,"biz.mv":!0,"com.mv":!0,"coop.mv":!0,"edu.mv":!0,"gov.mv":!0,"info.mv":!0,"int.mv":!0,"mil.mv":!0,"museum.mv":!0,"name.mv":!0,"net.mv":!0,"org.mv":!0,"pro.mv":!0,"ac.mw":!0,"co.mw":!0,"com.mw":!0,"coop.mw":!0,"edu.mw":!0,"gov.mw":!0,"int.mw":!0,"museum.mw":!0,"net.mw":!0,"org.mw":!0,"com.mx":!0,"net.mx":!0,"org.mx":!0,"edu.mx":!0,"gob.mx":!0,"com.my":!0,"net.my":!0,"org.my":!0,"gov.my":!0,"edu.my":!0,"sch.my":!0,"mil.my":!0,"name.my":!0,"com.nf":!0,"net.nf":!0,"arts.nf":!0,"store.nf":!0,"web.nf":!0,"firm.nf":!0,"info.nf":!0,"other.nf":!0,"per.nf":!0,"rec.nf":!0,"com.ng":!0,"org.ng":!0,"gov.ng":!0,"edu.ng":!0,"net.ng":!0,"sch.ng":!0,"name.ng":!0,"mobi.ng":!0,"biz.ng":!0,"mil.ng":!0,"gob.ni":!0,"co.ni":!0,"com.ni":!0,"ac.ni":!0,"edu.ni":!0,"org.ni":!0,"nom.ni":!0,"net.ni":!0,"mil.ni":!0,"com.np":!0,"edu.np":!0,"gov.np":!0,"org.np":!0,"mil.np":!0,"net.np":!0,"edu.nr":!0,"gov.nr":!0,"biz.nr":!0,"info.nr":!0,"net.nr":!0,"org.nr":!0,"com.nr":!0,"com.om":!0,"co.om":!0,"edu.om":!0,"ac.om":!0,"sch.om":!0,"gov.om":!0,"net.om":!0,"org.om":!0,"mil.om":!0,"museum.om":!0,"biz.om":!0,"pro.om":!0,"med.om":!0,"edu.pe":!0,"gob.pe":!0,"nom.pe":!0,"mil.pe":!0,"sld.pe":!0,"org.pe":!0,"com.pe":!0,"net.pe":!0,"com.ph":!0,"net.ph":!0,"org.ph":!0,"mil.ph":!0,"ngo.ph":!0,"i.ph":!0,"gov.ph":!0,"edu.ph":!0,"com.pk":!0,"net.pk":!0,"edu.pk":!0,"org.pk":!0,"fam.pk":!0,"biz.pk":!0,"web.pk":!0,"gov.pk":!0,"gob.pk":!0,"gok.pk":!0,"gon.pk":!0,"gop.pk":!0,"gos.pk":!0,"pwr.pl":!0,"com.pl":!0,"biz.pl":!0,"net.pl":!0,"art.pl":!0,"edu.pl":!0,"org.pl":!0,"ngo.pl":!0,"gov.pl":!0,"info.pl":!0,"mil.pl":!0,"waw.pl":!0,"warszawa.pl":!0,"wroc.pl":!0,"wroclaw.pl":!0,"krakow.pl":!0,"katowice.pl":!0,"poznan.pl":!0,"lodz.pl":!0,"gda.pl":!0,"gdansk.pl":!0,"slupsk.pl":!0,"radom.pl":!0,"szczecin.pl":!0,"lublin.pl":!0,"bialystok.pl":!0,"olsztyn.pl":!0,"torun.pl":!0,"gorzow.pl":!0,"zgora.pl":!0,"biz.pr":!0,"com.pr":!0,"edu.pr":!0,"gov.pr":!0,"info.pr":!0,"isla.pr":!0,"name.pr":!0,"net.pr":!0,"org.pr":!0,"pro.pr":!0,"est.pr":!0,"prof.pr":!0,"ac.pr":!0,"com.ps":!0,"net.ps":!0,"org.ps":!0,"edu.ps":!0,"gov.ps":!0,"plo.ps":!0,"sec.ps":!0,"co.pw":!0,"ne.pw":!0,"or.pw":!0,"ed.pw":!0,"go.pw":!0,"belau.pw":!0,"arts.ro":!0,"com.ro":!0,"firm.ro":!0,"info.ro":!0,"nom.ro":!0,"nt.ro":!0,"org.ro":!0,"rec.ro":!0,"store.ro":!0,"tm.ro":!0,"www.ro":!0,"co.rs":!0,"org.rs":!0,"edu.rs":!0,"ac.rs":!0,"gov.rs":!0,"in.rs":!0,"com.sb":!0,"net.sb":!0,"edu.sb":!0,"org.sb":!0,"gov.sb":!0,"com.sc":!0,"net.sc":!0,"edu.sc":!0,"gov.sc":!0,"org.sc":!0,"co.sh":!0,"com.sh":!0,"org.sh":!0,"gov.sh":!0,"edu.sh":!0,"net.sh":!0,"nom.sh":!0,"com.sl":!0,"net.sl":!0,"org.sl":!0,"edu.sl":!0,"gov.sl":!0,"gov.st":!0,"saotome.st":!0,"principe.st":!0,"consulado.st":!0,"embaixada.st":!0,"org.st":!0,"edu.st":!0,"net.st":!0,"com.st":!0,"store.st":!0,"mil.st":!0,"co.st":!0,"edu.sv":!0,"gob.sv":!0,"com.sv":!0,"org.sv":!0,"red.sv":!0,"co.sz":!0,"ac.sz":!0,"org.sz":!0,"com.tr":!0,"gen.tr":!0,"org.tr":!0,"biz.tr":!0,"info.tr":!0,"av.tr":!0,"dr.tr":!0,"pol.tr":!0,"bel.tr":!0,"tsk.tr":!0,"bbs.tr":!0,"k12.tr":!0,"edu.tr":!0,"name.tr":!0,"net.tr":!0,"gov.tr":!0,"web.tr":!0,"tel.tr":!0,"tv.tr":!0,"co.tt":!0,"com.tt":!0,"org.tt":!0,"net.tt":!0,"biz.tt":!0,"info.tt":!0,"pro.tt":!0,"int.tt":!0,"coop.tt":!0,"jobs.tt":!0,"mobi.tt":!0,"travel.tt":!0,"museum.tt":!0,"aero.tt":!0,"cat.tt":!0,"tel.tt":!0,"name.tt":!0,"mil.tt":!0,"edu.tt":!0,"gov.tt":!0,"edu.tw":!0,"gov.tw":!0,"mil.tw":!0,"com.tw":!0,"net.tw":!0,"org.tw":!0,"idv.tw":!0,"game.tw":!0,"ebiz.tw":!0,"club.tw":!0,"com.mu":!0,"gov.mu":!0,"net.mu":!0,"org.mu":!0,"ac.mu":!0,"co.mu":!0,"or.mu":!0,"ac.mz":!0,"co.mz":!0,"edu.mz":!0,"org.mz":!0,"gov.mz":!0,"com.na":!0,"co.na":!0,"ac.nz":!0,"co.nz":!0,"cri.nz":!0,"geek.nz":!0,"gen.nz":!0,"govt.nz":!0,"health.nz":!0,"iwi.nz":!0,"maori.nz":!0,"mil.nz":!0,"net.nz":!0,"org.nz":!0,"parliament.nz":!0,"school.nz":!0,"abo.pa":!0,"ac.pa":!0,"com.pa":!0,"edu.pa":!0,"gob.pa":!0,"ing.pa":!0,"med.pa":!0,"net.pa":!0,"nom.pa":!0,"org.pa":!0,"sld.pa":!0,"com.pt":!0,"edu.pt":!0,"gov.pt":!0,"int.pt":!0,"net.pt":!0,"nome.pt":!0,"org.pt":!0,"publ.pt":!0,"com.py":!0,"edu.py":!0,"gov.py":!0,"mil.py":!0,"net.py":!0,"org.py":!0,"com.qa":!0,"edu.qa":!0,"gov.qa":!0,"mil.qa":!0,"net.qa":!0,"org.qa":!0,"asso.re":!0,"com.re":!0,"nom.re":!0,"ac.ru":!0,"adygeya.ru":!0,"altai.ru":!0,"amur.ru":!0,"arkhangelsk.ru":!0,"astrakhan.ru":!0,"bashkiria.ru":!0,"belgorod.ru":!0,"bir.ru":!0,"bryansk.ru":!0,"buryatia.ru":!0,"cbg.ru":!0,"chel.ru":!0,"chelyabinsk.ru":!0,"chita.ru":!0,"chukotka.ru":!0,"chuvashia.ru":!0,"com.ru":!0,"dagestan.ru":!0,"e-burg.ru":!0,"edu.ru":!0,"gov.ru":!0,"grozny.ru":!0,"int.ru":!0,"irkutsk.ru":!0,"ivanovo.ru":!0,"izhevsk.ru":!0,"jar.ru":!0,"joshkar-ola.ru":!0,"kalmykia.ru":!0,"kaluga.ru":!0,"kamchatka.ru":!0,"karelia.ru":!0,"kazan.ru":!0,"kchr.ru":!0,"kemerovo.ru":!0,"khabarovsk.ru":!0,"khakassia.ru":!0,"khv.ru":!0,"kirov.ru":!0,"koenig.ru":!0,"komi.ru":!0,"kostroma.ru":!0,"kranoyarsk.ru":!0,"kuban.ru":!0,"kurgan.ru":!0,"kursk.ru":!0,"lipetsk.ru":!0,"magadan.ru":!0,"mari.ru":!0,"mari-el.ru":!0,"marine.ru":!0,"mil.ru":!0,"mordovia.ru":!0,"mosreg.ru":!0,"msk.ru":!0,"murmansk.ru":!0,"nalchik.ru":!0,"net.ru":!0,"nnov.ru":!0,"nov.ru":!0,"novosibirsk.ru":!0,"nsk.ru":!0,"omsk.ru":!0,"orenburg.ru":!0,"org.ru":!0,"oryol.ru":!0,"penza.ru":!0,"perm.ru":!0,"pp.ru":!0,"pskov.ru":!0,"ptz.ru":!0,"rnd.ru":!0,"ryazan.ru":!0,"sakhalin.ru":!0,"samara.ru":!0,"saratov.ru":!0,"simbirsk.ru":!0,"smolensk.ru":!0,"spb.ru":!0,"stavropol.ru":!0,"stv.ru":!0,"surgut.ru":!0,"tambov.ru":!0,"tatarstan.ru":!0,"tom.ru":!0,"tomsk.ru":!0,"tsaritsyn.ru":!0,"tsk.ru":!0,"tula.ru":!0,"tuva.ru":!0,"tver.ru":!0,"tyumen.ru":!0,"udm.ru":!0,"udmurtia.ru":!0,"ulan-ude.ru":!0,"vladikavkaz.ru":!0,"vladimir.ru":!0,"vladivostok.ru":!0,"volgograd.ru":!0,"vologda.ru":!0,"voronezh.ru":!0,"vrn.ru":!0,"vyatka.ru":!0,"yakutia.ru":!0,"yamal.ru":!0,"yekaterinburg.ru":!0,"yuzhno-sakhalinsk.ru":!0,"ac.rw":!0,"co.rw":!0,"com.rw":!0,"edu.rw":!0,"gouv.rw":!0,"gov.rw":!0,"int.rw":!0,"mil.rw":!0,"net.rw":!0,"com.sa":!0,"edu.sa":!0,"gov.sa":!0,"med.sa":!0,"net.sa":!0,"org.sa":!0,"pub.sa":!0,"sch.sa":!0,"com.sd":!0,"edu.sd":!0,"gov.sd":!0,"info.sd":!0,"med.sd":!0,"net.sd":!0,"org.sd":!0,"tv.sd":!0,"a.se":!0,"ac.se":!0,"b.se":!0,"bd.se":!0,"c.se":!0,"d.se":!0,"e.se":!0,"f.se":!0,"g.se":!0,"h.se":!0,"i.se":!0,"k.se":!0,"l.se":!0,"m.se":!0,"n.se":!0,"o.se":!0,"org.se":!0,"p.se":!0,"parti.se":!0,"pp.se":!0,"press.se":!0,"r.se":!0,"s.se":!0,"t.se":!0,"tm.se":!0,"u.se":!0,"w.se":!0,"x.se":!0,"y.se":!0,"z.se":!0,"com.sg":!0,"edu.sg":!0,"gov.sg":!0,"idn.sg":!0,"net.sg":!0,"org.sg":!0,"per.sg":!0,"art.sn":!0,"com.sn":!0,"edu.sn":!0,"gouv.sn":!0,"org.sn":!0,"perso.sn":!0,"univ.sn":!0,"com.sy":!0,"edu.sy":!0,"gov.sy":!0,"mil.sy":!0,"net.sy":!0,"news.sy":!0,"org.sy":!0,"ac.th":!0,"co.th":!0,"go.th":!0,"in.th":!0,"mi.th":!0,"net.th":!0,"or.th":!0,"ac.tj":!0,"biz.tj":!0,"co.tj":!0,"com.tj":!0,"edu.tj":!0,"go.tj":!0,"gov.tj":!0,"info.tj":!0,"int.tj":!0,"mil.tj":!0,"name.tj":!0,"net.tj":!0,"nic.tj":!0,"org.tj":!0,"test.tj":!0,"web.tj":!0,"agrinet.tn":!0,"com.tn":!0,"defense.tn":!0,"edunet.tn":!0,"ens.tn":!0,"fin.tn":!0,"gov.tn":!0,"ind.tn":!0,"info.tn":!0,"intl.tn":!0,"mincom.tn":!0,"nat.tn":!0,"net.tn":!0,"org.tn":!0,"perso.tn":!0,"rnrt.tn":!0,"rns.tn":!0,"rnu.tn":!0,"tourism.tn":!0,"ac.tz":!0,"co.tz":!0,"go.tz":!0,"ne.tz":!0,"or.tz":!0,"biz.ua":!0,"cherkassy.ua":!0,"chernigov.ua":!0,"chernovtsy.ua":!0,"ck.ua":!0,"cn.ua":!0,"co.ua":!0,"com.ua":!0,"crimea.ua":!0,"cv.ua":!0,"dn.ua":!0,"dnepropetrovsk.ua":!0,"donetsk.ua":!0,"dp.ua":!0,"edu.ua":!0,"gov.ua":!0,"if.ua":!0,"in.ua":!0,"ivano-frankivsk.ua":!0,"kh.ua":!0,"kharkov.ua":!0,"kherson.ua":!0,"khmelnitskiy.ua":!0,"kiev.ua":!0,"kirovograd.ua":!0,"km.ua":!0,"kr.ua":!0,"ks.ua":!0,"kv.ua":!0,"lg.ua":!0,"lugansk.ua":!0,"lutsk.ua":!0,"lviv.ua":!0,"me.ua":!0,"mk.ua":!0,"net.ua":!0,"nikolaev.ua":!0,"od.ua":!0,"odessa.ua":!0,"org.ua":!0,"pl.ua":!0,"poltava.ua":!0,"pp.ua":!0,"rovno.ua":!0,"rv.ua":!0,"sebastopol.ua":!0,"sumy.ua":!0,"te.ua":!0,"ternopil.ua":!0,"uzhgorod.ua":!0,"vinnica.ua":!0,"vn.ua":!0,"zaporizhzhe.ua":!0,"zhitomir.ua":!0,"zp.ua":!0,"zt.ua":!0,"ac.ug":!0,"co.ug":!0,"go.ug":!0,"ne.ug":!0,"or.ug":!0,"org.ug":!0,"sc.ug":!0,"ac.uk":!0,"bl.uk":!0,"british-library.uk":!0,"co.uk":!0,"cym.uk":!0,"gov.uk":!0,"govt.uk":!0,"icnet.uk":!0,"jet.uk":!0,"lea.uk":!0,"ltd.uk":!0,"me.uk":!0,"mil.uk":!0,"mod.uk":!0,"national-library-scotland.uk":!0,"nel.uk":!0,"net.uk":!0,"nhs.uk":!0,"nic.uk":!0,"nls.uk":!0,"org.uk":!0,"orgn.uk":!0,"parliament.uk":!0,"plc.uk":!0,"police.uk":!0,"sch.uk":!0,"scot.uk":!0,"soc.uk":!0,"4fd.us":!0,"dni.us":!0,"fed.us":!0,"isa.us":!0,"kids.us":!0,"nsn.us":!0,"com.uy":!0,"edu.uy":!0,"gub.uy":!0,"mil.uy":!0,"net.uy":!0,"org.uy":!0,"co.ve":!0,"com.ve":!0,"edu.ve":!0,"gob.ve":!0,"info.ve":!0,"mil.ve":!0,"net.ve":!0,"org.ve":!0,"web.ve":!0,"co.vi":!0,"com.vi":!0,"k12.vi":!0,"net.vi":!0,"org.vi":!0,"ac.vn":!0,"biz.vn":!0,"com.vn":!0,"edu.vn":!0,"gov.vn":!0,"health.vn":!0,"info.vn":!0,"int.vn":!0,"name.vn":!0,"net.vn":!0,"org.vn":!0,"pro.vn":!0,"co.ye":!0,"com.ye":!0,"gov.ye":!0,"ltd.ye":!0,"me.ye":!0,"net.ye":!0,"org.ye":!0,"plc.ye":!0,"ac.yu":!0,"co.yu":!0,"edu.yu":!0,"gov.yu":!0,"org.yu":!0,"ac.za":!0,"agric.za":!0,"alt.za":!0,"bourse.za":!0,"city.za":!0,"co.za":!0,"cybernet.za":!0,"db.za":!0,"ecape.school.za":!0,"edu.za":!0,"fs.school.za":!0,"gov.za":!0,"gp.school.za":!0,"grondar.za":!0,"iaccess.za":!0,"imt.za":!0,"inca.za":!0,"kzn.school.za":!0,"landesign.za":!0,"law.za":!0,"lp.school.za":!0,"mil.za":!0,"mpm.school.za":!0,"ncape.school.za":!0,"net.za":!0,"ngo.za":!0,"nis.za":!0,"nom.za":!0,"nw.school.za":!0,"olivetti.za":!0,"org.za":!0,"pix.za":!0,"school.za":!0,"tm.za":!0,"wcape.school.za":!0,"web.za":!0,"ac.zm":!0,"co.zm":!0,"com.zm":!0,"edu.zm":!0,"gov.zm":!0,"net.zm":!0,"org.zm":!0,"sch.zm":!0}; -},{}],203:[function(require,module,exports){ +},{}],235:[function(require,module,exports){ const sldMap=require("./domains/sld");module.exports=function(t,e){if("string"!=typeof t)return!1;if(e instanceof Object||(e={}),(t=t.toLowerCase()).endsWith(".")&&(t=t.slice(0,t.length-1)),t.length>253)return!1;if(!/^([a-z0-9-._*]+)$/g.test(t))return!1;const n=t.match(/(.*)\.(([a-z0-9]+)(\.[a-z0-9]+))/);var r=null,i=null;if(n&&n.length>2&&sldMap[n[2]]&&(r=n[2],i=n[1].split(".")),!i){if((i=t.split(".")).length<=1)return!1;if(r=i.pop(),!/^(?:xn--)?(?!^\d+$)[a-z0-9]+$/gi.test(r))return!1}if(0==e.subdomain&&i.length>1)return!1;return i.every(function(t,n){if(e.wildcard&&0===n&&"*"===t&&i.length>1)return!0;let r=/^([a-zA-Z0-9-_]+)$/g;return n===i.length-1&&(r=/^([a-zA-Z0-9-]+)$/g),(t.match(/--/g)||[]).length===(t.match(/xn--/g)||[]).length&&(r.test(t)&&t.length<64&&!t.startsWith("-")&&!t.endsWith("-"))})}; -},{"./domains/sld":202}],204:[function(require,module,exports){ -var toString={}.toString;module.exports=Array.isArray||function(r){return"[object Array]"==toString.call(r)}; +},{"./domains/sld":234}],236:[function(require,module,exports){ +(function (Buffer){(function (){ +const jsesc=require("jsesc"),sanitize=require("sanitize-filename"),TypedFastBitSet=require("typedfastbitset"),{readFile:readFile,writeFile:writeFile}=require("atomically-universal"),toBuffer=require("typedarray-to-buffer"),FIELD_SIZE=4;function saveTypedArrayFile(e,t,i,r,a,l){l||(l=(()=>{}));const s=toBuffer(a),n=Math.min(1.1*r,a.length),F=Buffer.alloc(4*FIELD_SIZE+n*a.BYTES_PER_ELEMENT);F.writeUInt32LE(t,0),F.writeUInt32LE(i,FIELD_SIZE),F.writeUInt32LE(r,2*FIELD_SIZE),s.copy(F,4*FIELD_SIZE),writeFile(e,F).then(()=>l()).catch(l)}function loadTypedArrayFile(e,t,i){readFile(e).then(e=>{const r=e.readUInt32LE(0),a=e.readUInt32LE(FIELD_SIZE),l=e.readUInt32LE(2*FIELD_SIZE),s=e.slice(4*FIELD_SIZE);i(null,{version:r,offset:a,count:l,tarr:new t(s.buffer,s.offset,s.byteLength/(t===Float64Array?8:4))})}).catch(i)}function saveBitsetFile(e,t,i,r,a){r.trim(),saveTypedArrayFile(e,t,i,r.count,r.words,a)}function loadBitsetFile(e,t){loadTypedArrayFile(e,Uint32Array,(e,i)=>{if(e)t(e);else{const{version:e,offset:r,count:a,tarr:l}=i,s=new TypedFastBitSet;s.words=l,s.count=a,t(null,{version:e,offset:r,bitset:s})}})}function listFilesIDB(e,t){new(require("idb-kv-store"))(e,{disableBroadcast:!0}).keys(t)}function listFilesFS(e,t){const i=require("fs");require("mkdirp")(e).then(()=>{i.readdir(e,t)},t)}function safeFilename(e){let t=jsesc(e);return t=(t=(t=(t=(t=(t=(t=(t=t.replace(/\./g,"x2E")).replace(/\//g,"x2F")).replace(/\?/g,"x3F")).replace(/\/g,"x3E")).replace(/\:/g,"x3A")).replace(/\*/g,"x2A")).replace(/\|/g,"x7C"),sanitize(t)}module.exports={saveTypedArrayFile:saveTypedArrayFile,loadTypedArrayFile:loadTypedArrayFile,saveBitsetFile:saveBitsetFile,loadBitsetFile:loadBitsetFile,listFilesIDB:listFilesIDB,listFilesFS:listFilesFS,safeFilename:safeFilename}; -},{}],205:[function(require,module,exports){ -(function (Buffer){ -const bipf=require("bipf"),TypedFastBitSet=require("typedfastbitset"),path=require("path"),push=require("push-stream"),sanitize=require("sanitize-filename"),debounce=require("lodash.debounce"),AtomicFile=require("atomic-file/buffer"),toBuffer=require("typedarray-to-buffer"),debug=require("debug")("jitdb");module.exports=function(e,t){function a(e,a,n,i,s){const o=path.join(t,e+".index");s||(s=(()=>{})),debug("writing index to",o);const f=toBuffer(i);var r=Buffer.alloc(8+f.length);r.writeInt32LE(a,0),r.writeInt32LE(n,4),f.copy(r,8),AtomicFile(o).set(r,s)}function n(e,t,n,i){debug("saving index:"+e),n.trim(),a(e,t,n.count,n.words,i)}function i(e,t,a){AtomicFile(e).get((e,n)=>{if(e)return a(e);const i=n.readInt32LE(0),s=n.readInt32LE(4),o=n.slice(8);a(null,{seq:i,count:s,data:new t(o.buffer,o.offset,o.byteLength/(t===Float64Array?8:4))})})}var s={};function o(e,t){debug("lazy loading",e);let a=s[e];i(a.filepath,Uint32Array,(e,n)=>{a.seq=n.seq,a.data.words=n.data,a.data.count=n.count,a.lazy=!1,t()})}var f=!1,r=[];!function(e){function a(a,n){push(push.values(n),push.asyncMap((e,a)=>{const n=e.replace(/\.[^/.]+$/,"");"offset.index"===e?i(path.join(t,e),Uint32Array,(e,t)=>{s[n]=t,a()}):"timestamp.index"===e?i(path.join(t,e),Float64Array,(e,t)=>{s[n]=t,a()}):e.endsWith(".index")?(s[n]={seq:0,data:new TypedFastBitSet,lazy:!0,filepath:path.join(t,e)},a()):a()}),push.collect(e))}if("undefined"!=typeof window)!function(e,t){new(require("idb-kv-store"))(e,{disableBroadcast:!0}).keys(t)}(t,a);else{const e=require("fs");require("mkdirp").sync(t),a(0,e.readdirSync(t))}}(()=>{debug("loaded indexes",Object.keys(s)),s.offset||(s.offset={seq:0,count:0,data:new Uint32Array(16e3)}),s.timestamp||(s.timestamp={seq:0,count:0,data:new Float64Array(16e3)}),f=!0;for(var e=0;e{e&&"flumelog:deleted"===e.code?a():a(e,bipf.decode(t,0))})}function h(e,t){debug("growing index");let a=new t(2*e.data.length);a.set(e.data),e.data=a}function b(e,t){if(e>s.offset.count-1)return e>s.offset.data.length&&h(s.offset,Uint32Array),s.offset.seq=t,s.offset.data[e]=t,s.offset.count=e+1,!0}function g(e,t,a){if(e>s.timestamp.count-1){e>s.timestamp.data.length&&h(s.timestamp,Float64Array),s.timestamp.seq=t;var n=0;return n=bipf.seekKey(a,n,d),n=bipf.seekKey(a,n,u),s.timestamp.data[e]=bipf.decode(a,n),s.timestamp.count=e+1,!0}}function q(e,t,a){const n=e.seek(a);return void 0===e.value?-1===n:!(!~n||0!==bipf.compareString(a,n,e.value))}function w(e,t,a,n){const i=q(e,0,a);return i&&t.data.add(n),i}function k(t,i){var o={};t.forEach(e=>{o[e.indexName]={seq:0,data:new TypedFastBitSet}});var f=0,r=!1,u=!1;const d=Date.now();e.stream({}).pipe({paused:!1,write:function(e){var a=e.seq,n=e.value;b(f,a)&&(r=!0),g(f,e.seq,n)&&(u=!0),t.forEach(e=>{e.indexAll?function(e,t,a,n){const i=e.seek(a),s=sanitize(bipf.decode(a,i)),o=e.indexType+"_"+s;t[o]||(t[o]={seq:0,data:new TypedFastBitSet}),t[o].data.add(n)}(e,o,n,f):w(e,o[e.indexName],n,f)}),f++},end:()=>{var e=f;for(var t in debug(`time: ${Date.now()-d}ms, total items: ${e}`),r&&a("offset",s.offset.seq,e,s.offset.data),u&&a("timestamp",s.timestamp.seq,e,s.timestamp.data),o)s[t]=o[t],s[t].seq=s.offset.seq,n(t,s[t].seq,s[t].data);i()}})}function x(e){const t=void 0===e.data.value?"":sanitize(e.data.value.toString());e.data.indexName=e.data.indexType+"_"+t,void 0!==e.data.value&&(e.data.value=Buffer.isBuffer(e.data.value)?e.data.value:Buffer.from(e.data.value))}function B(t,i){var f=[],r=[];function u(t,i){e.since.value>s[t.data.indexName].seq?function(t,i){for(var o=s[t.data.indexName],f=0;f{var e=f;debug(`time: ${Date.now()-d}ms, total items: ${e}`),r&&a("offset",s.offset.seq,e,s.offset.data),u&&a("timestamp",s.timestamp.seq,e,s.timestamp.data),o.seq=s.offset.seq,n(t.data.indexName,o.seq,o.data),i()}})}(t,i):i()}function d(){!function e(t,a){"EQUAL"===t.type?u(t,()=>{a(s[t.data.indexName].data)}):"AND"===t.type?e(t.data[0],n=>{e(t.data[1],e=>{a(n.new_intersection(e))})}):"OR"===t.type&&e(t.data[0],n=>{e(t.data[1],e=>{a(n.new_union(e))})})}(t,i)}function p(){f.length>0?k(f,d):d()}!function e(t){t.forEach(t=>{"EQUAL"===t.type?(x(t),s[t.data.indexName]?s[t.data.indexName].lazy&&r.push(t.data.indexName):f.push(t.data)):"AND"===t.type||"OR"===t.type?e(t.data):debug("Unknown operator type:"+t.type)})}([t]),f.length>0&&debug("missing indexes:",f),r.length>0?function(e,t){push(push.values(e),push.asyncMap(o),push.collect(t))}(r,p):p()}function A(e){f?e():r.push(e)}return{query:function(e,t,a,n,i){A(()=>{B(e,e=>{a?function(e,t,a,n,i){t=t||0,"function"==typeof n&&(i=n,n=!1),debug("results",e.size()),console.time("get values and sort top "+a);var o=e.array().map(function(e){return{val:e,timestamp:s.timestamp.data[e]}}).sort((e,t)=>n?e.timestamp-t.timestamp:t.timestamp-e.timestamp);push(push.values(o.slice(t,t+a)),push.asyncMap((e,t)=>v(e.val,t)),push.filter(e=>e),push.collect((e,t)=>{console.timeEnd("get values and sort top "+a),i(null,t)}))}(e,t,a,n,i):function(e,t){var a=Date.now();push(push.values(e.array()),push.asyncMap(v),push.filter(e=>e),push.collect((e,n)=>{debug(`get all: ${Date.now()-a}ms, total items: ${n.length}`),t(e,n)}))}(e,t)})})},querySeq:function(e,t,a){A(()=>{B(e,e=>{!function(e,t,a){var n=Date.now();push(push.values(e.array()),push.filter(e=>s.offset.data[e]>t),push.asyncMap(v),push.filter(e=>e),push.collect((e,t)=>{debug(`get all: ${Date.now()-n}ms, total items: ${t.length}`),a(e,t)}))}(e,t,a)})})},getSeq:e=>s[e.data.indexName].seq,liveQuerySingleIndex:function(t,a){var n=[],i=debounce(function(){var e=n.slice(0);n=[],a(null,e)},300);x(t);var o={live:!0},f=s[t.data.indexName];f&&(o.gt=f.seq),e.stream(o).pipe({paused:!1,write:function(e){var a;q(t.data,0,e.value)&&(a=bipf.decode(e.value,0),n.push(a),i())}})},onReady:A,seekAuthor:function(e){var t=0;if(~(t=bipf.seekKey(e,t,d)))return bipf.seekKey(e,t,p)},seekType:function(e){var t=0;if(~(t=bipf.seekKey(e,t,d))&&~(t=bipf.seekKey(e,t,c)))return bipf.seekKey(e,t,l)},seekRoot:function(e){var t=0;if(~(t=bipf.seekKey(e,t,d))&&~(t=bipf.seekKey(e,t,c)))return bipf.seekKey(e,t,y)},seekPrivate:function(e){var t=0;if(~(t=bipf.seekKey(e,t,d))&&~(t=bipf.seekKey(e,t,Buffer.from("meta"))))return bipf.seekKey(e,t,Buffer.from("private"))},seekChannel:function(e){var t=0;if(~(t=bipf.seekKey(e,t,d))&&~(t=bipf.seekKey(e,t,c)))return bipf.seekKey(e,t,m)},saveIndex:n,saveTypedArray:a,loadIndex:i,indexes:s}}; +}).call(this)}).call(this,require("buffer").Buffer) +},{"atomically-universal":40,"buffer":101,"fs":100,"idb-kv-store":216,"jsesc":241,"mkdirp":286,"sanitize-filename":513,"typedarray-to-buffer":661,"typedfastbitset":662}],237:[function(require,module,exports){ +(function (Buffer){(function (){ +const path=require("path"),bipf=require("bipf"),push=require("push-stream"),pull=require("pull-stream"),toPull=require("push-stream-to-pull-stream"),pullAsync=require("pull-async"),TypedFastBitSet=require("typedfastbitset"),bsb=require("binary-search-bounds"),multicb=require("multicb"),debug=require("debug")("jitdb"),{saveTypedArrayFile:saveTypedArrayFile,loadTypedArrayFile:loadTypedArrayFile,saveBitsetFile:saveBitsetFile,loadBitsetFile:loadBitsetFile,safeFilename:safeFilename,listFilesIDB:listFilesIDB,listFilesFS:listFilesFS}=require("./files");module.exports=function(e,t){debug("indexes path",t);let n=new WeakMap,a={ascending:new WeakMap,descending:new WeakMap},s=-1;const i={};let r=!1,o=[];function f(e){r?e():o.push(e)}!function(e){function n(n,a){push(push.values(a),push.asyncMap((e,n)=>{const a=path.parse(e).name;"seq.index"===e?loadTypedArrayFile(path.join(t,e),Uint32Array,(e,t)=>{i[a]=t,n()}):"timestamp.index"===e?loadTypedArrayFile(path.join(t,e),Float64Array,(e,t)=>{i[a]=t,n()}):"sequence.index"===e?loadTypedArrayFile(path.join(t,e),Uint32Array,(e,t)=>{i[a]=t,n()}):e.endsWith(".32prefix")?(i[a]={offset:-1,count:0,tarr:new Uint32Array(16e3),lazy:!0,prefix:32,filepath:path.join(t,e)},n()):e.endsWith(".index")?(i[a]={offset:0,bitset:new TypedFastBitSet,lazy:!0,filepath:path.join(t,e)},n()):n()}),push.collect(e))}"undefined"!=typeof window?listFilesIDB(t,n):listFilesFS(t,n)}(()=>{debug("loaded indexes",Object.keys(i)),i.seq||(i.seq={offset:-1,count:0,tarr:new Uint32Array(16e3)}),i.timestamp||(i.timestamp={offset:-1,count:0,tarr:new Float64Array(16e3)}),i.sequence||(i.sequence={offset:-1,count:0,tarr:new Uint32Array(16e3)}),r=!0;for(var e=0;es&&(s=e.since.value,n=new WeakMap,a.ascending=new WeakMap,a.descending=new WeakMap)}function c(e,n,a){if(n.offset<0)return;debug("saving core index: %s",e);const s=path.join(t,e+".index");saveTypedArrayFile(s,n.version||1,n.offset,a,n.tarr)}function y(e,n,a){if(n.offset<0||0===n.bitset.size())return;debug("saving index: %s",e);const s=path.join(t,e+".index");saveBitsetFile(s,n.version||1,n.offset,n.bitset,a)}function m(e,n,a,s){if(n.offset<0)return;debug("saving prefix index: %s",e);const i=n.prefix,r=path.join(t,e+`.${i}prefix`);saveTypedArrayFile(r,n.version||1,n.offset,a,n.tarr,s)}function h(e,t){debug("growing index");const n=new t(2*e.tarr.length);n.set(e.tarr),e.tarr=n}function g(e,t){if(e>i.seq.count-1)return e>i.seq.tarr.length&&h(i.seq,Uint32Array),i.seq.offset=t,i.seq.tarr[e]=t,i.seq.count=e+1,!0}function b(e,t,n){if(e>i.timestamp.count-1){e>i.timestamp.tarr.length&&h(i.timestamp,Float64Array),i.timestamp.offset=t;var a=0;a=bipf.seekKey(n,a,u);const s=bipf.decode(n,a);a=0,a=bipf.seekKey(n,a,p),a=bipf.seekKey(n,a,u);const r=bipf.decode(n,a),o=Math.min(s,r);return i.timestamp.tarr[e]=o,i.timestamp.count=e+1,!0}}function q(e,t,n){if(e>i.sequence.count-1){e>i.sequence.tarr.length&&h(i.sequence,Uint32Array),i.sequence.offset=t;var a=0;return a=bipf.seekKey(n,a,p),a=bipf.seekKey(n,a,d),i.sequence.tarr[e]=bipf.decode(n,a),i.sequence.count=e+1,!0}}function x(e,t){const n=e.seek(t);return e.value?!(!~n||0!==bipf.compareString(t,n,e.value)):-1===n}function v(e,t){const n=e.seek(t);if(!~n)return!1;const a=bipf.getEncodedType(t,n);if(a===bipf.types.string)return x(e,t);if(a===bipf.types.array){let a=!1;return bipf.iterate(t,n,(n,s)=>{const i=e.pluck?e.pluck(t,s):s;if(0===bipf.compareString(t,i,e.value))return a=!0,!0}),a}return!1}function F(e){if(e.length<4){const t=Buffer.alloc(4);return e.copy(t),t.readUInt32LE(0)}return e.readUInt32LE(0)}function w(e,t,n,a,s){if(a>t.count-1){a>t.tarr.length&&h(t,Uint32Array);const i=e.seek(n);if(i){const e=bipf.slice(n,i);t.tarr[a]=e.length?F(e):0}else t.tarr[a]=0;t.offset=s,t.count=a+1}}function S(e,t,n,a){"EQUAL"===e.type&&x(e.data,n)?t.bitset.add(a):"INCLUDES"===e.type&&v(e.data,n)&&t.bitset.add(a)}function A(t,n){const a={};t.forEach(e=>{e.data.prefix?a[e.data.indexName]={offset:0,count:0,tarr:new Uint32Array(16e3),prefix:"number"==typeof e.data.prefix?e.data.prefix:32}:a[e.data.indexName]={offset:0,bitset:new TypedFastBitSet}});let s=0,r=!1,o=!1,f=!1;const u=Date.now();e.stream({}).pipe({paused:!1,write:function(e){const n=e.offset,i=e.value;g(s,n)&&(r=!0),i?(b(s,n,i)&&(o=!0),q(s,n,i)&&(f=!0),t.forEach(e=>{e.data.prefix?w(e.data,a[e.data.indexName],i,s,n):e.data.indexAll?function(e,t,n,a){const s=e.seek(n),i=bipf.decode(n,s),r=safeFilename(e.indexType+"_"+i);t[r]||(t[r]={offset:0,bitset:new TypedFastBitSet}),t[r].bitset.add(a)}(e.data,a,i,s):S(e,a[e.data.indexName],i,s)}),s++):s++},end:()=>{const e=s;for(var t in debug(`time: ${Date.now()-u}ms, total items: ${e}`),r&&c("seq",i.seq,e),o&&c("timestamp",i.timestamp,e),f&&c("sequence",i.sequence,e),a){const n=i[t]=a[t];n.offset=i.seq.offset,n.prefix?m(t,n,e):y(t,n)}n()}})}function E(e,t){debug("lazy loading %s",e);let n=i[e];n.prefix?loadTypedArrayFile(n.filepath,Uint32Array,(e,a)=>{if(e)return t(e);const{version:s,offset:i,count:r,tarr:o}=a;n.version=s,n.offset=i,n.count=r,n.tarr=o,n.lazy=!1,t()}):loadBitsetFile(n.filepath,(e,a)=>{if(e)return t(e);const{version:s,offset:i,bitset:r}=a;n.version=s,n.offset=i,n.bitset=r,n.lazy=!1,t()})}function N(t,n){e.since.value>i[t.data.indexName].offset?function(t,n){const a=i[t.data.indexName];let s=0;if(-1!==a.offset){const{tarr:e}=i.seq,t=a.offset;for(const n=e.length;s{const e=s;debug(`time: ${Date.now()-u}ms, total items: ${e}`),r&&c("seq",i.seq,e),o&&c("timestamp",i.timestamp,e),f&&c("sequence",i.sequence,e),a.offset=i.seq.offset,d&&(a.prefix?m(t.data.indexName,a,e):y(t.data.indexName,a)),n()}})}(t,n):(debug("ensureIndexSync %s is already synced",t.data.indexName),n())}function T(e){N({data:{indexName:"seq"}},e)}function B(e,t,n){N(e,()=>{if("sequence"===e.data.indexName){const s=new TypedFastBitSet,{tarr:r,count:o}=i.sequence;for(var a=0;a{n={type:t,data:[n,e]}}),n}function k(e,t){"EQUAL"===e.type||"INCLUDES"===e.type?e.data.prefix?N(e,()=>{!function(e,t,n){const a=e.data.value,s=a?F(a):0,i=t.count,r=t.tarr,o=new TypedFastBitSet,f=multicb({pluck:1});for(let e=0;e{if(t)return console.error(t);const i=e.data.seek;for(let e=0,t=s.length;e{t(i[e.data.indexName].bitset)}):"GT"===e.type?B(e,(e,t)=>e>t.data.value,t):"GTE"===e.type?B(e,(e,t)=>e>=t.data.value,t):"LT"===e.type?B(e,(e,t)=>ee<=t.data.value,t):"OFFSETS"===e.type?T(()=>{!function(e,t){const n=[];e.sort((e,t)=>e-t);const a=e.length,{tarr:s}=i.seq;for(var r=0,o=s.length;r{t(new TypedFastBitSet(e.seqs))}):"LIVESEQS"===e.type?t(new TypedFastBitSet):"AND"===e.type?(e.data.length>2&&(e=U(e.data,"AND")),k(e.data[0],n=>{k(e.data[1],e=>{t(n.new_intersection(e))})})):"OR"===e.type?(e.data.length>2&&(e=U(e.data,"OR")),k(e.data[0],n=>{k(e.data[1],e=>{t(n.new_union(e))})})):e.type?console.error("Unknown type",e):function(e){N({data:{indexName:"sequence"}},()=>{const t=new TypedFastBitSet,{count:n}=i.sequence;for(var a=0;a{n.set(e,a),t(a)})}function o(){a.length>0?A(a,r):r()}!function e(t){t.forEach(t=>{if("EQUAL"===t.type||"INCLUDES"===t.type){const e=t.data.indexName;i[e]?i[e].lazy&&s.push(e):a.push(t)}else"AND"===t.type||"OR"===t.type?e(t.data):"SEQS"!==t.type&&"LIVESEQS"!==t.type&&"OFFSETS"!==t.type&&t.type&&debug("Unknown operator type: "+t.type)})}([e]),a.length>0&&debug("missing indexes: %o",a),s.length>0?function(e,t){push(push.values(e),push.asyncMap(E),push.collect(t))}(s,o):o()}function L(t,n){const a=i.seq.tarr[t];e.get(a,(e,s)=>{e&&"flumelog:deleted"===e.code?n():n(e,{offset:a,value:s,seq:t})})}function I(t,n,s,r,o,f){n=n||0;const u=Date.now(),d=function(e,t){l();const n=t?"descending":"ascending";if(a[n].has(e))return a[n].get(e);const s=e.array().map(e=>({seq:e,timestamp:i.timestamp.tarr[e]})).sort((e,n)=>t?n.timestamp-e.timestamp:e.timestamp-n.timestamp);return a[n].set(e,s),s}(t,r),p=null!=s?d.slice(n,n+s):n>0?d.slice(n):d;push(push.values(p),push.asyncMap(({seq:t},n)=>{o?n(null,i.seq.tarr[t]):function(t,n){const a=i.seq.tarr[t];e.get(a,(e,t)=>{e&&"flumelog:deleted"===e.code?n():n(e,bipf.decode(t,0))})}(t,n)}),push.filter(e=>!!o||e),push.collect((e,t)=>{f(e,{results:t,total:d.length,duration:Date.now()-u})}))}return{onReady:f,paginate:function(e,t,n,a,s,i){f(()=>{D(e,e=>{I(e,t,n,a,s,(e,t)=>{e?i(e):(debug(`paginate(): ${t.duration}ms, total messages: ${t.total}`),i(e,t))})})})},all:function(e,t,n,a,s){f(()=>{D(e,e=>{I(e,t,null,n,a,(e,t)=>{e?s(e):(debug(`all(): ${t.duration}ms, total messages: ${t.total}`),s(e,t.results))})})})},live:function(t){return pull(pullAsync(e=>f(()=>{D(t,t=>{e()})})),pull.map(()=>{let n,a,s=-1;if(function e(t){t.forEach(t=>{if("EQUAL"===t.type||"INCLUDES"===t.type)s=i[t.data.indexName]?i[t.data.indexName].offset:-1;else if("AND"===t.type||"OR"===t.type)e(t.data);else if("LIVESEQS"===t.type){if(n)throw new Error("Only one seq stream in live supported");n=t.stream}})}([t]),n)a=pull(n,pull.asyncMap((e,t)=>{T(()=>{L(e,t)})}));else{const t=-1===s?{live:!0,gt:i.seq.offset}:{live:!0,gt:s};a=toPull(e.stream(t))}return a}),pull.flatten(),pull.filter(e=>(function e(t,n,a){for(var s=0;sbipf.decode(e.value,0)))},indexes:i}}; -}).call(this,require("buffer").Buffer) -},{"atomic-file/buffer":35,"bipf":40,"buffer":88,"debug":206,"fs":87,"idb-kv-store":191,"lodash.debounce":211,"mkdirp":220,"path":265,"push-stream":399,"sanitize-filename":447,"typedarray-to-buffer":561,"typedfastbitset":562}],206:[function(require,module,exports){ -(function (process){ -function useColors(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+module.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;e.splice(1,0,o,"color: inherit");let C=0,t=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(C++,"%c"===e&&(t=C))}),e.splice(t,0,o)}function save(e){try{e?exports.storage.setItem("debug",e):exports.storage.removeItem("debug")}catch(e){}}function load(){let e;try{e=exports.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}function localstorage(){try{return localStorage}catch(e){}}exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage=localstorage(),exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],exports.log=console.debug||console.log||(()=>{}),module.exports=require("./common")(exports);const{formatters:formatters}=module.exports;formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}; +}).call(this)}).call(this,require("buffer").Buffer) +},{"./files":236,"binary-search-bounds":53,"bipf":54,"buffer":101,"debug":238,"multicb":295,"path":331,"pull-async":362,"pull-stream":428,"push-stream":477,"push-stream-to-pull-stream":474,"typedfastbitset":662}],238:[function(require,module,exports){ +(function (process){(function (){ +function useColors(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+module.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;e.splice(1,0,o,"color: inherit");let t=0,C=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(t++,"%c"===e&&(C=t))}),e.splice(C,0,o)}function save(e){try{e?exports.storage.setItem("debug",e):exports.storage.removeItem("debug")}catch(e){}}function load(){let e;try{e=exports.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}function localstorage(){try{return localStorage}catch(e){}}exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage=localstorage(),exports.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],exports.log=console.debug||console.log||(()=>{}),module.exports=require("./common")(exports);const{formatters:formatters}=module.exports;formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}; -}).call(this,require('_process')) -},{"./common":207,"_process":284}],207:[function(require,module,exports){ -function setup(e){function n(e){let r;function o(...e){if(!o.enabled)return;const t=o,s=Number(new Date),i=s-(r||s);t.diff=i,t.prev=r,t.curr=s,r=s,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(s,r)=>{if("%%"===s)return s;a++;const o=n.formatters[r];if("function"==typeof o){const n=e[a];s=o.call(t,n),e.splice(a,1),a--}return s}),n.formatArgs.call(t,e),(t.log||n.log).apply(t,e)}return o.namespace=e,o.enabled=n.enabled(e),o.useColors=n.useColors(),o.color=n.selectColor(e),o.destroy=t,o.extend=s,"function"==typeof n.init&&n.init(o),n.instances.push(o),o}function t(){const e=n.instances.indexOf(this);return-1!==e&&(n.instances.splice(e,1),!0)}function s(e,t){const s=n(this.namespace+(void 0===t?":":t)+e);return s.log=this.log,s}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names.map(r),...n.skips.map(r).map(e=>"-"+e)].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const s=("string"==typeof e?e:"").split(/[\s,]+/),r=s.length;for(t=0;t{n[t]=e[t]}),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n{if("%%"===r)return"%";i++;const s=n.formatters[o];if("function"==typeof s){const n=e[i];r=s.call(t,n),e.splice(i,1),i--}return r}),n.formatArgs.call(t,e),(t.log||n.log).apply(t,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=t,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null===o?n.enabled(e):o,set:e=>{o=e}}),"function"==typeof n.init&&n.init(s),s}function t(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names.map(r),...n.skips.map(r).map(e=>"-"+e)].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(t=0;t{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n{var r=n;for(let n of t)if(!~(r=bipf.seekKey(e,r,Buffer.from(n))))return;return r}}function slowEqual(e,t,n){n=n||{};const r=seekFromDesc(e),a=toBufferOrFalsy(t),i=a?a.toString():"",u=e.replace(/\./g,"_");return{type:"EQUAL",data:{seek:r,value:a,indexType:u,indexName:n.prefix?safeFilename(u):safeFilename(u+"_"+i),indexAll:n.indexAll,prefix:n.prefix}}}function equal(e,t,n){if(!(n=n||{}).indexType)throw new Error("equal() operator needs an indexType in the 3rd arg");const r=toBufferOrFalsy(t),a=r?r.toString():"",i=n.indexType;return{type:"EQUAL",data:{seek:e,value:r,indexType:i,indexName:n.prefix?safeFilename(i):safeFilename(i+"_"+a),indexAll:n.indexAll,prefix:n.prefix}}}function slowIncludes(e,t,n){n=n||{};const r=seekFromDesc(e),a=toBufferOrFalsy(t);if(!a)throw new Error("slowIncludes() 2nd arg needs to be truthy");const i=a.toString(),u=e.replace(/\./g,"_"),l=safeFilename(u+"_"+i),o=n.pluck&&"string"==typeof n.pluck?seekFromDesc(n.pluck):n.pluck;return{type:"INCLUDES",data:{seek:r,value:a,indexType:u,indexName:l,indexAll:n.indexAll,pluck:o}}}function includes(e,t,n){if(!(n=n||{}).indexType)throw new Error("includes() operator needs an indexType in the 3rd arg");const r=toBufferOrFalsy(t);if(!r)throw new Error("includes() 2nd arg needs to be truthy");const a=r.toString(),i=n.indexType;return{type:"INCLUDES",data:{seek:e,value:r,indexType:i,indexName:safeFilename(i+"_"+a),indexAll:n.indexAll,pluck:n.pluck}}}function gt(e,t){if("number"!=typeof e)throw new Error("gt() needs a number arg");return{type:"GT",data:{value:e,indexName:t}}}function gte(e,t){if("number"!=typeof e)throw new Error("gte() needs a number arg");return{type:"GTE",data:{value:e,indexName:t}}}function lt(e,t){if("number"!=typeof e)throw new Error("lt() needs a number arg");return{type:"LT",data:{value:e,indexName:t}}}function lte(e,t){if("number"!=typeof e)throw new Error("lte() needs a number arg");return{type:"LTE",data:{value:e,indexName:t}}}function deferred(e){return{type:"DEFERRED",task:e}}function debug(){return e=>{const t=JSON.stringify(e.meta,(e,t)=>"db"===e?void 0:t);return console.log("debug",JSON.stringify(e,(e,t)=>"meta"===e?void 0:"task"===e&&"function"==typeof t?"[Function]":"value"===e&&"Buffer"===t.type?Buffer.from(t.data).toString():t,2),"{}"===t?"":"meta: "+t),e}}function copyMeta(e,t){e.meta&&(t.meta=e.meta)}function updateMeta(e,t,n){const r=Object.assign({},e);return r.meta[t]=n,r}function extractMeta(e){return e.meta}function and(...e){const t=e.map(e=>"function"==typeof e?e():e);return e=>{const n=e&&e.type?{type:"AND",data:[e,...t]}:t.length>1?{type:"AND",data:t}:t[0];return e&©Meta(e,n),n}}function or(...e){const t=e.map(e=>"function"==typeof e?e():e);return e=>{const n=e&&e.type?{type:"OR",data:[e,...t]}:t.length>1?{type:"OR",data:t}:t[0];return e&©Meta(e,n),n}}function live(e){return e&&e.old?e=>updateMeta(e,"live","liveAndOld"):e=>updateMeta(e,"live","liveOnly")}function descending(){return e=>updateMeta(e,"descending",!0)}function startFrom(e){return t=>updateMeta(t,"seq",e)}function paginate(e){return t=>updateMeta(t,"pageSize",e)}async function executeDeferredOps(e,t){const n=[];return traverse.forEach(e,function(e){if(e){if("meta"===this.key&&e.db)return this.block();"DEFERRED"===e.type&&e.task&&n.push([this.path,e]),Array.isArray(e)||"AND"===e.type||"OR"===e.type||this.block()}}),0===n.length?e:((await Promise.all(n.map(([e,n])=>promisify(n.task)(t).then(t=>[e,t||{}])))).forEach(([n,r])=>{r.meta=t,0===n.length?e=r:traverse.set(e,n,r)}),e)}function toCallback(e){return t=>{const n=extractMeta(t);executeDeferredOps(t,n).then(t=>{const r=n.seq||0;n.pageSize?n.db.paginate(t,r,n.pageSize,n.descending,!1,e):n.db.all(t,r,n.descending,!1,e)}).catch(t=>{e(t)})}}function toPromise(){return e=>promisify(t=>toCallback(t)(e))()}function toPullStream(){return e=>{const t=extractMeta(e);function n(e){let n=t.seq||0,r=1/0;const a=t.pageSize||1;return function(i,u){return i?u(i):n>=r?u(!0):void t.db.paginate(e,n,a,t.descending,!1,(e,i)=>{if(e)return u(e);0===i.total?u(!0):(r=i.total,n+=a,u(null,t.pageSize?i.results:i.results[0]))})}}return pull(pullAsync(n=>{executeDeferredOps(e,t).then(e=>n(null,e),e=>n(e))}),pull.map(e=>"liveOnly"===t.live?t.db.live(e):"liveAndOld"===t.live?cat([n(e),t.db.live(e)]):n(e)),pull.flatten())}}function toAsyncIter(){return async function*(e){const t=toPullStream()(e);for await(let e of pullAwaitable(t))yield e}}module.exports={fromDB:fromDB,query:query,live:live,slowEqual:slowEqual,equal:equal,slowIncludes:slowIncludes,includes:includes,gt:gt,gte:gte,lt:lt,lte:lte,and:and,or:or,deferred:deferred,liveSeqs:liveSeqs,seqs:seqs,offsets:offsets,descending:descending,startFrom:startFrom,paginate:paginate,toCallback:toCallback,toPullStream:toPullStream,toPromise:toPromise,toAsyncIter:toAsyncIter,debug:debug}; -},{"ms":228}],208:[function(require,module,exports){ -(function (Buffer){ +}).call(this)}).call(this,require("buffer").Buffer) +},{"./files":236,"bipf":54,"buffer":101,"promisify-4loc":350,"pull-async":362,"pull-awaitable":363,"pull-cat":365,"pull-stream":428,"traverse":656}],241:[function(require,module,exports){ +(function (Buffer){(function (){ +"use strict";const object={},hasOwnProperty=object.hasOwnProperty,forOwn=(e,t)=>{for(const r in e)hasOwnProperty.call(e,r)&&t(r,e[r])},extend=(e,t)=>t?(forOwn(t,(t,r)=>{e[t]=r}),e):e,forEach=(e,t)=>{const r=e.length;let i=-1;for(;++i"\\u"+("0000"+e).slice(-4),hexadecimal=(e,t)=>{let r=e.toString(16);return t?r:r.toUpperCase()},toString=object.toString,isArray=Array.isArray,isBuffer=e=>"function"==typeof Buffer&&Buffer.isBuffer(e),isObject=e=>"[object Object]"==toString.call(e),isString=e=>"string"==typeof e||"[object String]"==toString.call(e),isNumber=e=>"number"==typeof e||"[object Number]"==toString.call(e),isFunction=e=>"function"==typeof e,isMap=e=>"[object Map]"==toString.call(e),isSet=e=>"[object Set]"==toString.call(e),singleEscapes={"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},regexSingleEscape=/[\\\b\f\n\r\t]/,regexDigit=/[0-9]/,regexWhitespace=/[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,escapeEverythingRegex=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^]/g,escapeNonAsciiRegex=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^ !#-&\(-\[\]-_a-~]/g,jsesc=(e,t)=>{const r=()=>{u=a,++t.indentLevel,a=t.indent.repeat(t.indentLevel)},i={escapeEverything:!1,minimal:!1,isScriptContext:!1,quotes:"single",wrap:!1,es6:!1,json:!1,compact:!0,lowercaseHex:!1,numbers:"decimal",indent:"\t",indentLevel:0,__inline1__:!1,__inline2__:!1},n=t&&t.json;n&&(i.quotes="double",i.wrap=!0),"single"!=(t=extend(i,t)).quotes&&"double"!=t.quotes&&"backtick"!=t.quotes&&(t.quotes="single");const s="double"==t.quotes?'"':"backtick"==t.quotes?"`":"'",c=t.compact,o=t.lowercaseHex;let a=t.indent.repeat(t.indentLevel),u="";const l=t.__inline1__,f=t.__inline2__,p=c?"":"\n";let g,_=!0;const x="binary"==t.numbers,m="octal"==t.numbers,b="decimal"==t.numbers,h="hexadecimal"==t.numbers;if(n&&e&&isFunction(e.toJSON)&&(e=e.toJSON()),!isString(e)){if(isMap(e))return 0==e.size?"new Map()":(c||(t.__inline1__=!0,t.__inline2__=!1),"new Map("+jsesc(Array.from(e),t)+")");if(isSet(e))return 0==e.size?"new Set()":"new Set("+jsesc(Array.from(e),t)+")";if(isBuffer(e))return 0==e.length?"Buffer.from([])":"Buffer.from("+jsesc(Array.from(e),t)+")";if(isArray(e))return g=[],t.wrap=!0,l&&(t.__inline1__=!1,t.__inline2__=!0),f||r(),forEach(e,e=>{_=!1,f&&(t.__inline2__=!1),g.push((c||f?"":a)+jsesc(e,t))}),_?"[]":f?"["+g.join(", ")+"]":"["+p+g.join(","+p)+p+(c?"":u)+"]";if(!isNumber(e))return isObject(e)?(g=[],t.wrap=!0,r(),forOwn(e,(e,r)=>{_=!1,g.push((c?"":a)+jsesc(e,t)+":"+(c?"":" ")+jsesc(r,t))}),_?"{}":"{"+p+g.join(","+p)+p+(c?"":u)+"}"):n?JSON.stringify(e)||"null":String(e);if(n)return JSON.stringify(e);if(b)return String(e);if(h){let t=e.toString(16);return o||(t=t.toUpperCase()),"0x"+t}if(x)return"0b"+e.toString(2);if(m)return"0o"+e.toString(8)}const S=t.escapeEverything?escapeEverythingRegex:escapeNonAsciiRegex;return g=e.replace(S,(e,r,i,c,a,u)=>{if(r){if(t.minimal)return r;const e=r.charCodeAt(0),i=r.charCodeAt(1);if(t.es6){return"\\u{"+hexadecimal(1024*(e-55296)+i-56320+65536,o)+"}"}return fourHexEscape(hexadecimal(e,o))+fourHexEscape(hexadecimal(i,o))}if(i)return fourHexEscape(hexadecimal(i.charCodeAt(0),o));if("\0"==e&&!n&&!regexDigit.test(u.charAt(a+1)))return"\\0";if(c)return c==s||t.escapeEverything?"\\"+c:c;if(regexSingleEscape.test(e))return singleEscapes[e];if(t.minimal&&!regexWhitespace.test(e))return e;const l=hexadecimal(e.charCodeAt(0),o);return n||l.length>2?fourHexEscape(l):"\\x"+("00"+l).slice(-2)}),"`"==s&&(g=g.replace(/\$\{/g,"\\${")),t.isScriptContext&&(g=g.replace(/<\/(script|style)/gi,"<\\/$1").replace(/