|
|
@@ -0,0 +1,281 @@
|
|
|
+import{c as t}from"./@turf-e5dd68ad.js";var i,r={exports:{}};i=r,function(){
|
|
|
+// Copyright (c) 2005 Tom Wu
|
|
|
+// All Rights Reserved.
|
|
|
+// See "LICENSE" for details.
|
|
|
+// Basic JavaScript BN library - subset useful for RSA encryption.
|
|
|
+// Bits per digit
|
|
|
+var t;
|
|
|
+// JavaScript engine analysis
|
|
|
+// (public) Constructor
|
|
|
+function r(t,i,r){null!=t&&("number"==typeof t?this.fromNumber(t,i,r):null==i&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,i))}
|
|
|
+// return new, unset BigInteger
|
|
|
+function o(){return new r(null)}
|
|
|
+// am: Compute w_j += (x*this_i), propagate carries,
|
|
|
+// c is initial carry, returns final carry.
|
|
|
+// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
|
|
|
+// We need to select the fastest one that works in this environment.
|
|
|
+// am1: use a single mult and divide to get the high bits,
|
|
|
+// max digit bits should be 26 because
|
|
|
+// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
|
|
|
+var s="undefined"!=typeof navigator;s&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=
|
|
|
+// am2 avoids a big mult-and-extract completely.
|
|
|
+// Max digit bits should be <= 30 because we do bitwise ops
|
|
|
+// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
|
|
|
+function(t,i,r,o,s,h){for(var e=32767&i,n=i>>15;--h>=0;){var f=32767&this[t],u=this[t++]>>15,p=n*f+u*e;s=((f=e*f+((32767&p)<<15)+r[o]+(1073741823&s))>>>30)+(p>>>15)+n*u+(s>>>30),r[o++]=1073741823&f}return s}
|
|
|
+// Alternately, set max digit bits to 28 since some
|
|
|
+// browsers slow down when dealing with 32-bit numbers.
|
|
|
+,t=30):s&&"Netscape"!=navigator.appName?(r.prototype.am=function(t,i,r,o,s,h){for(;--h>=0;){var e=i*this[t++]+r[o]+s;s=Math.floor(e/67108864),r[o++]=67108863&e}return s},t=26):(// Mozilla/Netscape seems to prefer am3
|
|
|
+r.prototype.am=function(t,i,r,o,s,h){for(var e=16383&i,n=i>>14;--h>=0;){var f=16383&this[t],u=this[t++]>>14,p=n*f+u*e;s=((f=e*f+((16383&p)<<14)+r[o]+s)>>28)+(p>>14)+n*u,r[o++]=268435455&f}return s},t=28),r.prototype.DB=t,r.prototype.DM=(1<<t)-1,r.prototype.DV=1<<t,r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-t,r.prototype.F2=2*t-52;
|
|
|
+// Digit conversions
|
|
|
+var h,e,n=new Array;for(h="0".charCodeAt(0),e=0;e<=9;++e)n[h++]=e;for(h="a".charCodeAt(0),e=10;e<36;++e)n[h++]=e;for(h="A".charCodeAt(0),e=10;e<36;++e)n[h++]=e;function f(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function u(t,i){var r=n[t.charCodeAt(i)];return null==r?-1:r}
|
|
|
+// (protected) copy this to r
|
|
|
+// return bigint initialized to value
|
|
|
+function p(t){var i=o();return i.fromInt(t),i}
|
|
|
+// (protected) set from string and radix
|
|
|
+// returns bit length of the integer x
|
|
|
+function a(t){var i,r=1;return 0!=(i=t>>>16)&&(t=i,r+=16),0!=(i=t>>8)&&(t=i,r+=8),0!=(i=t>>4)&&(t=i,r+=4),0!=(i=t>>2)&&(t=i,r+=2),0!=(i=t>>1)&&(t=i,r+=1),r}
|
|
|
+// (public) return the number of bits in "this"
|
|
|
+// Modular reduction using "classic" algorithm
|
|
|
+function c(t){this.m=t}
|
|
|
+// Montgomery reduction
|
|
|
+function m(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}
|
|
|
+// xR mod m
|
|
|
+// (public) this & a
|
|
|
+function l(t,i){return t&i}
|
|
|
+// (public) this | a
|
|
|
+function v(t,i){return t|i}
|
|
|
+// (public) this ^ a
|
|
|
+function T(t,i){return t^i}
|
|
|
+// (public) this & ~a
|
|
|
+function y(t,i){return t&~i}
|
|
|
+// return index of lowest 1-bit in x, x < 2^31
|
|
|
+function d(t){if(0==t)return-1;var i=0;return 65535&t||(t>>=16,i+=16),255&t||(t>>=8,i+=8),15&t||(t>>=4,i+=4),3&t||(t>>=2,i+=2),1&t||++i,i}
|
|
|
+// (public) returns index of lowest 1-bit (or -1 if none)
|
|
|
+// return number of 1 bits in x
|
|
|
+function D(t){for(var i=0;0!=t;)t&=t-1,++i;return i}
|
|
|
+// (public) return number of set bits
|
|
|
+// A "null" reducer
|
|
|
+function g(){}function b(t){return t}
|
|
|
+// Barrett modular reduction
|
|
|
+function S(t){
|
|
|
+// setup Barrett
|
|
|
+this.r2=o(),this.q3=o(),r.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}c.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},c.prototype.revert=function(t){return t},c.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},c.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},c.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)},m.prototype.convert=function(t){var i=o();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(r.ZERO)>0&&this.m.subTo(i,i),i}
|
|
|
+// x/R mod m
|
|
|
+,m.prototype.revert=function(t){var i=o();return t.copyTo(i),this.reduce(i),i}
|
|
|
+// x = x/R mod m (HAC 14.32)
|
|
|
+,m.prototype.reduce=function(t){for(;t.t<=this.mt2;)// pad x so am has enough room later
|
|
|
+t[t.t++]=0;for(var i=0;i<this.m.t;++i){
|
|
|
+// faster way of calculating u0 = x[i]*mp mod DV
|
|
|
+var r=32767&t[i],o=r*this.mpl+((r*this.mph+(t[i]>>15)*this.mpl&this.um)<<15)&t.DM;
|
|
|
+// propagate carry
|
|
|
+for(t[
|
|
|
+// use am to combine the multiply-shift-add into one call
|
|
|
+r=i+this.m.t]+=this.m.am(0,o,t,i,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}
|
|
|
+// r = "x^2/R mod m"; x != r
|
|
|
+,m.prototype.mulTo=
|
|
|
+// r = "xy/R mod m"; x,y != r
|
|
|
+function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},m.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)},
|
|
|
+// protected
|
|
|
+r.prototype.copyTo=function(t){for(var i=this.t-1;i>=0;--i)t[i]=this[i];t.t=this.t,t.s=this.s}
|
|
|
+// (protected) set from integer value x, -DV <= x < DV
|
|
|
+,r.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},r.prototype.fromString=function(t,i){var o;if(16==i)o=4;else if(8==i)o=3;else if(256==i)o=8;// byte array
|
|
|
+else if(2==i)o=1;else if(32==i)o=5;else{if(4!=i)return void this.fromRadix(t,i);o=2}this.t=0,this.s=0;for(var s=t.length,h=!1,e=0;--s>=0;){var n=8==o?255&t[s]:u(t,s);n<0?"-"==t.charAt(s)&&(h=!0):(h=!1,0==e?this[this.t++]=n:e+o>this.DB?(this[this.t-1]|=(n&(1<<this.DB-e)-1)<<e,this[this.t++]=n>>this.DB-e):this[this.t-1]|=n<<e,(e+=o)>=this.DB&&(e-=this.DB))}8==o&&128&t[0]&&(this.s=-1,e>0&&(this[this.t-1]|=(1<<this.DB-e)-1<<e)),this.clamp(),h&&r.ZERO.subTo(this,this)}
|
|
|
+// (protected) clamp off excess high words
|
|
|
+,r.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}
|
|
|
+// (public) return string representation in given radix
|
|
|
+,r.prototype.dlShiftTo=
|
|
|
+// (protected) r = this << n*DB
|
|
|
+function(t,i){var r;for(r=this.t-1;r>=0;--r)i[r+t]=this[r];for(r=t-1;r>=0;--r)i[r]=0;i.t=this.t+t,i.s=this.s}
|
|
|
+// (protected) r = this >> n*DB
|
|
|
+,r.prototype.drShiftTo=function(t,i){for(var r=t;r<this.t;++r)i[r-t]=this[r];i.t=Math.max(this.t-t,0),i.s=this.s}
|
|
|
+// (protected) r = this << n
|
|
|
+,r.prototype.lShiftTo=function(t,i){var r,o=t%this.DB,s=this.DB-o,h=(1<<s)-1,e=Math.floor(t/this.DB),n=this.s<<o&this.DM;for(r=this.t-1;r>=0;--r)i[r+e+1]=this[r]>>s|n,n=(this[r]&h)<<o;for(r=e-1;r>=0;--r)i[r]=0;i[e]=n,i.t=this.t+e+1,i.s=this.s,i.clamp()}
|
|
|
+// (protected) r = this >> n
|
|
|
+,r.prototype.rShiftTo=function(t,i){i.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)i.t=0;else{var o=t%this.DB,s=this.DB-o,h=(1<<o)-1;i[0]=this[r]>>o;for(var e=r+1;e<this.t;++e)i[e-r-1]|=(this[e]&h)<<s,i[e-r]=this[e]>>o;o>0&&(i[this.t-r-1]|=(this.s&h)<<s),i.t=this.t-r,i.clamp()}}
|
|
|
+// (protected) r = this - a
|
|
|
+,r.prototype.subTo=function(t,i){for(var r=0,o=0,s=Math.min(t.t,this.t);r<s;)o+=this[r]-t[r],i[r++]=o&this.DM,o>>=this.DB;if(t.t<this.t){for(o-=t.s;r<this.t;)o+=this[r],i[r++]=o&this.DM,o>>=this.DB;o+=this.s}else{for(o+=this.s;r<t.t;)o-=t[r],i[r++]=o&this.DM,o>>=this.DB;o-=t.s}i.s=o<0?-1:0,o<-1?i[r++]=this.DV+o:o>0&&(i[r++]=o),i.t=r,i.clamp()}
|
|
|
+// (protected) r = this * a, r != this,a (HAC 14.12)
|
|
|
+// "this" should be the larger one if appropriate.
|
|
|
+,r.prototype.multiplyTo=function(t,i){var o=this.abs(),s=t.abs(),h=o.t;for(i.t=h+s.t;--h>=0;)i[h]=0;for(h=0;h<s.t;++h)i[h+o.t]=o.am(0,s[h],i,h,0,o.t);i.s=0,i.clamp(),this.s!=t.s&&r.ZERO.subTo(i,i)}
|
|
|
+// (protected) r = this^2, r != this (HAC 14.16)
|
|
|
+,r.prototype.squareTo=function(t){for(var i=this.abs(),r=t.t=2*i.t;--r>=0;)t[r]=0;for(r=0;r<i.t-1;++r){var o=i.am(r,i[r],t,2*r,0,1);(t[r+i.t]+=i.am(r+1,2*i[r],t,2*r+1,o,i.t-r-1))>=i.DV&&(t[r+i.t]-=i.DV,t[r+i.t+1]=1)}t.t>0&&(t[t.t-1]+=i.am(r,i[r],t,2*r,0,1)),t.s=0,t.clamp()}
|
|
|
+// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
|
|
|
+// r != q, this != m. q or r may be null.
|
|
|
+,r.prototype.divRemTo=function(t,i,s){var h=t.abs();if(!(h.t<=0)){var e=this.abs();if(e.t<h.t)return null!=i&&i.fromInt(0),void(null!=s&&this.copyTo(s));null==s&&(s=o());var n=o(),f=this.s,u=t.s,p=this.DB-a(h[h.t-1]);// normalize modulus
|
|
|
+p>0?(h.lShiftTo(p,n),e.lShiftTo(p,s)):(h.copyTo(n),e.copyTo(s));var c=n.t,m=n[c-1];if(0!=m){var l=m*(1<<this.F1)+(c>1?n[c-2]>>this.F2:0),v=this.FV/l,T=(1<<this.F1)/l,y=1<<this.F2,d=s.t,D=d-c,g=null==i?o():i;// "negative" y so we can replace sub with am later
|
|
|
+for(n.dlShiftTo(D,g),s.compareTo(g)>=0&&(s[s.t++]=1,s.subTo(g,s)),r.ONE.dlShiftTo(c,g),g.subTo(n,n);n.t<c;)n[n.t++]=0;for(;--D>=0;){
|
|
|
+// Estimate quotient digit
|
|
|
+var b=s[--d]==m?this.DM:Math.floor(s[d]*v+(s[d-1]+y)*T);if((s[d]+=n.am(0,b,s,D,0,c))<b)for(// Try it out
|
|
|
+n.dlShiftTo(D,g),s.subTo(g,s);s[d]<--b;)s.subTo(g,s)}null!=i&&(s.drShiftTo(c,i),f!=u&&r.ZERO.subTo(i,i)),s.t=c,s.clamp(),p>0&&s.rShiftTo(p,s),// Denormalize remainder
|
|
|
+f<0&&r.ZERO.subTo(s,s)}}}
|
|
|
+// (public) this mod a
|
|
|
+,r.prototype.invDigit=
|
|
|
+// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
|
|
|
+// justification:
|
|
|
+// xy == 1 (mod m)
|
|
|
+// xy = 1+km
|
|
|
+// xy(2-xy) = (1+km)(1-km)
|
|
|
+// x[y(2-xy)] = 1-k^2m^2
|
|
|
+// x[y(2-xy)] == 1 (mod m^2)
|
|
|
+// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
|
|
|
+// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
|
|
|
+// JS multiply "overflows" differently from C/C++, so care is needed here.
|
|
|
+function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var i=3&t;// y == 1/x mod 2^2
|
|
|
+// y == 1/x mod 2^dbits
|
|
|
+// we really want the negative inverse, and -DV < y < DV
|
|
|
+// y == 1/x mod 2^16
|
|
|
+// last step - calculate inverse mod DV directly;
|
|
|
+// assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
|
|
|
+return(i=(// y == 1/x mod 2^8
|
|
|
+i=(// y == 1/x mod 2^4
|
|
|
+i=(i=i*(2-(15&t)*i)&15)*(2-(255&t)*i)&255)*(2-((65535&t)*i&65535))&65535)*(2-t*i%this.DV)%this.DV)>0?this.DV-i:-i},r.prototype.isEven=
|
|
|
+// (protected) true iff this is even
|
|
|
+function(){return 0==(this.t>0?1&this[0]:this.s)}
|
|
|
+// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
|
|
|
+,r.prototype.exp=function(t,i){if(t>4294967295||t<1)return r.ONE;var s=o(),h=o(),e=i.convert(this),n=a(t)-1;for(e.copyTo(s);--n>=0;)if(i.sqrTo(s,h),(t&1<<n)>0)i.mulTo(h,e,s);else{var f=s;s=h,h=f}return i.revert(s)}
|
|
|
+// (public) this^e % m, 0 <= e < 2^32
|
|
|
+,
|
|
|
+// public
|
|
|
+r.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var r,o=(1<<i)-1,s=!1,h="",e=this.t,n=this.DB-e*this.DB%i;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)>0&&(s=!0,h=f(r));e>=0;)n<i?(r=(this[e]&(1<<n)-1)<<i-n,r|=this[--e]>>(n+=this.DB-i)):(r=this[e]>>(n-=i)&o,n<=0&&(n+=this.DB,--e)),r>0&&(s=!0),s&&(h+=f(r));return s?h:"0"}
|
|
|
+// (public) -this
|
|
|
+,r.prototype.negate=function(){var t=o();return r.ZERO.subTo(this,t),t}
|
|
|
+// (public) |this|
|
|
|
+,r.prototype.abs=function(){return this.s<0?this.negate():this}
|
|
|
+// (public) return + if this > a, - if this < a, 0 if equal
|
|
|
+,r.prototype.compareTo=function(t){var i=this.s-t.s;if(0!=i)return i;var r=this.t;if(0!=(i=r-t.t))return this.s<0?-i:i;for(;--r>=0;)if(0!=(i=this[r]-t[r]))return i;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+a(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(t){var i=o();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(r.ZERO)>0&&t.subTo(i,i),i},r.prototype.modPowInt=function(t,i){var r;return r=t<256||i.isEven()?new c(i):new m(i),this.exp(t,r)},
|
|
|
+// "constants"
|
|
|
+r.ZERO=p(0),r.ONE=p(1),g.prototype.convert=b,g.prototype.revert=b,g.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r)},g.prototype.sqrTo=function(t,i){t.squareTo(i)},S.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=o();return t.copyTo(i),this.reduce(i),i},S.prototype.revert=function(t){return t}
|
|
|
+// x = x mod m (HAC 14.42)
|
|
|
+,S.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}
|
|
|
+// r = x^2 mod m; x != r
|
|
|
+,S.prototype.mulTo=
|
|
|
+// r = x*y mod m; x,y != r
|
|
|
+function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},S.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)};var B,w,M,E=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],R=(1<<26)/E[E.length-1];
|
|
|
+// Mix in the current time (w/milliseconds) into the pool
|
|
|
+function O(){
|
|
|
+// Mix in a 32-bit integer into the pool
|
|
|
+var t;t=(new Date).getTime(),w[M++]^=255&t,w[M++]^=t>>8&255,w[M++]^=t>>16&255,w[M++]^=t>>24&255,M>=I&&(M-=I)}
|
|
|
+// Initialize the pool with junk if needed.
|
|
|
+if(
|
|
|
+// protected
|
|
|
+r.prototype.chunkSize=
|
|
|
+// (protected) return x s.t. r^x < DV
|
|
|
+function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}
|
|
|
+// (public) 0 if this == 0, 1 if this > 0
|
|
|
+,r.prototype.toRadix=
|
|
|
+// (protected) convert to radix string
|
|
|
+function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var i=this.chunkSize(t),r=Math.pow(t,i),s=p(r),h=o(),e=o(),n="";for(this.divRemTo(s,h,e);h.signum()>0;)n=(r+e.intValue()).toString(t).substr(1)+n,h.divRemTo(s,h,e);return e.intValue().toString(t)+n}
|
|
|
+// (protected) convert from radix string
|
|
|
+,r.prototype.fromRadix=function(t,i){this.fromInt(0),null==i&&(i=10);for(var o=this.chunkSize(i),s=Math.pow(i,o),h=!1,e=0,n=0,f=0;f<t.length;++f){var p=u(t,f);p<0?"-"==t.charAt(f)&&0==this.signum()&&(h=!0):(n=i*n+p,++e>=o&&(this.dMultiply(s),this.dAddOffset(n,0),e=0,n=0))}e>0&&(this.dMultiply(Math.pow(i,e)),this.dAddOffset(n,0)),h&&r.ZERO.subTo(this,this)}
|
|
|
+// (protected) alternate constructor
|
|
|
+,r.prototype.fromNumber=function(t,i,o){if("number"==typeof i)
|
|
|
+// new BigInteger(int,int,RNG)
|
|
|
+if(t<2)this.fromInt(1);else// force odd
|
|
|
+for(this.fromNumber(t,o),this.testBit(t-1)||// force MSB set
|
|
|
+this.bitwiseTo(r.ONE.shiftLeft(t-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(r.ONE.shiftLeft(t-1),this);else{
|
|
|
+// new BigInteger(int,RNG)
|
|
|
+var s=new Array,h=7&t;s.length=1+(t>>3),i.nextBytes(s),h>0?s[0]&=(1<<h)-1:s[0]=0,this.fromString(s,256)}}
|
|
|
+// (public) convert to bigendian byte array
|
|
|
+,r.prototype.bitwiseTo=
|
|
|
+// (protected) r = this op a (bitwise)
|
|
|
+function(t,i,r){var o,s,h=Math.min(t.t,this.t);for(o=0;o<h;++o)r[o]=i(this[o],t[o]);if(t.t<this.t){for(s=t.s&this.DM,o=h;o<this.t;++o)r[o]=i(this[o],s);r.t=this.t}else{for(s=this.s&this.DM,o=h;o<t.t;++o)r[o]=i(s,t[o]);r.t=t.t}r.s=i(this.s,t.s),r.clamp()},r.prototype.changeBit=
|
|
|
+// (protected) this op (1<<n)
|
|
|
+function(t,i){var o=r.ONE.shiftLeft(t);return this.bitwiseTo(o,i,o),o}
|
|
|
+// (public) this | (1<<n)
|
|
|
+,r.prototype.addTo=
|
|
|
+// (protected) r = this + a
|
|
|
+function(t,i){for(var r=0,o=0,s=Math.min(t.t,this.t);r<s;)o+=this[r]+t[r],i[r++]=o&this.DM,o>>=this.DB;if(t.t<this.t){for(o+=t.s;r<this.t;)o+=this[r],i[r++]=o&this.DM,o>>=this.DB;o+=this.s}else{for(o+=this.s;r<t.t;)o+=t[r],i[r++]=o&this.DM,o>>=this.DB;o+=t.s}i.s=o<0?-1:0,o>0?i[r++]=o:o<-1&&(i[r++]=this.DV+o),i.t=r,i.clamp()}
|
|
|
+// (public) this + a
|
|
|
+,r.prototype.dMultiply=
|
|
|
+// (protected) this *= n, this >= 0, 1 < n < DV
|
|
|
+function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}
|
|
|
+// (protected) this += n << w words, this >= 0
|
|
|
+,r.prototype.dAddOffset=function(t,i){if(0!=t){for(;this.t<=i;)this[this.t++]=0;for(this[i]+=t;this[i]>=this.DV;)this[i]-=this.DV,++i>=this.t&&(this[this.t++]=0),++this[i]}},r.prototype.multiplyLowerTo=
|
|
|
+// (protected) r = lower n words of "this * a", a.t <= n
|
|
|
+// "this" should be the larger one if appropriate.
|
|
|
+function(t,i,r){var o,s=Math.min(this.t+t.t,i);for(r.s=0,// assumes a,this >= 0
|
|
|
+r.t=s;s>0;)r[--s]=0;for(o=r.t-this.t;s<o;++s)r[s+this.t]=this.am(0,t[s],r,s,0,this.t);for(o=Math.min(t.t,i);s<o;++s)this.am(0,t[s],r,s,0,i-s);r.clamp()}
|
|
|
+// (protected) r = "this * a" without lower n words, n > 0
|
|
|
+// "this" should be the larger one if appropriate.
|
|
|
+,r.prototype.multiplyUpperTo=function(t,i,r){--i;var o=r.t=this.t+t.t-i;// assumes a,this >= 0
|
|
|
+for(r.s=0;--o>=0;)r[o]=0;for(o=Math.max(i-this.t,0);o<t.t;++o)r[this.t+o-i]=this.am(i-o,t[o],r,0,0,this.t+o-i);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=
|
|
|
+// (protected) this % n, n < 2^26
|
|
|
+function(t){if(t<=0)return 0;var i=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==i)r=this[0]%t;else for(var o=this.t-1;o>=0;--o)r=(i*r+this[o])%t;return r}
|
|
|
+// (public) 1/this % m (HAC 14.61)
|
|
|
+,r.prototype.millerRabin=
|
|
|
+// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
|
|
|
+function(t){var i=this.subtract(r.ONE),s=i.getLowestSetBit();if(s<=0)return!1;var h=i.shiftRight(s);(t=t+1>>1)>E.length&&(t=E.length);for(var e=o(),n=0;n<t;++n){
|
|
|
+//Pick bases at random, instead of starting at 2
|
|
|
+e.fromInt(E[Math.floor(Math.random()*E.length)]);var f=e.modPow(h,this);if(0!=f.compareTo(r.ONE)&&0!=f.compareTo(i)){for(var u=1;u++<s&&0!=f.compareTo(i);)if(0==(f=f.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=f.compareTo(i))return!1}}return!0},
|
|
|
+// public
|
|
|
+r.prototype.clone=
|
|
|
+// Copyright (c) 2005-2009 Tom Wu
|
|
|
+// All Rights Reserved.
|
|
|
+// See "LICENSE" for details.
|
|
|
+// Extended JavaScript BN functions, required for RSA private ops.
|
|
|
+// Version 1.1: new BigInteger("0", 10) returns "proper" zero
|
|
|
+// Version 1.2: square() API, isProbablePrime fix
|
|
|
+// (public)
|
|
|
+function(){var t=o();return this.copyTo(t),t}
|
|
|
+// (public) return value as integer
|
|
|
+,r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];
|
|
|
+// assumes 16 < DB < 32
|
|
|
+if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}
|
|
|
+// (public) return value as byte
|
|
|
+,r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24}
|
|
|
+// (public) return value as short (assumes DB>=16)
|
|
|
+,r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var t=this.t,i=new Array;i[0]=this.s;var r,o=this.DB-t*this.DB%8,s=0;if(t-- >0)for(o<this.DB&&(r=this[t]>>o)!=(this.s&this.DM)>>o&&(i[s++]=r|this.s<<this.DB-o);t>=0;)o<8?(r=(this[t]&(1<<o)-1)<<8-o,r|=this[--t]>>(o+=this.DB-8)):(r=this[t]>>(o-=8)&255,o<=0&&(o+=this.DB,--t)),128&r&&(r|=-256),0==s&&(128&this.s)!=(128&r)&&++s,(s>0||r!=this.s)&&(i[s++]=r);return i},r.prototype.equals=function(t){return 0==this.compareTo(t)},r.prototype.min=function(t){return this.compareTo(t)<0?this:t},r.prototype.max=function(t){return this.compareTo(t)>0?this:t},r.prototype.and=function(t){var i=o();return this.bitwiseTo(t,l,i),i},r.prototype.or=function(t){var i=o();return this.bitwiseTo(t,v,i),i},r.prototype.xor=function(t){var i=o();return this.bitwiseTo(t,T,i),i},r.prototype.andNot=function(t){var i=o();return this.bitwiseTo(t,y,i),i}
|
|
|
+// (public) ~this
|
|
|
+,r.prototype.not=function(){for(var t=o(),i=0;i<this.t;++i)t[i]=this.DM&~this[i];return t.t=this.t,t.s=~this.s,t}
|
|
|
+// (public) this << n
|
|
|
+,r.prototype.shiftLeft=function(t){var i=o();return t<0?this.rShiftTo(-t,i):this.lShiftTo(t,i),i}
|
|
|
+// (public) this >> n
|
|
|
+,r.prototype.shiftRight=function(t){var i=o();return t<0?this.lShiftTo(-t,i):this.rShiftTo(t,i),i},r.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+d(this[t]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var t=0,i=this.s&this.DM,r=0;r<this.t;++r)t+=D(this[r]^i);return t}
|
|
|
+// (public) true iff nth bit is set
|
|
|
+,r.prototype.testBit=function(t){var i=Math.floor(t/this.DB);return i>=this.t?0!=this.s:!!(this[i]&1<<t%this.DB)},r.prototype.setBit=function(t){return this.changeBit(t,v)}
|
|
|
+// (public) this & ~(1<<n)
|
|
|
+,r.prototype.clearBit=function(t){return this.changeBit(t,y)}
|
|
|
+// (public) this ^ (1<<n)
|
|
|
+,r.prototype.flipBit=function(t){return this.changeBit(t,T)},r.prototype.add=function(t){var i=o();return this.addTo(t,i),i}
|
|
|
+// (public) this - a
|
|
|
+,r.prototype.subtract=function(t){var i=o();return this.subTo(t,i),i}
|
|
|
+// (public) this * a
|
|
|
+,r.prototype.multiply=function(t){var i=o();return this.multiplyTo(t,i),i}
|
|
|
+// (public) this^2
|
|
|
+,r.prototype.divide=
|
|
|
+// (public) this / a
|
|
|
+function(t){var i=o();return this.divRemTo(t,i,null),i}
|
|
|
+// (public) this % a
|
|
|
+,r.prototype.remainder=function(t){var i=o();return this.divRemTo(t,null,i),i}
|
|
|
+// (public) [this/a,this%a]
|
|
|
+,r.prototype.divideAndRemainder=function(t){var i=o(),r=o();return this.divRemTo(t,i,r),new Array(i,r)},r.prototype.modPow=
|
|
|
+// (public) this^e % m (HAC 14.85)
|
|
|
+function(t,i){var r,s,h=t.bitLength(),e=p(1);if(h<=0)return e;r=h<18?1:h<48?3:h<144?4:h<768?5:6,s=h<8?new c(i):i.isEven()?new S(i):new m(i);
|
|
|
+// precomputation
|
|
|
+var n=new Array,f=3,u=r-1,l=(1<<r)-1;if(n[1]=s.convert(this),r>1){var v=o();for(s.sqrTo(n[1],v);f<=l;)n[f]=o(),s.mulTo(v,n[f-2],n[f]),f+=2}var T,y,d=t.t-1,D=!0,g=o();for(h=a(t[d])-1;d>=0;){for(h>=u?T=t[d]>>h-u&l:(T=(t[d]&(1<<h+1)-1)<<u-h,d>0&&(T|=t[d-1]>>this.DB+h-u)),f=r;!(1&T);)T>>=1,--f;if((h-=f)<0&&(h+=this.DB,--d),D)// ret == 1, don't bother squaring or multiplying it
|
|
|
+n[T].copyTo(e),D=!1;else{for(;f>1;)s.sqrTo(e,g),s.sqrTo(g,e),f-=2;f>0?s.sqrTo(e,g):(y=e,e=g,g=y),s.mulTo(g,n[T],e)}for(;d>=0&&!(t[d]&1<<h);)s.sqrTo(e,g),y=e,e=g,g=y,--h<0&&(h=this.DB-1,--d)}return s.revert(e)}
|
|
|
+// (public) gcd(this,a) (HAC 14.54)
|
|
|
+,r.prototype.modInverse=function(t){var i=t.isEven();if(this.isEven()&&i||0==t.signum())return r.ZERO;for(var o=t.clone(),s=this.clone(),h=p(1),e=p(0),n=p(0),f=p(1);0!=o.signum();){for(;o.isEven();)o.rShiftTo(1,o),i?(h.isEven()&&e.isEven()||(h.addTo(this,h),e.subTo(t,e)),h.rShiftTo(1,h)):e.isEven()||e.subTo(t,e),e.rShiftTo(1,e);for(;s.isEven();)s.rShiftTo(1,s),i?(n.isEven()&&f.isEven()||(n.addTo(this,n),f.subTo(t,f)),n.rShiftTo(1,n)):f.isEven()||f.subTo(t,f),f.rShiftTo(1,f);o.compareTo(s)>=0?(o.subTo(s,o),i&&h.subTo(n,h),e.subTo(f,e)):(s.subTo(o,s),i&&n.subTo(h,n),f.subTo(e,f))}return 0!=s.compareTo(r.ONE)?r.ZERO:f.compareTo(t)>=0?f.subtract(t):f.signum()<0?(f.addTo(t,f),f.signum()<0?f.add(t):f):f},r.prototype.pow=
|
|
|
+// (public) this^e
|
|
|
+function(t){return this.exp(t,new g)},r.prototype.gcd=function(t){var i=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(i.compareTo(r)<0){var o=i;i=r,r=o}var s=i.getLowestSetBit(),h=r.getLowestSetBit();if(h<0)return i;for(s<h&&(h=s),h>0&&(i.rShiftTo(h,i),r.rShiftTo(h,r));i.signum()>0;)(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r));return h>0&&r.lShiftTo(h,r),r},r.prototype.isProbablePrime=
|
|
|
+// (public) test primality with certainty >= 1-.5^t
|
|
|
+function(t){var i,r=this.abs();if(1==r.t&&r[0]<=E[E.length-1]){for(i=0;i<E.length;++i)if(r[0]==E[i])return!0;return!1}if(r.isEven())return!1;for(i=1;i<E.length;){for(var o=E[i],s=i+1;s<E.length&&o<R;)o*=E[s++];for(o=r.modInt(o);i<s;)if(o%E[i++]==0)return!1}return r.millerRabin(t)},
|
|
|
+// JSBN-specific extension
|
|
|
+r.prototype.square=function(){var t=o();return this.squareTo(t),t},
|
|
|
+// Expose the Barrett function
|
|
|
+r.prototype.Barrett=S,null==w){var A;if(w=new Array,M=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){
|
|
|
+// Use webcrypto if available
|
|
|
+var V=new Uint8Array(32);for(window.crypto.getRandomValues(V),A=0;A<32;++A)w[M++]=V[A]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){
|
|
|
+// Extract entropy (256 bits) from NS4 RNG if available
|
|
|
+var q=window.crypto.random(32);for(A=0;A<q.length;++A)w[M++]=255&q.charCodeAt(A)}for(;M<I;)// extract some randomness from Math.random()
|
|
|
+A=Math.floor(65536*Math.random()),w[M++]=A>>>8,w[M++]=255&A;M=0,O()}function x(){if(null==B){for(O(),(B=new L).init(w),M=0;M<w.length;++M)w[M]=0;M=0}
|
|
|
+// TODO: allow reseeding after first request
|
|
|
+return B.next()}function N(){}
|
|
|
+// prng4.js - uses Arcfour as a PRNG
|
|
|
+function L(){this.i=0,this.j=0,this.S=new Array}
|
|
|
+// Initialize arcfour context from key, an array of ints, each from [0..255]
|
|
|
+N.prototype.nextBytes=function(t){var i;for(i=0;i<t.length;++i)t[i]=x()},L.prototype.init=function(t){var i,r,o;for(i=0;i<256;++i)this.S[i]=i;for(r=0,i=0;i<256;++i)r=r+this.S[i]+t[i%t.length]&255,o=this.S[i],this.S[i]=this.S[r],this.S[r]=o;this.i=0,this.j=0},L.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};
|
|
|
+// Pool size must be a multiple of 4 and greater than 32.
|
|
|
+// An array of bytes the size of the pool will be passed to init()
|
|
|
+var I=256;i.exports={default:r,BigInteger:r,SecureRandom:N}}.call(t);var o=r.exports;export{o as j};
|
|
|
+//# sourceMappingURL=jsbn-6a317af9.js.map
|