@micro-cms/crypto-auth-ui 1.0.32 → 1.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as L,b as xt}from"./chunk-73SFLUWV.mjs";var H=L(R=>{"use strict";R.byteLength=Bt;R.toByteArray=It;R.fromByteArray=Ut;var b=[],g=[],bt=typeof Uint8Array<"u"?Uint8Array:Array,P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(A=0,V=P.length;A<V;++A)b[A]=P[A],g[P.charCodeAt(A)]=A;var A,V;g[45]=62;g[95]=63;function J(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var i=r===t?0:4-r%4;return[r,i]}function Bt(e){var t=J(e),r=t[0],i=t[1];return(r+i)*3/4-i}function Et(e,t,r){return(t+r)*3/4-r}function It(e){var t,r=J(e),i=r[0],n=r[1],o=new bt(Et(e,i,n)),c=0,a=n>0?i-4:i,u;for(u=0;u<a;u+=4)t=g[e.charCodeAt(u)]<<18|g[e.charCodeAt(u+1)]<<12|g[e.charCodeAt(u+2)]<<6|g[e.charCodeAt(u+3)],o[c++]=t>>16&255,o[c++]=t>>8&255,o[c++]=t&255;return n===2&&(t=g[e.charCodeAt(u)]<<2|g[e.charCodeAt(u+1)]>>4,o[c++]=t&255),n===1&&(t=g[e.charCodeAt(u)]<<10|g[e.charCodeAt(u+1)]<<4|g[e.charCodeAt(u+2)]>>2,o[c++]=t>>8&255,o[c++]=t&255),o}function Ft(e){return b[e>>18&63]+b[e>>12&63]+b[e>>6&63]+b[e&63]}function At(e,t,r){for(var i,n=[],o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(Ft(i));return n.join("")}function Ut(e){for(var t,r=e.length,i=r%3,n=[],o=16383,c=0,a=r-i;c<a;c+=o)n.push(At(e,c,c+o>a?a:c+o));return i===1?(t=e[r-1],n.push(b[t>>2]+b[t<<4&63]+"==")):i===2&&(t=(e[r-2]<<8)+e[r-1],n.push(b[t>>10]+b[t>>4&63]+b[t<<2&63]+"=")),n.join("")}});var X=L($=>{"use strict";$.read=function(e,t,r,i,n){var o,c,a=n*8-i-1,u=(1<<a)-1,h=u>>1,p=-7,m=r?n-1:0,y=r?-1:1,w=e[t+m];for(m+=y,o=w&(1<<-p)-1,w>>=-p,p+=a;p>0;o=o*256+e[t+m],m+=y,p-=8);for(c=o&(1<<-p)-1,o>>=-p,p+=i;p>0;c=c*256+e[t+m],m+=y,p-=8);if(o===0)o=1-h;else{if(o===u)return c?NaN:(w?-1:1)*(1/0);c=c+Math.pow(2,i),o=o-h}return(w?-1:1)*c*Math.pow(2,o-i)};$.write=function(e,t,r,i,n,o){var c,a,u,h=o*8-n-1,p=(1<<h)-1,m=p>>1,y=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=i?0:o-1,F=i?1:-1,gt=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,c=p):(c=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-c))<1&&(c--,u*=2),c+m>=1?t+=y/u:t+=y*Math.pow(2,1-m),t*u>=2&&(c++,u/=2),c+m>=p?(a=0,c=p):c+m>=1?(a=(t*u-1)*Math.pow(2,n),c=c+m):(a=t*Math.pow(2,m-1)*Math.pow(2,n),c=0));n>=8;e[r+w]=a&255,w+=F,a/=256,n-=8);for(c=c<<n|a,h+=n;h>0;e[r+w]=c&255,w+=F,c/=256,h-=8);e[r+w-F]|=gt*128}});var lt=L(N=>{"use strict";var D=H(),C=X(),K=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;N.Buffer=s;N.SlowBuffer=Rt;N.INSPECT_MAX_BYTES=50;var _=2147483647;N.kMaxLength=_;s.TYPED_ARRAY_SUPPORT=kt();!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&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 kt(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function E(e){if(e>_)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return W(e)}return rt(e,t,r)}s.poolSize=8192;function rt(e,t,r){if(typeof e=="string")return St(e,t);if(ArrayBuffer.isView(e))return Nt(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(B(e,ArrayBuffer)||e&&B(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(B(e,SharedArrayBuffer)||e&&B(e.buffer,SharedArrayBuffer)))return v(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return s.from(i,t,r);let n=Tt(e);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}s.from=function(e,t,r){return rt(e,t,r)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function et(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function Ct(e,t,r){return et(e),e<=0?E(e):t!==void 0?typeof r=="string"?E(e).fill(t,r):E(e).fill(t):E(e)}s.alloc=function(e,t,r){return Ct(e,t,r)};function W(e){return et(e),E(e<0?0:q(e)|0)}s.allocUnsafe=function(e){return W(e)};s.allocUnsafeSlow=function(e){return W(e)};function St(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=it(e,t)|0,i=E(r),n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}function O(e){let t=e.length<0?0:q(e.length)|0,r=E(t);for(let i=0;i<t;i+=1)r[i]=e[i]&255;return r}function Nt(e){if(B(e,Uint8Array)){let t=new Uint8Array(e);return v(t.buffer,t.byteOffset,t.byteLength)}return O(e)}function v(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return t===void 0&&r===void 0?i=new Uint8Array(e):r===void 0?i=new Uint8Array(e,t):i=new Uint8Array(e,t,r),Object.setPrototypeOf(i,s.prototype),i}function Tt(e){if(s.isBuffer(e)){let t=q(e.length)|0,r=E(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||G(e.length)?E(0):O(e);if(e.type==="Buffer"&&Array.isArray(e.data))return O(e.data)}function q(e){if(e>=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return e|0}function Rt(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==s.prototype};s.compare=function(t,r){if(B(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),B(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(t)||!s.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let i=t.length,n=r.length;for(let o=0,c=Math.min(i,n);o<c;++o)if(t[o]!==r[o]){i=t[o],n=r[o];break}return i<n?-1:n<i?1:0};s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return s.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<t.length;++i)r+=t[i].length;let n=s.allocUnsafe(r),o=0;for(i=0;i<t.length;++i){let c=t[i];if(B(c,Uint8Array))o+c.length>n.length?(s.isBuffer(c)||(c=s.from(c)),c.copy(n,o)):Uint8Array.prototype.set.call(n,c,o);else if(s.isBuffer(c))c.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=c.length}return n};function it(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||B(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ht(e).length;default:if(n)return i?-1:j(e).length;t=(""+t).toLowerCase(),n=!0}}s.byteLength=it;function _t(e,t,r){let i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return qt(this,t,r);case"utf8":case"utf-8":return ot(this,t,r);case"ascii":return jt(this,t,r);case"latin1":case"binary":return Wt(this,t,r);case"base64":return Ot(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zt(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}s.prototype._isBuffer=!0;function U(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}s.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)U(this,r,r+1);return this};s.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)U(this,r,r+3),U(this,r+1,r+2);return this};s.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)U(this,r,r+7),U(this,r+1,r+6),U(this,r+2,r+5),U(this,r+3,r+4);return this};s.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?ot(this,0,t):_t.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:s.compare(this,t)===0};s.prototype.inspect=function(){let t="",r=N.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};K&&(s.prototype[K]=s.prototype.inspect);s.prototype.compare=function(t,r,i,n,o){if(B(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),i===void 0&&(i=t?t.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),r<0||i>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=i)return 0;if(n>=o)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,o>>>=0,this===t)return 0;let c=o-n,a=i-r,u=Math.min(c,a),h=this.slice(n,o),p=t.slice(r,i);for(let m=0;m<u;++m)if(h[m]!==p[m]){c=h[m],a=p[m];break}return c<a?-1:a<c?1:0};function nt(e,t,r,i,n){if(e.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,G(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof t=="string"&&(t=s.from(t,i)),s.isBuffer(t))return t.length===0?-1:Z(e,t,r,i,n);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Z(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Z(e,t,r,i,n){let o=1,c=e.length,a=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,c/=2,a/=2,r/=2}function u(p,m){return o===1?p[m]:p.readUInt16BE(m*o)}let h;if(n){let p=-1;for(h=r;h<c;h++)if(u(e,h)===u(t,p===-1?0:h-p)){if(p===-1&&(p=h),h-p+1===a)return p*o}else p!==-1&&(h-=h-p),p=-1}else for(r+a>c&&(r=c-a),h=r;h>=0;h--){let p=!0;for(let m=0;m<a;m++)if(u(e,h+m)!==u(t,m)){p=!1;break}if(p)return h}return-1}s.prototype.includes=function(t,r,i){return this.indexOf(t,r,i)!==-1};s.prototype.indexOf=function(t,r,i){return nt(this,t,r,i,!0)};s.prototype.lastIndexOf=function(t,r,i){return nt(this,t,r,i,!1)};function Mt(e,t,r,i){r=Number(r)||0;let n=e.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let o=t.length;i>o/2&&(i=o/2);let c;for(c=0;c<i;++c){let a=parseInt(t.substr(c*2,2),16);if(G(a))return c;e[r+c]=a}return c}function Lt(e,t,r,i){return M(j(t,e.length-r),e,r,i)}function Pt(e,t,r,i){return M(Jt(t),e,r,i)}function $t(e,t,r,i){return M(ht(t),e,r,i)}function Dt(e,t,r,i){return M(Ht(t,e.length-r),e,r,i)}s.prototype.write=function(t,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((i===void 0||i>o)&&(i=o),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let c=!1;for(;;)switch(n){case"hex":return Mt(this,t,r,i);case"utf8":case"utf-8":return Lt(this,t,r,i);case"ascii":case"latin1":case"binary":return Pt(this,t,r,i);case"base64":return $t(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Dt(this,t,r,i);default:if(c)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),c=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ot(e,t,r){return t===0&&r===e.length?D.fromByteArray(e):D.fromByteArray(e.slice(t,r))}function ot(e,t,r){r=Math.min(e.length,r);let i=[],n=t;for(;n<r;){let o=e[n],c=null,a=o>239?4:o>223?3:o>191?2:1;if(n+a<=r){let u,h,p,m;switch(a){case 1:o<128&&(c=o);break;case 2:u=e[n+1],(u&192)===128&&(m=(o&31)<<6|u&63,m>127&&(c=m));break;case 3:u=e[n+1],h=e[n+2],(u&192)===128&&(h&192)===128&&(m=(o&15)<<12|(u&63)<<6|h&63,m>2047&&(m<55296||m>57343)&&(c=m));break;case 4:u=e[n+1],h=e[n+2],p=e[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(m=(o&15)<<18|(u&63)<<12|(h&63)<<6|p&63,m>65535&&m<1114112&&(c=m))}}c===null?(c=65533,a=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|c&1023),i.push(c),n+=a}return vt(i)}var Q=4096;function vt(e){let t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=Q));return r}function jt(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]&127);return i}function Wt(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function qt(e,t,r){let i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let o=t;o<r;++o)n+=Xt[e[o]];return n}function zt(e,t,r){let i=e.slice(t,r),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}s.prototype.slice=function(t,r){let i=this.length;t=~~t,r=r===void 0?i:~~r,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<t&&(r=t);let n=this.subarray(t,r);return Object.setPrototypeOf(n,s.prototype),n};function l(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||l(t,r,this.length);let n=this[t],o=1,c=0;for(;++c<r&&(o*=256);)n+=this[t+c]*o;return n};s.prototype.readUintBE=s.prototype.readUIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||l(t,r,this.length);let n=this[t+--r],o=1;for(;r>0&&(o*=256);)n+=this[t+--r]*o;return n};s.prototype.readUint8=s.prototype.readUInt8=function(t,r){return t=t>>>0,r||l(t,1,this.length),this[t]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||l(t,2,this.length),this[t]|this[t+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||l(t,2,this.length),this[t]<<8|this[t+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||l(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||l(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};s.prototype.readBigUInt64LE=I(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&T(t,this.length-8);let n=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});s.prototype.readBigUInt64BE=I(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&T(t,this.length-8);let n=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});s.prototype.readIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||l(t,r,this.length);let n=this[t],o=1,c=0;for(;++c<r&&(o*=256);)n+=this[t+c]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*r)),n};s.prototype.readIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||l(t,r,this.length);let n=r,o=1,c=this[t+--n];for(;n>0&&(o*=256);)c+=this[t+--n]*o;return o*=128,c>=o&&(c-=Math.pow(2,8*r)),c};s.prototype.readInt8=function(t,r){return t=t>>>0,r||l(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};s.prototype.readInt16LE=function(t,r){t=t>>>0,r||l(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};s.prototype.readInt16BE=function(t,r){t=t>>>0,r||l(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};s.prototype.readInt32LE=function(t,r){return t=t>>>0,r||l(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};s.prototype.readInt32BE=function(t,r){return t=t>>>0,r||l(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};s.prototype.readBigInt64LE=I(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&T(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});s.prototype.readBigInt64BE=I(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&T(t,this.length-8);let n=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i)});s.prototype.readFloatLE=function(t,r){return t=t>>>0,r||l(t,4,this.length),C.read(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,r){return t=t>>>0,r||l(t,4,this.length),C.read(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||l(t,8,this.length),C.read(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||l(t,8,this.length),C.read(this,t,!1,52,8)};function d(e,t,r,i,n,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,r,i,n){if(t=+t,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;d(this,t,r,i,a,0)}let o=1,c=0;for(this[r]=t&255;++c<i&&(o*=256);)this[r+c]=t/o&255;return r+i};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,r,i,n){if(t=+t,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;d(this,t,r,i,a,0)}let o=i-1,c=1;for(this[r+o]=t&255;--o>=0&&(c*=256);)this[r+o]=t/c&255;return r+i};s.prototype.writeUint8=s.prototype.writeUInt8=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,1,255,0),this[r]=t&255,r+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function ct(e,t,r,i,n){pt(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;let c=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=c,c=c>>8,e[r++]=c,c=c>>8,e[r++]=c,c=c>>8,e[r++]=c,r}function st(e,t,r,i,n){pt(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;let c=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=c,c=c>>8,e[r+2]=c,c=c>>8,e[r+1]=c,c=c>>8,e[r]=c,r+8}s.prototype.writeBigUInt64LE=I(function(t,r=0){return ct(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeBigUInt64BE=I(function(t,r=0){return st(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeIntLE=function(t,r,i,n){if(t=+t,r=r>>>0,!n){let u=Math.pow(2,8*i-1);d(this,t,r,i,u-1,-u)}let o=0,c=1,a=0;for(this[r]=t&255;++o<i&&(c*=256);)t<0&&a===0&&this[r+o-1]!==0&&(a=1),this[r+o]=(t/c>>0)-a&255;return r+i};s.prototype.writeIntBE=function(t,r,i,n){if(t=+t,r=r>>>0,!n){let u=Math.pow(2,8*i-1);d(this,t,r,i,u-1,-u)}let o=i-1,c=1,a=0;for(this[r+o]=t&255;--o>=0&&(c*=256);)t<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(t/c>>0)-a&255;return r+i};s.prototype.writeInt8=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};s.prototype.writeInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};s.prototype.writeInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};s.prototype.writeInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};s.prototype.writeInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};s.prototype.writeBigInt64LE=I(function(t,r=0){return ct(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});s.prototype.writeBigInt64BE=I(function(t,r=0){return st(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function at(e,t,r,i,n,o){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ut(e,t,r,i,n){return t=+t,r=r>>>0,n||at(e,t,r,4,34028234663852886e22,-34028234663852886e22),C.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(t,r,i){return ut(this,t,r,!0,i)};s.prototype.writeFloatBE=function(t,r,i){return ut(this,t,r,!1,i)};function mt(e,t,r,i,n){return t=+t,r=r>>>0,n||at(e,t,r,8,17976931348623157e292,-17976931348623157e292),C.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(t,r,i){return mt(this,t,r,!0,i)};s.prototype.writeDoubleBE=function(t,r,i){return mt(this,t,r,!1,i)};s.prototype.copy=function(t,r,i,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<i&&(n=i),n===i||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-i&&(n=t.length-r+i);let o=n-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(t,this.subarray(i,n),r),o};s.prototype.fill=function(t,r,i,n){if(typeof t=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(t.length===1){let c=t.charCodeAt(0);(n==="utf8"&&c<128||n==="latin1")&&(t=c)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let o;if(typeof t=="number")for(o=r;o<i;++o)this[o]=t;else{let c=s.isBuffer(t)?t:s.from(t,n),a=c.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<i-r;++o)this[o+r]=c[o%a]}return this};var k={};function z(e,t,r){k[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}z("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);z("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);z("ERR_OUT_OF_RANGE",function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=tt(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=tt(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function tt(e){let t="",r=e.length,i=e[0]==="-"?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function Gt(e,t,r){S(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&T(t,e.length-(r+1))}function pt(e,t,r,i,n,o){if(e>r||e<t){let c=typeof t=="bigint"?"n":"",a;throw o>3?t===0||t===BigInt(0)?a=`>= 0${c} and < 2${c} ** ${(o+1)*8}${c}`:a=`>= -(2${c} ** ${(o+1)*8-1}${c}) and < 2 ** ${(o+1)*8-1}${c}`:a=`>= ${t}${c} and <= ${r}${c}`,new k.ERR_OUT_OF_RANGE("value",a,e)}Gt(i,n,o)}function S(e,t){if(typeof e!="number")throw new k.ERR_INVALID_ARG_TYPE(t,"number",e)}function T(e,t,r){throw Math.floor(e)!==e?(S(e,r),new k.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new k.ERR_BUFFER_OUT_OF_BOUNDS:new k.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var Yt=/[^+/0-9A-Za-z-_]/g;function Vt(e){if(e=e.split("=")[0],e=e.trim().replace(Yt,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function j(e,t){t=t||1/0;let r,i=e.length,n=null,o=[];for(let c=0;c<i;++c){if(r=e.charCodeAt(c),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(c+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=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,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function Jt(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function Ht(e,t){let r,i,n,o=[];for(let c=0;c<e.length&&!((t-=2)<0);++c)r=e.charCodeAt(c),i=r>>8,n=r%256,o.push(n),o.push(i);return o}function ht(e){return D.toByteArray(Vt(e))}function M(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function B(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function G(e){return e!==e}var Xt=(function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t})();function I(e){return typeof BigInt>"u"?Kt:e}function Kt(){throw new Error("BigInt not supported")}});var yt=xt(lt());import{useState as dt}from"react";import{useEffect as Qt}from"react";import{Wallet as wt,Shield as tr,Loader2 as rr,AlertCircle as er}from"lucide-react";var Zt="*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.mcms-mb-4{margin-bottom:1rem}.mcms-mb-6{margin-bottom:1.5rem}.mcms-mt-4{margin-top:1rem}.mcms-block{display:block}.mcms-flex{display:flex}.mcms-grid{display:grid}.mcms-h-10{height:2.5rem}.mcms-h-4{height:1rem}.mcms-h-5{height:1.25rem}.mcms-h-6{height:1.5rem}.mcms-w-10{width:2.5rem}.mcms-w-4{width:1rem}.mcms-w-5{width:1.25rem}.mcms-w-6{width:1.5rem}.mcms-flex-shrink-0{flex-shrink:0}@keyframes mcms-spin{to{transform:rotate(1turn)}}.mcms-animate-spin{animation:mcms-spin 1s linear infinite}.mcms-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.mcms-flex-col{flex-direction:column}.mcms-items-center{align-items:center}.mcms-justify-center{justify-content:center}.mcms-justify-between{justify-content:space-between}.mcms-gap-2{gap:.5rem}.mcms-gap-3{gap:.75rem}.mcms-gap-4{gap:1rem}.mcms-rounded-full{border-radius:9999px}.mcms-rounded-lg{border-radius:.5rem}.mcms-rounded-xl{border-radius:.75rem}.mcms-border{border-width:1px}.mcms-border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity,1))}.mcms-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.mcms-border-green-100{--tw-border-opacity:1;border-color:rgb(220 252 231/var(--tw-border-opacity,1))}.mcms-border-red-100{--tw-border-opacity:1;border-color:rgb(254 226 226/var(--tw-border-opacity,1))}.mcms-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.mcms-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.mcms-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.mcms-bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.mcms-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.mcms-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.mcms-p-2{padding:.5rem}.mcms-p-3{padding:.75rem}.mcms-p-4{padding:1rem}.mcms-p-6{padding:1.5rem}.mcms-py-8{padding-top:2rem;padding-bottom:2rem}.mcms-text-left{text-align:left}.mcms-text-center{text-align:center}.mcms-font-serif{font-family:ui-serif,Georgia,Cambria,Times New Roman,Times,serif}.mcms-text-lg{font-size:1.125rem;line-height:1.75rem}.mcms-text-sm{font-size:.875rem;line-height:1.25rem}.mcms-text-xs{font-size:.75rem;line-height:1rem}.mcms-font-bold{font-weight:700}.mcms-font-medium{font-weight:500}.mcms-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.mcms-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.mcms-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.mcms-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.mcms-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.mcms-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.mcms-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.mcms-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.mcms-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.mcms-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover:mcms-border-blue-500:hover{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.hover:mcms-bg-blue-50:hover{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.mcms-group:hover .group-hover:mcms-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}",ft=()=>{if(typeof document>"u"||document.getElementById("mcms-crypto-styles"))return;let e=document.createElement("style");e.id="mcms-crypto-styles",e.textContent=Zt,document.head.appendChild(e)};import{jsx as f,jsxs as x}from"react/jsx-runtime";var fr=({onSuccess:e,onError:t,className:r,endpoints:i})=>{let{status:n,error:o,authenticate:c}=Y({onSuccess:e,onError:t,endpoints:i});Qt(()=>{ft()},[]);let a=()=>{switch(n){case"connecting":return"Connecting Wallet...";case"requesting_nonce":return"Getting Nonce...";case"pending_signature":return"Please Sign Message...";case"verifying":return"Verifying Signature...";default:return null}};return x("div",{className:`mcms-p-6 mcms-bg-white mcms-rounded-xl mcms-shadow-lg mcms-border mcms-border-gray-100 ${r}`,children:[x("div",{className:"mcms-flex mcms-items-center mcms-gap-3 mcms-mb-6",children:[f("div",{className:"mcms-p-2 mcms-bg-blue-50 mcms-rounded-lg",children:f(tr,{className:"mcms-w-6 mcms-h-6 mcms-text-blue-600"})}),x("div",{children:[f("h3",{className:"mcms-text-lg mcms-font-bold mcms-text-gray-900",children:"Crypto Login"}),f("p",{className:"mcms-text-sm mcms-text-gray-500",children:"Sign in with your wallet"})]})]}),o&&x("div",{className:"mcms-mb-4 mcms-p-3 mcms-bg-red-50 mcms-text-red-700 mcms-rounded-lg mcms-flex mcms-items-center mcms-gap-2 mcms-text-sm mcms-border mcms-border-red-100",children:[f(er,{className:"mcms-w-4 mcms-h-4 mcms-flex-shrink-0"}),f("p",{children:o})]}),n!=="idle"&&n!=="error"&&n!=="success"?x("div",{className:"mcms-flex mcms-flex-col mcms-items-center mcms-justify-center mcms-py-8 mcms-gap-4",children:[f(rr,{className:"mcms-w-10 mcms-h-10 mcms-text-blue-600 mcms-animate-spin"}),f("p",{className:"mcms-text-sm mcms-font-medium mcms-text-gray-600",children:a()})]}):x("div",{className:"mcms-grid mcms-grid-cols-1 mcms-gap-3",children:[x("button",{onClick:()=>c("solana"),className:"mcms-flex mcms-items-center mcms-justify-between mcms-p-4 mcms-rounded-xl mcms-border mcms-border-gray-200 hover:mcms-border-blue-500 hover:mcms-bg-blue-50 mcms-transition-all mcms-group",children:[x("div",{className:"mcms-flex mcms-items-center mcms-gap-3",children:[f("div",{className:"mcms-w-10 mcms-h-10 mcms-bg-black mcms-rounded-full mcms-flex mcms-items-center mcms-justify-center mcms-text-white mcms-font-bold",children:"S"}),x("div",{className:"mcms-text-left",children:[f("span",{className:"mcms-block mcms-font-bold mcms-text-gray-900",children:"Solana"}),f("span",{className:"mcms-block mcms-text-xs mcms-text-gray-500",children:"Phantom, Solflare, etc."})]})]}),f(wt,{className:"mcms-w-5 mcms-h-5 mcms-text-gray-400 group-hover:mcms-text-blue-500"})]}),x("button",{onClick:()=>c("evm"),className:"mcms-flex mcms-items-center mcms-justify-between mcms-p-4 mcms-rounded-xl mcms-border mcms-border-gray-200 hover:mcms-border-blue-500 hover:mcms-bg-blue-50 mcms-transition-all mcms-group",children:[x("div",{className:"mcms-flex mcms-items-center mcms-gap-3",children:[f("div",{className:"mcms-w-10 mcms-h-10 mcms-bg-orange-500 mcms-rounded-full mcms-flex mcms-items-center mcms-justify-center mcms-text-white mcms-font-bold mcms-font-serif",children:"M"}),x("div",{className:"mcms-text-left",children:[f("span",{className:"mcms-block mcms-font-bold mcms-text-gray-900",children:"Base / Ethereum"}),f("span",{className:"mcms-block mcms-text-xs mcms-text-gray-500",children:"MetaMask, Coinbase Wallet"})]})]}),f(wt,{className:"mcms-w-5 mcms-h-5 mcms-text-gray-400 group-hover:mcms-text-blue-500"})]})]}),n==="success"&&f("div",{className:"mcms-mt-4 mcms-p-3 mcms-bg-green-50 mcms-text-green-700 mcms-rounded-lg mcms-text-center mcms-text-sm mcms-border mcms-border-green-100",children:"Login Successful!"})]})};typeof window<"u"&&(window.Buffer||(window.Buffer=yt.Buffer),window.global||(window.global=window),window.process||(window.process={env:{}}));var Y=(e={})=>{let[t,r]=dt("idle"),[i,n]=dt(null);return{status:t,error:i,authenticate:async c=>{try{r("connecting"),n(null);let a,u;if(c==="solana"){let{useSolanaWallet:m}=await import("./SolanaProvider-LOXNC2PW.mjs"),y=m();a=await y.connect(),r("requesting_nonce");let w=await fetch(e.endpoints?.nonce||"/api/auth/crypto/nonce",{method:"POST",headers:{"Content-Type":"application/json",...e.headers||{}},body:JSON.stringify({address:a})}),{nonce:F}=await w.json();r("pending_signature"),u=await y.signMessage(`Sign this message to authenticate: ${F}`)}else{let{useEVMWallet:m}=await import("./EVMProvider-OOSE6HA4.mjs"),y=m();a=await y.connect(),r("requesting_nonce");let w=await fetch(e.endpoints?.nonce||"/api/auth/crypto/nonce",{method:"POST",headers:{"Content-Type":"application/json",...e.headers||{}},body:JSON.stringify({address:a})}),{nonce:F}=await w.json();r("pending_signature"),u=await y.signMessage(a,`Sign this message to authenticate: ${F}`)}r("verifying");let h=await fetch(e.endpoints?.verify||"/api/auth/crypto/verify",{method:"POST",headers:{"Content-Type":"application/json",...e.headers||{}},body:JSON.stringify({address:a,signature:u,network:c})});if(!h.ok)throw new Error("Verification failed");let{token:p}=await h.json();return r("success"),e.onSuccess?.(p),p}catch(a){throw n(a.message||"Authentication failed"),r("error"),e.onError?.(a),a}}}},xr={manifest:{name:"@micro-cms/crypto-auth-ui",version:"1.0.0",provides:["crypto-auth-ui"],requires:[]},async load(e){e.runtime.register("crypto-auth-ui",{useCryptoAuth:Y})}};export{fr as AuthWidget,xr as default,Y as useCryptoAuth};
|
|
1
|
+
import{a as L,b as xt}from"./chunk-73SFLUWV.mjs";var J=L(T=>{"use strict";T.byteLength=Bt;T.toByteArray=It;T.fromByteArray=Ut;var b=[],g=[],bt=typeof Uint8Array<"u"?Uint8Array:Array,P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(A=0,V=P.length;A<V;++A)b[A]=P[A],g[P.charCodeAt(A)]=A;var A,V;g[45]=62;g[95]=63;function H(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var i=r===t?0:4-r%4;return[r,i]}function Bt(e){var t=H(e),r=t[0],i=t[1];return(r+i)*3/4-i}function Et(e,t,r){return(t+r)*3/4-r}function It(e){var t,r=H(e),i=r[0],n=r[1],o=new bt(Et(e,i,n)),c=0,a=n>0?i-4:i,u;for(u=0;u<a;u+=4)t=g[e.charCodeAt(u)]<<18|g[e.charCodeAt(u+1)]<<12|g[e.charCodeAt(u+2)]<<6|g[e.charCodeAt(u+3)],o[c++]=t>>16&255,o[c++]=t>>8&255,o[c++]=t&255;return n===2&&(t=g[e.charCodeAt(u)]<<2|g[e.charCodeAt(u+1)]>>4,o[c++]=t&255),n===1&&(t=g[e.charCodeAt(u)]<<10|g[e.charCodeAt(u+1)]<<4|g[e.charCodeAt(u+2)]>>2,o[c++]=t>>8&255,o[c++]=t&255),o}function Ft(e){return b[e>>18&63]+b[e>>12&63]+b[e>>6&63]+b[e&63]}function At(e,t,r){for(var i,n=[],o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(Ft(i));return n.join("")}function Ut(e){for(var t,r=e.length,i=r%3,n=[],o=16383,c=0,a=r-i;c<a;c+=o)n.push(At(e,c,c+o>a?a:c+o));return i===1?(t=e[r-1],n.push(b[t>>2]+b[t<<4&63]+"==")):i===2&&(t=(e[r-2]<<8)+e[r-1],n.push(b[t>>10]+b[t>>4&63]+b[t<<2&63]+"=")),n.join("")}});var X=L($=>{"use strict";$.read=function(e,t,r,i,n){var o,c,a=n*8-i-1,u=(1<<a)-1,h=u>>1,p=-7,m=r?n-1:0,w=r?-1:1,d=e[t+m];for(m+=w,o=d&(1<<-p)-1,d>>=-p,p+=a;p>0;o=o*256+e[t+m],m+=w,p-=8);for(c=o&(1<<-p)-1,o>>=-p,p+=i;p>0;c=c*256+e[t+m],m+=w,p-=8);if(o===0)o=1-h;else{if(o===u)return c?NaN:(d?-1:1)*(1/0);c=c+Math.pow(2,i),o=o-h}return(d?-1:1)*c*Math.pow(2,o-i)};$.write=function(e,t,r,i,n,o){var c,a,u,h=o*8-n-1,p=(1<<h)-1,m=p>>1,w=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,F=i?1:-1,gt=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,c=p):(c=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-c))<1&&(c--,u*=2),c+m>=1?t+=w/u:t+=w*Math.pow(2,1-m),t*u>=2&&(c++,u/=2),c+m>=p?(a=0,c=p):c+m>=1?(a=(t*u-1)*Math.pow(2,n),c=c+m):(a=t*Math.pow(2,m-1)*Math.pow(2,n),c=0));n>=8;e[r+d]=a&255,d+=F,a/=256,n-=8);for(c=c<<n|a,h+=n;h>0;e[r+d]=c&255,d+=F,c/=256,h-=8);e[r+d-F]|=gt*128}});var lt=L(N=>{"use strict";var D=J(),k=X(),K=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;N.Buffer=s;N.SlowBuffer=Tt;N.INSPECT_MAX_BYTES=50;var _=2147483647;N.kMaxLength=_;s.TYPED_ARRAY_SUPPORT=Ct();!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&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 Ct(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function E(e){if(e>_)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return W(e)}return rt(e,t,r)}s.poolSize=8192;function rt(e,t,r){if(typeof e=="string")return St(e,t);if(ArrayBuffer.isView(e))return Nt(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(B(e,ArrayBuffer)||e&&B(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(B(e,SharedArrayBuffer)||e&&B(e.buffer,SharedArrayBuffer)))return O(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return s.from(i,t,r);let n=Rt(e);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}s.from=function(e,t,r){return rt(e,t,r)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function et(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function kt(e,t,r){return et(e),e<=0?E(e):t!==void 0?typeof r=="string"?E(e).fill(t,r):E(e).fill(t):E(e)}s.alloc=function(e,t,r){return kt(e,t,r)};function W(e){return et(e),E(e<0?0:q(e)|0)}s.allocUnsafe=function(e){return W(e)};s.allocUnsafeSlow=function(e){return W(e)};function St(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=it(e,t)|0,i=E(r),n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}function v(e){let t=e.length<0?0:q(e.length)|0,r=E(t);for(let i=0;i<t;i+=1)r[i]=e[i]&255;return r}function Nt(e){if(B(e,Uint8Array)){let t=new Uint8Array(e);return O(t.buffer,t.byteOffset,t.byteLength)}return v(e)}function O(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return t===void 0&&r===void 0?i=new Uint8Array(e):r===void 0?i=new Uint8Array(e,t):i=new Uint8Array(e,t,r),Object.setPrototypeOf(i,s.prototype),i}function Rt(e){if(s.isBuffer(e)){let t=q(e.length)|0,r=E(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||G(e.length)?E(0):v(e);if(e.type==="Buffer"&&Array.isArray(e.data))return v(e.data)}function q(e){if(e>=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return e|0}function Tt(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==s.prototype};s.compare=function(t,r){if(B(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),B(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(t)||!s.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let i=t.length,n=r.length;for(let o=0,c=Math.min(i,n);o<c;++o)if(t[o]!==r[o]){i=t[o],n=r[o];break}return i<n?-1:n<i?1:0};s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return s.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<t.length;++i)r+=t[i].length;let n=s.allocUnsafe(r),o=0;for(i=0;i<t.length;++i){let c=t[i];if(B(c,Uint8Array))o+c.length>n.length?(s.isBuffer(c)||(c=s.from(c)),c.copy(n,o)):Uint8Array.prototype.set.call(n,c,o);else if(s.isBuffer(c))c.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=c.length}return n};function it(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||B(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ht(e).length;default:if(n)return i?-1:j(e).length;t=(""+t).toLowerCase(),n=!0}}s.byteLength=it;function _t(e,t,r){let i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return qt(this,t,r);case"utf8":case"utf-8":return ot(this,t,r);case"ascii":return jt(this,t,r);case"latin1":case"binary":return Wt(this,t,r);case"base64":return vt(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zt(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}s.prototype._isBuffer=!0;function U(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}s.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)U(this,r,r+1);return this};s.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)U(this,r,r+3),U(this,r+1,r+2);return this};s.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)U(this,r,r+7),U(this,r+1,r+6),U(this,r+2,r+5),U(this,r+3,r+4);return this};s.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?ot(this,0,t):_t.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:s.compare(this,t)===0};s.prototype.inspect=function(){let t="",r=N.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};K&&(s.prototype[K]=s.prototype.inspect);s.prototype.compare=function(t,r,i,n,o){if(B(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),i===void 0&&(i=t?t.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),r<0||i>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=i)return 0;if(n>=o)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,o>>>=0,this===t)return 0;let c=o-n,a=i-r,u=Math.min(c,a),h=this.slice(n,o),p=t.slice(r,i);for(let m=0;m<u;++m)if(h[m]!==p[m]){c=h[m],a=p[m];break}return c<a?-1:a<c?1:0};function nt(e,t,r,i,n){if(e.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,G(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof t=="string"&&(t=s.from(t,i)),s.isBuffer(t))return t.length===0?-1:Z(e,t,r,i,n);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Z(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Z(e,t,r,i,n){let o=1,c=e.length,a=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,c/=2,a/=2,r/=2}function u(p,m){return o===1?p[m]:p.readUInt16BE(m*o)}let h;if(n){let p=-1;for(h=r;h<c;h++)if(u(e,h)===u(t,p===-1?0:h-p)){if(p===-1&&(p=h),h-p+1===a)return p*o}else p!==-1&&(h-=h-p),p=-1}else for(r+a>c&&(r=c-a),h=r;h>=0;h--){let p=!0;for(let m=0;m<a;m++)if(u(e,h+m)!==u(t,m)){p=!1;break}if(p)return h}return-1}s.prototype.includes=function(t,r,i){return this.indexOf(t,r,i)!==-1};s.prototype.indexOf=function(t,r,i){return nt(this,t,r,i,!0)};s.prototype.lastIndexOf=function(t,r,i){return nt(this,t,r,i,!1)};function Mt(e,t,r,i){r=Number(r)||0;let n=e.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let o=t.length;i>o/2&&(i=o/2);let c;for(c=0;c<i;++c){let a=parseInt(t.substr(c*2,2),16);if(G(a))return c;e[r+c]=a}return c}function Lt(e,t,r,i){return M(j(t,e.length-r),e,r,i)}function Pt(e,t,r,i){return M(Ht(t),e,r,i)}function $t(e,t,r,i){return M(ht(t),e,r,i)}function Dt(e,t,r,i){return M(Jt(t,e.length-r),e,r,i)}s.prototype.write=function(t,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((i===void 0||i>o)&&(i=o),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let c=!1;for(;;)switch(n){case"hex":return Mt(this,t,r,i);case"utf8":case"utf-8":return Lt(this,t,r,i);case"ascii":case"latin1":case"binary":return Pt(this,t,r,i);case"base64":return $t(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Dt(this,t,r,i);default:if(c)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),c=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vt(e,t,r){return t===0&&r===e.length?D.fromByteArray(e):D.fromByteArray(e.slice(t,r))}function ot(e,t,r){r=Math.min(e.length,r);let i=[],n=t;for(;n<r;){let o=e[n],c=null,a=o>239?4:o>223?3:o>191?2:1;if(n+a<=r){let u,h,p,m;switch(a){case 1:o<128&&(c=o);break;case 2:u=e[n+1],(u&192)===128&&(m=(o&31)<<6|u&63,m>127&&(c=m));break;case 3:u=e[n+1],h=e[n+2],(u&192)===128&&(h&192)===128&&(m=(o&15)<<12|(u&63)<<6|h&63,m>2047&&(m<55296||m>57343)&&(c=m));break;case 4:u=e[n+1],h=e[n+2],p=e[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(m=(o&15)<<18|(u&63)<<12|(h&63)<<6|p&63,m>65535&&m<1114112&&(c=m))}}c===null?(c=65533,a=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|c&1023),i.push(c),n+=a}return Ot(i)}var Q=4096;function Ot(e){let t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=Q));return r}function jt(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]&127);return i}function Wt(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function qt(e,t,r){let i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let o=t;o<r;++o)n+=Xt[e[o]];return n}function zt(e,t,r){let i=e.slice(t,r),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}s.prototype.slice=function(t,r){let i=this.length;t=~~t,r=r===void 0?i:~~r,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<t&&(r=t);let n=this.subarray(t,r);return Object.setPrototypeOf(n,s.prototype),n};function l(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||l(t,r,this.length);let n=this[t],o=1,c=0;for(;++c<r&&(o*=256);)n+=this[t+c]*o;return n};s.prototype.readUintBE=s.prototype.readUIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||l(t,r,this.length);let n=this[t+--r],o=1;for(;r>0&&(o*=256);)n+=this[t+--r]*o;return n};s.prototype.readUint8=s.prototype.readUInt8=function(t,r){return t=t>>>0,r||l(t,1,this.length),this[t]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||l(t,2,this.length),this[t]|this[t+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||l(t,2,this.length),this[t]<<8|this[t+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||l(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||l(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};s.prototype.readBigUInt64LE=I(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&R(t,this.length-8);let n=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});s.prototype.readBigUInt64BE=I(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&R(t,this.length-8);let n=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});s.prototype.readIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||l(t,r,this.length);let n=this[t],o=1,c=0;for(;++c<r&&(o*=256);)n+=this[t+c]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*r)),n};s.prototype.readIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||l(t,r,this.length);let n=r,o=1,c=this[t+--n];for(;n>0&&(o*=256);)c+=this[t+--n]*o;return o*=128,c>=o&&(c-=Math.pow(2,8*r)),c};s.prototype.readInt8=function(t,r){return t=t>>>0,r||l(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};s.prototype.readInt16LE=function(t,r){t=t>>>0,r||l(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};s.prototype.readInt16BE=function(t,r){t=t>>>0,r||l(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};s.prototype.readInt32LE=function(t,r){return t=t>>>0,r||l(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};s.prototype.readInt32BE=function(t,r){return t=t>>>0,r||l(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};s.prototype.readBigInt64LE=I(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&R(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});s.prototype.readBigInt64BE=I(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&R(t,this.length-8);let n=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i)});s.prototype.readFloatLE=function(t,r){return t=t>>>0,r||l(t,4,this.length),k.read(this,t,!0,23,4)};s.prototype.readFloatBE=function(t,r){return t=t>>>0,r||l(t,4,this.length),k.read(this,t,!1,23,4)};s.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||l(t,8,this.length),k.read(this,t,!0,52,8)};s.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||l(t,8,this.length),k.read(this,t,!1,52,8)};function y(e,t,r,i,n,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,r,i,n){if(t=+t,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;y(this,t,r,i,a,0)}let o=1,c=0;for(this[r]=t&255;++c<i&&(o*=256);)this[r+c]=t/o&255;return r+i};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,r,i,n){if(t=+t,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;y(this,t,r,i,a,0)}let o=i-1,c=1;for(this[r+o]=t&255;--o>=0&&(c*=256);)this[r+o]=t/c&255;return r+i};s.prototype.writeUint8=s.prototype.writeUInt8=function(t,r,i){return t=+t,r=r>>>0,i||y(this,t,r,1,255,0),this[r]=t&255,r+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||y(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||y(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||y(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||y(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function ct(e,t,r,i,n){pt(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;let c=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=c,c=c>>8,e[r++]=c,c=c>>8,e[r++]=c,c=c>>8,e[r++]=c,r}function st(e,t,r,i,n){pt(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;let c=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=c,c=c>>8,e[r+2]=c,c=c>>8,e[r+1]=c,c=c>>8,e[r]=c,r+8}s.prototype.writeBigUInt64LE=I(function(t,r=0){return ct(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeBigUInt64BE=I(function(t,r=0){return st(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeIntLE=function(t,r,i,n){if(t=+t,r=r>>>0,!n){let u=Math.pow(2,8*i-1);y(this,t,r,i,u-1,-u)}let o=0,c=1,a=0;for(this[r]=t&255;++o<i&&(c*=256);)t<0&&a===0&&this[r+o-1]!==0&&(a=1),this[r+o]=(t/c>>0)-a&255;return r+i};s.prototype.writeIntBE=function(t,r,i,n){if(t=+t,r=r>>>0,!n){let u=Math.pow(2,8*i-1);y(this,t,r,i,u-1,-u)}let o=i-1,c=1,a=0;for(this[r+o]=t&255;--o>=0&&(c*=256);)t<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(t/c>>0)-a&255;return r+i};s.prototype.writeInt8=function(t,r,i){return t=+t,r=r>>>0,i||y(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};s.prototype.writeInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||y(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};s.prototype.writeInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||y(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};s.prototype.writeInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||y(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};s.prototype.writeInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||y(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};s.prototype.writeBigInt64LE=I(function(t,r=0){return ct(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});s.prototype.writeBigInt64BE=I(function(t,r=0){return st(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function at(e,t,r,i,n,o){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ut(e,t,r,i,n){return t=+t,r=r>>>0,n||at(e,t,r,4,34028234663852886e22,-34028234663852886e22),k.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(t,r,i){return ut(this,t,r,!0,i)};s.prototype.writeFloatBE=function(t,r,i){return ut(this,t,r,!1,i)};function mt(e,t,r,i,n){return t=+t,r=r>>>0,n||at(e,t,r,8,17976931348623157e292,-17976931348623157e292),k.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(t,r,i){return mt(this,t,r,!0,i)};s.prototype.writeDoubleBE=function(t,r,i){return mt(this,t,r,!1,i)};s.prototype.copy=function(t,r,i,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<i&&(n=i),n===i||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-i&&(n=t.length-r+i);let o=n-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(t,this.subarray(i,n),r),o};s.prototype.fill=function(t,r,i,n){if(typeof t=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(t.length===1){let c=t.charCodeAt(0);(n==="utf8"&&c<128||n==="latin1")&&(t=c)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let o;if(typeof t=="number")for(o=r;o<i;++o)this[o]=t;else{let c=s.isBuffer(t)?t:s.from(t,n),a=c.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<i-r;++o)this[o+r]=c[o%a]}return this};var C={};function z(e,t,r){C[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}z("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);z("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);z("ERR_OUT_OF_RANGE",function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=tt(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=tt(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function tt(e){let t="",r=e.length,i=e[0]==="-"?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function Gt(e,t,r){S(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&R(t,e.length-(r+1))}function pt(e,t,r,i,n,o){if(e>r||e<t){let c=typeof t=="bigint"?"n":"",a;throw o>3?t===0||t===BigInt(0)?a=`>= 0${c} and < 2${c} ** ${(o+1)*8}${c}`:a=`>= -(2${c} ** ${(o+1)*8-1}${c}) and < 2 ** ${(o+1)*8-1}${c}`:a=`>= ${t}${c} and <= ${r}${c}`,new C.ERR_OUT_OF_RANGE("value",a,e)}Gt(i,n,o)}function S(e,t){if(typeof e!="number")throw new C.ERR_INVALID_ARG_TYPE(t,"number",e)}function R(e,t,r){throw Math.floor(e)!==e?(S(e,r),new C.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new C.ERR_BUFFER_OUT_OF_BOUNDS:new C.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var Yt=/[^+/0-9A-Za-z-_]/g;function Vt(e){if(e=e.split("=")[0],e=e.trim().replace(Yt,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function j(e,t){t=t||1/0;let r,i=e.length,n=null,o=[];for(let c=0;c<i;++c){if(r=e.charCodeAt(c),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(c+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=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,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function Ht(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function Jt(e,t){let r,i,n,o=[];for(let c=0;c<e.length&&!((t-=2)<0);++c)r=e.charCodeAt(c),i=r>>8,n=r%256,o.push(n),o.push(i);return o}function ht(e){return D.toByteArray(Vt(e))}function M(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function B(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function G(e){return e!==e}var Xt=(function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t})();function I(e){return typeof BigInt>"u"?Kt:e}function Kt(){throw new Error("BigInt not supported")}});var yt=xt(lt());import{useState as dt}from"react";import{useEffect as Qt}from"react";import{Wallet as wt,Shield as tr,Loader2 as rr,AlertCircle as er}from"lucide-react";var Zt="*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.mcms-mb-4{margin-bottom:1rem}.mcms-mb-6{margin-bottom:1.5rem}.mcms-mt-4{margin-top:1rem}.mcms-block{display:block}.mcms-flex{display:flex}.mcms-grid{display:grid}.mcms-h-10{height:2.5rem}.mcms-h-4{height:1rem}.mcms-h-5{height:1.25rem}.mcms-h-6{height:1.5rem}.mcms-w-10{width:2.5rem}.mcms-w-4{width:1rem}.mcms-w-5{width:1.25rem}.mcms-w-6{width:1.5rem}.mcms-flex-shrink-0{flex-shrink:0}@keyframes mcms-spin{to{transform:rotate(1turn)}}.mcms-animate-spin{animation:mcms-spin 1s linear infinite}.mcms-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.mcms-flex-col{flex-direction:column}.mcms-items-center{align-items:center}.mcms-justify-center{justify-content:center}.mcms-justify-between{justify-content:space-between}.mcms-gap-2{gap:.5rem}.mcms-gap-3{gap:.75rem}.mcms-gap-4{gap:1rem}.mcms-rounded-full{border-radius:9999px}.mcms-rounded-lg{border-radius:.5rem}.mcms-rounded-xl{border-radius:.75rem}.mcms-border{border-width:1px}.mcms-border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity,1))}.mcms-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.mcms-border-green-100{--tw-border-opacity:1;border-color:rgb(220 252 231/var(--tw-border-opacity,1))}.mcms-border-red-100{--tw-border-opacity:1;border-color:rgb(254 226 226/var(--tw-border-opacity,1))}.mcms-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.mcms-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.mcms-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.mcms-bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.mcms-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.mcms-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.mcms-p-2{padding:.5rem}.mcms-p-3{padding:.75rem}.mcms-p-4{padding:1rem}.mcms-p-6{padding:1.5rem}.mcms-py-8{padding-top:2rem;padding-bottom:2rem}.mcms-text-left{text-align:left}.mcms-text-center{text-align:center}.mcms-font-serif{font-family:ui-serif,Georgia,Cambria,Times New Roman,Times,serif}.mcms-text-lg{font-size:1.125rem;line-height:1.75rem}.mcms-text-sm{font-size:.875rem;line-height:1.25rem}.mcms-text-xs{font-size:.75rem;line-height:1rem}.mcms-font-bold{font-weight:700}.mcms-font-medium{font-weight:500}.mcms-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.mcms-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.mcms-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.mcms-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.mcms-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.mcms-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.mcms-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.mcms-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.mcms-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.mcms-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover:mcms-border-blue-500:hover{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.hover:mcms-bg-blue-50:hover{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.mcms-group:hover .group-hover:mcms-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}",ft=()=>{if(typeof document>"u"||document.getElementById("mcms-crypto-styles"))return;let e=document.createElement("style");e.id="mcms-crypto-styles",e.textContent=Zt,document.head.appendChild(e)};import{jsx as f,jsxs as x}from"react/jsx-runtime";var fr=({onSuccess:e,onError:t,className:r,endpoints:i,headers:n,allowedNetworks:o=["solana","evm"],hideHeader:c=!1,headerComponent:a})=>{let{status:u,error:h,authenticate:p}=Y({onSuccess:e,onError:t,endpoints:i,headers:n});Qt(()=>{ft()},[]);let m=()=>{switch(u){case"connecting":return"Connecting Wallet...";case"requesting_nonce":return"Getting Nonce...";case"pending_signature":return"Please Sign Message...";case"verifying":return"Verifying Signature...";default:return null}},w=x("div",{className:"mcms-flex mcms-items-center mcms-gap-3 mcms-mb-6",children:[f("div",{className:"mcms-p-2 mcms-bg-blue-50 mcms-rounded-lg",children:f(tr,{className:"mcms-w-6 mcms-h-6 mcms-text-blue-600"})}),x("div",{children:[f("h3",{className:"mcms-text-lg mcms-font-bold mcms-text-gray-900",children:"Crypto Login"}),f("p",{className:"mcms-text-sm mcms-text-gray-500",children:"Sign in with your wallet"})]})]});return x("div",{className:`mcms-p-6 mcms-bg-white mcms-rounded-xl mcms-shadow-lg mcms-border mcms-border-gray-100 ${r}`,children:[!c&&(a||w),h&&x("div",{className:"mcms-mb-4 mcms-p-3 mcms-bg-red-50 mcms-text-red-700 mcms-rounded-lg mcms-flex mcms-items-center mcms-gap-2 mcms-text-sm mcms-border mcms-border-red-100",children:[f(er,{className:"mcms-w-4 mcms-h-4 mcms-flex-shrink-0"}),f("p",{children:h})]}),u!=="idle"&&u!=="error"&&u!=="success"?x("div",{className:"mcms-flex mcms-flex-col mcms-items-center mcms-justify-center mcms-py-8 mcms-gap-4",children:[f(rr,{className:"mcms-w-10 mcms-h-10 mcms-text-blue-600 mcms-animate-spin"}),f("p",{className:"mcms-text-sm mcms-font-medium mcms-text-gray-600",children:m()})]}):x("div",{className:"mcms-grid mcms-grid-cols-1 mcms-gap-3",children:[o.includes("solana")&&x("button",{onClick:()=>p("solana"),className:"mcms-flex mcms-items-center mcms-justify-between mcms-p-4 mcms-rounded-xl mcms-border mcms-border-gray-200 hover:mcms-border-blue-500 hover:mcms-bg-blue-50 mcms-transition-all mcms-group",children:[x("div",{className:"mcms-flex mcms-items-center mcms-gap-3",children:[f("div",{className:"mcms-w-10 mcms-h-10 mcms-bg-black mcms-rounded-full mcms-flex mcms-items-center mcms-justify-center mcms-text-white mcms-font-bold",children:"S"}),x("div",{className:"mcms-text-left",children:[f("span",{className:"mcms-block mcms-font-bold mcms-text-gray-900",children:"Solana"}),f("span",{className:"mcms-block mcms-text-xs mcms-text-gray-500",children:"Phantom, Solflare, etc."})]})]}),f(wt,{className:"mcms-w-5 mcms-h-5 mcms-text-gray-400 group-hover:mcms-text-blue-500"})]}),o.includes("evm")&&x("button",{onClick:()=>p("evm"),className:"mcms-flex mcms-items-center mcms-justify-between mcms-p-4 mcms-rounded-xl mcms-border mcms-border-gray-200 hover:mcms-border-blue-500 hover:mcms-bg-blue-50 mcms-transition-all mcms-group",children:[x("div",{className:"mcms-flex mcms-items-center mcms-gap-3",children:[f("div",{className:"mcms-w-10 mcms-h-10 mcms-bg-orange-500 mcms-rounded-full mcms-flex mcms-items-center mcms-justify-center mcms-text-white mcms-font-bold mcms-font-serif",children:"M"}),x("div",{className:"mcms-text-left",children:[f("span",{className:"mcms-block mcms-font-bold mcms-text-gray-900",children:"Base / Ethereum"}),f("span",{className:"mcms-block mcms-text-xs mcms-text-gray-500",children:"MetaMask, Coinbase Wallet"})]})]}),f(wt,{className:"mcms-w-5 mcms-h-5 mcms-text-gray-400 group-hover:mcms-text-blue-500"})]})]}),u==="success"&&f("div",{className:"mcms-mt-4 mcms-p-3 mcms-bg-green-50 mcms-text-green-700 mcms-rounded-lg mcms-text-center mcms-text-sm mcms-border mcms-border-green-100",children:"Login Successful!"})]})};typeof window<"u"&&(window.Buffer||(window.Buffer=yt.Buffer),window.global||(window.global=window),window.process||(window.process={env:{}}));var Y=(e={})=>{let[t,r]=dt("idle"),[i,n]=dt(null);return{status:t,error:i,authenticate:async c=>{try{r("connecting"),n(null);let a,u;if(c==="solana"){let{useSolanaWallet:m}=await import("./SolanaProvider-LOXNC2PW.mjs"),w=m();a=await w.connect(),r("requesting_nonce");let d=await fetch(e.endpoints?.nonce||"/api/auth/crypto/nonce",{method:"POST",headers:{"Content-Type":"application/json",...e.headers||{}},body:JSON.stringify({address:a})}),{nonce:F}=await d.json();r("pending_signature"),u=await w.signMessage(`Sign this message to authenticate: ${F}`)}else{let{useEVMWallet:m}=await import("./EVMProvider-OOSE6HA4.mjs"),w=m();a=await w.connect(),r("requesting_nonce");let d=await fetch(e.endpoints?.nonce||"/api/auth/crypto/nonce",{method:"POST",headers:{"Content-Type":"application/json",...e.headers||{}},body:JSON.stringify({address:a})}),{nonce:F}=await d.json();r("pending_signature"),u=await w.signMessage(a,`Sign this message to authenticate: ${F}`)}r("verifying");let h=await fetch(e.endpoints?.verify||"/api/auth/crypto/verify",{method:"POST",headers:{"Content-Type":"application/json",...e.headers||{}},body:JSON.stringify({address:a,signature:u,network:c})});if(!h.ok)throw new Error("Verification failed");let{token:p}=await h.json();return r("success"),e.onSuccess?.(p),p}catch(a){throw n(a.message||"Authentication failed"),r("error"),e.onError?.(a),a}}}},xr={manifest:{name:"@micro-cms/crypto-auth-ui",version:"1.0.0",provides:["crypto-auth-ui"],requires:[]},async load(e){e.runtime.register("crypto-auth-ui",{useCryptoAuth:Y})}};export{fr as AuthWidget,xr as default,Y as useCryptoAuth};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
ieee754/index.js:
|