nostr-crypto-utils 0.4.16 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/browser/128.nostr-crypto-utils.min.js +1 -1
  2. package/dist/browser/156.nostr-crypto-utils.min.js +1 -1
  3. package/dist/browser/158.nostr-crypto-utils.min.js +1 -1
  4. package/dist/browser/26.nostr-crypto-utils.min.js +1 -1
  5. package/dist/browser/287.nostr-crypto-utils.min.js +1 -1
  6. package/dist/browser/310.nostr-crypto-utils.min.js +1 -1
  7. package/dist/browser/324.nostr-crypto-utils.min.js +2 -0
  8. package/dist/browser/324.nostr-crypto-utils.min.js.LICENSE.txt +1 -0
  9. package/dist/browser/330.nostr-crypto-utils.min.js +2 -0
  10. package/dist/browser/330.nostr-crypto-utils.min.js.LICENSE.txt +1 -0
  11. package/dist/browser/344.nostr-crypto-utils.min.js +1 -1
  12. package/dist/browser/389.nostr-crypto-utils.min.js +2 -0
  13. package/dist/browser/404.nostr-crypto-utils.min.js +1 -1
  14. package/dist/browser/419.nostr-crypto-utils.min.js +1 -1
  15. package/dist/browser/430.nostr-crypto-utils.min.js +1 -1
  16. package/dist/browser/473.nostr-crypto-utils.min.js +1 -1
  17. package/dist/browser/490.nostr-crypto-utils.min.js +1 -1
  18. package/dist/browser/503.nostr-crypto-utils.min.js +1 -1
  19. package/dist/browser/509.nostr-crypto-utils.min.js +1 -1
  20. package/dist/browser/510.nostr-crypto-utils.min.js +1 -1
  21. package/dist/browser/529.nostr-crypto-utils.min.js +2 -0
  22. package/dist/browser/529.nostr-crypto-utils.min.js.LICENSE.txt +1 -0
  23. package/dist/browser/54.nostr-crypto-utils.min.js +1 -1
  24. package/dist/browser/613.nostr-crypto-utils.min.js +1 -0
  25. package/dist/browser/636.nostr-crypto-utils.min.js +1 -1
  26. package/dist/browser/657.nostr-crypto-utils.min.js +1 -1
  27. package/dist/browser/668.nostr-crypto-utils.min.js +1 -1
  28. package/dist/browser/705.nostr-crypto-utils.min.js +1 -1
  29. package/dist/browser/761.nostr-crypto-utils.min.js +1 -1
  30. package/dist/browser/801.nostr-crypto-utils.min.js +1 -1
  31. package/dist/browser/802.nostr-crypto-utils.min.js +1 -1
  32. package/dist/browser/829.nostr-crypto-utils.min.js +1 -1
  33. package/dist/browser/851.nostr-crypto-utils.min.js +1 -1
  34. package/dist/browser/890.nostr-crypto-utils.min.js +1 -1
  35. package/dist/browser/985.nostr-crypto-utils.min.js +1 -1
  36. package/dist/browser/995.nostr-crypto-utils.min.js +1 -1
  37. package/dist/browser/crypto.nostr-crypto-utils.min.js +1 -1
  38. package/dist/browser/main-43dd7041.nostr-crypto-utils.min.js +1 -1
  39. package/dist/browser/main-96d4916e.nostr-crypto-utils.min.js +1 -1
  40. package/dist/browser/protocol.nostr-crypto-utils.min.js +1 -1
  41. package/dist/browser/validation.nostr-crypto-utils.min.js +1 -1
  42. package/dist/cjs/crypto.js +28 -6
  43. package/dist/cjs/crypto.js.map +1 -1
  44. package/dist/cjs/index.js +5 -1
  45. package/dist/cjs/index.js.map +1 -1
  46. package/dist/cjs/nips/index.js +2 -0
  47. package/dist/cjs/nips/index.js.map +1 -1
  48. package/dist/cjs/nips/nip-04.js +15 -15
  49. package/dist/cjs/nips/nip-04.js.map +1 -1
  50. package/dist/cjs/nips/nip-44.js +131 -0
  51. package/dist/cjs/nips/nip-44.js.map +1 -0
  52. package/dist/cjs/nips/nip-49.js +62 -0
  53. package/dist/cjs/nips/nip-49.js.map +1 -0
  54. package/dist/esm/crypto.js +26 -6
  55. package/dist/esm/crypto.js.map +1 -1
  56. package/dist/esm/index.js +3 -1
  57. package/dist/esm/index.js.map +1 -1
  58. package/dist/esm/nips/index.js +2 -0
  59. package/dist/esm/nips/index.js.map +1 -1
  60. package/dist/esm/nips/nip-04.js +15 -15
  61. package/dist/esm/nips/nip-04.js.map +1 -1
  62. package/dist/esm/nips/nip-44.js +125 -0
  63. package/dist/esm/nips/nip-44.js.map +1 -0
  64. package/dist/esm/nips/nip-49.js +58 -0
  65. package/dist/esm/nips/nip-49.js.map +1 -0
  66. package/dist/types/crypto.d.ts +15 -2
  67. package/dist/types/crypto.d.ts.map +1 -1
  68. package/dist/types/index.d.ts +3 -1
  69. package/dist/types/index.d.ts.map +1 -1
  70. package/dist/types/nips/nip-04.d.ts.map +1 -1
  71. package/dist/types/nips/nip-44.d.ts +41 -0
  72. package/dist/types/nips/nip-44.d.ts.map +1 -0
  73. package/dist/types/nips/nip-49.d.ts +24 -0
  74. package/dist/types/nips/nip-49.d.ts.map +1 -0
  75. package/package.json +25 -13
  76. package/src/__tests__/nips/nip-44.test.ts +124 -0
  77. package/src/__tests__/nips/nip-49.test.ts +88 -0
  78. package/src/crypto.ts +32 -7
  79. package/src/index.ts +4 -0
  80. package/src/nips/index.ts +2 -0
  81. package/src/nips/nip-04.ts +14 -16
  82. package/src/nips/nip-44.ts +133 -0
  83. package/src/nips/nip-49.ts +72 -0
  84. package/dist/browser/343.nostr-crypto-utils.min.js +0 -1
  85. package/dist/browser/88.nostr-crypto-utils.min.js +0 -2
  86. package/dist/browser/910.nostr-crypto-utils.min.js +0 -1
  87. /package/dist/browser/{88.nostr-crypto-utils.min.js.LICENSE.txt → 389.nostr-crypto-utils.min.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[128],{7447(t,e,r){var n=r(8490),i=r(2723),s=r(7011),o=r(480),c=r(5037),u=s.assert,h=r(1200),a=r(8545);function p(t){if(!(this instanceof p))return new p(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(o,t),"Unknown curve "+t),t=o[t]),t instanceof o.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=p,p.prototype.keyPair=function(t){return new h(this,t)},p.prototype.keyFromPrivate=function(t,e){return h.fromPrivate(this,t,e)},p.prototype.keyFromPublic=function(t,e){return h.fromPublic(this,t,e)},p.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||c(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new n(2));;){var o=new n(e.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},p.prototype._truncateToN=function(t,e,r){var i;if(n.isBN(t)||"number"==typeof t)i=(t=new n(t,16)).byteLength();else if("object"==typeof t)i=t.length,t=new n(t,16);else{var s=t.toString();i=s.length+1>>>1,t=new n(s,16)}"number"!=typeof r&&(r=8*i);var o=r-this.n.bitLength();return o>0&&(t=t.ushrn(o)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},p.prototype.sign=function(t,e,r,s){if("object"==typeof r&&(s=r,r=null),s||(s={}),"string"!=typeof t&&"number"!=typeof t&&!n.isBN(t)){u("object"==typeof t&&t&&"number"==typeof t.length,"Expected message to be an array-like, a hex string, or a BN instance"),u(t.length>>>0===t.length);for(var o=0;o<t.length;o++)u((255&t[o])===t[o])}e=this.keyFromPrivate(e,r),t=this._truncateToN(t,!1,s.msgBitLength),u(!t.isNeg(),"Can not sign a negative message");var c=this.n.byteLength(),h=e.getPrivate().toArray("be",c),p=t.toArray("be",c);u(new n(p).eq(t),"Can not sign message");for(var f=new i({hash:this.hash,entropy:h,nonce:p,pers:s.pers,persEnc:s.persEnc||"utf8"}),d=this.n.sub(new n(1)),y=0;;y++){var v=s.k?s.k(y):new n(f.generate(this.n.byteLength()));if(!((v=this._truncateToN(v,!0)).cmpn(1)<=0||v.cmp(d)>=0)){var l=this.g.mul(v);if(!l.isInfinity()){var g=l.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=v.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(b=b.umod(this.n)).cmpn(0)){var P=(l.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return s.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),P^=1),new a({r:m,s:b,recoveryParam:P})}}}}}},p.prototype.verify=function(t,e,r,n,i){i||(i={}),t=this._truncateToN(t,!1,i.msgBitLength),r=this.keyFromPublic(r,n);var s=(e=new a(e,"hex")).r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var c,u=o.invm(this.n),h=u.mul(t).umod(this.n),p=u.mul(s).umod(this.n);return this.curve._maxwellTrick?!(c=this.g.jmulAdd(h,r.getPublic(),p)).isInfinity()&&c.eqXToP(s):!(c=this.g.mulAdd(h,r.getPublic(),p)).isInfinity()&&0===c.getX().umod(this.n).cmp(s)},p.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new a(e,i);var s=this.n,o=new n(t),c=e.r,h=e.s,p=1&r,f=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");c=f?this.curve.pointFromX(c.add(this.curve.n),p):this.curve.pointFromX(c,p);var d=e.r.invm(s),y=s.sub(o).mul(d).umod(s),v=h.mul(d).umod(s);return this.g.mulAdd(y,c,v)},p.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new a(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch(t){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},1200(t,e,r){var n=r(8490),i=r(7011).assert;function s(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=s,s.fromPublic=function(t,e,r){return e instanceof s?e:new s(t,{pub:e,pubEnc:r})},s.fromPrivate=function(t,e,r){return e instanceof s?e:new s(t,{priv:e,privEnc:r})},s.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},s.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},s.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},s.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},s.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},s.prototype.verify=function(t,e,r){return this.ec.verify(t,e,this,void 0,r)},s.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},8545(t,e,r){var n=r(8490),i=r(7011),s=i.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(s(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function c(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===t[e.place])return!1;for(var i=0,s=0,o=e.place;s<n;s++,o++)i<<=8,i|=t[o],i>>>=0;return!(i<=127)&&(e.place=o,i)}function h(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function a(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=o,o.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new c;if(48!==t[r.place++])return!1;var s=u(t,r);if(!1===s)return!1;if(s+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(128&t[r.place])return!1;var h=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var a=u(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;if(128&t[r.place])return!1;var p=t.slice(r.place,a+r.place);if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}if(0===p[0]){if(!(128&p[1]))return!1;p=p.slice(1)}return this.r=new n(h),this.s=new n(p),this.recoveryParam=null,!0},o.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=h(e),r=h(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];a(n,e.length),(n=n.concat(e)).push(2),a(n,r.length);var s=n.concat(r),o=[48];return a(o,s.length),o=o.concat(s),i.encode(o,t)}},8650(t,e,r){var n=r(7952),i=r(480),s=r(7011),o=s.assert,c=s.parseBytes,u=r(6661),h=r(220);function a(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof a))return new a(t);t=i[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=n.sha512}t.exports=a,a.prototype.sign=function(t,e){t=c(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),s=this.encodePoint(i),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),u=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:s})},a.prototype.verify=function(t,e,r){if(t=c(t),(e=this.makeSignature(e)).S().gte(e.eddsa.curve.n)||e.S().isNeg())return!1;var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(s)},a.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return s.intFromLE(t.digest()).umod(this.curve.n)},a.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},a.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},a.prototype.makeSignature=function(t){return t instanceof h?t:new h(this,t)},a.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},a.prototype.decodePoint=function(t){var e=(t=s.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),n=!!(128&t[e]),i=s.intFromLE(r);return this.curve.pointFromY(i,n)},a.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},a.prototype.decodeInt=function(t){return s.intFromLE(t)},a.prototype.isPoint=function(t){return t instanceof this.pointClass}},6661(t,e,r){var n=r(7011),i=n.assert,s=n.parseBytes,o=n.cachedProperty;function c(t,e){this.eddsa=t,this._secret=s(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=s(e.pub)}c.fromPublic=function(t,e){return e instanceof c?e:new c(t,{pub:e})},c.fromSecret=function(t,e){return e instanceof c?e:new c(t,{secret:e})},c.prototype.secret=function(){return this._secret},o(c,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),o(c,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),o(c,"privBytes",function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n}),o(c,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),o(c,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),o(c,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),c.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},c.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},c.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},c.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=c},220(t,e,r){var n=r(8490),i=r(7011),s=i.assert,o=i.cachedProperty,c=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=c(e)),Array.isArray(e)&&(s(e.length===2*t.encodingLength,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),s(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof n&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}o(u,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),o(u,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),o(u,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),o(u,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u}}]);
1
+ "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[128],{7447:(t,e,r)=>{var n=r(8490),i=r(2723),s=r(7011),o=r(480),c=r(5037),u=s.assert,h=r(1200),a=r(8545);function p(t){if(!(this instanceof p))return new p(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(o,t),"Unknown curve "+t),t=o[t]),t instanceof o.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=p,p.prototype.keyPair=function(t){return new h(this,t)},p.prototype.keyFromPrivate=function(t,e){return h.fromPrivate(this,t,e)},p.prototype.keyFromPublic=function(t,e){return h.fromPublic(this,t,e)},p.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||c(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new n(2));;){var o=new n(e.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},p.prototype._truncateToN=function(t,e,r){var i;if(n.isBN(t)||"number"==typeof t)i=(t=new n(t,16)).byteLength();else if("object"==typeof t)i=t.length,t=new n(t,16);else{var s=t.toString();i=s.length+1>>>1,t=new n(s,16)}"number"!=typeof r&&(r=8*i);var o=r-this.n.bitLength();return o>0&&(t=t.ushrn(o)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},p.prototype.sign=function(t,e,r,s){if("object"==typeof r&&(s=r,r=null),s||(s={}),"string"!=typeof t&&"number"!=typeof t&&!n.isBN(t)){u("object"==typeof t&&t&&"number"==typeof t.length,"Expected message to be an array-like, a hex string, or a BN instance"),u(t.length>>>0===t.length);for(var o=0;o<t.length;o++)u((255&t[o])===t[o])}e=this.keyFromPrivate(e,r),t=this._truncateToN(t,!1,s.msgBitLength),u(!t.isNeg(),"Can not sign a negative message");var c=this.n.byteLength(),h=e.getPrivate().toArray("be",c),p=t.toArray("be",c);u(new n(p).eq(t),"Can not sign message");for(var f=new i({hash:this.hash,entropy:h,nonce:p,pers:s.pers,persEnc:s.persEnc||"utf8"}),d=this.n.sub(new n(1)),y=0;;y++){var v=s.k?s.k(y):new n(f.generate(this.n.byteLength()));if(!((v=this._truncateToN(v,!0)).cmpn(1)<=0||v.cmp(d)>=0)){var l=this.g.mul(v);if(!l.isInfinity()){var g=l.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var b=v.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(b=b.umod(this.n)).cmpn(0)){var P=(l.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return s.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),P^=1),new a({r:m,s:b,recoveryParam:P})}}}}}},p.prototype.verify=function(t,e,r,n,i){i||(i={}),t=this._truncateToN(t,!1,i.msgBitLength),r=this.keyFromPublic(r,n);var s=(e=new a(e,"hex")).r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var c,u=o.invm(this.n),h=u.mul(t).umod(this.n),p=u.mul(s).umod(this.n);return this.curve._maxwellTrick?!(c=this.g.jmulAdd(h,r.getPublic(),p)).isInfinity()&&c.eqXToP(s):!(c=this.g.mulAdd(h,r.getPublic(),p)).isInfinity()&&0===c.getX().umod(this.n).cmp(s)},p.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new a(e,i);var s=this.n,o=new n(t),c=e.r,h=e.s,p=1&r,f=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");c=f?this.curve.pointFromX(c.add(this.curve.n),p):this.curve.pointFromX(c,p);var d=e.r.invm(s),y=s.sub(o).mul(d).umod(s),v=h.mul(d).umod(s);return this.g.mulAdd(y,c,v)},p.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new a(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch(t){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},1200:(t,e,r)=>{var n=r(8490),i=r(7011).assert;function s(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=s,s.fromPublic=function(t,e,r){return e instanceof s?e:new s(t,{pub:e,pubEnc:r})},s.fromPrivate=function(t,e,r){return e instanceof s?e:new s(t,{priv:e,privEnc:r})},s.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},s.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},s.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},s.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},s.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},s.prototype.verify=function(t,e,r){return this.ec.verify(t,e,this,void 0,r)},s.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},8545:(t,e,r)=>{var n=r(8490),i=r(7011),s=i.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(s(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function c(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===t[e.place])return!1;for(var i=0,s=0,o=e.place;s<n;s++,o++)i<<=8,i|=t[o],i>>>=0;return!(i<=127)&&(e.place=o,i)}function h(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function a(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=o,o.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new c;if(48!==t[r.place++])return!1;var s=u(t,r);if(!1===s)return!1;if(s+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(128&t[r.place])return!1;var h=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var a=u(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;if(128&t[r.place])return!1;var p=t.slice(r.place,a+r.place);if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}if(0===p[0]){if(!(128&p[1]))return!1;p=p.slice(1)}return this.r=new n(h),this.s=new n(p),this.recoveryParam=null,!0},o.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=h(e),r=h(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];a(n,e.length),(n=n.concat(e)).push(2),a(n,r.length);var s=n.concat(r),o=[48];return a(o,s.length),o=o.concat(s),i.encode(o,t)}},8650:(t,e,r)=>{var n=r(7952),i=r(480),s=r(7011),o=s.assert,c=s.parseBytes,u=r(6661),h=r(220);function a(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof a))return new a(t);t=i[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=n.sha512}t.exports=a,a.prototype.sign=function(t,e){t=c(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),s=this.encodePoint(i),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),u=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:s})},a.prototype.verify=function(t,e,r){if(t=c(t),(e=this.makeSignature(e)).S().gte(e.eddsa.curve.n)||e.S().isNeg())return!1;var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(s)},a.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return s.intFromLE(t.digest()).umod(this.curve.n)},a.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},a.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},a.prototype.makeSignature=function(t){return t instanceof h?t:new h(this,t)},a.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},a.prototype.decodePoint=function(t){var e=(t=s.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),n=!!(128&t[e]),i=s.intFromLE(r);return this.curve.pointFromY(i,n)},a.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},a.prototype.decodeInt=function(t){return s.intFromLE(t)},a.prototype.isPoint=function(t){return t instanceof this.pointClass}},6661:(t,e,r)=>{var n=r(7011),i=n.assert,s=n.parseBytes,o=n.cachedProperty;function c(t,e){this.eddsa=t,this._secret=s(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=s(e.pub)}c.fromPublic=function(t,e){return e instanceof c?e:new c(t,{pub:e})},c.fromSecret=function(t,e){return e instanceof c?e:new c(t,{secret:e})},c.prototype.secret=function(){return this._secret},o(c,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),o(c,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),o(c,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),o(c,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),o(c,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),o(c,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),c.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},c.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},c.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},c.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=c},220:(t,e,r)=>{var n=r(8490),i=r(7011),s=i.assert,o=i.cachedProperty,c=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=c(e)),Array.isArray(e)&&(s(e.length===2*t.encodingLength,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),s(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof n&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}o(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),o(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),o(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),o(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u}}]);
@@ -1 +1 @@
1
- (this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[156],{5037(e,t,r){var i;function n(e){this.rand=e}if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var c=r(1565);if("function"!=typeof c.randomBytes)throw new Error("Not supported");n.prototype._rand=function(e){return c.randomBytes(e)}}catch(e){}},462(e,t,r){var i=r(2861).Buffer;function n(e){i.isBuffer(e)||(e=i.from(e));for(var t=e.length/4|0,r=new Array(t),n=0;n<t;n++)r[n]=e.readUInt32BE(4*n);return r}function c(e){for(;0<e.length;e++)e[0]=0}function o(e,t,r,i,n){for(var c,o,a,h,s=r[0],p=r[1],u=r[2],l=r[3],f=e[0]^t[0],d=e[1]^t[1],y=e[2]^t[2],v=e[3]^t[3],_=4,m=1;m<n;m++)c=s[f>>>24]^p[d>>>16&255]^u[y>>>8&255]^l[255&v]^t[_++],o=s[d>>>24]^p[y>>>16&255]^u[v>>>8&255]^l[255&f]^t[_++],a=s[y>>>24]^p[v>>>16&255]^u[f>>>8&255]^l[255&d]^t[_++],h=s[v>>>24]^p[f>>>16&255]^u[d>>>8&255]^l[255&y]^t[_++],f=c,d=o,y=a,v=h;return c=(i[f>>>24]<<24|i[d>>>16&255]<<16|i[y>>>8&255]<<8|i[255&v])^t[_++],o=(i[d>>>24]<<24|i[y>>>16&255]<<16|i[v>>>8&255]<<8|i[255&f])^t[_++],a=(i[y>>>24]<<24|i[v>>>16&255]<<16|i[f>>>8&255]<<8|i[255&d])^t[_++],h=(i[v>>>24]<<24|i[f>>>16&255]<<16|i[d>>>8&255]<<8|i[255&y])^t[_++],[c>>>=0,o>>>=0,a>>>=0,h>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],i=[],n=[[],[],[],[]],c=[[],[],[],[]],o=0,a=0,h=0;h<256;++h){var s=a^a<<1^a<<2^a<<3^a<<4;s=s>>>8^255&s^99,r[o]=s,i[s]=o;var p=e[o],u=e[p],l=e[u],f=257*e[s]^16843008*s;n[0][o]=f<<24|f>>>8,n[1][o]=f<<16|f>>>16,n[2][o]=f<<8|f>>>24,n[3][o]=f,f=16843009*l^65537*u^257*p^16843008*o,c[0][s]=f<<24|f>>>8,c[1][s]=f<<16|f>>>16,c[2][s]=f<<8|f>>>24,c[3][s]=f,0===o?o=a=1:(o=p^e[e[e[l^p]]],a^=e[e[a]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:c}}();function s(e){this._key=n(e),this._reset()}s.blockSize=16,s.keySize=32,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,i=4*(r+1),n=[],c=0;c<t;c++)n[c]=e[c];for(c=t;c<i;c++){var o=n[c-1];c%t===0?(o=o<<8|o>>>24,o=h.SBOX[o>>>24]<<24|h.SBOX[o>>>16&255]<<16|h.SBOX[o>>>8&255]<<8|h.SBOX[255&o],o^=a[c/t|0]<<24):t>6&&c%t===4&&(o=h.SBOX[o>>>24]<<24|h.SBOX[o>>>16&255]<<16|h.SBOX[o>>>8&255]<<8|h.SBOX[255&o]),n[c]=n[c-t]^o}for(var s=[],p=0;p<i;p++){var u=i-p,l=n[u-(p%4?0:4)];s[p]=p<4||u<=4?l:h.INV_SUB_MIX[0][h.SBOX[l>>>24]]^h.INV_SUB_MIX[1][h.SBOX[l>>>16&255]]^h.INV_SUB_MIX[2][h.SBOX[l>>>8&255]]^h.INV_SUB_MIX[3][h.SBOX[255&l]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=s},s.prototype.encryptBlockRaw=function(e){return o(e=n(e),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},s.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},s.prototype.decryptBlock=function(e){var t=(e=n(e))[1];e[1]=e[3],e[3]=t;var r=o(e,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),c=i.allocUnsafe(16);return c.writeUInt32BE(r[0],0),c.writeUInt32BE(r[3],4),c.writeUInt32BE(r[2],8),c.writeUInt32BE(r[1],12),c},s.prototype.scrub=function(){c(this._keySchedule),c(this._invKeySchedule),c(this._key)},e.exports.AES=s},2356(e,t,r){var i=r(462),n=r(2861).Buffer,c=r(6168),o=r(6698),a=r(5892),h=r(295),s=r(5122);function p(e,t,r,o){c.call(this);var h=n.alloc(4,0);this._cipher=new i.AES(t);var p=this._cipher.encryptBlock(h);this._ghash=new a(p),r=function(e,t,r){if(12===t.length)return e._finID=n.concat([t,n.from([0,0,0,1])]),n.concat([t,n.from([0,0,0,2])]);var i=new a(r),c=t.length,o=c%16;i.update(t),o&&(o=16-o,i.update(n.alloc(o,0))),i.update(n.alloc(8,0));var h=8*c,p=n.alloc(8);p.writeUIntBE(h,0,8),i.update(p),e._finID=i.state;var u=n.from(e._finID);return s(u),u}(this,r,p),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=o,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}o(p,c),p.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=n.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},p.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=h(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=0;n<i;++n)r+=e[n]^t[n];return r}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},p.prototype.getAuthTag=function(){if(this._decrypt||!n.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},p.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},p.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},e.exports=p},1241(e,t,r){var i=r(5799),n=r(6171),c=r(3219);t.createCipher=t.Cipher=i.createCipher,t.createCipheriv=t.Cipheriv=i.createCipheriv,t.createDecipher=t.Decipher=n.createDecipher,t.createDecipheriv=t.Decipheriv=n.createDecipheriv,t.listCiphers=t.getCiphers=function(){return Object.keys(c)}},6171(e,t,r){var i=r(2356),n=r(2861).Buffer,c=r(530),o=r(650),a=r(6168),h=r(462),s=r(8078);function p(e,t,r){a.call(this),this._cache=new u,this._last=void 0,this._cipher=new h.AES(t),this._prev=n.from(r),this._mode=e,this._autopadding=!0}function u(){this.cache=n.allocUnsafe(0)}function l(e,t,r){var a=c[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof t&&(t=n.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===a.type?new o(a.module,t,r,!0):"auth"===a.type?new i(a.module,t,r,!0):new p(a.module,t,r)}r(6698)(p,a),p.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return n.concat(i)},p.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var r=-1;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(16!==t)return e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},p.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},u.prototype.add=function(e){this.cache=n.concat([this.cache,e])},u.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},u.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=function(e,t){var r=c[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=s(t,!1,r.key,r.iv);return l(e,i.key,i.iv)},t.createDecipheriv=l},5799(e,t,r){var i=r(530),n=r(2356),c=r(2861).Buffer,o=r(650),a=r(6168),h=r(462),s=r(8078);function p(e,t,r){a.call(this),this._cache=new l,this._cipher=new h.AES(t),this._prev=c.from(r),this._mode=e,this._autopadding=!0}r(6698)(p,a),p.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get();)r=this._mode.encrypt(this,t),i.push(r);return c.concat(i)};var u=c.alloc(16,16);function l(){this.cache=c.allocUnsafe(0)}function f(e,t,r){var a=i[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=c.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=c.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===a.type?new o(a.module,t,r):"auth"===a.type?new n(a.module,t,r):new p(a.module,t,r)}p.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(u))throw this._cipher.scrub(),new Error("data not multiple of block length")},p.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=c.concat([this.cache,e])},l.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},l.prototype.flush=function(){for(var e=16-this.cache.length,t=c.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return c.concat([this.cache,t])},t.createCipheriv=f,t.createCipher=function(e,t){var r=i[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=s(t,!1,r.key,r.iv);return f(e,n.key,n.iv)}},5892(e,t,r){var i=r(2861).Buffer,n=i.alloc(16,0);function c(e){var t=i.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}o.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},o.prototype._multiply=function(){for(var e,t,r,i=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],n=[0,0,0,0],o=-1;++o<128;){for(!!(this.state[~~(o/8)]&1<<7-o%8)&&(n[0]^=i[0],n[1]^=i[1],n[2]^=i[2],n[3]^=i[3]),r=!!(1&i[3]),t=3;t>0;t--)i[t]=i[t]>>>1|(1&i[t-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=c(n)},o.prototype.update=function(e){var t;for(this.cache=i.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(c([0,e,0,t])),this.state},e.exports=o},5122(e){e.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},2884(e,t,r){var i=r(295);t.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},t.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},6383(e,t,r){var i=r(2861).Buffer,n=r(295);function c(e,t,r){var c=t.length,o=n(t,e._cache);return e._cache=e._cache.slice(c),e._prev=i.concat([e._prev,r?t:o]),o}t.encrypt=function(e,t,r){for(var n,o=i.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=i.allocUnsafe(0)),!(e._cache.length<=t.length)){o=i.concat([o,c(e,t,r)]);break}n=e._cache.length,o=i.concat([o,c(e,t.slice(0,n),r)]),t=t.slice(n)}return o}},5264(e,t,r){var i=r(2861).Buffer;function n(e,t,r){for(var i,n,o=-1,a=0;++o<8;)i=t&1<<7-o?128:0,a+=(128&(n=e._cipher.encryptBlock(e._prev)[0]^i))>>o%8,e._prev=c(e._prev,r?i:n);return a}function c(e,t){var r=e.length,n=-1,c=i.allocUnsafe(e.length);for(e=i.concat([e,i.from([t])]);++n<r;)c[n]=e[n]<<1|e[n+1]>>7;return c}t.encrypt=function(e,t,r){for(var c=t.length,o=i.allocUnsafe(c),a=-1;++a<c;)o[a]=n(e,t[a],r);return o}},6975(e,t,r){var i=r(2861).Buffer;function n(e,t,r){var n=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=i.concat([e._prev.slice(1),i.from([r?t:n])]),n}t.encrypt=function(e,t,r){for(var c=t.length,o=i.allocUnsafe(c),a=-1;++a<c;)o[a]=n(e,t[a],r);return o}},3053(e,t,r){var i=r(295),n=r(2861).Buffer,c=r(5122);function o(e){var t=e._cipher.encryptBlockRaw(e._prev);return c(e._prev),t}t.encrypt=function(e,t){var r=Math.ceil(t.length/16),c=e._cache.length;e._cache=n.concat([e._cache,n.allocUnsafe(16*r)]);for(var a=0;a<r;a++){var h=o(e),s=c+16*a;e._cache.writeUInt32BE(h[0],s+0),e._cache.writeUInt32BE(h[1],s+4),e._cache.writeUInt32BE(h[2],s+8),e._cache.writeUInt32BE(h[3],s+12)}var p=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),i(t,p)}},2632(e,t){t.encrypt=function(e,t){return e._cipher.encryptBlock(t)},t.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},530(e,t,r){var i={ECB:r(2632),CBC:r(2884),CFB:r(6383),CFB8:r(6975),CFB1:r(5264),OFB:r(6843),CTR:r(3053),GCM:r(3053)},n=r(3219);for(var c in n)n[c].module=i[n[c].mode];e.exports=n},6843(e,t,r){var i=r(8287).Buffer,n=r(295);function c(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}t.encrypt=function(e,t){for(;e._cache.length<t.length;)e._cache=i.concat([e._cache,c(e)]);var r=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),n(t,r)}},650(e,t,r){var i=r(462),n=r(2861).Buffer,c=r(6168);function o(e,t,r,o){c.call(this),this._cipher=new i.AES(t),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=o,this._mode=e}r(6698)(o,c),o.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},o.prototype._final=function(){this._cipher.scrub()},e.exports=o},125(e,t,r){var i=r(4050),n=r(1241),c=r(530),o=r(2438),a=r(8078);function h(e,t,r){if(e=e.toLowerCase(),c[e])return n.createCipheriv(e,t,r);if(o[e])return new i({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function s(e,t,r){if(e=e.toLowerCase(),c[e])return n.createDecipheriv(e,t,r);if(o[e])return new i({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}t.createCipher=t.Cipher=function(e,t){var r,i;if(e=e.toLowerCase(),c[e])r=c[e].key,i=c[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");r=8*o[e].key,i=o[e].iv}var n=a(t,!1,r,i);return h(e,n.key,n.iv)},t.createCipheriv=t.Cipheriv=h,t.createDecipher=t.Decipher=function(e,t){var r,i;if(e=e.toLowerCase(),c[e])r=c[e].key,i=c[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");r=8*o[e].key,i=o[e].iv}var n=a(t,!1,r,i);return s(e,n.key,n.iv)},t.createDecipheriv=t.Decipheriv=s,t.listCiphers=t.getCiphers=function(){return Object.keys(o).concat(n.getCiphers())}},4050(e,t,r){var i=r(6168),n=r(9560),c=r(6698),o=r(2861).Buffer,a={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function h(e){i.call(this);var t,r=e.mode.toLowerCase(),n=a[r];t=e.decrypt?"decrypt":"encrypt";var c=e.key;o.isBuffer(c)||(c=o.from(c)),"des-ede"!==r&&"des-ede-cbc"!==r||(c=o.concat([c,c.slice(0,8)]));var h=e.iv;o.isBuffer(h)||(h=o.from(h)),this._des=n.create({key:c,iv:h,type:t})}a.des=a["des-cbc"],a.des3=a["des-ede3-cbc"],e.exports=h,c(h,i),h.prototype._update=function(e){return o.from(this._des.update(e))},h.prototype._final=function(){return o.from(this._des.final())}},2438(e,t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}},7332(e,t,r){"use strict";var i=r(9404),n=r(3209),c=r(2861).Buffer;function o(e){var t,r=e.modulus.byteLength();do{t=new i(n(r))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function a(e,t){var r=function(e){var t=o(e);return{blinder:t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),n=t.modulus.byteLength(),a=new i(e).mul(r.blinder).umod(t.modulus),h=a.toRed(i.mont(t.prime1)),s=a.toRed(i.mont(t.prime2)),p=t.coefficient,u=t.prime1,l=t.prime2,f=h.redPow(t.exponent1).fromRed(),d=s.redPow(t.exponent2).fromRed(),y=f.isub(d).imul(p).umod(u).imul(l);return d.iadd(y).imul(r.unblinder).umod(t.modulus).toArrayLike(c,"be",n)}a.getr=o,e.exports=a},3219(e){"use strict";e.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')}}]);
1
+ (this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[156],{5037:(e,t,r)=>{var i;function n(e){this.rand=e}if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var c=r(1565);if("function"!=typeof c.randomBytes)throw new Error("Not supported");n.prototype._rand=function(e){return c.randomBytes(e)}}catch(e){}},462:(e,t,r)=>{var i=r(2861).Buffer;function n(e){i.isBuffer(e)||(e=i.from(e));for(var t=e.length/4|0,r=new Array(t),n=0;n<t;n++)r[n]=e.readUInt32BE(4*n);return r}function c(e){for(;0<e.length;e++)e[0]=0}function o(e,t,r,i,n){for(var c,o,a,h,s=r[0],p=r[1],u=r[2],l=r[3],f=e[0]^t[0],d=e[1]^t[1],y=e[2]^t[2],v=e[3]^t[3],_=4,m=1;m<n;m++)c=s[f>>>24]^p[d>>>16&255]^u[y>>>8&255]^l[255&v]^t[_++],o=s[d>>>24]^p[y>>>16&255]^u[v>>>8&255]^l[255&f]^t[_++],a=s[y>>>24]^p[v>>>16&255]^u[f>>>8&255]^l[255&d]^t[_++],h=s[v>>>24]^p[f>>>16&255]^u[d>>>8&255]^l[255&y]^t[_++],f=c,d=o,y=a,v=h;return c=(i[f>>>24]<<24|i[d>>>16&255]<<16|i[y>>>8&255]<<8|i[255&v])^t[_++],o=(i[d>>>24]<<24|i[y>>>16&255]<<16|i[v>>>8&255]<<8|i[255&f])^t[_++],a=(i[y>>>24]<<24|i[v>>>16&255]<<16|i[f>>>8&255]<<8|i[255&d])^t[_++],h=(i[v>>>24]<<24|i[f>>>16&255]<<16|i[d>>>8&255]<<8|i[255&y])^t[_++],[c>>>=0,o>>>=0,a>>>=0,h>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],i=[],n=[[],[],[],[]],c=[[],[],[],[]],o=0,a=0,h=0;h<256;++h){var s=a^a<<1^a<<2^a<<3^a<<4;s=s>>>8^255&s^99,r[o]=s,i[s]=o;var p=e[o],u=e[p],l=e[u],f=257*e[s]^16843008*s;n[0][o]=f<<24|f>>>8,n[1][o]=f<<16|f>>>16,n[2][o]=f<<8|f>>>24,n[3][o]=f,f=16843009*l^65537*u^257*p^16843008*o,c[0][s]=f<<24|f>>>8,c[1][s]=f<<16|f>>>16,c[2][s]=f<<8|f>>>24,c[3][s]=f,0===o?o=a=1:(o=p^e[e[e[l^p]]],a^=e[e[a]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:c}}();function s(e){this._key=n(e),this._reset()}s.blockSize=16,s.keySize=32,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,i=4*(r+1),n=[],c=0;c<t;c++)n[c]=e[c];for(c=t;c<i;c++){var o=n[c-1];c%t==0?(o=o<<8|o>>>24,o=h.SBOX[o>>>24]<<24|h.SBOX[o>>>16&255]<<16|h.SBOX[o>>>8&255]<<8|h.SBOX[255&o],o^=a[c/t|0]<<24):t>6&&c%t==4&&(o=h.SBOX[o>>>24]<<24|h.SBOX[o>>>16&255]<<16|h.SBOX[o>>>8&255]<<8|h.SBOX[255&o]),n[c]=n[c-t]^o}for(var s=[],p=0;p<i;p++){var u=i-p,l=n[u-(p%4?0:4)];s[p]=p<4||u<=4?l:h.INV_SUB_MIX[0][h.SBOX[l>>>24]]^h.INV_SUB_MIX[1][h.SBOX[l>>>16&255]]^h.INV_SUB_MIX[2][h.SBOX[l>>>8&255]]^h.INV_SUB_MIX[3][h.SBOX[255&l]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=s},s.prototype.encryptBlockRaw=function(e){return o(e=n(e),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},s.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},s.prototype.decryptBlock=function(e){var t=(e=n(e))[1];e[1]=e[3],e[3]=t;var r=o(e,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),c=i.allocUnsafe(16);return c.writeUInt32BE(r[0],0),c.writeUInt32BE(r[3],4),c.writeUInt32BE(r[2],8),c.writeUInt32BE(r[1],12),c},s.prototype.scrub=function(){c(this._keySchedule),c(this._invKeySchedule),c(this._key)},e.exports.AES=s},2356:(e,t,r)=>{var i=r(462),n=r(2861).Buffer,c=r(6168),o=r(6698),a=r(5892),h=r(295),s=r(5122);function p(e,t,r,o){c.call(this);var h=n.alloc(4,0);this._cipher=new i.AES(t);var p=this._cipher.encryptBlock(h);this._ghash=new a(p),r=function(e,t,r){if(12===t.length)return e._finID=n.concat([t,n.from([0,0,0,1])]),n.concat([t,n.from([0,0,0,2])]);var i=new a(r),c=t.length,o=c%16;i.update(t),o&&(o=16-o,i.update(n.alloc(o,0))),i.update(n.alloc(8,0));var h=8*c,p=n.alloc(8);p.writeUIntBE(h,0,8),i.update(p),e._finID=i.state;var u=n.from(e._finID);return s(u),u}(this,r,p),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=o,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}o(p,c),p.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=n.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},p.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=h(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=0;n<i;++n)r+=e[n]^t[n];return r}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},p.prototype.getAuthTag=function(){if(this._decrypt||!n.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},p.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},p.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},e.exports=p},1241:(e,t,r)=>{var i=r(5799),n=r(6171),c=r(3219);t.createCipher=t.Cipher=i.createCipher,t.createCipheriv=t.Cipheriv=i.createCipheriv,t.createDecipher=t.Decipher=n.createDecipher,t.createDecipheriv=t.Decipheriv=n.createDecipheriv,t.listCiphers=t.getCiphers=function(){return Object.keys(c)}},6171:(e,t,r)=>{var i=r(2356),n=r(2861).Buffer,c=r(530),o=r(650),a=r(6168),h=r(462),s=r(8078);function p(e,t,r){a.call(this),this._cache=new u,this._last=void 0,this._cipher=new h.AES(t),this._prev=n.from(r),this._mode=e,this._autopadding=!0}function u(){this.cache=n.allocUnsafe(0)}function l(e,t,r){var a=c[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof t&&(t=n.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===a.type?new o(a.module,t,r,!0):"auth"===a.type?new i(a.module,t,r,!0):new p(a.module,t,r)}r(6698)(p,a),p.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return n.concat(i)},p.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var r=-1;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(16!==t)return e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},p.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},u.prototype.add=function(e){this.cache=n.concat([this.cache,e])},u.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},u.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=function(e,t){var r=c[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=s(t,!1,r.key,r.iv);return l(e,i.key,i.iv)},t.createDecipheriv=l},5799:(e,t,r)=>{var i=r(530),n=r(2356),c=r(2861).Buffer,o=r(650),a=r(6168),h=r(462),s=r(8078);function p(e,t,r){a.call(this),this._cache=new l,this._cipher=new h.AES(t),this._prev=c.from(r),this._mode=e,this._autopadding=!0}r(6698)(p,a),p.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get();)r=this._mode.encrypt(this,t),i.push(r);return c.concat(i)};var u=c.alloc(16,16);function l(){this.cache=c.allocUnsafe(0)}function f(e,t,r){var a=i[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=c.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=c.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===a.type?new o(a.module,t,r):"auth"===a.type?new n(a.module,t,r):new p(a.module,t,r)}p.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(u))throw this._cipher.scrub(),new Error("data not multiple of block length")},p.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=c.concat([this.cache,e])},l.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},l.prototype.flush=function(){for(var e=16-this.cache.length,t=c.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return c.concat([this.cache,t])},t.createCipheriv=f,t.createCipher=function(e,t){var r=i[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=s(t,!1,r.key,r.iv);return f(e,n.key,n.iv)}},5892:(e,t,r)=>{var i=r(2861).Buffer,n=i.alloc(16,0);function c(e){var t=i.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}o.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},o.prototype._multiply=function(){for(var e,t,r,i=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],n=[0,0,0,0],o=-1;++o<128;){for(!!(this.state[~~(o/8)]&1<<7-o%8)&&(n[0]^=i[0],n[1]^=i[1],n[2]^=i[2],n[3]^=i[3]),r=!!(1&i[3]),t=3;t>0;t--)i[t]=i[t]>>>1|(1&i[t-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=c(n)},o.prototype.update=function(e){var t;for(this.cache=i.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(c([0,e,0,t])),this.state},e.exports=o},5122:e=>{e.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},2884:(e,t,r)=>{var i=r(295);t.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},t.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},6383:(e,t,r)=>{var i=r(2861).Buffer,n=r(295);function c(e,t,r){var c=t.length,o=n(t,e._cache);return e._cache=e._cache.slice(c),e._prev=i.concat([e._prev,r?t:o]),o}t.encrypt=function(e,t,r){for(var n,o=i.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=i.allocUnsafe(0)),!(e._cache.length<=t.length)){o=i.concat([o,c(e,t,r)]);break}n=e._cache.length,o=i.concat([o,c(e,t.slice(0,n),r)]),t=t.slice(n)}return o}},5264:(e,t,r)=>{var i=r(2861).Buffer;function n(e,t,r){for(var i,n,o=-1,a=0;++o<8;)i=t&1<<7-o?128:0,a+=(128&(n=e._cipher.encryptBlock(e._prev)[0]^i))>>o%8,e._prev=c(e._prev,r?i:n);return a}function c(e,t){var r=e.length,n=-1,c=i.allocUnsafe(e.length);for(e=i.concat([e,i.from([t])]);++n<r;)c[n]=e[n]<<1|e[n+1]>>7;return c}t.encrypt=function(e,t,r){for(var c=t.length,o=i.allocUnsafe(c),a=-1;++a<c;)o[a]=n(e,t[a],r);return o}},6975:(e,t,r)=>{var i=r(2861).Buffer;function n(e,t,r){var n=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=i.concat([e._prev.slice(1),i.from([r?t:n])]),n}t.encrypt=function(e,t,r){for(var c=t.length,o=i.allocUnsafe(c),a=-1;++a<c;)o[a]=n(e,t[a],r);return o}},3053:(e,t,r)=>{var i=r(295),n=r(2861).Buffer,c=r(5122);function o(e){var t=e._cipher.encryptBlockRaw(e._prev);return c(e._prev),t}t.encrypt=function(e,t){var r=Math.ceil(t.length/16),c=e._cache.length;e._cache=n.concat([e._cache,n.allocUnsafe(16*r)]);for(var a=0;a<r;a++){var h=o(e),s=c+16*a;e._cache.writeUInt32BE(h[0],s+0),e._cache.writeUInt32BE(h[1],s+4),e._cache.writeUInt32BE(h[2],s+8),e._cache.writeUInt32BE(h[3],s+12)}var p=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),i(t,p)}},2632:(e,t)=>{t.encrypt=function(e,t){return e._cipher.encryptBlock(t)},t.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},530:(e,t,r)=>{var i={ECB:r(2632),CBC:r(2884),CFB:r(6383),CFB8:r(6975),CFB1:r(5264),OFB:r(6843),CTR:r(3053),GCM:r(3053)},n=r(3219);for(var c in n)n[c].module=i[n[c].mode];e.exports=n},6843:(e,t,r)=>{var i=r(8287).Buffer,n=r(295);function c(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}t.encrypt=function(e,t){for(;e._cache.length<t.length;)e._cache=i.concat([e._cache,c(e)]);var r=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),n(t,r)}},650:(e,t,r)=>{var i=r(462),n=r(2861).Buffer,c=r(6168);function o(e,t,r,o){c.call(this),this._cipher=new i.AES(t),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=o,this._mode=e}r(6698)(o,c),o.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},o.prototype._final=function(){this._cipher.scrub()},e.exports=o},125:(e,t,r)=>{var i=r(4050),n=r(1241),c=r(530),o=r(2438),a=r(8078);function h(e,t,r){if(e=e.toLowerCase(),c[e])return n.createCipheriv(e,t,r);if(o[e])return new i({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function s(e,t,r){if(e=e.toLowerCase(),c[e])return n.createDecipheriv(e,t,r);if(o[e])return new i({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}t.createCipher=t.Cipher=function(e,t){var r,i;if(e=e.toLowerCase(),c[e])r=c[e].key,i=c[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");r=8*o[e].key,i=o[e].iv}var n=a(t,!1,r,i);return h(e,n.key,n.iv)},t.createCipheriv=t.Cipheriv=h,t.createDecipher=t.Decipher=function(e,t){var r,i;if(e=e.toLowerCase(),c[e])r=c[e].key,i=c[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");r=8*o[e].key,i=o[e].iv}var n=a(t,!1,r,i);return s(e,n.key,n.iv)},t.createDecipheriv=t.Decipheriv=s,t.listCiphers=t.getCiphers=function(){return Object.keys(o).concat(n.getCiphers())}},4050:(e,t,r)=>{var i=r(6168),n=r(9560),c=r(6698),o=r(2861).Buffer,a={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function h(e){i.call(this);var t,r=e.mode.toLowerCase(),n=a[r];t=e.decrypt?"decrypt":"encrypt";var c=e.key;o.isBuffer(c)||(c=o.from(c)),"des-ede"!==r&&"des-ede-cbc"!==r||(c=o.concat([c,c.slice(0,8)]));var h=e.iv;o.isBuffer(h)||(h=o.from(h)),this._des=n.create({key:c,iv:h,type:t})}a.des=a["des-cbc"],a.des3=a["des-ede3-cbc"],e.exports=h,c(h,i),h.prototype._update=function(e){return o.from(this._des.update(e))},h.prototype._final=function(){return o.from(this._des.final())}},2438:(e,t)=>{t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}},7332:(e,t,r)=>{"use strict";var i=r(9404),n=r(3209),c=r(2861).Buffer;function o(e){var t,r=e.modulus.byteLength();do{t=new i(n(r))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function a(e,t){var r=function(e){var t=o(e);return{blinder:t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),n=t.modulus.byteLength(),a=new i(e).mul(r.blinder).umod(t.modulus),h=a.toRed(i.mont(t.prime1)),s=a.toRed(i.mont(t.prime2)),p=t.coefficient,u=t.prime1,l=t.prime2,f=h.redPow(t.exponent1).fromRed(),d=s.redPow(t.exponent2).fromRed(),y=f.isub(d).imul(p).umod(u).imul(l);return d.iadd(y).imul(r.unblinder).umod(t.modulus).toArrayLike(c,"be",n)}a.getr=o,e.exports=a},3219:e=>{"use strict";e.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')}}]);
@@ -1 +1 @@
1
- (this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[158],{1158(t,i,r){!function(t,i){"use strict";function h(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 e(t,i,r){if(e.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 o;"object"==typeof t?t.exports=e:i.BN=e,e.BN=e,e.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(4688).Buffer}catch(t){}function s(t,i){var r=t.charCodeAt(i);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,i,r){var h=s(t,r);return r-1>=i&&(h|=s(t,r-1)<<4),h}function a(t,i,r,h){for(var n=0,e=Math.min(t.length,r),o=i;o<e;o++){var s=t.charCodeAt(o)-48;n*=h,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}e.isBN=function(t){return t instanceof e||null!==t&&"object"==typeof t&&t.constructor.wordSize===e.wordSize&&Array.isArray(t.words)},e.max=function(t,i){return t.cmp(i)>0?t:i},e.min=function(t,i){return t.cmp(i)<0?t:i},e.prototype._init=function(t,i,r){if("number"==typeof t)return this._initNumber(t,i,r);if("object"==typeof t)return this._initArray(t,i,r);"hex"===i&&(i=16),h(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===i?this._parseHex(t,n,r):(this._parseBase(t,i,n),"le"===r&&this._initArray(this.toArray(),i,r)))},e.prototype._initNumber=function(t,i,r){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):(h(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),i,r)},e.prototype._initArray=function(t,i,r){if(h("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<this.length;n++)this.words[n]=0;var e,o,s=0;if("be"===r)for(n=t.length-1,e=0;n>=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[e]|=o<<s&67108863,this.words[e+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===r)for(n=0,e=0;n<t.length;n+=3)o=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[e]|=o<<s&67108863,this.words[e+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this.strip()},e.prototype._parseHex=function(t,i,r){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var n,e=0,o=0;if("be"===r)for(h=t.length-1;h>=i;h-=2)n=u(t,i,h)<<e,this.words[o]|=67108863&n,e>=18?(e-=18,o+=1,this.words[o]|=n>>>26):e+=8;else for(h=(t.length-i)%2==0?i+1:i;h<t.length;h+=2)n=u(t,i,h)<<e,this.words[o]|=67108863&n,e>=18?(e-=18,o+=1,this.words[o]|=n>>>26):e+=8;this.strip()},e.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,s=Math.min(e,e-o)+r,u=0,l=r;l<s;l+=h)u=a(t,l,l+h,i),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var m=1;for(u=a(t,l,t.length,i),l=0;l<o;l++)m*=i;this.imuln(m),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},e.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},e.prototype.clone=function(){var t=new e(null);return this.copy(t),t},e.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},e.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},e.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},e.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};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];function d(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<h;a++){for(var l=u>>>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()}e.prototype.toString=function(t,i){var r;if(i=0|i||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,e=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<n|e)).toString(16);e=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==e||o!==this.length-1?l[6-u.length]+u+r:u+r}for(0!==e&&(r=e.toString(16)+r);r.length%i!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var a=m[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?M+r:l[a-M.length]+M+r}for(this.isZero()&&(r="0"+r);r.length%i!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}h(!1,"Base should be between 2 and 36")},e.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&&h(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},e.prototype.toJSON=function(){return this.toString(16)},e.prototype.toBuffer=function(t,i){return h(void 0!==o),this.toArrayLike(o,t,i)},e.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},e.prototype.toArrayLike=function(t,i,r){var n=this.byteLength(),e=r||Math.max(1,n);h(n<=e,"byte array longer than desired length"),h(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<e;s++)a[s]=0}else{for(s=0;s<e-n;s++)a[s]=0;for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[e-s-1]=o}return a},Math.clz32?e.prototype._countBits=function(t){return 32-Math.clz32(t)}:e.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},e.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 8191&i||(r+=13,i>>>=13),127&i||(r+=7,i>>>=7),15&i||(r+=4,i>>>=4),3&i||(r+=2,i>>>=2),1&i||r++,r},e.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},e.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var r=this._zeroBits(this.words[i]);if(t+=r,26!==r)break}return t},e.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},e.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},e.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},e.prototype.isNeg=function(){return 0!==this.negative},e.prototype.neg=function(){return this.clone().ineg()},e.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},e.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},e.prototype.ior=function(t){return h(0===(this.negative|t.negative)),this.iuor(t)},e.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},e.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},e.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;r<i.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=i.length,this.strip()},e.prototype.iand=function(t){return h(0===(this.negative|t.negative)),this.iuand(t)},e.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},e.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},e.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var h=0;h<r.length;h++)this.words[h]=i.words[h]^r.words[h];if(this!==i)for(;h<i.length;h++)this.words[h]=i.words[h];return this.length=i.length,this.strip()},e.prototype.ixor=function(t){return h(0===(this.negative|t.negative)),this.iuxor(t)},e.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},e.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},e.prototype.inotn=function(t){h("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),r=t%26;this._expand(i),r>0&&i--;for(var n=0;n<i;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},e.prototype.notn=function(t){return this.clone().inotn(t)},e.prototype.setn=function(t,i){h("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=i?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},e.prototype.iadd=function(t){var i,r,h;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(r=this,h=t):(r=t,h=this);for(var n=0,e=0;e<h.length;e++)i=(0|r.words[e])+(0|h.words[e])+n,this.words[e]=67108863&i,n=i>>>26;for(;0!==n&&e<r.length;e++)i=(0|r.words[e])+n,this.words[e]=67108863&i,n=i>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;e<r.length;e++)this.words[e]=r.words[e];return this},e.prototype.add=function(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},e.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<h.length;o++)e=(i=(0|r.words[o])-(0|h.words[o])+e)>>26,this.words[o]=67108863&i;for(;0!==e&&o<r.length;o++)e=(i=(0|r.words[o])+e)>>26,this.words[o]=67108863&i;if(0===e&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},e.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,i,r){var h,n,e,o=t.words,s=i.words,u=r.words,a=0,l=0|o[0],m=8191&l,f=l>>>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,B=0|o[6],R=8191&B,q=B>>>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,C=O>>>13,K=0|s[0],P=8191&K,F=K>>>13,U=0|s[1],D=8191&U,H=U>>>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,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&lt,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,P))|0)+((8191&(n=(n=Math.imul(m,F))+Math.imul(f,P)|0))<<13)|0;a=((e=Math.imul(f,F))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,h=Math.imul(p,P),n=(n=Math.imul(p,F))+Math.imul(M,P)|0,e=Math.imul(M,F);var gt=(a+(h=h+Math.imul(m,D)|0)|0)+((8191&(n=(n=n+Math.imul(m,H)|0)+Math.imul(f,D)|0))<<13)|0;a=((e=e+Math.imul(f,H)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,h=Math.imul(g,P),n=(n=Math.imul(g,F))+Math.imul(c,P)|0,e=Math.imul(c,F),h=h+Math.imul(p,D)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(M,D)|0,e=e+Math.imul(M,H)|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,P),n=(n=Math.imul(y,F))+Math.imul(b,P)|0,e=Math.imul(b,F),h=h+Math.imul(g,D)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(c,D)|0,e=e+Math.imul(c,H)|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,P),n=(n=Math.imul(k,F))+Math.imul(A,P)|0,e=Math.imul(A,F),h=h+Math.imul(y,D)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(b,D)|0,e=e+Math.imul(b,H)|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,P),n=(n=Math.imul(S,F))+Math.imul(Z,P)|0,e=Math.imul(Z,F),h=h+Math.imul(k,D)|0,n=(n=n+Math.imul(k,H)|0)+Math.imul(A,D)|0,e=e+Math.imul(A,H)|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,P),n=(n=Math.imul(R,F))+Math.imul(q,P)|0,e=Math.imul(q,F),h=h+Math.imul(S,D)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(Z,D)|0,e=e+Math.imul(Z,H)|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,P),n=(n=Math.imul(L,F))+Math.imul(I,P)|0,e=Math.imul(I,F),h=h+Math.imul(R,D)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(q,D)|0,e=e+Math.imul(q,H)|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,P),n=(n=Math.imul(T,F))+Math.imul(E,P)|0,e=Math.imul(E,F),h=h+Math.imul(L,D)|0,n=(n=n+Math.imul(L,H)|0)+Math.imul(I,D)|0,e=e+Math.imul(I,H)|0,h=h+Math.imul(R,G)|0,n=(n=n+Math.imul(R,Q)|0)+Math.imul(q,G)|0,e=e+Math.imul(q,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,P),n=(n=Math.imul(j,F))+Math.imul(C,P)|0,e=Math.imul(C,F),h=h+Math.imul(T,D)|0,n=(n=n+Math.imul(T,H)|0)+Math.imul(E,D)|0,e=e+Math.imul(E,H)|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(q,W)|0,e=e+Math.imul(q,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,D),n=(n=Math.imul(j,H))+Math.imul(C,D)|0,e=Math.imul(C,H),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(q,$)|0,e=e+Math.imul(q,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(C,G)|0,e=Math.imul(C,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(q,rt)|0,e=e+Math.imul(q,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(C,W)|0,e=Math.imul(C,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(q,et)|0,e=e+Math.imul(q,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 Bt=(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)+(Bt>>>26)|0,Bt&=67108863,h=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(C,$)|0,e=Math.imul(C,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(q,ut)|0,e=e+Math.imul(q,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(C,rt)|0,e=Math.imul(C,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(q,mt)|0,e=e+Math.imul(q,ft)|0;var qt=(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)+(qt>>>26)|0,qt&=67108863,h=Math.imul(j,et),n=(n=Math.imul(j,ot))+Math.imul(C,et)|0,e=Math.imul(C,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(q,pt)|0))<<13)|0;a=((e=e+Math.imul(q,Mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h=Math.imul(j,ut),n=(n=Math.imul(j,at))+Math.imul(C,ut)|0,e=Math.imul(C,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(C,mt)|0,e=Math.imul(C,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(C,pt)|0))<<13)|0;return a=((e=Math.imul(C,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]=Bt,u[13]=Rt,u[14]=qt,u[15]=Nt,u[16]=Lt,u[17]=It,u[18]=zt,0!==a&&(u[19]=a,r.length++),r};function M(t,i,r){return(new v).mulp(t,i,r)}function v(t,i){this.x=t,this.y=i}Math.imul||(p=d),e.prototype.mulTo=function(t,i){var r,h=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,i):h<63?d(this,t,i):h<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<r.length-1;e++){var o=n;n=0;for(var s=67108863&h,u=Math.min(e,i.length-1),a=Math.max(0,e-t.length+1);a<=u;a++){var l=e-a,m=(0|t.words[l])*(0|i.words[a]),f=67108863&m;s=67108863&(f=f+s|0),n+=(o=(o=o+(m/67108864|0)|0)+(f>>>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):M(this,t,i),r},v.prototype.makeRBT=function(t){for(var i=new Array(t),r=e.prototype._countBits(t)-1,h=0;h<t;h++)i[h]=this.revBin(h,r,t);return i},v.prototype.revBin=function(t,i,r){if(0===t||t===r-1)return t;for(var h=0,n=0;n<i;n++)h|=(1&t)<<i-n-1,t>>=1;return h},v.prototype.permute=function(t,i,r,h,n,e){for(var o=0;o<e;o++)h[o]=i[t[o]],n[o]=r[t[o]]},v.prototype.transform=function(t,i,r,h,n,e){this.permute(e,t,i,r,h,n);for(var o=1;o<n;o<<=1)for(var s=o<<1,u=Math.cos(2*Math.PI/s),a=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var m=u,f=a,d=0;d<o;d++){var p=r[l+d],M=h[l+d],v=r[l+d+o],g=h[l+d+o],c=m*v-f*g;g=m*g+f*v,v=c,r[l+d]=p+v,h[l+d]=M+g,r[l+d+o]=p-v,h[l+d+o]=M-g,d!==s&&(c=u*m-a*f,f=u*f+a*m,m=c)}},v.prototype.guessLen13b=function(t,i){var r=1|Math.max(i,t),h=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+h},v.prototype.conjugate=function(t,i,r){if(!(r<=1))for(var h=0;h<r/2;h++){var n=t[h];t[h]=t[r-h-1],t[r-h-1]=n,n=i[h],i[h]=-i[r-h-1],i[r-h-1]=-n}},v.prototype.normalize13b=function(t,i){for(var r=0,h=0;h<i/2;h++){var n=8192*Math.round(t[2*h+1]/i)+Math.round(t[2*h]/i)+r;t[h]=67108863&n,r=n<67108864?0:n/67108864|0}return t},v.prototype.convert13b=function(t,i,r,n){for(var e=0,o=0;o<i;o++)e+=0|t[o],r[2*o]=8191&e,e>>>=13,r[2*o+1]=8191&e,e>>>=13;for(o=2*i;o<n;++o)r[o]=0;h(0===e),h(!(-8192&e))},v.prototype.stub=function(t){for(var i=new Array(t),r=0;r<t;r++)i[r]=0;return i},v.prototype.mulp=function(t,i,r){var h=2*this.guessLen13b(t.length,i.length),n=this.makeRBT(h),e=this.stub(h),o=new Array(h),s=new Array(h),u=new Array(h),a=new Array(h),l=new Array(h),m=new Array(h),f=r.words;f.length=h,this.convert13b(t.words,t.length,o,h),this.convert13b(i.words,i.length,a,h),this.transform(o,e,s,u,h,n),this.transform(a,e,l,m,h,n);for(var d=0;d<h;d++){var p=s[d]*l[d]-u[d]*m[d];u[d]=s[d]*m[d]+u[d]*l[d],s[d]=p}return this.conjugate(s,u,h),this.transform(s,u,f,e,h,n),this.conjugate(f,e,h),this.normalize13b(f,h),r.negative=t.negative^i.negative,r.length=t.length+i.length,r.strip()},e.prototype.mul=function(t){var i=new e(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},e.prototype.mulf=function(t){var i=new e(null);return i.words=new Array(this.length+t.length),M(this,t,i)},e.prototype.imul=function(t){return this.clone().mulTo(t,this)},e.prototype.imuln=function(t){h("number"==typeof t),h(t<67108864);for(var i=0,r=0;r<this.length;r++){var n=(0|this.words[r])*t,e=(67108863&n)+(67108863&i);i>>=26,i+=n/67108864|0,i+=e>>>26,this.words[r]=67108863&e}return 0!==i&&(this.words[r]=i,this.length++),this},e.prototype.muln=function(t){return this.clone().imuln(t)},e.prototype.sqr=function(){return this.mul(this)},e.prototype.isqr=function(){return this.imul(this.clone())},e.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r<i.length;r++){var h=r/26|0,n=r%26;i[r]=(t.words[h]&1<<n)>>>n}return i}(t);if(0===i.length)return new e(1);for(var r=this,h=0;h<i.length&&0===i[h];h++,r=r.sqr());if(++h<i.length)for(var n=r.sqr();h<i.length;h++,n=n.sqr())0!==i[h]&&(r=r.mul(n));return r},e.prototype.iushln=function(t){h("number"==typeof t&&t>=0);var i,r=t%26,n=(t-r)/26,e=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(i=0;i<this.length;i++){var s=this.words[i]&e,u=(0|this.words[i])-s<<r;this.words[i]=u|o,o=s>>>26-r}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<n;i++)this.words[i]=0;this.length+=n}return this.strip()},e.prototype.ishln=function(t){return h(0===this.negative),this.iushln(t)},e.prototype.iushrn=function(t,i,r){var n;h("number"==typeof t&&t>=0),n=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<<e,u=r;if(n-=o,n=Math.max(0,n),u){for(var a=0;a<o;a++)u.words[a]=this.words[a];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,a=0;a<this.length;a++)this.words[a]=this.words[a+o];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;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()},e.prototype.ishrn=function(t,i,r){return h(0===this.negative),this.iushrn(t,i,r)},e.prototype.shln=function(t){return this.clone().ishln(t)},e.prototype.ushln=function(t){return this.clone().iushln(t)},e.prototype.shrn=function(t){return this.clone().ishrn(t)},e.prototype.ushrn=function(t){return this.clone().iushrn(t)},e.prototype.testn=function(t){h("number"==typeof t&&t>=0);var i=t%26,r=(t-i)/26,n=1<<i;return!(this.length<=r||!(this.words[r]&n))},e.prototype.imaskn=function(t){h("number"==typeof t&&t>=0);var i=t%26,r=(t-i)/26;if(h(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==i&&r++,this.length=Math.min(r,this.length),0!==i){var n=67108863^67108863>>>i<<i;this.words[this.length-1]&=n}return this.strip()},e.prototype.maskn=function(t){return this.clone().imaskn(t)},e.prototype.iaddn=function(t){return h("number"==typeof t),h(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},e.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[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},e.prototype.isubn=function(t){if(h("number"==typeof t),h(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<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},e.prototype.addn=function(t){return this.clone().iaddn(t)},e.prototype.subn=function(t){return this.clone().isubn(t)},e.prototype.iabs=function(){return this.negative=0,this},e.prototype.abs=function(){return this.clone().iabs()},e.prototype._ishlnsubmul=function(t,i,r){var n,e,o=t.length+r;this._expand(o);var s=0;for(n=0;n<t.length;n++){e=(0|this.words[n+r])+s;var u=(0|t.words[n])*i;s=((e-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&e}for(;n<this.length-r;n++)s=(e=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&e;if(0===s)return this.strip();for(h(-1===s),s=0,n=0;n<this.length;n++)s=(e=-(0|this.words[n])+s)>>26,this.words[n]=67108863&e;return this.negative=1,this.strip()},e.prototype._wordDiv=function(t,i){var r=(this.length,t.length),h=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),h.iushln(r),o=0|n.words[n.length-1]);var s,u=h.length-n.length;if("mod"!==i){(s=new e(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a<s.length;a++)s.words[a]=0}var l=h.clone()._ishlnsubmul(n,1,u);0===l.negative&&(h=l,s&&(s.words[u]=1));for(var m=u-1;m>=0;m--){var f=67108864*(0|h.words[n.length+m])+(0|h.words[n.length+m-1]);for(f=Math.min(f/o|0,67108863),h._ishlnsubmul(n,f,m);0!==h.negative;)f--,h.negative=0,h._ishlnsubmul(n,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}},e.prototype.divmod=function(t,i,r){return h(!t.isZero()),this.isZero()?{div:new e(0),mod:new e(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(n=s.div.neg()),"div"!==i&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(n=s.div.neg()),{div:n,mod:s.mod}):0!==(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new e(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new e(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new e(this.modn(t.words[0]))}:this._wordDiv(t,i);var n,o,s},e.prototype.div=function(t){return this.divmod(t,"div",!1).div},e.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},e.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},e.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)},e.prototype.modn=function(t){h(t<=67108863);for(var i=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(i*r+(0|this.words[n]))%t;return r},e.prototype.idivn=function(t){h(t<=67108863);for(var i=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*i;this.words[r]=n/t|0,i=n%t}return this.strip()},e.prototype.divn=function(t){return this.clone().idivn(t)},e.prototype.egcd=function(t){h(0===t.negative),h(!t.isZero());var i=this,r=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var n=new e(1),o=new e(0),s=new e(0),u=new e(1),a=0;i.isEven()&&r.isEven();)i.iushrn(1),r.iushrn(1),++a;for(var l=r.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;)(n.isOdd()||o.isOdd())&&(n.iadd(l),o.isub(m)),n.iushrn(1),o.iushrn(1);for(var p=0,M=1;0===(r.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(r)>=0?(i.isub(r),n.isub(s),o.isub(u)):(r.isub(i),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(a)}},e.prototype._invmp=function(t){h(0===t.negative),h(!t.isZero());var i=this,r=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var n,o=new e(1),s=new e(0),u=r.clone();i.cmpn(1)>0&&r.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===(r.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(r.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(r)>=0?(i.isub(r),o.isub(s)):(r.isub(i),s.isub(o))}return(n=0===i.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},e.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)},e.prototype.invm=function(t){return this.egcd(t).a.umod(t)},e.prototype.isEven=function(){return!(1&this.words[0])},e.prototype.isOdd=function(){return!(1&~this.words[0])},e.prototype.andln=function(t){return this.words[0]&t},e.prototype.bincn=function(t){h("number"==typeof t);var i=t%26,r=(t-i)/26,n=1<<i;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var e=n,o=r;0!==e&&o<this.length;o++){var s=0|this.words[o];e=(s+=e)>>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},e.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},e.prototype.cmpn=function(t){var i,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)i=1;else{r&&(t=-t),h(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:n<t?-1:1}return 0!==this.negative?0|-i:i},e.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},e.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,r=this.length-1;r>=0;r--){var h=0|this.words[r],n=0|t.words[r];if(h!==n){h<n?i=-1:h>n&&(i=1);break}}return i},e.prototype.gtn=function(t){return 1===this.cmpn(t)},e.prototype.gt=function(t){return 1===this.cmp(t)},e.prototype.gten=function(t){return this.cmpn(t)>=0},e.prototype.gte=function(t){return this.cmp(t)>=0},e.prototype.ltn=function(t){return-1===this.cmpn(t)},e.prototype.lt=function(t){return-1===this.cmp(t)},e.prototype.lten=function(t){return this.cmpn(t)<=0},e.prototype.lte=function(t){return this.cmp(t)<=0},e.prototype.eqn=function(t){return 0===this.cmpn(t)},e.prototype.eq=function(t){return 0===this.cmp(t)},e.red=function(t){return new k(t)},e.prototype.toRed=function(t){return h(!this.red,"Already a number in reduction context"),h(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},e.prototype.fromRed=function(){return h(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},e.prototype._forceRed=function(t){return this.red=t,this},e.prototype.forceRed=function(t){return h(!this.red,"Already a number in reduction context"),this._forceRed(t)},e.prototype.redAdd=function(t){return h(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},e.prototype.redIAdd=function(t){return h(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},e.prototype.redSub=function(t){return h(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},e.prototype.redISub=function(t){return h(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},e.prototype.redShl=function(t){return h(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},e.prototype.redMul=function(t){return h(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},e.prototype.redIMul=function(t){return h(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},e.prototype.redSqr=function(){return h(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},e.prototype.redISqr=function(){return h(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},e.prototype.redSqrt=function(){return h(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},e.prototype.redInvm=function(){return h(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},e.prototype.redNeg=function(){return h(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},e.prototype.redPow=function(t){return h(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function c(t,i){this.name=t,this.p=new e(i,16),this.n=this.p.bitLength(),this.k=new e(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){c.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){c.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){c.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){c.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var i=e._prime(t);this.m=i.p,this.prime=i}else h(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new e(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)}c.prototype._tmp=function(){var t=new e(null);return t.words=new Array(Math.ceil(this.n/13)),t},c.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=i<this.n?-1:r.ucmp(this.p);return 0===h?(r.words[0]=0,r.length=1):h>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},c.prototype.split=function(t,i){t.iushrn(this.n,0,i)},c.prototype.imulK=function(t){return t.imul(this.k)},n(w,c),w.prototype.split=function(t,i){for(var r=4194303,h=Math.min(t.length,9),n=0;n<h;n++)i.words[n]=t.words[n];if(i.length=h,t.length<=9)return t.words[0]=0,void(t.length=1);var e=t.words[9];for(i.words[i.length++]=e&r,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(o&r)<<4|e>>>22,e=o}e>>>=22,t.words[n-10]=e,0===e&&t.length>10?t.length-=10:t.length-=9},w.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<t.length;r++){var h=0|t.words[r];i+=977*h,t.words[r]=67108863&i,i=64*h+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(y,c),n(b,c),n(_,c),_.prototype.imulK=function(t){for(var i=0,r=0;r<t.length;r++){var h=19*(0|t.words[r])+i,n=67108863&h;h>>>=26,t.words[r]=n,i=h}return 0!==i&&(t.words[t.length++]=i),t},e._prime=function(t){if(g[t])return g[t];var i;if("k256"===t)i=new w;else if("p224"===t)i=new y;else if("p192"===t)i=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new _}return g[t]=i,i},k.prototype._verify1=function(t){h(0===t.negative,"red works only with positives"),h(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,i){h(0===(t.negative|i.negative),"red works only with positives"),h(t.red&&t.red===i.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.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)},k.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},k.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)},k.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},k.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},k.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(h(i%2==1),3===i){var r=this.m.add(new e(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);h(!n.isZero());var s=new e(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new e(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,n),f=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();h(v<p);var g=this.pow(m,new e(1).iushln(p-v-1));f=f.redMul(g),m=g.redSqr(),d=d.redMul(m),p=v}return f},k.prototype.invm=function(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},k.prototype.pow=function(t,i){if(i.isZero())return new e(1).toRed(this);if(0===i.cmpn(1))return t.clone();var r=new Array(16);r[0]=new e(1).toRed(this),r[1]=t;for(var h=2;h<r.length;h++)r[h]=this.mul(r[h-1],t);var n=r[0],o=0,s=0,u=i.bitLength()%26;for(0===u&&(u=26),h=i.length-1;h>=0;h--){for(var a=i.words[h],l=u-1;l>=0;l--){var m=a>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===h&&0===l)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},k.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},k.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},e.mont=function(t){return new A(t)},n(A,k),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},A.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)},A.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new e(0)._forceRed(this);var r=t.mul(i),h=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(h).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)}}]);
1
+ (this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[158],{1158:function(t,i,r){!function(t,i){"use strict";function n(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 e(t,i,r){if(e.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 o;"object"==typeof t?t.exports=e:i.BN=e,e.BN=e,e.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(4688).Buffer}catch(t){}function s(t,i){var r=t.charCodeAt(i);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,i,r){var n=s(t,r);return r-1>=i&&(n|=s(t,r-1)<<4),n}function a(t,i,r,n){for(var h=0,e=Math.min(t.length,r),o=i;o<e;o++){var s=t.charCodeAt(o)-48;h*=n,h+=s>=49?s-49+10:s>=17?s-17+10:s}return h}e.isBN=function(t){return t instanceof e||null!==t&&"object"==typeof t&&t.constructor.wordSize===e.wordSize&&Array.isArray(t.words)},e.max=function(t,i){return t.cmp(i)>0?t:i},e.min=function(t,i){return t.cmp(i)<0?t:i},e.prototype._init=function(t,i,r){if("number"==typeof t)return this._initNumber(t,i,r);if("object"==typeof t)return this._initArray(t,i,r);"hex"===i&&(i=16),n(i===(0|i)&&i>=2&&i<=36);var h=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(h++,this.negative=1),h<t.length&&(16===i?this._parseHex(t,h,r):(this._parseBase(t,i,h),"le"===r&&this._initArray(this.toArray(),i,r)))},e.prototype._initNumber=function(t,i,r){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):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),i,r)},e.prototype._initArray=function(t,i,r){if(n("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<this.length;h++)this.words[h]=0;var e,o,s=0;if("be"===r)for(h=t.length-1,e=0;h>=0;h-=3)o=t[h]|t[h-1]<<8|t[h-2]<<16,this.words[e]|=o<<s&67108863,this.words[e+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===r)for(h=0,e=0;h<t.length;h+=3)o=t[h]|t[h+1]<<8|t[h+2]<<16,this.words[e]|=o<<s&67108863,this.words[e+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this.strip()},e.prototype._parseHex=function(t,i,r){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var h,e=0,o=0;if("be"===r)for(n=t.length-1;n>=i;n-=2)h=u(t,i,n)<<e,this.words[o]|=67108863&h,e>=18?(e-=18,o+=1,this.words[o]|=h>>>26):e+=8;else for(n=(t.length-i)%2==0?i+1:i;n<t.length;n+=2)h=u(t,i,n)<<e,this.words[o]|=67108863&h,e>=18?(e-=18,o+=1,this.words[o]|=h>>>26):e+=8;this.strip()},e.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,s=Math.min(e,e-o)+r,u=0,l=r;l<s;l+=n)u=a(t,l,l+n,i),this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var m=1;for(u=a(t,l,t.length,i),l=0;l<o;l++)m*=i;this.imuln(m),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},e.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},e.prototype.clone=function(){var t=new e(null);return this.copy(t),t},e.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},e.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},e.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},e.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};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];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<n;a++){for(var l=u>>>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()}e.prototype.toString=function(t,i){var r;if(i=0|i||1,16===(t=t||10)||"hex"===t){r="";for(var h=0,e=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<h|e)).toString(16);e=s>>>24-h&16777215,(h+=2)>=26&&(h-=26,o--),r=0!==e||o!==this.length-1?l[6-u.length]+u+r:u+r}for(0!==e&&(r=e.toString(16)+r);r.length%i!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var a=m[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?M+r:l[a-M.length]+M+r}for(this.isZero()&&(r="0"+r);r.length%i!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},e.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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},e.prototype.toJSON=function(){return this.toString(16)},e.prototype.toBuffer=function(t,i){return n(void 0!==o),this.toArrayLike(o,t,i)},e.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},e.prototype.toArrayLike=function(t,i,r){var h=this.byteLength(),e=r||Math.max(1,h);n(h<=e,"byte array longer than desired length"),n(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<e;s++)a[s]=0}else{for(s=0;s<e-h;s++)a[s]=0;for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[e-s-1]=o}return a},Math.clz32?e.prototype._countBits=function(t){return 32-Math.clz32(t)}:e.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},e.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 8191&i||(r+=13,i>>>=13),127&i||(r+=7,i>>>=7),15&i||(r+=4,i>>>=4),3&i||(r+=2,i>>>=2),1&i||r++,r},e.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},e.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var r=this._zeroBits(this.words[i]);if(t+=r,26!==r)break}return t},e.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},e.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},e.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},e.prototype.isNeg=function(){return 0!==this.negative},e.prototype.neg=function(){return this.clone().ineg()},e.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},e.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},e.prototype.ior=function(t){return n(!(this.negative|t.negative)),this.iuor(t)},e.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},e.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},e.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;r<i.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=i.length,this.strip()},e.prototype.iand=function(t){return n(!(this.negative|t.negative)),this.iuand(t)},e.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},e.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},e.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=i.words[n]^r.words[n];if(this!==i)for(;n<i.length;n++)this.words[n]=i.words[n];return this.length=i.length,this.strip()},e.prototype.ixor=function(t){return n(!(this.negative|t.negative)),this.iuxor(t)},e.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},e.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},e.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),r=t%26;this._expand(i),r>0&&i--;for(var h=0;h<i;h++)this.words[h]=67108863&~this.words[h];return r>0&&(this.words[h]=~this.words[h]&67108863>>26-r),this.strip()},e.prototype.notn=function(t){return this.clone().inotn(t)},e.prototype.setn=function(t,i){n("number"==typeof t&&t>=0);var r=t/26|0,h=t%26;return this._expand(r+1),this.words[r]=i?this.words[r]|1<<h:this.words[r]&~(1<<h),this.strip()},e.prototype.iadd=function(t){var i,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var h=0,e=0;e<n.length;e++)i=(0|r.words[e])+(0|n.words[e])+h,this.words[e]=67108863&i,h=i>>>26;for(;0!==h&&e<r.length;e++)i=(0|r.words[e])+h,this.words[e]=67108863&i,h=i>>>26;if(this.length=r.length,0!==h)this.words[this.length]=h,this.length++;else if(r!==this)for(;e<r.length;e++)this.words[e]=r.words[e];return this},e.prototype.add=function(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},e.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<n.length;o++)e=(i=(0|r.words[o])-(0|n.words[o])+e)>>26,this.words[o]=67108863&i;for(;0!==e&&o<r.length;o++)e=(i=(0|r.words[o])+e)>>26,this.words[o]=67108863&i;if(0===e&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},e.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,i,r){var n,h,e,o=t.words,s=i.words,u=r.words,a=0,l=0|o[0],m=8191&l,f=l>>>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,B=0|o[6],R=8191&B,q=B>>>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,C=O>>>13,K=0|s[0],P=8191&K,F=K>>>13,U=0|s[1],D=8191&U,H=U>>>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&lt,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,P))|0)+((8191&(h=(h=Math.imul(m,F))+Math.imul(f,P)|0))<<13)|0;a=((e=Math.imul(f,F))+(h>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,P),h=(h=Math.imul(p,F))+Math.imul(M,P)|0,e=Math.imul(M,F);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,P),h=(h=Math.imul(g,F))+Math.imul(c,P)|0,e=Math.imul(c,F),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,P),h=(h=Math.imul(y,F))+Math.imul(b,P)|0,e=Math.imul(b,F),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,P),h=(h=Math.imul(k,F))+Math.imul(A,P)|0,e=Math.imul(A,F),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(S,P),h=(h=Math.imul(S,F))+Math.imul(Z,P)|0,e=Math.imul(Z,F),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,P),h=(h=Math.imul(R,F))+Math.imul(q,P)|0,e=Math.imul(q,F),n=n+Math.imul(S,D)|0,h=(h=h+Math.imul(S,H)|0)+Math.imul(Z,D)|0,e=e+Math.imul(Z,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(L,P),h=(h=Math.imul(L,F))+Math.imul(I,P)|0,e=Math.imul(I,F),n=n+Math.imul(R,D)|0,h=(h=h+Math.imul(R,H)|0)+Math.imul(q,D)|0,e=e+Math.imul(q,H)|0,n=n+Math.imul(S,G)|0,h=(h=h+Math.imul(S,Q)|0)+Math.imul(Z,G)|0,e=e+Math.imul(Z,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(T,P),h=(h=Math.imul(T,F))+Math.imul(E,P)|0,e=Math.imul(E,F),n=n+Math.imul(L,D)|0,h=(h=h+Math.imul(L,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(q,G)|0,e=e+Math.imul(q,Q)|0,n=n+Math.imul(S,W)|0,h=(h=h+Math.imul(S,X)|0)+Math.imul(Z,W)|0,e=e+Math.imul(Z,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,P),h=(h=Math.imul(j,F))+Math.imul(C,P)|0,e=Math.imul(C,F),n=n+Math.imul(T,D)|0,h=(h=h+Math.imul(T,H)|0)+Math.imul(E,D)|0,e=e+Math.imul(E,H)|0,n=n+Math.imul(L,G)|0,h=(h=h+Math.imul(L,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(q,W)|0,e=e+Math.imul(q,X)|0,n=n+Math.imul(S,$)|0,h=(h=h+Math.imul(S,tt)|0)+Math.imul(Z,$)|0,e=e+Math.imul(Z,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 xt=(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)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,D),h=(h=Math.imul(j,H))+Math.imul(C,D)|0,e=Math.imul(C,H),n=n+Math.imul(T,G)|0,h=(h=h+Math.imul(T,Q)|0)+Math.imul(E,G)|0,e=e+Math.imul(E,Q)|0,n=n+Math.imul(L,W)|0,h=(h=h+Math.imul(L,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(q,$)|0,e=e+Math.imul(q,tt)|0,n=n+Math.imul(S,rt)|0,h=(h=h+Math.imul(S,nt)|0)+Math.imul(Z,rt)|0,e=e+Math.imul(Z,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 St=(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)+(St>>>26)|0,St&=67108863,n=Math.imul(j,G),h=(h=Math.imul(j,Q))+Math.imul(C,G)|0,e=Math.imul(C,Q),n=n+Math.imul(T,W)|0,h=(h=h+Math.imul(T,X)|0)+Math.imul(E,W)|0,e=e+Math.imul(E,X)|0,n=n+Math.imul(L,$)|0,h=(h=h+Math.imul(L,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(q,rt)|0,e=e+Math.imul(q,nt)|0,n=n+Math.imul(S,et)|0,h=(h=h+Math.imul(S,ot)|0)+Math.imul(Z,et)|0,e=e+Math.imul(Z,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 Zt=(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)+(Zt>>>26)|0,Zt&=67108863,n=Math.imul(j,W),h=(h=Math.imul(j,X))+Math.imul(C,W)|0,e=Math.imul(C,X),n=n+Math.imul(T,$)|0,h=(h=h+Math.imul(T,tt)|0)+Math.imul(E,$)|0,e=e+Math.imul(E,tt)|0,n=n+Math.imul(L,rt)|0,h=(h=h+Math.imul(L,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(q,et)|0,e=e+Math.imul(q,ot)|0,n=n+Math.imul(S,ut)|0,h=(h=h+Math.imul(S,at)|0)+Math.imul(Z,ut)|0,e=e+Math.imul(Z,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(C,$)|0,e=Math.imul(C,tt),n=n+Math.imul(T,rt)|0,h=(h=h+Math.imul(T,nt)|0)+Math.imul(E,rt)|0,e=e+Math.imul(E,nt)|0,n=n+Math.imul(L,et)|0,h=(h=h+Math.imul(L,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(q,ut)|0,e=e+Math.imul(q,at)|0,n=n+Math.imul(S,mt)|0,h=(h=h+Math.imul(S,ft)|0)+Math.imul(Z,mt)|0,e=e+Math.imul(Z,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(C,rt)|0,e=Math.imul(C,nt),n=n+Math.imul(T,et)|0,h=(h=h+Math.imul(T,ot)|0)+Math.imul(E,et)|0,e=e+Math.imul(E,ot)|0,n=n+Math.imul(L,ut)|0,h=(h=h+Math.imul(L,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(q,mt)|0,e=e+Math.imul(q,ft)|0;var qt=(a+(n=n+Math.imul(S,pt)|0)|0)+((8191&(h=(h=h+Math.imul(S,Mt)|0)+Math.imul(Z,pt)|0))<<13)|0;a=((e=e+Math.imul(Z,Mt)|0)+(h>>>13)|0)+(qt>>>26)|0,qt&=67108863,n=Math.imul(j,et),h=(h=Math.imul(j,ot))+Math.imul(C,et)|0,e=Math.imul(C,ot),n=n+Math.imul(T,ut)|0,h=(h=h+Math.imul(T,at)|0)+Math.imul(E,ut)|0,e=e+Math.imul(E,at)|0,n=n+Math.imul(L,mt)|0,h=(h=h+Math.imul(L,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Nt=(a+(n=n+Math.imul(R,pt)|0)|0)+((8191&(h=(h=h+Math.imul(R,Mt)|0)+Math.imul(q,pt)|0))<<13)|0;a=((e=e+Math.imul(q,Mt)|0)+(h>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(j,ut),h=(h=Math.imul(j,at))+Math.imul(C,ut)|0,e=Math.imul(C,at),n=n+Math.imul(T,mt)|0,h=(h=h+Math.imul(T,ft)|0)+Math.imul(E,mt)|0,e=e+Math.imul(E,ft)|0;var Lt=(a+(n=n+Math.imul(L,pt)|0)|0)+((8191&(h=(h=h+Math.imul(L,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(h>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,mt),h=(h=Math.imul(j,ft))+Math.imul(C,mt)|0,e=Math.imul(C,ft);var It=(a+(n=n+Math.imul(T,pt)|0)|0)+((8191&(h=(h=h+Math.imul(T,Mt)|0)+Math.imul(E,pt)|0))<<13)|0;a=((e=e+Math.imul(E,Mt)|0)+(h>>>13)|0)+(It>>>26)|0,It&=67108863;var zt=(a+(n=Math.imul(j,pt))|0)+((8191&(h=(h=Math.imul(j,Mt))+Math.imul(C,pt)|0))<<13)|0;return a=((e=Math.imul(C,Mt))+(h>>>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]=Bt,u[13]=Rt,u[14]=qt,u[15]=Nt,u[16]=Lt,u[17]=It,u[18]=zt,0!==a&&(u[19]=a,r.length++),r};function M(t,i,r){return(new v).mulp(t,i,r)}function v(t,i){this.x=t,this.y=i}Math.imul||(p=d),e.prototype.mulTo=function(t,i){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,i):n<63?d(this,t,i):n<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var n=0,h=0,e=0;e<r.length-1;e++){var o=h;h=0;for(var s=67108863&n,u=Math.min(e,i.length-1),a=Math.max(0,e-t.length+1);a<=u;a++){var l=e-a,m=(0|t.words[l])*(0|i.words[a]),f=67108863&m;s=67108863&(f=f+s|0),h+=(o=(o=o+(m/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[e]=s,n=o,o=h}return 0!==n?r.words[e]=n:r.length--,r.strip()}(this,t,i):M(this,t,i),r},v.prototype.makeRBT=function(t){for(var i=new Array(t),r=e.prototype._countBits(t)-1,n=0;n<t;n++)i[n]=this.revBin(n,r,t);return i},v.prototype.revBin=function(t,i,r){if(0===t||t===r-1)return t;for(var n=0,h=0;h<i;h++)n|=(1&t)<<i-h-1,t>>=1;return n},v.prototype.permute=function(t,i,r,n,h,e){for(var o=0;o<e;o++)n[o]=i[t[o]],h[o]=r[t[o]]},v.prototype.transform=function(t,i,r,n,h,e){this.permute(e,t,i,r,n,h);for(var o=1;o<h;o<<=1)for(var s=o<<1,u=Math.cos(2*Math.PI/s),a=Math.sin(2*Math.PI/s),l=0;l<h;l+=s)for(var m=u,f=a,d=0;d<o;d++){var p=r[l+d],M=n[l+d],v=r[l+d+o],g=n[l+d+o],c=m*v-f*g;g=m*g+f*v,v=c,r[l+d]=p+v,n[l+d]=M+g,r[l+d+o]=p-v,n[l+d+o]=M-g,d!==s&&(c=u*m-a*f,f=u*f+a*m,m=c)}},v.prototype.guessLen13b=function(t,i){var r=1|Math.max(i,t),n=1&r,h=0;for(r=r/2|0;r;r>>>=1)h++;return 1<<h+1+n},v.prototype.conjugate=function(t,i,r){if(!(r<=1))for(var n=0;n<r/2;n++){var h=t[n];t[n]=t[r-n-1],t[r-n-1]=h,h=i[n],i[n]=-i[r-n-1],i[r-n-1]=-h}},v.prototype.normalize13b=function(t,i){for(var r=0,n=0;n<i/2;n++){var h=8192*Math.round(t[2*n+1]/i)+Math.round(t[2*n]/i)+r;t[n]=67108863&h,r=h<67108864?0:h/67108864|0}return t},v.prototype.convert13b=function(t,i,r,h){for(var e=0,o=0;o<i;o++)e+=0|t[o],r[2*o]=8191&e,e>>>=13,r[2*o+1]=8191&e,e>>>=13;for(o=2*i;o<h;++o)r[o]=0;n(0===e),n(!(-8192&e))},v.prototype.stub=function(t){for(var i=new Array(t),r=0;r<t;r++)i[r]=0;return i},v.prototype.mulp=function(t,i,r){var n=2*this.guessLen13b(t.length,i.length),h=this.makeRBT(n),e=this.stub(n),o=new Array(n),s=new Array(n),u=new Array(n),a=new Array(n),l=new Array(n),m=new Array(n),f=r.words;f.length=n,this.convert13b(t.words,t.length,o,n),this.convert13b(i.words,i.length,a,n),this.transform(o,e,s,u,n,h),this.transform(a,e,l,m,n,h);for(var d=0;d<n;d++){var p=s[d]*l[d]-u[d]*m[d];u[d]=s[d]*m[d]+u[d]*l[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,f,e,n,h),this.conjugate(f,e,n),this.normalize13b(f,n),r.negative=t.negative^i.negative,r.length=t.length+i.length,r.strip()},e.prototype.mul=function(t){var i=new e(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},e.prototype.mulf=function(t){var i=new e(null);return i.words=new Array(this.length+t.length),M(this,t,i)},e.prototype.imul=function(t){return this.clone().mulTo(t,this)},e.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var i=0,r=0;r<this.length;r++){var h=(0|this.words[r])*t,e=(67108863&h)+(67108863&i);i>>=26,i+=h/67108864|0,i+=e>>>26,this.words[r]=67108863&e}return 0!==i&&(this.words[r]=i,this.length++),this},e.prototype.muln=function(t){return this.clone().imuln(t)},e.prototype.sqr=function(){return this.mul(this)},e.prototype.isqr=function(){return this.imul(this.clone())},e.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r<i.length;r++){var n=r/26|0,h=r%26;i[r]=(t.words[n]&1<<h)>>>h}return i}(t);if(0===i.length)return new e(1);for(var r=this,n=0;n<i.length&&0===i[n];n++,r=r.sqr());if(++n<i.length)for(var h=r.sqr();n<i.length;n++,h=h.sqr())0!==i[n]&&(r=r.mul(h));return r},e.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var i,r=t%26,h=(t-r)/26,e=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(i=0;i<this.length;i++){var s=this.words[i]&e,u=(0|this.words[i])-s<<r;this.words[i]=u|o,o=s>>>26-r}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<h;i++)this.words[i]=0;this.length+=h}return this.strip()},e.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},e.prototype.iushrn=function(t,i,r){var h;n("number"==typeof t&&t>=0),h=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<<e,u=r;if(h-=o,h=Math.max(0,h),u){for(var a=0;a<o;a++)u.words[a]=this.words[a];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,a=0;a<this.length;a++)this.words[a]=this.words[a+o];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;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()},e.prototype.ishrn=function(t,i,r){return n(0===this.negative),this.iushrn(t,i,r)},e.prototype.shln=function(t){return this.clone().ishln(t)},e.prototype.ushln=function(t){return this.clone().iushln(t)},e.prototype.shrn=function(t){return this.clone().ishrn(t)},e.prototype.ushrn=function(t){return this.clone().iushrn(t)},e.prototype.testn=function(t){n("number"==typeof t&&t>=0);var i=t%26,r=(t-i)/26,h=1<<i;return!(this.length<=r||!(this.words[r]&h))},e.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var i=t%26,r=(t-i)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==i&&r++,this.length=Math.min(r,this.length),0!==i){var h=67108863^67108863>>>i<<i;this.words[this.length-1]&=h}return this.strip()},e.prototype.maskn=function(t){return this.clone().imaskn(t)},e.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},e.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[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},e.prototype.isubn=function(t){if(n("number"==typeof t),n(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<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},e.prototype.addn=function(t){return this.clone().iaddn(t)},e.prototype.subn=function(t){return this.clone().isubn(t)},e.prototype.iabs=function(){return this.negative=0,this},e.prototype.abs=function(){return this.clone().iabs()},e.prototype._ishlnsubmul=function(t,i,r){var h,e,o=t.length+r;this._expand(o);var s=0;for(h=0;h<t.length;h++){e=(0|this.words[h+r])+s;var u=(0|t.words[h])*i;s=((e-=67108863&u)>>26)-(u/67108864|0),this.words[h+r]=67108863&e}for(;h<this.length-r;h++)s=(e=(0|this.words[h+r])+s)>>26,this.words[h+r]=67108863&e;if(0===s)return this.strip();for(n(-1===s),s=0,h=0;h<this.length;h++)s=(e=-(0|this.words[h])+s)>>26,this.words[h]=67108863&e;return this.negative=1,this.strip()},e.prototype._wordDiv=function(t,i){var r=(this.length,t.length),n=this.clone(),h=t,o=0|h.words[h.length-1];0!=(r=26-this._countBits(o))&&(h=h.ushln(r),n.iushln(r),o=0|h.words[h.length-1]);var s,u=n.length-h.length;if("mod"!==i){(s=new e(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a<s.length;a++)s.words[a]=0}var l=n.clone()._ishlnsubmul(h,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var m=u-1;m>=0;m--){var f=67108864*(0|n.words[h.length+m])+(0|n.words[h.length+m-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(h,f,m);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(h,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}},e.prototype.divmod=function(t,i,r){return n(!t.isZero()),this.isZero()?{div:new e(0),mod:new e(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(h=s.div.neg()),"div"!==i&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:h,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(h=s.div.neg()),{div:h,mod:s.mod}):this.negative&t.negative?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new e(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new e(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new e(this.modn(t.words[0]))}:this._wordDiv(t,i);var h,o,s},e.prototype.div=function(t){return this.divmod(t,"div",!1).div},e.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},e.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},e.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)},e.prototype.modn=function(t){n(t<=67108863);for(var i=(1<<26)%t,r=0,h=this.length-1;h>=0;h--)r=(i*r+(0|this.words[h]))%t;return r},e.prototype.idivn=function(t){n(t<=67108863);for(var i=0,r=this.length-1;r>=0;r--){var h=(0|this.words[r])+67108864*i;this.words[r]=h/t|0,i=h%t}return this.strip()},e.prototype.divn=function(t){return this.clone().idivn(t)},e.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var i=this,r=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var h=new e(1),o=new e(0),s=new e(0),u=new e(1),a=0;i.isEven()&&r.isEven();)i.iushrn(1),r.iushrn(1),++a;for(var l=r.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;!(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(h.isOdd()||o.isOdd())&&(h.iadd(l),o.isub(m)),h.iushrn(1),o.iushrn(1);for(var p=0,M=1;!(r.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(r)>=0?(i.isub(r),h.isub(s),o.isub(u)):(r.isub(i),s.isub(h),u.isub(o))}return{a:s,b:u,gcd:r.iushln(a)}},e.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var i=this,r=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var h,o=new e(1),s=new e(0),u=r.clone();i.cmpn(1)>0&&r.cmpn(1)>0;){for(var a=0,l=1;!(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;!(r.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(r.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(r)>=0?(i.isub(r),o.isub(s)):(r.isub(i),s.isub(o))}return(h=0===i.cmpn(1)?o:s).cmpn(0)<0&&h.iadd(t),h},e.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)},e.prototype.invm=function(t){return this.egcd(t).a.umod(t)},e.prototype.isEven=function(){return!(1&this.words[0])},e.prototype.isOdd=function(){return!(1&~this.words[0])},e.prototype.andln=function(t){return this.words[0]&t},e.prototype.bincn=function(t){n("number"==typeof t);var i=t%26,r=(t-i)/26,h=1<<i;if(this.length<=r)return this._expand(r+1),this.words[r]|=h,this;for(var e=h,o=r;0!==e&&o<this.length;o++){var s=0|this.words[o];e=(s+=e)>>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},e.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},e.prototype.cmpn=function(t){var i,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)i=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var h=0|this.words[0];i=h===t?0:h<t?-1:1}return 0!==this.negative?0|-i:i},e.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},e.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],h=0|t.words[r];if(n!==h){n<h?i=-1:n>h&&(i=1);break}}return i},e.prototype.gtn=function(t){return 1===this.cmpn(t)},e.prototype.gt=function(t){return 1===this.cmp(t)},e.prototype.gten=function(t){return this.cmpn(t)>=0},e.prototype.gte=function(t){return this.cmp(t)>=0},e.prototype.ltn=function(t){return-1===this.cmpn(t)},e.prototype.lt=function(t){return-1===this.cmp(t)},e.prototype.lten=function(t){return this.cmpn(t)<=0},e.prototype.lte=function(t){return this.cmp(t)<=0},e.prototype.eqn=function(t){return 0===this.cmpn(t)},e.prototype.eq=function(t){return 0===this.cmp(t)},e.red=function(t){return new k(t)},e.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},e.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},e.prototype._forceRed=function(t){return this.red=t,this},e.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},e.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},e.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},e.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},e.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},e.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},e.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},e.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},e.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},e.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},e.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},e.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},e.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},e.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function c(t,i){this.name=t,this.p=new e(i,16),this.n=this.p.bitLength(),this.k=new e(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){c.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){c.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){c.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){c.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var i=e._prime(t);this.m=i.p,this.prime=i}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new e(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)}c.prototype._tmp=function(){var t=new e(null);return t.words=new Array(Math.ceil(this.n/13)),t},c.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=i<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},c.prototype.split=function(t,i){t.iushrn(this.n,0,i)},c.prototype.imulK=function(t){return t.imul(this.k)},h(w,c),w.prototype.split=function(t,i){for(var r=4194303,n=Math.min(t.length,9),h=0;h<n;h++)i.words[h]=t.words[h];if(i.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var e=t.words[9];for(i.words[i.length++]=e&r,h=10;h<t.length;h++){var o=0|t.words[h];t.words[h-10]=(o&r)<<4|e>>>22,e=o}e>>>=22,t.words[h-10]=e,0===e&&t.length>10?t.length-=10:t.length-=9},w.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<t.length;r++){var n=0|t.words[r];i+=977*n,t.words[r]=67108863&i,i=64*n+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},h(y,c),h(b,c),h(_,c),_.prototype.imulK=function(t){for(var i=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+i,h=67108863&n;n>>>=26,t.words[r]=h,i=n}return 0!==i&&(t.words[t.length++]=i),t},e._prime=function(t){if(g[t])return g[t];var i;if("k256"===t)i=new w;else if("p224"===t)i=new y;else if("p192"===t)i=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new _}return g[t]=i,i},k.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,i){n(!(t.negative|i.negative),"red works only with positives"),n(t.red&&t.red===i.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.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)},k.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},k.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)},k.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},k.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},k.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(n(i%2==1),3===i){var r=this.m.add(new e(1)).iushrn(2);return this.pow(t,r)}for(var h=this.m.subn(1),o=0;!h.isZero()&&0===h.andln(1);)o++,h.iushrn(1);n(!h.isZero());var s=new e(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new e(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,h),f=this.pow(t,h.addn(1).iushrn(1)),d=this.pow(t,h),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();n(v<p);var g=this.pow(m,new e(1).iushln(p-v-1));f=f.redMul(g),m=g.redSqr(),d=d.redMul(m),p=v}return f},k.prototype.invm=function(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},k.prototype.pow=function(t,i){if(i.isZero())return new e(1).toRed(this);if(0===i.cmpn(1))return t.clone();var r=new Array(16);r[0]=new e(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var h=r[0],o=0,s=0,u=i.bitLength()%26;for(0===u&&(u=26),n=i.length-1;n>=0;n--){for(var a=i.words[n],l=u-1;l>=0;l--){var m=a>>l&1;h!==r[0]&&(h=this.sqr(h)),0!==m||0!==o?(o<<=1,o|=m,(4==++s||0===n&&0===l)&&(h=this.mul(h,r[o]),s=0,o=0)):s=0}u=26}return h},k.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},k.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},e.mont=function(t){return new A(t)},h(A,k),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},A.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)},A.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new e(0)._forceRed(this);var r=t.mul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=r.isub(n).iushrn(this.shift),o=h;return h.cmp(this.m)>=0?o=h.isub(this.m):h.cmpn(0)<0&&(o=h.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)}}]);
@@ -1 +1 @@
1
- "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[26],{370(f,e,r){var t=r(8490),d=r(6698),i=r(6677),n=r(7011);function s(f){i.call(this,"mont",f),this.a=new t(f.a,16).toRed(this.red),this.b=new t(f.b,16).toRed(this.red),this.i4=new t(4).toRed(this.red).redInvm(),this.two=new t(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(f,e,r){i.BasePoint.call(this,f,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new t(e,16),this.z=new t(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}d(s,i),f.exports=s,s.prototype.validate=function(f){var e=f.normalize().x,r=e.redSqr(),t=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===t.redSqrt().redSqr().cmp(t)},d(u,i.BasePoint),s.prototype.decodePoint=function(f,e){return this.point(n.toArray(f,e),1)},s.prototype.point=function(f,e){return new u(this,f,e)},s.prototype.pointFromJSON=function(f){return u.fromJSON(this,f)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(f,e){return new u(f,e[0],e[1]||f.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var f=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=f.redSub(e),t=f.redMul(e),d=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(t,d)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(f,e){var r=this.x.redAdd(this.z),t=this.x.redSub(this.z),d=f.x.redAdd(f.z),i=f.x.redSub(f.z).redMul(r),n=d.redMul(t),s=e.z.redMul(i.redAdd(n).redSqr()),u=e.x.redMul(i.redISub(n).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(f){for(var e=f.clone(),r=this,t=this.curve.point(null,null),d=[];0!==e.cmpn(0);e.iushrn(1))d.push(e.andln(1));for(var i=d.length-1;i>=0;i--)0===d[i]?(r=r.diffAdd(t,this),t=t.dbl()):(t=r.diffAdd(t,this),r=r.dbl());return t},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(f){return 0===this.getX().cmp(f.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},9188(f,e,r){var t=r(7011),d=r(8490),i=r(6698),n=r(6677),s=t.assert;function u(f){n.call(this,"short",f),this.a=new d(f.a,16).toRed(this.red),this.b=new d(f.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(f),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function o(f,e,r,t){n.BasePoint.call(this,f,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new d(e,16),this.y=new d(r,16),t&&(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 h(f,e,r,t){n.BasePoint.call(this,f,"jacobian"),null===e&&null===r&&null===t?(this.x=this.curve.one,this.y=this.curve.one,this.z=new d(0)):(this.x=new d(e,16),this.y=new d(r,16),this.z=new d(t,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}i(u,n),f.exports=u,u.prototype._getEndomorphism=function(f){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(f.beta)e=new d(f.beta,16).toRed(this.red);else{var t=this._getEndoRoots(this.p);e=(e=t[0].cmp(t[1])<0?t[0]:t[1]).toRed(this.red)}if(f.lambda)r=new d(f.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:f.basis?f.basis.map(function(f){return{a:new d(f.a,16),b:new d(f.b,16)}}):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(f){var e=f===this.p?this.red:d.mont(f),r=new d(2).toRed(e).redInvm(),t=r.redNeg(),i=new d(3).toRed(e).redNeg().redSqrt().redMul(r);return[t.redAdd(i).fromRed(),t.redSub(i).fromRed()]},u.prototype._getEndoBasis=function(f){for(var e,r,t,i,n,s,u,o,h,a=this.n.ushrn(Math.floor(this.n.bitLength()/2)),c=f,p=this.n.clone(),b=new d(1),l=new d(0),v=new d(0),S=new d(1),y=0;0!==c.cmpn(0);){var I=p.div(c);o=p.sub(I.mul(c)),h=v.sub(I.mul(b));var m=S.sub(I.mul(l));if(!t&&o.cmp(a)<0)e=u.neg(),r=b,t=o.neg(),i=h;else if(t&&2===++y)break;u=o,p=c,c=o,v=b,b=h,S=l,l=m}n=o.neg(),s=h;var A=t.sqr().add(i.sqr());return n.sqr().add(s.sqr()).cmp(A)>=0&&(n=e,s=r),t.negative&&(t=t.neg(),i=i.neg()),n.negative&&(n=n.neg(),s=s.neg()),[{a:t,b:i},{a:n,b:s}]},u.prototype._endoSplit=function(f){var e=this.endo.basis,r=e[0],t=e[1],d=t.b.mul(f).divRound(this.n),i=r.b.neg().mul(f).divRound(this.n),n=d.mul(r.a),s=i.mul(t.a),u=d.mul(r.b),o=i.mul(t.b);return{k1:f.sub(n).sub(s),k2:u.add(o).neg()}},u.prototype.pointFromX=function(f,e){(f=new d(f,16)).red||(f=f.toRed(this.red));var r=f.redSqr().redMul(f).redIAdd(f.redMul(this.a)).redIAdd(this.b),t=r.redSqrt();if(0!==t.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=t.fromRed().isOdd();return(e&&!i||!e&&i)&&(t=t.redNeg()),this.point(f,t)},u.prototype.validate=function(f){if(f.inf)return!0;var e=f.x,r=f.y,t=this.a.redMul(e),d=e.redSqr().redMul(e).redIAdd(t).redIAdd(this.b);return 0===r.redSqr().redISub(d).cmpn(0)},u.prototype._endoWnafMulAdd=function(f,e,r){for(var t=this._endoWnafT1,d=this._endoWnafT2,i=0;i<f.length;i++){var n=this._endoSplit(e[i]),s=f[i],u=s._getBeta();n.k1.negative&&(n.k1.ineg(),s=s.neg(!0)),n.k2.negative&&(n.k2.ineg(),u=u.neg(!0)),t[2*i]=s,t[2*i+1]=u,d[2*i]=n.k1,d[2*i+1]=n.k2}for(var o=this._wnafMulAdd(1,t,d,2*i,r),h=0;h<2*i;h++)t[h]=null,d[h]=null;return o},i(o,n.BasePoint),u.prototype.point=function(f,e,r){return new o(this,f,e,r)},u.prototype.pointFromJSON=function(f,e){return o.fromJSON(this,f,e)},o.prototype._getBeta=function(){if(this.curve.endo){var f=this.precomputed;if(f&&f.beta)return f.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(f){var r=this.curve,t=function(f){return r.point(f.x.redMul(r.endo.beta),f.y)};f.beta=e,e.precomputed={beta:null,naf:f.naf&&{wnd:f.naf.wnd,points:f.naf.points.map(t)},doubles:f.doubles&&{step:f.doubles.step,points:f.doubles.points.map(t)}}}return e}},o.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},o.fromJSON=function(f,e,r){"string"==typeof e&&(e=JSON.parse(e));var t=f.point(e[0],e[1],r);if(!e[2])return t;function d(e){return f.point(e[0],e[1],r)}var i=e[2];return t.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[t].concat(i.doubles.points.map(d))},naf:i.naf&&{wnd:i.naf.wnd,points:[t].concat(i.naf.points.map(d))}},t},o.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},o.prototype.isInfinity=function(){return this.inf},o.prototype.add=function(f){if(this.inf)return f;if(f.inf)return this;if(this.eq(f))return this.dbl();if(this.neg().eq(f))return this.curve.point(null,null);if(0===this.x.cmp(f.x))return this.curve.point(null,null);var e=this.y.redSub(f.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(f.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(f.x),t=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,t)},o.prototype.dbl=function(){if(this.inf)return this;var f=this.y.redAdd(this.y);if(0===f.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),t=f.redInvm(),d=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(t),i=d.redSqr().redISub(this.x.redAdd(this.x)),n=d.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},o.prototype.getX=function(){return this.x.fromRed()},o.prototype.getY=function(){return this.y.fromRed()},o.prototype.mul=function(f){return f=new d(f,16),this.isInfinity()?this:this._hasDoubles(f)?this.curve._fixedNafMul(this,f):this.curve.endo?this.curve._endoWnafMulAdd([this],[f]):this.curve._wnafMul(this,f)},o.prototype.mulAdd=function(f,e,r){var t=[this,e],d=[f,r];return this.curve.endo?this.curve._endoWnafMulAdd(t,d):this.curve._wnafMulAdd(1,t,d,2)},o.prototype.jmulAdd=function(f,e,r){var t=[this,e],d=[f,r];return this.curve.endo?this.curve._endoWnafMulAdd(t,d,!0):this.curve._wnafMulAdd(1,t,d,2,!0)},o.prototype.eq=function(f){return this===f||this.inf===f.inf&&(this.inf||0===this.x.cmp(f.x)&&0===this.y.cmp(f.y))},o.prototype.neg=function(f){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(f&&this.precomputed){var r=this.precomputed,t=function(f){return f.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(t)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(t)}}}return e},o.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},i(h,n.BasePoint),u.prototype.jpoint=function(f,e,r){return new h(this,f,e,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var f=this.z.redInvm(),e=f.redSqr(),r=this.x.redMul(e),t=this.y.redMul(e).redMul(f);return this.curve.point(r,t)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(f){if(this.isInfinity())return f;if(f.isInfinity())return this;var e=f.z.redSqr(),r=this.z.redSqr(),t=this.x.redMul(e),d=f.x.redMul(r),i=this.y.redMul(e.redMul(f.z)),n=f.y.redMul(r.redMul(this.z)),s=t.redSub(d),u=i.redSub(n);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var o=s.redSqr(),h=o.redMul(s),a=t.redMul(o),c=u.redSqr().redIAdd(h).redISub(a).redISub(a),p=u.redMul(a.redISub(c)).redISub(i.redMul(h)),b=this.z.redMul(f.z).redMul(s);return this.curve.jpoint(c,p,b)},h.prototype.mixedAdd=function(f){if(this.isInfinity())return f.toJ();if(f.isInfinity())return this;var e=this.z.redSqr(),r=this.x,t=f.x.redMul(e),d=this.y,i=f.y.redMul(e).redMul(this.z),n=r.redSub(t),s=d.redSub(i);if(0===n.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=n.redSqr(),o=u.redMul(n),h=r.redMul(u),a=s.redSqr().redIAdd(o).redISub(h).redISub(h),c=s.redMul(h.redISub(a)).redISub(d.redMul(o)),p=this.z.redMul(n);return this.curve.jpoint(a,c,p)},h.prototype.dblp=function(f){if(0===f)return this;if(this.isInfinity())return this;if(!f)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<f;e++)r=r.dbl();return r}var t=this.curve.a,d=this.curve.tinv,i=this.x,n=this.y,s=this.z,u=s.redSqr().redSqr(),o=n.redAdd(n);for(e=0;e<f;e++){var h=i.redSqr(),a=o.redSqr(),c=a.redSqr(),p=h.redAdd(h).redIAdd(h).redIAdd(t.redMul(u)),b=i.redMul(a),l=p.redSqr().redISub(b.redAdd(b)),v=b.redISub(l),S=p.redMul(v);S=S.redIAdd(S).redISub(c);var y=o.redMul(s);e+1<f&&(u=u.redMul(c)),i=l,s=y,o=S}return this.curve.jpoint(i,o.redMul(d),s)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var f,e,r;if(this.zOne){var t=this.x.redSqr(),d=this.y.redSqr(),i=d.redSqr(),n=this.x.redAdd(d).redSqr().redISub(t).redISub(i);n=n.redIAdd(n);var s=t.redAdd(t).redIAdd(t),u=s.redSqr().redISub(n).redISub(n),o=i.redIAdd(i);o=(o=o.redIAdd(o)).redIAdd(o),f=u,e=s.redMul(n.redISub(u)).redISub(o),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),a=this.y.redSqr(),c=a.redSqr(),p=this.x.redAdd(a).redSqr().redISub(h).redISub(c);p=p.redIAdd(p);var b=h.redAdd(h).redIAdd(h),l=b.redSqr(),v=c.redIAdd(c);v=(v=v.redIAdd(v)).redIAdd(v),f=l.redISub(p).redISub(p),e=b.redMul(p.redISub(f)).redISub(v),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(f,e,r)},h.prototype._threeDbl=function(){var f,e,r;if(this.zOne){var t=this.x.redSqr(),d=this.y.redSqr(),i=d.redSqr(),n=this.x.redAdd(d).redSqr().redISub(t).redISub(i);n=n.redIAdd(n);var s=t.redAdd(t).redIAdd(t).redIAdd(this.curve.a),u=s.redSqr().redISub(n).redISub(n);f=u;var o=i.redIAdd(i);o=(o=o.redIAdd(o)).redIAdd(o),e=s.redMul(n.redISub(u)).redISub(o),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),a=this.y.redSqr(),c=this.x.redMul(a),p=this.x.redSub(h).redMul(this.x.redAdd(h));p=p.redAdd(p).redIAdd(p);var b=c.redIAdd(c),l=(b=b.redIAdd(b)).redAdd(b);f=p.redSqr().redISub(l),r=this.y.redAdd(this.z).redSqr().redISub(a).redISub(h);var v=a.redSqr();v=(v=(v=v.redIAdd(v)).redIAdd(v)).redIAdd(v),e=p.redMul(b.redISub(f)).redISub(v)}return this.curve.jpoint(f,e,r)},h.prototype._dbl=function(){var f=this.curve.a,e=this.x,r=this.y,t=this.z,d=t.redSqr().redSqr(),i=e.redSqr(),n=r.redSqr(),s=i.redAdd(i).redIAdd(i).redIAdd(f.redMul(d)),u=e.redAdd(e),o=(u=u.redIAdd(u)).redMul(n),h=s.redSqr().redISub(o.redAdd(o)),a=o.redISub(h),c=n.redSqr();c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var p=s.redMul(a).redISub(c),b=r.redAdd(r).redMul(t);return this.curve.jpoint(h,p,b)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var f=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),t=e.redSqr(),d=f.redAdd(f).redIAdd(f),i=d.redSqr(),n=this.x.redAdd(e).redSqr().redISub(f).redISub(t),s=(n=(n=(n=n.redIAdd(n)).redAdd(n).redIAdd(n)).redISub(i)).redSqr(),u=t.redIAdd(t);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var o=d.redIAdd(n).redSqr().redISub(i).redISub(s).redISub(u),h=e.redMul(o);h=(h=h.redIAdd(h)).redIAdd(h);var a=this.x.redMul(s).redISub(h);a=(a=a.redIAdd(a)).redIAdd(a);var c=this.y.redMul(o.redMul(u.redISub(o)).redISub(n.redMul(s)));c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var p=this.z.redAdd(n).redSqr().redISub(r).redISub(s);return this.curve.jpoint(a,c,p)},h.prototype.mul=function(f,e){return f=new d(f,e),this.curve._wnafMul(this,f)},h.prototype.eq=function(f){if("affine"===f.type)return this.eq(f.toJ());if(this===f)return!0;var e=this.z.redSqr(),r=f.z.redSqr();if(0!==this.x.redMul(r).redISub(f.x.redMul(e)).cmpn(0))return!1;var t=e.redMul(this.z),d=r.redMul(f.z);return 0===this.y.redMul(d).redISub(f.y.redMul(t)).cmpn(0)},h.prototype.eqXToP=function(f){var e=this.z.redSqr(),r=f.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var t=f.clone(),d=this.curve.redN.redMul(e);;){if(t.iadd(this.curve.n),t.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(d),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},480(f,e,r){var t,d=e,i=r(7952),n=r(894),s=r(7011).assert;function u(f){"short"===f.type?this.curve=new n.short(f):"edwards"===f.type?this.curve=new n.edwards(f):this.curve=new n.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(f,e){Object.defineProperty(d,f,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(d,f,{configurable:!0,enumerable:!0,value:r}),r}})}d.PresetCurve=u,o("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:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("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:i.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"]}),o("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:i.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"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),o("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:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=r(4011)}catch(f){t=void 0}o("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:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}}]);
1
+ "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[26],{370:(f,e,r)=>{var t=r(8490),d=r(6698),i=r(6677),n=r(7011);function s(f){i.call(this,"mont",f),this.a=new t(f.a,16).toRed(this.red),this.b=new t(f.b,16).toRed(this.red),this.i4=new t(4).toRed(this.red).redInvm(),this.two=new t(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(f,e,r){i.BasePoint.call(this,f,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new t(e,16),this.z=new t(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}d(s,i),f.exports=s,s.prototype.validate=function(f){var e=f.normalize().x,r=e.redSqr(),t=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===t.redSqrt().redSqr().cmp(t)},d(u,i.BasePoint),s.prototype.decodePoint=function(f,e){return this.point(n.toArray(f,e),1)},s.prototype.point=function(f,e){return new u(this,f,e)},s.prototype.pointFromJSON=function(f){return u.fromJSON(this,f)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(f,e){return new u(f,e[0],e[1]||f.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var f=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=f.redSub(e),t=f.redMul(e),d=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(t,d)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(f,e){var r=this.x.redAdd(this.z),t=this.x.redSub(this.z),d=f.x.redAdd(f.z),i=f.x.redSub(f.z).redMul(r),n=d.redMul(t),s=e.z.redMul(i.redAdd(n).redSqr()),u=e.x.redMul(i.redISub(n).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(f){for(var e=f.clone(),r=this,t=this.curve.point(null,null),d=[];0!==e.cmpn(0);e.iushrn(1))d.push(e.andln(1));for(var i=d.length-1;i>=0;i--)0===d[i]?(r=r.diffAdd(t,this),t=t.dbl()):(t=r.diffAdd(t,this),r=r.dbl());return t},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(f){return 0===this.getX().cmp(f.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},9188:(f,e,r)=>{var t=r(7011),d=r(8490),i=r(6698),n=r(6677),s=t.assert;function u(f){n.call(this,"short",f),this.a=new d(f.a,16).toRed(this.red),this.b=new d(f.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(f),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function o(f,e,r,t){n.BasePoint.call(this,f,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new d(e,16),this.y=new d(r,16),t&&(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 h(f,e,r,t){n.BasePoint.call(this,f,"jacobian"),null===e&&null===r&&null===t?(this.x=this.curve.one,this.y=this.curve.one,this.z=new d(0)):(this.x=new d(e,16),this.y=new d(r,16),this.z=new d(t,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}i(u,n),f.exports=u,u.prototype._getEndomorphism=function(f){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(f.beta)e=new d(f.beta,16).toRed(this.red);else{var t=this._getEndoRoots(this.p);e=(e=t[0].cmp(t[1])<0?t[0]:t[1]).toRed(this.red)}if(f.lambda)r=new d(f.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:f.basis?f.basis.map((function(f){return{a:new d(f.a,16),b:new d(f.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(f){var e=f===this.p?this.red:d.mont(f),r=new d(2).toRed(e).redInvm(),t=r.redNeg(),i=new d(3).toRed(e).redNeg().redSqrt().redMul(r);return[t.redAdd(i).fromRed(),t.redSub(i).fromRed()]},u.prototype._getEndoBasis=function(f){for(var e,r,t,i,n,s,u,o,h,a=this.n.ushrn(Math.floor(this.n.bitLength()/2)),c=f,p=this.n.clone(),b=new d(1),l=new d(0),v=new d(0),S=new d(1),y=0;0!==c.cmpn(0);){var I=p.div(c);o=p.sub(I.mul(c)),h=v.sub(I.mul(b));var m=S.sub(I.mul(l));if(!t&&o.cmp(a)<0)e=u.neg(),r=b,t=o.neg(),i=h;else if(t&&2==++y)break;u=o,p=c,c=o,v=b,b=h,S=l,l=m}n=o.neg(),s=h;var A=t.sqr().add(i.sqr());return n.sqr().add(s.sqr()).cmp(A)>=0&&(n=e,s=r),t.negative&&(t=t.neg(),i=i.neg()),n.negative&&(n=n.neg(),s=s.neg()),[{a:t,b:i},{a:n,b:s}]},u.prototype._endoSplit=function(f){var e=this.endo.basis,r=e[0],t=e[1],d=t.b.mul(f).divRound(this.n),i=r.b.neg().mul(f).divRound(this.n),n=d.mul(r.a),s=i.mul(t.a),u=d.mul(r.b),o=i.mul(t.b);return{k1:f.sub(n).sub(s),k2:u.add(o).neg()}},u.prototype.pointFromX=function(f,e){(f=new d(f,16)).red||(f=f.toRed(this.red));var r=f.redSqr().redMul(f).redIAdd(f.redMul(this.a)).redIAdd(this.b),t=r.redSqrt();if(0!==t.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=t.fromRed().isOdd();return(e&&!i||!e&&i)&&(t=t.redNeg()),this.point(f,t)},u.prototype.validate=function(f){if(f.inf)return!0;var e=f.x,r=f.y,t=this.a.redMul(e),d=e.redSqr().redMul(e).redIAdd(t).redIAdd(this.b);return 0===r.redSqr().redISub(d).cmpn(0)},u.prototype._endoWnafMulAdd=function(f,e,r){for(var t=this._endoWnafT1,d=this._endoWnafT2,i=0;i<f.length;i++){var n=this._endoSplit(e[i]),s=f[i],u=s._getBeta();n.k1.negative&&(n.k1.ineg(),s=s.neg(!0)),n.k2.negative&&(n.k2.ineg(),u=u.neg(!0)),t[2*i]=s,t[2*i+1]=u,d[2*i]=n.k1,d[2*i+1]=n.k2}for(var o=this._wnafMulAdd(1,t,d,2*i,r),h=0;h<2*i;h++)t[h]=null,d[h]=null;return o},i(o,n.BasePoint),u.prototype.point=function(f,e,r){return new o(this,f,e,r)},u.prototype.pointFromJSON=function(f,e){return o.fromJSON(this,f,e)},o.prototype._getBeta=function(){if(this.curve.endo){var f=this.precomputed;if(f&&f.beta)return f.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(f){var r=this.curve,t=function(f){return r.point(f.x.redMul(r.endo.beta),f.y)};f.beta=e,e.precomputed={beta:null,naf:f.naf&&{wnd:f.naf.wnd,points:f.naf.points.map(t)},doubles:f.doubles&&{step:f.doubles.step,points:f.doubles.points.map(t)}}}return e}},o.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},o.fromJSON=function(f,e,r){"string"==typeof e&&(e=JSON.parse(e));var t=f.point(e[0],e[1],r);if(!e[2])return t;function d(e){return f.point(e[0],e[1],r)}var i=e[2];return t.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[t].concat(i.doubles.points.map(d))},naf:i.naf&&{wnd:i.naf.wnd,points:[t].concat(i.naf.points.map(d))}},t},o.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},o.prototype.isInfinity=function(){return this.inf},o.prototype.add=function(f){if(this.inf)return f;if(f.inf)return this;if(this.eq(f))return this.dbl();if(this.neg().eq(f))return this.curve.point(null,null);if(0===this.x.cmp(f.x))return this.curve.point(null,null);var e=this.y.redSub(f.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(f.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(f.x),t=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,t)},o.prototype.dbl=function(){if(this.inf)return this;var f=this.y.redAdd(this.y);if(0===f.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),t=f.redInvm(),d=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(t),i=d.redSqr().redISub(this.x.redAdd(this.x)),n=d.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},o.prototype.getX=function(){return this.x.fromRed()},o.prototype.getY=function(){return this.y.fromRed()},o.prototype.mul=function(f){return f=new d(f,16),this.isInfinity()?this:this._hasDoubles(f)?this.curve._fixedNafMul(this,f):this.curve.endo?this.curve._endoWnafMulAdd([this],[f]):this.curve._wnafMul(this,f)},o.prototype.mulAdd=function(f,e,r){var t=[this,e],d=[f,r];return this.curve.endo?this.curve._endoWnafMulAdd(t,d):this.curve._wnafMulAdd(1,t,d,2)},o.prototype.jmulAdd=function(f,e,r){var t=[this,e],d=[f,r];return this.curve.endo?this.curve._endoWnafMulAdd(t,d,!0):this.curve._wnafMulAdd(1,t,d,2,!0)},o.prototype.eq=function(f){return this===f||this.inf===f.inf&&(this.inf||0===this.x.cmp(f.x)&&0===this.y.cmp(f.y))},o.prototype.neg=function(f){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(f&&this.precomputed){var r=this.precomputed,t=function(f){return f.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(t)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(t)}}}return e},o.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},i(h,n.BasePoint),u.prototype.jpoint=function(f,e,r){return new h(this,f,e,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var f=this.z.redInvm(),e=f.redSqr(),r=this.x.redMul(e),t=this.y.redMul(e).redMul(f);return this.curve.point(r,t)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(f){if(this.isInfinity())return f;if(f.isInfinity())return this;var e=f.z.redSqr(),r=this.z.redSqr(),t=this.x.redMul(e),d=f.x.redMul(r),i=this.y.redMul(e.redMul(f.z)),n=f.y.redMul(r.redMul(this.z)),s=t.redSub(d),u=i.redSub(n);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var o=s.redSqr(),h=o.redMul(s),a=t.redMul(o),c=u.redSqr().redIAdd(h).redISub(a).redISub(a),p=u.redMul(a.redISub(c)).redISub(i.redMul(h)),b=this.z.redMul(f.z).redMul(s);return this.curve.jpoint(c,p,b)},h.prototype.mixedAdd=function(f){if(this.isInfinity())return f.toJ();if(f.isInfinity())return this;var e=this.z.redSqr(),r=this.x,t=f.x.redMul(e),d=this.y,i=f.y.redMul(e).redMul(this.z),n=r.redSub(t),s=d.redSub(i);if(0===n.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=n.redSqr(),o=u.redMul(n),h=r.redMul(u),a=s.redSqr().redIAdd(o).redISub(h).redISub(h),c=s.redMul(h.redISub(a)).redISub(d.redMul(o)),p=this.z.redMul(n);return this.curve.jpoint(a,c,p)},h.prototype.dblp=function(f){if(0===f)return this;if(this.isInfinity())return this;if(!f)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<f;e++)r=r.dbl();return r}var t=this.curve.a,d=this.curve.tinv,i=this.x,n=this.y,s=this.z,u=s.redSqr().redSqr(),o=n.redAdd(n);for(e=0;e<f;e++){var h=i.redSqr(),a=o.redSqr(),c=a.redSqr(),p=h.redAdd(h).redIAdd(h).redIAdd(t.redMul(u)),b=i.redMul(a),l=p.redSqr().redISub(b.redAdd(b)),v=b.redISub(l),S=p.redMul(v);S=S.redIAdd(S).redISub(c);var y=o.redMul(s);e+1<f&&(u=u.redMul(c)),i=l,s=y,o=S}return this.curve.jpoint(i,o.redMul(d),s)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var f,e,r;if(this.zOne){var t=this.x.redSqr(),d=this.y.redSqr(),i=d.redSqr(),n=this.x.redAdd(d).redSqr().redISub(t).redISub(i);n=n.redIAdd(n);var s=t.redAdd(t).redIAdd(t),u=s.redSqr().redISub(n).redISub(n),o=i.redIAdd(i);o=(o=o.redIAdd(o)).redIAdd(o),f=u,e=s.redMul(n.redISub(u)).redISub(o),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),a=this.y.redSqr(),c=a.redSqr(),p=this.x.redAdd(a).redSqr().redISub(h).redISub(c);p=p.redIAdd(p);var b=h.redAdd(h).redIAdd(h),l=b.redSqr(),v=c.redIAdd(c);v=(v=v.redIAdd(v)).redIAdd(v),f=l.redISub(p).redISub(p),e=b.redMul(p.redISub(f)).redISub(v),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(f,e,r)},h.prototype._threeDbl=function(){var f,e,r;if(this.zOne){var t=this.x.redSqr(),d=this.y.redSqr(),i=d.redSqr(),n=this.x.redAdd(d).redSqr().redISub(t).redISub(i);n=n.redIAdd(n);var s=t.redAdd(t).redIAdd(t).redIAdd(this.curve.a),u=s.redSqr().redISub(n).redISub(n);f=u;var o=i.redIAdd(i);o=(o=o.redIAdd(o)).redIAdd(o),e=s.redMul(n.redISub(u)).redISub(o),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),a=this.y.redSqr(),c=this.x.redMul(a),p=this.x.redSub(h).redMul(this.x.redAdd(h));p=p.redAdd(p).redIAdd(p);var b=c.redIAdd(c),l=(b=b.redIAdd(b)).redAdd(b);f=p.redSqr().redISub(l),r=this.y.redAdd(this.z).redSqr().redISub(a).redISub(h);var v=a.redSqr();v=(v=(v=v.redIAdd(v)).redIAdd(v)).redIAdd(v),e=p.redMul(b.redISub(f)).redISub(v)}return this.curve.jpoint(f,e,r)},h.prototype._dbl=function(){var f=this.curve.a,e=this.x,r=this.y,t=this.z,d=t.redSqr().redSqr(),i=e.redSqr(),n=r.redSqr(),s=i.redAdd(i).redIAdd(i).redIAdd(f.redMul(d)),u=e.redAdd(e),o=(u=u.redIAdd(u)).redMul(n),h=s.redSqr().redISub(o.redAdd(o)),a=o.redISub(h),c=n.redSqr();c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var p=s.redMul(a).redISub(c),b=r.redAdd(r).redMul(t);return this.curve.jpoint(h,p,b)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var f=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),t=e.redSqr(),d=f.redAdd(f).redIAdd(f),i=d.redSqr(),n=this.x.redAdd(e).redSqr().redISub(f).redISub(t),s=(n=(n=(n=n.redIAdd(n)).redAdd(n).redIAdd(n)).redISub(i)).redSqr(),u=t.redIAdd(t);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var o=d.redIAdd(n).redSqr().redISub(i).redISub(s).redISub(u),h=e.redMul(o);h=(h=h.redIAdd(h)).redIAdd(h);var a=this.x.redMul(s).redISub(h);a=(a=a.redIAdd(a)).redIAdd(a);var c=this.y.redMul(o.redMul(u.redISub(o)).redISub(n.redMul(s)));c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var p=this.z.redAdd(n).redSqr().redISub(r).redISub(s);return this.curve.jpoint(a,c,p)},h.prototype.mul=function(f,e){return f=new d(f,e),this.curve._wnafMul(this,f)},h.prototype.eq=function(f){if("affine"===f.type)return this.eq(f.toJ());if(this===f)return!0;var e=this.z.redSqr(),r=f.z.redSqr();if(0!==this.x.redMul(r).redISub(f.x.redMul(e)).cmpn(0))return!1;var t=e.redMul(this.z),d=r.redMul(f.z);return 0===this.y.redMul(d).redISub(f.y.redMul(t)).cmpn(0)},h.prototype.eqXToP=function(f){var e=this.z.redSqr(),r=f.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var t=f.clone(),d=this.curve.redN.redMul(e);;){if(t.iadd(this.curve.n),t.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(d),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},480:(f,e,r)=>{var t,d=e,i=r(7952),n=r(894),s=r(7011).assert;function u(f){"short"===f.type?this.curve=new n.short(f):"edwards"===f.type?this.curve=new n.edwards(f):this.curve=new n.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(f,e){Object.defineProperty(d,f,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(d,f,{configurable:!0,enumerable:!0,value:r}),r}})}d.PresetCurve=u,o("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:i.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:i.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:i.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("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:i.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"]}),o("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:i.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"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:i.sha256,gRed:!1,g:["9"]}),o("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:i.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=r(4011)}catch(f){t=void 0}o("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:i.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}}]);