function assignToObject(t,e){return"function"!=typeof Object.assign&&Object.defineProperties(Object,{assign:{value:function(t){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),r=1;rthis.length)&&(e=this.length),this.substring(e-t.length,e)===t}),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){e=e||window;for(var r=0;r=e.length?n(t,e):n(e,t)}function i(t,e){for(var r,n=t.length,i=new Array(n),o=y,s=0;se.length?1:-1;for(var r=t.length-1;0<=r;r--)if(t[r]!==e[r])return t[r]>e[r]?1:-1;return 0}function l(t){var e=t.abs();return!e.isUnit()&&(!!(e.equals(2)||e.equals(3)||e.equals(5))||!(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))&&(!!e.lesser(49)||void 0))}function u(t,e){for(var r,n,i,o,s=t.prev(),a=s;a.isEven();)a=a.divide(2);for(i=0;i=n)throw new Error(c+" is not a valid digit in base "+e+".")}}if(2<=e&&e<=36&&r<=f/Math.log(e)){var o=parseInt(t,e);if(isNaN(o))throw new Error(c+" is not a valid digit in base "+e+".");return new d(parseInt(t,e))}e=W(e);var s=[],a="-"===t[0];for(i=a?1:0;i"!==t[++i];);s.push(W(t.slice(u+1,i)))}}return Z(s,e,a)};function Z(t,e,r){for(var n=p[0],i=p[1],o=t.length-1;0<=o;o--)n=n.add(t[o].times(i)),i=i.times(e);return r?n.negate():n}function J(t){return t<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t):"<"+t+">"}function F(t,e){if((e=bigInt(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(t-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var n=!1;if(t.isNegative()&&e.isPositive()&&(n=!0,t=t.abs()),e.equals(1))return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+t)).map(Number.prototype.valueOf,1),isNegative:n};for(var i,o=[],s=t;s.isNegative()||0<=s.compareAbs(e);){s=(i=s.divmod(e)).quotient;var a=i.remainder;a.isNegative()&&(a=e.minus(a).abs(),s=s.next()),o.push(a.toJSNumber())}return o.push(s.toJSNumber()),{value:o.reverse(),isNegative:n}}function H(t,e){var r=F(t,e);return(r.isNegative?"-":"")+r.value.map(J).join("")}function V(t){if(v(+t)){var e=+t;if(e===S(e))return new d(e);throw new Error("Invalid integer: "+t)}var r="-"===t[0];r&&(t=t.slice(1));var n=t.split(/e/i);if(2>>24]^p[o>>16&255]^g[s>>8&255]^d[255&e]^n[u],a=t[o>>>24]^p[s>>16&255]^g[e>>8&255]^d[255&i]^n[u+1],c=t[s>>>24]^p[e>>16&255]^g[i>>8&255]^d[255&o]^n[u+2],e=t[e>>>24]^p[i>>16&255]^g[o>>8&255]^d[255&s]^n[u+3],u+=4,i=f,o=a,s=c;for(y=0;y<4;y++)h[r?3&-y:y]=v[i>>>24]<<24^v[o>>16&255]<<16^v[s>>8&255]<<8^v[255&e]^n[u++],f=i,i=o,o=s,s=e,e=f;return h}function u(t,e){for(var r,n,i=t.F,o=t.b,s=i[0],a=i[1],c=i[2],l=i[3],u=i[4],h=i[5],f=i[6],p=i[7],g=0;g<64;g++)r=(r=g<16?e[g]:(r=e[g+1&15],n=e[g+14&15],e[15&g]=(r>>>7^r>>>18^r>>>3^r<<25^r<<14)+(n>>>17^n>>>19^n>>>10^n<<15^n<<13)+e[15&g]+e[g+9&15]|0))+p+(u>>>6^u>>>11^u>>>25^u<<26^u<<21^u<<7)+(f^u&(h^f))+o[g],p=f,f=h,h=u,u=l+r|0,l=c,c=a,s=r+((a=s)&c^l&(a^c))+(a>>>2^a>>>13^a>>>22^a<<30^a<<19^a<<10)|0;i[0]=i[0]+s|0,i[1]=i[1]+a|0,i[2]=i[2]+c|0,i[3]=i[3]+l|0,i[4]=i[4]+u|0,i[5]=i[5]+h|0,i[6]=i[6]+f|0,i[7]=i[7]+p|0}function A(t,e){var r,n=sjcl.random.K[t],i=[];for(r in n)n.hasOwnProperty(r)&&i.push(n[r]);for(r=0;r>>24]<<24^i[e>>16&255]<<16^i[e>>8&255]<<8^i[255&e],0==t%s&&(e=e<<8^e>>>24^a<<24,a=a<<1^283*(a>>7))),r[t]=r[t-s]^e;for(s=0;t;s++,t--)e=r[3&s?t:t-4],n[s]=t<=4||s<4?e:o[0][i[e>>>24]]^o[1][i[e>>16&255]]^o[2][i[e>>8&255]]^o[3][i[255&e]]},sjcl.cipher.aes.prototype={encrypt:function(e){return t(this,e,0)},decrypt:function(e){return t(this,e,1)},s:[[[],[],[],[],[]],[[],[],[],[],[]]],O:function(){for(var t,e,r,n,i,o,s=this.s[0],a=this.s[1],c=s[4],l=a[4],u=[],h=[],f=0;f<256;f++)h[(u[f]=f<<1^283*(f>>7))^f]=f;for(t=e=0;!c[t];t^=r||1,e=h[e]||1)for(i=(i=e^e<<1^e<<2^e<<3^e<<4)>>8^255&i^99,o=16843009*(n=u[f=u[r=u[l[c[t]=i]=t]]])^65537*f^257*r^16843008*t,n=257*u[i]^16843008*i,f=0;f<4;f++)s[f][t]=n=n<<24^n>>>8,a[f][i]=o=o<<24^o>>>8;for(f=0;f<5;f++)s[f]=s[f].slice(0),a[f]=a[f].slice(0)}},sjcl.bitArray={bitSlice:function(t,e,r){return t=sjcl.bitArray.$(t.slice(e/32),32-(31&e)).slice(1),void 0===r?t:sjcl.bitArray.clamp(t,r-e)},extract:function(t,e,r){var n=Math.floor(-e-r&31);return(-32&(e+r-1^e)?t[e/32|0]<<32-n^t[e/32+1|0]>>>n:t[e/32|0]>>>n)&(1<>e-1,1)),t},partial:function(t,e,r){return 32===t?e:(r?0|e:e<<32-t)+1099511627776*t},getPartial:function(t){return Math.round(t/1099511627776)||32},equal:function(t,e){if(sjcl.bitArray.bitLength(t)!==sjcl.bitArray.bitLength(e))return!1;for(var r=0,n=0;n>>e),r=t[i]<<32-e;return i=t.length?t[t.length-1]:0,t=sjcl.bitArray.getPartial(i),n.push(sjcl.bitArray.partial(e+t&31,32>>24|e>>>8&65280|(65280&e)<<8|e<<24;return t}},sjcl.codec.utf8String={fromBits:function(t){for(var e,r="",n=sjcl.bitArray.bitLength(t),i=0;i>>8>>>8>>>8),e<<=8;return decodeURIComponent(escape(r))},toBits:function(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0,n=0;n>>s)>>>i),s>>c),u=n<>>i)>>>26),i<6?(s=t[r]<<6-i,i+=26,r++):(s<<=6,i-=6);for(;3&n.length&&!e;)n+="=";return n},toBits:function(t,e){t=t.replace(/\s|=/g,"");var r,n,i=[],o=0,s=sjcl.codec.base64.B,a=0;for(e&&(s=s.substr(0,62)+"-_"),r=0;r>>o),a=n<<32-o):a^=n<<32-(o+=6)}return 56&o&&i.push(sjcl.bitArray.partial(56&o,a,1)),i}},sjcl.codec.base64url={fromBits:function(t){return sjcl.codec.base64.fromBits(t,1,1)},toBits:function(t){return sjcl.codec.base64.toBits(t,1)}},sjcl.hash.sha256=function(t){this.b[0]||this.O(),t?(this.F=t.F.slice(0),this.A=t.A.slice(0),this.l=t.l):this.reset()},sjcl.hash.sha256.hash=function(t){return(new sjcl.hash.sha256).update(t).finalize()},sjcl.hash.sha256.prototype={blockSize:512,reset:function(){return this.F=this.Y.slice(0),this.A=[],this.l=0,this},update:function(t){"string"==typeof t&&(t=sjcl.codec.utf8String.toBits(t));var e=this.A=sjcl.bitArray.concat(this.A,t);if(i=this.l,9007199254740991<(t=this.l=i+sjcl.bitArray.bitLength(t)))throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!=typeof Uint32Array){for(var r=new Uint32Array(e),n=0,i=512+i-(512+i&511);i<=t;i+=512)u(this,r.subarray(16*n,16*(n+1))),n+=1;e.splice(0,16*n)}else for(i=512+i-(512+i&511);i<=t;i+=512)u(this,e.splice(0,16));return this},finalize:function(){for(var t=this.A,e=this.F,r=(t=sjcl.bitArray.concat(t,[sjcl.bitArray.partial(1,1)])).length+2;15&r;r++)t.push(0);for(t.push(Math.floor(this.l/4294967296)),t.push(0|this.l);t.length;)u(this,t.splice(0,16));return this.reset(),e},Y:[],b:[],O:function(){function t(t){return 4294967296*(t-Math.floor(t))|0}for(var e,r,n=0,i=2;n<64;i++){for(r=!0,e=2;e*e<=i;e++)if(0==i%e){r=!1;break}r&&(n<8&&(this.Y[n]=t(Math.pow(i,.5))),this.b[n]=t(Math.pow(i,1/3)),n++)}}},sjcl.mode.ccm={name:"ccm",G:[],listenProgress:function(t){sjcl.mode.ccm.G.push(t)},unListenProgress:function(t){-1<(t=sjcl.mode.ccm.G.indexOf(t))&&sjcl.mode.ccm.G.splice(t,1)},fa:function(t){for(var e=sjcl.mode.ccm.G.slice(),r=0;r>>8*o;o++);return o<15-c&&(o=15-c),r=a.clamp(r,8*(15-o)),e=sjcl.mode.ccm.V(t,e,r,n,i,o),s=sjcl.mode.ccm.C(t,s,r,e,i,o),a.concat(s.data,s.tag)},decrypt:function(t,e,r,n,i){i=i||64,n=n||[];var o=sjcl.bitArray,s=o.bitLength(r)/8,a=o.bitLength(e),c=o.clamp(e,a-i),l=o.bitSlice(e,a-i),a=(a-i)/8;if(s<7)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(e=2;e<4&&a>>>8*e;e++);if(e<15-s&&(e=15-s),r=o.clamp(r,8*(15-e)),c=sjcl.mode.ccm.C(t,c,r,l,i,e),t=sjcl.mode.ccm.V(t,c.data,r,n,i,e),!o.equal(c.tag,t))throw new sjcl.exception.corrupt("ccm: tag doesn't match");return c.data},na:function(t,e,r,n,i,o){var s=[],a=sjcl.bitArray,c=a.i;if(n=[a.partial(8,(e.length?64:0)|n-2<<2|o-1)],(n=a.concat(n,r))[3]|=i,n=t.encrypt(n),e.length)for((r=a.bitLength(e)/8)<=65279?s=[a.partial(16,r)]:r<=4294967295&&(s=a.concat([a.partial(16,65534)],[r])),s=a.concat(s,e),e=0;e>>31,t[1]<<1^t[2]>>>31,t[2]<<1^t[3]>>>31,t[3]<<1^135*(t[0]>>>31)]}},sjcl.mode.gcm={name:"gcm",encrypt:function(t,e,r,n,i){var o=e.slice(0);return e=sjcl.bitArray,n=n||[],t=sjcl.mode.gcm.C(!0,t,o,n,r,i||128),e.concat(t.data,t.tag)},decrypt:function(t,e,r,n,i){var o=e.slice(0),s=sjcl.bitArray,a=s.bitLength(o);if(n=n||[],o=(i=i||128)<=a?(e=s.bitSlice(o,a-i),s.bitSlice(o,0,a-i)):(e=o,[]),t=sjcl.mode.gcm.C(!1,t,o,n,r,i),!s.equal(t.tag,e))throw new sjcl.exception.corrupt("gcm: tag doesn't match");return t.data},ka:function(t,e){for(var r,n,i=sjcl.bitArray.i,o=[0,0,0,0],s=e.slice(0),a=0;a<128;a++){for((r=0!=(t[Math.floor(a/32)]&1<<31-a%32))&&(o=i(o,s)),n=0!=(1&s[3]),r=3;0>>1|(1&s[r-1])<<31;s[0]>>>=1,n&&(s[0]^=-520093696)}return o},j:function(t,e,r){var n,i=r.length;for(e=e.slice(0),n=0;ni&&(t=e.hash(t)),r=0;r=1<this.o&&(this.o=s),this.P++,this.b=sjcl.hash.sha256.hash(this.b.concat(r)),this.L=new sjcl.cipher.aes(this.b),i=0;i<4&&(this.h[i]=this.h[i]+1|0,!this.h[i]);i++);}for(i=0;i>>=1;this.c[o].update([c,this.N++,2,e,i,t.length].concat(t))}break;case"string":void 0===e&&(e=t.length),this.c[o].update([c,this.N++,3,e,i,t.length]),this.c[o].update(t);break;default:a=1}if(a)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.m[o]+=e,this.f+=e,s===this.u&&(this.isReady()!==this.u&&A("seeded",Math.max(this.o,this.f)),A("progress",this.getProgress()))},isReady:function(t){return t=this.T[void 0!==t?t:this.M],this.o&&this.o>=t?this.m[0]>this.ba&&(new Date).valueOf()>this.Z?this.J|this.I:this.I:this.f>=t?this.J|this.u:this.u},getProgress:function(t){return t=this.T[t||this.M],this.o>=t||this.f>t?1:this.f/t},startCollectors:function(){if(!this.D){if(this.a={loadTimeCollector:B(this,this.ma),mouseCollector:B(this,this.oa),keyboardCollector:B(this,this.la),accelerometerCollector:B(this,this.ea),touchCollector:B(this,this.qa)},window.addEventListener)window.addEventListener("load",this.a.loadTimeCollector,!1),window.addEventListener("mousemove",this.a.mouseCollector,!1),window.addEventListener("keypress",this.a.keyboardCollector,!1),window.addEventListener("devicemotion",this.a.accelerometerCollector,!1),window.addEventListener("touchmove",this.a.touchCollector,!1);else{if(!document.attachEvent)throw new sjcl.exception.bug("can't attach event");document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector)}this.D=!0}},stopCollectors:function(){this.D&&(window.removeEventListener?(window.removeEventListener("load",this.a.loadTimeCollector,!1),window.removeEventListener("mousemove",this.a.mouseCollector,!1),window.removeEventListener("keypress",this.a.keyboardCollector,!1),window.removeEventListener("devicemotion",this.a.accelerometerCollector,!1),window.removeEventListener("touchmove",this.a.touchCollector,!1)):document.detachEvent&&(document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove",this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.D=!1)},addEventListener:function(t,e){this.K[t][this.ga++]=e},removeEventListener:function(t,e){var r,n,i=this.K[t],o=[];for(n in i)i.hasOwnProperty(n)&&i[n]===e&&o.push(n);for(r=0;r>>n:t[e/32|0]>>>n)&(1<>e-1,1)),t},partial:function(t,e,r){return 32===t?e:(r?0|e:e<<32-t)+1099511627776*t},getPartial:function(t){return Math.round(t/1099511627776)||32},equal:function(t,e){if(sjcl.bitArray.bitLength(t)!==sjcl.bitArray.bitLength(e))return!1;for(var r=0,n=0;n>>e),r=t[i]<<32-e;return o=t.length?t[t.length-1]:0,s=sjcl.bitArray.getPartial(o),n.push(sjcl.bitArray.partial(e+s&31,32>>24|e>>>8&65280|(65280&e)<<8|e<<24;return t}},sjcl.misc.hkdf=function(t,e,r,n,i){var o,s,a,c,l,u,h=[];if(i=i||sjcl.hash.sha256,"string"==typeof n&&(n=sjcl.codec.utf8String.toBits(n)),r="string"==typeof r?sjcl.codec.utf8String.toBits(r):r||[],s=(o=new sjcl.misc.hmac(r,i)).mac(t),c=sjcl.bitArray.bitLength(s),255<(l=Math.ceil(e/c)))throw new sjcl.exception.invalid("key bit length is too large for hkdf");for(o=new sjcl.misc.hmac(s,i),u=[],a=1;a<=l;a++)o.update(u),o.update(n),o.update([sjcl.bitArray.partial(8,a)]),u=o.digest(),h=sjcl.bitArray.concat(h,u);return sjcl.bitArray.clamp(h,e)};