From 2eb7861950cceb6fca62631c4bebf126d5e70004 Mon Sep 17 00:00:00 2001 From: Elliot Braem <16282460+elliotBraem@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:02:42 -0400 Subject: [PATCH] update build --- dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 7958f3e2..6aab7c2b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var r="object"==typeof exports?t(require("react")):t(e.React);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(global,e=>(()=>{"use strict";var t,r,n,i,o={764:function(e,t,r){var n;let i=r(238),o=r(665),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l;t.INSPECT_MAX_BYTES=50;l.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!l.TYPED_ARRAY_SUPPORT&&"undefined"!=typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return f(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!l.isEncoding(t))throw TypeError("Unknown encoding: "+t);let r=0|g(e,t),n=s(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(q(e,Uint8Array)){let t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(q(e,SharedArrayBuffer)||e&&q(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);let i=function(e){if(l.isBuffer(e)){let t=0|p(e.length),r=s(t);return 0===r.length?r:(e.copy(r,0,0,t),r)}if(void 0!==e.length)return"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return c(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function f(e){return u(e),s(e<0?0:0|p(e))}l.alloc=function(e,t,r){var n,i,o;return n=e,i=t,o=r,(u(n),n<=0)?s(n):void 0!==i?"string"==typeof o?s(n).fill(i,o):s(n).fill(i):s(n)},l.allocUnsafe=function(e){return f(e)},l.allocUnsafeSlow=function(e){return f(e)};function h(e){let t=e.length<0?0:0|p(e.length),r=s(t);for(let n=0;n=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+"7fffffff bytes");return 0|e}function g(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return R(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return n?-1:R(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0))return"";for(!e&&(e="utf8");;)switch(e){case"hex":return function(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),function(e){return e!=e}(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)return i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r);return b(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let o,a=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let n=-1;for(o=r;os&&(r=s-l),o=r;o>=0;o--){let r=!0;for(let n=0;nn.length?(!l.isBuffer(t)&&(t=l.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else if(l.isBuffer(t))t.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return n},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},a&&(l.prototype[a]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,i){if(q(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;let o=i-n,a=r-t,s=Math.min(o,a),c=this.slice(n,i),u=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let w=this.length-t;if((void 0===r||r>w)&&(r=w),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");!n&&(n="utf8");let E=!1;for(;;)switch(n){case"hex":return function(e,t,r,n){let i;r=Number(r)||0;let o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;let a=t.length;for(n>a/2&&(n=a/2),i=0;i>8,i=r%256,o.push(i),o.push(n);return o}(v,m.length-y),m,y,b);default:if(E)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),E=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function w(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+a<=r){let r,n,s,l;switch(a){case 1:t<128&&(o=t);break;case 2:(192&(r=e[i+1]))==128&&(l=(31&t)<<6|63&r)>127&&(o=l);break;case 3:r=e[i+1],n=e[i+2],(192&r)==128&&(192&n)==128&&(l=(15&t)<<12|(63&r)<<6|63&n)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],(192&r)==128&&(192&n)==128&&(192&s)==128&&(l=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(e){let t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nr)throw RangeError("Trying to access beyond buffer length")}function S(e,t,r,n,i,o){if(!l.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function k(e,t,r,n,i){B(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function x(e,t,r,n,i){B(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function _(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function I(e,t,r,n,i){return t=+t,r>>>=0,!i&&_(e,t,r,4,34028234663852886e22,-34028234663852886e22),o.write(e,t,r,n,23,4),r+4}function C(e,t,r,n,i){return t=+t,r>>>=0,!i&&_(e,t,r,8,17976931348623157e292,-17976931348623157e292),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){let r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,!r&&E(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,!r&&E(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,!t&&E(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,!t&&E(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,!t&&E(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,!t&&E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,!t&&E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=D(function(e){T(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&P(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+16777216*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+16777216*r;return BigInt(n)+(BigInt(i)<>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&P(e,this.length-8);let n=16777216*t+65536*this[++e]+256*this[++e]+this[++e],i=16777216*this[++e]+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,!r&&E(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,!r&&E(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return(e>>>=0,!t&&E(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,!t&&E(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,!t&&E(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,!t&&E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,!t&&E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=D(function(e){T(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&P(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24))<>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&P(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<>>=0,!t&&E(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,!t&&E(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,!t&&E(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,!t&&E(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;S(this,e,t,r,n,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;S(this,e,t,r,n,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=D(function(e,t=0){return k(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=D(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);S(this,e,t,r,n-1,-n)}let i=0,o=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);S(this,e,t,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=D(function(e,t=0){return k(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=D(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return C(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return C(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw TypeError("argument should be a Buffer");if(!r&&(r=0),!n&&0!==n&&(n=this.length),t>=e.length&&(t=e.length),!t&&(t=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,!e&&(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}A("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),A("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),A("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>4294967296?i=O(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=O(i)),i+="n"),n+=` It must be ${t}. Received ${i}`},RangeError);function B(e,t,r,n,i,o){var a,s,l;if(e>r||e3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${(o+1)*8}${i}`:`>= -(2${i} ** ${(o+1)*8-1}${i}) and < 2 ** ${(o+1)*8-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new N.ERR_OUT_OF_RANGE("value",n,e)}a=n,s=i,l=o,T(s,"offset"),(void 0===a[s]||void 0===a[s+l])&&P(s,a.length-(l+1))}function T(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function P(e,t,r){if(Math.floor(e)!==e)throw T(e,r),new N.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}let U=/[^+/0-9A-Za-z-_]/g;function R(e,t){let r;t=t||1/0;let n=e.length,i=null,o=[];for(let a=0;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function j(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function M(e,t,r,n){let i;for(i=0;i=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}let L=function(){let e="0123456789abcdef",t=Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function D(e){return"undefined"==typeof BigInt?$:e}function $(){throw Error("BigInt not supported")}},238:function(e){e.exports=require("base64-js")},665:function(e){e.exports=require("ieee754")},169:function(t){t.exports=e}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return o[e](r,r.exports,s),r.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};s.r(l),s.d(l,{useAccountId:()=>eQ,Widget:()=>r4,CommitButton:()=>tV,useNear:()=>eJ,useCache:()=>tw,utils:()=>c,useInitNear:()=>eL,EthersProviderContext:()=>t5,useAccount:()=>eZ});var c={};s.r(c),s.d(c,{ErrorFallback:()=>R,ErrorScopes:()=>P,Loading:()=>U,MaxGasPerTransaction:()=>N,OneNear:()=>B,ReactKey:()=>eh,StorageCostPerByte:()=>A,TGas:()=>C,availableNearBalance:()=>H,bigMax:()=>G,bigMin:()=>J,bigToString:()=>V,computeSrcOrCode:()=>ev,computeWritePermission:()=>eu,convertToStringLeaves:()=>ei,dateToString:()=>W,deepCopy:()=>ep,deepEqual:()=>em,deepFreeze:()=>ef,displayGas:()=>z,displayNear:()=>K,displayTime:()=>X,estimateDataSize:()=>ee,extractKeys:()=>et,filterValues:()=>eg,indexMatch:()=>el,ipfsUpload:()=>Z,ipfsUrl:()=>Q,isArray:()=>q,isFunction:()=>D,isObject:()=>F,isReactObject:()=>ed,isString:()=>L,isValidAccountId:()=>j,isoDate:()=>Y,keysToCamel:()=>$,patternMatch:()=>es,removeDuplicates:()=>er});var u=s("169"),f=s.n(u),h=require("@swc/helpers/_/_async_to_generator"),d=require("@swc/helpers/_/_sliced_to_array"),p=require("@swc/helpers/_/_ts_generator"),g=require("react-singleton-hook"),m=require("@swc/helpers/_/_object_spread"),v=require("@swc/helpers/_/_object_spread_props"),y=require("near-api-js"),b=require("big.js"),w=s.n(b),E=require("deep-equal"),S=s.n(E),k=require("ethers"),x=require("bn.js"),_=s.n(x),I=s(764).Buffer,C=w()(10).pow(12),N=C.mul(250),A=w()(10).pow(19),O=/^(([a-z\d]+[-_])*[a-z\d]+\.)*([a-z\d]+[-_])*[a-z\d]+$/,B=w()(10).pow(24),T=B.div(2),P={Boundary:"Component triggered an Error Boundary",Compilation:"Compilation error",Execution:"Execution error",Render:"Render error",Source:"Source code not found"},U=f().createElement("span",{className:"spinner-grow spinner-grow-sm me-1",style:{animationDelay:"2s"},role:"status","aria-hidden":"true"}),R=e=>{var t=e.error;return f().createElement("div",{role:"alert"},f().createElement("p",null,"Something went wrong:"),f().createElement("pre",null,t.message))};function j(e){return e&&e.length>=2&&e.length<=64&&e.match(O)}var M=e=>e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),q=e=>Array.isArray(e),F=e=>e===Object(e)&&!q(e)&&"function"!=typeof e,L=e=>"string"==typeof e,D=e=>"function"==typeof e,$=function(e){if(F(e)){var t={};return Object.keys(e).forEach(r=>{t[M(r)]=$(e[r])}),t}return q(e)?e.map(e=>$(e)):e},J=(e,t)=>e&&t?e.lt(t)?e:t:e||t,G=(e,t)=>e&&t?e.gt(t)?e:t:e||t,V=(e,t,r)=>{if(null===e)return"???";var n=e.toFixed(),i=n.indexOf(".");if(t=t||6,r=r||7,i>0){var o=Math.min(t,Math.max(r-i,0));o>0&&(o+=1),i+o=0;a-=3)n=n.slice(0,a+1)+","+n.slice(a+1);return"0.000000"===n&&6===t&&7===r?"<0.000001":n},K=e=>e?e.eq(1)?f().createElement(f().Fragment,null,"1 ",f().createElement("span",{className:"text-secondary"},"yoctoNEAR")):f().createElement(f().Fragment,null,V(e.div(B))," ",f().createElement("span",{className:"text-secondary"},"NEAR")):"???",z=e=>e?f().createElement(f().Fragment,null,V(e.div(C))," ",f().createElement("span",{className:"text-secondary"},"TGas")):"???",W=e=>e.toLocaleString("en-us",{day:"numeric",month:"short",year:"numeric"}),X=e=>e.toLocaleString(),H=e=>{if(e&&!e.loading&&e.state){var t=w()(e.state.amount).sub(w()(e.state.storage_usage).mul(w()(A)));if(t.gt(T))return t.sub(T)}return w()(0)},Y=e=>e?new Date(e).toISOString().substring(0,10):"",Z=function(){var e=(0,h._)(function(e){return(0,p._)(this,function(t){switch(t.label){case 0:return[4,fetch("https://ipfs.near.social/add",{method:"POST",headers:{Accept:"application/json"},body:e})];case 1:return[4,t.sent().json()];case 2:return[2,t.sent().cid]}})});return function(t){return e.apply(this,arguments)}}(),Q=e=>`https://ipfs.near.social/ipfs/${e}`,ee=(e,t)=>F(e)?Object.entries(e).reduce((e,r)=>{var n=(0,d._)(r,2),i=n[0],o=n[1],a=F(t)?t[i]:void 0;return e+(void 0!==a?ee(o,a):2*i.length+ee(o,void 0)+140)},F(t)?0:98):((null==e?void 0:e.length)||8)-(L(t)?t.length:0),et=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Object.entries(e).map(e=>{var r=(0,d._)(e,2),n=r[0],i=r[1];return F(i)?et(i,`${t}${n}/`):`${t}${n}`}).flat()},er=(e,t)=>{var r=Object.entries(e).reduce((e,r)=>{var n=(0,d._)(r,2),i=n[0],o=n[1],a=F(t)?t[i]:void 0;if(F(o)){var s=F(a)?er(o,a):o;void 0!==s&&(e[i]=s)}else o!==a&&(e[i]=o);return e},{});return Object.keys(r).length?r:void 0},en=e=>L(e)||null===e?e:JSON.stringify(e),ei=e=>F(e)?Object.entries(e).reduce((e,t)=>{var r=(0,d._)(t,2),n=r[0],i=r[1];return e[en(n)]=ei(i),e},{}):en(e),eo=(e,t)=>{var r=t[0],n="**"===r;return n?1===t.length:("*"===r||n?Object.values(e):e.hasOwnProperty(r)?[e[r]]:[]).some(e=>F(e)?t.length>1?eo(e,t.slice(1)):void 0!==e[""]:1===t.length)},ea=(e,t)=>{var r=t[0];return("*"===r?Object.values(e):e.hasOwnProperty(r)?[e[r]]:[]).some(e=>1===t.length||F(e)&&ea(e,t.slice(1)))},es=(e,t,r)=>{var n=t.split("/");return"get"===e?eo(r,n):"keys"===e&&ea(r,n)},el=(e,t,r)=>Object.values(r).some(r=>{var n,i=null==r?void 0:null===(n=r.index)||void 0===n?void 0:n[e];try{return i&&JSON.stringify(JSON.parse(i).key)===JSON.stringify(t)}catch(e){return!1}}),ec={graph:!0,post:!0,index:!0,settings:!0},eu=(e,t)=>{var r=F(e)?JSON.parse(JSON.stringify(e)):{};return F(t)&&Object.entries(t).forEach(e=>{var t=(0,d._)(e,2),n=t[0],i=t[1];if(ec.hasOwnProperty(n)){if(F(i)){var o=r[n]=r[n]||{};Object.keys(i).forEach(e=>{o[e]=!0})}else r[n]=!0}else r[n]=!0}),r},ef=e=>(Object.freeze(e),Object.keys(e).forEach(t=>{if(!Object.getOwnPropertyDescriptor(e,t).get&&"object"==typeof e[t]&&!Object.isFrozen(e[t]))ef(e[t])}),e),eh="$$typeof",ed=e=>null!==e&&"object"==typeof e&&!!e[eh],ep=e=>{if(Array.isArray(e))return e.map(e=>ep(e));if(e instanceof Map)return new Map([...e.entries()].map(e=>{var t=(0,d._)(e,2),r=t[0],n=t[1];return[ep(r),ep(n)]}));if(e instanceof Set)return new Set([...e].map(e=>ep(e)));else if(I.isBuffer(e))return I.from(e);else if(e instanceof URL)return new URL(e);else if(e instanceof File)return new File([e],e.name,{type:e.type});else if(e instanceof Blob)return new Blob([e],{type:e.type});else if(e instanceof Uint8Array||e instanceof ArrayBuffer)return e.slice(0);else if(e instanceof k.ethers.BigNumber||e instanceof x.BN||e instanceof w())return e;else if(e instanceof Date)return new Date(e);else if(e instanceof WebSocket)return e;else if(F(e))return ed(e)?e:Object.fromEntries(Object.entries(e).map(e=>{var t=(0,d._)(e,2);return[t[0],ep(t[1])]}));else if(void 0===e||"function"==typeof e)return e;else return JSON.parse(JSON.stringify(e))},eg=e=>F(e)?Object.fromEntries(Object.entries(e).filter(e=>{var t=(0,d._)(e,2);return void 0!==(t[0],t[1])})):e,em=S(),ev=(e,t,r)=>{var n=e?{src:e}:t?{code:t}:null,i=!0,o=!1,a=void 0;try{for(var s,l=(r||[])[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var c=s.value;if(null==n?void 0:n.src){var u=n.src,f=F(null==c?void 0:c.redirectMap)&&c.redirectMap[u];if(!f)try{f=D(null==c?void 0:c.redirect)&&c.redirect(u)}catch(e){}if(L(f))n={src:f};else if(L(null==f?void 0:f.code))return{code:f.code}}}}catch(e){o=!0,a=e}finally{try{!i&&null!=l.return&&l.return()}finally{if(o)throw a}}return n},ey=s(764).Buffer,eb="PENDING_TRANSACTION_AFTER_SIGNIN",ew=(e,t,r,n)=>({type:"FunctionCall",params:{methodName:e,args:t,gas:r,deposit:n}}),eE={networkId:"testnet",nodeUrl:"https://rpc.testnet.near.org",archivalNodeUrl:"https://rpc.testnet.internal.near.org",contractName:"v1.social08.testnet",walletUrl:"https://wallet.testnet.near.org",wrapNearAccountId:"wrap.testnet",apiUrl:"https://discovery-api.stage.testnet.near.org",enableWeb4FastRpc:!1},eS={networkId:"mainnet",nodeUrl:"https://rpc.mainnet.near.org",archivalNodeUrl:"https://rpc.mainnet.internal.near.org",contractName:"social.near",walletUrl:"https://wallet.near.org",wrapNearAccountId:"wrap.near",apiUrl:"https://api.near.social",enableWeb4FastRpc:!1},ek={get:!0,keys:!0},ex=function(){var e=(0,h._)(function(e,t,r,n,i){var o;return(0,p._)(this,function(a){switch(a.label){case 0:if(!e.apiUrl||!ek.hasOwnProperty(t))return[2,i()];r=r||{},n&&(r.blockHeight=n),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(`${e.apiUrl}/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})];case 2:return[4,a.sent().json()];case 3:return[2,a.sent()];case 4:return o=a.sent(),console.log("API call failed",t,r),console.error(o),[2,i()];case 5:return[2]}})});return function(t,r,n,i,o){return e.apply(this,arguments)}}();function e_(e){return new y.keyStores.BrowserLocalStorageKeyStore(window.localStorage,`${e}:keystore:`)}function eI(e,t){return eC.apply(this,arguments)}function eC(){return(eC=(0,h._)(function(e,t){var r,n,i,o;return(0,p._)(this,function(a){switch(a.label){case 0:return r=e_(t),[4,e.selector];case 1:if(!(n=a.sent()))return[3,4];return[4,n.wallet()];case 2:return i=a.sent(),[4,y.connect({keyStore:r,walletUrl:i.metadata.walletUrl,networkId:e.config.networkId,nodeUrl:e.config.nodeUrl,headers:{}})];case 3:return o=a.sent(),[2,new y.WalletConnection(o,t)];case 4:return[2]}})})).apply(this,arguments)}function eN(){return(eN=(0,h._)(function(e,t){var r,n,i,o,a,s,l,c,u;return(0,p._)(this,function(f){switch(f.label){case 0:return[4,eI(e,r=t.contractName)];case 1:if(!(n=f.sent())._walletBaseUrl)return[3,2];return sessionStorage.setItem(eb,JSON.stringify(t)),n.requestSignIn({contractId:r,methodNames:[]}),[3,7];case 2:return i=y.utils.KeyPair.fromRandom("ed25519"),o=y.transactions.functionCallAccessKey(r,[]),a=i.getPublicKey(),[4,e.selector.then(e=>e.wallet())];case 3:return[4,(s=f.sent()).getAccounts()];case 4:var h,d,p,g,m;return c=(l=f.sent()[0]).accountId,[4,s.signAndSendTransactions({transactions:[{receiverId:c,actions:[{type:"AddKey",params:{publicKey:a.toString(),accessKey:{permission:o.permission.functionCall}}}],gas:C.mul(30)},(h=t.contractName,d=t.methodName,p=t.args,g=t.gas,m=t.deposit,{receiverId:h,actions:[ew(d,p,g.toFixed(0),m.toFixed(0))]})]})];case 5:return u=f.sent(),[4,e_(r).setKey(e.config.networkId,c,i)];case 6:return f.sent(),localStorage.setItem(`${r}_wallet_auth_key`,JSON.stringify({accountId:c,allKeys:[l.publicKey]})),[2,u];case 7:return[2]}})})).apply(this,arguments)}function eA(){return(eA=(0,h._)(function(e,t){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,eI(e,t)];case 1:return[2,r.sent().isSignedIn()]}})})).apply(this,arguments)}function eO(e,t,r,n,i,o){return eB.apply(this,arguments)}function eB(){return(eB=(0,h._)(function(e,t,r,n,i,o){var a,s;return(0,p._)(this,function(l){switch(l.label){case 0:return l.trys.push([0,7,,8]),[4,e.selector];case 1:return[4,l.sent().wallet()];case 2:if(a=l.sent(),!(t!==e.contract.contractId))return[3,5];return[4,eI(e,t)];case 3:if(!(s=l.sent()).isSignedIn())return[3,5];return[4,s.account().functionCall({contractId:t,methodName:r,args:n,gas:i})];case 4:case 6:return[2,l.sent()];case 5:return[4,a.signAndSendTransaction({receiverId:t,actions:[ew(r,n,null!=i?i:C.mul(30).toFixed(0),null!=o?o:"0")]})];case 7:throw l.sent();case 8:return[2]}})})).apply(this,arguments)}function eT(){return(eT=(0,h._)(function(e,t){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,new y.Account(e.nearConnection.connection,t).state()];case 1:return[2,r.sent()]}})})).apply(this,arguments)}function eP(e,t){return eU.apply(this,arguments)}function eU(){return(eU=(0,h._)(function(e,t){var r,n,i,o,a,s,l,c,u;return(0,p._)(this,function(f){switch(f.label){case 0:if(1!==t.length)return[3,2];if(n=(r=t[0]).contractName,i=r.methodName,o=r.args,a=r.gas,!(!(s=r.deposit)||"0"===s.toString()))return[3,2];return[4,eO(e,n,i,o,null==a?void 0:a.toString())];case 1:case 5:return[2,f.sent()];case 2:return f.trys.push([2,6,,7]),[4,e.selector];case 3:return[4,f.sent().wallet()];case 4:return l=f.sent(),c=[],u=w()(0),t.forEach(e=>{var t,r=e.contractName,n=e.methodName,i=e.args,o=e.gas,a=e.deposit,s=u.add(o),l=ew(n,i,o.toFixed(0),a.toFixed(0));(null===(t=c[c.length-1])||void 0===t?void 0:t.receiverId)!==r||s.gt(N)?(c.push({receiverId:r,actions:[]}),u=o):u=s,c[c.length-1].actions.push(l)}),[4,l.signAndSendTransactions({transactions:c})];case 6:throw f.sent();case 7:return[2]}})})).apply(this,arguments)}function eR(){return(eR=(0,h._)(function(e,t){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,e.selector];case 1:return[4,r.sent().wallet()];case 2:return[2,r.sent().signMessage(t)]}})})).apply(this,arguments)}function ej(){return(ej=(0,h._)(function(e,t,r,n,i,o){var a;return(0,p._)(this,function(s){switch(s.label){case 0:return i=i||{},[4,e.query({request_type:"call_function",account_id:r,method_name:n,args_base64:ey.from(JSON.stringify(i)).toString("base64"),block_id:t,finality:o})];case 1:return[2,(a=s.sent()).result&&a.result.length>0&&JSON.parse(ey.from(a.result).toString())]}})})).apply(this,arguments)}function eM(){return(eM=(0,h._)(function(e,t,r,n){var i,o;return(0,p._)(this,function(a){switch(a.label){case 0:r=r||{},i=new URL(`https://rpc.web4.near.page/account/${e}/view/${t}`),Object.entries(r).forEach(e=>{var t=(0,d._)(e,2),r=t[0],n=t[1];void 0!==n&&i.searchParams.append(`${r}.json`,JSON.stringify(n))}),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(i.toString())];case 2:return[4,a.sent().json()];case 3:return[2,a.sent()];case 4:return o=a.sent(),console.log("Web4 view call failed",i.toString()),console.error(o),[2,n()];case 5:return[2]}})})).apply(this,arguments)}function eq(e){return eF.apply(this,arguments)}function eF(){return(eF=(0,h._)(function(e){var t,r,n,i,o,a,s,l,c,u,f,d,g,m,v,b;return(0,p._)(this,function(w){switch(w.label){case 0:return t=e.networkId,r=e.config,i=void 0===(n=e.errorCallback)?()=>{}:n,o=e.keyStore,a=e.selector,l=void 0===(s=e.walletConnectCallback)?()=>{}:s,u=void 0===(c=e.customElements)?{}:c,d=void 0===(f=e.features)?{}:f,!r&&(r={},!t&&(r.networkId="mainnet")),t&&!r.networkId&&(r.networkId=t),"mainnet"===r.networkId?r=Object.assign({},eS,r):"testnet"===r.networkId&&(r=Object.assign({},eE,r)),r.walletConnectCallback=l,r.errorCallback=i,r.customElements=Object.assign({},r.customElements,u),o=null!=o?o:new y.keyStores.BrowserLocalStorageKeyStore,[4,y.connect(Object.assign({deps:{keyStore:o}},r))];case 1:var E,S,k,x,_,I,C,N;if(g=w.sent(),(m={config:r,selector:a,keyStore:o,nearConnection:g,features:d}).nearArchivalConnection=y.Connection.fromConfig({networkId:r.networkId,provider:{type:"JsonRpcProvider",args:{url:r.archivalNodeUrl}},signer:{type:"InMemorySigner",keyStore:o}}),v=e=>{var t;return"optimistic"===e||"final"===e?{finality:e,blockId:void 0}:null!=e?{finality:void 0,blockId:parseInt(e)}:{finality:null!==(t=r.defaultFinality)&&void 0!==t?t:"optimistic",blockId:void 0}},m.signMessage=e=>(function(e,t){return eR.apply(this,arguments)})(m,e),m.viewCall=(e,t,n,i)=>{var o=v(i),a=o.blockId,s=o.finality,l=()=>(function(e,t,r,n,i,o){return ej.apply(this,arguments)})(a?m.nearArchivalConnection.provider:m.nearConnection.connection.provider,null!=a?a:void 0,e,t,n,s),c=()=>"optimistic"===s&&r.enableWeb4FastRpc?function(e,t,r,n){return eM.apply(this,arguments)}(e,t,n,l):l();return e===r.contractName&&(a||"final"===s)?ex(r,t,n,a,c):c()},m.block=e=>{var t=v(e);return(t.blockId?m.nearArchivalConnection.provider:m.nearConnection.connection.provider).block(t)},m.functionCall=(e,t,r,n,i)=>eO(m,e,t,r,n,i),m.sendTransactions=e=>eP(m,e),m.isSignedIntoContract=(E=(0,h._)(function(e){return(0,p._)(this,function(t){return[2,function(e,t){return eA.apply(this,arguments)}(m,e)]})}),function(e){return E.apply(this,arguments)}),m.signInAndSetPendingTransaction=(S=(0,h._)(function(e){return(0,p._)(this,function(t){return[2,function(e,t){return eN.apply(this,arguments)}(m,e)]})}),function(e){return S.apply(this,arguments)}),m.contract=(k=m,x=r.contractName,I=(_={viewMethods:["storage_balance_of","get","get_num_accounts","get_accounts_paged","is_write_permission_granted","keys"],changeMethods:["set","grant_write_permission","storage_deposit","storage_withdraw"]}).viewMethods,C=_.changeMethods,N={near:k,contractId:x},(void 0===I?[]:I).forEach(e=>{N[e]=t=>k.viewCall(x,e,t)}),(void 0===C?[]:C).forEach(e=>{N[e]=(t,r,n)=>k.functionCall(x,e,t,r,n)}),N),m.accountState=e=>(function(e,t){return eT.apply(this,arguments)})(m,e),!(b=JSON.parse(sessionStorage.getItem(eb))))return[3,7];return console.log("found pending transaction",b),[4,eI(m,b.contractName)];case 2:if(!w.sent())return[3,7];console.log("sending pending transaction",b),w.label=3;case 3:return w.trys.push([3,5,,6]),[4,eP(m,[b])];case 4:return w.sent(),[3,6];case 5:return console.error("error sending pending transaction",w.sent()),[3,6];case 6:sessionStorage.removeItem(eb),w.label=7;case 7:return[2,m]}})})).apply(this,arguments)}var eL=(0,g.singletonHook)({},()=>{var e=(0,d._)((0,u.useState)(null),2),t=e[0],r=e[1];return{nearPromise:t,initNear:(0,u.useMemo)(()=>e=>{var t,n=(null===(t=e.config)||void 0===t?void 0:t.networkId)||e.networkId;return r(Promise.all(["testnet"===n?e:(0,v._)((0,m._)({},e),{networkId:"testnet",config:void 0,keyStore:void 0,selector:void 0}),"mainnet"===n?e:(0,v._)((0,m._)({},e),{networkId:"mainnet",config:void 0,keyStore:void 0,selector:void 0})].concat("mainnet"!==n&&"testnet"!==n?e:[]).map(eq)).then(e=>e.map(e=>(0,v._)((0,m._)({},e),{default:e.config.networkId===n}))))},[])}}),eD=[],e$=(0,g.singletonHook)(eD,()=>{var e=(0,d._)((0,u.useState)(eD),2),t=e[0],r=e[1],n=eL().nearPromise;return((0,u.useEffect)(()=>{n&&n.then(r)},[n]),t)?{default:t.find(e=>e.default),testnet:t.find(e=>"testnet"===e.config.networkId),mainnet:t.find(e=>"mainnet"===e.config.networkId)}:t}),eJ=e=>e$()[e||"default"]||null,eG=require("local-storage"),eV=s.n(eG),eK="near-social-vm:v01:",ez=eK+":accountId:",eW=eK+":pretendAccountId:",eX={loading:!0,signedAccountId:null!==(t=eV().get(ez))&&void 0!==t?t:void 0,pretendAccountId:null!==(r=eV().get(eW))&&void 0!==r?r:void 0,accountId:null!==(i=null!==(n=eV().get(eW))&&void 0!==n?n:eV().get(ez))&&void 0!==i?i:void 0,state:null,near:null};function eH(){return(eH=(0,h._)(function(e,t){var r,n,i,o,a,s;return(0,p._)(this,function(l){switch(l.label){case 0:if(e.connectedContractId=null==t?void 0:null===(r=t.contract)||void 0===r?void 0:r.contractId,!(e.connectedContractId&&e.connectedContractId!==e.config.contractName&&e.connectedContractId!==e.config.allowExternalContract))return[3,4];return[4,e.selector];case 1:return[4,(o=l.sent()).wallet()];case 2:return[4,l.sent().signOut()];case 3:l.sent(),e.connectedContractId=null,t=o.store.getState(),l.label=4;case 4:if(e.accountId=null!==(a=null==t?void 0:null===(i=t.accounts)||void 0===i?void 0:null===(n=i[0])||void 0===n?void 0:n.accountId)&&void 0!==a?a:null,e.accountId){e.publicKey=null;try{(null==t?void 0:t.selectedWalletId)==="here-wallet"&&(s=eV().get("herewallet:keystore"),e.publicKey=y.KeyPair.fromString(s[e.config.networkId].accounts[e.accountId]).getPublicKey())}catch(e){console.error(e)}if(!e.publicKey)try{e.publicKey=y.KeyPair.fromString(eV().get((null==t?void 0:t.selectedWalletId)==="meteor-wallet"?`_meteor_wallet${e.accountId}:${e.config.networkId}`:`near-api-js:keystore:${e.accountId}:${e.config.networkId}`)).getPublicKey()}catch(e){console.error(e)}}return[2]}})})).apply(this,arguments)}var eY=function(){var e=(0,h._)(function(e,t){var r,n,i,o,a,s,l;return(0,p._)(this,function(c){switch(c.label){case 0:var u;if((r=e.accountId)?(eV().set(ez,r),e.config.walletConnectCallback(r)):eV().remove(ez),o={loading:!1,signedAccountId:r,pretendAccountId:i=null!==(n=eV().get(eW))&&void 0!==n?n:void 0,accountId:null!=i?i:r,state:null,near:e,refresh:(0,h._)(function(){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,eY(e,t)];case 1:return[2,r.sent()]}})}),startPretending:(u=(0,h._)(function(r){return(0,p._)(this,function(n){switch(n.label){case 0:return r?eV().set(eW,r):eV().remove(eW),[4,eY(e,t)];case 1:return n.sent(),[2]}})}),function(e){return u.apply(this,arguments)})},!r)return[3,2];return[4,Promise.all([e.contract.storage_balance_of({account_id:r}),e.accountState(r)])];case 1:s=(a=d._.apply(void 0,[c.sent(),2]))[0],l=a[1],o.storageBalance=s,o.state=l,c.label=2;case 2:return t(o),[2]}})});return function(t,r){return e.apply(this,arguments)}}(),eZ=(0,g.singletonHook)(eX,()=>{var e=(0,d._)((0,u.useState)(eX),2),t=e[0],r=e[1],n=eJ();return(0,u.useEffect)(()=>{if(!!n)n.selector.then(e=>{e.store.observable.subscribe(function(){var e=(0,h._)(function(e){return(0,p._)(this,function(t){switch(t.label){case 0:return[4,function(e,t){return eH.apply(this,arguments)}(n,e)];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,4,,5]),[4,eY(n,r)];case 3:return t.sent(),[3,5];case 4:return console.error(t.sent()),[3,5];case 5:return[2]}})});return function(t){return e.apply(this,arguments)}}())})},[n]),t}),eQ=e=>{var t=eJ(),r=eZ();if(!!t&&(!e||t.config.networkId===e))return r.accountId},e0=require("@swc/helpers/_/_object_without_properties"),e1=require("react-bootstrap/Modal"),e2=s.n(e1),e4=require("react-bootstrap/Alert"),e6=s.n(e4),e3=require("react-bootstrap/Toast"),e5=s.n(e3),e8=require("react-bootstrap/ToastContainer"),e7=s.n(e8),e9=require("remark-gfm"),te=s.n(e9),tt=require("react-markdown"),tr=s.n(tt),tn=require("react-syntax-highlighter"),ti=require("react-syntax-highlighter/dist/esm/styles/prism"),to=require("mdast-util-find-and-replace"),ta=/@((?:(?:[a-z\d]+[-_])*[a-z\d]+\.)*(?:[a-z\d]+[-_])*[a-z\d]+)/gi;function ts(){function e(e,t,r){if(/[\w`]/.test(r.input.charAt(r.index-1))||/[/\w`]/.test(r.input.charAt(r.index+e.length))||t.length<2||t.length>64)return!1;var n={type:"text",value:e};return n={type:"strong",children:[n],data:{hProperties:{accountId:t}}}}return function(t){return(0,to.findAndReplace)(t,ta,e),t}}var tl=/#(\w+)/gi;function tc(){function e(e,t,r){if(/[\w`]/.test(r.input.charAt(r.index-1))||/[/\w`]/.test(r.input.charAt(r.index+e.length)))return!1;var n={type:"text",value:e};return n={type:"strong",children:[n],data:{hProperties:{hashtag:t}}}}return function(t){return(0,to.findAndReplace)(t,tl,e),t}}var tu=e=>{var t=e.onLink,r=e.onLinkClick,n=e.text,i=e.onMention,o=e.onHashtag,a=e.onImage,s=e.syntaxHighlighterProps;return f().createElement(tr(),{plugins:[],rehypePlugins:[],remarkPlugins:[te(),ts,tc],children:n,components:{strong(e){var t,r,n,a,s=e.node,l=e.children,c=(0,e0._)(e,["node","children"]);return i&&(null===(t=s.properties)||void 0===t?void 0:t.accountId)?i(null===(n=s.properties)||void 0===n?void 0:n.accountId):o&&(null===(r=s.properties)||void 0===r?void 0:r.hashtag)?o(null===(a=s.properties)||void 0===a?void 0:a.hashtag):f().createElement("strong",c,l)},a:e=>{var n,i=e.node,o=(0,e0._)(e,["node"]);return t?t((0,v._)((0,m._)({},o),{href:null===(n=i.properties)||void 0===n?void 0:n.href})):r?f().createElement("a",(0,m._)({onClick:r},o)):f().createElement("a",(0,m._)({target:"_blank"},o))},img:e=>{e.node;var t=(0,e0._)(e,["node"]);return a?a((0,m._)({},t)):f().createElement("img",(0,m._)({className:"img-fluid"},t))},blockquote:e=>{e.node;var t=(0,e0._)(e,["node"]);return f().createElement("blockquote",(0,m._)({className:"blockquote"},t))},table:e=>{e.node;var t=(0,e0._)(e,["node"]);return f().createElement("table",(0,m._)({className:"table table-striped"},t))},code(e){e.node;var t=e.inline,r=e.className,n=e.children,i=(0,e0._)(e,["node","inline","className","children"]),o=/language-(\w+)/.exec(r||""),a=null!=s?s:{},l=a.wrapLines,c=a.lineProps,u=a.showLineNumbers,h=a.lineNumberStyle;return!t&&o?f().createElement(tn.Prism,(0,m._)({children:String(n).replace(/\n$/,""),style:ti.tomorrow,language:o[1],PreTag:"div",wrapLines:l,lineProps:c,showLineNumbers:u,lineNumberStyle:h},i)):f().createElement("code",(0,m._)({className:r},i),n)}}})},tf=require("idb"),th={ViewCall:"ViewCall",Fetch:"Fetch",Block:"Block",LocalStorage:"LocalStorage",CustomPromise:"CustomPromise",EthersCall:"EthersCall"},td={NotStarted:"NotStarted",InProgress:"InProgress",Done:"Done",Invalidated:"Invalidated"},tp="cache-v1";class tg{invalidateCallbacks(e,t){var r;if(null===(r=e.invalidationCallbacks)||void 0===r?void 0:r.length){var n=e.invalidationCallbacks;e.invalidationCallbacks=[],setTimeout(()=>{n.forEach(e=>{try{e()}catch(e){}})},t?this.finalSynchronizationDelayMs+50:50)}}innerGet(e){var t=this;return(0,h._)(function(){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,t.dbPromise];case 1:return[2,r.sent().get(tp,e)]}})})()}innerSet(e,t){var r=this;return(0,h._)(function(){return(0,p._)(this,function(n){switch(n.label){case 0:return[4,r.dbPromise];case 1:return[2,n.sent().put(tp,t,e)]}})})()}cachedPromise(e,t,r,n){e=JSON.stringify(e);var i=this.cache[e]||{status:td.NotStarted,invalidationCallbacks:[],result:null,time:new Date().getTime()};if(this.cache[e]=i,!F(r)&&(r={onInvalidate:r}),r.onInvalidate&&i.invalidationCallbacks.push(r.onInvalidate),!i.subscription&&r.subscribe){var o=()=>{i.subscription=setTimeout(()=>{document.hidden?o():(i.subscription=null,i.status=td.Invalidated,this.invalidateCallbacks(i,!1))},5e3)};o()}return i.status===td.InProgress||i.status===td.Done&&i.time+3e5>new Date().getTime()?i.result:(i.status===td.NotStarted&&!(null==n?void 0:n.ignoreCache)&&this.innerGet(e).then(e=>{(e||(null==n?void 0:n.forceCachedValue))&&i.status===td.InProgress&&(i.result=e,i.time=new Date().getTime(),this.invalidateCallbacks(i,!1))}),i.status=td.InProgress,t&&t().then(t=>{i.status=td.Done,i.time=new Date().getTime(),JSON.stringify(t)!==JSON.stringify(i.result)&&(i.result=t,this.innerSet(e,t),this.invalidateCallbacks(i,!1))}).catch(t=>{console.error(t),i.status=td.Done;var r=void 0;i.time=new Date().getTime(),JSON.stringify(r)!==JSON.stringify(i.result)&&(i.result=r,this.innerSet(e,r),this.invalidateCallbacks(i,!1))}),i.result)}invalidateCache(e,t){var r=[],n=`${e.config.apiUrl}/index`;Object.keys(this.cache).forEach(i=>{try{o=JSON.parse(i)}catch(e){console.error("Key deserialization failed",i);return}if(o.action!==th.ViewCall||o.contractId!==e.config.contractName||o.blockId&&"optimistic"!==o.blockId&&"final"!==o.blockId)o.action===th.ViewCall&&o.contractId===t&&r.push([i,"final"===o.blockId]);else try{;(null===(a=o.args)||void 0===a?void 0:a.keys).some(e=>es(o.methodName,e,t))&&r.push([i,"final"===o.blockId])}catch(e){}if(o.action===th.Fetch&&o.url===n)try{var o,a,s,l=JSON.parse(null===(s=o.options)||void 0===s?void 0:s.body),c=l.action,u=l.key;c&&u&&el(c,u,t)&&r.push([i,!0])}catch(e){}}),console.log("Cache invalidation",r),r.forEach(e=>{var t=(0,d._)(e,2),r=t[0],n=t[1],i=this.cache[r];i.status=td.Invalidated,this.invalidateCallbacks(i,n)})}cachedBlock(e,t,r,n){return this.cachedPromise({action:th.Block,blockId:t},()=>e.block(t),r,n)}cachedViewCall(e,t,r,n,i,o,a){return this.cachedPromise({action:th.ViewCall,contractId:t,methodName:r,args:n,blockId:i},()=>e.viewCall(t,r,n,i),o,a)}asyncFetch(e,t){return(0,h._)(function(){var r,n,i,o,a,s,l;return(0,p._)(this,function(c){switch(c.label){case 0:n=null==t?void 0:null===(r=t.responseType)||void 0===r?void 0:r.toLowerCase(),t={method:null==t?void 0:t.method,headers:null==t?void 0:t.headers,body:null==t?void 0:t.body},c.label=1;case 1:return c.trys.push([1,6,,7]),[4,fetch(e,t)];case 2:if(o=(i=c.sent()).status,a=i.ok,s=i.headers.get("content-type"),!a)return[3,4];return[4,"arraybuffer"===n?i.arrayBuffer():"blob"===n?i.blob():"formdata"===n?i.formData():"json"===n?i.json():"text"===n?i.text():s&&-1!==s.indexOf("application/json")?i.json():i.text()];case 3:return l=c.sent(),[3,5];case 4:l=void 0,c.label=5;case 5:return[2,{ok:a,status:o,contentType:s,body:l}];case 6:return[2,{ok:!1,error:c.sent().message}];case 7:return[2]}})})()}cachedFetch(e,t,r,n){return this.cachedPromise({action:th.Fetch,url:e,options:t},()=>this.asyncFetch(e,t),r,n)}cachedCustomPromise(e,t,r,n){return this.cachedPromise({action:th.CustomPromise,key:e},()=>t(),r,n)}socialGet(e,t,r,n,i,o,a){if(!e)return null;var s={keys:t=(t=Array.isArray(t)?t:[t]).map(e=>r?`${e}/**`:`${e}`),options:i},l=this.cachedViewCall(e,e.config.contractName,"get",s,n,o,a);if(null===l)return null;if(1===t.length){for(var c=t[0].split("/"),u=0;ue[t](...r),n,i):null}constructor(e,t){this.dbPromise=(0,tf.openDB)(void 0===e?"cacheDb":e,1,{upgrade(e){e.createObjectStore(tp)}}),this.cache={},this.finalSynchronizationDelayMs=void 0===t?3e3:t}}var tm=new tg,tv=new tg("secondaryCacheDb"),ty=(0,g.singletonHook)(tm,()=>tm),tb=(0,g.singletonHook)(tv,()=>tv),tw=e=>{var t=eJ(),r=ty(),n=tb();return e&&e!==t.config.networkId?n:r},tE=require("react-uuid"),tS=s.n(tE),tk=e=>{var t=JSON.stringify(e,null,2);return`\`\`\`json +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var r="object"==typeof exports?t(require("react")):t(e.React);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(global,e=>(()=>{"use strict";var t,r,n,i,o={764:function(e,t,r){var n;let i=r(238),o=r(665),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l;t.INSPECT_MAX_BYTES=50;l.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!l.TYPED_ARRAY_SUPPORT&&"undefined"!=typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return f(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!l.isEncoding(t))throw TypeError("Unknown encoding: "+t);let r=0|g(e,t),n=s(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(q(e,Uint8Array)){let t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(q(e,SharedArrayBuffer)||e&&q(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);let i=function(e){if(l.isBuffer(e)){let t=0|p(e.length),r=s(t);return 0===r.length?r:(e.copy(r,0,0,t),r)}if(void 0!==e.length)return"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return c(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function f(e){return u(e),s(e<0?0:0|p(e))}l.alloc=function(e,t,r){var n,i,o;return n=e,i=t,o=r,(u(n),n<=0)?s(n):void 0!==i?"string"==typeof o?s(n).fill(i,o):s(n).fill(i):s(n)},l.allocUnsafe=function(e){return f(e)},l.allocUnsafeSlow=function(e){return f(e)};function h(e){let t=e.length<0?0:0|p(e.length),r=s(t);for(let n=0;n=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+"7fffffff bytes");return 0|e}function g(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return R(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(i)return n?-1:R(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0))return"";for(!e&&(e="utf8");;)switch(e){case"hex":return function(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),function(e){return e!=e}(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)return i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r);return b(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let o,a=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let n=-1;for(o=r;os&&(r=s-l),o=r;o>=0;o--){let r=!0;for(let n=0;nn.length?(!l.isBuffer(t)&&(t=l.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else if(l.isBuffer(t))t.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return n},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},a&&(l.prototype[a]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,i){if(q(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;let o=i-n,a=r-t,s=Math.min(o,a),c=this.slice(n,i),u=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let w=this.length-t;if((void 0===r||r>w)&&(r=w),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");!n&&(n="utf8");let E=!1;for(;;)switch(n){case"hex":return function(e,t,r,n){let i;r=Number(r)||0;let o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;let a=t.length;for(n>a/2&&(n=a/2),i=0;i>8,i=r%256,o.push(i),o.push(n);return o}(v,m.length-y),m,y,b);default:if(E)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),E=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function w(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+a<=r){let r,n,s,l;switch(a){case 1:t<128&&(o=t);break;case 2:(192&(r=e[i+1]))==128&&(l=(31&t)<<6|63&r)>127&&(o=l);break;case 3:r=e[i+1],n=e[i+2],(192&r)==128&&(192&n)==128&&(l=(15&t)<<12|(63&r)<<6|63&n)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],(192&r)==128&&(192&n)==128&&(192&s)==128&&(l=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(e){let t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nr)throw RangeError("Trying to access beyond buffer length")}function S(e,t,r,n,i,o){if(!l.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function k(e,t,r,n,i){B(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function x(e,t,r,n,i){B(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function _(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function I(e,t,r,n,i){return t=+t,r>>>=0,!i&&_(e,t,r,4,34028234663852886e22,-34028234663852886e22),o.write(e,t,r,n,23,4),r+4}function C(e,t,r,n,i){return t=+t,r>>>=0,!i&&_(e,t,r,8,17976931348623157e292,-17976931348623157e292),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){let r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,!r&&E(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,!r&&E(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,!t&&E(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,!t&&E(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,!t&&E(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,!t&&E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,!t&&E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=D(function(e){T(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&P(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+16777216*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+16777216*r;return BigInt(n)+(BigInt(i)<>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&P(e,this.length-8);let n=16777216*t+65536*this[++e]+256*this[++e]+this[++e],i=16777216*this[++e]+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,!r&&E(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,!r&&E(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return(e>>>=0,!t&&E(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,!t&&E(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,!t&&E(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,!t&&E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,!t&&E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=D(function(e){T(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&P(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24))<>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&P(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<>>=0,!t&&E(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,!t&&E(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,!t&&E(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,!t&&E(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;S(this,e,t,r,n,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;S(this,e,t,r,n,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=D(function(e,t=0){return k(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=D(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);S(this,e,t,r,n-1,-n)}let i=0,o=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);S(this,e,t,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,!r&&S(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=D(function(e,t=0){return k(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=D(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return C(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return C(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw TypeError("argument should be a Buffer");if(!r&&(r=0),!n&&0!==n&&(n=this.length),t>=e.length&&(t=e.length),!t&&(t=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,!e&&(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}A("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),A("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),A("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>4294967296?i=O(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=O(i)),i+="n"),n+=` It must be ${t}. Received ${i}`},RangeError);function B(e,t,r,n,i,o){var a,s,l;if(e>r||e3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${(o+1)*8}${i}`:`>= -(2${i} ** ${(o+1)*8-1}${i}) and < 2 ** ${(o+1)*8-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new N.ERR_OUT_OF_RANGE("value",n,e)}a=n,s=i,l=o,T(s,"offset"),(void 0===a[s]||void 0===a[s+l])&&P(s,a.length-(l+1))}function T(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function P(e,t,r){if(Math.floor(e)!==e)throw T(e,r),new N.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}let U=/[^+/0-9A-Za-z-_]/g;function R(e,t){let r;t=t||1/0;let n=e.length,i=null,o=[];for(let a=0;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function j(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function M(e,t,r,n){let i;for(i=0;i=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}let L=function(){let e="0123456789abcdef",t=Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function D(e){return"undefined"==typeof BigInt?$:e}function $(){throw Error("BigInt not supported")}},238:function(e){e.exports=require("base64-js")},665:function(e){e.exports=require("ieee754")},359:function(t){t.exports=e}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return o[e](r,r.exports,s),r.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};s.r(l),s.d(l,{useAccountId:()=>eQ,Widget:()=>r4,CommitButton:()=>tV,useNear:()=>eJ,useCache:()=>tw,utils:()=>c,useInitNear:()=>eL,EthersProviderContext:()=>t5,useAccount:()=>eZ});var c={};s.r(c),s.d(c,{ErrorFallback:()=>R,ErrorScopes:()=>P,Loading:()=>U,MaxGasPerTransaction:()=>N,OneNear:()=>B,ReactKey:()=>eh,StorageCostPerByte:()=>A,TGas:()=>C,availableNearBalance:()=>H,bigMax:()=>G,bigMin:()=>J,bigToString:()=>V,computeSrcOrCode:()=>ev,computeWritePermission:()=>eu,convertToStringLeaves:()=>ei,dateToString:()=>W,deepCopy:()=>ep,deepEqual:()=>em,deepFreeze:()=>ef,displayGas:()=>z,displayNear:()=>K,displayTime:()=>X,estimateDataSize:()=>ee,extractKeys:()=>et,filterValues:()=>eg,indexMatch:()=>el,ipfsUpload:()=>Z,ipfsUrl:()=>Q,isArray:()=>q,isFunction:()=>D,isObject:()=>F,isReactObject:()=>ed,isString:()=>L,isValidAccountId:()=>j,isoDate:()=>Y,keysToCamel:()=>$,patternMatch:()=>es,removeDuplicates:()=>er});var u=s("359"),f=s.n(u),h=require("@swc/helpers/_/_async_to_generator"),d=require("@swc/helpers/_/_sliced_to_array"),p=require("@swc/helpers/_/_ts_generator"),g=require("react-singleton-hook"),m=require("@swc/helpers/_/_object_spread"),v=require("@swc/helpers/_/_object_spread_props"),y=require("near-api-js"),b=require("big.js"),w=s.n(b),E=require("deep-equal"),S=s.n(E),k=require("ethers"),x=require("bn.js"),_=s.n(x),I=s(764).Buffer,C=w()(10).pow(12),N=C.mul(250),A=w()(10).pow(19),O=/^(([a-z\d]+[-_])*[a-z\d]+\.)*([a-z\d]+[-_])*[a-z\d]+$/,B=w()(10).pow(24),T=B.div(2),P={Boundary:"Component triggered an Error Boundary",Compilation:"Compilation error",Execution:"Execution error",Render:"Render error",Source:"Source code not found"},U=f().createElement("span",{className:"spinner-grow spinner-grow-sm me-1",style:{animationDelay:"2s"},role:"status","aria-hidden":"true"}),R=e=>{var t=e.error;return f().createElement("div",{role:"alert"},f().createElement("p",null,"Something went wrong:"),f().createElement("pre",null,t.message))};function j(e){return e&&e.length>=2&&e.length<=64&&e.match(O)}var M=e=>e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),q=e=>Array.isArray(e),F=e=>e===Object(e)&&!q(e)&&"function"!=typeof e,L=e=>"string"==typeof e,D=e=>"function"==typeof e,$=function(e){if(F(e)){var t={};return Object.keys(e).forEach(r=>{t[M(r)]=$(e[r])}),t}return q(e)?e.map(e=>$(e)):e},J=(e,t)=>e&&t?e.lt(t)?e:t:e||t,G=(e,t)=>e&&t?e.gt(t)?e:t:e||t,V=(e,t,r)=>{if(null===e)return"???";var n=e.toFixed(),i=n.indexOf(".");if(t=t||6,r=r||7,i>0){var o=Math.min(t,Math.max(r-i,0));o>0&&(o+=1),i+o=0;a-=3)n=n.slice(0,a+1)+","+n.slice(a+1);return"0.000000"===n&&6===t&&7===r?"<0.000001":n},K=e=>e?e.eq(1)?f().createElement(f().Fragment,null,"1 ",f().createElement("span",{className:"text-secondary"},"yoctoNEAR")):f().createElement(f().Fragment,null,V(e.div(B))," ",f().createElement("span",{className:"text-secondary"},"NEAR")):"???",z=e=>e?f().createElement(f().Fragment,null,V(e.div(C))," ",f().createElement("span",{className:"text-secondary"},"TGas")):"???",W=e=>e.toLocaleString("en-us",{day:"numeric",month:"short",year:"numeric"}),X=e=>e.toLocaleString(),H=e=>{if(e&&!e.loading&&e.state){var t=w()(e.state.amount).sub(w()(e.state.storage_usage).mul(w()(A)));if(t.gt(T))return t.sub(T)}return w()(0)},Y=e=>e?new Date(e).toISOString().substring(0,10):"",Z=function(){var e=(0,h._)(function(e){return(0,p._)(this,function(t){switch(t.label){case 0:return[4,fetch("https://ipfs.near.social/add",{method:"POST",headers:{Accept:"application/json"},body:e})];case 1:return[4,t.sent().json()];case 2:return[2,t.sent().cid]}})});return function(t){return e.apply(this,arguments)}}(),Q=e=>`https://ipfs.near.social/ipfs/${e}`,ee=(e,t)=>F(e)?Object.entries(e).reduce((e,r)=>{var n=(0,d._)(r,2),i=n[0],o=n[1],a=F(t)?t[i]:void 0;return e+(void 0!==a?ee(o,a):2*i.length+ee(o,void 0)+140)},F(t)?0:98):((null==e?void 0:e.length)||8)-(L(t)?t.length:0),et=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Object.entries(e).map(e=>{var r=(0,d._)(e,2),n=r[0],i=r[1];return F(i)?et(i,`${t}${n}/`):`${t}${n}`}).flat()},er=(e,t)=>{var r=Object.entries(e).reduce((e,r)=>{var n=(0,d._)(r,2),i=n[0],o=n[1],a=F(t)?t[i]:void 0;if(F(o)){var s=F(a)?er(o,a):o;void 0!==s&&(e[i]=s)}else o!==a&&(e[i]=o);return e},{});return Object.keys(r).length?r:void 0},en=e=>L(e)||null===e?e:JSON.stringify(e),ei=e=>F(e)?Object.entries(e).reduce((e,t)=>{var r=(0,d._)(t,2),n=r[0],i=r[1];return e[en(n)]=ei(i),e},{}):en(e),eo=(e,t)=>{var r=t[0],n="**"===r;return n?1===t.length:("*"===r||n?Object.values(e):e.hasOwnProperty(r)?[e[r]]:[]).some(e=>F(e)?t.length>1?eo(e,t.slice(1)):void 0!==e[""]:1===t.length)},ea=(e,t)=>{var r=t[0];return("*"===r?Object.values(e):e.hasOwnProperty(r)?[e[r]]:[]).some(e=>1===t.length||F(e)&&ea(e,t.slice(1)))},es=(e,t,r)=>{var n=t.split("/");return"get"===e?eo(r,n):"keys"===e&&ea(r,n)},el=(e,t,r)=>Object.values(r).some(r=>{var n,i=null==r?void 0:null===(n=r.index)||void 0===n?void 0:n[e];try{return i&&JSON.stringify(JSON.parse(i).key)===JSON.stringify(t)}catch(e){return!1}}),ec={graph:!0,post:!0,index:!0,settings:!0},eu=(e,t)=>{var r=F(e)?JSON.parse(JSON.stringify(e)):{};return F(t)&&Object.entries(t).forEach(e=>{var t=(0,d._)(e,2),n=t[0],i=t[1];if(ec.hasOwnProperty(n)){if(F(i)){var o=r[n]=r[n]||{};Object.keys(i).forEach(e=>{o[e]=!0})}else r[n]=!0}else r[n]=!0}),r},ef=e=>(Object.freeze(e),Object.keys(e).forEach(t=>{if(!Object.getOwnPropertyDescriptor(e,t).get&&"object"==typeof e[t]&&!Object.isFrozen(e[t]))ef(e[t])}),e),eh="$$typeof",ed=e=>null!==e&&"object"==typeof e&&!!e[eh],ep=e=>{if(Array.isArray(e))return e.map(e=>ep(e));if(e instanceof Map)return new Map([...e.entries()].map(e=>{var t=(0,d._)(e,2),r=t[0],n=t[1];return[ep(r),ep(n)]}));if(e instanceof Set)return new Set([...e].map(e=>ep(e)));else if(I.isBuffer(e))return I.from(e);else if(e instanceof URL)return new URL(e);else if(e instanceof File)return new File([e],e.name,{type:e.type});else if(e instanceof Blob)return new Blob([e],{type:e.type});else if(e instanceof Uint8Array||e instanceof ArrayBuffer)return e.slice(0);else if(e instanceof k.ethers.BigNumber||e instanceof x.BN||e instanceof w())return e;else if(e instanceof Date)return new Date(e);else if(e instanceof WebSocket)return e;else if(F(e))return ed(e)?e:Object.fromEntries(Object.entries(e).map(e=>{var t=(0,d._)(e,2);return[t[0],ep(t[1])]}));else if(void 0===e||"function"==typeof e)return e;else return JSON.parse(JSON.stringify(e))},eg=e=>F(e)?Object.fromEntries(Object.entries(e).filter(e=>{var t=(0,d._)(e,2);return void 0!==(t[0],t[1])})):e,em=S(),ev=(e,t,r)=>{var n=e?{src:e}:t?{code:t}:null,i=!0,o=!1,a=void 0;try{for(var s,l=(r||[])[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var c=s.value;if(null==n?void 0:n.src){var u=n.src,f=F(null==c?void 0:c.redirectMap)&&c.redirectMap[u];if(!f)try{f=D(null==c?void 0:c.redirect)&&c.redirect(u)}catch(e){}if(L(f))n={src:f};else if(L(null==f?void 0:f.code))return{code:f.code}}}}catch(e){o=!0,a=e}finally{try{!i&&null!=l.return&&l.return()}finally{if(o)throw a}}return n},ey=s(764).Buffer,eb="PENDING_TRANSACTION_AFTER_SIGNIN",ew=(e,t,r,n)=>({type:"FunctionCall",params:{methodName:e,args:t,gas:r,deposit:n}}),eE={networkId:"testnet",nodeUrl:"https://rpc.testnet.near.org",archivalNodeUrl:"https://rpc.testnet.internal.near.org",contractName:"v1.social08.testnet",walletUrl:"https://wallet.testnet.near.org",wrapNearAccountId:"wrap.testnet",apiUrl:"https://discovery-api.stage.testnet.near.org",enableWeb4FastRpc:!1},eS={networkId:"mainnet",nodeUrl:"https://rpc.mainnet.near.org",archivalNodeUrl:"https://rpc.mainnet.internal.near.org",contractName:"social.near",walletUrl:"https://wallet.near.org",wrapNearAccountId:"wrap.near",apiUrl:"https://api.near.social",enableWeb4FastRpc:!1},ek={get:!0,keys:!0},ex=function(){var e=(0,h._)(function(e,t,r,n,i){var o;return(0,p._)(this,function(a){switch(a.label){case 0:if(!e.apiUrl||!ek.hasOwnProperty(t))return[2,i()];r=r||{},n&&(r.blockHeight=n),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(`${e.apiUrl}/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})];case 2:return[4,a.sent().json()];case 3:return[2,a.sent()];case 4:return o=a.sent(),console.log("API call failed",t,r),console.error(o),[2,i()];case 5:return[2]}})});return function(t,r,n,i,o){return e.apply(this,arguments)}}();function e_(e){return new y.keyStores.BrowserLocalStorageKeyStore(window.localStorage,`${e}:keystore:`)}function eI(e,t){return eC.apply(this,arguments)}function eC(){return(eC=(0,h._)(function(e,t){var r,n,i,o;return(0,p._)(this,function(a){switch(a.label){case 0:return r=e_(t),[4,e.selector];case 1:if(!(n=a.sent()))return[3,4];return[4,n.wallet()];case 2:return i=a.sent(),[4,y.connect({keyStore:r,walletUrl:i.metadata.walletUrl,networkId:e.config.networkId,nodeUrl:e.config.nodeUrl,headers:{}})];case 3:return o=a.sent(),[2,new y.WalletConnection(o,t)];case 4:return[2]}})})).apply(this,arguments)}function eN(){return(eN=(0,h._)(function(e,t){var r,n,i,o,a,s,l,c,u;return(0,p._)(this,function(f){switch(f.label){case 0:return[4,eI(e,r=t.contractName)];case 1:if(!(n=f.sent())._walletBaseUrl)return[3,2];return sessionStorage.setItem(eb,JSON.stringify(t)),n.requestSignIn({contractId:r,methodNames:[]}),[3,7];case 2:return i=y.utils.KeyPair.fromRandom("ed25519"),o=y.transactions.functionCallAccessKey(r,[]),a=i.getPublicKey(),[4,e.selector.then(e=>e.wallet())];case 3:return[4,(s=f.sent()).getAccounts()];case 4:var h,d,p,g,m;return c=(l=f.sent()[0]).accountId,[4,s.signAndSendTransactions({transactions:[{receiverId:c,actions:[{type:"AddKey",params:{publicKey:a.toString(),accessKey:{permission:o.permission.functionCall}}}],gas:C.mul(30)},(h=t.contractName,d=t.methodName,p=t.args,g=t.gas,m=t.deposit,{receiverId:h,actions:[ew(d,p,g.toFixed(0),m.toFixed(0))]})]})];case 5:return u=f.sent(),[4,e_(r).setKey(e.config.networkId,c,i)];case 6:return f.sent(),localStorage.setItem(`${r}_wallet_auth_key`,JSON.stringify({accountId:c,allKeys:[l.publicKey]})),[2,u];case 7:return[2]}})})).apply(this,arguments)}function eA(){return(eA=(0,h._)(function(e,t){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,eI(e,t)];case 1:return[2,r.sent().isSignedIn()]}})})).apply(this,arguments)}function eO(e,t,r,n,i,o){return eB.apply(this,arguments)}function eB(){return(eB=(0,h._)(function(e,t,r,n,i,o){var a,s;return(0,p._)(this,function(l){switch(l.label){case 0:return l.trys.push([0,7,,8]),[4,e.selector];case 1:return[4,l.sent().wallet()];case 2:if(a=l.sent(),!(t!==e.contract.contractId))return[3,5];return[4,eI(e,t)];case 3:if(!(s=l.sent()).isSignedIn())return[3,5];return[4,s.account().functionCall({contractId:t,methodName:r,args:n,gas:i})];case 4:case 6:return[2,l.sent()];case 5:return[4,a.signAndSendTransaction({receiverId:t,actions:[ew(r,n,null!=i?i:C.mul(30).toFixed(0),null!=o?o:"0")]})];case 7:throw l.sent();case 8:return[2]}})})).apply(this,arguments)}function eT(){return(eT=(0,h._)(function(e,t){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,new y.Account(e.nearConnection.connection,t).state()];case 1:return[2,r.sent()]}})})).apply(this,arguments)}function eP(e,t){return eU.apply(this,arguments)}function eU(){return(eU=(0,h._)(function(e,t){var r,n,i,o,a,s,l,c,u;return(0,p._)(this,function(f){switch(f.label){case 0:if(1!==t.length)return[3,2];if(n=(r=t[0]).contractName,i=r.methodName,o=r.args,a=r.gas,!(!(s=r.deposit)||"0"===s.toString()))return[3,2];return[4,eO(e,n,i,o,null==a?void 0:a.toString())];case 1:case 5:return[2,f.sent()];case 2:return f.trys.push([2,6,,7]),[4,e.selector];case 3:return[4,f.sent().wallet()];case 4:return l=f.sent(),c=[],u=w()(0),t.forEach(e=>{var t,r=e.contractName,n=e.methodName,i=e.args,o=e.gas,a=e.deposit,s=u.add(o),l=ew(n,i,o.toFixed(0),a.toFixed(0));(null===(t=c[c.length-1])||void 0===t?void 0:t.receiverId)!==r||s.gt(N)?(c.push({receiverId:r,actions:[]}),u=o):u=s,c[c.length-1].actions.push(l)}),[4,l.signAndSendTransactions({transactions:c})];case 6:throw f.sent();case 7:return[2]}})})).apply(this,arguments)}function eR(){return(eR=(0,h._)(function(e,t){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,e.selector];case 1:return[4,r.sent().wallet()];case 2:return[2,r.sent().signMessage(t)]}})})).apply(this,arguments)}function ej(){return(ej=(0,h._)(function(e,t,r,n,i,o){var a;return(0,p._)(this,function(s){switch(s.label){case 0:return i=i||{},[4,e.query({request_type:"call_function",account_id:r,method_name:n,args_base64:ey.from(JSON.stringify(i)).toString("base64"),block_id:t,finality:o})];case 1:return[2,(a=s.sent()).result&&a.result.length>0&&JSON.parse(ey.from(a.result).toString())]}})})).apply(this,arguments)}function eM(){return(eM=(0,h._)(function(e,t,r,n){var i,o;return(0,p._)(this,function(a){switch(a.label){case 0:r=r||{},i=new URL(`https://rpc.web4.near.page/account/${e}/view/${t}`),Object.entries(r).forEach(e=>{var t=(0,d._)(e,2),r=t[0],n=t[1];void 0!==n&&i.searchParams.append(`${r}.json`,JSON.stringify(n))}),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(i.toString())];case 2:return[4,a.sent().json()];case 3:return[2,a.sent()];case 4:return o=a.sent(),console.log("Web4 view call failed",i.toString()),console.error(o),[2,n()];case 5:return[2]}})})).apply(this,arguments)}function eq(e){return eF.apply(this,arguments)}function eF(){return(eF=(0,h._)(function(e){var t,r,n,i,o,a,s,l,c,u,f,d,g,m,v,b;return(0,p._)(this,function(w){switch(w.label){case 0:return t=e.networkId,r=e.config,i=void 0===(n=e.errorCallback)?()=>{}:n,o=e.keyStore,a=e.selector,l=void 0===(s=e.walletConnectCallback)?()=>{}:s,u=void 0===(c=e.customElements)?{}:c,d=void 0===(f=e.features)?{}:f,!r&&(r={},!t&&(r.networkId="mainnet")),t&&!r.networkId&&(r.networkId=t),"mainnet"===r.networkId?r=Object.assign({},eS,r):"testnet"===r.networkId&&(r=Object.assign({},eE,r)),r.walletConnectCallback=l,r.errorCallback=i,r.customElements=Object.assign({},r.customElements,u),o=null!=o?o:new y.keyStores.BrowserLocalStorageKeyStore,[4,y.connect(Object.assign({deps:{keyStore:o}},r))];case 1:var E,S,k,x,_,I,C,N;if(g=w.sent(),(m={config:r,selector:a,keyStore:o,nearConnection:g,features:d}).nearArchivalConnection=y.Connection.fromConfig({networkId:r.networkId,provider:{type:"JsonRpcProvider",args:{url:r.archivalNodeUrl}},signer:{type:"InMemorySigner",keyStore:o}}),v=e=>{var t;return"optimistic"===e||"final"===e?{finality:e,blockId:void 0}:null!=e?{finality:void 0,blockId:parseInt(e)}:{finality:null!==(t=r.defaultFinality)&&void 0!==t?t:"optimistic",blockId:void 0}},m.signMessage=e=>(function(e,t){return eR.apply(this,arguments)})(m,e),m.viewCall=(e,t,n,i)=>{var o=v(i),a=o.blockId,s=o.finality,l=()=>(function(e,t,r,n,i,o){return ej.apply(this,arguments)})(a?m.nearArchivalConnection.provider:m.nearConnection.connection.provider,null!=a?a:void 0,e,t,n,s),c=()=>"optimistic"===s&&r.enableWeb4FastRpc?function(e,t,r,n){return eM.apply(this,arguments)}(e,t,n,l):l();return e===r.contractName&&(a||"final"===s)?ex(r,t,n,a,c):c()},m.block=e=>{var t=v(e);return(t.blockId?m.nearArchivalConnection.provider:m.nearConnection.connection.provider).block(t)},m.functionCall=(e,t,r,n,i)=>eO(m,e,t,r,n,i),m.sendTransactions=e=>eP(m,e),m.isSignedIntoContract=(E=(0,h._)(function(e){return(0,p._)(this,function(t){return[2,function(e,t){return eA.apply(this,arguments)}(m,e)]})}),function(e){return E.apply(this,arguments)}),m.signInAndSetPendingTransaction=(S=(0,h._)(function(e){return(0,p._)(this,function(t){return[2,function(e,t){return eN.apply(this,arguments)}(m,e)]})}),function(e){return S.apply(this,arguments)}),m.contract=(k=m,x=r.contractName,I=(_={viewMethods:["storage_balance_of","get","get_num_accounts","get_accounts_paged","is_write_permission_granted","keys"],changeMethods:["set","grant_write_permission","storage_deposit","storage_withdraw"]}).viewMethods,C=_.changeMethods,N={near:k,contractId:x},(void 0===I?[]:I).forEach(e=>{N[e]=t=>k.viewCall(x,e,t)}),(void 0===C?[]:C).forEach(e=>{N[e]=(t,r,n)=>k.functionCall(x,e,t,r,n)}),N),m.accountState=e=>(function(e,t){return eT.apply(this,arguments)})(m,e),!(b=JSON.parse(sessionStorage.getItem(eb))))return[3,7];return console.log("found pending transaction",b),[4,eI(m,b.contractName)];case 2:if(!w.sent())return[3,7];console.log("sending pending transaction",b),w.label=3;case 3:return w.trys.push([3,5,,6]),[4,eP(m,[b])];case 4:return w.sent(),[3,6];case 5:return console.error("error sending pending transaction",w.sent()),[3,6];case 6:sessionStorage.removeItem(eb),w.label=7;case 7:return[2,m]}})})).apply(this,arguments)}var eL=(0,g.singletonHook)({},()=>{var e=(0,d._)((0,u.useState)(null),2),t=e[0],r=e[1];return{nearPromise:t,initNear:(0,u.useMemo)(()=>e=>{var t,n=(null===(t=e.config)||void 0===t?void 0:t.networkId)||e.networkId;return r(Promise.all(["testnet"===n?e:(0,v._)((0,m._)({},e),{networkId:"testnet",config:void 0,keyStore:void 0,selector:void 0}),"mainnet"===n?e:(0,v._)((0,m._)({},e),{networkId:"mainnet",config:void 0,keyStore:void 0,selector:void 0})].concat("mainnet"!==n&&"testnet"!==n?e:[]).map(eq)).then(e=>e.map(e=>(0,v._)((0,m._)({},e),{default:e.config.networkId===n}))))},[])}}),eD=[],e$=(0,g.singletonHook)(eD,()=>{var e=(0,d._)((0,u.useState)(eD),2),t=e[0],r=e[1],n=eL().nearPromise;return((0,u.useEffect)(()=>{n&&n.then(r)},[n]),t)?{default:t.find(e=>e.default),testnet:t.find(e=>"testnet"===e.config.networkId),mainnet:t.find(e=>"mainnet"===e.config.networkId)}:t}),eJ=e=>e$()[e||"default"]||null,eG=require("local-storage"),eV=s.n(eG),eK="near-social-vm:v01:",ez=eK+":accountId:",eW=eK+":pretendAccountId:",eX={loading:!0,signedAccountId:null!==(t=eV().get(ez))&&void 0!==t?t:void 0,pretendAccountId:null!==(r=eV().get(eW))&&void 0!==r?r:void 0,accountId:null!==(i=null!==(n=eV().get(eW))&&void 0!==n?n:eV().get(ez))&&void 0!==i?i:void 0,state:null,near:null};function eH(){return(eH=(0,h._)(function(e,t){var r,n,i,o,a,s;return(0,p._)(this,function(l){switch(l.label){case 0:if(e.connectedContractId=null==t?void 0:null===(r=t.contract)||void 0===r?void 0:r.contractId,!(e.connectedContractId&&e.connectedContractId!==e.config.contractName&&e.connectedContractId!==e.config.allowExternalContract))return[3,4];return[4,e.selector];case 1:return[4,(o=l.sent()).wallet()];case 2:return[4,l.sent().signOut()];case 3:l.sent(),e.connectedContractId=null,t=o.store.getState(),l.label=4;case 4:if(e.accountId=null!==(a=null==t?void 0:null===(i=t.accounts)||void 0===i?void 0:null===(n=i[0])||void 0===n?void 0:n.accountId)&&void 0!==a?a:null,e.accountId){e.publicKey=null;try{(null==t?void 0:t.selectedWalletId)==="here-wallet"&&(s=eV().get("herewallet:keystore"),e.publicKey=y.KeyPair.fromString(s[e.config.networkId].accounts[e.accountId]).getPublicKey())}catch(e){console.error(e)}if(!e.publicKey)try{e.publicKey=y.KeyPair.fromString(eV().get((null==t?void 0:t.selectedWalletId)==="meteor-wallet"?`_meteor_wallet${e.accountId}:${e.config.networkId}`:`near-api-js:keystore:${e.accountId}:${e.config.networkId}`)).getPublicKey()}catch(e){console.error(e)}}return[2]}})})).apply(this,arguments)}var eY=function(){var e=(0,h._)(function(e,t){var r,n,i,o,a,s,l;return(0,p._)(this,function(c){switch(c.label){case 0:var u;if((r=e.accountId)?(eV().set(ez,r),e.config.walletConnectCallback(r)):eV().remove(ez),o={loading:!1,signedAccountId:r,pretendAccountId:i=null!==(n=eV().get(eW))&&void 0!==n?n:void 0,accountId:null!=i?i:r,state:null,near:e,refresh:(0,h._)(function(){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,eY(e,t)];case 1:return[2,r.sent()]}})}),startPretending:(u=(0,h._)(function(r){return(0,p._)(this,function(n){switch(n.label){case 0:return r?eV().set(eW,r):eV().remove(eW),[4,eY(e,t)];case 1:return n.sent(),[2]}})}),function(e){return u.apply(this,arguments)})},!r)return[3,2];return[4,Promise.all([e.contract.storage_balance_of({account_id:r}),e.accountState(r)])];case 1:s=(a=d._.apply(void 0,[c.sent(),2]))[0],l=a[1],o.storageBalance=s,o.state=l,c.label=2;case 2:return t(o),[2]}})});return function(t,r){return e.apply(this,arguments)}}(),eZ=(0,g.singletonHook)(eX,()=>{var e=(0,d._)((0,u.useState)(eX),2),t=e[0],r=e[1],n=eJ();return(0,u.useEffect)(()=>{if(!!n)n.selector.then(e=>{e.store.observable.subscribe(function(){var e=(0,h._)(function(e){return(0,p._)(this,function(t){switch(t.label){case 0:return[4,function(e,t){return eH.apply(this,arguments)}(n,e)];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,4,,5]),[4,eY(n,r)];case 3:return t.sent(),[3,5];case 4:return console.error(t.sent()),[3,5];case 5:return[2]}})});return function(t){return e.apply(this,arguments)}}())})},[n]),t}),eQ=e=>{var t=eJ(),r=eZ();if(!!t&&(!e||t.config.networkId===e))return r.accountId},e0=require("@swc/helpers/_/_object_without_properties"),e1=require("react-bootstrap/Modal"),e2=s.n(e1),e4=require("react-bootstrap/Alert"),e6=s.n(e4),e3=require("react-bootstrap/Toast"),e5=s.n(e3),e8=require("react-bootstrap/ToastContainer"),e7=s.n(e8),e9=require("remark-gfm"),te=s.n(e9),tt=require("react-markdown"),tr=s.n(tt),tn=require("react-syntax-highlighter"),ti=require("react-syntax-highlighter/dist/esm/styles/prism"),to=require("mdast-util-find-and-replace"),ta=/@((?:(?:[a-z\d]+[-_])*[a-z\d]+\.)*(?:[a-z\d]+[-_])*[a-z\d]+)/gi;function ts(){function e(e,t,r){if(/[\w`]/.test(r.input.charAt(r.index-1))||/[/\w`]/.test(r.input.charAt(r.index+e.length))||t.length<2||t.length>64)return!1;var n={type:"text",value:e};return n={type:"strong",children:[n],data:{hProperties:{accountId:t}}}}return function(t){return(0,to.findAndReplace)(t,ta,e),t}}var tl=/#(\w+)/gi;function tc(){function e(e,t,r){if(/[\w`]/.test(r.input.charAt(r.index-1))||/[/\w`]/.test(r.input.charAt(r.index+e.length)))return!1;var n={type:"text",value:e};return n={type:"strong",children:[n],data:{hProperties:{hashtag:t}}}}return function(t){return(0,to.findAndReplace)(t,tl,e),t}}var tu=e=>{var t=e.onLink,r=e.onLinkClick,n=e.text,i=e.onMention,o=e.onHashtag,a=e.onImage,s=e.syntaxHighlighterProps;return f().createElement(tr(),{plugins:[],rehypePlugins:[],remarkPlugins:[te(),ts,tc],children:n,components:{strong(e){var t,r,n,a,s=e.node,l=e.children,c=(0,e0._)(e,["node","children"]);return i&&(null===(t=s.properties)||void 0===t?void 0:t.accountId)?i(null===(n=s.properties)||void 0===n?void 0:n.accountId):o&&(null===(r=s.properties)||void 0===r?void 0:r.hashtag)?o(null===(a=s.properties)||void 0===a?void 0:a.hashtag):f().createElement("strong",c,l)},a:e=>{var n,i=e.node,o=(0,e0._)(e,["node"]);return t?t((0,v._)((0,m._)({},o),{href:null===(n=i.properties)||void 0===n?void 0:n.href})):r?f().createElement("a",(0,m._)({onClick:r},o)):f().createElement("a",(0,m._)({target:"_blank"},o))},img:e=>{e.node;var t=(0,e0._)(e,["node"]);return a?a((0,m._)({},t)):f().createElement("img",(0,m._)({className:"img-fluid"},t))},blockquote:e=>{e.node;var t=(0,e0._)(e,["node"]);return f().createElement("blockquote",(0,m._)({className:"blockquote"},t))},table:e=>{e.node;var t=(0,e0._)(e,["node"]);return f().createElement("table",(0,m._)({className:"table table-striped"},t))},code(e){e.node;var t=e.inline,r=e.className,n=e.children,i=(0,e0._)(e,["node","inline","className","children"]),o=/language-(\w+)/.exec(r||""),a=null!=s?s:{},l=a.wrapLines,c=a.lineProps,u=a.showLineNumbers,h=a.lineNumberStyle;return!t&&o?f().createElement(tn.Prism,(0,m._)({children:String(n).replace(/\n$/,""),style:ti.tomorrow,language:o[1],PreTag:"div",wrapLines:l,lineProps:c,showLineNumbers:u,lineNumberStyle:h},i)):f().createElement("code",(0,m._)({className:r},i),n)}}})},tf=require("idb"),th={ViewCall:"ViewCall",Fetch:"Fetch",Block:"Block",LocalStorage:"LocalStorage",CustomPromise:"CustomPromise",EthersCall:"EthersCall"},td={NotStarted:"NotStarted",InProgress:"InProgress",Done:"Done",Invalidated:"Invalidated"},tp="cache-v1";class tg{invalidateCallbacks(e,t){var r;if(null===(r=e.invalidationCallbacks)||void 0===r?void 0:r.length){var n=e.invalidationCallbacks;e.invalidationCallbacks=[],setTimeout(()=>{n.forEach(e=>{try{e()}catch(e){}})},t?this.finalSynchronizationDelayMs+50:50)}}innerGet(e){var t=this;return(0,h._)(function(){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,t.dbPromise];case 1:return[2,r.sent().get(tp,e)]}})})()}innerSet(e,t){var r=this;return(0,h._)(function(){return(0,p._)(this,function(n){switch(n.label){case 0:return[4,r.dbPromise];case 1:return[2,n.sent().put(tp,t,e)]}})})()}cachedPromise(e,t,r,n){e=JSON.stringify(e);var i=this.cache[e]||{status:td.NotStarted,invalidationCallbacks:[],result:null,time:new Date().getTime()};if(this.cache[e]=i,!F(r)&&(r={onInvalidate:r}),r.onInvalidate&&i.invalidationCallbacks.push(r.onInvalidate),!i.subscription&&r.subscribe){var o=()=>{i.subscription=setTimeout(()=>{document.hidden?o():(i.subscription=null,i.status=td.Invalidated,this.invalidateCallbacks(i,!1))},5e3)};o()}return i.status===td.InProgress||i.status===td.Done&&i.time+3e5>new Date().getTime()?i.result:(i.status===td.NotStarted&&!(null==n?void 0:n.ignoreCache)&&this.innerGet(e).then(e=>{(e||(null==n?void 0:n.forceCachedValue))&&i.status===td.InProgress&&(i.result=e,i.time=new Date().getTime(),this.invalidateCallbacks(i,!1))}),i.status=td.InProgress,t&&t().then(t=>{i.status=td.Done,i.time=new Date().getTime(),JSON.stringify(t)!==JSON.stringify(i.result)&&(i.result=t,this.innerSet(e,t),this.invalidateCallbacks(i,!1))}).catch(t=>{console.error(t),i.status=td.Done;var r=void 0;i.time=new Date().getTime(),JSON.stringify(r)!==JSON.stringify(i.result)&&(i.result=r,this.innerSet(e,r),this.invalidateCallbacks(i,!1))}),i.result)}invalidateCache(e,t){var r=[],n=`${e.config.apiUrl}/index`;Object.keys(this.cache).forEach(i=>{try{o=JSON.parse(i)}catch(e){console.error("Key deserialization failed",i);return}if(o.action!==th.ViewCall||o.contractId!==e.config.contractName||o.blockId&&"optimistic"!==o.blockId&&"final"!==o.blockId)o.action===th.ViewCall&&o.contractId===t&&r.push([i,"final"===o.blockId]);else try{;(null===(a=o.args)||void 0===a?void 0:a.keys).some(e=>es(o.methodName,e,t))&&r.push([i,"final"===o.blockId])}catch(e){}if(o.action===th.Fetch&&o.url===n)try{var o,a,s,l=JSON.parse(null===(s=o.options)||void 0===s?void 0:s.body),c=l.action,u=l.key;c&&u&&el(c,u,t)&&r.push([i,!0])}catch(e){}}),console.log("Cache invalidation",r),r.forEach(e=>{var t=(0,d._)(e,2),r=t[0],n=t[1],i=this.cache[r];i.status=td.Invalidated,this.invalidateCallbacks(i,n)})}cachedBlock(e,t,r,n){return this.cachedPromise({action:th.Block,blockId:t},()=>e.block(t),r,n)}cachedViewCall(e,t,r,n,i,o,a){return this.cachedPromise({action:th.ViewCall,contractId:t,methodName:r,args:n,blockId:i},()=>e.viewCall(t,r,n,i),o,a)}asyncFetch(e,t){return(0,h._)(function(){var r,n,i,o,a,s,l;return(0,p._)(this,function(c){switch(c.label){case 0:n=null==t?void 0:null===(r=t.responseType)||void 0===r?void 0:r.toLowerCase(),t={method:null==t?void 0:t.method,headers:null==t?void 0:t.headers,body:null==t?void 0:t.body},c.label=1;case 1:return c.trys.push([1,6,,7]),[4,fetch(e,t)];case 2:if(o=(i=c.sent()).status,a=i.ok,s=i.headers.get("content-type"),!a)return[3,4];return[4,"arraybuffer"===n?i.arrayBuffer():"blob"===n?i.blob():"formdata"===n?i.formData():"json"===n?i.json():"text"===n?i.text():s&&-1!==s.indexOf("application/json")?i.json():i.text()];case 3:return l=c.sent(),[3,5];case 4:l=void 0,c.label=5;case 5:return[2,{ok:a,status:o,contentType:s,body:l}];case 6:return[2,{ok:!1,error:c.sent().message}];case 7:return[2]}})})()}cachedFetch(e,t,r,n){return this.cachedPromise({action:th.Fetch,url:e,options:t},()=>this.asyncFetch(e,t),r,n)}cachedCustomPromise(e,t,r,n){return this.cachedPromise({action:th.CustomPromise,key:e},()=>t(),r,n)}socialGet(e,t,r,n,i,o,a){if(!e)return null;var s={keys:t=(t=Array.isArray(t)?t:[t]).map(e=>r?`${e}/**`:`${e}`),options:i},l=this.cachedViewCall(e,e.config.contractName,"get",s,n,o,a);if(null===l)return null;if(1===t.length){for(var c=t[0].split("/"),u=0;ue[t](...r),n,i):null}constructor(e,t){this.dbPromise=(0,tf.openDB)(void 0===e?"cacheDb":e,1,{upgrade(e){e.createObjectStore(tp)}}),this.cache={},this.finalSynchronizationDelayMs=void 0===t?3e3:t}}var tm=new tg,tv=new tg("secondaryCacheDb"),ty=(0,g.singletonHook)(tm,()=>tm),tb=(0,g.singletonHook)(tv,()=>tv),tw=e=>{var t=eJ(),r=ty(),n=tb();return e&&e!==t.config.networkId?n:r},tE=require("react-uuid"),tS=s.n(tE),tk=e=>{var t=JSON.stringify(e,null,2);return`\`\`\`json ${t} \`\`\``},tx={page:"confirm_transactions"},t_={SendTransactionWithoutConfirmation:"send_transaction_without_confirmation"};function tI(e){var t,r,n,i,o,a=(0,u.useState)(tS()()),s=eJ(e.networkId);eQ(e.networkId);var l=tw(),c=(0,d._)((0,u.useState)(!1),2),g=c[0],m=c[1],v=(0,d._)((0,u.useState)(e.transactions),1)[0],y=(0,d._)((0,u.useState)(null),2),b=y[0],w=y[1],E=(0,d._)((0,u.useState)(!1),2),S=E[0],k=E[1],x=(0,d._)((0,u.useState)(null),2),_=x[0],I=x[1],C=e.widgetSrc,N=!!(null!==(o=null==s?void 0:null===(i=s.features)||void 0===i?void 0:i.bypassTransactionConfirmation)&&void 0!==o&&o);var A=(t=(0,h._)(function(e,t){return(0,p._)(this,function(r){switch(r.label){case 0:return[4,l.asyncLocalStorageGet(tx,{widgetSrc:e,contractId:t,type:t_.SendTransactionWithoutConfirmation})];case 1:return[2,r.sent()]}})}),function(e,r){return t.apply(this,arguments)}),O=N||v[0].contractName!==s.contract.contractId&&1===v.length&&!(v[0].deposit&&v[0].deposit.gt(0));(0,u.useEffect)(()=>{(0,h._)(function(){var e,t,r,n,i;return(0,p._)(this,function(o){switch(o.label){case 0:if(!O)return[3,5];return e=v[0].contractName,[4,s.isSignedIntoContract(e)];case 1:return t=o.sent(),[4,A(C,e)];case 2:if(r=o.sent(),w(n=N||!!(t&&r&&r[v[0].methodName])),!n)return[3,4];return m(!0),[4,s.sendTransactions(v)];case 3:i=o.sent(),m(!1),B(i),o.label=4;case 4:return[3,6];case 5:w(!1),o.label=6;case 6:return[2]}})})()},[]);var B=e.onHide,T=!!v;var P=(r=(0,h._)(function(){return(0,p._)(this,function(e){return k(!S),I(null),[2]})}),function(){return r.apply(this,arguments)});if(null===b)return f().createElement(f().Fragment,null);if(b){var R=v[0];return f().createElement(e7(),{position:"bottom-end",className:"position-fixed"},f().createElement(e5(),{show:T,bg:"info"},f().createElement(e5().Header,null,"Sending transaction ",U),f().createElement(e5().Body,null,"Calling contract"," ",f().createElement("span",{className:"font-monospace"},R.contractName)," ","with method"," ",f().createElement("span",{className:"font-monospace"},R.methodName))))}return f().createElement(e2(),{size:"xl",centered:!0,scrollable:!0,show:T,onHide:B},f().createElement(e2().Header,{closeButton:!0},f().createElement(e2().Title,null,"Confirm Transaction")),f().createElement(e2().Body,null,v&&v.map((e,t)=>f().createElement("div",{key:`${a}-${t}`},f().createElement("div",null,f().createElement("h4",null,"Transaction #",t+1)),f().createElement("div",null,f().createElement("span",{className:"text-secondary"},"Contract ID: "),f().createElement("span",{className:"font-monospace"},e.contractName)),f().createElement("div",null,f().createElement("span",{className:"text-secondary"},"Method name: "),f().createElement("span",{className:"font-monospace"},e.methodName)),e.deposit&&e.deposit.gt(0)&&f().createElement("div",null,f().createElement("span",{className:"text-secondary"},"Deposit: "),f().createElement("span",{className:"font-monospace"},K(e.deposit))),f().createElement("div",null,f().createElement("span",{className:"text-secondary"},"Gas: "),f().createElement("span",{className:"font-monospace"},z(e.gas))),f().createElement(tu,{text:tk(e.args)}))),O?f().createElement(f().Fragment,null,f().createElement("div",{class:"form-check form-switch"},f().createElement("input",{class:"form-check-input",type:"checkbox",id:"dontaskagaincheckbox",checked:S,onChange:()=>P()}),f().createElement("label",{class:"form-check-label",for:"dontaskagaincheckbox"},"Don't ask again for sending similar transactions by"," ",f().createElement("span",{className:"font-monospace"},C))),_?f().createElement(e6(),{variant:"danger"},'There was an error when choosing "Don\'t ask again":'," ",_):f().createElement(f().Fragment,null)):f().createElement(f().Fragment,null)),f().createElement(e2().Footer,null,f().createElement("button",{className:"btn btn-success",disabled:g,onClick:(n=(0,h._)(function(e){var t,r,n,i,o,a;return(0,p._)(this,function(c){switch(c.label){case 0:if(e.preventDefault(),m(!0),!S)return[3,7];return r=(t=v[0]).contractName,n=t.methodName,[4,A(C,r)];case 1:(i=c.sent()||{})[n]=!0,l.localStorageSet(tx,{widgetSrc:C,contractId:r,type:t_.SendTransactionWithoutConfirmation},i),c.label=2;case 2:return c.trys.push([2,6,,7]),[4,s.isSignedIntoContract(r)];case 3:if(c.sent())return[3,5];return[4,s.signInAndSetPendingTransaction(t)];case 4:return o=c.sent(),m(!1),B(o?o.find(e=>e.transaction.receiver_id===r):o),[2];case 5:return[3,7];case 6:return I(c.sent().message),m(!1),[2];case 7:return[4,s.sendTransactions(v)];case 8:return a=c.sent(),m(!1),B(a),[2]}})}),function(e){return n.apply(this,arguments)})},g&&U," Confirm"),f().createElement("button",{className:"btn btn-secondary",onClick:B,disabled:g},"Close")))}var tC=require("@swc/helpers/_/_type_of"),tN=require("react-files"),tA=s.n(tN),tO=require("react-infinite-scroller"),tB=s.n(tO),tT=A.mul(2e3),tP=A.mul(500),tU=A.mul(500),tR=A.mul(500),tj=function(){var e=(0,h._)(function(e,t){var r;return(0,p._)(this,function(n){switch(n.label){case 0:return r=et(t),[4,e.contract.get({keys:r})];case 1:return[2,n.sent()]}})});return function(t,r){return e.apply(this,arguments)}}(),tM=function(){var e=(0,h._)(function(e,t,r,n){var i,o,a,s,l,c,u,f,h;return(0,p._)(this,function(p){switch(p.label){case 0:return[4,e.selector];case 1:if(p.sent(),!(i=e.accountId))return alert("You're not logged in. Sign in to commit data."),[2];return[4,Promise.all([e.viewCall(e.config.contractName,"get_account_storage",{account_id:i}),i!==t?e.viewCall(e.config.contractName,"is_write_permission_granted",{predecessor_id:i,key:t}):Promise.resolve(!0)])];case 2:if(a=(o=d._.apply(void 0,[p.sent(),2]))[0],s=o[1],l=w()((null==a?void 0:a.available_bytes)||"0"),c={[t]:ei(r)},u={},n)return[3,4];return[4,tj(e,c)];case 3:u=p.sent(),c=er(c,u),p.label=4;case 4:return h=G((f=A.mul(ee(c,u)).add(a?w()(0):tP).add(s?w()(0):tR).add(tU)).sub(l.mul(A)),a?s?w()(0):w()(1):tT),[2,{originalData:r,accountId:t,accountStorage:a,availableBytes:l,currentData:u,data:c,expectedDataBalance:f,deposit:h,permissionGranted:s}]}})});return function(t,r,n,i){return e.apply(this,arguments)}}(),tq=function(){var e=(0,h._)(function(e,t,r){return(0,p._)(this,function(n){switch(n.label){case 0:return console.log("Committing data",t),[4,e.contract.set({data:t},C.mul(100).toFixed(0),r.toFixed(0))];case 1:return[2,n.sent()]}})});return function(t,r,n){return e.apply(this,arguments)}}();(function(){var e=(0,h._)(function(e,t,r){var n;return(0,p._)(this,function(i){switch(i.label){case 0:return[4,tM(e,t,r)];case 1:return[2,tq(e,(n=i.sent()).data,n.deposit)]}})});})();var tF=function(){var e=(0,h._)(function(e,t,r){var n,i;return(0,p._)(this,function(o){switch(o.label){case 0:return[4,e.selector];case 1:return[4,o.sent().wallet()];case 2:return n=o.sent(),i=[],e.publicKey&&(i.push(ew("grant_write_permission",{public_key:e.publicKey.toString(),keys:[e.accountId]},C.mul(100).toFixed(0),r.gt(0)?r.toFixed(0):"1")),r=w()(0)),i.push(ew("set",{data:t},C.mul(100).toFixed(0),r.gt(0)?r.toFixed(0):"1")),[4,n.signAndSendTransaction({receiverId:e.config.contractName,actions:i})];case 3:return[2,o.sent()]}})});return function(t,r,n){return e.apply(this,arguments)}}(),tL=require("react-bootstrap"),tD=e=>{var t=JSON.stringify(e,null,2);return`\`\`\`json ${t}