]> git.ardis.lu - alu.bz/commitdiff
Initial commit
authorArdis Lu <ardisglu@gmail.com>
Sun, 30 Oct 2022 06:56:13 +0000 (23:56 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sun, 30 Oct 2022 06:56:13 +0000 (23:56 -0700)
README.md [new file with mode: 0644]
functions/api.js [new file with mode: 0644]
functions/verifyMessage.js [new file with mode: 0644]
index.html [new file with mode: 0644]
script.js [new file with mode: 0644]
style.css [new file with mode: 0644]

diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..e35fdac
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+# alu.bz
+
+A short URL service that uses the Ethereum blockchain for access control.
+
+This is a proof of concept to demonstrate the minimum amount of code required to
+use Ethereum for this purpose.
+
+Supersedes [alu.pm](https://github.com/ardislu/alu.pm).
+
+## Testing locally
+
+To run the frontend and the backend at the same time:
+
+```
+npx wrangler pages dev . --kv links
+```
diff --git a/functions/api.js b/functions/api.js
new file mode 100644 (file)
index 0000000..7e41826
--- /dev/null
@@ -0,0 +1,90 @@
+import { verifyMessage } from './verifyMessage';
+
+// Same function used on the frontend, ran again to verify.
+async function getNftCount(address) {
+  // Hardcoded parameters to query the Ethereum smart contract
+  const contractAddress = '0x74EE68a33f6c9f113e22B3B77418B75f85d07D22'; // Zerion ERC-1155 NFT 
+  const byteSignature = '00fdd58e'; // Ethereum ABI function signature for: balanceOf(address, uint256)
+  const paddedAddress = address.substring(2).padStart(64, '0');
+  const nftId = '5'.padStart(64, '0'); // Arbitrary ID for the ERC-1155 NFT to look up
+
+  // Prepare and send the payload to an Ethereum JSON-RPC node
+  const payload = {
+    jsonrpc: '2.0',
+    id: 1,
+    method: 'eth_call',
+    params: [
+      {
+        to: contractAddress,
+        data: `0x${byteSignature}${paddedAddress}${nftId}`
+      },
+      'latest'
+    ]
+  }
+  return fetch('https://eth.alu.bz/v1/mainnet', {
+    method: 'POST',
+    headers: {
+      'Content-Type': 'application/json'
+    },
+    body: JSON.stringify(payload)
+  })
+    .then(r => r.json())
+    .then(json => json['result'])
+    .then(result => parseInt(result, 16));
+}
+
+export async function onRequestPost({ request, env }) {
+  const data = await request.formData();
+  let shortUrl = data.get('short-url');
+  const fullUrl = data.get('full-url');
+  const signature = data.get('signature');
+  let isRandomlyGenerated = false;
+
+  // Generate random 4 character shortUrl if none is provided
+  if (shortUrl === '' || shortUrl === null || shortUrl === undefined) {
+    isRandomlyGenerated = true;
+    do {
+      let array = new Uint32Array(4);
+      crypto.getRandomValues(array);
+      shortUrl = [...array].map(v => (v % 36).toString(36)).join('');
+    } while (await env.links.get(shortUrl) !== null); // Confirm it's not already taken
+  }
+  // Invalid short URLs
+  else if (!/^[0-9a-zA-Z-_]*$/g.test(shortUrl) || shortUrl === 'api') {
+    return new Response('Invalid short URL', { status: 400, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } });
+  }
+  // User-provided duplicates
+  else if (await env.links.get(shortUrl) !== null) {
+    return new Response('This short URL is already taken', { status: 400, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } });
+  }
+
+  // Invalid full URLs
+  try {
+    new URL(fullUrl);
+  }
+  catch (error) {
+    return new Response('Invalid full URL', { status: 400, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } });
+  }
+
+  if (!isRandomlyGenerated) {
+    const message = `Sign this message to confirm you want to create https://alu.bz/${shortUrl} to redirect to ${fullUrl}.`; // Must match frontend exactly
+    const signingAddress = verifyMessage(message, signature);
+    const nftCount = await getNftCount(signingAddress);
+    if (!(nftCount > 0)) {
+      return new Response('Invalid signature', { status: 403, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } });
+    }
+  }
+
+  await env.links.put(shortUrl, fullUrl);
+  return new Response(`Successfully created short URL: https://alu.bz/${shortUrl}`, { headers: { 'Content-Type': 'text/plain; charset=UTF-8' } });
+}
+
+export async function onRequestGet({ request, env }) {
+  const url = new URL(request.url);
+  const shortUrl = url.search.substring(1);
+  const fullUrl = env.links.get(shortUrl);
+  if (fullUrl === null) {
+    return Response.redirect('https://alu.bz');
+  }
+  return Response.redirect(fullUrl);
+}
diff --git a/functions/verifyMessage.js b/functions/verifyMessage.js
new file mode 100644 (file)
index 0000000..0f42ba5
--- /dev/null
@@ -0,0 +1,10 @@
+var An=Object.create;var ei=Object.defineProperty;var Sn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,Nn=Object.prototype.hasOwnProperty;var Ft=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Pn=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of En(t))!Nn.call(e,n)&&n!==i&&ei(e,n,{get:()=>t[n],enumerable:!(s=Sn(t,n))||s.enumerable});return e};var Qr=(e,t,i)=>(i=e!=null?An(In(e)):{},Pn(t||!e||!e.__esModule?ei(i,"default",{value:e,enumerable:!0}):i,e));var di=Ft(()=>{});var ke=Ft((vi,Fe)=>{(function(e,t){"use strict";function i(p,r){if(!p)throw new Error(r||"Assertion failed")}function s(p,r){p.super_=r;var o=function(){};o.prototype=r.prototype,p.prototype=new o,p.prototype.constructor=p}function n(p,r,o){if(n.isBN(p))return p;this.negative=0,this.words=null,this.length=0,this.red=null,p!==null&&((r==="le"||r==="be")&&(o=r,r=10),this._init(p||0,r||10,o||"be"))}typeof e=="object"?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;var l;try{typeof window<"u"&&typeof window.Buffer<"u"?l=window.Buffer:l=di().Buffer}catch{}n.isBN=function(r){return r instanceof n?!0:r!==null&&typeof r=="object"&&r.constructor.wordSize===n.wordSize&&Array.isArray(r.words)},n.max=function(r,o){return r.cmp(o)>0?r:o},n.min=function(r,o){return r.cmp(o)<0?r:o},n.prototype._init=function(r,o,h){if(typeof r=="number")return this._initNumber(r,o,h);if(typeof r=="object")return this._initArray(r,o,h);o==="hex"&&(o=16),i(o===(o|0)&&o>=2&&o<=36),r=r.toString().replace(/\s+/g,"");var u=0;r[0]==="-"&&(u++,this.negative=1),u<r.length&&(o===16?this._parseHex(r,u,h):(this._parseBase(r,o,u),h==="le"&&this._initArray(this.toArray(),o,h)))},n.prototype._initNumber=function(r,o,h){r<0&&(this.negative=1,r=-r),r<67108864?(this.words=[r&67108863],this.length=1):r<4503599627370496?(this.words=[r&67108863,r/67108864&67108863],this.length=2):(i(r<9007199254740992),this.words=[r&67108863,r/67108864&67108863,1],this.length=3),h==="le"&&this._initArray(this.toArray(),o,h)},n.prototype._initArray=function(r,o,h){if(i(typeof r.length=="number"),r.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(r.length/3),this.words=new Array(this.length);for(var u=0;u<this.length;u++)this.words[u]=0;var c,g,b=0;if(h==="be")for(u=r.length-1,c=0;u>=0;u-=3)g=r[u]|r[u-1]<<8|r[u-2]<<16,this.words[c]|=g<<b&67108863,this.words[c+1]=g>>>26-b&67108863,b+=24,b>=26&&(b-=26,c++);else if(h==="le")for(u=0,c=0;u<r.length;u+=3)g=r[u]|r[u+1]<<8|r[u+2]<<16,this.words[c]|=g<<b&67108863,this.words[c+1]=g>>>26-b&67108863,b+=24,b>=26&&(b-=26,c++);return this._strip()};function m(p,r){var o=p.charCodeAt(r);if(o>=48&&o<=57)return o-48;if(o>=65&&o<=70)return o-55;if(o>=97&&o<=102)return o-87;i(!1,"Invalid character in "+p)}function x(p,r,o){var h=m(p,o);return o-1>=r&&(h|=m(p,o-1)<<4),h}n.prototype._parseHex=function(r,o,h){this.length=Math.ceil((r.length-o)/6),this.words=new Array(this.length);for(var u=0;u<this.length;u++)this.words[u]=0;var c=0,g=0,b;if(h==="be")for(u=r.length-1;u>=o;u-=2)b=x(r,o,u)<<c,this.words[g]|=b&67108863,c>=18?(c-=18,g+=1,this.words[g]|=b>>>26):c+=8;else{var d=r.length-o;for(u=d%2===0?o+1:o;u<r.length;u+=2)b=x(r,o,u)<<c,this.words[g]|=b&67108863,c>=18?(c-=18,g+=1,this.words[g]|=b>>>26):c+=8}this._strip()};function y(p,r,o,h){for(var u=0,c=0,g=Math.min(p.length,o),b=r;b<g;b++){var d=p.charCodeAt(b)-48;u*=h,d>=49?c=d-49+10:d>=17?c=d-17+10:c=d,i(d>=0&&c<h,"Invalid character"),u+=c}return u}n.prototype._parseBase=function(r,o,h){this.words=[0],this.length=1;for(var u=0,c=1;c<=67108863;c*=o)u++;u--,c=c/o|0;for(var g=r.length-h,b=g%u,d=Math.min(g,g-b)+h,f=0,v=h;v<d;v+=u)f=y(r,v,v+u,o),this.imuln(c),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(b!==0){var B=1;for(f=y(r,v,r.length,o),v=0;v<b;v++)B*=o;this.imuln(B),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this._strip()},n.prototype.copy=function(r){r.words=new Array(this.length);for(var o=0;o<this.length;o++)r.words[o]=this.words[o];r.length=this.length,r.negative=this.negative,r.red=this.red};function w(p,r){p.words=r.words,p.length=r.length,p.negative=r.negative,p.red=r.red}if(n.prototype._move=function(r){w(r,this)},n.prototype.clone=function(){var r=new n(null);return this.copy(r),r},n.prototype._expand=function(r){for(;this.length<r;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=A}catch{n.prototype.inspect=A}else n.prototype.inspect=A;function A(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var _=["","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"],I=[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],P=[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];n.prototype.toString=function(r,o){r=r||10,o=o|0||1;var h;if(r===16||r==="hex"){h="";for(var u=0,c=0,g=0;g<this.length;g++){var b=this.words[g],d=((b<<u|c)&16777215).toString(16);c=b>>>24-u&16777215,u+=2,u>=26&&(u-=26,g--),c!==0||g!==this.length-1?h=_[6-d.length]+d+h:h=d+h}for(c!==0&&(h=c.toString(16)+h);h.length%o!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}if(r===(r|0)&&r>=2&&r<=36){var f=I[r],v=P[r];h="";var B=this.clone();for(B.negative=0;!B.isZero();){var a=B.modrn(v).toString(r);B=B.idivn(v),B.isZero()?h=a+h:h=_[f-a.length]+a+h}for(this.isZero()&&(h="0"+h);h.length%o!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}i(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var r=this.words[0];return this.length===2?r+=this.words[1]*67108864:this.length===3&&this.words[2]===1?r+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-r:r},n.prototype.toJSON=function(){return this.toString(16,2)},l&&(n.prototype.toBuffer=function(r,o){return this.toArrayLike(l,r,o)}),n.prototype.toArray=function(r,o){return this.toArrayLike(Array,r,o)};var N=function(r,o){return r.allocUnsafe?r.allocUnsafe(o):new r(o)};n.prototype.toArrayLike=function(r,o,h){this._strip();var u=this.byteLength(),c=h||Math.max(1,u);i(u<=c,"byte array longer than desired length"),i(c>0,"Requested array length <= 0");var g=N(r,c),b=o==="le"?"LE":"BE";return this["_toArrayLike"+b](g,u),g},n.prototype._toArrayLikeLE=function(r,o){for(var h=0,u=0,c=0,g=0;c<this.length;c++){var b=this.words[c]<<g|u;r[h++]=b&255,h<r.length&&(r[h++]=b>>8&255),h<r.length&&(r[h++]=b>>16&255),g===6?(h<r.length&&(r[h++]=b>>24&255),u=0,g=0):(u=b>>>24,g+=2)}if(h<r.length)for(r[h++]=u;h<r.length;)r[h++]=0},n.prototype._toArrayLikeBE=function(r,o){for(var h=r.length-1,u=0,c=0,g=0;c<this.length;c++){var b=this.words[c]<<g|u;r[h--]=b&255,h>=0&&(r[h--]=b>>8&255),h>=0&&(r[h--]=b>>16&255),g===6?(h>=0&&(r[h--]=b>>24&255),u=0,g=0):(u=b>>>24,g+=2)}if(h>=0)for(r[h--]=u;h>=0;)r[h--]=0},Math.clz32?n.prototype._countBits=function(r){return 32-Math.clz32(r)}:n.prototype._countBits=function(r){var o=r,h=0;return o>=4096&&(h+=13,o>>>=13),o>=64&&(h+=7,o>>>=7),o>=8&&(h+=4,o>>>=4),o>=2&&(h+=2,o>>>=2),h+o},n.prototype._zeroBits=function(r){if(r===0)return 26;var o=r,h=0;return(o&8191)===0&&(h+=13,o>>>=13),(o&127)===0&&(h+=7,o>>>=7),(o&15)===0&&(h+=4,o>>>=4),(o&3)===0&&(h+=2,o>>>=2),(o&1)===0&&h++,h},n.prototype.bitLength=function(){var r=this.words[this.length-1],o=this._countBits(r);return(this.length-1)*26+o};function k(p){for(var r=new Array(p.bitLength()),o=0;o<r.length;o++){var h=o/26|0,u=o%26;r[o]=p.words[h]>>>u&1}return r}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var r=0,o=0;o<this.length;o++){var h=this._zeroBits(this.words[o]);if(r+=h,h!==26)break}return r},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(r){return this.negative!==0?this.abs().inotn(r).iaddn(1):this.clone()},n.prototype.fromTwos=function(r){return this.testn(r-1)?this.notn(r).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(r){for(;this.length<r.length;)this.words[this.length++]=0;for(var o=0;o<r.length;o++)this.words[o]=this.words[o]|r.words[o];return this._strip()},n.prototype.ior=function(r){return i((this.negative|r.negative)===0),this.iuor(r)},n.prototype.or=function(r){return this.length>r.length?this.clone().ior(r):r.clone().ior(this)},n.prototype.uor=function(r){return this.length>r.length?this.clone().iuor(r):r.clone().iuor(this)},n.prototype.iuand=function(r){var o;this.length>r.length?o=r:o=this;for(var h=0;h<o.length;h++)this.words[h]=this.words[h]&r.words[h];return this.length=o.length,this._strip()},n.prototype.iand=function(r){return i((this.negative|r.negative)===0),this.iuand(r)},n.prototype.and=function(r){return this.length>r.length?this.clone().iand(r):r.clone().iand(this)},n.prototype.uand=function(r){return this.length>r.length?this.clone().iuand(r):r.clone().iuand(this)},n.prototype.iuxor=function(r){var o,h;this.length>r.length?(o=this,h=r):(o=r,h=this);for(var u=0;u<h.length;u++)this.words[u]=o.words[u]^h.words[u];if(this!==o)for(;u<o.length;u++)this.words[u]=o.words[u];return this.length=o.length,this._strip()},n.prototype.ixor=function(r){return i((this.negative|r.negative)===0),this.iuxor(r)},n.prototype.xor=function(r){return this.length>r.length?this.clone().ixor(r):r.clone().ixor(this)},n.prototype.uxor=function(r){return this.length>r.length?this.clone().iuxor(r):r.clone().iuxor(this)},n.prototype.inotn=function(r){i(typeof r=="number"&&r>=0);var o=Math.ceil(r/26)|0,h=r%26;this._expand(o),h>0&&o--;for(var u=0;u<o;u++)this.words[u]=~this.words[u]&67108863;return h>0&&(this.words[u]=~this.words[u]&67108863>>26-h),this._strip()},n.prototype.notn=function(r){return this.clone().inotn(r)},n.prototype.setn=function(r,o){i(typeof r=="number"&&r>=0);var h=r/26|0,u=r%26;return this._expand(h+1),o?this.words[h]=this.words[h]|1<<u:this.words[h]=this.words[h]&~(1<<u),this._strip()},n.prototype.iadd=function(r){var o;if(this.negative!==0&&r.negative===0)return this.negative=0,o=this.isub(r),this.negative^=1,this._normSign();if(this.negative===0&&r.negative!==0)return r.negative=0,o=this.isub(r),r.negative=1,o._normSign();var h,u;this.length>r.length?(h=this,u=r):(h=r,u=this);for(var c=0,g=0;g<u.length;g++)o=(h.words[g]|0)+(u.words[g]|0)+c,this.words[g]=o&67108863,c=o>>>26;for(;c!==0&&g<h.length;g++)o=(h.words[g]|0)+c,this.words[g]=o&67108863,c=o>>>26;if(this.length=h.length,c!==0)this.words[this.length]=c,this.length++;else if(h!==this)for(;g<h.length;g++)this.words[g]=h.words[g];return this},n.prototype.add=function(r){var o;return r.negative!==0&&this.negative===0?(r.negative=0,o=this.sub(r),r.negative^=1,o):r.negative===0&&this.negative!==0?(this.negative=0,o=r.sub(this),this.negative=1,o):this.length>r.length?this.clone().iadd(r):r.clone().iadd(this)},n.prototype.isub=function(r){if(r.negative!==0){r.negative=0;var o=this.iadd(r);return r.negative=1,o._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(r),this.negative=1,this._normSign();var h=this.cmp(r);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;var u,c;h>0?(u=this,c=r):(u=r,c=this);for(var g=0,b=0;b<c.length;b++)o=(u.words[b]|0)-(c.words[b]|0)+g,g=o>>26,this.words[b]=o&67108863;for(;g!==0&&b<u.length;b++)o=(u.words[b]|0)+g,g=o>>26,this.words[b]=o&67108863;if(g===0&&b<u.length&&u!==this)for(;b<u.length;b++)this.words[b]=u.words[b];return this.length=Math.max(this.length,b),u!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(r){return this.clone().isub(r)};function U(p,r,o){o.negative=r.negative^p.negative;var h=p.length+r.length|0;o.length=h,h=h-1|0;var u=p.words[0]|0,c=r.words[0]|0,g=u*c,b=g&67108863,d=g/67108864|0;o.words[0]=b;for(var f=1;f<h;f++){for(var v=d>>>26,B=d&67108863,a=Math.min(f,r.length-1),M=Math.max(0,f-p.length+1);M<=a;M++){var S=f-M|0;u=p.words[S]|0,c=r.words[M]|0,g=u*c+B,v+=g/67108864|0,B=g&67108863}o.words[f]=B|0,d=v|0}return d!==0?o.words[f]=d|0:o.length--,o._strip()}var C=function(r,o,h){var u=r.words,c=o.words,g=h.words,b=0,d,f,v,B=u[0]|0,a=B&8191,M=B>>>13,S=u[1]|0,E=S&8191,R=S>>>13,T=u[2]|0,F=T&8191,O=T>>>13,It=u[3]|0,q=It&8191,L=It>>>13,xr=u[4]|0,J=xr&8191,Z=xr>>>13,br=u[5]|0,W=br&8191,X=br>>>13,yr=u[6]|0,V=yr&8191,j=yr>>>13,wr=u[7]|0,$=wr&8191,Y=wr>>>13,Mr=u[8]|0,Q=Mr&8191,tt=Mr>>>13,_r=u[9]|0,rt=_r&8191,et=_r>>>13,Ar=c[0]|0,it=Ar&8191,nt=Ar>>>13,Sr=c[1]|0,ft=Sr&8191,ot=Sr>>>13,Er=c[2]|0,st=Er&8191,at=Er>>>13,Ir=c[3]|0,ht=Ir&8191,ut=Ir>>>13,Nr=c[4]|0,lt=Nr&8191,ct=Nr>>>13,Pr=c[5]|0,dt=Pr&8191,vt=Pr>>>13,Rr=c[6]|0,pt=Rr&8191,mt=Rr>>>13,Or=c[7]|0,gt=Or&8191,xt=Or>>>13,Fr=c[8]|0,bt=Fr&8191,yt=Fr>>>13,kr=c[9]|0,wt=kr&8191,Mt=kr>>>13;h.negative=r.negative^o.negative,h.length=19,d=Math.imul(a,it),f=Math.imul(a,nt),f=f+Math.imul(M,it)|0,v=Math.imul(M,nt);var hr=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(hr>>>26)|0,hr&=67108863,d=Math.imul(E,it),f=Math.imul(E,nt),f=f+Math.imul(R,it)|0,v=Math.imul(R,nt),d=d+Math.imul(a,ft)|0,f=f+Math.imul(a,ot)|0,f=f+Math.imul(M,ft)|0,v=v+Math.imul(M,ot)|0;var ur=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(ur>>>26)|0,ur&=67108863,d=Math.imul(F,it),f=Math.imul(F,nt),f=f+Math.imul(O,it)|0,v=Math.imul(O,nt),d=d+Math.imul(E,ft)|0,f=f+Math.imul(E,ot)|0,f=f+Math.imul(R,ft)|0,v=v+Math.imul(R,ot)|0,d=d+Math.imul(a,st)|0,f=f+Math.imul(a,at)|0,f=f+Math.imul(M,st)|0,v=v+Math.imul(M,at)|0;var lr=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(lr>>>26)|0,lr&=67108863,d=Math.imul(q,it),f=Math.imul(q,nt),f=f+Math.imul(L,it)|0,v=Math.imul(L,nt),d=d+Math.imul(F,ft)|0,f=f+Math.imul(F,ot)|0,f=f+Math.imul(O,ft)|0,v=v+Math.imul(O,ot)|0,d=d+Math.imul(E,st)|0,f=f+Math.imul(E,at)|0,f=f+Math.imul(R,st)|0,v=v+Math.imul(R,at)|0,d=d+Math.imul(a,ht)|0,f=f+Math.imul(a,ut)|0,f=f+Math.imul(M,ht)|0,v=v+Math.imul(M,ut)|0;var cr=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(cr>>>26)|0,cr&=67108863,d=Math.imul(J,it),f=Math.imul(J,nt),f=f+Math.imul(Z,it)|0,v=Math.imul(Z,nt),d=d+Math.imul(q,ft)|0,f=f+Math.imul(q,ot)|0,f=f+Math.imul(L,ft)|0,v=v+Math.imul(L,ot)|0,d=d+Math.imul(F,st)|0,f=f+Math.imul(F,at)|0,f=f+Math.imul(O,st)|0,v=v+Math.imul(O,at)|0,d=d+Math.imul(E,ht)|0,f=f+Math.imul(E,ut)|0,f=f+Math.imul(R,ht)|0,v=v+Math.imul(R,ut)|0,d=d+Math.imul(a,lt)|0,f=f+Math.imul(a,ct)|0,f=f+Math.imul(M,lt)|0,v=v+Math.imul(M,ct)|0;var dr=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(dr>>>26)|0,dr&=67108863,d=Math.imul(W,it),f=Math.imul(W,nt),f=f+Math.imul(X,it)|0,v=Math.imul(X,nt),d=d+Math.imul(J,ft)|0,f=f+Math.imul(J,ot)|0,f=f+Math.imul(Z,ft)|0,v=v+Math.imul(Z,ot)|0,d=d+Math.imul(q,st)|0,f=f+Math.imul(q,at)|0,f=f+Math.imul(L,st)|0,v=v+Math.imul(L,at)|0,d=d+Math.imul(F,ht)|0,f=f+Math.imul(F,ut)|0,f=f+Math.imul(O,ht)|0,v=v+Math.imul(O,ut)|0,d=d+Math.imul(E,lt)|0,f=f+Math.imul(E,ct)|0,f=f+Math.imul(R,lt)|0,v=v+Math.imul(R,ct)|0,d=d+Math.imul(a,dt)|0,f=f+Math.imul(a,vt)|0,f=f+Math.imul(M,dt)|0,v=v+Math.imul(M,vt)|0;var de=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(de>>>26)|0,de&=67108863,d=Math.imul(V,it),f=Math.imul(V,nt),f=f+Math.imul(j,it)|0,v=Math.imul(j,nt),d=d+Math.imul(W,ft)|0,f=f+Math.imul(W,ot)|0,f=f+Math.imul(X,ft)|0,v=v+Math.imul(X,ot)|0,d=d+Math.imul(J,st)|0,f=f+Math.imul(J,at)|0,f=f+Math.imul(Z,st)|0,v=v+Math.imul(Z,at)|0,d=d+Math.imul(q,ht)|0,f=f+Math.imul(q,ut)|0,f=f+Math.imul(L,ht)|0,v=v+Math.imul(L,ut)|0,d=d+Math.imul(F,lt)|0,f=f+Math.imul(F,ct)|0,f=f+Math.imul(O,lt)|0,v=v+Math.imul(O,ct)|0,d=d+Math.imul(E,dt)|0,f=f+Math.imul(E,vt)|0,f=f+Math.imul(R,dt)|0,v=v+Math.imul(R,vt)|0,d=d+Math.imul(a,pt)|0,f=f+Math.imul(a,mt)|0,f=f+Math.imul(M,pt)|0,v=v+Math.imul(M,mt)|0;var ve=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,d=Math.imul($,it),f=Math.imul($,nt),f=f+Math.imul(Y,it)|0,v=Math.imul(Y,nt),d=d+Math.imul(V,ft)|0,f=f+Math.imul(V,ot)|0,f=f+Math.imul(j,ft)|0,v=v+Math.imul(j,ot)|0,d=d+Math.imul(W,st)|0,f=f+Math.imul(W,at)|0,f=f+Math.imul(X,st)|0,v=v+Math.imul(X,at)|0,d=d+Math.imul(J,ht)|0,f=f+Math.imul(J,ut)|0,f=f+Math.imul(Z,ht)|0,v=v+Math.imul(Z,ut)|0,d=d+Math.imul(q,lt)|0,f=f+Math.imul(q,ct)|0,f=f+Math.imul(L,lt)|0,v=v+Math.imul(L,ct)|0,d=d+Math.imul(F,dt)|0,f=f+Math.imul(F,vt)|0,f=f+Math.imul(O,dt)|0,v=v+Math.imul(O,vt)|0,d=d+Math.imul(E,pt)|0,f=f+Math.imul(E,mt)|0,f=f+Math.imul(R,pt)|0,v=v+Math.imul(R,mt)|0,d=d+Math.imul(a,gt)|0,f=f+Math.imul(a,xt)|0,f=f+Math.imul(M,gt)|0,v=v+Math.imul(M,xt)|0;var pe=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(pe>>>26)|0,pe&=67108863,d=Math.imul(Q,it),f=Math.imul(Q,nt),f=f+Math.imul(tt,it)|0,v=Math.imul(tt,nt),d=d+Math.imul($,ft)|0,f=f+Math.imul($,ot)|0,f=f+Math.imul(Y,ft)|0,v=v+Math.imul(Y,ot)|0,d=d+Math.imul(V,st)|0,f=f+Math.imul(V,at)|0,f=f+Math.imul(j,st)|0,v=v+Math.imul(j,at)|0,d=d+Math.imul(W,ht)|0,f=f+Math.imul(W,ut)|0,f=f+Math.imul(X,ht)|0,v=v+Math.imul(X,ut)|0,d=d+Math.imul(J,lt)|0,f=f+Math.imul(J,ct)|0,f=f+Math.imul(Z,lt)|0,v=v+Math.imul(Z,ct)|0,d=d+Math.imul(q,dt)|0,f=f+Math.imul(q,vt)|0,f=f+Math.imul(L,dt)|0,v=v+Math.imul(L,vt)|0,d=d+Math.imul(F,pt)|0,f=f+Math.imul(F,mt)|0,f=f+Math.imul(O,pt)|0,v=v+Math.imul(O,mt)|0,d=d+Math.imul(E,gt)|0,f=f+Math.imul(E,xt)|0,f=f+Math.imul(R,gt)|0,v=v+Math.imul(R,xt)|0,d=d+Math.imul(a,bt)|0,f=f+Math.imul(a,yt)|0,f=f+Math.imul(M,bt)|0,v=v+Math.imul(M,yt)|0;var me=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(me>>>26)|0,me&=67108863,d=Math.imul(rt,it),f=Math.imul(rt,nt),f=f+Math.imul(et,it)|0,v=Math.imul(et,nt),d=d+Math.imul(Q,ft)|0,f=f+Math.imul(Q,ot)|0,f=f+Math.imul(tt,ft)|0,v=v+Math.imul(tt,ot)|0,d=d+Math.imul($,st)|0,f=f+Math.imul($,at)|0,f=f+Math.imul(Y,st)|0,v=v+Math.imul(Y,at)|0,d=d+Math.imul(V,ht)|0,f=f+Math.imul(V,ut)|0,f=f+Math.imul(j,ht)|0,v=v+Math.imul(j,ut)|0,d=d+Math.imul(W,lt)|0,f=f+Math.imul(W,ct)|0,f=f+Math.imul(X,lt)|0,v=v+Math.imul(X,ct)|0,d=d+Math.imul(J,dt)|0,f=f+Math.imul(J,vt)|0,f=f+Math.imul(Z,dt)|0,v=v+Math.imul(Z,vt)|0,d=d+Math.imul(q,pt)|0,f=f+Math.imul(q,mt)|0,f=f+Math.imul(L,pt)|0,v=v+Math.imul(L,mt)|0,d=d+Math.imul(F,gt)|0,f=f+Math.imul(F,xt)|0,f=f+Math.imul(O,gt)|0,v=v+Math.imul(O,xt)|0,d=d+Math.imul(E,bt)|0,f=f+Math.imul(E,yt)|0,f=f+Math.imul(R,bt)|0,v=v+Math.imul(R,yt)|0,d=d+Math.imul(a,wt)|0,f=f+Math.imul(a,Mt)|0,f=f+Math.imul(M,wt)|0,v=v+Math.imul(M,Mt)|0;var ge=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,d=Math.imul(rt,ft),f=Math.imul(rt,ot),f=f+Math.imul(et,ft)|0,v=Math.imul(et,ot),d=d+Math.imul(Q,st)|0,f=f+Math.imul(Q,at)|0,f=f+Math.imul(tt,st)|0,v=v+Math.imul(tt,at)|0,d=d+Math.imul($,ht)|0,f=f+Math.imul($,ut)|0,f=f+Math.imul(Y,ht)|0,v=v+Math.imul(Y,ut)|0,d=d+Math.imul(V,lt)|0,f=f+Math.imul(V,ct)|0,f=f+Math.imul(j,lt)|0,v=v+Math.imul(j,ct)|0,d=d+Math.imul(W,dt)|0,f=f+Math.imul(W,vt)|0,f=f+Math.imul(X,dt)|0,v=v+Math.imul(X,vt)|0,d=d+Math.imul(J,pt)|0,f=f+Math.imul(J,mt)|0,f=f+Math.imul(Z,pt)|0,v=v+Math.imul(Z,mt)|0,d=d+Math.imul(q,gt)|0,f=f+Math.imul(q,xt)|0,f=f+Math.imul(L,gt)|0,v=v+Math.imul(L,xt)|0,d=d+Math.imul(F,bt)|0,f=f+Math.imul(F,yt)|0,f=f+Math.imul(O,bt)|0,v=v+Math.imul(O,yt)|0,d=d+Math.imul(E,wt)|0,f=f+Math.imul(E,Mt)|0,f=f+Math.imul(R,wt)|0,v=v+Math.imul(R,Mt)|0;var xe=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(xe>>>26)|0,xe&=67108863,d=Math.imul(rt,st),f=Math.imul(rt,at),f=f+Math.imul(et,st)|0,v=Math.imul(et,at),d=d+Math.imul(Q,ht)|0,f=f+Math.imul(Q,ut)|0,f=f+Math.imul(tt,ht)|0,v=v+Math.imul(tt,ut)|0,d=d+Math.imul($,lt)|0,f=f+Math.imul($,ct)|0,f=f+Math.imul(Y,lt)|0,v=v+Math.imul(Y,ct)|0,d=d+Math.imul(V,dt)|0,f=f+Math.imul(V,vt)|0,f=f+Math.imul(j,dt)|0,v=v+Math.imul(j,vt)|0,d=d+Math.imul(W,pt)|0,f=f+Math.imul(W,mt)|0,f=f+Math.imul(X,pt)|0,v=v+Math.imul(X,mt)|0,d=d+Math.imul(J,gt)|0,f=f+Math.imul(J,xt)|0,f=f+Math.imul(Z,gt)|0,v=v+Math.imul(Z,xt)|0,d=d+Math.imul(q,bt)|0,f=f+Math.imul(q,yt)|0,f=f+Math.imul(L,bt)|0,v=v+Math.imul(L,yt)|0,d=d+Math.imul(F,wt)|0,f=f+Math.imul(F,Mt)|0,f=f+Math.imul(O,wt)|0,v=v+Math.imul(O,Mt)|0;var be=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(be>>>26)|0,be&=67108863,d=Math.imul(rt,ht),f=Math.imul(rt,ut),f=f+Math.imul(et,ht)|0,v=Math.imul(et,ut),d=d+Math.imul(Q,lt)|0,f=f+Math.imul(Q,ct)|0,f=f+Math.imul(tt,lt)|0,v=v+Math.imul(tt,ct)|0,d=d+Math.imul($,dt)|0,f=f+Math.imul($,vt)|0,f=f+Math.imul(Y,dt)|0,v=v+Math.imul(Y,vt)|0,d=d+Math.imul(V,pt)|0,f=f+Math.imul(V,mt)|0,f=f+Math.imul(j,pt)|0,v=v+Math.imul(j,mt)|0,d=d+Math.imul(W,gt)|0,f=f+Math.imul(W,xt)|0,f=f+Math.imul(X,gt)|0,v=v+Math.imul(X,xt)|0,d=d+Math.imul(J,bt)|0,f=f+Math.imul(J,yt)|0,f=f+Math.imul(Z,bt)|0,v=v+Math.imul(Z,yt)|0,d=d+Math.imul(q,wt)|0,f=f+Math.imul(q,Mt)|0,f=f+Math.imul(L,wt)|0,v=v+Math.imul(L,Mt)|0;var ye=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,d=Math.imul(rt,lt),f=Math.imul(rt,ct),f=f+Math.imul(et,lt)|0,v=Math.imul(et,ct),d=d+Math.imul(Q,dt)|0,f=f+Math.imul(Q,vt)|0,f=f+Math.imul(tt,dt)|0,v=v+Math.imul(tt,vt)|0,d=d+Math.imul($,pt)|0,f=f+Math.imul($,mt)|0,f=f+Math.imul(Y,pt)|0,v=v+Math.imul(Y,mt)|0,d=d+Math.imul(V,gt)|0,f=f+Math.imul(V,xt)|0,f=f+Math.imul(j,gt)|0,v=v+Math.imul(j,xt)|0,d=d+Math.imul(W,bt)|0,f=f+Math.imul(W,yt)|0,f=f+Math.imul(X,bt)|0,v=v+Math.imul(X,yt)|0,d=d+Math.imul(J,wt)|0,f=f+Math.imul(J,Mt)|0,f=f+Math.imul(Z,wt)|0,v=v+Math.imul(Z,Mt)|0;var we=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(we>>>26)|0,we&=67108863,d=Math.imul(rt,dt),f=Math.imul(rt,vt),f=f+Math.imul(et,dt)|0,v=Math.imul(et,vt),d=d+Math.imul(Q,pt)|0,f=f+Math.imul(Q,mt)|0,f=f+Math.imul(tt,pt)|0,v=v+Math.imul(tt,mt)|0,d=d+Math.imul($,gt)|0,f=f+Math.imul($,xt)|0,f=f+Math.imul(Y,gt)|0,v=v+Math.imul(Y,xt)|0,d=d+Math.imul(V,bt)|0,f=f+Math.imul(V,yt)|0,f=f+Math.imul(j,bt)|0,v=v+Math.imul(j,yt)|0,d=d+Math.imul(W,wt)|0,f=f+Math.imul(W,Mt)|0,f=f+Math.imul(X,wt)|0,v=v+Math.imul(X,Mt)|0;var Me=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(Me>>>26)|0,Me&=67108863,d=Math.imul(rt,pt),f=Math.imul(rt,mt),f=f+Math.imul(et,pt)|0,v=Math.imul(et,mt),d=d+Math.imul(Q,gt)|0,f=f+Math.imul(Q,xt)|0,f=f+Math.imul(tt,gt)|0,v=v+Math.imul(tt,xt)|0,d=d+Math.imul($,bt)|0,f=f+Math.imul($,yt)|0,f=f+Math.imul(Y,bt)|0,v=v+Math.imul(Y,yt)|0,d=d+Math.imul(V,wt)|0,f=f+Math.imul(V,Mt)|0,f=f+Math.imul(j,wt)|0,v=v+Math.imul(j,Mt)|0;var _e=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(_e>>>26)|0,_e&=67108863,d=Math.imul(rt,gt),f=Math.imul(rt,xt),f=f+Math.imul(et,gt)|0,v=Math.imul(et,xt),d=d+Math.imul(Q,bt)|0,f=f+Math.imul(Q,yt)|0,f=f+Math.imul(tt,bt)|0,v=v+Math.imul(tt,yt)|0,d=d+Math.imul($,wt)|0,f=f+Math.imul($,Mt)|0,f=f+Math.imul(Y,wt)|0,v=v+Math.imul(Y,Mt)|0;var Ae=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,d=Math.imul(rt,bt),f=Math.imul(rt,yt),f=f+Math.imul(et,bt)|0,v=Math.imul(et,yt),d=d+Math.imul(Q,wt)|0,f=f+Math.imul(Q,Mt)|0,f=f+Math.imul(tt,wt)|0,v=v+Math.imul(tt,Mt)|0;var Se=(b+d|0)+((f&8191)<<13)|0;b=(v+(f>>>13)|0)+(Se>>>26)|0,Se&=67108863,d=Math.imul(rt,wt),f=Math.imul(rt,Mt),f=f+Math.imul(et,wt)|0,v=Math.imul(et,Mt);var Ee=(b+d|0)+((f&8191)<<13)|0;return b=(v+(f>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,g[0]=hr,g[1]=ur,g[2]=lr,g[3]=cr,g[4]=dr,g[5]=de,g[6]=ve,g[7]=pe,g[8]=me,g[9]=ge,g[10]=xe,g[11]=be,g[12]=ye,g[13]=we,g[14]=Me,g[15]=_e,g[16]=Ae,g[17]=Se,g[18]=Ee,b!==0&&(g[19]=b,h.length++),h};Math.imul||(C=U);function St(p,r,o){o.negative=r.negative^p.negative,o.length=p.length+r.length;for(var h=0,u=0,c=0;c<o.length-1;c++){var g=u;u=0;for(var b=h&67108863,d=Math.min(c,r.length-1),f=Math.max(0,c-p.length+1);f<=d;f++){var v=c-f,B=p.words[v]|0,a=r.words[f]|0,M=B*a,S=M&67108863;g=g+(M/67108864|0)|0,S=S+b|0,b=S&67108863,g=g+(S>>>26)|0,u+=g>>>26,g&=67108863}o.words[c]=b,h=g,g=u}return h!==0?o.words[c]=h:o.length--,o._strip()}function Rt(p,r,o){return St(p,r,o)}n.prototype.mulTo=function(r,o){var h,u=this.length+r.length;return this.length===10&&r.length===10?h=C(this,r,o):u<63?h=U(this,r,o):u<1024?h=St(this,r,o):h=Rt(this,r,o),h};function At(p,r){this.x=p,this.y=r}At.prototype.makeRBT=function(r){for(var o=new Array(r),h=n.prototype._countBits(r)-1,u=0;u<r;u++)o[u]=this.revBin(u,h,r);return o},At.prototype.revBin=function(r,o,h){if(r===0||r===h-1)return r;for(var u=0,c=0;c<o;c++)u|=(r&1)<<o-c-1,r>>=1;return u},At.prototype.permute=function(r,o,h,u,c,g){for(var b=0;b<g;b++)u[b]=o[r[b]],c[b]=h[r[b]]},At.prototype.transform=function(r,o,h,u,c,g){this.permute(g,r,o,h,u,c);for(var b=1;b<c;b<<=1)for(var d=b<<1,f=Math.cos(2*Math.PI/d),v=Math.sin(2*Math.PI/d),B=0;B<c;B+=d)for(var a=f,M=v,S=0;S<b;S++){var E=h[B+S],R=u[B+S],T=h[B+S+b],F=u[B+S+b],O=a*T-M*F;F=a*F+M*T,T=O,h[B+S]=E+T,u[B+S]=R+F,h[B+S+b]=E-T,u[B+S+b]=R-F,S!==d&&(O=f*a-v*M,M=f*M+v*a,a=O)}},At.prototype.guessLen13b=function(r,o){var h=Math.max(o,r)|1,u=h&1,c=0;for(h=h/2|0;h;h=h>>>1)c++;return 1<<c+1+u},At.prototype.conjugate=function(r,o,h){if(!(h<=1))for(var u=0;u<h/2;u++){var c=r[u];r[u]=r[h-u-1],r[h-u-1]=c,c=o[u],o[u]=-o[h-u-1],o[h-u-1]=-c}},At.prototype.normalize13b=function(r,o){for(var h=0,u=0;u<o/2;u++){var c=Math.round(r[2*u+1]/o)*8192+Math.round(r[2*u]/o)+h;r[u]=c&67108863,c<67108864?h=0:h=c/67108864|0}return r},At.prototype.convert13b=function(r,o,h,u){for(var c=0,g=0;g<o;g++)c=c+(r[g]|0),h[2*g]=c&8191,c=c>>>13,h[2*g+1]=c&8191,c=c>>>13;for(g=2*o;g<u;++g)h[g]=0;i(c===0),i((c&-8192)===0)},At.prototype.stub=function(r){for(var o=new Array(r),h=0;h<r;h++)o[h]=0;return o},At.prototype.mulp=function(r,o,h){var u=2*this.guessLen13b(r.length,o.length),c=this.makeRBT(u),g=this.stub(u),b=new Array(u),d=new Array(u),f=new Array(u),v=new Array(u),B=new Array(u),a=new Array(u),M=h.words;M.length=u,this.convert13b(r.words,r.length,b,u),this.convert13b(o.words,o.length,v,u),this.transform(b,g,d,f,u,c),this.transform(v,g,B,a,u,c);for(var S=0;S<u;S++){var E=d[S]*B[S]-f[S]*a[S];f[S]=d[S]*a[S]+f[S]*B[S],d[S]=E}return this.conjugate(d,f,u),this.transform(d,f,M,g,u,c),this.conjugate(M,g,u),this.normalize13b(M,u),h.negative=r.negative^o.negative,h.length=r.length+o.length,h._strip()},n.prototype.mul=function(r){var o=new n(null);return o.words=new Array(this.length+r.length),this.mulTo(r,o)},n.prototype.mulf=function(r){var o=new n(null);return o.words=new Array(this.length+r.length),Rt(this,r,o)},n.prototype.imul=function(r){return this.clone().mulTo(r,this)},n.prototype.imuln=function(r){var o=r<0;o&&(r=-r),i(typeof r=="number"),i(r<67108864);for(var h=0,u=0;u<this.length;u++){var c=(this.words[u]|0)*r,g=(c&67108863)+(h&67108863);h>>=26,h+=c/67108864|0,h+=g>>>26,this.words[u]=g&67108863}return h!==0&&(this.words[u]=h,this.length++),o?this.ineg():this},n.prototype.muln=function(r){return this.clone().imuln(r)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(r){var o=k(r);if(o.length===0)return new n(1);for(var h=this,u=0;u<o.length&&o[u]===0;u++,h=h.sqr());if(++u<o.length)for(var c=h.sqr();u<o.length;u++,c=c.sqr())o[u]!==0&&(h=h.mul(c));return h},n.prototype.iushln=function(r){i(typeof r=="number"&&r>=0);var o=r%26,h=(r-o)/26,u=67108863>>>26-o<<26-o,c;if(o!==0){var g=0;for(c=0;c<this.length;c++){var b=this.words[c]&u,d=(this.words[c]|0)-b<<o;this.words[c]=d|g,g=b>>>26-o}g&&(this.words[c]=g,this.length++)}if(h!==0){for(c=this.length-1;c>=0;c--)this.words[c+h]=this.words[c];for(c=0;c<h;c++)this.words[c]=0;this.length+=h}return this._strip()},n.prototype.ishln=function(r){return i(this.negative===0),this.iushln(r)},n.prototype.iushrn=function(r,o,h){i(typeof r=="number"&&r>=0);var u;o?u=(o-o%26)/26:u=0;var c=r%26,g=Math.min((r-c)/26,this.length),b=67108863^67108863>>>c<<c,d=h;if(u-=g,u=Math.max(0,u),d){for(var f=0;f<g;f++)d.words[f]=this.words[f];d.length=g}if(g!==0)if(this.length>g)for(this.length-=g,f=0;f<this.length;f++)this.words[f]=this.words[f+g];else this.words[0]=0,this.length=1;var v=0;for(f=this.length-1;f>=0&&(v!==0||f>=u);f--){var B=this.words[f]|0;this.words[f]=v<<26-c|B>>>c,v=B&b}return d&&v!==0&&(d.words[d.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(r,o,h){return i(this.negative===0),this.iushrn(r,o,h)},n.prototype.shln=function(r){return this.clone().ishln(r)},n.prototype.ushln=function(r){return this.clone().iushln(r)},n.prototype.shrn=function(r){return this.clone().ishrn(r)},n.prototype.ushrn=function(r){return this.clone().iushrn(r)},n.prototype.testn=function(r){i(typeof r=="number"&&r>=0);var o=r%26,h=(r-o)/26,u=1<<o;if(this.length<=h)return!1;var c=this.words[h];return!!(c&u)},n.prototype.imaskn=function(r){i(typeof r=="number"&&r>=0);var o=r%26,h=(r-o)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=h)return this;if(o!==0&&h++,this.length=Math.min(h,this.length),o!==0){var u=67108863^67108863>>>o<<o;this.words[this.length-1]&=u}return this._strip()},n.prototype.maskn=function(r){return this.clone().imaskn(r)},n.prototype.iaddn=function(r){return i(typeof r=="number"),i(r<67108864),r<0?this.isubn(-r):this.negative!==0?this.length===1&&(this.words[0]|0)<=r?(this.words[0]=r-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(r),this.negative=1,this):this._iaddn(r)},n.prototype._iaddn=function(r){this.words[0]+=r;for(var o=0;o<this.length&&this.words[o]>=67108864;o++)this.words[o]-=67108864,o===this.length-1?this.words[o+1]=1:this.words[o+1]++;return this.length=Math.max(this.length,o+1),this},n.prototype.isubn=function(r){if(i(typeof r=="number"),i(r<67108864),r<0)return this.iaddn(-r);if(this.negative!==0)return this.negative=0,this.iaddn(r),this.negative=1,this;if(this.words[0]-=r,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var o=0;o<this.length&&this.words[o]<0;o++)this.words[o]+=67108864,this.words[o+1]-=1;return this._strip()},n.prototype.addn=function(r){return this.clone().iaddn(r)},n.prototype.subn=function(r){return this.clone().isubn(r)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(r,o,h){var u=r.length+h,c;this._expand(u);var g,b=0;for(c=0;c<r.length;c++){g=(this.words[c+h]|0)+b;var d=(r.words[c]|0)*o;g-=d&67108863,b=(g>>26)-(d/67108864|0),this.words[c+h]=g&67108863}for(;c<this.length-h;c++)g=(this.words[c+h]|0)+b,b=g>>26,this.words[c+h]=g&67108863;if(b===0)return this._strip();for(i(b===-1),b=0,c=0;c<this.length;c++)g=-(this.words[c]|0)+b,b=g>>26,this.words[c]=g&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(r,o){var h=this.length-r.length,u=this.clone(),c=r,g=c.words[c.length-1]|0,b=this._countBits(g);h=26-b,h!==0&&(c=c.ushln(h),u.iushln(h),g=c.words[c.length-1]|0);var d=u.length-c.length,f;if(o!=="mod"){f=new n(null),f.length=d+1,f.words=new Array(f.length);for(var v=0;v<f.length;v++)f.words[v]=0}var B=u.clone()._ishlnsubmul(c,1,d);B.negative===0&&(u=B,f&&(f.words[d]=1));for(var a=d-1;a>=0;a--){var M=(u.words[c.length+a]|0)*67108864+(u.words[c.length+a-1]|0);for(M=Math.min(M/g|0,67108863),u._ishlnsubmul(c,M,a);u.negative!==0;)M--,u.negative=0,u._ishlnsubmul(c,1,a),u.isZero()||(u.negative^=1);f&&(f.words[a]=M)}return f&&f._strip(),u._strip(),o!=="div"&&h!==0&&u.iushrn(h),{div:f||null,mod:u}},n.prototype.divmod=function(r,o,h){if(i(!r.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var u,c,g;return this.negative!==0&&r.negative===0?(g=this.neg().divmod(r,o),o!=="mod"&&(u=g.div.neg()),o!=="div"&&(c=g.mod.neg(),h&&c.negative!==0&&c.iadd(r)),{div:u,mod:c}):this.negative===0&&r.negative!==0?(g=this.divmod(r.neg(),o),o!=="mod"&&(u=g.div.neg()),{div:u,mod:g.mod}):(this.negative&r.negative)!==0?(g=this.neg().divmod(r.neg(),o),o!=="div"&&(c=g.mod.neg(),h&&c.negative!==0&&c.isub(r)),{div:g.div,mod:c}):r.length>this.length||this.cmp(r)<0?{div:new n(0),mod:this}:r.length===1?o==="div"?{div:this.divn(r.words[0]),mod:null}:o==="mod"?{div:null,mod:new n(this.modrn(r.words[0]))}:{div:this.divn(r.words[0]),mod:new n(this.modrn(r.words[0]))}:this._wordDiv(r,o)},n.prototype.div=function(r){return this.divmod(r,"div",!1).div},n.prototype.mod=function(r){return this.divmod(r,"mod",!1).mod},n.prototype.umod=function(r){return this.divmod(r,"mod",!0).mod},n.prototype.divRound=function(r){var o=this.divmod(r);if(o.mod.isZero())return o.div;var h=o.div.negative!==0?o.mod.isub(r):o.mod,u=r.ushrn(1),c=r.andln(1),g=h.cmp(u);return g<0||c===1&&g===0?o.div:o.div.negative!==0?o.div.isubn(1):o.div.iaddn(1)},n.prototype.modrn=function(r){var o=r<0;o&&(r=-r),i(r<=67108863);for(var h=(1<<26)%r,u=0,c=this.length-1;c>=0;c--)u=(h*u+(this.words[c]|0))%r;return o?-u:u},n.prototype.modn=function(r){return this.modrn(r)},n.prototype.idivn=function(r){var o=r<0;o&&(r=-r),i(r<=67108863);for(var h=0,u=this.length-1;u>=0;u--){var c=(this.words[u]|0)+h*67108864;this.words[u]=c/r|0,h=c%r}return this._strip(),o?this.ineg():this},n.prototype.divn=function(r){return this.clone().idivn(r)},n.prototype.egcd=function(r){i(r.negative===0),i(!r.isZero());var o=this,h=r.clone();o.negative!==0?o=o.umod(r):o=o.clone();for(var u=new n(1),c=new n(0),g=new n(0),b=new n(1),d=0;o.isEven()&&h.isEven();)o.iushrn(1),h.iushrn(1),++d;for(var f=h.clone(),v=o.clone();!o.isZero();){for(var B=0,a=1;(o.words[0]&a)===0&&B<26;++B,a<<=1);if(B>0)for(o.iushrn(B);B-- >0;)(u.isOdd()||c.isOdd())&&(u.iadd(f),c.isub(v)),u.iushrn(1),c.iushrn(1);for(var M=0,S=1;(h.words[0]&S)===0&&M<26;++M,S<<=1);if(M>0)for(h.iushrn(M);M-- >0;)(g.isOdd()||b.isOdd())&&(g.iadd(f),b.isub(v)),g.iushrn(1),b.iushrn(1);o.cmp(h)>=0?(o.isub(h),u.isub(g),c.isub(b)):(h.isub(o),g.isub(u),b.isub(c))}return{a:g,b,gcd:h.iushln(d)}},n.prototype._invmp=function(r){i(r.negative===0),i(!r.isZero());var o=this,h=r.clone();o.negative!==0?o=o.umod(r):o=o.clone();for(var u=new n(1),c=new n(0),g=h.clone();o.cmpn(1)>0&&h.cmpn(1)>0;){for(var b=0,d=1;(o.words[0]&d)===0&&b<26;++b,d<<=1);if(b>0)for(o.iushrn(b);b-- >0;)u.isOdd()&&u.iadd(g),u.iushrn(1);for(var f=0,v=1;(h.words[0]&v)===0&&f<26;++f,v<<=1);if(f>0)for(h.iushrn(f);f-- >0;)c.isOdd()&&c.iadd(g),c.iushrn(1);o.cmp(h)>=0?(o.isub(h),u.isub(c)):(h.isub(o),c.isub(u))}var B;return o.cmpn(1)===0?B=u:B=c,B.cmpn(0)<0&&B.iadd(r),B},n.prototype.gcd=function(r){if(this.isZero())return r.abs();if(r.isZero())return this.abs();var o=this.clone(),h=r.clone();o.negative=0,h.negative=0;for(var u=0;o.isEven()&&h.isEven();u++)o.iushrn(1),h.iushrn(1);do{for(;o.isEven();)o.iushrn(1);for(;h.isEven();)h.iushrn(1);var c=o.cmp(h);if(c<0){var g=o;o=h,h=g}else if(c===0||h.cmpn(1)===0)break;o.isub(h)}while(!0);return h.iushln(u)},n.prototype.invm=function(r){return this.egcd(r).a.umod(r)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(r){return this.words[0]&r},n.prototype.bincn=function(r){i(typeof r=="number");var o=r%26,h=(r-o)/26,u=1<<o;if(this.length<=h)return this._expand(h+1),this.words[h]|=u,this;for(var c=u,g=h;c!==0&&g<this.length;g++){var b=this.words[g]|0;b+=c,c=b>>>26,b&=67108863,this.words[g]=b}return c!==0&&(this.words[g]=c,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(r){var o=r<0;if(this.negative!==0&&!o)return-1;if(this.negative===0&&o)return 1;this._strip();var h;if(this.length>1)h=1;else{o&&(r=-r),i(r<=67108863,"Number is too big");var u=this.words[0]|0;h=u===r?0:u<r?-1:1}return this.negative!==0?-h|0:h},n.prototype.cmp=function(r){if(this.negative!==0&&r.negative===0)return-1;if(this.negative===0&&r.negative!==0)return 1;var o=this.ucmp(r);return this.negative!==0?-o|0:o},n.prototype.ucmp=function(r){if(this.length>r.length)return 1;if(this.length<r.length)return-1;for(var o=0,h=this.length-1;h>=0;h--){var u=this.words[h]|0,c=r.words[h]|0;if(u!==c){u<c?o=-1:u>c&&(o=1);break}}return o},n.prototype.gtn=function(r){return this.cmpn(r)===1},n.prototype.gt=function(r){return this.cmp(r)===1},n.prototype.gten=function(r){return this.cmpn(r)>=0},n.prototype.gte=function(r){return this.cmp(r)>=0},n.prototype.ltn=function(r){return this.cmpn(r)===-1},n.prototype.lt=function(r){return this.cmp(r)===-1},n.prototype.lten=function(r){return this.cmpn(r)<=0},n.prototype.lte=function(r){return this.cmp(r)<=0},n.prototype.eqn=function(r){return this.cmpn(r)===0},n.prototype.eq=function(r){return this.cmp(r)===0},n.red=function(r){return new G(r)},n.prototype.toRed=function(r){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),r.convertTo(this)._forceRed(r)},n.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(r){return this.red=r,this},n.prototype.forceRed=function(r){return i(!this.red,"Already a number in reduction context"),this._forceRed(r)},n.prototype.redAdd=function(r){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,r)},n.prototype.redIAdd=function(r){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,r)},n.prototype.redSub=function(r){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,r)},n.prototype.redISub=function(r){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,r)},n.prototype.redShl=function(r){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,r)},n.prototype.redMul=function(r){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,r),this.red.mul(this,r)},n.prototype.redIMul=function(r){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,r),this.red.imul(this,r)},n.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(r){return i(this.red&&!r.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,r)};var Et={k256:null,p224:null,p192:null,p25519:null};function K(p,r){this.name=p,this.p=new n(r,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}K.prototype._tmp=function(){var r=new n(null);return r.words=new Array(Math.ceil(this.n/13)),r},K.prototype.ireduce=function(r){var o=r,h;do this.split(o,this.tmp),o=this.imulK(o),o=o.iadd(this.tmp),h=o.bitLength();while(h>this.n);var u=h<this.n?-1:o.ucmp(this.p);return u===0?(o.words[0]=0,o.length=1):u>0?o.isub(this.p):o.strip!==void 0?o.strip():o._strip(),o},K.prototype.split=function(r,o){r.iushrn(this.n,0,o)},K.prototype.imulK=function(r){return r.imul(this.k)};function Ot(){K.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(Ot,K),Ot.prototype.split=function(r,o){for(var h=4194303,u=Math.min(r.length,9),c=0;c<u;c++)o.words[c]=r.words[c];if(o.length=u,r.length<=9){r.words[0]=0,r.length=1;return}var g=r.words[9];for(o.words[o.length++]=g&h,c=10;c<r.length;c++){var b=r.words[c]|0;r.words[c-10]=(b&h)<<4|g>>>22,g=b}g>>>=22,r.words[c-10]=g,g===0&&r.length>10?r.length-=10:r.length-=9},Ot.prototype.imulK=function(r){r.words[r.length]=0,r.words[r.length+1]=0,r.length+=2;for(var o=0,h=0;h<r.length;h++){var u=r.words[h]|0;o+=u*977,r.words[h]=o&67108863,o=u*64+(o/67108864|0)}return r.words[r.length-1]===0&&(r.length--,r.words[r.length-1]===0&&r.length--),r};function qt(){K.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(qt,K);function Lt(){K.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(Lt,K);function ar(){K.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(ar,K),ar.prototype.imulK=function(r){for(var o=0,h=0;h<r.length;h++){var u=(r.words[h]|0)*19+o,c=u&67108863;u>>>=26,r.words[h]=c,o=u}return o!==0&&(r.words[r.length++]=o),r},n._prime=function(r){if(Et[r])return Et[r];var o;if(r==="k256")o=new Ot;else if(r==="p224")o=new qt;else if(r==="p192")o=new Lt;else if(r==="p25519")o=new ar;else throw new Error("Unknown prime "+r);return Et[r]=o,o};function G(p){if(typeof p=="string"){var r=n._prime(p);this.m=r.p,this.prime=r}else i(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}G.prototype._verify1=function(r){i(r.negative===0,"red works only with positives"),i(r.red,"red works only with red numbers")},G.prototype._verify2=function(r,o){i((r.negative|o.negative)===0,"red works only with positives"),i(r.red&&r.red===o.red,"red works only with red numbers")},G.prototype.imod=function(r){return this.prime?this.prime.ireduce(r)._forceRed(this):(w(r,r.umod(this.m)._forceRed(this)),r)},G.prototype.neg=function(r){return r.isZero()?r.clone():this.m.sub(r)._forceRed(this)},G.prototype.add=function(r,o){this._verify2(r,o);var h=r.add(o);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},G.prototype.iadd=function(r,o){this._verify2(r,o);var h=r.iadd(o);return h.cmp(this.m)>=0&&h.isub(this.m),h},G.prototype.sub=function(r,o){this._verify2(r,o);var h=r.sub(o);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},G.prototype.isub=function(r,o){this._verify2(r,o);var h=r.isub(o);return h.cmpn(0)<0&&h.iadd(this.m),h},G.prototype.shl=function(r,o){return this._verify1(r),this.imod(r.ushln(o))},G.prototype.imul=function(r,o){return this._verify2(r,o),this.imod(r.imul(o))},G.prototype.mul=function(r,o){return this._verify2(r,o),this.imod(r.mul(o))},G.prototype.isqr=function(r){return this.imul(r,r.clone())},G.prototype.sqr=function(r){return this.mul(r,r)},G.prototype.sqrt=function(r){if(r.isZero())return r.clone();var o=this.m.andln(3);if(i(o%2===1),o===3){var h=this.m.add(new n(1)).iushrn(2);return this.pow(r,h)}for(var u=this.m.subn(1),c=0;!u.isZero()&&u.andln(1)===0;)c++,u.iushrn(1);i(!u.isZero());var g=new n(1).toRed(this),b=g.redNeg(),d=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);this.pow(f,d).cmp(b)!==0;)f.redIAdd(b);for(var v=this.pow(f,u),B=this.pow(r,u.addn(1).iushrn(1)),a=this.pow(r,u),M=c;a.cmp(g)!==0;){for(var S=a,E=0;S.cmp(g)!==0;E++)S=S.redSqr();i(E<M);var R=this.pow(v,new n(1).iushln(M-E-1));B=B.redMul(R),v=R.redSqr(),a=a.redMul(v),M=E}return B},G.prototype.invm=function(r){var o=r._invmp(this.m);return o.negative!==0?(o.negative=0,this.imod(o).redNeg()):this.imod(o)},G.prototype.pow=function(r,o){if(o.isZero())return new n(1).toRed(this);if(o.cmpn(1)===0)return r.clone();var h=4,u=new Array(1<<h);u[0]=new n(1).toRed(this),u[1]=r;for(var c=2;c<u.length;c++)u[c]=this.mul(u[c-1],r);var g=u[0],b=0,d=0,f=o.bitLength()%26;for(f===0&&(f=26),c=o.length-1;c>=0;c--){for(var v=o.words[c],B=f-1;B>=0;B--){var a=v>>B&1;if(g!==u[0]&&(g=this.sqr(g)),a===0&&b===0){d=0;continue}b<<=1,b|=a,d++,!(d!==h&&(c!==0||B!==0))&&(g=this.mul(g,u[b]),d=0,b=0)}f=26}return g},G.prototype.convertTo=function(r){var o=r.umod(this.m);return o===r?o.clone():o},G.prototype.convertFrom=function(r){var o=r.clone();return o.red=null,o},n.mont=function(r){return new zt(r)};function zt(p){G.call(this,p),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(zt,G),zt.prototype.convertTo=function(r){return this.imod(r.ushln(this.shift))},zt.prototype.convertFrom=function(r){var o=this.imod(r.mul(this.rinv));return o.red=null,o},zt.prototype.imul=function(r,o){if(r.isZero()||o.isZero())return r.words[0]=0,r.length=1,r;var h=r.imul(o),u=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=h.isub(u).iushrn(this.shift),g=c;return c.cmp(this.m)>=0?g=c.isub(this.m):c.cmpn(0)<0&&(g=c.iadd(this.m)),g._forceRed(this)},zt.prototype.mul=function(r,o){if(r.isZero()||o.isZero())return new n(0)._forceRed(this);var h=r.mul(o),u=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=h.isub(u).iushrn(this.shift),g=c;return c.cmp(this.m)>=0?g=c.isub(this.m):c.cmpn(0)<0&&(g=c.iadd(this.m)),g._forceRed(this)},zt.prototype.invm=function(r){var o=this.imod(r._invmp(this.m).mul(this.r2));return o._forceRed(this)}})(typeof Fe>"u"||Fe,vi)});var gi=Ft((Lo,ne)=>{(function(){"use strict";var e="input is invalid type",t="finalize already called",i=typeof window=="object",s=i?window:{};s.JS_SHA3_NO_WINDOW&&(i=!1);var n=!i&&typeof self=="object",l=!s.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;l?s=global:n&&(s=self);var m=!s.JS_SHA3_NO_COMMON_JS&&typeof ne=="object"&&ne.exports,x=typeof define=="function"&&define.amd,y=!s.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",w="0123456789abcdef".split(""),A=[31,7936,2031616,520093696],_=[4,1024,262144,67108864],I=[1,256,65536,16777216],P=[6,1536,393216,100663296],N=[0,8,16,24],k=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],U=[224,256,384,512],C=[128,256],St=["hex","buffer","arrayBuffer","array","digest"],Rt={128:168,256:136};(s.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"}),y&&(s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(a){return typeof a=="object"&&a.buffer&&a.buffer.constructor===ArrayBuffer});for(var At=function(a,M,S){return function(E){return new f(a,M,a).update(E)[S]()}},Et=function(a,M,S){return function(E,R){return new f(a,M,R).update(E)[S]()}},K=function(a,M,S){return function(E,R,T,F){return r["cshake"+a].update(E,R,T,F)[S]()}},Ot=function(a,M,S){return function(E,R,T,F){return r["kmac"+a].update(E,R,T,F)[S]()}},qt=function(a,M,S,E){for(var R=0;R<St.length;++R){var T=St[R];a[T]=M(S,E,T)}return a},Lt=function(a,M){var S=At(a,M,"hex");return S.create=function(){return new f(a,M,a)},S.update=function(E){return S.create().update(E)},qt(S,At,a,M)},ar=function(a,M){var S=Et(a,M,"hex");return S.create=function(E){return new f(a,M,E)},S.update=function(E,R){return S.create(R).update(E)},qt(S,Et,a,M)},G=function(a,M){var S=Rt[a],E=K(a,M,"hex");return E.create=function(R,T,F){return!T&&!F?r["shake"+a].create(R):new f(a,M,R).bytepad([T,F],S)},E.update=function(R,T,F,O){return E.create(T,F,O).update(R)},qt(E,K,a,M)},zt=function(a,M){var S=Rt[a],E=Ot(a,M,"hex");return E.create=function(R,T,F){return new v(a,M,T).bytepad(["KMAC",F],S).bytepad([R],S)},E.update=function(R,T,F,O){return E.create(R,F,O).update(T)},qt(E,Ot,a,M)},p=[{name:"keccak",padding:I,bits:U,createMethod:Lt},{name:"sha3",padding:P,bits:U,createMethod:Lt},{name:"shake",padding:A,bits:C,createMethod:ar},{name:"cshake",padding:_,bits:C,createMethod:G},{name:"kmac",padding:_,bits:C,createMethod:zt}],r={},o=[],h=0;h<p.length;++h)for(var u=p[h],c=u.bits,g=0;g<c.length;++g){var b=u.name+"_"+c[g];if(o.push(b),r[b]=u.createMethod(c[g],u.padding),u.name!=="sha3"){var d=u.name+c[g];o.push(d),r[d]=r[b]}}function f(a,M,S){this.blocks=[],this.s=[],this.padding=M,this.outputBits=S,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(a<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=S>>5,this.extraBytes=(S&31)>>3;for(var E=0;E<50;++E)this.s[E]=0}f.prototype.update=function(a){if(this.finalized)throw new Error(t);var M,S=typeof a;if(S!=="string"){if(S==="object"){if(a===null)throw new Error(e);if(y&&a.constructor===ArrayBuffer)a=new Uint8Array(a);else if(!Array.isArray(a)&&(!y||!ArrayBuffer.isView(a)))throw new Error(e)}else throw new Error(e);M=!0}for(var E=this.blocks,R=this.byteCount,T=a.length,F=this.blockCount,O=0,It=this.s,q,L;O<T;){if(this.reset)for(this.reset=!1,E[0]=this.block,q=1;q<F+1;++q)E[q]=0;if(M)for(q=this.start;O<T&&q<R;++O)E[q>>2]|=a[O]<<N[q++&3];else for(q=this.start;O<T&&q<R;++O)L=a.charCodeAt(O),L<128?E[q>>2]|=L<<N[q++&3]:L<2048?(E[q>>2]|=(192|L>>6)<<N[q++&3],E[q>>2]|=(128|L&63)<<N[q++&3]):L<55296||L>=57344?(E[q>>2]|=(224|L>>12)<<N[q++&3],E[q>>2]|=(128|L>>6&63)<<N[q++&3],E[q>>2]|=(128|L&63)<<N[q++&3]):(L=65536+((L&1023)<<10|a.charCodeAt(++O)&1023),E[q>>2]|=(240|L>>18)<<N[q++&3],E[q>>2]|=(128|L>>12&63)<<N[q++&3],E[q>>2]|=(128|L>>6&63)<<N[q++&3],E[q>>2]|=(128|L&63)<<N[q++&3]);if(this.lastByteIndex=q,q>=R){for(this.start=q-R,this.block=E[F],q=0;q<F;++q)It[q]^=E[q];B(It),this.reset=!0}else this.start=q}return this},f.prototype.encode=function(a,M){var S=a&255,E=1,R=[S];for(a=a>>8,S=a&255;S>0;)R.unshift(S),a=a>>8,S=a&255,++E;return M?R.push(E):R.unshift(E),this.update(R),R.length},f.prototype.encodeString=function(a){var M,S=typeof a;if(S!=="string"){if(S==="object"){if(a===null)throw new Error(e);if(y&&a.constructor===ArrayBuffer)a=new Uint8Array(a);else if(!Array.isArray(a)&&(!y||!ArrayBuffer.isView(a)))throw new Error(e)}else throw new Error(e);M=!0}var E=0,R=a.length;if(M)E=R;else for(var T=0;T<a.length;++T){var F=a.charCodeAt(T);F<128?E+=1:F<2048?E+=2:F<55296||F>=57344?E+=3:(F=65536+((F&1023)<<10|a.charCodeAt(++T)&1023),E+=4)}return E+=this.encode(E*8),this.update(a),E},f.prototype.bytepad=function(a,M){for(var S=this.encode(M),E=0;E<a.length;++E)S+=this.encodeString(a[E]);var R=M-S%M,T=[];return T.length=R,this.update(T),this},f.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var a=this.blocks,M=this.lastByteIndex,S=this.blockCount,E=this.s;if(a[M>>2]|=this.padding[M&3],this.lastByteIndex===this.byteCount)for(a[0]=a[S],M=1;M<S+1;++M)a[M]=0;for(a[S-1]|=2147483648,M=0;M<S;++M)E[M]^=a[M];B(E)}},f.prototype.toString=f.prototype.hex=function(){this.finalize();for(var a=this.blockCount,M=this.s,S=this.outputBlocks,E=this.extraBytes,R=0,T=0,F="",O;T<S;){for(R=0;R<a&&T<S;++R,++T)O=M[R],F+=w[O>>4&15]+w[O&15]+w[O>>12&15]+w[O>>8&15]+w[O>>20&15]+w[O>>16&15]+w[O>>28&15]+w[O>>24&15];T%a===0&&(B(M),R=0)}return E&&(O=M[R],F+=w[O>>4&15]+w[O&15],E>1&&(F+=w[O>>12&15]+w[O>>8&15]),E>2&&(F+=w[O>>20&15]+w[O>>16&15])),F},f.prototype.arrayBuffer=function(){this.finalize();var a=this.blockCount,M=this.s,S=this.outputBlocks,E=this.extraBytes,R=0,T=0,F=this.outputBits>>3,O;E?O=new ArrayBuffer(S+1<<2):O=new ArrayBuffer(F);for(var It=new Uint32Array(O);T<S;){for(R=0;R<a&&T<S;++R,++T)It[T]=M[R];T%a===0&&B(M)}return E&&(It[R]=M[R],O=O.slice(0,F)),O},f.prototype.buffer=f.prototype.arrayBuffer,f.prototype.digest=f.prototype.array=function(){this.finalize();for(var a=this.blockCount,M=this.s,S=this.outputBlocks,E=this.extraBytes,R=0,T=0,F=[],O,It;T<S;){for(R=0;R<a&&T<S;++R,++T)O=T<<2,It=M[R],F[O]=It&255,F[O+1]=It>>8&255,F[O+2]=It>>16&255,F[O+3]=It>>24&255;T%a===0&&B(M)}return E&&(O=T<<2,It=M[R],F[O]=It&255,E>1&&(F[O+1]=It>>8&255),E>2&&(F[O+2]=It>>16&255)),F};function v(a,M,S){f.call(this,a,M,S)}v.prototype=new f,v.prototype.finalize=function(){return this.encode(this.outputBits,!0),f.prototype.finalize.call(this)};var B=function(a){var M,S,E,R,T,F,O,It,q,L,xr,J,Z,br,W,X,yr,V,j,wr,$,Y,Mr,Q,tt,_r,rt,et,Ar,it,nt,Sr,ft,ot,Er,st,at,Ir,ht,ut,Nr,lt,ct,Pr,dt,vt,Rr,pt,mt,Or,gt,xt,Fr,bt,yt,kr,wt,Mt,hr,ur,lr,cr,dr;for(E=0;E<48;E+=2)R=a[0]^a[10]^a[20]^a[30]^a[40],T=a[1]^a[11]^a[21]^a[31]^a[41],F=a[2]^a[12]^a[22]^a[32]^a[42],O=a[3]^a[13]^a[23]^a[33]^a[43],It=a[4]^a[14]^a[24]^a[34]^a[44],q=a[5]^a[15]^a[25]^a[35]^a[45],L=a[6]^a[16]^a[26]^a[36]^a[46],xr=a[7]^a[17]^a[27]^a[37]^a[47],J=a[8]^a[18]^a[28]^a[38]^a[48],Z=a[9]^a[19]^a[29]^a[39]^a[49],M=J^(F<<1|O>>>31),S=Z^(O<<1|F>>>31),a[0]^=M,a[1]^=S,a[10]^=M,a[11]^=S,a[20]^=M,a[21]^=S,a[30]^=M,a[31]^=S,a[40]^=M,a[41]^=S,M=R^(It<<1|q>>>31),S=T^(q<<1|It>>>31),a[2]^=M,a[3]^=S,a[12]^=M,a[13]^=S,a[22]^=M,a[23]^=S,a[32]^=M,a[33]^=S,a[42]^=M,a[43]^=S,M=F^(L<<1|xr>>>31),S=O^(xr<<1|L>>>31),a[4]^=M,a[5]^=S,a[14]^=M,a[15]^=S,a[24]^=M,a[25]^=S,a[34]^=M,a[35]^=S,a[44]^=M,a[45]^=S,M=It^(J<<1|Z>>>31),S=q^(Z<<1|J>>>31),a[6]^=M,a[7]^=S,a[16]^=M,a[17]^=S,a[26]^=M,a[27]^=S,a[36]^=M,a[37]^=S,a[46]^=M,a[47]^=S,M=L^(R<<1|T>>>31),S=xr^(T<<1|R>>>31),a[8]^=M,a[9]^=S,a[18]^=M,a[19]^=S,a[28]^=M,a[29]^=S,a[38]^=M,a[39]^=S,a[48]^=M,a[49]^=S,br=a[0],W=a[1],vt=a[11]<<4|a[10]>>>28,Rr=a[10]<<4|a[11]>>>28,et=a[20]<<3|a[21]>>>29,Ar=a[21]<<3|a[20]>>>29,ur=a[31]<<9|a[30]>>>23,lr=a[30]<<9|a[31]>>>23,lt=a[40]<<18|a[41]>>>14,ct=a[41]<<18|a[40]>>>14,ot=a[2]<<1|a[3]>>>31,Er=a[3]<<1|a[2]>>>31,X=a[13]<<12|a[12]>>>20,yr=a[12]<<12|a[13]>>>20,pt=a[22]<<10|a[23]>>>22,mt=a[23]<<10|a[22]>>>22,it=a[33]<<13|a[32]>>>19,nt=a[32]<<13|a[33]>>>19,cr=a[42]<<2|a[43]>>>30,dr=a[43]<<2|a[42]>>>30,bt=a[5]<<30|a[4]>>>2,yt=a[4]<<30|a[5]>>>2,st=a[14]<<6|a[15]>>>26,at=a[15]<<6|a[14]>>>26,V=a[25]<<11|a[24]>>>21,j=a[24]<<11|a[25]>>>21,Or=a[34]<<15|a[35]>>>17,gt=a[35]<<15|a[34]>>>17,Sr=a[45]<<29|a[44]>>>3,ft=a[44]<<29|a[45]>>>3,Q=a[6]<<28|a[7]>>>4,tt=a[7]<<28|a[6]>>>4,kr=a[17]<<23|a[16]>>>9,wt=a[16]<<23|a[17]>>>9,Ir=a[26]<<25|a[27]>>>7,ht=a[27]<<25|a[26]>>>7,wr=a[36]<<21|a[37]>>>11,$=a[37]<<21|a[36]>>>11,xt=a[47]<<24|a[46]>>>8,Fr=a[46]<<24|a[47]>>>8,Pr=a[8]<<27|a[9]>>>5,dt=a[9]<<27|a[8]>>>5,_r=a[18]<<20|a[19]>>>12,rt=a[19]<<20|a[18]>>>12,Mt=a[29]<<7|a[28]>>>25,hr=a[28]<<7|a[29]>>>25,ut=a[38]<<8|a[39]>>>24,Nr=a[39]<<8|a[38]>>>24,Y=a[48]<<14|a[49]>>>18,Mr=a[49]<<14|a[48]>>>18,a[0]=br^~X&V,a[1]=W^~yr&j,a[10]=Q^~_r&et,a[11]=tt^~rt&Ar,a[20]=ot^~st&Ir,a[21]=Er^~at&ht,a[30]=Pr^~vt&pt,a[31]=dt^~Rr&mt,a[40]=bt^~kr&Mt,a[41]=yt^~wt&hr,a[2]=X^~V&wr,a[3]=yr^~j&$,a[12]=_r^~et&it,a[13]=rt^~Ar&nt,a[22]=st^~Ir&ut,a[23]=at^~ht&Nr,a[32]=vt^~pt&Or,a[33]=Rr^~mt&gt,a[42]=kr^~Mt&ur,a[43]=wt^~hr&lr,a[4]=V^~wr&Y,a[5]=j^~$&Mr,a[14]=et^~it&Sr,a[15]=Ar^~nt&ft,a[24]=Ir^~ut&lt,a[25]=ht^~Nr&ct,a[34]=pt^~Or&xt,a[35]=mt^~gt&Fr,a[44]=Mt^~ur&cr,a[45]=hr^~lr&dr,a[6]=wr^~Y&br,a[7]=$^~Mr&W,a[16]=it^~Sr&Q,a[17]=nt^~ft&tt,a[26]=ut^~lt&ot,a[27]=Nr^~ct&Er,a[36]=Or^~xt&Pr,a[37]=gt^~Fr&dt,a[46]=ur^~cr&bt,a[47]=lr^~dr&yt,a[8]=Y^~br&X,a[9]=Mr^~W&yr,a[18]=Sr^~Q&_r,a[19]=ft^~tt&rt,a[28]=lt^~ot&st,a[29]=ct^~Er&at,a[38]=xt^~Pr&vt,a[39]=Fr^~dt&Rr,a[48]=cr^~bt&kr,a[49]=dr^~yt&wt,a[0]^=k[E],a[1]^=k[E+1]};if(m)ne.exports=r;else{for(h=0;h<o.length;++h)s[o[h]]=r[o[h]];x&&define(function(){return r})}})()});var Ur=Ft((m0,Pi)=>{Pi.exports=Ni;function Ni(e,t){if(!e)throw new Error(t||"Assertion failed")}Ni.equal=function(t,i,s){if(t!=i)throw new Error(s||"Assertion failed: "+t+" != "+i)}});var Ri=Ft((g0,Ce)=>{typeof Object.create=="function"?Ce.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Ce.exports=function(t,i){if(i){t.super_=i;var s=function(){};s.prototype=i.prototype,t.prototype=new s,t.prototype.constructor=t}}});var Wt=Ft(H=>{"use strict";var zn=Ur(),Kn=Ri();H.inherits=Kn;function Hn(e,t){return(e.charCodeAt(t)&64512)!==55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)===56320}function Gn(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var i=[];if(typeof e=="string")if(t){if(t==="hex")for(e=e.replace(/[^a-z0-9]+/ig,""),e.length%2!==0&&(e="0"+e),n=0;n<e.length;n+=2)i.push(parseInt(e[n]+e[n+1],16))}else for(var s=0,n=0;n<e.length;n++){var l=e.charCodeAt(n);l<128?i[s++]=l:l<2048?(i[s++]=l>>6|192,i[s++]=l&63|128):Hn(e,n)?(l=65536+((l&1023)<<10)+(e.charCodeAt(++n)&1023),i[s++]=l>>18|240,i[s++]=l>>12&63|128,i[s++]=l>>6&63|128,i[s++]=l&63|128):(i[s++]=l>>12|224,i[s++]=l>>6&63|128,i[s++]=l&63|128)}else for(n=0;n<e.length;n++)i[n]=e[n]|0;return i}H.toArray=Gn;function Jn(e){for(var t="",i=0;i<e.length;i++)t+=Fi(e[i].toString(16));return t}H.toHex=Jn;function Oi(e){var t=e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24;return t>>>0}H.htonl=Oi;function Zn(e,t){for(var i="",s=0;s<e.length;s++){var n=e[s];t==="little"&&(n=Oi(n)),i+=ki(n.toString(16))}return i}H.toHex32=Zn;function Fi(e){return e.length===1?"0"+e:e}H.zero2=Fi;function ki(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}H.zero8=ki;function Wn(e,t,i,s){var n=i-t;zn(n%4===0);for(var l=new Array(n/4),m=0,x=t;m<l.length;m++,x+=4){var y;s==="big"?y=e[x]<<24|e[x+1]<<16|e[x+2]<<8|e[x+3]:y=e[x+3]<<24|e[x+2]<<16|e[x+1]<<8|e[x],l[m]=y>>>0}return l}H.join32=Wn;function Xn(e,t){for(var i=new Array(e.length*4),s=0,n=0;s<e.length;s++,n+=4){var l=e[s];t==="big"?(i[n]=l>>>24,i[n+1]=l>>>16&255,i[n+2]=l>>>8&255,i[n+3]=l&255):(i[n+3]=l>>>24,i[n+2]=l>>>16&255,i[n+1]=l>>>8&255,i[n]=l&255)}return i}H.split32=Xn;function Vn(e,t){return e>>>t|e<<32-t}H.rotr32=Vn;function jn(e,t){return e<<t|e>>>32-t}H.rotl32=jn;function $n(e,t){return e+t>>>0}H.sum32=$n;function Yn(e,t,i){return e+t+i>>>0}H.sum32_3=Yn;function Qn(e,t,i,s){return e+t+i+s>>>0}H.sum32_4=Qn;function tf(e,t,i,s,n){return e+t+i+s+n>>>0}H.sum32_5=tf;function rf(e,t,i,s){var n=e[t],l=e[t+1],m=s+l>>>0,x=(m<s?1:0)+i+n;e[t]=x>>>0,e[t+1]=m}H.sum64=rf;function ef(e,t,i,s){var n=t+s>>>0,l=(n<t?1:0)+e+i;return l>>>0}H.sum64_hi=ef;function nf(e,t,i,s){var n=t+s;return n>>>0}H.sum64_lo=nf;function ff(e,t,i,s,n,l,m,x){var y=0,w=t;w=w+s>>>0,y+=w<t?1:0,w=w+l>>>0,y+=w<l?1:0,w=w+x>>>0,y+=w<x?1:0;var A=e+i+n+m+y;return A>>>0}H.sum64_4_hi=ff;function of(e,t,i,s,n,l,m,x){var y=t+s+l+x;return y>>>0}H.sum64_4_lo=of;function sf(e,t,i,s,n,l,m,x,y,w){var A=0,_=t;_=_+s>>>0,A+=_<t?1:0,_=_+l>>>0,A+=_<l?1:0,_=_+x>>>0,A+=_<x?1:0,_=_+w>>>0,A+=_<w?1:0;var I=e+i+n+m+y+A;return I>>>0}H.sum64_5_hi=sf;function af(e,t,i,s,n,l,m,x,y,w){var A=t+s+l+x+w;return A>>>0}H.sum64_5_lo=af;function hf(e,t,i){var s=t<<32-i|e>>>i;return s>>>0}H.rotr64_hi=hf;function uf(e,t,i){var s=e<<32-i|t>>>i;return s>>>0}H.rotr64_lo=uf;function lf(e,t,i){return e>>>i}H.shr64_hi=lf;function cf(e,t,i){var s=e<<32-i|t>>>i;return s>>>0}H.shr64_lo=cf});var zr=Ft(qi=>{"use strict";var Bi=Wt(),df=Ur();function fe(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}qi.BlockHash=fe;fe.prototype.update=function(t,i){if(t=Bi.toArray(t,i),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var s=t.length%this._delta8;this.pending=t.slice(t.length-s,t.length),this.pending.length===0&&(this.pending=null),t=Bi.join32(t,0,t.length-s,this.endian);for(var n=0;n<t.length;n+=this._delta32)this._update(t,n,n+this._delta32)}return this};fe.prototype.digest=function(t){return this.update(this._pad()),df(this.pending===null),this._digest(t)};fe.prototype._pad=function(){var t=this.pendingTotal,i=this._delta8,s=i-(t+this.padLength)%i,n=new Array(s+this.padLength);n[0]=128;for(var l=1;l<s;l++)n[l]=0;if(t<<=3,this.endian==="big"){for(var m=8;m<this.padLength;m++)n[l++]=0;n[l++]=0,n[l++]=0,n[l++]=0,n[l++]=0,n[l++]=t>>>24&255,n[l++]=t>>>16&255,n[l++]=t>>>8&255,n[l++]=t&255}else for(n[l++]=t&255,n[l++]=t>>>8&255,n[l++]=t>>>16&255,n[l++]=t>>>24&255,n[l++]=0,n[l++]=0,n[l++]=0,n[l++]=0,m=8;m<this.padLength;m++)n[l++]=0;return n}});var Le=Ft(fr=>{"use strict";var vf=Wt(),$t=vf.rotr32;function pf(e,t,i,s){if(e===0)return Ti(t,i,s);if(e===1||e===3)return Li(t,i,s);if(e===2)return Ci(t,i,s)}fr.ft_1=pf;function Ti(e,t,i){return e&t^~e&i}fr.ch32=Ti;function Ci(e,t,i){return e&t^e&i^t&i}fr.maj32=Ci;function Li(e,t,i){return e^t^i}fr.p32=Li;function mf(e){return $t(e,2)^$t(e,13)^$t(e,22)}fr.s0_256=mf;function gf(e){return $t(e,6)^$t(e,11)^$t(e,25)}fr.s1_256=gf;function xf(e){return $t(e,7)^$t(e,18)^e>>>3}fr.g0_256=xf;function bf(e){return $t(e,17)^$t(e,19)^e>>>10}fr.g1_256=bf});var zi=Ft((w0,Ui)=>{"use strict";var Kr=Wt(),yf=zr(),wf=Le(),De=Kr.rotl32,$r=Kr.sum32,Mf=Kr.sum32_5,_f=wf.ft_1,Di=yf.BlockHash,Af=[1518500249,1859775393,2400959708,3395469782];function Yt(){if(!(this instanceof Yt))return new Yt;Di.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Kr.inherits(Yt,Di);Ui.exports=Yt;Yt.blockSize=512;Yt.outSize=160;Yt.hmacStrength=80;Yt.padLength=64;Yt.prototype._update=function(t,i){for(var s=this.W,n=0;n<16;n++)s[n]=t[i+n];for(;n<s.length;n++)s[n]=De(s[n-3]^s[n-8]^s[n-14]^s[n-16],1);var l=this.h[0],m=this.h[1],x=this.h[2],y=this.h[3],w=this.h[4];for(n=0;n<s.length;n++){var A=~~(n/20),_=Mf(De(l,5),_f(A,m,x,y),w,s[n],Af[A]);w=y,y=x,x=De(m,30),m=l,l=_}this.h[0]=$r(this.h[0],l),this.h[1]=$r(this.h[1],m),this.h[2]=$r(this.h[2],x),this.h[3]=$r(this.h[3],y),this.h[4]=$r(this.h[4],w)};Yt.prototype._digest=function(t){return t==="hex"?Kr.toHex32(this.h,"big"):Kr.split32(this.h,"big")}});var Ue=Ft((M0,Hi)=>{"use strict";var Hr=Wt(),Sf=zr(),Gr=Le(),Ef=Ur(),Xt=Hr.sum32,If=Hr.sum32_4,Nf=Hr.sum32_5,Pf=Gr.ch32,Rf=Gr.maj32,Of=Gr.s0_256,Ff=Gr.s1_256,kf=Gr.g0_256,Bf=Gr.g1_256,Ki=Sf.BlockHash,qf=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Qt(){if(!(this instanceof Qt))return new Qt;Ki.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=qf,this.W=new Array(64)}Hr.inherits(Qt,Ki);Hi.exports=Qt;Qt.blockSize=512;Qt.outSize=256;Qt.hmacStrength=192;Qt.padLength=64;Qt.prototype._update=function(t,i){for(var s=this.W,n=0;n<16;n++)s[n]=t[i+n];for(;n<s.length;n++)s[n]=If(Bf(s[n-2]),s[n-7],kf(s[n-15]),s[n-16]);var l=this.h[0],m=this.h[1],x=this.h[2],y=this.h[3],w=this.h[4],A=this.h[5],_=this.h[6],I=this.h[7];for(Ef(this.k.length===s.length),n=0;n<s.length;n++){var P=Nf(I,Ff(w),Pf(w,A,_),this.k[n],s[n]),N=Xt(Of(l),Rf(l,m,x));I=_,_=A,A=w,w=Xt(y,P),y=x,x=m,m=l,l=Xt(P,N)}this.h[0]=Xt(this.h[0],l),this.h[1]=Xt(this.h[1],m),this.h[2]=Xt(this.h[2],x),this.h[3]=Xt(this.h[3],y),this.h[4]=Xt(this.h[4],w),this.h[5]=Xt(this.h[5],A),this.h[6]=Xt(this.h[6],_),this.h[7]=Xt(this.h[7],I)};Qt.prototype._digest=function(t){return t==="hex"?Hr.toHex32(this.h,"big"):Hr.split32(this.h,"big")}});var Zi=Ft((_0,Ji)=>{"use strict";var ze=Wt(),Gi=Ue();function or(){if(!(this instanceof or))return new or;Gi.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}ze.inherits(or,Gi);Ji.exports=or;or.blockSize=512;or.outSize=224;or.hmacStrength=192;or.padLength=64;or.prototype._digest=function(t){return t==="hex"?ze.toHex32(this.h.slice(0,7),"big"):ze.split32(this.h.slice(0,7),"big")}});var Ge=Ft((A0,ji)=>{"use strict";var Dt=Wt(),Tf=zr(),Cf=Ur(),tr=Dt.rotr64_hi,rr=Dt.rotr64_lo,Wi=Dt.shr64_hi,Xi=Dt.shr64_lo,pr=Dt.sum64,Ke=Dt.sum64_hi,He=Dt.sum64_lo,Lf=Dt.sum64_4_hi,Df=Dt.sum64_4_lo,Uf=Dt.sum64_5_hi,zf=Dt.sum64_5_lo,Vi=Tf.BlockHash,Kf=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Vt(){if(!(this instanceof Vt))return new Vt;Vi.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Kf,this.W=new Array(160)}Dt.inherits(Vt,Vi);ji.exports=Vt;Vt.blockSize=1024;Vt.outSize=512;Vt.hmacStrength=192;Vt.padLength=128;Vt.prototype._prepareBlock=function(t,i){for(var s=this.W,n=0;n<32;n++)s[n]=t[i+n];for(;n<s.length;n+=2){var l=Qf(s[n-4],s[n-3]),m=to(s[n-4],s[n-3]),x=s[n-14],y=s[n-13],w=$f(s[n-30],s[n-29]),A=Yf(s[n-30],s[n-29]),_=s[n-32],I=s[n-31];s[n]=Lf(l,m,x,y,w,A,_,I),s[n+1]=Df(l,m,x,y,w,A,_,I)}};Vt.prototype._update=function(t,i){this._prepareBlock(t,i);var s=this.W,n=this.h[0],l=this.h[1],m=this.h[2],x=this.h[3],y=this.h[4],w=this.h[5],A=this.h[6],_=this.h[7],I=this.h[8],P=this.h[9],N=this.h[10],k=this.h[11],U=this.h[12],C=this.h[13],St=this.h[14],Rt=this.h[15];Cf(this.k.length===s.length);for(var At=0;At<s.length;At+=2){var Et=St,K=Rt,Ot=Vf(I,P),qt=jf(I,P),Lt=Hf(I,P,N,k,U,C),ar=Gf(I,P,N,k,U,C),G=this.k[At],zt=this.k[At+1],p=s[At],r=s[At+1],o=Uf(Et,K,Ot,qt,Lt,ar,G,zt,p,r),h=zf(Et,K,Ot,qt,Lt,ar,G,zt,p,r);Et=Wf(n,l),K=Xf(n,l),Ot=Jf(n,l,m,x,y,w),qt=Zf(n,l,m,x,y,w);var u=Ke(Et,K,Ot,qt),c=He(Et,K,Ot,qt);St=U,Rt=C,U=N,C=k,N=I,k=P,I=Ke(A,_,o,h),P=He(_,_,o,h),A=y,_=w,y=m,w=x,m=n,x=l,n=Ke(o,h,u,c),l=He(o,h,u,c)}pr(this.h,0,n,l),pr(this.h,2,m,x),pr(this.h,4,y,w),pr(this.h,6,A,_),pr(this.h,8,I,P),pr(this.h,10,N,k),pr(this.h,12,U,C),pr(this.h,14,St,Rt)};Vt.prototype._digest=function(t){return t==="hex"?Dt.toHex32(this.h,"big"):Dt.split32(this.h,"big")};function Hf(e,t,i,s,n){var l=e&i^~e&n;return l<0&&(l+=4294967296),l}function Gf(e,t,i,s,n,l){var m=t&s^~t&l;return m<0&&(m+=4294967296),m}function Jf(e,t,i,s,n){var l=e&i^e&n^i&n;return l<0&&(l+=4294967296),l}function Zf(e,t,i,s,n,l){var m=t&s^t&l^s&l;return m<0&&(m+=4294967296),m}function Wf(e,t){var i=tr(e,t,28),s=tr(t,e,2),n=tr(t,e,7),l=i^s^n;return l<0&&(l+=4294967296),l}function Xf(e,t){var i=rr(e,t,28),s=rr(t,e,2),n=rr(t,e,7),l=i^s^n;return l<0&&(l+=4294967296),l}function Vf(e,t){var i=tr(e,t,14),s=tr(e,t,18),n=tr(t,e,9),l=i^s^n;return l<0&&(l+=4294967296),l}function jf(e,t){var i=rr(e,t,14),s=rr(e,t,18),n=rr(t,e,9),l=i^s^n;return l<0&&(l+=4294967296),l}function $f(e,t){var i=tr(e,t,1),s=tr(e,t,8),n=Wi(e,t,7),l=i^s^n;return l<0&&(l+=4294967296),l}function Yf(e,t){var i=rr(e,t,1),s=rr(e,t,8),n=Xi(e,t,7),l=i^s^n;return l<0&&(l+=4294967296),l}function Qf(e,t){var i=tr(e,t,19),s=tr(t,e,29),n=Wi(e,t,6),l=i^s^n;return l<0&&(l+=4294967296),l}function to(e,t){var i=rr(e,t,19),s=rr(t,e,29),n=Xi(e,t,6),l=i^s^n;return l<0&&(l+=4294967296),l}});var Qi=Ft((S0,Yi)=>{"use strict";var Je=Wt(),$i=Ge();function sr(){if(!(this instanceof sr))return new sr;$i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Je.inherits(sr,$i);Yi.exports=sr;sr.blockSize=1024;sr.outSize=384;sr.hmacStrength=192;sr.padLength=128;sr.prototype._digest=function(t){return t==="hex"?Je.toHex32(this.h.slice(0,12),"big"):Je.split32(this.h.slice(0,12),"big")}});var tn=Ft(Jr=>{"use strict";Jr.sha1=zi();Jr.sha224=Zi();Jr.sha256=Ue();Jr.sha384=Qi();Jr.sha512=Ge()});var sn=Ft(on=>{"use strict";var qr=Wt(),ro=zr(),oe=qr.rotl32,rn=qr.sum32,Yr=qr.sum32_3,en=qr.sum32_4,fn=ro.BlockHash;function er(){if(!(this instanceof er))return new er;fn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}qr.inherits(er,fn);on.ripemd160=er;er.blockSize=512;er.outSize=160;er.hmacStrength=192;er.padLength=64;er.prototype._update=function(t,i){for(var s=this.h[0],n=this.h[1],l=this.h[2],m=this.h[3],x=this.h[4],y=s,w=n,A=l,_=m,I=x,P=0;P<80;P++){var N=rn(oe(en(s,nn(P,n,l,m),t[no[P]+i],eo(P)),oo[P]),x);s=x,x=m,m=oe(l,10),l=n,n=N,N=rn(oe(en(y,nn(79-P,w,A,_),t[fo[P]+i],io(P)),so[P]),I),y=I,I=_,_=oe(A,10),A=w,w=N}N=Yr(this.h[1],l,_),this.h[1]=Yr(this.h[2],m,I),this.h[2]=Yr(this.h[3],x,y),this.h[3]=Yr(this.h[4],s,w),this.h[4]=Yr(this.h[0],n,A),this.h[0]=N};er.prototype._digest=function(t){return t==="hex"?qr.toHex32(this.h,"little"):qr.split32(this.h,"little")};function nn(e,t,i,s){return e<=15?t^i^s:e<=31?t&i|~t&s:e<=47?(t|~i)^s:e<=63?t&s|i&~s:t^(i|~s)}function eo(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function io(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var no=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],fo=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],oo=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],so=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var hn=Ft((N0,an)=>{"use strict";var ao=Wt(),ho=Ur();function Zr(e,t,i){if(!(this instanceof Zr))return new Zr(e,t,i);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(ao.toArray(t,i))}an.exports=Zr;Zr.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),ho(t.length<=this.blockSize);for(var i=t.length;i<this.blockSize;i++)t.push(0);for(i=0;i<t.length;i++)t[i]^=54;for(this.inner=new this.Hash().update(t),i=0;i<t.length;i++)t[i]^=106;this.outer=new this.Hash().update(t)};Zr.prototype.update=function(t,i){return this.inner.update(t,i),this};Zr.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}});var ln=Ft(un=>{var kt=un;kt.utils=Wt();kt.common=zr();kt.sha=tn();kt.ripemd=sn();kt.hmac=hn();kt.sha1=kt.sha.sha1;kt.sha256=kt.sha.sha256;kt.sha224=kt.sha.sha224;kt.sha384=kt.sha.sha384;kt.sha512=kt.sha.sha512;kt.ripemd160=kt.ripemd.ripemd160});var ii="logger/5.7.0";var ni=!1,fi=!1,te={debug:1,default:2,info:2,warning:3,error:4,off:5},oi=te.default,Ie=null;function Rn(){try{let e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}var si=Rn(),Ne;(function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"})(Ne||(Ne={}));var Jt;(function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"})(Jt||(Jt={}));var ai="0123456789abcdef",z=class{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,i){let s=t.toLowerCase();te[s]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(oi>te[s])&&console.log.apply(console,i)}debug(...t){this._log(z.levels.DEBUG,t)}info(...t){this._log(z.levels.INFO,t)}warn(...t){this._log(z.levels.WARNING,t)}makeError(t,i,s){if(fi)return this.makeError("censored error",i,{});i||(i=z.errors.UNKNOWN_ERROR),s||(s={});let n=[];Object.keys(s).forEach(y=>{let w=s[y];try{if(w instanceof Uint8Array){let A="";for(let _=0;_<w.length;_++)A+=ai[w[_]>>4],A+=ai[w[_]&15];n.push(y+"=Uint8Array(0x"+A+")")}else n.push(y+"="+JSON.stringify(w))}catch{n.push(y+"="+JSON.stringify(s[y].toString()))}}),n.push(`code=${i}`),n.push(`version=${this.version}`);let l=t,m="";switch(i){case Jt.NUMERIC_FAULT:{m="NUMERIC_FAULT";let y=t;switch(y){case"overflow":case"underflow":case"division-by-zero":m+="-"+y;break;case"negative-power":case"negative-width":m+="-unsupported";break;case"unbound-bitwise-result":m+="-unbound-result";break}break}case Jt.CALL_EXCEPTION:case Jt.INSUFFICIENT_FUNDS:case Jt.MISSING_NEW:case Jt.NONCE_EXPIRED:case Jt.REPLACEMENT_UNDERPRICED:case Jt.TRANSACTION_REPLACED:case Jt.UNPREDICTABLE_GAS_LIMIT:m=i;break}m&&(t+=" [ See: https://links.ethers.org/v5-errors-"+m+" ]"),n.length&&(t+=" ("+n.join(", ")+")");let x=new Error(t);return x.reason=l,x.code=i,Object.keys(s).forEach(function(y){x[y]=s[y]}),x}throwError(t,i,s){throw this.makeError(t,i,s)}throwArgumentError(t,i,s){return this.throwError(t,z.errors.INVALID_ARGUMENT,{argument:i,value:s})}assert(t,i,s,n){t||this.throwError(i,s,n)}assertArgument(t,i,s,n){t||this.throwArgumentError(i,s,n)}checkNormalize(t){t==null&&(t="platform missing String.prototype.normalize"),si&&this.throwError("platform missing String.prototype.normalize",z.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:si})}checkSafeUint53(t,i){typeof t=="number"&&(i==null&&(i="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(i,z.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(i,z.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,i,s){s?s=": "+s:s="",t<i&&this.throwError("missing argument"+s,z.errors.MISSING_ARGUMENT,{count:t,expectedCount:i}),t>i&&this.throwError("too many arguments"+s,z.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:i})}checkNew(t,i){(t===Object||t==null)&&this.throwError("missing new",z.errors.MISSING_NEW,{name:i.name})}checkAbstract(t,i){t===i?this.throwError("cannot instantiate abstract class "+JSON.stringify(i.name)+" directly; use a sub-class",z.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",z.errors.MISSING_NEW,{name:i.name})}static globalLogger(){return Ie||(Ie=new z(ii)),Ie}static setCensorship(t,i){if(!t&&i&&this.globalLogger().throwError("cannot permanently disable censorship",z.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ni){if(!t)return;this.globalLogger().throwError("error censorship permanent",z.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fi=!!t,ni=!!i}static setLogLevel(t){let i=te[t.toLowerCase()];if(i==null){z.globalLogger().warn("invalid log level - "+t);return}oi=i}static from(t){return new z(t)}};z.errors=Jt;z.levels=Ne;var hi="bytes/5.7.0";var Nt=new z(hi);function li(e){return!!e.toHexString}function Cr(e){return e.slice||(e.slice=function(){let t=Array.prototype.slice.call(arguments);return Cr(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function ci(e){return Zt(e)&&!(e.length%2)||Re(e)}function ui(e){return typeof e=="number"&&e==e&&e%1===0}function Re(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!ui(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){let i=e[t];if(!ui(i)||i<0||i>=256)return!1}return!0}function _t(e,t){if(t||(t={}),typeof e=="number"){Nt.checkSafeUint53(e,"invalid arrayify value");let i=[];for(;e;)i.unshift(e&255),e=parseInt(String(e/256));return i.length===0&&i.push(0),Cr(new Uint8Array(i))}if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),li(e)&&(e=e.toHexString()),Zt(e)){let i=e.substring(2);i.length%2&&(t.hexPad==="left"?i="0"+i:t.hexPad==="right"?i+="0":Nt.throwArgumentError("hex data is odd-length","value",e));let s=[];for(let n=0;n<i.length;n+=2)s.push(parseInt(i.substring(n,n+2),16));return Cr(new Uint8Array(s))}return Re(e)?Cr(new Uint8Array(e)):Nt.throwArgumentError("invalid arrayify value","value",e)}function Oe(e){let t=e.map(n=>_t(n)),i=t.reduce((n,l)=>n+l.length,0),s=new Uint8Array(i);return t.reduce((n,l)=>(s.set(l,n),n+l.length),0),Cr(s)}function On(e,t){e=_t(e),e.length>t&&Nt.throwArgumentError("value out of range","value",arguments[0]);let i=new Uint8Array(t);return i.set(e,t-e.length),Cr(i)}function Zt(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}var Pe="0123456789abcdef";function Tt(e,t){if(t||(t={}),typeof e=="number"){Nt.checkSafeUint53(e,"invalid hexlify value");let i="";for(;e;)i=Pe[e&15]+i,e=Math.floor(e/16);return i.length?(i.length%2&&(i="0"+i),"0x"+i):"0x00"}if(typeof e=="bigint")return e=e.toString(16),e.length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),li(e))return e.toHexString();if(Zt(e))return e.length%2&&(t.hexPad==="left"?e="0x0"+e.substring(2):t.hexPad==="right"?e+="0":Nt.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Re(e)){let i="0x";for(let s=0;s<e.length;s++){let n=e[s];i+=Pe[(n&240)>>4]+Pe[n&15]}return i}return Nt.throwArgumentError("invalid hexlify value","value",e)}function re(e){if(typeof e!="string")e=Tt(e);else if(!Zt(e)||e.length%2)return null;return(e.length-2)/2}function ee(e,t,i){return typeof e!="string"?e=Tt(e):(!Zt(e)||e.length%2)&&Nt.throwArgumentError("invalid hexData","value",e),t=2+2*t,i!=null?"0x"+e.substring(t,2+2*i):"0x"+e.substring(t)}function vr(e,t){for(typeof e!="string"?e=Tt(e):Zt(e)||Nt.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Nt.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function ie(e){let t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(ci(e)){let i=_t(e);i.length===64?(t.v=27+(i[32]>>7),i[32]&=127,t.r=Tt(i.slice(0,32)),t.s=Tt(i.slice(32,64))):i.length===65?(t.r=Tt(i.slice(0,32)),t.s=Tt(i.slice(32,64)),t.v=i[64]):Nt.throwArgumentError("invalid signature string","signature",e),t.v<27&&(t.v===0||t.v===1?t.v+=27:Nt.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(i[32]|=128),t._vs=Tt(i.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,t._vs!=null){let n=On(_t(t._vs),32);t._vs=Tt(n);let l=n[0]>=128?1:0;t.recoveryParam==null?t.recoveryParam=l:t.recoveryParam!==l&&Nt.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;let m=Tt(n);t.s==null?t.s=m:t.s!==m&&Nt.throwArgumentError("signature v mismatch _vs","signature",e)}if(t.recoveryParam==null)t.v==null?Nt.throwArgumentError("signature missing v and recoveryParam","signature",e):t.v===0||t.v===1?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(t.v==null)t.v=27+t.recoveryParam;else{let n=t.v===0||t.v===1?t.v:1-t.v%2;t.recoveryParam!==n&&Nt.throwArgumentError("signature recoveryParam mismatch v","signature",e)}t.r==null||!Zt(t.r)?Nt.throwArgumentError("signature missing or invalid r","signature",e):t.r=vr(t.r,32),t.s==null||!Zt(t.s)?Nt.throwArgumentError("signature missing or invalid s","signature",e):t.s=vr(t.s,32);let i=_t(t.s);i[0]>=128&&Nt.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(i[0]|=128);let s=Tt(i);t._vs&&(Zt(t._vs)||Nt.throwArgumentError("signature invalid _vs","signature",e),t._vs=vr(t._vs,32)),t._vs==null?t._vs=s:t._vs!==s&&Nt.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}var mi=Qr(ke());var pi="bignumber/5.7.0";var Fn=mi.default.BN,Bo=new z(pi);function Be(e){return new Fn(e,36).toString(16)}var xi=Qr(gi());function Lr(e){return"0x"+xi.default.keccak_256(_t(e))}var bi="address/5.7.0";var Xr=new z(bi);function yi(e){Zt(e,20)||Xr.throwArgumentError("invalid address","address",e),e=e.toLowerCase();let t=e.substring(2).split(""),i=new Uint8Array(40);for(let n=0;n<40;n++)i[n]=t[n].charCodeAt(0);let s=_t(Lr(i));for(let n=0;n<40;n+=2)s[n>>1]>>4>=8&&(t[n]=t[n].toUpperCase()),(s[n>>1]&15)>=8&&(t[n+1]=t[n+1].toUpperCase());return"0x"+t.join("")}var qn=9007199254740991;function Tn(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}var qe={};for(let e=0;e<10;e++)qe[String(e)]=String(e);for(let e=0;e<26;e++)qe[String.fromCharCode(65+e)]=String(10+e);var wi=Math.floor(Tn(qn));function Cn(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let t=e.split("").map(s=>qe[s]).join("");for(;t.length>=wi;){let s=t.substring(0,wi);t=parseInt(s,10)%97+t.substring(s.length)}let i=String(98-parseInt(t,10)%97);for(;i.length<2;)i="0"+i;return i}function Mi(e){let t=null;if(typeof e!="string"&&Xr.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))e.substring(0,2)!=="0x"&&(e="0x"+e),t=yi(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&Xr.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==Cn(e)&&Xr.throwArgumentError("bad icap checksum","address",e),t=Be(e.substring(4));t.length<40;)t="0"+t;t=yi("0x"+t)}else Xr.throwArgumentError("invalid address","address",e);return t}var _i="properties/5.7.0";var Yo=new z(_i);function Dr(e,t,i){Object.defineProperty(e,t,{enumerable:!0,value:i,writable:!1})}var Ai="strings/5.7.0";var Si=new z(Ai),Vr;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(Vr||(Vr={}));var Br;(function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"})(Br||(Br={}));function Ln(e,t,i,s,n){return Si.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",i)}function Ei(e,t,i,s,n){if(e===Br.BAD_PREFIX||e===Br.UNEXPECTED_CONTINUE){let l=0;for(let m=t+1;m<i.length&&i[m]>>6===2;m++)l++;return l}return e===Br.OVERRUN?i.length-t-1:0}function Dn(e,t,i,s,n){return e===Br.OVERLONG?(s.push(n),0):(s.push(65533),Ei(e,t,i,s,n))}var Un=Object.freeze({error:Ln,ignore:Ei,replace:Dn});function jr(e,t=Vr.current){t!=Vr.current&&(Si.checkNormalize(),e=e.normalize(t));let i=[];for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);if(n<128)i.push(n);else if(n<2048)i.push(n>>6|192),i.push(n&63|128);else if((n&64512)==55296){s++;let l=e.charCodeAt(s);if(s>=e.length||(l&64512)!==56320)throw new Error("invalid utf-8 string");let m=65536+((n&1023)<<10)+(l&1023);i.push(m>>18|240),i.push(m>>12&63|128),i.push(m>>6&63|128),i.push(m&63|128)}else i.push(n>>12|224),i.push(n>>6&63|128),i.push(n&63|128)}return _t(i)}var Ii=`\19Ethereum Signed Message:
+`;function Te(e){return typeof e=="string"&&(e=jr(e)),Lr(Oe([jr(Ii),jr(String(e.length)),e]))}var D=Qr(ke()),ir=Qr(ln());function Wr(e,t,i){return i={path:t,exports:{},require:function(s,n){return uo(s,n??i.path)}},e(i,i.exports),i.exports}function uo(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Ve=dn;function dn(e,t){if(!e)throw new Error(t||"Assertion failed")}dn.equal=function(t,i,s){if(t!=i)throw new Error(s||"Assertion failed: "+t+" != "+i)};var jt=Wr(function(e,t){"use strict";var i=t;function s(m,x){if(Array.isArray(m))return m.slice();if(!m)return[];var y=[];if(typeof m!="string"){for(var w=0;w<m.length;w++)y[w]=m[w]|0;return y}if(x==="hex"){m=m.replace(/[^a-z0-9]+/ig,""),m.length%2!==0&&(m="0"+m);for(var w=0;w<m.length;w+=2)y.push(parseInt(m[w]+m[w+1],16))}else for(var w=0;w<m.length;w++){var A=m.charCodeAt(w),_=A>>8,I=A&255;_?y.push(_,I):y.push(I)}return y}i.toArray=s;function n(m){return m.length===1?"0"+m:m}i.zero2=n;function l(m){for(var x="",y=0;y<m.length;y++)x+=n(m[y].toString(16));return x}i.toHex=l,i.encode=function(x,y){return y==="hex"?l(x):x}}),Ut=Wr(function(e,t){"use strict";var i=t;i.assert=Ve,i.toArray=jt.toArray,i.zero2=jt.zero2,i.toHex=jt.toHex,i.encode=jt.encode;function s(y,w,A){var _=new Array(Math.max(y.bitLength(),A)+1);_.fill(0);for(var I=1<<w+1,P=y.clone(),N=0;N<_.length;N++){var k,U=P.andln(I-1);P.isOdd()?(U>(I>>1)-1?k=(I>>1)-U:k=U,P.isubn(k)):k=0,_[N]=k,P.iushrn(1)}return _}i.getNAF=s;function n(y,w){var A=[[],[]];y=y.clone(),w=w.clone();for(var _=0,I=0,P;y.cmpn(-_)>0||w.cmpn(-I)>0;){var N=y.andln(3)+_&3,k=w.andln(3)+I&3;N===3&&(N=-1),k===3&&(k=-1);var U;(N&1)===0?U=0:(P=y.andln(7)+_&7,(P===3||P===5)&&k===2?U=-N:U=N),A[0].push(U);var C;(k&1)===0?C=0:(P=w.andln(7)+I&7,(P===3||P===5)&&N===2?C=-k:C=k),A[1].push(C),2*_===U+1&&(_=1-_),2*I===C+1&&(I=1-I),y.iushrn(1),w.iushrn(1)}return A}i.getJSF=n;function l(y,w,A){var _="_"+w;y.prototype[w]=function(){return this[_]!==void 0?this[_]:this[_]=A.call(this)}}i.cachedProperty=l;function m(y){return typeof y=="string"?i.toArray(y,"hex"):y}i.parseBytes=m;function x(y){return new D.default(y,"hex","le")}i.intFromLE=x}),he=Ut.getNAF,lo=Ut.getJSF,ue=Ut.assert;function gr(e,t){this.type=e,this.p=new D.default(t.p,16),this.red=t.prime?D.default.red(t.prime):D.default.mont(this.p),this.zero=new D.default(0).toRed(this.red),this.one=new D.default(1).toRed(this.red),this.two=new D.default(2).toRed(this.red),this.n=t.n&&new D.default(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var i=this.n&&this.p.div(this.n);!i||i.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Tr=gr;gr.prototype.point=function(){throw new Error("Not implemented")};gr.prototype.validate=function(){throw new Error("Not implemented")};gr.prototype._fixedNafMul=function(t,i){ue(t.precomputed);var s=t._getDoubles(),n=he(i,1,this._bitLength),l=(1<<s.step+1)-(s.step%2===0?2:1);l/=3;var m=[],x,y;for(x=0;x<n.length;x+=s.step){y=0;for(var w=x+s.step-1;w>=x;w--)y=(y<<1)+n[w];m.push(y)}for(var A=this.jpoint(null,null,null),_=this.jpoint(null,null,null),I=l;I>0;I--){for(x=0;x<m.length;x++)y=m[x],y===I?_=_.mixedAdd(s.points[x]):y===-I&&(_=_.mixedAdd(s.points[x].neg()));A=A.add(_)}return A.toP()};gr.prototype._wnafMul=function(t,i){var s=4,n=t._getNAFPoints(s);s=n.wnd;for(var l=n.points,m=he(i,s,this._bitLength),x=this.jpoint(null,null,null),y=m.length-1;y>=0;y--){for(var w=0;y>=0&&m[y]===0;y--)w++;if(y>=0&&w++,x=x.dblp(w),y<0)break;var A=m[y];ue(A!==0),t.type==="affine"?A>0?x=x.mixedAdd(l[A-1>>1]):x=x.mixedAdd(l[-A-1>>1].neg()):A>0?x=x.add(l[A-1>>1]):x=x.add(l[-A-1>>1].neg())}return t.type==="affine"?x.toP():x};gr.prototype._wnafMulAdd=function(t,i,s,n,l){var m=this._wnafT1,x=this._wnafT2,y=this._wnafT3,w=0,A,_,I;for(A=0;A<n;A++){I=i[A];var P=I._getNAFPoints(t);m[A]=P.wnd,x[A]=P.points}for(A=n-1;A>=1;A-=2){var N=A-1,k=A;if(m[N]!==1||m[k]!==1){y[N]=he(s[N],m[N],this._bitLength),y[k]=he(s[k],m[k],this._bitLength),w=Math.max(y[N].length,w),w=Math.max(y[k].length,w);continue}var U=[i[N],null,null,i[k]];i[N].y.cmp(i[k].y)===0?(U[1]=i[N].add(i[k]),U[2]=i[N].toJ().mixedAdd(i[k].neg())):i[N].y.cmp(i[k].y.redNeg())===0?(U[1]=i[N].toJ().mixedAdd(i[k]),U[2]=i[N].add(i[k].neg())):(U[1]=i[N].toJ().mixedAdd(i[k]),U[2]=i[N].toJ().mixedAdd(i[k].neg()));var C=[-3,-1,-5,-7,0,7,5,1,3],St=lo(s[N],s[k]);for(w=Math.max(St[0].length,w),y[N]=new Array(w),y[k]=new Array(w),_=0;_<w;_++){var Rt=St[0][_]|0,At=St[1][_]|0;y[N][_]=C[(Rt+1)*3+(At+1)],y[k][_]=0,x[N]=U}}var Et=this.jpoint(null,null,null),K=this._wnafT4;for(A=w;A>=0;A--){for(var Ot=0;A>=0;){var qt=!0;for(_=0;_<n;_++)K[_]=y[_][A]|0,K[_]!==0&&(qt=!1);if(!qt)break;Ot++,A--}if(A>=0&&Ot++,Et=Et.dblp(Ot),A<0)break;for(_=0;_<n;_++){var Lt=K[_];Lt!==0&&(Lt>0?I=x[_][Lt-1>>1]:Lt<0&&(I=x[_][-Lt-1>>1].neg()),I.type==="affine"?Et=Et.mixedAdd(I):Et=Et.add(I))}}for(A=0;A<n;A++)x[A]=null;return l?Et:Et.toP()};function Ht(e,t){this.curve=e,this.type=t,this.precomputed=null}gr.BasePoint=Ht;Ht.prototype.eq=function(){throw new Error("Not implemented")};Ht.prototype.validate=function(){return this.curve.validate(this)};gr.prototype.decodePoint=function(t,i){t=Ut.toArray(t,i);var s=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*s){t[0]===6?ue(t[t.length-1]%2===0):t[0]===7&&ue(t[t.length-1]%2===1);var n=this.point(t.slice(1,1+s),t.slice(1+s,1+2*s));return n}else if((t[0]===2||t[0]===3)&&t.length-1===s)return this.pointFromX(t.slice(1,1+s),t[0]===3);throw new Error("Unknown point format")};Ht.prototype.encodeCompressed=function(t){return this.encode(t,!0)};Ht.prototype._encode=function(t){var i=this.curve.p.byteLength(),s=this.getX().toArray("be",i);return t?[this.getY().isEven()?2:3].concat(s):[4].concat(s,this.getY().toArray("be",i))};Ht.prototype.encode=function(t,i){return Ut.encode(this._encode(i),t)};Ht.prototype.precompute=function(t){if(this.precomputed)return this;var i={doubles:null,naf:null,beta:null};return i.naf=this._getNAFPoints(8),i.doubles=this._getDoubles(4,t),i.beta=this._getBeta(),this.precomputed=i,this};Ht.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var i=this.precomputed.doubles;return i?i.points.length>=Math.ceil((t.bitLength()+1)/i.step):!1};Ht.prototype._getDoubles=function(t,i){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var s=[this],n=this,l=0;l<i;l+=t){for(var m=0;m<t;m++)n=n.dbl();s.push(n)}return{step:t,points:s}};Ht.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var i=[this],s=(1<<t)-1,n=s===1?null:this.dbl(),l=1;l<s;l++)i[l]=i[l-1].add(n);return{wnd:t,points:i}};Ht.prototype._getBeta=function(){return null};Ht.prototype.dblp=function(t){for(var i=this,s=0;s<t;s++)i=i.dbl();return i};var je=Wr(function(e){typeof Object.create=="function"?e.exports=function(i,s){s&&(i.super_=s,i.prototype=Object.create(s.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(i,s){if(s){i.super_=s;var n=function(){};n.prototype=s.prototype,i.prototype=new n,i.prototype.constructor=i}}}),co=Ut.assert;function Gt(e){Tr.call(this,"short",e),this.a=new D.default(e.a,16).toRed(this.red),this.b=new D.default(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}je(Gt,Tr);var vo=Gt;Gt.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var i,s;if(t.beta)i=new D.default(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);i=n[0].cmp(n[1])<0?n[0]:n[1],i=i.toRed(this.red)}if(t.lambda)s=new D.default(t.lambda,16);else{var l=this._getEndoRoots(this.n);this.g.mul(l[0]).x.cmp(this.g.x.redMul(i))===0?s=l[0]:(s=l[1],co(this.g.mul(s).x.cmp(this.g.x.redMul(i))===0))}var m;return t.basis?m=t.basis.map(function(x){return{a:new D.default(x.a,16),b:new D.default(x.b,16)}}):m=this._getEndoBasis(s),{beta:i,lambda:s,basis:m}}};Gt.prototype._getEndoRoots=function(t){var i=t===this.p?this.red:D.default.mont(t),s=new D.default(2).toRed(i).redInvm(),n=s.redNeg(),l=new D.default(3).toRed(i).redNeg().redSqrt().redMul(s),m=n.redAdd(l).fromRed(),x=n.redSub(l).fromRed();return[m,x]};Gt.prototype._getEndoBasis=function(t){for(var i=this.n.ushrn(Math.floor(this.n.bitLength()/2)),s=t,n=this.n.clone(),l=new D.default(1),m=new D.default(0),x=new D.default(0),y=new D.default(1),w,A,_,I,P,N,k,U=0,C,St;s.cmpn(0)!==0;){var Rt=n.div(s);C=n.sub(Rt.mul(s)),St=x.sub(Rt.mul(l));var At=y.sub(Rt.mul(m));if(!_&&C.cmp(i)<0)w=k.neg(),A=l,_=C.neg(),I=St;else if(_&&++U===2)break;k=C,n=s,s=C,x=l,l=St,y=m,m=At}P=C.neg(),N=St;var Et=_.sqr().add(I.sqr()),K=P.sqr().add(N.sqr());return K.cmp(Et)>=0&&(P=w,N=A),_.negative&&(_=_.neg(),I=I.neg()),P.negative&&(P=P.neg(),N=N.neg()),[{a:_,b:I},{a:P,b:N}]};Gt.prototype._endoSplit=function(t){var i=this.endo.basis,s=i[0],n=i[1],l=n.b.mul(t).divRound(this.n),m=s.b.neg().mul(t).divRound(this.n),x=l.mul(s.a),y=m.mul(n.a),w=l.mul(s.b),A=m.mul(n.b),_=t.sub(x).sub(y),I=w.add(A).neg();return{k1:_,k2:I}};Gt.prototype.pointFromX=function(t,i){t=new D.default(t,16),t.red||(t=t.toRed(this.red));var s=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=s.redSqrt();if(n.redSqr().redSub(s).cmp(this.zero)!==0)throw new Error("invalid point");var l=n.fromRed().isOdd();return(i&&!l||!i&&l)&&(n=n.redNeg()),this.point(t,n)};Gt.prototype.validate=function(t){if(t.inf)return!0;var i=t.x,s=t.y,n=this.a.redMul(i),l=i.redSqr().redMul(i).redIAdd(n).redIAdd(this.b);return s.redSqr().redISub(l).cmpn(0)===0};Gt.prototype._endoWnafMulAdd=function(t,i,s){for(var n=this._endoWnafT1,l=this._endoWnafT2,m=0;m<t.length;m++){var x=this._endoSplit(i[m]),y=t[m],w=y._getBeta();x.k1.negative&&(x.k1.ineg(),y=y.neg(!0)),x.k2.negative&&(x.k2.ineg(),w=w.neg(!0)),n[m*2]=y,n[m*2+1]=w,l[m*2]=x.k1,l[m*2+1]=x.k2}for(var A=this._wnafMulAdd(1,n,l,m*2,s),_=0;_<m*2;_++)n[_]=null,l[_]=null;return A};function Pt(e,t,i,s){Tr.BasePoint.call(this,e,"affine"),t===null&&i===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new D.default(t,16),this.y=new D.default(i,16),s&&(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)}je(Pt,Tr.BasePoint);Gt.prototype.point=function(t,i,s){return new Pt(this,t,i,s)};Gt.prototype.pointFromJSON=function(t,i){return Pt.fromJSON(this,t,i)};Pt.prototype._getBeta=function(){if(!!this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var i=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var s=this.curve,n=function(l){return s.point(l.x.redMul(s.endo.beta),l.y)};t.beta=i,i.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return i}};Pt.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]};Pt.fromJSON=function(t,i,s){typeof i=="string"&&(i=JSON.parse(i));var n=t.point(i[0],i[1],s);if(!i[2])return n;function l(x){return t.point(x[0],x[1],s)}var m=i[2];return n.precomputed={beta:null,doubles:m.doubles&&{step:m.doubles.step,points:[n].concat(m.doubles.points.map(l))},naf:m.naf&&{wnd:m.naf.wnd,points:[n].concat(m.naf.points.map(l))}},n};Pt.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)+">"};Pt.prototype.isInfinity=function(){return this.inf};Pt.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var i=this.y.redSub(t.y);i.cmpn(0)!==0&&(i=i.redMul(this.x.redSub(t.x).redInvm()));var s=i.redSqr().redISub(this.x).redISub(t.x),n=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,n)};Pt.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var i=this.curve.a,s=this.x.redSqr(),n=t.redInvm(),l=s.redAdd(s).redIAdd(s).redIAdd(i).redMul(n),m=l.redSqr().redISub(this.x.redAdd(this.x)),x=l.redMul(this.x.redSub(m)).redISub(this.y);return this.curve.point(m,x)};Pt.prototype.getX=function(){return this.x.fromRed()};Pt.prototype.getY=function(){return this.y.fromRed()};Pt.prototype.mul=function(t){return t=new D.default(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)};Pt.prototype.mulAdd=function(t,i,s){var n=[this,i],l=[t,s];return this.curve.endo?this.curve._endoWnafMulAdd(n,l):this.curve._wnafMulAdd(1,n,l,2)};Pt.prototype.jmulAdd=function(t,i,s){var n=[this,i],l=[t,s];return this.curve.endo?this.curve._endoWnafMulAdd(n,l,!0):this.curve._wnafMulAdd(1,n,l,2,!0)};Pt.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)};Pt.prototype.neg=function(t){if(this.inf)return this;var i=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var s=this.precomputed,n=function(l){return l.neg()};i.precomputed={naf:s.naf&&{wnd:s.naf.wnd,points:s.naf.points.map(n)},doubles:s.doubles&&{step:s.doubles.step,points:s.doubles.points.map(n)}}}return i};Pt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Bt(e,t,i,s){Tr.BasePoint.call(this,e,"jacobian"),t===null&&i===null&&s===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new D.default(0)):(this.x=new D.default(t,16),this.y=new D.default(i,16),this.z=new D.default(s,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}je(Bt,Tr.BasePoint);Gt.prototype.jpoint=function(t,i,s){return new Bt(this,t,i,s)};Bt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),i=t.redSqr(),s=this.x.redMul(i),n=this.y.redMul(i).redMul(t);return this.curve.point(s,n)};Bt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Bt.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var i=t.z.redSqr(),s=this.z.redSqr(),n=this.x.redMul(i),l=t.x.redMul(s),m=this.y.redMul(i.redMul(t.z)),x=t.y.redMul(s.redMul(this.z)),y=n.redSub(l),w=m.redSub(x);if(y.cmpn(0)===0)return w.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var A=y.redSqr(),_=A.redMul(y),I=n.redMul(A),P=w.redSqr().redIAdd(_).redISub(I).redISub(I),N=w.redMul(I.redISub(P)).redISub(m.redMul(_)),k=this.z.redMul(t.z).redMul(y);return this.curve.jpoint(P,N,k)};Bt.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var i=this.z.redSqr(),s=this.x,n=t.x.redMul(i),l=this.y,m=t.y.redMul(i).redMul(this.z),x=s.redSub(n),y=l.redSub(m);if(x.cmpn(0)===0)return y.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var w=x.redSqr(),A=w.redMul(x),_=s.redMul(w),I=y.redSqr().redIAdd(A).redISub(_).redISub(_),P=y.redMul(_.redISub(I)).redISub(l.redMul(A)),N=this.z.redMul(x);return this.curve.jpoint(I,P,N)};Bt.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var i;if(this.curve.zeroA||this.curve.threeA){var s=this;for(i=0;i<t;i++)s=s.dbl();return s}var n=this.curve.a,l=this.curve.tinv,m=this.x,x=this.y,y=this.z,w=y.redSqr().redSqr(),A=x.redAdd(x);for(i=0;i<t;i++){var _=m.redSqr(),I=A.redSqr(),P=I.redSqr(),N=_.redAdd(_).redIAdd(_).redIAdd(n.redMul(w)),k=m.redMul(I),U=N.redSqr().redISub(k.redAdd(k)),C=k.redISub(U),St=N.redMul(C);St=St.redIAdd(St).redISub(P);var Rt=A.redMul(y);i+1<t&&(w=w.redMul(P)),m=U,y=Rt,A=St}return this.curve.jpoint(m,A.redMul(l),y)};Bt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};Bt.prototype._zeroDbl=function(){var t,i,s;if(this.zOne){var n=this.x.redSqr(),l=this.y.redSqr(),m=l.redSqr(),x=this.x.redAdd(l).redSqr().redISub(n).redISub(m);x=x.redIAdd(x);var y=n.redAdd(n).redIAdd(n),w=y.redSqr().redISub(x).redISub(x),A=m.redIAdd(m);A=A.redIAdd(A),A=A.redIAdd(A),t=w,i=y.redMul(x.redISub(w)).redISub(A),s=this.y.redAdd(this.y)}else{var _=this.x.redSqr(),I=this.y.redSqr(),P=I.redSqr(),N=this.x.redAdd(I).redSqr().redISub(_).redISub(P);N=N.redIAdd(N);var k=_.redAdd(_).redIAdd(_),U=k.redSqr(),C=P.redIAdd(P);C=C.redIAdd(C),C=C.redIAdd(C),t=U.redISub(N).redISub(N),i=k.redMul(N.redISub(t)).redISub(C),s=this.y.redMul(this.z),s=s.redIAdd(s)}return this.curve.jpoint(t,i,s)};Bt.prototype._threeDbl=function(){var t,i,s;if(this.zOne){var n=this.x.redSqr(),l=this.y.redSqr(),m=l.redSqr(),x=this.x.redAdd(l).redSqr().redISub(n).redISub(m);x=x.redIAdd(x);var y=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),w=y.redSqr().redISub(x).redISub(x);t=w;var A=m.redIAdd(m);A=A.redIAdd(A),A=A.redIAdd(A),i=y.redMul(x.redISub(w)).redISub(A),s=this.y.redAdd(this.y)}else{var _=this.z.redSqr(),I=this.y.redSqr(),P=this.x.redMul(I),N=this.x.redSub(_).redMul(this.x.redAdd(_));N=N.redAdd(N).redIAdd(N);var k=P.redIAdd(P);k=k.redIAdd(k);var U=k.redAdd(k);t=N.redSqr().redISub(U),s=this.y.redAdd(this.z).redSqr().redISub(I).redISub(_);var C=I.redSqr();C=C.redIAdd(C),C=C.redIAdd(C),C=C.redIAdd(C),i=N.redMul(k.redISub(t)).redISub(C)}return this.curve.jpoint(t,i,s)};Bt.prototype._dbl=function(){var t=this.curve.a,i=this.x,s=this.y,n=this.z,l=n.redSqr().redSqr(),m=i.redSqr(),x=s.redSqr(),y=m.redAdd(m).redIAdd(m).redIAdd(t.redMul(l)),w=i.redAdd(i);w=w.redIAdd(w);var A=w.redMul(x),_=y.redSqr().redISub(A.redAdd(A)),I=A.redISub(_),P=x.redSqr();P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P);var N=y.redMul(I).redISub(P),k=s.redAdd(s).redMul(n);return this.curve.jpoint(_,N,k)};Bt.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),i=this.y.redSqr(),s=this.z.redSqr(),n=i.redSqr(),l=t.redAdd(t).redIAdd(t),m=l.redSqr(),x=this.x.redAdd(i).redSqr().redISub(t).redISub(n);x=x.redIAdd(x),x=x.redAdd(x).redIAdd(x),x=x.redISub(m);var y=x.redSqr(),w=n.redIAdd(n);w=w.redIAdd(w),w=w.redIAdd(w),w=w.redIAdd(w);var A=l.redIAdd(x).redSqr().redISub(m).redISub(y).redISub(w),_=i.redMul(A);_=_.redIAdd(_),_=_.redIAdd(_);var I=this.x.redMul(y).redISub(_);I=I.redIAdd(I),I=I.redIAdd(I);var P=this.y.redMul(A.redMul(w.redISub(A)).redISub(x.redMul(y)));P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P);var N=this.z.redAdd(x).redSqr().redISub(s).redISub(y);return this.curve.jpoint(I,P,N)};Bt.prototype.mul=function(t,i){return t=new D.default(t,i),this.curve._wnafMul(this,t)};Bt.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var i=this.z.redSqr(),s=t.z.redSqr();if(this.x.redMul(s).redISub(t.x.redMul(i)).cmpn(0)!==0)return!1;var n=i.redMul(this.z),l=s.redMul(t.z);return this.y.redMul(l).redISub(t.y.redMul(n)).cmpn(0)===0};Bt.prototype.eqXToP=function(t){var i=this.z.redSqr(),s=t.toRed(this.curve.red).redMul(i);if(this.x.cmp(s)===0)return!0;for(var n=t.clone(),l=this.curve.redN.redMul(i);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(s.redIAdd(l),this.x.cmp(s)===0)return!0}};Bt.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)+">"};Bt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var se=Wr(function(e,t){"use strict";var i=t;i.base=Tr,i.short=vo,i.mont=null,i.edwards=null}),ae=Wr(function(e,t){"use strict";var i=t,s=Ut.assert;function n(x){x.type==="short"?this.curve=new se.short(x):x.type==="edwards"?this.curve=new se.edwards(x):this.curve=new se.mont(x),this.g=this.curve.g,this.n=this.curve.n,this.hash=x.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}i.PresetCurve=n;function l(x,y){Object.defineProperty(i,x,{configurable:!0,enumerable:!0,get:function(){var w=new n(y);return Object.defineProperty(i,x,{configurable:!0,enumerable:!0,value:w}),w}})}l("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:ir.default.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),l("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:ir.default.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),l("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:ir.default.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),l("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:ir.default.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"]}),l("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:ir.default.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"]}),l("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ir.default.sha256,gRed:!1,g:["9"]}),l("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:ir.default.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var m;try{m=null.crash()}catch{m=void 0}l("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:ir.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",m]})});function mr(e){if(!(this instanceof mr))return new mr(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=jt.toArray(e.entropy,e.entropyEnc||"hex"),i=jt.toArray(e.nonce,e.nonceEnc||"hex"),s=jt.toArray(e.pers,e.persEnc||"hex");Ve(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,i,s)}var vn=mr;mr.prototype._init=function(t,i,s){var n=t.concat(i).concat(s);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var l=0;l<this.V.length;l++)this.K[l]=0,this.V[l]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656};mr.prototype._hmac=function(){return new ir.default.hmac(this.hash,this.K)};mr.prototype._update=function(t){var i=this._hmac().update(this.V).update([0]);t&&(i=i.update(t)),this.K=i.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())};mr.prototype.reseed=function(t,i,s,n){typeof i!="string"&&(n=s,s=i,i=null),t=jt.toArray(t,i),s=jt.toArray(s,n),Ve(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(s||[])),this._reseed=1};mr.prototype.generate=function(t,i,s,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof i!="string"&&(n=s,s=i,i=null),s&&(s=jt.toArray(s,n||"hex"),this._update(s));for(var l=[];l.length<t;)this.V=this._hmac().update(this.V).digest(),l=l.concat(this.V);var m=l.slice(0,t);return this._update(s),this._reseed++,jt.encode(m,i)};var Xe=Ut.assert;function Ct(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var $e=Ct;Ct.fromPublic=function(t,i,s){return i instanceof Ct?i:new Ct(t,{pub:i,pubEnc:s})};Ct.fromPrivate=function(t,i,s){return i instanceof Ct?i:new Ct(t,{priv:i,privEnc:s})};Ct.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"}};Ct.prototype.getPublic=function(t,i){return typeof t=="string"&&(i=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),i?this.pub.encode(i,t):this.pub};Ct.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv};Ct.prototype._importPrivate=function(t,i){this.priv=new D.default(t,i||16),this.priv=this.priv.umod(this.ec.curve.n)};Ct.prototype._importPublic=function(t,i){if(t.x||t.y){this.ec.curve.type==="mont"?Xe(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Xe(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,i)};Ct.prototype.derive=function(t){return t.validate()||Xe(t.validate(),"public point not validated"),t.mul(this.priv).getX()};Ct.prototype.sign=function(t,i,s){return this.ec.sign(t,this,i,s)};Ct.prototype.verify=function(t,i){return this.ec.verify(t,i,this)};Ct.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var po=Ut.assert;function le(e,t){if(e instanceof le)return e;this._importDER(e,t)||(po(e.r&&e.s,"Signature without r or s"),this.r=new D.default(e.r,16),this.s=new D.default(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var ce=le;function mo(){this.place=0}function Ze(e,t){var i=e[t.place++];if(!(i&128))return i;var s=i&15;if(s===0||s>4)return!1;for(var n=0,l=0,m=t.place;l<s;l++,m++)n<<=8,n|=e[m],n>>>=0;return n<=127?!1:(t.place=m,n)}function cn(e){for(var t=0,i=e.length-1;!e[t]&&!(e[t+1]&128)&&t<i;)t++;return t===0?e:e.slice(t)}le.prototype._importDER=function(t,i){t=Ut.toArray(t,i);var s=new mo;if(t[s.place++]!==48)return!1;var n=Ze(t,s);if(n===!1||n+s.place!==t.length||t[s.place++]!==2)return!1;var l=Ze(t,s);if(l===!1)return!1;var m=t.slice(s.place,l+s.place);if(s.place+=l,t[s.place++]!==2)return!1;var x=Ze(t,s);if(x===!1||t.length!==x+s.place)return!1;var y=t.slice(s.place,x+s.place);if(m[0]===0)if(m[1]&128)m=m.slice(1);else return!1;if(y[0]===0)if(y[1]&128)y=y.slice(1);else return!1;return this.r=new D.default(m),this.s=new D.default(y),this.recoveryParam=null,!0};function We(e,t){if(t<128){e.push(t);return}var i=1+(Math.log(t)/Math.LN2>>>3);for(e.push(i|128);--i;)e.push(t>>>(i<<3)&255);e.push(t)}le.prototype.toDER=function(t){var i=this.r.toArray(),s=this.s.toArray();for(i[0]&128&&(i=[0].concat(i)),s[0]&128&&(s=[0].concat(s)),i=cn(i),s=cn(s);!s[0]&&!(s[1]&128);)s=s.slice(1);var n=[2];We(n,i.length),n=n.concat(i),n.push(2),We(n,s.length);var l=n.concat(s),m=[48];return We(m,l.length),m=m.concat(l),Ut.encode(m,t)};var go=function(){throw new Error("unsupported")},pn=Ut.assert;function Kt(e){if(!(this instanceof Kt))return new Kt(e);typeof e=="string"&&(pn(Object.prototype.hasOwnProperty.call(ae,e),"Unknown curve "+e),e=ae[e]),e instanceof ae.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var xo=Kt;Kt.prototype.keyPair=function(t){return new $e(this,t)};Kt.prototype.keyFromPrivate=function(t,i){return $e.fromPrivate(this,t,i)};Kt.prototype.keyFromPublic=function(t,i){return $e.fromPublic(this,t,i)};Kt.prototype.genKeyPair=function(t){t||(t={});for(var i=new vn({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||go(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),s=this.n.byteLength(),n=this.n.sub(new D.default(2));;){var l=new D.default(i.generate(s));if(!(l.cmp(n)>0))return l.iaddn(1),this.keyFromPrivate(l)}};Kt.prototype._truncateToN=function(t,i){var s=t.byteLength()*8-this.n.bitLength();return s>0&&(t=t.ushrn(s)),!i&&t.cmp(this.n)>=0?t.sub(this.n):t};Kt.prototype.sign=function(t,i,s,n){typeof s=="object"&&(n=s,s=null),n||(n={}),i=this.keyFromPrivate(i,s),t=this._truncateToN(new D.default(t,16));for(var l=this.n.byteLength(),m=i.getPrivate().toArray("be",l),x=t.toArray("be",l),y=new vn({hash:this.hash,entropy:m,nonce:x,pers:n.pers,persEnc:n.persEnc||"utf8"}),w=this.n.sub(new D.default(1)),A=0;;A++){var _=n.k?n.k(A):new D.default(y.generate(this.n.byteLength()));if(_=this._truncateToN(_,!0),!(_.cmpn(1)<=0||_.cmp(w)>=0)){var I=this.g.mul(_);if(!I.isInfinity()){var P=I.getX(),N=P.umod(this.n);if(N.cmpn(0)!==0){var k=_.invm(this.n).mul(N.mul(i.getPrivate()).iadd(t));if(k=k.umod(this.n),k.cmpn(0)!==0){var U=(I.getY().isOdd()?1:0)|(P.cmp(N)!==0?2:0);return n.canonical&&k.cmp(this.nh)>0&&(k=this.n.sub(k),U^=1),new ce({r:N,s:k,recoveryParam:U})}}}}}};Kt.prototype.verify=function(t,i,s,n){t=this._truncateToN(new D.default(t,16)),s=this.keyFromPublic(s,n),i=new ce(i,"hex");var l=i.r,m=i.s;if(l.cmpn(1)<0||l.cmp(this.n)>=0||m.cmpn(1)<0||m.cmp(this.n)>=0)return!1;var x=m.invm(this.n),y=x.mul(t).umod(this.n),w=x.mul(l).umod(this.n),A;return this.curve._maxwellTrick?(A=this.g.jmulAdd(y,s.getPublic(),w),A.isInfinity()?!1:A.eqXToP(l)):(A=this.g.mulAdd(y,s.getPublic(),w),A.isInfinity()?!1:A.getX().umod(this.n).cmp(l)===0)};Kt.prototype.recoverPubKey=function(e,t,i,s){pn((3&i)===i,"The recovery param is more than two bits"),t=new ce(t,s);var n=this.n,l=new D.default(e),m=t.r,x=t.s,y=i&1,w=i>>1;if(m.cmp(this.curve.p.umod(this.curve.n))>=0&&w)throw new Error("Unable to find sencond key candinate");w?m=this.curve.pointFromX(m.add(this.curve.n),y):m=this.curve.pointFromX(m,y);var A=t.r.invm(n),_=n.sub(l).mul(A).umod(n),I=x.mul(A).umod(n);return this.g.mulAdd(_,m,I)};Kt.prototype.getKeyRecoveryParam=function(e,t,i,s){if(t=new ce(t,s),t.recoveryParam!==null)return t.recoveryParam;for(var n=0;n<4;n++){var l;try{l=this.recoverPubKey(e,t,n)}catch{continue}if(l.eq(i))return n}throw new Error("Unable to find valid recovery factor")};var bo=Wr(function(e,t){"use strict";var i=t;i.version="6.5.4",i.utils=Ut,i.rand=function(){throw new Error("unsupported")},i.curve=se,i.curves=ae,i.ec=xo,i.eddsa=null}),mn=bo.ec;var gn="signing-key/5.7.0";var Qe=new z(gn),Ye=null;function nr(){return Ye||(Ye=new mn("secp256k1")),Ye}var ti=class{constructor(t){Dr(this,"curve","secp256k1"),Dr(this,"privateKey",Tt(t)),re(this.privateKey)!==32&&Qe.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let i=nr().keyFromPrivate(_t(this.privateKey));Dr(this,"publicKey","0x"+i.getPublic(!1,"hex")),Dr(this,"compressedPublicKey","0x"+i.getPublic(!0,"hex")),Dr(this,"_isSigningKey",!0)}_addPoint(t){let i=nr().keyFromPublic(_t(this.publicKey)),s=nr().keyFromPublic(_t(t));return"0x"+i.pub.add(s.pub).encodeCompressed("hex")}signDigest(t){let i=nr().keyFromPrivate(_t(this.privateKey)),s=_t(t);s.length!==32&&Qe.throwArgumentError("bad digest length","digest",t);let n=i.sign(s,{canonical:!0});return ie({recoveryParam:n.recoveryParam,r:vr("0x"+n.r.toString(16),32),s:vr("0x"+n.s.toString(16),32)})}computeSharedSecret(t){let i=nr().keyFromPrivate(_t(this.privateKey)),s=nr().keyFromPublic(_t(ri(t)));return vr("0x"+i.derive(s.getPublic()).toString(16),32)}static isSigningKey(t){return!!(t&&t._isSigningKey)}};function xn(e,t){let i=ie(t),s={r:_t(i.r),s:_t(i.s)};return"0x"+nr().recoverPubKey(_t(e),s,i.recoveryParam).encode("hex",!1)}function ri(e,t){let i=_t(e);if(i.length===32){let s=new ti(i);return t?"0x"+nr().keyFromPrivate(i).getPublic(!0,"hex"):s.publicKey}else{if(i.length===33)return t?Tt(i):"0x"+nr().keyFromPublic(i).getPublic(!1,"hex");if(i.length===65)return t?"0x"+nr().keyFromPublic(i).getPublic(!0,"hex"):Tt(i)}return Qe.throwArgumentError("invalid public or private key","key","[REDACTED]")}var bn="transactions/5.7.0";var Z0=new z(bn),yn;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})(yn||(yn={}));function wn(e){let t=ri(e);return Mi(ee(Lr(ee(t,1)),12))}function Mn(e,t){return wn(xn(_t(e),t))}var _n="wallet/5.7.0";var rs=new z(_n);function yo(e,t){return Mn(Te(e),t)}export{yo as verifyMessage};
+/**
+ * [js-sha3]{@link https://github.com/emn178/js-sha3}
+ *
+ * @version 0.8.0
+ * @author Chen, Yi-Cyuan [emn178@gmail.com]
+ * @copyright Chen, Yi-Cyuan 2015-2018
+ * @license MIT
+ */
diff --git a/index.html b/index.html
new file mode 100644 (file)
index 0000000..8ec101b
--- /dev/null
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+  <meta charset="UTF-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <meta name="description" content="A minimal short link service that uses the Ethereum blockchain for access control.">
+  <meta property="og:title" content="alu.bz">
+  <meta property="og:description" content="A minimal short link service that uses the Ethereum blockchain for access control.">
+  <meta property="og:type" content="website">
+  <meta property="og:url" content="https://alu.bz/">
+  <link rel="canonical" href="https://alu.bz/">
+  <link rel="icon" href="data:,">
+  <link rel="stylesheet" href="style.css">
+  <title>alu.bz</title>
+</head>
+
+<body>
+  <header>
+    <h1>alu.bz</h1>
+    <nav>
+      <button id="connect" class="text-button">Connect&nbsp;Wallet</button>
+      <button>
+        <svg role="img" aria-labelledby="info" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+          <title id="info">About this site</title>
+          <circle cx="12" cy="12" r="10"></circle>
+          <line x1="12" y1="16" x2="12" y2="12"></line>
+          <line x1="12" y1="8" x2="12.01" y2="8"></line>
+        </svg>
+      </button>
+      <a href="https://github.com/ardislu/alu.bz" id="github-link">
+        <svg role="img" aria-labelledby="github" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+          <title id="github">GitHub repository</title>
+          <path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"></path>
+          <path d="M9 18c-4.51 2-5-2-7-2"></path>
+        </svg>
+      </a>
+    </nav>
+  </header>
+
+  <main>
+    <form>
+      <div>
+        <label for="full-url">Long link</label>
+        <aside>Enter a long URL to shorten.</aside>
+        <input type="url" id="full-url" name="full-url" placeholder="https://example.com" required>
+      </div>
+
+      <div>
+        <label for="short-url">Custom short path</label>
+        <aside id="short-url-aside">Connect wallet to enable this feature.</aside>
+        <!-- Maximum 80 characters, valid characters are alphanumeric, hyphen (-), and underscore (_) -->
+        <input type="text" id="short-url" name="short-url" placeholder="example" maxlength="80" pattern="^[0-9a-zA-Z-_]*$" disabled>
+      </div>
+
+      <button type="submit" id="generate" class="text-button">Create short link</button>
+
+      <output id="status" name="status"></output>
+    </form>
+  </main>
+
+  <script>
+    if (location.pathname !== '' && location.pathname !== '/') {
+      fetch(`/api?${location.pathname.substring(1)}`);
+    }
+  </script>
+  <script src="script.js" type="module"></script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/script.js b/script.js
new file mode 100644 (file)
index 0000000..62c0156
--- /dev/null
+++ b/script.js
@@ -0,0 +1,118 @@
+let currentAccount = null;
+const connectButton = document.getElementById('connect');
+const shortUrlInput = document.getElementById('short-url');
+const shortUrlAside = document.getElementById('short-url-aside');
+const statusOutput = document.getElementById('status');
+const form = document.querySelector('form');
+
+// Helper function to call the balanceOf function on an address to check if it's eligible to create
+// custom short URLs. The same logic is executed on the backend to independently validate on server-side.
+async function getNftCount(address) {
+  // Hardcoded parameters to query the Ethereum smart contract
+  const contractAddress = '0x74EE68a33f6c9f113e22B3B77418B75f85d07D22'; // Zerion ERC-1155 NFT 
+  const byteSignature = '00fdd58e'; // Ethereum ABI function signature for: balanceOf(address, uint256)
+  const paddedAddress = address.substring(2).padStart(64, '0');
+  const nftId = '5'.padStart(64, '0'); // Arbitrary ID for the ERC-1155 NFT to look up
+
+  // Prepare and send the payload to an Ethereum JSON-RPC node
+  const payload = {
+    jsonrpc: '2.0',
+    id: 1,
+    method: 'eth_call',
+    params: [
+      {
+        to: contractAddress,
+        data: `0x${byteSignature}${paddedAddress}${nftId}`
+      },
+      'latest'
+    ]
+  }
+  return fetch('https://eth.alu.bz/v1/mainnet', {
+    method: 'POST',
+    headers: {
+      'Content-Type': 'application/json'
+    },
+    body: JSON.stringify(payload)
+  })
+    .then(r => r.json())
+    .then(json => json['result'])
+    .then(result => parseInt(result, 16));
+}
+
+// Event handler to update UI elements to reflect the active account
+async function setAccount(accounts) {
+  // Use the currently active account if multiple accounts are connected
+  currentAccount = accounts[0];
+
+  // All accounts disconnected
+  if (currentAccount === null || currentAccount === undefined) {
+    connectButton.textContent = `Connect${String.fromCharCode(160)}Wallet`; // Char code 160 = non-breaking space
+    connectButton.disabled = false;
+    shortUrlInput.value = '';
+    shortUrlInput.disabled = true;
+    shortUrlAside.textContent = 'Connect wallet to enable this feature.';
+    return;
+  }
+
+  connectButton.textContent = currentAccount;
+  connectButton.disabled = true;
+  shortUrlAside.textContent = 'Checking your address...';
+  const nftCount = await getNftCount(currentAccount);
+  if (nftCount > 0) {
+    shortUrlAside.textContent = 'Enter a custom short URL.';
+    shortUrlInput.disabled = false;
+  }
+  else {
+    shortUrlAside.textContent = 'The required access token was not found in your account.';
+    shortUrlInput.value = '';
+    shortUrlInput.disabled = true;
+  }
+}
+
+// Event handler for form submit event
+async function handleSubmit(event) {
+  event.preventDefault();
+
+  statusOutput.classList.remove('success');
+  statusOutput.classList.remove('failure');
+  statusOutput.textContent = '';
+
+  const data = new FormData(event.target);
+  const shortUrl = data.get('short-url');
+  const fullUrl = data.get('full-url');
+
+  if (shortUrl !== '' && shortUrl !== null && shortUrl !== undefined) {
+    const message = `Sign this message to confirm you want to create https://alu.bz/${shortUrl} to redirect to ${fullUrl}.`;
+    const array = [...new TextEncoder().encode(message)];
+    const hex = `0x${array.map(v => v.toString(16).padStart(2, '0')).join('')}`;
+    const signature = await ethereum.request({
+      method: 'personal_sign',
+      params: [hex, currentAccount, '']
+    });
+    data.set('signature', signature);
+  }
+
+  const response = await fetch('/api', {
+    method: 'POST',
+    body: data
+  });
+
+  if (response.ok) {
+    statusOutput.classList.add('success');
+  }
+  else {
+    statusOutput.classList.add('failure');
+  }
+  statusOutput.textContent = await response.text();
+}
+
+// User switches account manually in MetaMask
+ethereum.addListener('accountsChanged', setAccount);
+
+connectButton.addEventListener('click', () => {
+  ethereum
+    .request({ method: 'eth_requestAccounts' })
+    .then(setAccount);
+});
+
+form.addEventListener('submit', handleSubmit);
\ No newline at end of file
diff --git a/style.css b/style.css
new file mode 100644 (file)
index 0000000..4ad0b7f
--- /dev/null
+++ b/style.css
@@ -0,0 +1,241 @@
+:root {
+  color-scheme: dark light;
+  --primary: hsl(212deg 19% 19%);
+  --primary-stronger: hsl(212deg 80% 40%);
+  --primary-strongest: hsl(212deg 80% 50%);
+  --primary-transparent: hsl(212deg 80% 30% / 0.5);
+  --primary-complement: hsl(211deg 15% 33%);
+  --text-color: hsl(212deg 50% 98%);
+  --text-background: hsl(211deg 15% 60%);
+}
+
+@media (prefers-color-scheme: light) {
+  :root {
+    --primary: hsl(211deg 100% 96%);
+    --primary-stronger: hsl(212deg 80% 80%);
+    --primary-strongest: hsl(212deg 70% 70%);
+    --primary-transparent: hsl(211deg 98% 98% / 0.5);
+    --primary-complement: hsl(212deg 70% 88%);
+    --text-color: hsl(212deg 95% 10%);
+    --text-background: hsl(211deg 15% 60%);
+  }
+}
+
+html,
+body {
+  min-block-size: 100%;
+}
+
+body {
+  inline-size: min(100% - 32px, 720px);
+  margin-inline: auto;
+  margin-block: 16px;
+  background: radial-gradient(circle at top right, var(--primary-complement), var(--primary));
+  font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
+  color: var(--text-color);
+}
+
+header,
+nav {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  gap: 12px;
+}
+
+h1 {
+  margin-block: 0;
+}
+
+#github-link {
+  display: none;
+}
+
+@media (min-width: 34.375rem) {
+  #github-link {
+    display: initial;
+  }
+}
+
+button,
+a {
+  border: initial;
+  background: initial;
+  padding: 0;
+  line-height: 0;
+  cursor: pointer;
+}
+
+button>svg,
+a>svg {
+  width: 24px;
+  height: 24px;
+  padding: 11px;
+  border-radius: 16px;
+  background: var(--primary-complement);
+  color: var(--text-color);
+  transition: filter 900ms;
+}
+
+:is(button>svg, a>svg):hover,
+:is(button:focus-within, a:focus-within) svg {
+  filter: brightness(115%) drop-shadow(0 0 16px var(--primary-complement));
+  transition: filter 200ms;
+}
+
+main {
+  margin-block-start: 16px;
+  padding-block-start: 16px;
+  border-block-start: 4px solid var(--primary-complement);
+}
+
+form,
+form>div {
+  display: flex;
+  flex-direction: column;
+}
+
+form {
+  gap: 16px;
+}
+
+form>div {
+  position: relative;
+}
+
+@media (prefers-reduced-motion: no-preference) {
+  form>div::before {
+    content: "";
+    display: block;
+    position: absolute;
+    inset-block-start: -4px;
+    inset-inline-start: -16px;
+    inline-size: 8px;
+    block-size: calc(100% + 8px);
+    background: var(--primary-strongest);
+    transform: scaleY(0);
+  }
+
+  form>div:focus-within::before {
+    transform: scaleY(1);
+    transition: transform 200ms;
+  }
+
+  form>div::after {
+    content: "";
+    display: block;
+    position: absolute;
+    z-index: -1;
+    inset-block-start: -4px;
+    inset-inline-start: -8px;
+    inline-size: calc(100% + 16px);
+    block-size: calc(100% + 8px);
+    background: radial-gradient(circle at left, var(--primary-complement), transparent 30%);
+    opacity: 0;
+  }
+
+  form>div:focus-within::after {
+    opacity: 1;
+    transition: opacity 250ms;
+    transition-delay: 100ms;
+  }
+}
+
+label {
+  font-size: 1.1rem;
+  font-weight: 700;
+}
+
+aside {
+  opacity: 0.7;
+  transition: opacity 700ms;
+}
+
+form>div:focus-within aside {
+  opacity: 1;
+  transition: opacity 200ms;
+}
+
+@media (min-width: 88rem) {
+  aside {
+    position: absolute;
+    inset-block-start: 26px;
+    inset-inline-end: -8px;
+    transform: translateX(100%);
+    max-inline-size: 30ch;
+  }
+}
+
+input {
+  min-block-size: 24px;
+  padding: 8px;
+  margin-block-start: 8px;
+  border-radius: 8px;
+}
+
+output {
+  font-weight: 500;
+  font-size: 1.1rem;
+}
+
+.text-button {
+  inline-size: fit-content;
+  background: var(--primary-strongest);
+  color: var(--text-color);
+  padding-inline: 16px;
+  padding-block: 14px;
+  border: 1px solid var(--primary-transparent);
+  border-radius: 16px;
+  line-height: normal;
+  font-weight: 600;
+  transition: filter 900ms, border-color 900ms;
+}
+
+.text-button:enabled:hover,
+.text-button:enabled:focus-within {
+  filter: brightness(115%) drop-shadow(0 0 16px var(--primary-complement));
+  border: 1px solid var(--primary-strongest);
+  transition: filter 200ms, border-color 200ms;
+}
+
+.text-button:disabled {
+  background: var(--primary-complement);
+  filter: brightness(95%);
+  border: none;
+}
+
+.success::before {
+  content: "✔ ";
+}
+
+.failure::before {
+  content: "❌ ";
+}
+
+output::after {
+  content: "";
+  position: fixed;
+  z-index: -1;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 90px;
+  opacity: 1;
+}
+
+@media (prefers-reduced-motion: no-preference) {
+  .success::after {
+    background-repeat: repeat-x;
+    background-image: url("data:image/svg+xml,%3Csvg width='600' height='90' viewBox='0 0 600 90' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='42' y='-10' width='6' height='10'/%3E%3Crect x='84' y='-10' width='6' height='10'/%3E%3Crect x='126' y='-13' width='5' height='13'/%3E%3Crect x='168' y='-13' width='5' height='13'/%3E%3Crect x='210' y='-10' width='6' height='10'/%3E%3Crect x='252' y='-13' width='5' height='13'/%3E%3Crect x='294' y='-10' width='6' height='10'/%3E%3Crect x='336' y='-13' width='5' height='13'/%3E%3Crect x='378' y='-13' width='5' height='13'/%3E%3Crect x='420' y='-10' width='6' height='10'/%3E%3Crect x='462' y='-10' width='6' height='10'/%3E%3Crect x='504' y='-13' width='5' height='13'/%3E%3Crect x='546' y='-10' width='6' height='10'/%3E%3Cstyle type='text/css'%3E rect %7B opacity: 0; %7D rect:nth-child(1) %7B transform-origin: 45px 5px; transform: rotate(-145deg); animation: blast 700ms infinite ease-out; animation-delay: 88ms; animation-duration: 631ms; %7D rect:nth-child(2) %7B transform-origin: 87px 5px; transform: rotate(164deg); animation: blast 700ms infinite ease-out; animation-delay: 131ms; animation-duration: 442ms; %7D rect:nth-child(3) %7B transform-origin: 128px 6px; transform: rotate(4deg); animation: blast 700ms infinite ease-out; animation-delay: 92ms; animation-duration: 662ms; %7D rect:nth-child(4) %7B transform-origin: 170px 6px; transform: rotate(-175deg); animation: blast 700ms infinite ease-out; animation-delay: 17ms; animation-duration: 593ms; %7D rect:nth-child(5) %7B transform-origin: 213px 5px; transform: rotate(-97deg); animation: blast 700ms infinite ease-out; animation-delay: 122ms; animation-duration: 476ms; %7D rect:nth-child(6) %7B transform-origin: 255px 6px; transform: rotate(57deg); animation: blast 700ms infinite ease-out; animation-delay: 271ms; animation-duration: 381ms; %7D rect:nth-child(7) %7B transform-origin: 297px 5px; transform: rotate(-46deg); animation: blast 700ms infinite ease-out; animation-delay: 131ms; animation-duration: 619ms; %7D rect:nth-child(8) %7B transform-origin: 338px 6px; transform: rotate(-65deg); animation: blast 700ms infinite ease-out; animation-delay: 85ms; animation-duration: 668ms; %7D rect:nth-child(9) %7B transform-origin: 380px 6px; transform: rotate(13deg); animation: blast 700ms infinite ease-out; animation-delay: 128ms; animation-duration: 377ms; %7D rect:nth-child(10) %7B transform-origin: 423px 5px; transform: rotate(176deg); animation: blast 700ms infinite ease-out; animation-delay: 311ms; animation-duration: 508ms; %7D rect:nth-child(11) %7B transform-origin: 465px 5px; transform: rotate(108deg); animation: blast 700ms infinite ease-out; animation-delay: 108ms; animation-duration: 595ms; %7D rect:nth-child(12) %7B transform-origin: 506px 6px; transform: rotate(62deg); animation: blast 700ms infinite ease-out; animation-delay: 105ms; animation-duration: 375ms; %7D rect:nth-child(13) %7B transform-origin: 549px 5px; transform: rotate(16deg); animation: blast 700ms infinite ease-out; animation-delay: 149ms; animation-duration: 491ms; %7D rect:nth-child(odd) %7B fill: %2365BB5C; %7D rect:nth-child(even) %7B z-index: 1; fill: %2333AAFF; %7D rect:nth-child(4n) %7B animation-duration: 1400ms; fill: %23F23B14; %7D rect:nth-child(3n) %7B animation-duration: 1750ms; animation-delay: 700ms; %7D rect:nth-child(4n-7) %7B fill: %232A2F6A; %7D rect:nth-child(6n) %7B fill: %23FBBA23; %7D @keyframes blast %7B from %7B opacity: 0; %7D 20%25 %7B opacity: 1; %7D to %7B transform: translateY(90px); %7D %7D %3C/style%3E%3C/svg%3E%0A");
+    opacity: 0;
+    transition: opacity 250ms;
+    transition-delay: 2s;
+  }
+}
+
+#connect {
+  max-inline-size: 18ch;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
\ No newline at end of file
This page took 0.072701 seconds and 4 git commands to generate.