@naculus/connect-appkit-ui 0.2.4 → 0.2.6
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/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";var Dr=Object.create;var gt=Object.defineProperty;var Mr=Object.getOwnPropertyDescriptor;var Ir=Object.getOwnPropertyNames;var Lr=Object.getPrototypeOf,zr=Object.prototype.hasOwnProperty;var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Wr=(t,e)=>{for(var n in e)gt(t,n,{get:e[n],enumerable:!0})},Dn=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ir(e))!zr.call(t,r)&&r!==n&>(t,r,{get:()=>e[r],enumerable:!(o=Mr(e,r))||o.enumerable});return t};var Ot=(t,e,n)=>(n=t!=null?Dr(Lr(t)):{},Dn(e||!t||!t.__esModule?gt(n,"default",{value:t,enumerable:!0}):n,t)),Vr=t=>Dn(gt({},"__esModule",{value:!0}),t);var qn=M((Ua,Kn)=>{"use strict";Kn.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var Ne=M(Ae=>{"use strict";var qt,Qr=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Ae.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Ae.getSymbolTotalCodewords=function(e){return Qr[e]};Ae.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};Ae.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');qt=e};Ae.isKanjiModeEnabled=function(){return typeof qt<"u"};Ae.toSJIS=function(e){return qt(e)}});var Ct=M(le=>{"use strict";le.L={bit:1};le.M={bit:0};le.Q={bit:3};le.H={bit:2};function $r(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return le.L;case"m":case"medium":return le.M;case"q":case"quartile":return le.Q;case"h":case"high":return le.H;default:throw new Error("Unknown EC Level: "+t)}}le.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};le.from=function(e,n){if(le.isValid(e))return e;try{return $r(e)}catch{return n}}});var $n=M((Fa,Qn)=>{"use strict";function jn(){this.buffer=[],this.length=0}jn.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let n=0;n<e;n++)this.putBit((t>>>e-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};Qn.exports=jn});var Yn=M((Ka,Gn)=>{"use strict";function ot(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}ot.prototype.set=function(t,e,n,o){let r=t*this.size+e;this.data[r]=n,o&&(this.reservedBit[r]=!0)};ot.prototype.get=function(t,e){return this.data[t*this.size+e]};ot.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n};ot.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};Gn.exports=ot});var Jn=M(wt=>{"use strict";var Gr=Ne().getSymbolSize;wt.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,o=Gr(e),r=o===145?26:Math.ceil((o-13)/(2*n-2))*2,s=[o-7];for(let a=1;a<n-1;a++)s[a]=s[a-1]-r;return s.push(6),s.reverse()};wt.getPositions=function(e){let n=[],o=wt.getRowColCoords(e),r=o.length;for(let s=0;s<r;s++)for(let a=0;a<r;a++)s===0&&a===0||s===0&&a===r-1||s===r-1&&a===0||n.push([o[s],o[a]]);return n}});var eo=M(Zn=>{"use strict";var Yr=Ne().getSymbolSize,Xn=7;Zn.getPositions=function(e){let n=Yr(e);return[[0,0],[n-Xn,0],[0,n-Xn]]}});var to=M(z=>{"use strict";z.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var De={N1:3,N2:3,N3:40,N4:10};z.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};z.from=function(e){return z.isValid(e)?parseInt(e,10):void 0};z.getPenaltyN1=function(e){let n=e.size,o=0,r=0,s=0,a=null,i=null;for(let l=0;l<n;l++){r=s=0,a=i=null;for(let c=0;c<n;c++){let u=e.get(l,c);u===a?r++:(r>=5&&(o+=De.N1+(r-5)),a=u,r=1),u=e.get(c,l),u===i?s++:(s>=5&&(o+=De.N1+(s-5)),i=u,s=1)}r>=5&&(o+=De.N1+(r-5)),s>=5&&(o+=De.N1+(s-5))}return o};z.getPenaltyN2=function(e){let n=e.size,o=0;for(let r=0;r<n-1;r++)for(let s=0;s<n-1;s++){let a=e.get(r,s)+e.get(r,s+1)+e.get(r+1,s)+e.get(r+1,s+1);(a===4||a===0)&&o++}return o*De.N2};z.getPenaltyN3=function(e){let n=e.size,o=0,r=0,s=0;for(let a=0;a<n;a++){r=s=0;for(let i=0;i<n;i++)r=r<<1&2047|e.get(a,i),i>=10&&(r===1488||r===93)&&o++,s=s<<1&2047|e.get(i,a),i>=10&&(s===1488||s===93)&&o++}return o*De.N3};z.getPenaltyN4=function(e){let n=0,o=e.data.length;for(let s=0;s<o;s++)n+=e.data[s];return Math.abs(Math.ceil(n*100/o/5)-10)*De.N4};function Jr(t,e,n){switch(t){case z.Patterns.PATTERN000:return(e+n)%2===0;case z.Patterns.PATTERN001:return e%2===0;case z.Patterns.PATTERN010:return n%3===0;case z.Patterns.PATTERN011:return(e+n)%3===0;case z.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(n/3))%2===0;case z.Patterns.PATTERN101:return e*n%2+e*n%3===0;case z.Patterns.PATTERN110:return(e*n%2+e*n%3)%2===0;case z.Patterns.PATTERN111:return(e*n%3+(e+n)%2)%2===0;default:throw new Error("bad maskPattern:"+t)}}z.applyMask=function(e,n){let o=n.size;for(let r=0;r<o;r++)for(let s=0;s<o;s++)n.isReserved(s,r)||n.xor(s,r,Jr(e,s,r))};z.getBestMask=function(e,n){let o=Object.keys(z.Patterns).length,r=0,s=1/0;for(let a=0;a<o;a++){n(a),z.applyMask(a,e);let i=z.getPenaltyN1(e)+z.getPenaltyN2(e)+z.getPenaltyN3(e)+z.getPenaltyN4(e);z.applyMask(a,e),i<s&&(s=i,r=a)}return r}});var Qt=M(jt=>{"use strict";var ke=Ct(),Nt=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],kt=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];jt.getBlocksCount=function(e,n){switch(n){case ke.L:return Nt[(e-1)*4+0];case ke.M:return Nt[(e-1)*4+1];case ke.Q:return Nt[(e-1)*4+2];case ke.H:return Nt[(e-1)*4+3];default:return}};jt.getTotalCodewordsCount=function(e,n){switch(n){case ke.L:return kt[(e-1)*4+0];case ke.M:return kt[(e-1)*4+1];case ke.Q:return kt[(e-1)*4+2];case ke.H:return kt[(e-1)*4+3];default:return}}});var no=M(St=>{"use strict";var rt=new Uint8Array(512),Rt=new Uint8Array(256);(function(){let e=1;for(let n=0;n<255;n++)rt[n]=e,Rt[e]=n,e<<=1,e&256&&(e^=285);for(let n=255;n<512;n++)rt[n]=rt[n-255]})();St.log=function(e){if(e<1)throw new Error("log("+e+")");return Rt[e]};St.exp=function(e){return rt[e]};St.mul=function(e,n){return e===0||n===0?0:rt[Rt[e]+Rt[n]]}});var oo=M(st=>{"use strict";var $t=no();st.mul=function(e,n){let o=new Uint8Array(e.length+n.length-1);for(let r=0;r<e.length;r++)for(let s=0;s<n.length;s++)o[r+s]^=$t.mul(e[r],n[s]);return o};st.mod=function(e,n){let o=new Uint8Array(e);for(;o.length-n.length>=0;){let r=o[0];for(let a=0;a<n.length;a++)o[a]^=$t.mul(n[a],r);let s=0;for(;s<o.length&&o[s]===0;)s++;o=o.slice(s)}return o};st.generateECPolynomial=function(e){let n=new Uint8Array([1]);for(let o=0;o<e;o++)n=st.mul(n,new Uint8Array([1,$t.exp(o)]));return n}});var ao=M((Ja,so)=>{"use strict";var ro=oo();function Gt(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}Gt.prototype.initialize=function(e){this.degree=e,this.genPoly=ro.generateECPolynomial(this.degree)};Gt.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let n=new Uint8Array(e.length+this.degree);n.set(e);let o=ro.mod(n,this.genPoly),r=this.degree-o.length;if(r>0){let s=new Uint8Array(this.degree);return s.set(o,r),s}return o};so.exports=Gt});var Yt=M(io=>{"use strict";io.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var Jt=M(xe=>{"use strict";var lo="[0-9]+",Xr="[A-Z $%*+\\-./:]+",at="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";at=at.replace(/u/g,"\\u");var Zr="(?:(?![A-Z0-9 $%*+\\-./:]|"+at+`)(?:.|[\r
|
|
2
2
|
]))+`;xe.KANJI=new RegExp(at,"g");xe.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");xe.BYTE=new RegExp(Zr,"g");xe.NUMERIC=new RegExp(lo,"g");xe.ALPHANUMERIC=new RegExp(Xr,"g");var es=new RegExp("^"+at+"$"),ts=new RegExp("^"+lo+"$"),ns=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");xe.testKanji=function(e){return es.test(e)};xe.testNumeric=function(e){return ts.test(e)};xe.testAlphanumeric=function(e){return ns.test(e)}});var Re=M(G=>{"use strict";var os=Yt(),Xt=Jt();G.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};G.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};G.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};G.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};G.MIXED={bit:-1};G.getCharCountIndicator=function(e,n){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!os.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]};G.getBestModeForData=function(e){return Xt.testNumeric(e)?G.NUMERIC:Xt.testAlphanumeric(e)?G.ALPHANUMERIC:Xt.testKanji(e)?G.KANJI:G.BYTE};G.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};G.isValid=function(e){return e&&e.bit&&e.ccBits};function rs(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return G.NUMERIC;case"alphanumeric":return G.ALPHANUMERIC;case"kanji":return G.KANJI;case"byte":return G.BYTE;default:throw new Error("Unknown mode: "+t)}}G.from=function(e,n){if(G.isValid(e))return e;try{return rs(e)}catch{return n}}});var fo=M(Me=>{"use strict";var Tt=Ne(),ss=Qt(),co=Ct(),Se=Re(),Zt=Yt(),mo=7973,uo=Tt.getBCHDigit(mo);function as(t,e,n){for(let o=1;o<=40;o++)if(e<=Me.getCapacity(o,n,t))return o}function po(t,e){return Se.getCharCountIndicator(t,e)+4}function is(t,e){let n=0;return t.forEach(function(o){let r=po(o.mode,e);n+=r+o.getBitsLength()}),n}function ls(t,e){for(let n=1;n<=40;n++)if(is(t,n)<=Me.getCapacity(n,e,Se.MIXED))return n}Me.from=function(e,n){return Zt.isValid(e)?parseInt(e,10):n};Me.getCapacity=function(e,n,o){if(!Zt.isValid(e))throw new Error("Invalid QR Code version");typeof o>"u"&&(o=Se.BYTE);let r=Tt.getSymbolTotalCodewords(e),s=ss.getTotalCodewordsCount(e,n),a=(r-s)*8;if(o===Se.MIXED)return a;let i=a-po(o,e);switch(o){case Se.NUMERIC:return Math.floor(i/10*3);case Se.ALPHANUMERIC:return Math.floor(i/11*2);case Se.KANJI:return Math.floor(i/13);case Se.BYTE:default:return Math.floor(i/8)}};Me.getBestVersionForData=function(e,n){let o,r=co.from(n,co.M);if(Array.isArray(e)){if(e.length>1)return ls(e,r);if(e.length===0)return 1;o=e[0]}else o=e;return as(o.mode,o.getLength(),r)};Me.getEncodedBits=function(e){if(!Zt.isValid(e)||e<7)throw new Error("Invalid QR Code version");let n=e<<12;for(;Tt.getBCHDigit(n)-uo>=0;)n^=mo<<Tt.getBCHDigit(n)-uo;return e<<12|n}});var yo=M(bo=>{"use strict";var en=Ne(),ho=1335,cs=21522,go=en.getBCHDigit(ho);bo.getEncodedBits=function(e,n){let o=e.bit<<3|n,r=o<<10;for(;en.getBCHDigit(r)-go>=0;)r^=ho<<en.getBCHDigit(r)-go;return(o<<10|r)^cs}});var vo=M((oi,xo)=>{"use strict";var ds=Re();function _e(t){this.mode=ds.NUMERIC,this.data=t.toString()}_e.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};_e.prototype.getLength=function(){return this.data.length};_e.prototype.getBitsLength=function(){return _e.getBitsLength(this.data.length)};_e.prototype.write=function(e){let n,o,r;for(n=0;n+3<=this.data.length;n+=3)o=this.data.substr(n,3),r=parseInt(o,10),e.put(r,10);let s=this.data.length-n;s>0&&(o=this.data.substr(n),r=parseInt(o,10),e.put(r,s*3+1))};xo.exports=_e});var wo=M((ri,Co)=>{"use strict";var us=Re(),tn=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Fe(t){this.mode=us.ALPHANUMERIC,this.data=t}Fe.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Fe.prototype.getLength=function(){return this.data.length};Fe.prototype.getBitsLength=function(){return Fe.getBitsLength(this.data.length)};Fe.prototype.write=function(e){let n;for(n=0;n+2<=this.data.length;n+=2){let o=tn.indexOf(this.data[n])*45;o+=tn.indexOf(this.data[n+1]),e.put(o,11)}this.data.length%2&&e.put(tn.indexOf(this.data[n]),6)};Co.exports=Fe});var ko=M((si,No)=>{"use strict";var ms=Re();function Ke(t){this.mode=ms.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}Ke.getBitsLength=function(e){return e*8};Ke.prototype.getLength=function(){return this.data.length};Ke.prototype.getBitsLength=function(){return Ke.getBitsLength(this.data.length)};Ke.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)};No.exports=Ke});var So=M((ai,Ro)=>{"use strict";var ps=Re(),fs=Ne();function qe(t){this.mode=ps.KANJI,this.data=t}qe.getBitsLength=function(e){return e*13};qe.prototype.getLength=function(){return this.data.length};qe.prototype.getBitsLength=function(){return qe.getBitsLength(this.data.length)};qe.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=fs.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
3
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),t.put(n,13)}};Ro.exports=qe});var To=M((ii,nn)=>{"use strict";var it={single_source_shortest_paths:function(t,e,n){var o={},r={};r[e]=0;var s=it.PriorityQueue.make();s.push(e,0);for(var a,i,l,c,u,d,
|
|
4
|
-
Suggested mode is: `+E.toString(o));switch(n===E.KANJI&&!Pt.isKanjiModeEnabled()&&(n=E.BYTE),n){case E.NUMERIC:return new Eo(t);case E.ALPHANUMERIC:return new Ao(t);case E.KANJI:return new Mo(t);case E.BYTE:return new Do(t)}}je.fromArray=function(e){return e.reduce(function(n,o){return typeof o=="string"?n.push(Bo(o,null)):o.data&&n.push(Bo(o.data,o.mode)),n},[])};je.fromString=function(e,n){let o=Io(e,Pt.isKanjiModeEnabled()),r=bs(o),s=ys(r,n),a=gs.find_path(s.map,"start","end"),i=[];for(let l=1;l<a.length-1;l++)i.push(s.table[a[l]].node);return je.fromArray(hs(i))};je.rawSplit=function(e){return je.fromArray(Io(e,Pt.isKanjiModeEnabled()))}});var Wo=M(zo=>{"use strict";var Et=Ne(),rn=Ct(),xs=$n(),vs=Yn(),Cs=Jn(),ws=eo(),ln=to(),cn=Qt(),Ns=ao(),Bt=fo(),ks=yo(),Rs=Re(),sn=Lo();function Ss(t,e){let n=t.size,o=ws.getPositions(e);for(let r=0;r<o.length;r++){let s=o[r][0],a=o[r][1];for(let i=-1;i<=7;i++)if(!(s+i<=-1||n<=s+i))for(let l=-1;l<=7;l++)a+l<=-1||n<=a+l||(i>=0&&i<=6&&(l===0||l===6)||l>=0&&l<=6&&(i===0||i===6)||i>=2&&i<=4&&l>=2&&l<=4?t.set(s+i,a+l,!0,!0):t.set(s+i,a+l,!1,!0))}}function Ts(t){let e=t.size;for(let n=8;n<e-8;n++){let o=n%2===0;t.set(n,6,o,!0),t.set(6,n,o,!0)}}function Ps(t,e){let n=Cs.getPositions(e);for(let o=0;o<n.length;o++){let r=n[o][0],s=n[o][1];for(let a=-2;a<=2;a++)for(let i=-2;i<=2;i++)a===-2||a===2||i===-2||i===2||a===0&&i===0?t.set(r+a,s+i,!0,!0):t.set(r+a,s+i,!1,!0)}}function Bs(t,e){let n=t.size,o=Bt.getEncodedBits(e),r,s,a;for(let i=0;i<18;i++)r=Math.floor(i/3),s=i%3+n-8-3,a=(o>>i&1)===1,t.set(r,s,a,!0),t.set(s,r,a,!0)}function an(t,e,n){let o=t.size,r=ks.getEncodedBits(e,n),s,a;for(s=0;s<15;s++)a=(r>>s&1)===1,s<6?t.set(s,8,a,!0):s<8?t.set(s+1,8,a,!0):t.set(o-15+s,8,a,!0),s<8?t.set(8,o-s-1,a,!0):s<9?t.set(8,15-s-1+1,a,!0):t.set(8,15-s-1,a,!0);t.set(o-8,8,1,!0)}function Es(t,e){let n=t.size,o=-1,r=n-1,s=7,a=0;for(let i=n-1;i>0;i-=2)for(i===6&&i--;;){for(let l=0;l<2;l++)if(!t.isReserved(r,i-l)){let c=!1;a<e.length&&(c=(e[a]>>>s&1)===1),t.set(r,i-l,c),s--,s===-1&&(a++,s=7)}if(r+=o,r<0||n<=r){r-=o,o=-o;break}}}function As(t,e,n){let o=new xs;n.forEach(function(l){o.put(l.mode.bit,4),o.put(l.getLength(),Rs.getCharCountIndicator(l.mode,t)),l.write(o)});let r=Et.getSymbolTotalCodewords(t),s=cn.getTotalCodewordsCount(t,e),a=(r-s)*8;for(o.getLengthInBits()+4<=a&&o.put(0,4);o.getLengthInBits()%8!==0;)o.putBit(0);let i=(a-o.getLengthInBits())/8;for(let l=0;l<i;l++)o.put(l%2?17:236,8);return Ds(o,t,e)}function Ds(t,e,n){let o=Et.getSymbolTotalCodewords(e),r=cn.getTotalCodewordsCount(e,n),s=o-r,a=cn.getBlocksCount(e,n),i=o%a,l=a-i,c=Math.floor(o/a),u=Math.floor(s/a),d=u+1,
|
|
3
|
+
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),t.put(n,13)}};Ro.exports=qe});var To=M((ii,nn)=>{"use strict";var it={single_source_shortest_paths:function(t,e,n){var o={},r={};r[e]=0;var s=it.PriorityQueue.make();s.push(e,0);for(var a,i,l,c,u,d,m,y,w;!s.empty();){a=s.pop(),i=a.value,c=a.cost,u=t[i]||{};for(l in u)u.hasOwnProperty(l)&&(d=u[l],m=c+d,y=r[l],w=typeof r[l]>"u",(w||y>m)&&(r[l]=m,s.push(l,m),o[l]=i))}if(typeof n<"u"&&typeof r[n]>"u"){var f=["Could not find a path from ",e," to ",n,"."].join("");throw new Error(f)}return o},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],o=e,r;o;)n.push(o),r=t[o],o=t[o];return n.reverse(),n},find_path:function(t,e,n){var o=it.single_source_shortest_paths(t,e,n);return it.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(t){var e=it.PriorityQueue,n={},o;t=t||{};for(o in e)e.hasOwnProperty(o)&&(n[o]=e[o]);return n.queue=[],n.sorter=t.sorter||e.default_sorter,n},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof nn<"u"&&(nn.exports=it)});var Lo=M(je=>{"use strict";var E=Re(),Eo=vo(),Ao=wo(),Do=ko(),Mo=So(),lt=Jt(),Pt=Ne(),gs=To();function Po(t){return unescape(encodeURIComponent(t)).length}function ct(t,e,n){let o=[],r;for(;(r=t.exec(n))!==null;)o.push({data:r[0],index:r.index,mode:e,length:r[0].length});return o}function Io(t){let e=ct(lt.NUMERIC,E.NUMERIC,t),n=ct(lt.ALPHANUMERIC,E.ALPHANUMERIC,t),o,r;return Pt.isKanjiModeEnabled()?(o=ct(lt.BYTE,E.BYTE,t),r=ct(lt.KANJI,E.KANJI,t)):(o=ct(lt.BYTE_KANJI,E.BYTE,t),r=[]),e.concat(n,o,r).sort(function(a,i){return a.index-i.index}).map(function(a){return{data:a.data,mode:a.mode,length:a.length}})}function on(t,e){switch(e){case E.NUMERIC:return Eo.getBitsLength(t);case E.ALPHANUMERIC:return Ao.getBitsLength(t);case E.KANJI:return Mo.getBitsLength(t);case E.BYTE:return Do.getBitsLength(t)}}function hs(t){return t.reduce(function(e,n){let o=e.length-1>=0?e[e.length-1]:null;return o&&o.mode===n.mode?(e[e.length-1].data+=n.data,e):(e.push(n),e)},[])}function bs(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n];switch(o.mode){case E.NUMERIC:e.push([o,{data:o.data,mode:E.ALPHANUMERIC,length:o.length},{data:o.data,mode:E.BYTE,length:o.length}]);break;case E.ALPHANUMERIC:e.push([o,{data:o.data,mode:E.BYTE,length:o.length}]);break;case E.KANJI:e.push([o,{data:o.data,mode:E.BYTE,length:Po(o.data)}]);break;case E.BYTE:e.push([{data:o.data,mode:E.BYTE,length:Po(o.data)}])}}return e}function ys(t,e){let n={},o={start:{}},r=["start"];for(let s=0;s<t.length;s++){let a=t[s],i=[];for(let l=0;l<a.length;l++){let c=a[l],u=""+s+l;i.push(u),n[u]={node:c,lastCount:0},o[u]={};for(let d=0;d<r.length;d++){let m=r[d];n[m]&&n[m].node.mode===c.mode?(o[m][u]=on(n[m].lastCount+c.length,c.mode)-on(n[m].lastCount,c.mode),n[m].lastCount+=c.length):(n[m]&&(n[m].lastCount=c.length),o[m][u]=on(c.length,c.mode)+4+E.getCharCountIndicator(c.mode,e))}}r=i}for(let s=0;s<r.length;s++)o[r[s]].end=0;return{map:o,table:n}}function Bo(t,e){let n,o=E.getBestModeForData(t);if(n=E.from(e,o),n!==E.BYTE&&n.bit<o.bit)throw new Error('"'+t+'" cannot be encoded with mode '+E.toString(n)+`.
|
|
4
|
+
Suggested mode is: `+E.toString(o));switch(n===E.KANJI&&!Pt.isKanjiModeEnabled()&&(n=E.BYTE),n){case E.NUMERIC:return new Eo(t);case E.ALPHANUMERIC:return new Ao(t);case E.KANJI:return new Mo(t);case E.BYTE:return new Do(t)}}je.fromArray=function(e){return e.reduce(function(n,o){return typeof o=="string"?n.push(Bo(o,null)):o.data&&n.push(Bo(o.data,o.mode)),n},[])};je.fromString=function(e,n){let o=Io(e,Pt.isKanjiModeEnabled()),r=bs(o),s=ys(r,n),a=gs.find_path(s.map,"start","end"),i=[];for(let l=1;l<a.length-1;l++)i.push(s.table[a[l]].node);return je.fromArray(hs(i))};je.rawSplit=function(e){return je.fromArray(Io(e,Pt.isKanjiModeEnabled()))}});var Wo=M(zo=>{"use strict";var Et=Ne(),rn=Ct(),xs=$n(),vs=Yn(),Cs=Jn(),ws=eo(),ln=to(),cn=Qt(),Ns=ao(),Bt=fo(),ks=yo(),Rs=Re(),sn=Lo();function Ss(t,e){let n=t.size,o=ws.getPositions(e);for(let r=0;r<o.length;r++){let s=o[r][0],a=o[r][1];for(let i=-1;i<=7;i++)if(!(s+i<=-1||n<=s+i))for(let l=-1;l<=7;l++)a+l<=-1||n<=a+l||(i>=0&&i<=6&&(l===0||l===6)||l>=0&&l<=6&&(i===0||i===6)||i>=2&&i<=4&&l>=2&&l<=4?t.set(s+i,a+l,!0,!0):t.set(s+i,a+l,!1,!0))}}function Ts(t){let e=t.size;for(let n=8;n<e-8;n++){let o=n%2===0;t.set(n,6,o,!0),t.set(6,n,o,!0)}}function Ps(t,e){let n=Cs.getPositions(e);for(let o=0;o<n.length;o++){let r=n[o][0],s=n[o][1];for(let a=-2;a<=2;a++)for(let i=-2;i<=2;i++)a===-2||a===2||i===-2||i===2||a===0&&i===0?t.set(r+a,s+i,!0,!0):t.set(r+a,s+i,!1,!0)}}function Bs(t,e){let n=t.size,o=Bt.getEncodedBits(e),r,s,a;for(let i=0;i<18;i++)r=Math.floor(i/3),s=i%3+n-8-3,a=(o>>i&1)===1,t.set(r,s,a,!0),t.set(s,r,a,!0)}function an(t,e,n){let o=t.size,r=ks.getEncodedBits(e,n),s,a;for(s=0;s<15;s++)a=(r>>s&1)===1,s<6?t.set(s,8,a,!0):s<8?t.set(s+1,8,a,!0):t.set(o-15+s,8,a,!0),s<8?t.set(8,o-s-1,a,!0):s<9?t.set(8,15-s-1+1,a,!0):t.set(8,15-s-1,a,!0);t.set(o-8,8,1,!0)}function Es(t,e){let n=t.size,o=-1,r=n-1,s=7,a=0;for(let i=n-1;i>0;i-=2)for(i===6&&i--;;){for(let l=0;l<2;l++)if(!t.isReserved(r,i-l)){let c=!1;a<e.length&&(c=(e[a]>>>s&1)===1),t.set(r,i-l,c),s--,s===-1&&(a++,s=7)}if(r+=o,r<0||n<=r){r-=o,o=-o;break}}}function As(t,e,n){let o=new xs;n.forEach(function(l){o.put(l.mode.bit,4),o.put(l.getLength(),Rs.getCharCountIndicator(l.mode,t)),l.write(o)});let r=Et.getSymbolTotalCodewords(t),s=cn.getTotalCodewordsCount(t,e),a=(r-s)*8;for(o.getLengthInBits()+4<=a&&o.put(0,4);o.getLengthInBits()%8!==0;)o.putBit(0);let i=(a-o.getLengthInBits())/8;for(let l=0;l<i;l++)o.put(l%2?17:236,8);return Ds(o,t,e)}function Ds(t,e,n){let o=Et.getSymbolTotalCodewords(e),r=cn.getTotalCodewordsCount(e,n),s=o-r,a=cn.getBlocksCount(e,n),i=o%a,l=a-i,c=Math.floor(o/a),u=Math.floor(s/a),d=u+1,m=c-u,y=new Ns(m),w=0,f=new Array(a),v=new Array(a),R=0,p=new Uint8Array(t.buffer);for(let L=0;L<a;L++){let be=L<l?u:d;f[L]=p.slice(w,w+be),v[L]=y.encode(f[L]),w+=be,R=Math.max(R,be)}let k=new Uint8Array(o),P=0,S,Y;for(S=0;S<R;S++)for(Y=0;Y<a;Y++)S<f[Y].length&&(k[P++]=f[Y][S]);for(S=0;S<m;S++)for(Y=0;Y<a;Y++)k[P++]=v[Y][S];return k}function Ms(t,e,n,o){let r;if(Array.isArray(t))r=sn.fromArray(t);else if(typeof t=="string"){let c=e;if(!c){let u=sn.rawSplit(t);c=Bt.getBestVersionForData(u,n)}r=sn.fromString(t,c||40)}else throw new Error("Invalid data");let s=Bt.getBestVersionForData(r,n);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=s;else if(e<s)throw new Error(`
|
|
5
5
|
The chosen QR Code version cannot contain this amount of data.
|
|
6
6
|
Minimum version required to store current data is: `+s+`.
|
|
7
|
-
`);let a=As(e,n,r),i=Et.getSymbolSize(e),l=new vs(i);return Ss(l,e),Ts(l),Ps(l,e),an(l,n,0),e>=7&&Bs(l,e),Es(l,a),isNaN(o)&&(o=ln.getBestMask(l,an.bind(null,l,n))),ln.applyMask(o,l),an(l,n,o),{modules:l,version:e,errorCorrectionLevel:n,maskPattern:o,segments:r}}zo.create=function(e,n){if(typeof e>"u"||e==="")throw new Error("No input text");let o=rn.M,r,s;return typeof n<"u"&&(o=rn.from(n.errorCorrectionLevel,rn.M),r=Bt.from(n.version),s=ln.from(n.maskPattern),n.toSJISFunc&&Et.setToSJISFunction(n.toSJISFunc)),Ms(e,r,o,s)}});var dn=M(Ie=>{"use strict";function Vo(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(o){return[o,o]}))),e.length===6&&e.push("F","F");let n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+e.slice(0,6).join("")}}Ie.getOptions=function(e){e||(e={}),e.color||(e.color={});let n=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,o=e.width&&e.width>=21?e.width:void 0,r=e.scale||4;return{width:o,scale:o?4:r,margin:n,color:{dark:Vo(e.color.dark||"#000000ff"),light:Vo(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Ie.getScale=function(e,n){return n.width&&n.width>=e+n.margin*2?n.width/(e+n.margin*2):n.scale};Ie.getImageWidth=function(e,n){let o=Ie.getScale(e,n);return Math.floor((e+n.margin*2)*o)};Ie.qrToImageData=function(e,n,o){let r=n.modules.size,s=n.modules.data,a=Ie.getScale(r,o),i=Math.floor((r+o.margin*2)*a),l=o.margin*a,c=[o.color.light,o.color.dark];for(let u=0;u<i;u++)for(let d=0;d<i;d++){let
|
|
8
|
-
`;return typeof o=="function"&&o(null,p),p}});var Ko=M(dt=>{"use strict";var Vs=qn(),pn=Wo(),Fo=Ho(),Hs=_o();function fn(t,e,n,o,r){let s=[].slice.call(arguments,1),a=s.length,i=typeof s[a-1]=="function";if(!i&&!Vs())throw new Error("Callback required as last argument");if(i){if(a<2)throw new Error("Too few arguments provided");a===2?(r=n,n=e,e=o=void 0):a===3&&(e.getContext&&typeof r>"u"?(r=o,o=void 0):(r=o,o=n,n=e,e=void 0))}else{if(a<1)throw new Error("Too few arguments provided");return a===1?(n=e,e=o=void 0):a===2&&!e.getContext&&(o=n,n=e,e=void 0),new Promise(function(l,c){try{let u=pn.create(n,o);l(t(u,e,o))}catch(u){c(u)}})}try{let l=pn.create(n,o);r(null,t(l,e,o))}catch(l){r(l)}}dt.create=pn.create;dt.toCanvas=fn.bind(null,Fo.render);dt.toDataURL=fn.bind(null,Fo.renderToDataURL);dt.toString=fn.bind(null,function(t,e,n){return Hs.render(t,n)})});var ba={};Wr(ba,{AccountButton:()=>vt,AccountSelector:()=>or,AccountSelectorView:()=>Cn,AddressWarningDialog:()=>yr,AppKit:()=>Tn,AppKitButton:()=>Pn,AppKitChainSelector:()=>Bn,ChainSelector:()=>Le,ConnectButton:()=>we,ErrorBoundary:()=>Ge,PasskeySetup:()=>cr,PasskeySetupView:()=>Rn,PassphraseDialog:()=>lr,PassphraseDialogView:()=>kn,QRCodeModal:()=>Qe,RouteSelector:()=>pr,SeedPhraseBackup:()=>$e,SignInButton:()=>Mt,SmartWalletSettings:()=>hr,SmartWalletToggle:()=>gr,ThemeProvider:()=>It,WalletConnectProvider:()=>ht,WalletPicker:()=>xr,WalletSecurityPanel:()=>ar,WalletSecurityPanelView:()=>wn,Web3ComponentProvider:()=>zt,Web3ConnectUI:()=>Ze,cn:()=>N,useAppKit:()=>Sn,useComponent:()=>Zo,useComponentRegistry:()=>B,useDetectionMode:()=>Jo,useEIP6963:()=>He,useIsMobile:()=>Ue,useTheme:()=>yn,useThemeVariable:()=>$o,useWalletConnect:()=>In,useWalletConnectOptional:()=>bt});module.exports=Vr(ba);var ue=require("react"),zn=require("@naculus/connect-appkit-react");var K=require("react"),Mn=require("@naculus/connect-appkit-react"),Ln=require("react/jsx-runtime"),_t=(0,K.createContext)(null);function ht({children:t}){let e=(0,Mn.useWeb3)(),[n,o]=(0,K.useState)(null),[r,s]=(0,K.useState)(!1),[a,i]=(0,K.useState)("idle"),[l,c]=(0,K.useState)(null),u=(0,K.useRef)(0),d=(0,K.useRef)(null);(0,K.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let p=(0,K.useCallback)(()=>{u.current+=1,e.cancelPairing?.(),d.current&&(clearTimeout(d.current),d.current=null),o(null),s(!1),i("cancelled"),c(null)},[e]),x=(0,K.useRef)(void 0);x.current=async()=>{if(!e.startPairing||!e.completePairing){c("WalletConnect pairing not available"),i("error");return}let m=++u.current,k=()=>u.current===m;i("loading"),c(null),s(!0);try{let P=await e.startPairing();if(!k())return;o(P),i("ready");try{if(await e.completePairing(),!k())return;d.current=setTimeout(()=>{d.current=null,k()&&(s(!1),o(null),i("idle"))},1e3)}catch(S){if(!k())return;i("error"),c(S instanceof Error?S.message:"Connection failed")}}catch(P){if(!k())return;i("error"),c(P instanceof Error?P.message:"Failed to generate QR code")}};let w=(0,K.useCallback)(async()=>{await x.current?.()},[]),f=(0,K.useCallback)(()=>{o(null),c(null),i("loading"),x.current?.()},[]),v=(0,K.useMemo)(()=>({qrUri:n,showQR:r,qrStatus:a,error:l}),[n,r,a,l]),R=(0,K.useMemo)(()=>({state:v,connectWalletConnect:w,cancelQR:p,retryQR:f}),[v,w,p,f]);return(0,Ln.jsx)(_t.Provider,{value:R,children:t})}function In(){let t=(0,K.useContext)(_t);if(!t)throw new Error("useWalletConnect must be used within a WalletConnectProvider");return t}function bt(){return(0,K.useContext)(_t)}var Ee=require("react");function He(){let[t,e]=(0,Ee.useState)([]),[n,o]=(0,Ee.useState)(!0),r=(0,Ee.useRef)(new Set);return(0,Ee.useEffect)(()=>{r.current.clear(),o(!0);let s=i=>{let l=i.detail,c=l?.info,u=l?.provider;!c?.rdns||r.current.has(c.rdns)||(r.current.add(c.rdns),e(d=>d.find(p=>p.id===c.rdns)?d:[...d,{id:c.rdns,name:c.name||c.rdns,icon:c.icon||"",rdns:c.rdns,provider:u}]))};window.addEventListener("eip6963:announceProvider",s),window.dispatchEvent(new Event("eip6963:requestProvider"));let a=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",s),clearTimeout(a)}},[]),{wallets:t,isDetecting:n,hasWallets:t.length>0}}var yt=require("react");function Ue(){let[t,e]=(0,yt.useState)(!1);return(0,yt.useEffect)(()=>{if(typeof navigator>"u"||typeof window>"u")return;let n=navigator.userAgent.toLowerCase();e(/(iphone|ipad|ipod|android|mobile)/i.test(n))},[]),t}var Ft=require("react/jsx-runtime");function we({className:t,isConnected:e,isConnecting:n,onConnect:o,onDisconnect:r,onMobileDeepLink:s,mobileWalletName:a,startPairing:i,completePairing:l,address:c,balance:u,balanceSymbol:d,tokenBalances:p,isBalanceLoading:x,explorerUrl:w,explorerLabel:f}){let v=bt(),{wallets:R}=He(),m=Ue(),k=JSON.stringify(R.map(({id:J,name:ge,icon:ee,rdns:Ve})=>({id:J,name:ge,icon:ee,rdns:Ve}))),[P,S]=(0,ue.useState)(null),[Y,L]=(0,ue.useState)(!1),[be,Z]=(0,ue.useState)(null),se=(0,ue.useRef)({aborted:!1}),nt=(0,ue.useCallback)(()=>{se.current.aborted=!0,v?.cancelQR(),L(!1),S(null),Z(null)},[v]);(0,ue.useEffect)(()=>{if(!v)return;let{qrStatus:J,qrUri:ge,error:ee}=v.state;J==="loading"?(L(!0),S(null),Z(null)):J==="ready"&&ge?(L(!1),S(ge),Z(null)):J==="error"?(L(!1),Z(ee)):(J==="idle"||J==="cancelled")&&(L(!1),S(null),Z(null))},[v?.state?.qrStatus,v?.state?.qrUri,v?.state?.error]);let ye=(0,ue.useCallback)((J,ge)=>{if(J==="walletconnect"){if(v){v.connectWalletConnect();return}if(i&&l){L(!0),Z(null),se.current.aborted=!1,i().then(ee=>{se.current.aborted||(S(ee),L(!1),l().then(()=>{se.current.aborted||S(null)}).catch(Ve=>{se.current.aborted||Z(Ve instanceof Error?Ve.message:"Connection failed")}))}).catch(ee=>{se.current.aborted||(L(!1),Z(ee instanceof Error?ee.message:"Connection failed"))});return}}o?.(J,()=>{},ge)},[v,i,l,o]);return(0,Ft.jsx)("div",{className:t,children:(0,Ft.jsx)(zn.AppkitConnectButton,{connected:e??!1,connecting:n??!1,address:c??"",balance:u??null,balanceSymbol:d??"",isBalanceLoading:x??!1,tokenBalancesJson:JSON.stringify(p??[]),explorerUrl:w??"",explorerLabel:f??"",walletsJson:k,isMobile:m,mobileWalletName:a??"",qrUri:P,qrLoading:Y,qrError:be,onAppkitConnect:J=>{ye(J.detail.kind,J.detail.walletId)},onAppkitDisconnect:()=>r?.(),onAppkitStartPairing:()=>ye("walletconnect"),onAppkitRetry:()=>{se.current.aborted=!0,Z(null),S(null),ye("walletconnect")},onAppkitCancelPairing:nt,onAppkitMobileDeepLink:()=>s?.(),onAppkitCopyAddress:J=>{navigator.clipboard?.writeText(J.detail).catch(()=>{})}})})}var tr=require("@naculus/connect-core"),tt=require("react"),Wt=require("@naculus/connect-appkit-react");var Wn=require("clsx"),Vn=require("tailwind-merge");function N(...t){return(0,Vn.twMerge)((0,Wn.clsx)(t))}var Hn='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 0l-.26.97v28.15l.26.26 13.07-7.72L12 0z" fill="#8C8C8C"/><path d="M12 0L-.87 21.69l12.87 7.72V0z" fill="#3C3C3B"/><path d="M12 31.88l-.16.2v10.55l.16.47 13.08-18.42L12 31.88z" fill="#8C8C8C"/><path d="M12 42.9V31.88L-.87 24.68 12 42.9z" fill="#3C3C3B"/><path d="M12 28.41l13.07-7.72L12 14.09v14.32z" fill="#141414"/><path d="M-.87 20.69L12 28.41V14.09l-12.87 6.6z" fill="#393939"/></svg>',Hr='<svg viewBox="0 0 24 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 12.3l-3.7 2.2-3.8-2.2V7.9L11.3 5.7 15 7.9v2.7l-2.2 1.3-1.5-.9v-2l1.5.9 2.2-1.3V7.9L11.3 4 6 7.9v6.3l5.3 3.1 5.3-3.1-1.6-2.8z" fill="#6C00F6"/></svg>',Ur='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#F0B90B"/><path d="M12 4l2.7 1.6L14.7 7 12 5.4 9.3 7l-.7-.4L12 4zm4.7 2.7l-2.7 1.6V10l4 2.3v4.7L16 18.7v-4l-1.3-.7v4L12 20l-2.7-1.6v-4L8 14.7v4l-1.3-.7V12.3l4-2.3V8.3l-2.7-1.6.7-.4L12 8l2.7-1.7.7.4z" fill="white"/></svg>',Or='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.5c.3 0 .6.1.8.2l8.8 5.1c.5.3.9.9.9 1.5v10.2c0 .6-.3 1.2-.9 1.5l-8.8 5.1c-.3.2-.6.2-.8.2s-.6-.1-.8-.2l-8.8-5.1c-.5-.3-.9-.9-.9-1.5V8.3c0-.6.3-1.2.9-1.5l8.8-5.1c.3-.2.6-.2.8-.2z" fill="#213147"/><path d="M14.7 13.8l-1.2 3.2c0 .1 0 .2.1.3l2 5.5 2.3-1.3-2.8-7.6c-.1-.2-.3-.2-.4-.1z" fill="#12AAFF"/><path d="M16.3 8.5c0-.2-.3-.2-.4 0l-1.1 3.2c0 .1 0 .2.1.3l3.3 9 2.3-1.3-4.2-9.1v-.1z" fill="#12AAFF"/><path d="M12 3.5c.1 0 .2 0 .3.1l8.8 5.1c.1.1.2.2.2.3v10.2c0 .1-.1.2-.2.3l-8.8 5.1c-.1 0-.2.1-.3.1s-.2 0-.3-.1l-8.8-5.1c-.1-.1-.2-.2-.2-.3V9c0-.1.1-.2.2-.3l8.8-5.1c.1 0 .2-.1.3-.1z" fill="#9DCCED" fill-opacity="0.3"/><path d="M13.3 6.2h-2.2c-.2 0-.3.1-.4.3L5.9 19.6l2.3 1.3L13 6.5c0-.1-.1-.3-.2-.3h.4z" fill="white"/><path d="M15.2 6.2H13c-.2 0-.3.1-.4.3L8.1 21.4l2.3 1.3 6-16.4c0-.1-.1-.3-.2-.3v.2z" fill="white"/></svg>',_r='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#FF0420"/><path d="M8.5 16c-.5 0-.9-.1-1.3-.3-.4-.2-.7-.5-1-.8-.3-.4-.4-.8-.4-1.3V10c0-.5.1-1 .4-1.4.3-.4.6-.7 1-.9.4-.2.8-.3 1.3-.3.4 0 .8.1 1.2.2.3.2.6.4.8.7l-1 1c-.2-.2-.4-.3-.6-.4-.2-.1-.5-.2-.8-.2-.3 0-.6.1-.9.2-.3.2-.5.4-.6.7-.1.3-.2.6-.2 1v3.5c0 .3.1.6.2.9.1.3.3.5.6.6.3.2.6.2.9.2.3 0 .6-.1.8-.2.2-.1.4-.3.6-.5l1 1c-.2.3-.5.5-.8.7-.4.2-.9.3-1.4.3z" fill="white"/><path d="M15.5 16c-.5 0-.9-.1-1.3-.3-.4-.2-.7-.5-1-.8-.2-.4-.4-.8-.4-1.3V10c0-.5.1-1 .4-1.4.2-.4.5-.7.9-.9.4-.2.8-.3 1.3-.3.5 0 1 .1 1.4.3.4.2.7.5.9.9.2.4.3.9.3 1.4v.7h-2.9v-1.1c0-.3-.1-.6-.2-.9-.1-.3-.3-.5-.5-.6-.2-.1-.5-.2-.8-.2-.3 0-.6.1-.8.2-.3.2-.5.4-.6.7-.1.3-.2.6-.2 1v3.5c0 .3.1.6.2.8.1.3.3.5.6.6.2.2.5.2.8.2.3 0 .6-.1.8-.2.2-.1.4-.3.5-.6.1-.3.2-.6.2-1v-1.1h2.9v.7c0 .5-.1 1-.3 1.4-.2.4-.5.7-.9.9-.4.2-.9.3-1.4.3z" fill="white"/></svg>',Fr='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#E84142"/><path d="M8.6 16.8H6.3c-.5 0-.8-.1-1-.3-.2-.2-.3-.5-.3-.8 0-.2 0-.4.1-.6l5.8-10.7c.2-.4.5-.7.8-.8.3-.1.5-.1.7 0 .2.1.5.3.7.8l1.2 2.1.1.2c.3.5.5.9.5 1.3.1.4.1.8 0 1.1-.1.4-.3.8-.6 1.3l-3 5.4c-.2.5-.5.8-.8 1-.4.2-.7.2-1.2.2z" fill="white"/><path d="M14.5 16.8h3.3c.5 0 .7-.1 1-.3.2-.2.3-.5.3-.8 0-.2-.1-.4-.3-.7l-1.7-3-.2-.3c-.2-.4-.4-.7-.6-.8-.2-.1-.4-.1-.6 0-.2.1-.4.3-.6.8l-1.6 3c-.2.4-.4.7-.4.9 0 .2.1.5.3.7.1.1.4.3.9.3z" fill="white"/></svg>',Kr='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#1969FF"/><path d="M11.3 3.8c.4-.2 1-.2 1.4 0l4.1 2.2c.2.1.4.3.4.5h0v10.9c0 .2-.1.4-.4.6l-4.1 2.2c-.4.2-1 .2-1.4 0l-4.1-2.2c-.3-.1-.4-.4-.4-.6V6.5c0-.2.1-.4.4-.5l4.1-2.2zm5.3 8.7l-3.9 2c-.4.2-1 .2-1.4 0l-3.9-2v4.8l3.9 2c.2.1.5.2.7.2.2 0 .5-.1.7-.2l3.9-2v-4.8z" fill="white"/></svg>',qr={"eip155:1":Hn,"eip155:137":Hr,"eip155:56":Ur,"eip155:42161":Or,"eip155:10":_r,"eip155:43114":Fr,"eip155:250":Kr,"eip155:11155111":Hn};function xt(t){return qr[t]}var et=require("react");var Un=require("lucide-react");var me=require("react/jsx-runtime");function jr({children:t}){return(0,me.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground",children:t})}function vt({className:t,showAddress:e=!0,showBalance:n=!1,address:o,balance:r,balanceSymbol:s,onConnect:a}){let l=B().Button;if(!o)return(0,me.jsxs)(l,{"aria-label":"Connect Wallet",onClick:a,className:t,children:[(0,me.jsx)(Un.Wallet,{size:18,className:"shrink-0"}),"Connect Wallet"]});let c=o.includes(":")?o.split(":").pop():o,u=c.slice(0,6)+"..."+c.slice(-4),d=r!=null?parseFloat(r).toLocaleString(void 0,{maximumFractionDigits:4})+(s?` ${s}`:""):null;return(0,me.jsxs)(l,{className:t,children:[(0,me.jsx)(jr,{children:"W"}),(0,me.jsxs)("div",{className:"flex flex-col items-start gap-0",children:[e&&(0,me.jsx)("span",{className:"font-mono text-xs",children:u}),n&&d&&(0,me.jsx)("span",{className:"text-xs text-muted-foreground",children:d}),n&&!d&&r===null&&(0,me.jsx)("span",{className:"text-xs text-muted-foreground",children:"Loading..."})]})]})}var pe=require("react"),ce=require("lucide-react");var Kt=require("react");var On=require("lucide-react"),ie=require("react/jsx-runtime");function Oe({open:t,onClose:e,children:n,closable:o,className:r}){return(0,Kt.useEffect)(()=>{if(!t)return;let s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s}},[t]),(0,Kt.useEffect)(()=>{if(!t||!e)return;let s=a=>{a.key==="Escape"&&e()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t,e]),t?(0,ie.jsxs)("div",{className:N("fixed inset-0 z-50 flex items-center justify-center p-4",r),style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"},children:[(0,ie.jsx)("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:e,style:{position:"absolute",inset:0,background:"rgb(0 0 0 / 0.8)"}}),(0,ie.jsxs)("div",{role:"dialog","aria-modal":"true",className:"relative z-10 w-full max-w-sm rounded-xl border bg-card text-card-foreground shadow-2xl max-h-[85vh] overflow-y-auto p-6",style:{position:"relative",zIndex:10,width:"100%",maxWidth:"24rem",maxHeight:"85vh",overflowY:"auto",borderRadius:"0.75rem",padding:"1.5rem",background:"hsl(var(--card, 0 0% 100%))",color:"hsl(var(--card-foreground, 222.2 84% 4.9%))",boxShadow:"0 25px 50px -12px rgb(0 0 0 / 0.4)"},children:[o&&e&&(0,ie.jsx)("button",{onClick:e,type:"button","aria-label":"Close modal",className:"absolute right-4 top-4 z-20 rounded-md p-1 text-muted-foreground hover:text-foreground",style:{position:"absolute",right:"1rem",top:"1rem",zIndex:20,border:0,background:"transparent",cursor:"pointer",color:"inherit"},children:(0,ie.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,ie.jsx)("path",{d:"M18 6 6 18M6 6l12 12","data-testid":"x-icon"})})}),n]})]}):null}function _n({title:t,onClose:e,showCloseButton:n=!0}){return(0,ie.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,ie.jsx)("h2",{className:"text-lg font-semibold m-0",children:t}),n&&e&&(0,ie.jsx)("button",{onClick:e,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200","aria-label":"Close",children:(0,ie.jsx)(On.X,{size:16})})]})}function Fn({children:t,className:e=""}){return(0,ie.jsx)("div",{className:N("flex flex-col gap-4",e),children:t})}var T=require("react/jsx-runtime");async function Us(t,e){let n=await Promise.resolve().then(()=>Ot(Ko(),1)),r=(n.default??n).toCanvas??n.toCanvas;if(typeof r!="function")throw new Error("qrcode.toCanvas is unavailable");return new Promise((s,a)=>{r(t,e,{width:280,margin:2},i=>{i?a(i):s()})})}function Qe({uri:t,open:e,onClose:n,onDeepLink:o,onRetry:r,status:s="pending",showDeepLink:a,timeoutMs:i=300*1e3,title:l="Scan with WalletConnect",description:c="Open your wallet app and scan this QR code to connect.",className:u}){let d=(0,pe.useRef)(null),[p,x]=(0,pe.useState)(null),[w,f]=(0,pe.useState)(0),v=Ue(),R=B(),m=R.Button,k=a??v,P=(0,pe.useRef)(null);(0,pe.useEffect)(()=>{!e||!t||!d.current||(x(null),Us(d.current,t).catch(ee=>{x(ee instanceof Error?ee.message:"Unable to render QR code")}))},[e,t]),(0,pe.useEffect)(()=>{if(!e||s!=="pending"){P.current&&(clearInterval(P.current),P.current=null),f(0);return}let ee=Date.now();return P.current=setInterval(()=>f(Date.now()-ee),1e3),()=>{P.current&&clearInterval(P.current)}},[e,s,i]);let S=w>=i&&s==="pending",Y=S||s==="expired"||s==="error",L=Math.max(0,Math.ceil((i-w)/1e3)),be=Math.floor(L/60),Z=L%60,se=Math.min(w/i,1),nt=(0,pe.useCallback)(()=>{t&&o&&o(t)},[t,o]),ye=t&&!S&&s==="pending"?p?(0,T.jsxs)("div",{className:"w-[280px] h-[280px] flex flex-col items-center justify-center bg-muted rounded-lg gap-2",children:[(0,T.jsx)(ce.AlertCircle,{size:24,className:"text-muted-foreground"}),(0,T.jsx)("span",{className:"text-sm text-muted-foreground",children:"Failed to render QR code"})]}):(0,T.jsx)("canvas",{ref:d,width:280,height:280,role:"img","aria-label":"WalletConnect pairing QR code",className:"rounded-lg border border-border"}):(0,T.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 bg-muted rounded-lg w-[280px] h-[280px]",children:[s==="scanned"?(0,T.jsx)(ce.CheckCircle2,{size:48,className:"text-[hsl(var(--primary))]"}):(0,T.jsx)(ce.AlertCircle,{size:48,className:"text-destructive"}),(0,T.jsx)("span",{className:"text-sm text-muted-foreground","data-testid":"status-label",children:s==="scanned"?"QR code scanned! Connecting...":S||s==="expired"?"Connection timed out.":"Something went wrong. Try again."})]}),ge=R.Modal??Oe;return(0,T.jsx)(ge,{open:e,onClose:n,closable:!0,title:l,className:u,children:(0,T.jsxs)("div",{className:"p-6",children:[(0,T.jsxs)("div",{className:"text-center mb-5",children:[(0,T.jsx)("div",{className:"flex justify-center mb-3",children:s==="pending"&&!S&&(0,T.jsx)(ce.Loader2,{size:20,className:"animate-spin text-primary","data-testid":"loader-icon-inline"})}),(0,T.jsx)("h3",{className:"text-lg font-semibold m-0 text-foreground",children:l}),c&&(0,T.jsx)("p",{className:"text-sm text-muted-foreground mt-1.5 mb-0",children:c})]}),(0,T.jsx)("div",{className:"flex justify-center mb-4",children:ye}),s==="pending"&&!S&&(0,T.jsxs)("div",{className:"mb-3",children:[(0,T.jsx)("div",{className:"h-1 bg-muted rounded-full overflow-hidden",role:"progressbar","aria-valuenow":Math.round((1-se)*100),"aria-valuemin":0,"aria-valuemax":100,children:(0,T.jsx)("div",{className:"h-full bg-primary rounded-full transition-all duration-1000",style:{width:`${(1-se)*100}%`}})}),(0,T.jsxs)("p",{"data-testid":"countdown",className:"text-xs text-muted-foreground text-center mt-1.5 mb-0",children:["Expires in ",be,":",Z.toString().padStart(2,"0")]})]}),(0,T.jsxs)("div",{className:"flex flex-col gap-2",children:[k&&t&&s==="pending"&&!S&&(0,T.jsxs)("button",{onClick:nt,className:"inline-flex items-center justify-center gap-2 w-full rounded-lg border border-input bg-card px-4 py-2.5 text-sm font-medium text-foreground hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[(0,T.jsx)(ce.Smartphone,{size:16})," Open in Wallet App"]}),Y&&r&&(m?(0,T.jsxs)(m,{onClick:r,variant:"default",size:"default",className:"w-full",children:[(0,T.jsx)(ce.RefreshCw,{size:16})," Generate New QR Code"]}):(0,T.jsxs)("button",{onClick:r,className:"inline-flex items-center justify-center gap-2 w-full rounded-lg bg-primary text-primary-foreground px-4 py-2.5 text-sm font-medium hover:bg-primary/90 transition-all duration-200 cursor-pointer border-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[(0,T.jsx)(ce.RefreshCw,{size:16})," Generate New QR Code"]})),m?(0,T.jsx)(m,{onClick:n,variant:"outline",size:"default",className:"w-full",children:"Cancel"}):(0,T.jsx)("button",{onClick:n,className:"inline-flex items-center justify-center w-full rounded-lg border border-input bg-transparent px-4 py-2.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Cancel"})]})]})})}var Dt=require("react"),ne=require("lucide-react");var C=require("react/jsx-runtime");function Mt({className:t,isSignedIn:e=!1,isSigningIn:n=!1,result:o=null,error:r=null,onSignIn:s,onClearError:a,children:i}){let[l,c]=(0,Dt.useState)(!1),[u,d]=(0,Dt.useState)(!1),[p,x]=(0,Dt.useState)(!1),w=B(),f=w.Button,v=w.Dialog,R=w.DialogContent,m=w.DialogHeader,k=w.DialogTitle,P=async()=>{if(o?.signature)try{await navigator.clipboard.writeText(o.signature),x(!1),d(!0),setTimeout(()=>d(!1),2e3)}catch{d(!1),x(!0)}};return!e&&!n&&!r?(0,C.jsx)(f,{onClick:s,className:t,"aria-label":"Sign In",children:(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,C.jsx)(ne.LogIn,{size:16}),i??"Sign In"]})}):n?(0,C.jsx)(f,{disabled:!0,className:t,"aria-label":"Signing In",children:(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,C.jsx)(ne.Loader2,{size:16,className:"animate-spin"}),"Signing In..."]})}):r&&!e?(0,C.jsxs)("div",{style:{position:"relative",display:"inline-flex",flexDirection:"column"},children:[(0,C.jsx)(f,{onClick:s,className:t,"aria-label":"Retry Sign In",children:(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,C.jsx)(ne.AlertCircle,{size:16,style:{color:"var(--destructive, #ef4444)"}}),i??"Retry Sign In"]})}),(0,C.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--destructive, #ef4444)",padding:"0.25rem 0.5rem",borderRadius:"0.375rem",background:"var(--destructive-foreground, #fef2f2)",marginTop:"2px",wordBreak:"break-word",maxWidth:"100%",lineHeight:1.4},children:r.message})]}):(0,C.jsxs)("div",{style:{position:"relative",display:"inline-block"},children:[(0,C.jsx)(f,{onClick:()=>c(S=>!S),className:t,children:(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,C.jsx)(ne.CheckCircle2,{size:16,style:{color:"#22c55e"}}),(0,C.jsx)("span",{style:{fontSize:"0.875rem",fontWeight:500},children:"Signed In"})]})}),l&&(v&&R?(0,C.jsx)(v,{open:!0,onOpenChange:S=>{S||c(!1)},children:(0,C.jsx)(R,{children:m&&k?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(m,{children:(0,C.jsx)(k,{children:"Sign-In Details"})}),(0,C.jsx)(gn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:p,onCopy:P})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Sign-In Details"}),(0,C.jsx)(gn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:p,onCopy:P})]})})}):l&&(0,C.jsx)("div",{style:{position:"absolute",top:"calc(100% + 8px)",right:0,zIndex:100,width:"340px",maxWidth:"90vw",background:"var(--card, #fff)",border:"1px solid var(--border, #e2e8f0)",borderRadius:"0.75rem",boxShadow:"0 10px 25px rgba(0,0,0,0.1)",padding:"1rem"},children:(0,C.jsx)(gn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:p,onCopy:P})}))]})}function gn({result:t,onClose:e,copiedSign:n,onCopy:o,copyFailed:r}){let a=B().Button;if(!t)return(0,C.jsxs)("div",{style:{textAlign:"center",padding:"1rem 0"},children:[(0,C.jsx)(ne.CheckCircle2,{size:32,style:{color:"#22c55e",margin:"0 auto 0.75rem"}}),(0,C.jsx)("p",{style:{fontSize:"0.875rem",color:"var(--muted-foreground, #64748b)"},children:"Authenticated successfully"}),(0,C.jsx)(a,{variant:"outline",size:"sm",onClick:e,children:"Close"})]});let{message:i,signature:l}=t,c=l.length>20?l.slice(0,14)+"..."+l.slice(-6):l;return(0,C.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,C.jsx)(ne.CheckCircle2,{size:18,color:"#22c55e"}),(0,C.jsx)("span",{style:{fontWeight:600,fontSize:"0.9375rem"},children:"Signed In"})]}),(0,C.jsx)(a,{variant:"ghost",size:"icon",onClick:e,children:(0,C.jsx)(ne.X,{size:16})})]}),(0,C.jsxs)("div",{style:{display:"grid",gap:"0.375rem"},children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Domain"}),(0,C.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:i.domain})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Address"}),(0,C.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem",wordBreak:"break-all"},children:i.address})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Chain"}),(0,C.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:i.chainId})]})]}),i.statement&&(0,C.jsx)("div",{style:{padding:"0.5rem 0.625rem",borderRadius:"0.375rem",background:"var(--muted, #f1f5f9)",fontSize:"0.8125rem",lineHeight:1.5},children:i.statement}),(0,C.jsxs)("div",{children:[(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.25rem"},children:[(0,C.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Signature"}),(0,C.jsx)(a,{variant:"ghost",size:"icon",onClick:o,title:r?"This browser refused the clipboard \u2014 select the signature and copy it":"Copy signature","aria-label":r?"Copy failed":"Copy signature",children:n?(0,C.jsx)(ne.Check,{size:12,color:"#22c55e"}):(0,C.jsx)(ne.Copy,{size:12})})]}),(0,C.jsx)("p",{style:{fontSize:"0.75rem",fontFamily:"monospace",wordBreak:"break-all",lineHeight:1.4,color:"var(--muted-foreground, #64748b)",background:"var(--muted, #f1f5f9)",padding:"0.375rem 0.5rem",borderRadius:"0.375rem"},children:c})]}),(0,C.jsx)(a,{variant:"outline",className:"w-full",onClick:e,children:"Close"})]})}var Q=require("react"),H=require("lucide-react");var g=require("react/jsx-runtime");function Os(t){let e=Math.floor(4294967296/t)*t,n=new Uint32Array(1),o;do crypto.getRandomValues(n),o=n[0];while(o>=e);return o%t}function hn(t){let e=[...t];for(let n=e.length-1;n>0;n--){let o=Os(n+1);[e[n],e[o]]=[e[o],e[n]]}return e}function qo(t,e=3){let n=t.trim().split(/\s+/);return hn(n.map((r,s)=>s)).slice(0,Math.min(e,n.length)).map(r=>{let s=n[r],a=n.filter((c,u)=>u!==r),i=hn(a).slice(0,3),l=hn([s,...i]);return{index:r,correct:s,options:l}})}function $e({seedPhrase:t,onConfirm:e,onSkip:n,onExportPrivateKey:o,className:r,wordCount:s,inline:a=!1,open:i=!0,onOpenChange:l}){let c=B(),u=c.Button,d=c.Dialog,p=c.DialogContent,x=c.DialogHeader,w=c.DialogTitle,[f,v]=(0,Q.useState)("reveal"),[R,m]=(0,Q.useState)(!1),[k,P]=(0,Q.useState)(!1),[S,Y]=(0,Q.useState)(!1),[L,be]=(0,Q.useState)(()=>qo(t,3)),[Z,se]=(0,Q.useState)({}),[nt,ye]=(0,Q.useState)([]),[J,ge]=(0,Q.useState)(!1),[ee,Ve]=(0,Q.useState)(null),Ht=(0,Q.useMemo)(()=>t.trim().split(/\s+/),[t]),vr=(0,Q.useMemo)(()=>{let V=new Map;return Ht.map(te=>{let ae=V.get(te)??0;return V.set(te,ae+1),{word:te,key:`${te}-${ae}`}})},[Ht]),ya=s??(Ht.length===24?24:12),Cr=(0,Q.useCallback)(()=>m(!0),[]),wr=(0,Q.useCallback)(async()=>{try{await navigator.clipboard.writeText(t),Y(!1),P(!0),setTimeout(()=>P(!1),2e3)}catch{P(!1),Y(!0)}},[t]),Nr=(0,Q.useCallback)(()=>{be(qo(t,3)),se({}),ye([]),v("confirm")},[t]),kr=(0,Q.useCallback)((V,te)=>{se(ae=>({...ae,[V]:te})),ye(ae=>ae.filter(Ut=>Ut!==V))},[]),Rr=(0,Q.useCallback)(()=>{let V=[];for(let te of L)Z[te.index]!==te.correct&&V.push(te.index);if(V.length>0){ye(V);return}v("done"),e()},[L,Z,e]),An=(0,Q.useCallback)(()=>{n?.()},[n]),Sr=(0,Q.useCallback)(()=>{if(o){let V=o();Ve(V),ge(!0)}},[o]),Tr=L.every(V=>Z[V.index]!==void 0),Pr=(0,g.jsxs)("div",{className:"space-y-4",children:[(0,g.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/30 px-4 py-3",children:(0,g.jsxs)("div",{className:"flex items-start gap-2",children:[(0,g.jsx)(H.AlertTriangle,{size:16,className:"mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,g.jsx)("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:"Write down these words in order and store them somewhere safe. Never share them with anyone. If you lose your seed phrase, your funds cannot be recovered."})]})}),R?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:vr.map(({word:V,key:te},ae)=>(0,g.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2.5 py-1.5 text-sm",children:[(0,g.jsx)("span",{className:"text-xs text-muted-foreground w-5 shrink-0 text-right",children:ae+1}),(0,g.jsx)("span",{className:"font-mono font-medium",children:V})]},te))}),(0,g.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,g.jsxs)(u,{onClick:wr,variant:"outline",size:"sm",children:[k?(0,g.jsx)(H.Check,{size:14}):(0,g.jsx)(H.Copy,{size:14}),k?"Copied":S?"Copy failed":"Copy"]}),o&&(0,g.jsxs)(u,{onClick:Sr,variant:"outline",size:"sm",children:[(0,g.jsx)(H.Download,{size:14}),"Export Private Key"]})]}),S&&(0,g.jsx)("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:"This browser would not let the page write to your clipboard. Nothing was copied \u2014 select the words above and copy them yourself, or write them down."}),J&&ee&&(0,g.jsxs)("div",{className:"rounded-lg border border-border bg-muted p-3 space-y-2",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(H.EyeOff,{size:14,className:"text-muted-foreground"}),(0,g.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Private Key (keep secret!)"})]}),(0,g.jsx)("p",{className:"font-mono text-xs break-all select-all",children:ee})]}),(0,g.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[(0,g.jsxs)(u,{onClick:Nr,variant:"default",children:["I've Saved It",(0,g.jsx)(H.ArrowRight,{size:16})]}),n&&(0,g.jsxs)(u,{onClick:An,variant:"ghost",size:"sm",children:[(0,g.jsx)(H.SkipForward,{size:14}),"Skip Backup"]})]})]}):(0,g.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,g.jsx)(H.Shield,{size:40,className:"text-muted-foreground"}),(0,g.jsx)("p",{className:"text-sm text-muted-foreground text-center",children:"Click the button below to reveal your seed phrase. Make sure no one is watching your screen."}),(0,g.jsxs)(u,{onClick:Cr,variant:"default",children:[(0,g.jsx)(H.Eye,{size:16}),"Reveal Seed Phrase"]})]})]}),Br=(0,g.jsxs)("div",{className:"space-y-4",children:[(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:"Verify your backup by selecting the correct word for each position."}),L.map(V=>{let te=nt.includes(V.index);return(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsxs)("p",{className:N("text-sm font-medium",te?"text-destructive":"text-foreground"),children:["Word #",V.index+1,te&&(0,g.jsx)("span",{className:"ml-2 text-xs text-destructive",children:"(incorrect)"})]}),(0,g.jsx)("div",{className:"grid grid-cols-2 gap-2",children:V.options.map(ae=>{let Ut=Z[V.index]===ae;return(0,g.jsx)("button",{type:"button",onClick:()=>kr(V.index,ae),className:N("rounded-md border px-3 py-2 text-sm font-mono transition-all duration-200 cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",Ut?"border-primary bg-primary/10 text-primary font-medium":te?"border-destructive/50 bg-destructive/5":"border-border bg-card hover:border-primary/50"),children:ae},`${V.index}-${ae}`)})})]},V.index)}),(0,g.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[(0,g.jsxs)(u,{onClick:Rr,variant:"default",disabled:!Tr,children:[(0,g.jsx)(H.Check,{size:16}),"Verify & Confirm"]}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsxs)(u,{onClick:()=>v("reveal"),variant:"ghost",size:"sm",children:[(0,g.jsx)(H.ArrowLeft,{size:14}),"Back"]}),n&&(0,g.jsxs)(u,{onClick:An,variant:"ghost",size:"sm",children:[(0,g.jsx)(H.SkipForward,{size:14}),"Skip"]})]})]})]}),Er={reveal:Pr,confirm:Br,done:(0,g.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[(0,g.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:(0,g.jsx)(H.Check,{size:24,className:"text-green-600 dark:text-green-400"})}),(0,g.jsx)("p",{className:"font-medium text-foreground",children:"Backup Confirmed"}),(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your seed phrase has been backed up successfully."})]})},Ar={reveal:"Backup Seed Phrase",confirm:"Verify Backup",done:"Backup Complete"},pt=Er[f],ft=Ar[f];return a?(0,g.jsxs)("div",{className:N("space-y-4",r),children:[f!=="done"&&(0,g.jsx)("h3",{className:"text-lg font-semibold",children:ft}),pt]}):i?d&&p?(0,g.jsx)(d,{open:!0,onOpenChange:V=>{V||l?.(!1)},children:(0,g.jsx)(p,{children:x&&w?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(x,{children:(0,g.jsx)(w,{children:ft})}),(0,g.jsx)("div",{className:"mt-2 max-h-[55vh] overflow-y-auto",children:pt})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"mb-3 text-lg font-semibold",children:ft}),(0,g.jsx)("div",{className:"max-h-[55vh] overflow-y-auto",children:pt})]})})}):(0,g.jsxs)(Oe,{open:!0,onClose:()=>l?.(!1),children:[(0,g.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,g.jsx)("h2",{className:"text-lg font-semibold m-0",children:ft}),l&&(0,g.jsx)("button",{onClick:()=>l(!1),type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200 cursor-pointer border-none bg-transparent","aria-label":"Close",children:(0,g.jsx)(H.X,{size:16})})]}),pt]}):null}var jo=Ot(require("react"),1);var A=require("react/jsx-runtime");function _s({error:t,reset:e,dismiss:n,retryLabel:o="Try Again"}){let r=B(),s=r.Button,a=r.Dialog,i=r.DialogContent,l=r.DialogHeader,c=r.DialogTitle;if(a&&i)return(0,A.jsx)(a,{open:!0,onOpenChange:()=>{},children:(0,A.jsx)(i,{children:l&&c?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(l,{children:(0,A.jsx)(c,{children:"Something went wrong"})}),(0,A.jsxs)("div",{style:{marginTop:"0.5rem"},children:[(0,A.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,A.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,A.jsx)(s,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,A.jsx)(s,{variant:"default",size:"default",onClick:e,children:o})]})]})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Something went wrong"}),(0,A.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,A.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,A.jsx)(s,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,A.jsx)(s,{variant:"default",size:"default",onClick:e,children:o})]})]})})});let u=!0,d=n??void 0;return(0,A.jsxs)(Oe,{open:u,onClose:d,children:[(0,A.jsx)(_n,{title:"Something went wrong",onClose:d,showCloseButton:!!n}),(0,A.jsxs)(Fn,{children:[(0,A.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,A.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,A.jsx)(s,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,A.jsx)(s,{variant:"default",size:"default",onClick:e,children:o})]})]})]})}var Ge=class extends jo.default.Component{constructor(e){super(e),this.state={hasError:!1,error:null,dismissed:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e,dismissed:!1}}componentDidCatch(e,n){this.props.onError?.(e,n)}handleReset=()=>{this.setState({hasError:!1,error:null,dismissed:!1}),this.props.onReset?.()};handleDismiss=()=>{this.setState(e=>({...e,dismissed:!0})),this.props.onDismiss?.()};render(){return this.state.dismissed?this.props.children:this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback({error:this.state.error,reset:this.handleReset}):(0,A.jsx)(_s,{error:this.state.error,reset:this.handleReset,dismiss:this.props.onDismiss?this.handleDismiss:void 0,retryLabel:this.props.retryLabel}):this.props.children}};var Xe=require("react"),Go=require("@naculus/connect-appkit-react");var $=require("react");var Ye={primary:{name:"--primary",fallback:"221.2 83.2% 53.3%"},"primary-foreground":{name:"--primary-foreground",fallback:"210 40% 98%"},background:{name:"--background",fallback:"0 0% 100%"},foreground:{name:"--foreground",fallback:"222.2 84% 4.9%"},card:{name:"--card",fallback:"0 0% 100%"},"card-foreground":{name:"--card-foreground",fallback:"222.2 84% 4.9%"},popover:{name:"--popover",fallback:"0 0% 100%"},"popover-foreground":{name:"--popover-foreground",fallback:"222.2 84% 4.9%"},secondary:{name:"--secondary",fallback:"210 40% 96.1%"},"secondary-foreground":{name:"--secondary-foreground",fallback:"222.2 47.4% 11.2%"},muted:{name:"--muted",fallback:"210 40% 96.1%"},"muted-foreground":{name:"--muted-foreground",fallback:"215.4 16.3% 46.9%"},accent:{name:"--accent",fallback:"210 40% 96.1%"},"accent-foreground":{name:"--accent-foreground",fallback:"222.2 47.4% 11.2%"},destructive:{name:"--destructive",fallback:"0 84.2% 60.2%"},border:{name:"--border",fallback:"214.3 31.8% 91.4%"},input:{name:"--input",fallback:"214.3 31.8% 91.4%"},ring:{name:"--ring",fallback:"221.2 83.2% 53.3%"},radius:{name:"--radius",fallback:"0.5rem"}},Fs=new Map;function bn(){Fs.clear()}var Lt=require("react/jsx-runtime"),Qo=(0,$.createContext)({theme:{},isDark:!1,setTheme:()=>{},toggleDarkMode:()=>{}});function Ks(t){let e=[];for(let[n,o]of Object.entries(t)){let r=Ye[n];r&&o&&e.push(" "+r.name+": "+o+";")}return e.length===0?"":`:root {
|
|
7
|
+
`);let a=As(e,n,r),i=Et.getSymbolSize(e),l=new vs(i);return Ss(l,e),Ts(l),Ps(l,e),an(l,n,0),e>=7&&Bs(l,e),Es(l,a),isNaN(o)&&(o=ln.getBestMask(l,an.bind(null,l,n))),ln.applyMask(o,l),an(l,n,o),{modules:l,version:e,errorCorrectionLevel:n,maskPattern:o,segments:r}}zo.create=function(e,n){if(typeof e>"u"||e==="")throw new Error("No input text");let o=rn.M,r,s;return typeof n<"u"&&(o=rn.from(n.errorCorrectionLevel,rn.M),r=Bt.from(n.version),s=ln.from(n.maskPattern),n.toSJISFunc&&Et.setToSJISFunction(n.toSJISFunc)),Ms(e,r,o,s)}});var dn=M(Ie=>{"use strict";function Vo(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(o){return[o,o]}))),e.length===6&&e.push("F","F");let n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+e.slice(0,6).join("")}}Ie.getOptions=function(e){e||(e={}),e.color||(e.color={});let n=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,o=e.width&&e.width>=21?e.width:void 0,r=e.scale||4;return{width:o,scale:o?4:r,margin:n,color:{dark:Vo(e.color.dark||"#000000ff"),light:Vo(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Ie.getScale=function(e,n){return n.width&&n.width>=e+n.margin*2?n.width/(e+n.margin*2):n.scale};Ie.getImageWidth=function(e,n){let o=Ie.getScale(e,n);return Math.floor((e+n.margin*2)*o)};Ie.qrToImageData=function(e,n,o){let r=n.modules.size,s=n.modules.data,a=Ie.getScale(r,o),i=Math.floor((r+o.margin*2)*a),l=o.margin*a,c=[o.color.light,o.color.dark];for(let u=0;u<i;u++)for(let d=0;d<i;d++){let m=(u*i+d)*4,y=o.color.light;if(u>=l&&d>=l&&u<i-l&&d<i-l){let w=Math.floor((u-l)/a),f=Math.floor((d-l)/a);y=c[s[w*r+f]?1:0]}e[m++]=y.r,e[m++]=y.g,e[m++]=y.b,e[m]=y.a}}});var Ho=M(At=>{"use strict";var un=dn();function Is(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+"px",e.style.width=n+"px"}function Ls(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}At.render=function(e,n,o){let r=o,s=n;typeof r>"u"&&(!n||!n.getContext)&&(r=n,n=void 0),n||(s=Ls()),r=un.getOptions(r);let a=un.getImageWidth(e.modules.size,r),i=s.getContext("2d"),l=i.createImageData(a,a);return un.qrToImageData(l.data,e,r),Is(i,s,a),i.putImageData(l,0,0),s};At.renderToDataURL=function(e,n,o){let r=o;typeof r>"u"&&(!n||!n.getContext)&&(r=n,n=void 0),r||(r={});let s=At.render(e,n,r),a=r.type||"image/png",i=r.rendererOpts||{};return s.toDataURL(a,i.quality)}});var _o=M(Oo=>{"use strict";var zs=dn();function Uo(t,e){let n=t.a/255,o=e+'="'+t.hex+'"';return n<1?o+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':o}function mn(t,e,n){let o=t+e;return typeof n<"u"&&(o+=" "+n),o}function Ws(t,e,n){let o="",r=0,s=!1,a=0;for(let i=0;i<t.length;i++){let l=Math.floor(i%e),c=Math.floor(i/e);!l&&!s&&(s=!0),t[i]?(a++,i>0&&l>0&&t[i-1]||(o+=s?mn("M",l+n,.5+c+n):mn("m",r,0),r=0,s=!1),l+1<e&&t[i+1]||(o+=mn("h",a),a=0)):r++}return o}Oo.render=function(e,n,o){let r=zs.getOptions(n),s=e.modules.size,a=e.modules.data,i=s+r.margin*2,l=r.color.light.a?"<path "+Uo(r.color.light,"fill")+' d="M0 0h'+i+"v"+i+'H0z"/>':"",c="<path "+Uo(r.color.dark,"stroke")+' d="'+Ws(a,s,r.margin)+'"/>',u='viewBox="0 0 '+i+" "+i+'"',m='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+u+' shape-rendering="crispEdges">'+l+c+`</svg>
|
|
8
|
+
`;return typeof o=="function"&&o(null,m),m}});var Ko=M(dt=>{"use strict";var Vs=qn(),pn=Wo(),Fo=Ho(),Hs=_o();function fn(t,e,n,o,r){let s=[].slice.call(arguments,1),a=s.length,i=typeof s[a-1]=="function";if(!i&&!Vs())throw new Error("Callback required as last argument");if(i){if(a<2)throw new Error("Too few arguments provided");a===2?(r=n,n=e,e=o=void 0):a===3&&(e.getContext&&typeof r>"u"?(r=o,o=void 0):(r=o,o=n,n=e,e=void 0))}else{if(a<1)throw new Error("Too few arguments provided");return a===1?(n=e,e=o=void 0):a===2&&!e.getContext&&(o=n,n=e,e=void 0),new Promise(function(l,c){try{let u=pn.create(n,o);l(t(u,e,o))}catch(u){c(u)}})}try{let l=pn.create(n,o);r(null,t(l,e,o))}catch(l){r(l)}}dt.create=pn.create;dt.toCanvas=fn.bind(null,Fo.render);dt.toDataURL=fn.bind(null,Fo.renderToDataURL);dt.toString=fn.bind(null,function(t,e,n){return Hs.render(t,n)})});var ba={};Wr(ba,{AccountButton:()=>vt,AccountSelector:()=>or,AccountSelectorView:()=>Cn,AddressWarningDialog:()=>yr,AppKit:()=>Tn,AppKitButton:()=>Pn,AppKitChainSelector:()=>Bn,ChainSelector:()=>Le,ConnectButton:()=>we,ErrorBoundary:()=>Ge,PasskeySetup:()=>cr,PasskeySetupView:()=>Rn,PassphraseDialog:()=>lr,PassphraseDialogView:()=>kn,QRCodeModal:()=>Qe,RouteSelector:()=>pr,SeedPhraseBackup:()=>$e,SignInButton:()=>Mt,SmartWalletSettings:()=>hr,SmartWalletToggle:()=>gr,ThemeProvider:()=>It,WalletConnectProvider:()=>ht,WalletPicker:()=>xr,WalletSecurityPanel:()=>ar,WalletSecurityPanelView:()=>wn,Web3ComponentProvider:()=>zt,Web3ConnectUI:()=>Ze,cn:()=>N,useAppKit:()=>Sn,useComponent:()=>Zo,useComponentRegistry:()=>B,useDetectionMode:()=>Jo,useEIP6963:()=>He,useIsMobile:()=>Ue,useTheme:()=>yn,useThemeVariable:()=>$o,useWalletConnect:()=>In,useWalletConnectOptional:()=>bt});module.exports=Vr(ba);var ue=require("react"),zn=require("@naculus/connect-appkit-react");var K=require("react"),Mn=require("@naculus/connect-appkit-react"),Ln=require("react/jsx-runtime"),_t=(0,K.createContext)(null);function ht({children:t}){let e=(0,Mn.useWeb3)(),[n,o]=(0,K.useState)(null),[r,s]=(0,K.useState)(!1),[a,i]=(0,K.useState)("idle"),[l,c]=(0,K.useState)(null),u=(0,K.useRef)(0),d=(0,K.useRef)(null);(0,K.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let m=(0,K.useCallback)(()=>{u.current+=1,e.cancelPairing?.(),d.current&&(clearTimeout(d.current),d.current=null),o(null),s(!1),i("cancelled"),c(null)},[e]),y=(0,K.useRef)(void 0);y.current=async()=>{if(!e.startPairing||!e.completePairing){c("WalletConnect pairing not available"),i("error");return}let p=++u.current,k=()=>u.current===p;i("loading"),c(null),s(!0);try{let P=await e.startPairing();if(!k())return;o(P),i("ready");try{if(await e.completePairing(),!k())return;d.current=setTimeout(()=>{d.current=null,k()&&(s(!1),o(null),i("idle"))},1e3)}catch(S){if(!k())return;i("error"),c(S instanceof Error?S.message:"Connection failed")}}catch(P){if(!k())return;i("error"),c(P instanceof Error?P.message:"Failed to generate QR code")}};let w=(0,K.useCallback)(async()=>{await y.current?.()},[]),f=(0,K.useCallback)(()=>{o(null),c(null),i("loading"),y.current?.()},[]),v=(0,K.useMemo)(()=>({qrUri:n,showQR:r,qrStatus:a,error:l}),[n,r,a,l]),R=(0,K.useMemo)(()=>({state:v,connectWalletConnect:w,cancelQR:m,retryQR:f}),[v,w,m,f]);return(0,Ln.jsx)(_t.Provider,{value:R,children:t})}function In(){let t=(0,K.useContext)(_t);if(!t)throw new Error("useWalletConnect must be used within a WalletConnectProvider");return t}function bt(){return(0,K.useContext)(_t)}var Ee=require("react");function He(){let[t,e]=(0,Ee.useState)([]),[n,o]=(0,Ee.useState)(!0),r=(0,Ee.useRef)(new Set);return(0,Ee.useEffect)(()=>{r.current.clear(),o(!0);let s=c=>{let u=c.detail,d=u?.info,m=u?.provider;!d?.rdns||r.current.has(d.rdns)||(r.current.add(d.rdns),e(y=>y.find(w=>w.id===d.rdns)?y:[...y,{id:d.rdns,name:d.name||d.rdns,icon:d.icon||"",rdns:d.rdns,provider:m}]))};window.addEventListener("eip6963:announceProvider",s);let a=window,i=(c,u,d)=>{r.current.has(c)||(r.current.add(c),e(m=>m.some(y=>y.id===c)?m:[...m,{id:c,name:u,icon:"",rdns:c,provider:d}]))};a.ethereum?.isMetaMask&&i("io.metamask","MetaMask",a.ethereum),a.phantom?i("app.phantom","Phantom",a.phantom):a.solana?.isPhantom&&i("app.phantom","Phantom",a.solana),window.dispatchEvent(new Event("eip6963:requestProvider"));let l=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",s),clearTimeout(l)}},[]),{wallets:t,isDetecting:n,hasWallets:t.length>0}}var yt=require("react");function Ue(){let[t,e]=(0,yt.useState)(!1);return(0,yt.useEffect)(()=>{if(typeof navigator>"u"||typeof window>"u")return;let n=navigator.userAgent.toLowerCase();e(/(iphone|ipad|ipod|android|mobile)/i.test(n))},[]),t}var Ft=require("react/jsx-runtime");function we({className:t,isConnected:e,isConnecting:n,onConnect:o,onDisconnect:r,onMobileDeepLink:s,mobileWalletName:a,startPairing:i,completePairing:l,address:c,balance:u,balanceSymbol:d,tokenBalances:m,isBalanceLoading:y,explorerUrl:w,explorerLabel:f}){let v=bt(),{wallets:R}=He(),p=Ue(),k=JSON.stringify(R.map(({id:J,name:ge,icon:ee,rdns:Ve})=>({id:J,name:ge,icon:ee,rdns:Ve}))),[P,S]=(0,ue.useState)(null),[Y,L]=(0,ue.useState)(!1),[be,Z]=(0,ue.useState)(null),se=(0,ue.useRef)({aborted:!1}),nt=(0,ue.useCallback)(()=>{se.current.aborted=!0,v?.cancelQR(),L(!1),S(null),Z(null)},[v]);(0,ue.useEffect)(()=>{if(!v)return;let{qrStatus:J,qrUri:ge,error:ee}=v.state;J==="loading"?(L(!0),S(null),Z(null)):J==="ready"&&ge?(L(!1),S(ge),Z(null)):J==="error"?(L(!1),Z(ee)):(J==="idle"||J==="cancelled")&&(L(!1),S(null),Z(null))},[v?.state?.qrStatus,v?.state?.qrUri,v?.state?.error]);let ye=(0,ue.useCallback)((J,ge)=>{if(J==="walletconnect"){if(v){v.connectWalletConnect();return}if(i&&l){L(!0),Z(null),se.current.aborted=!1,i().then(ee=>{se.current.aborted||(S(ee),L(!1),l().then(()=>{se.current.aborted||S(null)}).catch(Ve=>{se.current.aborted||Z(Ve instanceof Error?Ve.message:"Connection failed")}))}).catch(ee=>{se.current.aborted||(L(!1),Z(ee instanceof Error?ee.message:"Connection failed"))});return}}o?.(J,()=>{},ge)},[v,i,l,o]);return(0,Ft.jsx)("div",{className:t,children:(0,Ft.jsx)(zn.AppkitConnectButton,{connected:e??!1,connecting:n??!1,address:c??"",balance:u??null,balanceSymbol:d??"",isBalanceLoading:y??!1,tokenBalancesJson:JSON.stringify(m??[]),explorerUrl:w??"",explorerLabel:f??"",walletsJson:k,isMobile:p,mobileWalletName:a??"",qrUri:P,qrLoading:Y,qrError:be,onAppkitConnect:J=>{ye(J.detail.kind,J.detail.walletId)},onAppkitDisconnect:()=>r?.(),onAppkitStartPairing:()=>ye("walletconnect"),onAppkitRetry:()=>{se.current.aborted=!0,Z(null),S(null),ye("walletconnect")},onAppkitCancelPairing:nt,onAppkitMobileDeepLink:()=>s?.(),onAppkitCopyAddress:J=>{navigator.clipboard?.writeText(J.detail).catch(()=>{})}})})}var tr=require("@naculus/connect-core"),tt=require("react"),Wt=require("@naculus/connect-appkit-react");var Wn=require("clsx"),Vn=require("tailwind-merge");function N(...t){return(0,Vn.twMerge)((0,Wn.clsx)(t))}var Hn='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 0l-.26.97v28.15l.26.26 13.07-7.72L12 0z" fill="#8C8C8C"/><path d="M12 0L-.87 21.69l12.87 7.72V0z" fill="#3C3C3B"/><path d="M12 31.88l-.16.2v10.55l.16.47 13.08-18.42L12 31.88z" fill="#8C8C8C"/><path d="M12 42.9V31.88L-.87 24.68 12 42.9z" fill="#3C3C3B"/><path d="M12 28.41l13.07-7.72L12 14.09v14.32z" fill="#141414"/><path d="M-.87 20.69L12 28.41V14.09l-12.87 6.6z" fill="#393939"/></svg>',Hr='<svg viewBox="0 0 24 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 12.3l-3.7 2.2-3.8-2.2V7.9L11.3 5.7 15 7.9v2.7l-2.2 1.3-1.5-.9v-2l1.5.9 2.2-1.3V7.9L11.3 4 6 7.9v6.3l5.3 3.1 5.3-3.1-1.6-2.8z" fill="#6C00F6"/></svg>',Ur='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#F0B90B"/><path d="M12 4l2.7 1.6L14.7 7 12 5.4 9.3 7l-.7-.4L12 4zm4.7 2.7l-2.7 1.6V10l4 2.3v4.7L16 18.7v-4l-1.3-.7v4L12 20l-2.7-1.6v-4L8 14.7v4l-1.3-.7V12.3l4-2.3V8.3l-2.7-1.6.7-.4L12 8l2.7-1.7.7.4z" fill="white"/></svg>',Or='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.5c.3 0 .6.1.8.2l8.8 5.1c.5.3.9.9.9 1.5v10.2c0 .6-.3 1.2-.9 1.5l-8.8 5.1c-.3.2-.6.2-.8.2s-.6-.1-.8-.2l-8.8-5.1c-.5-.3-.9-.9-.9-1.5V8.3c0-.6.3-1.2.9-1.5l8.8-5.1c.3-.2.6-.2.8-.2z" fill="#213147"/><path d="M14.7 13.8l-1.2 3.2c0 .1 0 .2.1.3l2 5.5 2.3-1.3-2.8-7.6c-.1-.2-.3-.2-.4-.1z" fill="#12AAFF"/><path d="M16.3 8.5c0-.2-.3-.2-.4 0l-1.1 3.2c0 .1 0 .2.1.3l3.3 9 2.3-1.3-4.2-9.1v-.1z" fill="#12AAFF"/><path d="M12 3.5c.1 0 .2 0 .3.1l8.8 5.1c.1.1.2.2.2.3v10.2c0 .1-.1.2-.2.3l-8.8 5.1c-.1 0-.2.1-.3.1s-.2 0-.3-.1l-8.8-5.1c-.1-.1-.2-.2-.2-.3V9c0-.1.1-.2.2-.3l8.8-5.1c.1 0 .2-.1.3-.1z" fill="#9DCCED" fill-opacity="0.3"/><path d="M13.3 6.2h-2.2c-.2 0-.3.1-.4.3L5.9 19.6l2.3 1.3L13 6.5c0-.1-.1-.3-.2-.3h.4z" fill="white"/><path d="M15.2 6.2H13c-.2 0-.3.1-.4.3L8.1 21.4l2.3 1.3 6-16.4c0-.1-.1-.3-.2-.3v.2z" fill="white"/></svg>',_r='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#FF0420"/><path d="M8.5 16c-.5 0-.9-.1-1.3-.3-.4-.2-.7-.5-1-.8-.3-.4-.4-.8-.4-1.3V10c0-.5.1-1 .4-1.4.3-.4.6-.7 1-.9.4-.2.8-.3 1.3-.3.4 0 .8.1 1.2.2.3.2.6.4.8.7l-1 1c-.2-.2-.4-.3-.6-.4-.2-.1-.5-.2-.8-.2-.3 0-.6.1-.9.2-.3.2-.5.4-.6.7-.1.3-.2.6-.2 1v3.5c0 .3.1.6.2.9.1.3.3.5.6.6.3.2.6.2.9.2.3 0 .6-.1.8-.2.2-.1.4-.3.6-.5l1 1c-.2.3-.5.5-.8.7-.4.2-.9.3-1.4.3z" fill="white"/><path d="M15.5 16c-.5 0-.9-.1-1.3-.3-.4-.2-.7-.5-1-.8-.2-.4-.4-.8-.4-1.3V10c0-.5.1-1 .4-1.4.2-.4.5-.7.9-.9.4-.2.8-.3 1.3-.3.5 0 1 .1 1.4.3.4.2.7.5.9.9.2.4.3.9.3 1.4v.7h-2.9v-1.1c0-.3-.1-.6-.2-.9-.1-.3-.3-.5-.5-.6-.2-.1-.5-.2-.8-.2-.3 0-.6.1-.8.2-.3.2-.5.4-.6.7-.1.3-.2.6-.2 1v3.5c0 .3.1.6.2.8.1.3.3.5.6.6.2.2.5.2.8.2.3 0 .6-.1.8-.2.2-.1.4-.3.5-.6.1-.3.2-.6.2-1v-1.1h2.9v.7c0 .5-.1 1-.3 1.4-.2.4-.5.7-.9.9-.4.2-.9.3-1.4.3z" fill="white"/></svg>',Fr='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#E84142"/><path d="M8.6 16.8H6.3c-.5 0-.8-.1-1-.3-.2-.2-.3-.5-.3-.8 0-.2 0-.4.1-.6l5.8-10.7c.2-.4.5-.7.8-.8.3-.1.5-.1.7 0 .2.1.5.3.7.8l1.2 2.1.1.2c.3.5.5.9.5 1.3.1.4.1.8 0 1.1-.1.4-.3.8-.6 1.3l-3 5.4c-.2.5-.5.8-.8 1-.4.2-.7.2-1.2.2z" fill="white"/><path d="M14.5 16.8h3.3c.5 0 .7-.1 1-.3.2-.2.3-.5.3-.8 0-.2-.1-.4-.3-.7l-1.7-3-.2-.3c-.2-.4-.4-.7-.6-.8-.2-.1-.4-.1-.6 0-.2.1-.4.3-.6.8l-1.6 3c-.2.4-.4.7-.4.9 0 .2.1.5.3.7.1.1.4.3.9.3z" fill="white"/></svg>',Kr='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#1969FF"/><path d="M11.3 3.8c.4-.2 1-.2 1.4 0l4.1 2.2c.2.1.4.3.4.5h0v10.9c0 .2-.1.4-.4.6l-4.1 2.2c-.4.2-1 .2-1.4 0l-4.1-2.2c-.3-.1-.4-.4-.4-.6V6.5c0-.2.1-.4.4-.5l4.1-2.2zm5.3 8.7l-3.9 2c-.4.2-1 .2-1.4 0l-3.9-2v4.8l3.9 2c.2.1.5.2.7.2.2 0 .5-.1.7-.2l3.9-2v-4.8z" fill="white"/></svg>',qr={"eip155:1":Hn,"eip155:137":Hr,"eip155:56":Ur,"eip155:42161":Or,"eip155:10":_r,"eip155:43114":Fr,"eip155:250":Kr,"eip155:11155111":Hn};function xt(t){return qr[t]}var et=require("react");var Un=require("lucide-react");var me=require("react/jsx-runtime");function jr({children:t}){return(0,me.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground",children:t})}function vt({className:t,showAddress:e=!0,showBalance:n=!1,address:o,balance:r,balanceSymbol:s,onConnect:a}){let l=B().Button;if(!o)return(0,me.jsxs)(l,{"aria-label":"Connect Wallet",onClick:a,className:t,children:[(0,me.jsx)(Un.Wallet,{size:18,className:"shrink-0"}),"Connect Wallet"]});let c=o.includes(":")?o.split(":").pop():o,u=c.slice(0,6)+"..."+c.slice(-4),d=r!=null?parseFloat(r).toLocaleString(void 0,{maximumFractionDigits:4})+(s?` ${s}`:""):null;return(0,me.jsxs)(l,{className:t,children:[(0,me.jsx)(jr,{children:"W"}),(0,me.jsxs)("div",{className:"flex flex-col items-start gap-0",children:[e&&(0,me.jsx)("span",{className:"font-mono text-xs",children:u}),n&&d&&(0,me.jsx)("span",{className:"text-xs text-muted-foreground",children:d}),n&&!d&&r===null&&(0,me.jsx)("span",{className:"text-xs text-muted-foreground",children:"Loading..."})]})]})}var pe=require("react"),ce=require("lucide-react");var Kt=require("react");var On=require("lucide-react"),ie=require("react/jsx-runtime");function Oe({open:t,onClose:e,children:n,closable:o,className:r}){return(0,Kt.useEffect)(()=>{if(!t)return;let s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s}},[t]),(0,Kt.useEffect)(()=>{if(!t||!e)return;let s=a=>{a.key==="Escape"&&e()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t,e]),t?(0,ie.jsxs)("div",{className:N("fixed inset-0 z-50 flex items-center justify-center p-4",r),style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"},children:[(0,ie.jsx)("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:e,style:{position:"absolute",inset:0,background:"rgb(0 0 0 / 0.8)"}}),(0,ie.jsxs)("div",{role:"dialog","aria-modal":"true",className:"relative z-10 w-full max-w-sm rounded-xl border bg-card text-card-foreground shadow-2xl max-h-[85vh] overflow-y-auto p-6",style:{position:"relative",zIndex:10,width:"100%",maxWidth:"24rem",maxHeight:"85vh",overflowY:"auto",borderRadius:"0.75rem",padding:"1.5rem",background:"hsl(var(--card, 0 0% 100%))",color:"hsl(var(--card-foreground, 222.2 84% 4.9%))",boxShadow:"0 25px 50px -12px rgb(0 0 0 / 0.4)"},children:[o&&e&&(0,ie.jsx)("button",{onClick:e,type:"button","aria-label":"Close modal",className:"absolute right-4 top-4 z-20 rounded-md p-1 text-muted-foreground hover:text-foreground",style:{position:"absolute",right:"1rem",top:"1rem",zIndex:20,border:0,background:"transparent",cursor:"pointer",color:"inherit"},children:(0,ie.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,ie.jsx)("path",{d:"M18 6 6 18M6 6l12 12","data-testid":"x-icon"})})}),n]})]}):null}function _n({title:t,onClose:e,showCloseButton:n=!0}){return(0,ie.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,ie.jsx)("h2",{className:"text-lg font-semibold m-0",children:t}),n&&e&&(0,ie.jsx)("button",{onClick:e,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200","aria-label":"Close",children:(0,ie.jsx)(On.X,{size:16})})]})}function Fn({children:t,className:e=""}){return(0,ie.jsx)("div",{className:N("flex flex-col gap-4",e),children:t})}var T=require("react/jsx-runtime");async function Us(t,e){let n=await Promise.resolve().then(()=>Ot(Ko(),1)),r=(n.default??n).toCanvas??n.toCanvas;if(typeof r!="function")throw new Error("qrcode.toCanvas is unavailable");return new Promise((s,a)=>{r(t,e,{width:280,margin:2},i=>{i?a(i):s()})})}function Qe({uri:t,open:e,onClose:n,onDeepLink:o,onRetry:r,status:s="pending",showDeepLink:a,timeoutMs:i=300*1e3,title:l="Scan with WalletConnect",description:c="Open your wallet app and scan this QR code to connect.",className:u}){let d=(0,pe.useRef)(null),[m,y]=(0,pe.useState)(null),[w,f]=(0,pe.useState)(0),v=Ue(),R=B(),p=R.Button,k=a??v,P=(0,pe.useRef)(null);(0,pe.useEffect)(()=>{!e||!t||!d.current||(y(null),Us(d.current,t).catch(ee=>{y(ee instanceof Error?ee.message:"Unable to render QR code")}))},[e,t]),(0,pe.useEffect)(()=>{if(!e||s!=="pending"){P.current&&(clearInterval(P.current),P.current=null),f(0);return}let ee=Date.now();return P.current=setInterval(()=>f(Date.now()-ee),1e3),()=>{P.current&&clearInterval(P.current)}},[e,s,i]);let S=w>=i&&s==="pending",Y=S||s==="expired"||s==="error",L=Math.max(0,Math.ceil((i-w)/1e3)),be=Math.floor(L/60),Z=L%60,se=Math.min(w/i,1),nt=(0,pe.useCallback)(()=>{t&&o&&o(t)},[t,o]),ye=t&&!S&&s==="pending"?m?(0,T.jsxs)("div",{className:"w-[280px] h-[280px] flex flex-col items-center justify-center bg-muted rounded-lg gap-2",children:[(0,T.jsx)(ce.AlertCircle,{size:24,className:"text-muted-foreground"}),(0,T.jsx)("span",{className:"text-sm text-muted-foreground",children:"Failed to render QR code"})]}):(0,T.jsx)("canvas",{ref:d,width:280,height:280,role:"img","aria-label":"WalletConnect pairing QR code",className:"rounded-lg border border-border"}):(0,T.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 bg-muted rounded-lg w-[280px] h-[280px]",children:[s==="scanned"?(0,T.jsx)(ce.CheckCircle2,{size:48,className:"text-[hsl(var(--primary))]"}):(0,T.jsx)(ce.AlertCircle,{size:48,className:"text-destructive"}),(0,T.jsx)("span",{className:"text-sm text-muted-foreground","data-testid":"status-label",children:s==="scanned"?"QR code scanned! Connecting...":S||s==="expired"?"Connection timed out.":"Something went wrong. Try again."})]}),ge=R.Modal??Oe;return(0,T.jsx)(ge,{open:e,onClose:n,closable:!0,title:l,className:u,children:(0,T.jsxs)("div",{className:"p-6",children:[(0,T.jsxs)("div",{className:"text-center mb-5",children:[(0,T.jsx)("div",{className:"flex justify-center mb-3",children:s==="pending"&&!S&&(0,T.jsx)(ce.Loader2,{size:20,className:"animate-spin text-primary","data-testid":"loader-icon-inline"})}),(0,T.jsx)("h3",{className:"text-lg font-semibold m-0 text-foreground",children:l}),c&&(0,T.jsx)("p",{className:"text-sm text-muted-foreground mt-1.5 mb-0",children:c})]}),(0,T.jsx)("div",{className:"flex justify-center mb-4",children:ye}),s==="pending"&&!S&&(0,T.jsxs)("div",{className:"mb-3",children:[(0,T.jsx)("div",{className:"h-1 bg-muted rounded-full overflow-hidden",role:"progressbar","aria-valuenow":Math.round((1-se)*100),"aria-valuemin":0,"aria-valuemax":100,children:(0,T.jsx)("div",{className:"h-full bg-primary rounded-full transition-all duration-1000",style:{width:`${(1-se)*100}%`}})}),(0,T.jsxs)("p",{"data-testid":"countdown",className:"text-xs text-muted-foreground text-center mt-1.5 mb-0",children:["Expires in ",be,":",Z.toString().padStart(2,"0")]})]}),(0,T.jsxs)("div",{className:"flex flex-col gap-2",children:[k&&t&&s==="pending"&&!S&&(0,T.jsxs)("button",{onClick:nt,className:"inline-flex items-center justify-center gap-2 w-full rounded-lg border border-input bg-card px-4 py-2.5 text-sm font-medium text-foreground hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[(0,T.jsx)(ce.Smartphone,{size:16})," Open in Wallet App"]}),Y&&r&&(p?(0,T.jsxs)(p,{onClick:r,variant:"default",size:"default",className:"w-full",children:[(0,T.jsx)(ce.RefreshCw,{size:16})," Generate New QR Code"]}):(0,T.jsxs)("button",{onClick:r,className:"inline-flex items-center justify-center gap-2 w-full rounded-lg bg-primary text-primary-foreground px-4 py-2.5 text-sm font-medium hover:bg-primary/90 transition-all duration-200 cursor-pointer border-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[(0,T.jsx)(ce.RefreshCw,{size:16})," Generate New QR Code"]})),p?(0,T.jsx)(p,{onClick:n,variant:"outline",size:"default",className:"w-full",children:"Cancel"}):(0,T.jsx)("button",{onClick:n,className:"inline-flex items-center justify-center w-full rounded-lg border border-input bg-transparent px-4 py-2.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Cancel"})]})]})})}var Dt=require("react"),ne=require("lucide-react");var C=require("react/jsx-runtime");function Mt({className:t,isSignedIn:e=!1,isSigningIn:n=!1,result:o=null,error:r=null,onSignIn:s,onClearError:a,children:i}){let[l,c]=(0,Dt.useState)(!1),[u,d]=(0,Dt.useState)(!1),[m,y]=(0,Dt.useState)(!1),w=B(),f=w.Button,v=w.Dialog,R=w.DialogContent,p=w.DialogHeader,k=w.DialogTitle,P=async()=>{if(o?.signature)try{await navigator.clipboard.writeText(o.signature),y(!1),d(!0),setTimeout(()=>d(!1),2e3)}catch{d(!1),y(!0)}};return!e&&!n&&!r?(0,C.jsx)(f,{onClick:s,className:t,"aria-label":"Sign In",children:(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,C.jsx)(ne.LogIn,{size:16}),i??"Sign In"]})}):n?(0,C.jsx)(f,{disabled:!0,className:t,"aria-label":"Signing In",children:(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,C.jsx)(ne.Loader2,{size:16,className:"animate-spin"}),"Signing In..."]})}):r&&!e?(0,C.jsxs)("div",{style:{position:"relative",display:"inline-flex",flexDirection:"column"},children:[(0,C.jsx)(f,{onClick:s,className:t,"aria-label":"Retry Sign In",children:(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,C.jsx)(ne.AlertCircle,{size:16,style:{color:"var(--destructive, #ef4444)"}}),i??"Retry Sign In"]})}),(0,C.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--destructive, #ef4444)",padding:"0.25rem 0.5rem",borderRadius:"0.375rem",background:"var(--destructive-foreground, #fef2f2)",marginTop:"2px",wordBreak:"break-word",maxWidth:"100%",lineHeight:1.4},children:r.message})]}):(0,C.jsxs)("div",{style:{position:"relative",display:"inline-block"},children:[(0,C.jsx)(f,{onClick:()=>c(S=>!S),className:t,children:(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,C.jsx)(ne.CheckCircle2,{size:16,style:{color:"#22c55e"}}),(0,C.jsx)("span",{style:{fontSize:"0.875rem",fontWeight:500},children:"Signed In"})]})}),l&&(v&&R?(0,C.jsx)(v,{open:!0,onOpenChange:S=>{S||c(!1)},children:(0,C.jsx)(R,{children:p&&k?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(p,{children:(0,C.jsx)(k,{children:"Sign-In Details"})}),(0,C.jsx)(gn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:m,onCopy:P})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Sign-In Details"}),(0,C.jsx)(gn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:m,onCopy:P})]})})}):l&&(0,C.jsx)("div",{style:{position:"absolute",top:"calc(100% + 8px)",right:0,zIndex:100,width:"340px",maxWidth:"90vw",background:"var(--card, #fff)",border:"1px solid var(--border, #e2e8f0)",borderRadius:"0.75rem",boxShadow:"0 10px 25px rgba(0,0,0,0.1)",padding:"1rem"},children:(0,C.jsx)(gn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:m,onCopy:P})}))]})}function gn({result:t,onClose:e,copiedSign:n,onCopy:o,copyFailed:r}){let a=B().Button;if(!t)return(0,C.jsxs)("div",{style:{textAlign:"center",padding:"1rem 0"},children:[(0,C.jsx)(ne.CheckCircle2,{size:32,style:{color:"#22c55e",margin:"0 auto 0.75rem"}}),(0,C.jsx)("p",{style:{fontSize:"0.875rem",color:"var(--muted-foreground, #64748b)"},children:"Authenticated successfully"}),(0,C.jsx)(a,{variant:"outline",size:"sm",onClick:e,children:"Close"})]});let{message:i,signature:l}=t,c=l.length>20?l.slice(0,14)+"..."+l.slice(-6):l;return(0,C.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,C.jsx)(ne.CheckCircle2,{size:18,color:"#22c55e"}),(0,C.jsx)("span",{style:{fontWeight:600,fontSize:"0.9375rem"},children:"Signed In"})]}),(0,C.jsx)(a,{variant:"ghost",size:"icon",onClick:e,children:(0,C.jsx)(ne.X,{size:16})})]}),(0,C.jsxs)("div",{style:{display:"grid",gap:"0.375rem"},children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Domain"}),(0,C.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:i.domain})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Address"}),(0,C.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem",wordBreak:"break-all"},children:i.address})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Chain"}),(0,C.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:i.chainId})]})]}),i.statement&&(0,C.jsx)("div",{style:{padding:"0.5rem 0.625rem",borderRadius:"0.375rem",background:"var(--muted, #f1f5f9)",fontSize:"0.8125rem",lineHeight:1.5},children:i.statement}),(0,C.jsxs)("div",{children:[(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.25rem"},children:[(0,C.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Signature"}),(0,C.jsx)(a,{variant:"ghost",size:"icon",onClick:o,title:r?"This browser refused the clipboard \u2014 select the signature and copy it":"Copy signature","aria-label":r?"Copy failed":"Copy signature",children:n?(0,C.jsx)(ne.Check,{size:12,color:"#22c55e"}):(0,C.jsx)(ne.Copy,{size:12})})]}),(0,C.jsx)("p",{style:{fontSize:"0.75rem",fontFamily:"monospace",wordBreak:"break-all",lineHeight:1.4,color:"var(--muted-foreground, #64748b)",background:"var(--muted, #f1f5f9)",padding:"0.375rem 0.5rem",borderRadius:"0.375rem"},children:c})]}),(0,C.jsx)(a,{variant:"outline",className:"w-full",onClick:e,children:"Close"})]})}var Q=require("react"),H=require("lucide-react");var g=require("react/jsx-runtime");function Os(t){let e=Math.floor(4294967296/t)*t,n=new Uint32Array(1),o;do crypto.getRandomValues(n),o=n[0];while(o>=e);return o%t}function hn(t){let e=[...t];for(let n=e.length-1;n>0;n--){let o=Os(n+1);[e[n],e[o]]=[e[o],e[n]]}return e}function qo(t,e=3){let n=t.trim().split(/\s+/);return hn(n.map((r,s)=>s)).slice(0,Math.min(e,n.length)).map(r=>{let s=n[r],a=n.filter((c,u)=>u!==r),i=hn(a).slice(0,3),l=hn([s,...i]);return{index:r,correct:s,options:l}})}function $e({seedPhrase:t,onConfirm:e,onSkip:n,onExportPrivateKey:o,className:r,wordCount:s,inline:a=!1,open:i=!0,onOpenChange:l}){let c=B(),u=c.Button,d=c.Dialog,m=c.DialogContent,y=c.DialogHeader,w=c.DialogTitle,[f,v]=(0,Q.useState)("reveal"),[R,p]=(0,Q.useState)(!1),[k,P]=(0,Q.useState)(!1),[S,Y]=(0,Q.useState)(!1),[L,be]=(0,Q.useState)(()=>qo(t,3)),[Z,se]=(0,Q.useState)({}),[nt,ye]=(0,Q.useState)([]),[J,ge]=(0,Q.useState)(!1),[ee,Ve]=(0,Q.useState)(null),Ht=(0,Q.useMemo)(()=>t.trim().split(/\s+/),[t]),vr=(0,Q.useMemo)(()=>{let V=new Map;return Ht.map(te=>{let ae=V.get(te)??0;return V.set(te,ae+1),{word:te,key:`${te}-${ae}`}})},[Ht]),ya=s??(Ht.length===24?24:12),Cr=(0,Q.useCallback)(()=>p(!0),[]),wr=(0,Q.useCallback)(async()=>{try{await navigator.clipboard.writeText(t),Y(!1),P(!0),setTimeout(()=>P(!1),2e3)}catch{P(!1),Y(!0)}},[t]),Nr=(0,Q.useCallback)(()=>{be(qo(t,3)),se({}),ye([]),v("confirm")},[t]),kr=(0,Q.useCallback)((V,te)=>{se(ae=>({...ae,[V]:te})),ye(ae=>ae.filter(Ut=>Ut!==V))},[]),Rr=(0,Q.useCallback)(()=>{let V=[];for(let te of L)Z[te.index]!==te.correct&&V.push(te.index);if(V.length>0){ye(V);return}v("done"),e()},[L,Z,e]),An=(0,Q.useCallback)(()=>{n?.()},[n]),Sr=(0,Q.useCallback)(()=>{if(o){let V=o();Ve(V),ge(!0)}},[o]),Tr=L.every(V=>Z[V.index]!==void 0),Pr=(0,g.jsxs)("div",{className:"space-y-4",children:[(0,g.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/30 px-4 py-3",children:(0,g.jsxs)("div",{className:"flex items-start gap-2",children:[(0,g.jsx)(H.AlertTriangle,{size:16,className:"mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,g.jsx)("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:"Write down these words in order and store them somewhere safe. Never share them with anyone. If you lose your seed phrase, your funds cannot be recovered."})]})}),R?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:vr.map(({word:V,key:te},ae)=>(0,g.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2.5 py-1.5 text-sm",children:[(0,g.jsx)("span",{className:"text-xs text-muted-foreground w-5 shrink-0 text-right",children:ae+1}),(0,g.jsx)("span",{className:"font-mono font-medium",children:V})]},te))}),(0,g.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,g.jsxs)(u,{onClick:wr,variant:"outline",size:"sm",children:[k?(0,g.jsx)(H.Check,{size:14}):(0,g.jsx)(H.Copy,{size:14}),k?"Copied":S?"Copy failed":"Copy"]}),o&&(0,g.jsxs)(u,{onClick:Sr,variant:"outline",size:"sm",children:[(0,g.jsx)(H.Download,{size:14}),"Export Private Key"]})]}),S&&(0,g.jsx)("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:"This browser would not let the page write to your clipboard. Nothing was copied \u2014 select the words above and copy them yourself, or write them down."}),J&&ee&&(0,g.jsxs)("div",{className:"rounded-lg border border-border bg-muted p-3 space-y-2",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(H.EyeOff,{size:14,className:"text-muted-foreground"}),(0,g.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Private Key (keep secret!)"})]}),(0,g.jsx)("p",{className:"font-mono text-xs break-all select-all",children:ee})]}),(0,g.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[(0,g.jsxs)(u,{onClick:Nr,variant:"default",children:["I've Saved It",(0,g.jsx)(H.ArrowRight,{size:16})]}),n&&(0,g.jsxs)(u,{onClick:An,variant:"ghost",size:"sm",children:[(0,g.jsx)(H.SkipForward,{size:14}),"Skip Backup"]})]})]}):(0,g.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,g.jsx)(H.Shield,{size:40,className:"text-muted-foreground"}),(0,g.jsx)("p",{className:"text-sm text-muted-foreground text-center",children:"Click the button below to reveal your seed phrase. Make sure no one is watching your screen."}),(0,g.jsxs)(u,{onClick:Cr,variant:"default",children:[(0,g.jsx)(H.Eye,{size:16}),"Reveal Seed Phrase"]})]})]}),Br=(0,g.jsxs)("div",{className:"space-y-4",children:[(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:"Verify your backup by selecting the correct word for each position."}),L.map(V=>{let te=nt.includes(V.index);return(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsxs)("p",{className:N("text-sm font-medium",te?"text-destructive":"text-foreground"),children:["Word #",V.index+1,te&&(0,g.jsx)("span",{className:"ml-2 text-xs text-destructive",children:"(incorrect)"})]}),(0,g.jsx)("div",{className:"grid grid-cols-2 gap-2",children:V.options.map(ae=>{let Ut=Z[V.index]===ae;return(0,g.jsx)("button",{type:"button",onClick:()=>kr(V.index,ae),className:N("rounded-md border px-3 py-2 text-sm font-mono transition-all duration-200 cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",Ut?"border-primary bg-primary/10 text-primary font-medium":te?"border-destructive/50 bg-destructive/5":"border-border bg-card hover:border-primary/50"),children:ae},`${V.index}-${ae}`)})})]},V.index)}),(0,g.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[(0,g.jsxs)(u,{onClick:Rr,variant:"default",disabled:!Tr,children:[(0,g.jsx)(H.Check,{size:16}),"Verify & Confirm"]}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsxs)(u,{onClick:()=>v("reveal"),variant:"ghost",size:"sm",children:[(0,g.jsx)(H.ArrowLeft,{size:14}),"Back"]}),n&&(0,g.jsxs)(u,{onClick:An,variant:"ghost",size:"sm",children:[(0,g.jsx)(H.SkipForward,{size:14}),"Skip"]})]})]})]}),Er={reveal:Pr,confirm:Br,done:(0,g.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[(0,g.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:(0,g.jsx)(H.Check,{size:24,className:"text-green-600 dark:text-green-400"})}),(0,g.jsx)("p",{className:"font-medium text-foreground",children:"Backup Confirmed"}),(0,g.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your seed phrase has been backed up successfully."})]})},Ar={reveal:"Backup Seed Phrase",confirm:"Verify Backup",done:"Backup Complete"},pt=Er[f],ft=Ar[f];return a?(0,g.jsxs)("div",{className:N("space-y-4",r),children:[f!=="done"&&(0,g.jsx)("h3",{className:"text-lg font-semibold",children:ft}),pt]}):i?d&&m?(0,g.jsx)(d,{open:!0,onOpenChange:V=>{V||l?.(!1)},children:(0,g.jsx)(m,{children:y&&w?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(y,{children:(0,g.jsx)(w,{children:ft})}),(0,g.jsx)("div",{className:"mt-2 max-h-[55vh] overflow-y-auto",children:pt})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"mb-3 text-lg font-semibold",children:ft}),(0,g.jsx)("div",{className:"max-h-[55vh] overflow-y-auto",children:pt})]})})}):(0,g.jsxs)(Oe,{open:!0,onClose:()=>l?.(!1),children:[(0,g.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,g.jsx)("h2",{className:"text-lg font-semibold m-0",children:ft}),l&&(0,g.jsx)("button",{onClick:()=>l(!1),type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200 cursor-pointer border-none bg-transparent","aria-label":"Close",children:(0,g.jsx)(H.X,{size:16})})]}),pt]}):null}var jo=Ot(require("react"),1);var A=require("react/jsx-runtime");function _s({error:t,reset:e,dismiss:n,retryLabel:o="Try Again"}){let r=B(),s=r.Button,a=r.Dialog,i=r.DialogContent,l=r.DialogHeader,c=r.DialogTitle;if(a&&i)return(0,A.jsx)(a,{open:!0,onOpenChange:()=>{},children:(0,A.jsx)(i,{children:l&&c?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(l,{children:(0,A.jsx)(c,{children:"Something went wrong"})}),(0,A.jsxs)("div",{style:{marginTop:"0.5rem"},children:[(0,A.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,A.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,A.jsx)(s,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,A.jsx)(s,{variant:"default",size:"default",onClick:e,children:o})]})]})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Something went wrong"}),(0,A.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,A.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,A.jsx)(s,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,A.jsx)(s,{variant:"default",size:"default",onClick:e,children:o})]})]})})});let u=!0,d=n??void 0;return(0,A.jsxs)(Oe,{open:u,onClose:d,children:[(0,A.jsx)(_n,{title:"Something went wrong",onClose:d,showCloseButton:!!n}),(0,A.jsxs)(Fn,{children:[(0,A.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,A.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,A.jsx)(s,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,A.jsx)(s,{variant:"default",size:"default",onClick:e,children:o})]})]})]})}var Ge=class extends jo.default.Component{constructor(e){super(e),this.state={hasError:!1,error:null,dismissed:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e,dismissed:!1}}componentDidCatch(e,n){this.props.onError?.(e,n)}handleReset=()=>{this.setState({hasError:!1,error:null,dismissed:!1}),this.props.onReset?.()};handleDismiss=()=>{this.setState(e=>({...e,dismissed:!0})),this.props.onDismiss?.()};render(){return this.state.dismissed?this.props.children:this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback({error:this.state.error,reset:this.handleReset}):(0,A.jsx)(_s,{error:this.state.error,reset:this.handleReset,dismiss:this.props.onDismiss?this.handleDismiss:void 0,retryLabel:this.props.retryLabel}):this.props.children}};var Xe=require("react"),Go=require("@naculus/connect-appkit-react");var $=require("react");var Ye={primary:{name:"--primary",fallback:"221.2 83.2% 53.3%"},"primary-foreground":{name:"--primary-foreground",fallback:"210 40% 98%"},background:{name:"--background",fallback:"0 0% 100%"},foreground:{name:"--foreground",fallback:"222.2 84% 4.9%"},card:{name:"--card",fallback:"0 0% 100%"},"card-foreground":{name:"--card-foreground",fallback:"222.2 84% 4.9%"},popover:{name:"--popover",fallback:"0 0% 100%"},"popover-foreground":{name:"--popover-foreground",fallback:"222.2 84% 4.9%"},secondary:{name:"--secondary",fallback:"210 40% 96.1%"},"secondary-foreground":{name:"--secondary-foreground",fallback:"222.2 47.4% 11.2%"},muted:{name:"--muted",fallback:"210 40% 96.1%"},"muted-foreground":{name:"--muted-foreground",fallback:"215.4 16.3% 46.9%"},accent:{name:"--accent",fallback:"210 40% 96.1%"},"accent-foreground":{name:"--accent-foreground",fallback:"222.2 47.4% 11.2%"},destructive:{name:"--destructive",fallback:"0 84.2% 60.2%"},border:{name:"--border",fallback:"214.3 31.8% 91.4%"},input:{name:"--input",fallback:"214.3 31.8% 91.4%"},ring:{name:"--ring",fallback:"221.2 83.2% 53.3%"},radius:{name:"--radius",fallback:"0.5rem"}},Fs=new Map;function bn(){Fs.clear()}var Lt=require("react/jsx-runtime"),Qo=(0,$.createContext)({theme:{},isDark:!1,setTheme:()=>{},toggleDarkMode:()=>{}});function Ks(t){let e=[];for(let[n,o]of Object.entries(t)){let r=Ye[n];r&&o&&e.push(" "+r.name+": "+o+";")}return e.length===0?"":`:root {
|
|
9
9
|
`+e.join(`
|
|
10
10
|
`)+`
|
|
11
|
-
}`}function qs(t){let e=new Set;if(t!=="computed"||typeof document>"u")return e;for(let n of Object.keys(Ye)){let o=Ye[n],r=getComputedStyle(document.documentElement).getPropertyValue(o.name).trim();r&&r!==o.fallback&&e.add(n)}return e}function It({children:t,theme:e={},defaultDark:n=!1,priority:o="fallback"}){let[r,s]=(0,$.useState)(e),[a,i]=(0,$.useState)(n);(0,$.useEffect)(()=>{bn()},[r]);let[l,c]=(0,$.useState)(new Set);(0,$.useEffect)(()=>{c(qs(o))},[o]);let u=(0,$.useMemo)(()=>{if(o==="fallback"||l.size===0)return r;let f={};for(let[v,R]of Object.entries(r))!l.has(v)&&R&&(f[v]=R);return f},[r,o,l]),d=(0,$.useMemo)(()=>Ks(u),[u]);(0,$.useEffect)(()=>{if(typeof document>"u")return;let f=document.documentElement;a?f.classList.add("dark"):f.classList.remove("dark"),bn()},[a]);let p=(0,$.useMemo)(()=>"w3c-theme-"+Math.random().toString(36).slice(2,9),[]),x=(0,$.useCallback)(()=>i(f=>!f),[]),w=(0,$.useMemo)(()=>({theme:r,isDark:a,setTheme:s,toggleDarkMode:x}),[r,a,x]);return(0,Lt.jsxs)(Qo.Provider,{value:w,children:[d?(0,Lt.jsx)("style",{id:p,dangerouslySetInnerHTML:{__html:d}}):null,t]})}function yn(){return(0,$.useContext)(Qo)}function $o(t){let{theme:e}=yn(),[n,o]=(0,$.useState)("");return(0,$.useEffect)(()=>{let r=Ye[t];if(!r)return;let s=e[t];if(s){o(s);return}if(typeof document>"u"){o(r.fallback);return}let a=getComputedStyle(document.documentElement).getPropertyValue(r.name).trim();o(a||r.fallback)},[t,e]),n||Ye[t]?.fallback||""}var Je=require("react/jsx-runtime"),Yo=(0,Xe.createContext)({mode:"walletconnect"});function Jo(){return(0,Xe.useContext)(Yo)}function Ze({config:t,children:e,autoConnect:n=!1,detectionMode:o="walletconnect",theme:r,defaultDark:s=!1,themePriority:a="computed"}){let i=(0,Xe.useMemo)(()=>({mode:o}),[o]),l=o==="walletconnect"||o==="auto";return(0,Je.jsx)(Yo.Provider,{value:i,children:(0,Je.jsx)(It,{theme:r,defaultDark:s,priority:a,children:(0,Je.jsx)(zt,{components:{QRCodeModal:Qe},children:(0,Je.jsx)(Go.Web3ConnectProvider,{config:t,autoConnect:n,children:l?(0,Je.jsx)(ht,{children:e}):e})})})})}var vn=require("react/jsx-runtime");function js({className:t,variant:e,size:n,...o}){let r=["inline-flex items-center justify-center gap-2 rounded-lg border px-4 py-2","text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",e==="outline"?"border-input bg-transparent hover:bg-accent":"border-primary bg-primary text-primary-foreground hover:bg-primary/90",n==="sm"?"h-9 px-3":n==="icon"?"h-10 w-10 p-0":"h-10",t].filter(Boolean).join(" ");return(0,vn.jsx)("button",{type:"button",className:r,...o})}var xn={Button:js,ConnectButton:we,AccountButton:vt,ChainSelector:Le,QRCodeModal:Qe,SignInButton:Mt,SeedPhraseBackup:$e,ErrorBoundary:Ge,Web3ConnectUI:Ze},Xo=(0,et.createContext)({});function zt({children:t,components:e={}}){let n=(0,et.useMemo)(()=>({...xn,...e}),[e]);return(0,vn.jsx)(Xo.Provider,{value:n,children:t})}function B(){return(0,et.useContext)(Xo)}function Zo(t){return B()[t]}var U=require("react/jsx-runtime");function er(t){let e=t&&typeof t=="object"&&"details"in t?t.details:void 0,n=e instanceof Error?`${e.name}: ${e.message}`:e;tr.logger.error("ui/ChainSelector","switchChain failed",t,n)}function ut({chainId:t,className:e}){let n=xt(t);return n?(0,U.jsx)("span",{className:N("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function Le({className:t,showLabel:e=!0,variant:n="dropdown"}){let{currentChain:o,availableChains:r,switchChain:s,isEvm:a}=(0,Wt.useChain)(),{isConnected:i}=(0,Wt.useWallet)(),[l,c]=(0,tt.useState)(!1),d=B().Button,p=(0,tt.useRef)(null);if((0,tt.useEffect)(()=>{function f(v){p.current&&!p.current.contains(v.target)&&c(!1)}return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]),!i)return null;let x=o?.name??"Unknown Chain",w=r.length>1;return n==="minimal"?(0,U.jsxs)("div",{className:N("inline-flex items-center gap-1.5 text-xs text-muted-foreground",t),children:[o&&(0,U.jsx)(ut,{chainId:o.caip2,className:"h-3.5 w-3.5"}),x]}):n==="buttons"?(0,U.jsx)("div",{className:N("flex flex-wrap gap-2",t),children:r.map(f=>{let v=f.caip2,R=v===o?.caip2;return(0,U.jsxs)(d,{className:R?N("bg-accent","border-primary"):"",onClick:()=>{R||s(v).catch(er)},children:[(0,U.jsx)(ut,{chainId:v,className:"h-4 w-4"}),f.name,f.token&&(0,U.jsx)("span",{className:"text-xs opacity-60",children:f.token})]},v)})}):w?(0,U.jsxs)("div",{ref:p,className:N("relative inline-block",t),children:[(0,U.jsxs)(d,{onClick:()=>c(!l),children:[o&&(0,U.jsx)(ut,{chainId:o.caip2,className:"h-4 w-4"}),x,(0,U.jsx)("svg",{className:N("h-3 w-3 transition-transform",l&&"rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,U.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),l&&(0,U.jsxs)("div",{className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] rounded-lg border bg-card p-1 shadow-lg animate-in fade-in zoom-in-95 duration-200",children:[e&&(0,U.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Switch Network"}),r.map(f=>{let v=f.caip2,R=v===o?.caip2;return(0,U.jsxs)(d,{onClick:()=>{R||s(v).catch(er),c(!1)},className:N("flex w-full items-center gap-2 rounded-md px-2 py-2 text-sm transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",R?"bg-accent font-medium":"hover:bg-accent/50"),children:[(0,U.jsx)(ut,{chainId:v,className:"h-4 w-4"}),(0,U.jsx)("span",{className:"flex-1 text-left",children:f.name}),f.token&&(0,U.jsx)("span",{className:"text-xs text-muted-foreground",children:f.token}),R&&(0,U.jsx)("svg",{className:"h-4 w-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,U.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},v)})]})]}):(0,U.jsxs)("div",{className:N("inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm opacity-60 cursor-default",t),children:[o&&(0,U.jsx)(ut,{chainId:o.caip2,className:"h-4 w-4"}),x]})}var nr=require("@naculus/connect-appkit-react"),ve=require("lucide-react"),Te=require("react");var q=require("react/jsx-runtime"),$s={eip155:{name:"Ethereum & EVM",detail:"One address across Ethereum, Polygon, Arbitrum and every EVM chain"},solana:{name:"Solana",detail:"A separate key on a different curve"}};function Gs(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Ys({account:t,isActive:e,onSelect:n}){let[o,r]=(0,Te.useState)(!1),s=$s[t.namespace]??{name:t.namespace,detail:""},a=(0,Te.useCallback)(i=>{i.stopPropagation();let l=navigator?.clipboard?.writeText;l&&l.call(navigator.clipboard,t.address).then(()=>{r(!0),setTimeout(()=>r(!1),1500)},()=>{})},[t.address]);return(0,q.jsxs)("div",{role:"radio",tabIndex:0,"aria-checked":e,onClick:n,onKeyDown:i=>{i.target===i.currentTarget&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),n())},className:N("flex w-full items-center gap-3 rounded-md border px-3 py-2.5 text-left text-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e?"border-primary bg-accent":"border-border hover:bg-accent/50"),children:[(0,q.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,q.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[s.name,e&&(0,q.jsx)("span",{className:"rounded-sm bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-primary",children:"Signing"})]}),(0,q.jsx)("span",{className:"truncate font-mono text-xs text-muted-foreground",children:Gs(t.address)})]}),(0,q.jsx)("button",{type:"button","aria-label":`Copy ${s.name} address`,onClick:a,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o?(0,q.jsx)(ve.Check,{size:14}):(0,q.jsx)(ve.Copy,{size:14})}),e&&(0,q.jsx)(ve.Check,{size:16,className:"shrink-0 text-primary"})]})}function Cn({className:t,hideBackfill:e=!1,onSelect:n,accounts:o,activeNamespace:r,canDerive:s,setActiveNamespace:a,backfillAccounts:i}){let[l,c]=(0,Te.useState)(!1),[u,d]=(0,Te.useState)(null),p=(0,Te.useCallback)(f=>{if(f!==r)try{a(f),d(null),n?.(f)}catch(v){d(v instanceof Error?v.message:"Could not switch account")}},[r,a,n]),x=(0,Te.useCallback)(async()=>{c(!0),d(null);try{await i()}catch(f){d(f instanceof Error?f.message:"Could not derive accounts")}finally{c(!1)}},[i]);if(o.length===0)return null;let w=!e&&s;return(0,q.jsxs)("div",{className:N("flex flex-col gap-2",t),children:[(0,q.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,q.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Accounts"}),(0,q.jsx)("span",{className:"text-[11px] text-muted-foreground",children:"Chooses the signing key, not the network"})]}),(0,q.jsx)("div",{role:"radiogroup","aria-label":"Wallet accounts",className:"flex flex-col gap-1.5",children:o.map(f=>(0,q.jsx)(Ys,{account:f,isActive:f.namespace===r,onSelect:()=>p(f.namespace)},f.namespace))}),w&&(0,q.jsxs)("button",{type:"button",onClick:x,disabled:l,className:N("flex items-center justify-center gap-2 rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground","hover:bg-accent/50 disabled:opacity-60"),children:[l?(0,q.jsx)(ve.Loader2,{size:14,className:"animate-spin"}):(0,q.jsx)(ve.Plus,{size:14}),l?"Deriving\u2026":"Show accounts this phrase already owns"]}),u&&(0,q.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:u})]})}function or(t){let{wallet:e,accounts:n,activeNamespace:o,setActiveNamespace:r,backfillAccounts:s}=(0,nr.useEmbeddedWallet)();return e?(0,q.jsx)(Cn,{...t,accounts:n,activeNamespace:o,canDerive:e.recoveryAvailable&&n.length<2,setActiveNamespace:r,backfillAccounts:s}):null}var Ce=require("lucide-react"),sr=require("@naculus/connect-appkit-react");var W=require("react/jsx-runtime"),Js={critical:Ce.ShieldAlert,warning:Ce.AlertTriangle,info:Ce.Info},Xs={critical:"text-destructive",warning:"text-amber-600 dark:text-amber-500",info:"text-muted-foreground"};function rr(t){return t>=90?"text-emerald-600 dark:text-emerald-500":t>=70?"text-amber-600 dark:text-amber-500":"text-destructive"}function Zs({finding:t}){let e=Js[t.severity]??Ce.Info;return(0,W.jsxs)("li",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[(0,W.jsx)(e,{size:16,className:N("mt-0.5 shrink-0",Xs[t.severity])}),(0,W.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,W.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,W.jsx)("span",{className:"text-sm font-medium",children:t.title}),t.deduction>0&&(0,W.jsxs)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:["\u2212",t.deduction]})]}),(0,W.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:t.detail}),t.remedy&&(0,W.jsxs)("p",{className:"text-xs leading-relaxed",children:[(0,W.jsx)("span",{className:"font-medium",children:"What helps: "}),(0,W.jsx)("span",{className:"text-muted-foreground",children:t.remedy})]})]})]})}function wn({className:t,hideInformational:e=!1,report:n}){if(!n)return null;let{score:o,level:r,findings:s,encrypted:a,backend:i,unlock:l}=n,c=e?s.filter(d=>d.deduction>0):s,u=s.every(d=>d.deduction===0);return(0,W.jsxs)("div",{className:N("flex flex-col gap-3",t),children:[(0,W.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border px-4 py-3",children:[(0,W.jsx)(Ce.ShieldCheck,{size:22,className:N("shrink-0",rr(o))}),(0,W.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,W.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,W.jsx)("span",{className:N("text-2xl font-semibold tabular-nums",rr(o)),children:o}),(0,W.jsx)("span",{className:"text-sm text-muted-foreground",children:"/ 100"}),(0,W.jsxs)("span",{className:"ml-auto text-xs text-muted-foreground",children:["Tier ",r]})]}),(0,W.jsxs)("span",{className:"text-xs text-muted-foreground",children:[i==="localStorage"?"localStorage":"IndexedDB",a?" \xB7 encrypted":" \xB7 not encrypted",l.sealedWith?.includes("prf")?" \xB7 passkey":""]})]})]}),u?(0,W.jsx)("p",{className:"text-xs text-muted-foreground",children:"Nothing is holding this score down."}):(0,W.jsx)("p",{className:"text-xs text-muted-foreground",children:"Scored against this SDK's own published rubric, not an external standard. Each item below names the points it costs."}),(0,W.jsx)("ul",{className:"flex flex-col gap-1.5",children:c.map(d=>(0,W.jsx)(Zs,{finding:d},d.id))})]})}function ar(t){let{securityReport:e}=(0,sr.useEmbeddedWallet)();return(0,W.jsx)(wn,{...t,report:e})}var he=require("react"),Pe=require("lucide-react"),ir=require("@naculus/connect-appkit-react");var D=require("react/jsx-runtime"),Nn=8,ea=12;function kn({className:t,request:e,submit:n,cancel:o}){let[r,s]=(0,he.useState)(""),[a,i]=(0,he.useState)(""),[l,c]=(0,he.useState)(!1),u=(0,he.useRef)(null),d=e?.intent==="create";(0,he.useEffect)(()=>{if(!e){s(""),i(""),c(!1);return}s(""),i(""),u.current?.focus()},[e]);let p=d&&r.length>0&&r.length<Nn,x=d&&a.length>0&&a!==r,w=d?r.length>=Nn&&a===r:r.length>0,f=(0,he.useCallback)(v=>{v.preventDefault(),w&&n(r)},[w,n,r]);return e?(0,D.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"presentation",children:(0,D.jsxs)("form",{role:"dialog","aria-modal":"true","aria-label":d?"Choose a passphrase":"Unlock your wallet",onSubmit:f,className:N("flex w-full max-w-sm flex-col gap-4 rounded-lg border border-border bg-card p-5 shadow-lg",t),children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(Pe.KeyRound,{size:18,className:"shrink-0 text-primary"}),(0,D.jsx)("h2",{className:"text-base font-semibold",children:d?"Choose a passphrase":"Unlock your wallet"})]}),e.previousError&&(0,D.jsx)("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:e.previousError}),(0,D.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:d?"This encrypts your wallet on this device. Without it, anything that can run script on this page can read your keys.":"Your wallet is encrypted on this device. Enter the passphrase you chose to open it."}),(0,D.jsxs)("label",{className:"flex flex-col gap-1.5",children:[(0,D.jsx)("span",{className:"text-xs font-medium",children:"Passphrase"}),(0,D.jsxs)("span",{className:"relative flex items-center",children:[(0,D.jsx)("input",{ref:u,type:l?"text":"password",value:r,onChange:v=>s(v.target.value),autoComplete:d?"new-password":"current-password",autoFocus:!0,className:"w-full rounded-md border border-border bg-background px-3 py-2 pr-9 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),(0,D.jsx)("button",{type:"button","aria-label":l?"Hide passphrase":"Show passphrase",onClick:()=>c(v=>!v),className:"absolute right-2 text-muted-foreground hover:text-foreground",children:l?(0,D.jsx)(Pe.EyeOff,{size:15}):(0,D.jsx)(Pe.Eye,{size:15})})]})]}),d&&(0,D.jsxs)("label",{className:"flex flex-col gap-1.5",children:[(0,D.jsx)("span",{className:"text-xs font-medium",children:"Type it again"}),(0,D.jsx)("input",{type:l?"text":"password",value:a,onChange:v=>i(v.target.value),autoComplete:"new-password",className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),p&&(0,D.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["At least ",Nn," characters."]}),x&&(0,D.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:"These do not match."}),d&&!p&&r.length>0&&r.length<ea&&(0,D.jsx)("p",{className:"text-xs text-muted-foreground",children:"Short. Several ordinary words are far harder to guess than a short one with symbols in it."}),d&&(0,D.jsxs)("p",{className:"flex gap-2 rounded-md bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-500",children:[(0,D.jsx)(Pe.ShieldAlert,{size:14,className:"mt-0.5 shrink-0"}),(0,D.jsx)("span",{children:"If you forget this, nothing can open this copy of the wallet \u2014 not us, not your browser. Your recovery phrase is the only thing that gets it back."})]}),(0,D.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,D.jsx)("button",{type:"button",onClick:()=>o(),className:"rounded-md border border-border px-3 py-2 text-sm hover:bg-accent",children:"Cancel"}),(0,D.jsx)("button",{type:"submit",disabled:!w,className:"rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:d?"Encrypt wallet":"Unlock"})]})]})}):null}function lr(t){let{request:e,submit:n,cancel:o}=(0,ir.usePassphraseGate)();return(0,D.jsx)(kn,{...t,request:e,submit:n,cancel:o})}var ze=require("react"),de=require("lucide-react"),Vt=require("@naculus/connect-appkit-react");var O=require("react/jsx-runtime");function Rn({className:t,passkeys:e,unlock:n,onRegistered:o}){let[r,s]=(0,ze.useState)(!1),[a,i]=(0,ze.useState)(null),[l,c]=(0,ze.useState)(!1),u=!!e?.hasCredential?.()||l,d=(0,ze.useCallback)(async()=>{if(e){s(!0),i(null);try{await e.createPasskey(),c(!0),await o?.()}catch(f){i(f instanceof Error?f.message:"Could not register a passkey")}finally{s(!1)}}},[e,o]);if(!e)return null;let p=n?.sealedWith?.includes("prf")??!1,x=null;if(u)switch(n?.prf){case"available":x=p?{tone:"good",icon:(0,O.jsx)(de.ShieldCheck,{size:16}),title:"Your passkey unlocks this wallet",detail:"Opening it needs your fingerprint or face, not a value a script on this page can supply."}:{tone:"warn",icon:(0,O.jsx)(de.TriangleAlert,{size:16}),title:"Registered, but not applied yet",detail:"This device can produce the key material. The next time the wallet is saved, the record is sealed under it."};break;case"unavailable":x={tone:"bad",icon:(0,O.jsx)(de.ShieldAlert,{size:16}),title:"This passkey cannot unlock the wallet",detail:"The authenticator did not return the key material. Firefox does not implement the extension, and a passkey created before it was requested cannot have it added afterwards \u2014 a new one has to be registered on a browser that supports it."};break;default:x={tone:"neutral",icon:(0,O.jsx)(de.Fingerprint,{size:16}),title:"A passkey is registered",detail:"Whether it can unlock this wallet is not known until the wallet is opened once. It will be used if it works."};break}let w={good:"text-emerald-600 dark:text-emerald-500",warn:"text-amber-600 dark:text-amber-500",bad:"text-destructive",neutral:"text-muted-foreground"};return(0,O.jsxs)("div",{className:N("flex flex-col gap-3",t),children:[x?(0,O.jsxs)("div",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[(0,O.jsx)("span",{className:N("mt-0.5 shrink-0",w[x.tone]),children:x.icon}),(0,O.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,O.jsx)("span",{className:"text-sm font-medium",children:x.title}),(0,O.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:x.detail})]})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"A passkey raises what it takes to read your stored keys from \u201Cany script on this page\u201D to your fingerprint or face. The passphrase keeps working, so a broken or replaced authenticator does not cost you this copy."}),(0,O.jsxs)("p",{className:"flex gap-2 rounded-md bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-500",children:[(0,O.jsx)(de.ShieldAlert,{size:14,className:"mt-0.5 shrink-0"}),(0,O.jsx)("span",{children:"This protects the copy on this device. It does not back up your wallet \u2014 the recovery phrase is still the only thing that survives losing this device."})]}),(0,O.jsxs)("button",{type:"button",onClick:d,disabled:r,className:"flex items-center justify-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-60",children:[r?(0,O.jsx)(de.Loader2,{size:15,className:"animate-spin"}):(0,O.jsx)(de.Fingerprint,{size:15}),r?"Waiting for your device\u2026":"Protect with a passkey"]})]}),a&&(0,O.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:a})]})}function cr(t){let{client:e}=(0,Vt.useWeb3)(),{securityReport:n,hasWallet:o}=(0,Vt.useEmbeddedWallet)(),r=(0,ze.useCallback)(async()=>{let s=e?.embeddedConnector;s&&o&&await s.save()},[e,o]);return(0,O.jsx)(Rn,{...t,passkeys:e?.passkeysConnector??null,unlock:n?.unlock,onRegistered:r})}var oe=require("@naculus/connect-appkit-react"),X=require("react");var fe=require("react/jsx-runtime"),dr=(0,X.createContext)(null);function Sn(){let t=(0,X.useContext)(dr);if(!t)throw new Error("useAppKit must be used within an <AppKit> component");return t}function Tn({projectId:t,metadata:e,enableEmbedded:n=!1,enablePasskeys:o=!1,chains:r,embeddedConfig:s,encryptionKey:a,siwx:i,children:l,className:c,autoConnect:u=!1,theme:d,defaultDark:p=!1,themePriority:x="computed",detectionMode:w="auto"}){let[f,v]=(0,X.useState)(!1),[R,m]=(0,X.useState)(!1),k=(0,X.useMemo)(()=>({projectId:t,metadata:e,enableEmbedded:n,enablePasskeys:o,chains:r,embeddedConfig:s,encryptionKey:a,siwx:i}),[t,e,n,o,r,s,a,i]);return(0,fe.jsx)(Ze,{config:k,autoConnect:u,detectionMode:w,theme:d,defaultDark:p,themePriority:x,children:(0,fe.jsx)(ta,{className:c,open:f,setOpen:v,backupOpen:R,setBackupOpen:m,children:l})})}function ta({children:t,className:e,open:n,setOpen:o,backupOpen:r,setBackupOpen:s}){let{isConnected:a,isConnecting:i}=(0,oe.useWallet)(),{primaryAccount:l}=(0,oe.useAccount)(),{currentChain:c,availableChains:u,switchChain:d}=(0,oe.useChain)(),p=(0,oe.useEmbeddedWallet)(),{disconnect:x}=(0,oe.useDisconnect)(),{wallets:w,hasWallets:f}=He(),{formatted:v}=(0,oe.useBalance)(),R=v??null,m=(0,X.useCallback)(async()=>{await x()},[x]),k=(0,X.useCallback)(()=>{p.confirmBackup(),s(!1)},[p,s]),P=(0,X.useCallback)(()=>{p.confirmBackup(),s(!1)},[p,s]),S=(0,X.useCallback)(()=>p.getPrivateKey(),[p]),Y=(0,X.useMemo)(()=>({connect:()=>o(!0),disconnect:m,isConnected:a,isConnecting:i,address:l,balance:R,balanceSymbol:c?.token??null,chainName:c?.name??null,availableChains:u.map(L=>({caip2:L.caip2,name:L.name,token:L.token})),switchChain:d,wallets:w,hasWallets:f,backupPending:p.backupPending,seedPhrase:p.seedPhrase,confirmBackup:k,skipBackup:P,open:n,setOpen:o}),[a,i,l,R,c,u,d,w,f,p.backupPending,p.seedPhrase,k,P,m,n,o]);return(0,X.useEffect)(()=>{p.seedPhrase&&p.backupPending&&s(!0)},[p.seedPhrase,p.backupPending,s]),(0,fe.jsxs)(dr.Provider,{value:Y,children:[t,p.seedPhrase&&r&&(0,fe.jsx)($e,{seedPhrase:p.seedPhrase,onConfirm:k,onSkip:P,onExportPrivateKey:S,open:r,onOpenChange:s})]})}function Pn({className:t}){let e=Sn(),{connectInjected:n}=(0,oe.useWeb3)(),{primaryAccount:o}=(0,oe.useAccount)(),{disconnect:r}=(0,oe.useDisconnect)(),s=(0,X.useCallback)(async(a,i,l)=>{a==="injected"&&(await n(l),i())},[n]);return e.isConnected&&o?(0,fe.jsxs)("div",{className:N("inline-flex items-center gap-2",t),children:[(0,fe.jsx)(Le,{variant:"minimal"}),(0,fe.jsx)(we,{isConnected:e.isConnected,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:s,className:t})]}):(0,fe.jsx)(we,{isConnected:e.isConnected,isConnecting:e.isConnecting,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:s,className:t})}function Bn({className:t,variant:e="dropdown"}){return(0,fe.jsx)(Le,{className:t,variant:e})}try{let t=xn;t&&Object.assign(t,{AppKit:Tn,AppKitButton:Pn,AppKitChainSelector:Bn})}catch{}var re=require("lucide-react");var h=require("react/jsx-runtime");function na(t){if(t<1e3)return"<1s";if(t<6e4)return`~${Math.round(t/1e3)}s`;let e=Math.floor(t/6e4),n=Math.round(t%6e4/1e3);return n>0?`~${e}m ${n}s`:`~${e}m`}function ur(t){return t.symbol||"UNKNOWN"}function oa(t){let e=t.toLowerCase();return e.includes("lifi")?"default":e.includes("axelar")?"secondary":"outline"}function ra(t){return t.length>12?`${t.slice(0,6)}...${t.slice(-6)}`:t}function sa({route:t,onSelect:e}){let n=B(),o=n.Button,r=n.Badge,s=t.provider??"Route";return(0,h.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4 transition-colors hover:bg-accent/30",children:[(0,h.jsxs)("div",{className:"flex flex-col gap-1.5 min-w-0",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[r?(0,h.jsx)(r,{variant:oa(s),children:s}):(0,h.jsx)("span",{className:"inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",children:s}),t.steps.length>1&&(0,h.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t.steps.length," steps"]})]}),(0,h.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm",children:[(0,h.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,h.jsx)(re.DollarSign,{className:"h-3.5 w-3.5"}),"$",t.gasCosts.totalUsd]}),(0,h.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,h.jsx)(re.Clock,{className:"h-3.5 w-3.5"}),na(t.steps.reduce((a,i)=>{let l=t.estimatedTime>0?15e3:0;return a+l},0))]}),(0,h.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[t.gasCosts.totalUsd," cost"]})]})]}),(0,h.jsx)(o,{variant:"outline",size:"sm",onClick:e,children:"Select"})]})}function aa(){let e=B().Skeleton;return(0,h.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"route-selector-loading",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,h.jsx)(re.Loader2,{className:"h-4 w-4 animate-spin"}),(0,h.jsx)("span",{children:"Fetching best routes..."})]}),[1,2,3].map(n=>(0,h.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4",children:[(0,h.jsx)("div",{className:"flex flex-col gap-2 flex-1",children:e?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(e,{className:"h-4 w-24"}),(0,h.jsx)(e,{className:"h-3 w-48"})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),(0,h.jsx)("div",{className:"h-3 w-48 animate-pulse rounded bg-muted"})]})}),e?(0,h.jsx)(e,{className:"h-8 w-20 rounded-md"}):(0,h.jsx)("div",{className:"h-8 w-20 animate-pulse rounded-md bg-muted"})]},n))]})}function ia(){return(0,h.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground","data-testid":"route-selector-empty",children:[(0,h.jsx)(re.AlertCircle,{className:"h-8 w-8 opacity-40"}),(0,h.jsx)("span",{children:"No routes found for this pair"}),(0,h.jsx)("span",{className:"text-xs",children:"Try a different token or amount"})]})}function la({error:t,onRetry:e}){let o=B().Button;return(0,h.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-6","data-testid":"route-selector-error",children:[(0,h.jsx)(re.XCircle,{className:"h-8 w-8 text-destructive"}),(0,h.jsx)("p",{className:"text-sm text-destructive font-medium",children:"Failed to fetch routes"}),(0,h.jsx)("p",{className:"text-xs text-muted-foreground max-w-xs text-center",children:t}),e&&(0,h.jsx)(o,{variant:"outline",size:"sm",onClick:e,children:"Retry"})]})}function ca(){let e=B().Progress;return(0,h.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6","data-testid":"route-selector-executing",children:[(0,h.jsx)(re.Loader2,{className:"h-6 w-6 animate-spin text-primary"}),(0,h.jsx)("p",{className:"text-sm font-medium",children:"Executing route..."}),(0,h.jsx)("p",{className:"text-xs text-muted-foreground",children:"Please confirm the transaction in your wallet"}),e?(0,h.jsx)(e,{value:50,className:"w-48 h-1.5"}):(0,h.jsx)("div",{className:"h-1.5 w-48 rounded-full bg-muted",children:(0,h.jsx)("div",{className:"h-full w-1/2 rounded-full bg-primary animate-pulse"})})]})}function da({txHash:t}){return(0,h.jsxs)("div",{className:"flex flex-col items-center gap-2 py-6","data-testid":"route-selector-success",children:[(0,h.jsx)(re.CheckCircle2,{className:"h-8 w-8 text-green-500"}),(0,h.jsx)("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Route executed successfully!"}),(0,h.jsxs)("p",{className:"text-xs text-muted-foreground font-mono",children:["TX: ",ra(t)]})]})}function mr({chainId:t,className:e}){let n=xt(`eip155:${t}`);return n?(0,h.jsx)("span",{className:N("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function pr({inputToken:t,outputToken:e,amount:n,routes:o=[],loading:r=!1,executing:s=!1,onRouteSelected:a,onCancel:i,successTxHash:l,error:c,className:u}){let d=B(),p=d.Card,x=d.Button;if(l)return(0,h.jsx)("div",{className:N("rounded-lg border border-border",u),children:(0,h.jsx)(da,{txHash:l})});if(s)return(0,h.jsx)("div",{className:N("rounded-lg border border-border",u),children:(0,h.jsx)(ca,{})});return p?(0,h.jsxs)(p,{className:N("p-4",u),children:[f(),v(),R()]}):(0,h.jsxs)("div",{className:N("rounded-lg border border-border p-4",u),children:[f(),v(),R()]});function f(){return!t&&!e?null:(0,h.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2 text-sm",children:[t&&(0,h.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[(0,h.jsx)(mr,{chainId:t.chainId,className:"h-4 w-4"}),n?`${n.toString()} `:"",ur(t)]}),t&&e&&(0,h.jsx)(re.ArrowRight,{className:"h-3.5 w-3.5 text-muted-foreground"}),e&&(0,h.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[(0,h.jsx)(mr,{chainId:e.chainId,className:"h-4 w-4"}),ur(e)]})]})}function v(){return r?(0,h.jsx)(aa,{}):c?(0,h.jsx)(la,{error:c}):o.length===0?(0,h.jsx)(ia,{}):(0,h.jsx)("div",{className:"flex flex-col gap-2","data-testid":"route-selector-routes",children:o.map((m,k)=>(0,h.jsx)(sa,{route:m,onSelect:()=>a?.(m)},`${m.fromChain}-${m.toChain}-${m.gasCosts.totalUsd}-${k}`))})}function R(){return!r&&o.length===0&&!c?null:(0,h.jsx)("div",{className:"mt-4 flex justify-end",children:(0,h.jsx)(x,{variant:"ghost",size:"sm",onClick:i,children:"Cancel"})})}}var fr=Ot(require("react"),1),_=require("lucide-react");var y=require("react/jsx-runtime");function ua(t){let e=Number(t)/1e18;return e<.001?`~${e.toFixed(6)} ETH`:`~${e.toFixed(3)} ETH`}function gr({isDeployed:t=!1,isDeploying:e=!1,estimatedGas:n,error:o=null,onUpgrade:r,onShowSettings:s,onRetry:a}){let i=B(),l=i.Button,c=i.Card,u=i.Badge,d=s?(0,y.jsxs)(l,{variant:"outline",className:"w-full",onClick:s,children:[(0,y.jsx)(_.Settings,{size:15})," Advanced Settings ",(0,y.jsx)(_.ChevronRight,{size:14,className:"text-muted-foreground"})]}):null;return t?(0,y.jsxs)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,y.jsx)("div",{className:"flex items-start justify-between",children:(0,y.jsxs)("div",{className:"flex items-center gap-3",children:[(0,y.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-green-500/10",children:(0,y.jsx)(_.ShieldCheck,{size:22,className:"text-green-500"})}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsx)("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),(0,y.jsxs)(u,{variant:"secondary",className:"rounded-full bg-green-500/10 px-2 py-0 text-xs font-medium text-green-500",children:[(0,y.jsx)(_.CheckCircle2,{size:12,className:"mr-0.5 inline"})," Deployed"]})]}),(0,y.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Your wallet has been upgraded to a smart wallet"})]})]})}),(0,y.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[[_.Fuel,"Gas Sponsorship","Enabled"],[_.RefreshCw,"Recovery","Enabled"]].map(([p,x,w],f)=>(0,y.jsxs)("div",{className:"rounded-lg bg-muted/50 p-3",children:[(0,y.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[fr.default.createElement(p,{size:14}),(0,y.jsx)("span",{children:x})]}),(0,y.jsx)("div",{className:"mt-1 text-sm font-medium text-foreground",children:w})]},f))}),s&&(0,y.jsx)("div",{className:"mt-4",children:d})]}):e?(0,y.jsx)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:(0,y.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,y.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:(0,y.jsx)(_.LoaderCircle,{size:28,className:"animate-spin text-primary"})}),(0,y.jsx)("h3",{className:"mb-1 text-base font-semibold text-foreground",children:"Deploying Smart Wallet..."}),(0,y.jsx)("p",{className:"mb-4 text-sm text-muted-foreground",children:"Please wait, contract deployment may take a few seconds"}),(0,y.jsx)("div",{className:"h-2 w-full max-w-[200px] overflow-hidden rounded-full bg-muted",children:(0,y.jsx)("div",{className:"h-full w-full animate-pulse rounded-full bg-primary",style:{animationDuration:"1.5s"}})})]})}):o?(0,y.jsxs)(c,{className:"w-full rounded-xl border border-destructive/30 bg-destructive/5 p-5 shadow-sm",children:[(0,y.jsxs)("div",{className:"flex items-start gap-3",children:[(0,y.jsx)("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-destructive/10",children:(0,y.jsx)(_.AlertCircle,{size:18,className:"text-destructive"})}),(0,y.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,y.jsx)("h4",{className:"text-sm font-semibold text-destructive",children:"Deployment Failed"}),(0,y.jsx)("p",{className:"mt-1 text-xs text-destructive/80 break-words",children:o}),a&&(0,y.jsxs)(l,{variant:"outline",size:"sm",className:"mt-3 border-destructive/30 text-destructive hover:bg-destructive/10",onClick:a,children:[(0,y.jsx)(_.RotateCcw,{size:13})," Retry"]})]})]}),s&&(0,y.jsx)("div",{className:"mt-3",children:d})]}):(0,y.jsxs)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,y.jsxs)("div",{className:"flex items-center gap-3",children:[(0,y.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/10",children:(0,y.jsx)(_.Shield,{size:20,className:"text-amber-500"})}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsx)("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),(0,y.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:"Not Upgraded"})]}),(0,y.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Upgrade to a smart wallet for more features"})]})]}),(0,y.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,y.jsx)(En,{icon:_.Zap,color:"text-green-500",text:"No ETH needed for transactions \u2014 pay gas with USDC/USDT"}),(0,y.jsx)(En,{icon:_.Fuel,color:"text-blue-500",text:"Optional dApp sponsorship, zero-cost transactions"}),(0,y.jsx)(En,{icon:_.ShieldCheck,color:"text-purple-500",text:"Secure recovery mechanism, no fear of losing keys"})]}),r&&(0,y.jsxs)(l,{className:"mt-4 w-full",onClick:r,children:["Upgrade Now",n!==void 0&&(0,y.jsxs)("span",{className:"ml-1 text-xs opacity-80",children:["(Estimated gas fee: ",ua(n),")"]})]}),s&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mt-4 mb-3 flex items-center gap-2",children:[(0,y.jsx)("div",{className:"h-px flex-1 bg-border"}),(0,y.jsx)("span",{className:"text-xs text-muted-foreground",children:"or"}),(0,y.jsx)("div",{className:"h-px flex-1 bg-border"})]}),d]})]})}function En({icon:t,color:e,text:n}){return(0,y.jsxs)("div",{className:"flex items-center gap-2.5 text-sm text-foreground/80",children:[(0,y.jsx)(t,{size:14,className:`shrink-0 ${e}`}),(0,y.jsx)("span",{children:n})]})}var We=require("react"),j=require("lucide-react");var b=require("react/jsx-runtime"),ma=[{value:"simple",label:"Single Sign (default)",description:"Single key control, simple and secure",icon:(0,b.jsx)(j.Shield,{size:16})},{value:"multi-sig",label:"Multi-Sign (2-of-3)",description:"Requires multiple signers to authorize transactions",icon:(0,b.jsx)(j.Users,{size:16})},{value:"social-recovery",label:"Social Recovery",description:"Set guardian accounts to help recover",icon:(0,b.jsx)(j.KeyRound,{size:16})}],pa=[{value:"self",label:"Pay Self (ETH)",description:"Pay gas fees with ETH"},{value:"sponsor",label:"Sponsored by dApp",description:"dApp covers your gas fees"},{value:"erc20",label:"Pay with USDC/USDT",description:"Use ERC-20 tokens for gas"},{value:"custom",label:"Custom Paymaster URL",description:"Use a custom paymaster service"}],fa=[{value:"pimlico",label:"Pimlico",description:"High-performance bundler service"},{value:"stackup",label:"Stackup",description:"Decentralized bundler network"},{value:"alchemy",label:"Alchemy",description:"Alchemy AA infrastructure"},{value:"custom",label:"Custom Bundler URL",description:"Use custom bundler endpoint"}];function ga(){return{accountType:"simple",paymasterType:"self",customPaymasterUrl:"",bundlerPreset:"pimlico",customBundlerUrl:"",guardians:[],threshold:2}}function hr({currentConfig:t,onSave:e,onBack:n}){let o=B(),r=o.Button,s=o.Input,a=o.Card,i=o.Separator,[l,c]=(0,We.useState)({...ga(),...t}),[u,d]=(0,We.useState)(""),[p,x]=(0,We.useState)(!1),w=m=>N("flex cursor-pointer items-center gap-3 rounded-lg border px-4 py-3 transition-all duration-200",m?"border-primary bg-primary/5":"border-border hover:bg-accent"),f="w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:border-ring focus:ring-2 focus:ring-ring focus:ring-offset-2 transition-all duration-200",v=(0,We.useCallback)(()=>{e?.(l),x(!0),setTimeout(()=>x(!1),2e3)},[l,e]),R=(0,We.useCallback)(()=>{let m=u.trim();!m||l.guardians.includes(m)||(c(k=>({...k,guardians:[...k.guardians,m]})),d(""))},[u,l.guardians]);return(0,b.jsxs)(a,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,b.jsx)("div",{className:"flex items-center justify-between mb-5",children:(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,b.jsxs)(r,{variant:"ghost",size:"sm",onClick:n,children:[(0,b.jsx)(j.ArrowLeft,{size:15}),"Back"]}),(0,b.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Smart Wallet Settings"})]})}),(0,b.jsxs)("section",{className:"mb-6",children:[(0,b.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,b.jsx)(j.Shield,{size:15})," Verification Method"]}),(0,b.jsx)("div",{className:"space-y-2",children:ma.map(m=>(0,b.jsxs)("label",{className:w(l.accountType===m.value),children:[(0,b.jsx)("input",{type:"radio",name:"accountType",value:m.value,checked:l.accountType===m.value,onChange:()=>c(k=>({...k,accountType:m.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,b.jsx)("div",{className:"flex items-center gap-2 text-foreground",children:m.icon}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-sm font-medium text-foreground",children:m.label}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:m.description})]})]},m.value))})]}),l.accountType==="social-recovery"&&(0,b.jsxs)("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[(0,b.jsxs)("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,b.jsx)(j.KeyRound,{size:14})," Guardian Addresses"]}),(0,b.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set at least one guardian to help recover your wallet if you lose your key"}),l.guardians.length>0&&(0,b.jsx)("div",{className:"mb-3 space-y-1.5",children:l.guardians.map(m=>(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-card px-3 py-2 text-sm",children:[(0,b.jsxs)("span",{className:"font-mono text-xs text-foreground",children:[m.slice(0,8),"...",m.slice(-6)]}),(0,b.jsx)(r,{variant:"ghost",size:"icon",onClick:()=>c(k=>({...k,guardians:k.guardians.filter(P=>P!==m)})),children:(0,b.jsx)(j.X,{size:14})})]},m))}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(s,{type:"text",placeholder:"Enter guardian address (0x...)",value:u,onChange:m=>d(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),R())},className:"flex-1"}),(0,b.jsxs)(r,{size:"sm",onClick:R,disabled:!u.trim(),children:[(0,b.jsx)(j.Plus,{size:14})," Add"]})]})]}),l.accountType==="multi-sig"&&(0,b.jsxs)("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[(0,b.jsxs)("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,b.jsx)(j.Users,{size:14})," Signing Threshold"]}),(0,b.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set how many signers are needed to authorize a transaction"}),(0,b.jsx)("div",{className:"flex items-center gap-3",children:[1,2,3].map(m=>(0,b.jsxs)("label",{className:w(l.threshold===m),children:[(0,b.jsx)("input",{type:"radio",name:"threshold",value:m,checked:l.threshold===m,onChange:()=>c(k=>({...k,threshold:m})),className:"sr-only"}),m,"-of-3"]},m))})]}),(0,b.jsx)(i,{className:"my-4"}),(0,b.jsxs)("section",{className:"mb-6",children:[(0,b.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,b.jsx)(j.Fuel,{size:15})," Gas Fees"]}),(0,b.jsx)("div",{className:"space-y-2",children:pa.map(m=>(0,b.jsxs)("label",{className:w(l.paymasterType===m.value),children:[(0,b.jsx)("input",{type:"radio",name:"paymasterType",value:m.value,checked:l.paymasterType===m.value,onChange:()=>c(k=>({...k,paymasterType:m.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("div",{className:"text-sm font-medium text-foreground",children:m.label}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:m.description})]})]},m.value))}),l.paymasterType==="custom"&&(0,b.jsx)("div",{className:"mt-3",children:(0,b.jsx)("input",{type:"text",placeholder:"Custom Paymaster URL",value:l.customPaymasterUrl,onChange:m=>c(k=>({...k,customPaymasterUrl:m.target.value})),className:f})})]}),(0,b.jsx)(i,{className:"my-4"}),(0,b.jsxs)("section",{className:"mb-6",children:[(0,b.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,b.jsx)(j.Wrench,{size:15})," Bundler"]}),(0,b.jsx)("div",{className:"space-y-2",children:fa.map(m=>(0,b.jsxs)("label",{className:w(l.bundlerPreset===m.value),children:[(0,b.jsx)("input",{type:"radio",name:"bundlerPreset",value:m.value,checked:l.bundlerPreset===m.value,onChange:()=>c(k=>({...k,bundlerPreset:m.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("div",{className:"text-sm font-medium text-foreground",children:m.label}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:m.description})]})]},m.value))}),l.bundlerPreset==="custom"&&(0,b.jsx)("div",{className:"mt-3",children:(0,b.jsx)("input",{type:"text",placeholder:"Custom Bundler URL",value:l.customBundlerUrl,onChange:m=>c(k=>({...k,customBundlerUrl:m.target.value})),className:f})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsxs)(r,{className:"flex-1",onClick:v,children:[(0,b.jsx)(j.Save,{size:15}),p?"Saved \u2713":"Save Settings"]}),n&&(0,b.jsxs)(r,{variant:"outline",onClick:n,children:[(0,b.jsx)(j.ArrowLeft,{size:15}),"\u2190 Back to Simple Mode"]})]})]})}var Be=require("lucide-react");var br=require("@naculus/connect-appkit-react"),I=require("react/jsx-runtime"),ha={ok:{icon:(0,I.jsx)(Be.CheckCircle,{size:20}),label:"No problem found",colorClass:"text-muted-foreground",bgClass:"bg-muted",buttonVariant:"default"},warning:{icon:(0,I.jsx)(Be.AlertTriangle,{size:20}),label:"Warning",colorClass:"text-[hsl(var(--warning,38_92%_50%))]",bgClass:"bg-[hsl(var(--warning)/0.1)]",buttonVariant:"default"},blocked:{icon:(0,I.jsx)(Be.ShieldAlert,{size:20}),label:"Blocked",colorClass:"text-destructive",bgClass:"bg-destructive/10",buttonVariant:"destructive"}};function yr({address:t,open:e,onClose:n,onProceed:o}){let r=B(),s=r.Button,a=r.Dialog,i=r.DialogContent,l=r.DialogHeader,c=r.DialogTitle,{validation:u}=(0,br.useValidateDestination)({address:t}),{level:d,warning:p}=u,x=ha[d],w=d==="blocked",f=t.length>12?`${t.slice(0,6)}...${t.slice(-4)}`:t,v=m=>N("inline-flex items-center justify-center whitespace-nowrap rounded-lg","text-sm font-medium transition-all duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50","h-10 px-4 py-2",m==="outline"&&"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",m==="destructive"&&"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm",m==="default"&&"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm"),R=(0,I.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,I.jsxs)("div",{className:N("flex items-center gap-3 rounded-lg p-4",x.bgClass),children:[(0,I.jsx)("span",{className:x.colorClass,children:x.icon}),(0,I.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,I.jsx)("span",{className:N("text-sm font-semibold",x.colorClass),children:x.label}),(0,I.jsx)("span",{className:"text-xs text-muted-foreground break-all font-mono",children:f})]})]}),p&&(0,I.jsx)("p",{className:"text-sm text-muted-foreground m-0",children:p}),(0,I.jsxs)("div",{className:"flex gap-2 justify-end pt-2",children:[s?(0,I.jsx)(s,{onClick:n,variant:"outline",className:"w-full sm:w-auto",children:"Cancel"}):(0,I.jsx)("button",{type:"button",onClick:n,className:N(v("outline"),"w-full sm:w-auto"),children:"Cancel"}),o&&(s?(0,I.jsx)(s,{onClick:o,variant:w?"destructive":"default",disabled:w,className:"w-full sm:w-auto",children:"Proceed anyway"}):(0,I.jsx)("button",{type:"button",onClick:o,disabled:w,className:N(v(w?"destructive":"default"),"w-full sm:w-auto"),children:"Proceed anyway"}))]})]});return a&&i&&l&&c?(0,I.jsx)(a,{open:e,onOpenChange:m=>{m||n()},children:(0,I.jsxs)(i,{className:"sm:max-w-md",children:[(0,I.jsx)(l,{children:(0,I.jsx)(c,{children:"Address Warning"})}),R]})}):e?(0,I.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,I.jsx)("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:n}),(0,I.jsxs)("div",{role:"dialog","aria-modal":"true",className:"relative z-10 w-full max-w-sm rounded-xl border bg-card text-card-foreground shadow-2xl p-6",children:[(0,I.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,I.jsx)("h2",{className:"text-lg font-semibold m-0",children:"Address Warning"}),(0,I.jsx)("button",{onClick:n,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close",children:(0,I.jsx)(Be.X,{size:16})})]}),R]})]}):null}var mt=require("lucide-react");var F=require("react/jsx-runtime");function xr({wallets:t,onSelect:e,loading:n=!1,error:o=null}){let s=B().Card,a=i=>s?(0,F.jsx)(s,{className:"p-4",children:i}):(0,F.jsx)("div",{className:"rounded-xl border bg-card text-card-foreground shadow-sm p-4",children:i});return n?a((0,F.jsxs)("div",{className:"flex flex-col gap-3",children:[Array.from({length:3}).map((i,l)=>(0,F.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg animate-pulse",children:[(0,F.jsx)("div",{className:"h-10 w-10 rounded-full bg-muted"}),(0,F.jsx)("div",{className:"h-4 w-32 rounded bg-muted"})]},l)),(0,F.jsx)("p",{className:"text-xs text-muted-foreground text-center m-0",children:"Detecting wallets..."})]})):o?a((0,F.jsxs)("div",{className:"flex flex-col items-center gap-3 py-4",children:[(0,F.jsx)(mt.AlertCircle,{size:24,className:"text-destructive"}),(0,F.jsx)("p",{className:"text-sm text-destructive m-0 font-medium",children:o})]})):t.length===0?a((0,F.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,F.jsx)(mt.Wallet,{size:32,className:"text-muted-foreground"}),(0,F.jsxs)("p",{className:"text-sm text-muted-foreground m-0 text-center",children:["No wallets detected.",(0,F.jsx)("br",{}),"Install a browser wallet extension to get started."]})]})):(0,F.jsx)("div",{className:"flex flex-col gap-2",children:t.map(i=>(0,F.jsxs)("button",{type:"button",onClick:()=>e(i),className:N("flex items-center gap-3 w-full p-3 rounded-lg","border border-input bg-card hover:bg-accent hover:text-accent-foreground","transition-all duration-200 cursor-pointer","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[i.icon?(0,F.jsx)("img",{src:i.icon,alt:i.name,className:"h-10 w-10 rounded-full object-cover shrink-0",onError:l=>{l.target.style.display="none"}}):(0,F.jsx)("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center shrink-0",children:(0,F.jsx)(mt.Wallet,{size:18,className:"text-muted-foreground"})}),(0,F.jsxs)("div",{className:"flex flex-col items-start gap-0.5 text-left min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-medium truncate w-full",children:i.name}),(0,F.jsx)("span",{className:"text-xs text-muted-foreground truncate w-full",children:i.rdns})]})]},i.id))})}0&&(module.exports={AccountButton,AccountSelector,AccountSelectorView,AddressWarningDialog,AppKit,AppKitButton,AppKitChainSelector,ChainSelector,ConnectButton,ErrorBoundary,PasskeySetup,PasskeySetupView,PassphraseDialog,PassphraseDialogView,QRCodeModal,RouteSelector,SeedPhraseBackup,SignInButton,SmartWalletSettings,SmartWalletToggle,ThemeProvider,WalletConnectProvider,WalletPicker,WalletSecurityPanel,WalletSecurityPanelView,Web3ComponentProvider,Web3ConnectUI,cn,useAppKit,useComponent,useComponentRegistry,useDetectionMode,useEIP6963,useIsMobile,useTheme,useThemeVariable,useWalletConnect,useWalletConnectOptional});
|
|
11
|
+
}`}function qs(t){let e=new Set;if(t!=="computed"||typeof document>"u")return e;for(let n of Object.keys(Ye)){let o=Ye[n],r=getComputedStyle(document.documentElement).getPropertyValue(o.name).trim();r&&r!==o.fallback&&e.add(n)}return e}function It({children:t,theme:e={},defaultDark:n=!1,priority:o="fallback"}){let[r,s]=(0,$.useState)(e),[a,i]=(0,$.useState)(n);(0,$.useEffect)(()=>{bn()},[r]);let[l,c]=(0,$.useState)(new Set);(0,$.useEffect)(()=>{c(qs(o))},[o]);let u=(0,$.useMemo)(()=>{if(o==="fallback"||l.size===0)return r;let f={};for(let[v,R]of Object.entries(r))!l.has(v)&&R&&(f[v]=R);return f},[r,o,l]),d=(0,$.useMemo)(()=>Ks(u),[u]);(0,$.useEffect)(()=>{if(typeof document>"u")return;let f=document.documentElement;a?f.classList.add("dark"):f.classList.remove("dark"),bn()},[a]);let m=(0,$.useMemo)(()=>"w3c-theme-"+Math.random().toString(36).slice(2,9),[]),y=(0,$.useCallback)(()=>i(f=>!f),[]),w=(0,$.useMemo)(()=>({theme:r,isDark:a,setTheme:s,toggleDarkMode:y}),[r,a,y]);return(0,Lt.jsxs)(Qo.Provider,{value:w,children:[d?(0,Lt.jsx)("style",{id:m,dangerouslySetInnerHTML:{__html:d}}):null,t]})}function yn(){return(0,$.useContext)(Qo)}function $o(t){let{theme:e}=yn(),[n,o]=(0,$.useState)("");return(0,$.useEffect)(()=>{let r=Ye[t];if(!r)return;let s=e[t];if(s){o(s);return}if(typeof document>"u"){o(r.fallback);return}let a=getComputedStyle(document.documentElement).getPropertyValue(r.name).trim();o(a||r.fallback)},[t,e]),n||Ye[t]?.fallback||""}var Je=require("react/jsx-runtime"),Yo=(0,Xe.createContext)({mode:"walletconnect"});function Jo(){return(0,Xe.useContext)(Yo)}function Ze({config:t,children:e,autoConnect:n=!1,detectionMode:o="walletconnect",theme:r,defaultDark:s=!1,themePriority:a="computed"}){let i=(0,Xe.useMemo)(()=>({mode:o}),[o]),l=o==="walletconnect"||o==="auto";return(0,Je.jsx)(Yo.Provider,{value:i,children:(0,Je.jsx)(It,{theme:r,defaultDark:s,priority:a,children:(0,Je.jsx)(zt,{components:{QRCodeModal:Qe},children:(0,Je.jsx)(Go.Web3ConnectProvider,{config:t,autoConnect:n,children:l?(0,Je.jsx)(ht,{children:e}):e})})})})}var vn=require("react/jsx-runtime");function js({className:t,variant:e,size:n,...o}){let r=["inline-flex items-center justify-center gap-2 rounded-lg border px-4 py-2","text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",e==="outline"?"border-input bg-transparent hover:bg-accent":"border-primary bg-primary text-primary-foreground hover:bg-primary/90",n==="sm"?"h-9 px-3":n==="icon"?"h-10 w-10 p-0":"h-10",t].filter(Boolean).join(" ");return(0,vn.jsx)("button",{type:"button",className:r,...o})}var xn={Button:js,ConnectButton:we,AccountButton:vt,ChainSelector:Le,QRCodeModal:Qe,SignInButton:Mt,SeedPhraseBackup:$e,ErrorBoundary:Ge,Web3ConnectUI:Ze},Xo=(0,et.createContext)({});function zt({children:t,components:e={}}){let n=(0,et.useMemo)(()=>({...xn,...e}),[e]);return(0,vn.jsx)(Xo.Provider,{value:n,children:t})}function B(){return(0,et.useContext)(Xo)}function Zo(t){return B()[t]}var U=require("react/jsx-runtime");function er(t){let e=t&&typeof t=="object"&&"details"in t?t.details:void 0,n=e instanceof Error?`${e.name}: ${e.message}`:e;tr.logger.error("ui/ChainSelector","switchChain failed",t,n)}function ut({chainId:t,className:e}){let n=xt(t);return n?(0,U.jsx)("span",{className:N("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function Le({className:t,showLabel:e=!0,variant:n="dropdown"}){let{currentChain:o,availableChains:r,switchChain:s,isEvm:a}=(0,Wt.useChain)(),{isConnected:i}=(0,Wt.useWallet)(),[l,c]=(0,tt.useState)(!1),d=B().Button,m=(0,tt.useRef)(null);if((0,tt.useEffect)(()=>{function f(v){m.current&&!m.current.contains(v.target)&&c(!1)}return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]),!i)return null;let y=o?.name??"Unknown Chain",w=r.length>1;return n==="minimal"?(0,U.jsxs)("div",{className:N("inline-flex items-center gap-1.5 text-xs text-muted-foreground",t),children:[o&&(0,U.jsx)(ut,{chainId:o.caip2,className:"h-3.5 w-3.5"}),y]}):n==="buttons"?(0,U.jsx)("div",{className:N("flex flex-wrap gap-2",t),children:r.map(f=>{let v=f.caip2,R=v===o?.caip2;return(0,U.jsxs)(d,{className:R?N("bg-accent","border-primary"):"",onClick:()=>{R||s(v).catch(er)},children:[(0,U.jsx)(ut,{chainId:v,className:"h-4 w-4"}),f.name,f.token&&(0,U.jsx)("span",{className:"text-xs opacity-60",children:f.token})]},v)})}):w?(0,U.jsxs)("div",{ref:m,className:N("relative inline-block",t),children:[(0,U.jsxs)(d,{onClick:()=>c(!l),children:[o&&(0,U.jsx)(ut,{chainId:o.caip2,className:"h-4 w-4"}),y,(0,U.jsx)("svg",{className:N("h-3 w-3 transition-transform",l&&"rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,U.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),l&&(0,U.jsxs)("div",{className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] rounded-lg border bg-card p-1 shadow-lg animate-in fade-in zoom-in-95 duration-200",children:[e&&(0,U.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Switch Network"}),r.map(f=>{let v=f.caip2,R=v===o?.caip2;return(0,U.jsxs)(d,{onClick:()=>{R||s(v).catch(er),c(!1)},className:N("flex w-full items-center gap-2 rounded-md px-2 py-2 text-sm transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",R?"bg-accent font-medium":"hover:bg-accent/50"),children:[(0,U.jsx)(ut,{chainId:v,className:"h-4 w-4"}),(0,U.jsx)("span",{className:"flex-1 text-left",children:f.name}),f.token&&(0,U.jsx)("span",{className:"text-xs text-muted-foreground",children:f.token}),R&&(0,U.jsx)("svg",{className:"h-4 w-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,U.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},v)})]})]}):(0,U.jsxs)("div",{className:N("inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm opacity-60 cursor-default",t),children:[o&&(0,U.jsx)(ut,{chainId:o.caip2,className:"h-4 w-4"}),y]})}var nr=require("@naculus/connect-appkit-react"),ve=require("lucide-react"),Te=require("react");var q=require("react/jsx-runtime"),$s={eip155:{name:"Ethereum & EVM",detail:"One address across Ethereum, Polygon, Arbitrum and every EVM chain"},solana:{name:"Solana",detail:"A separate key on a different curve"}};function Gs(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Ys({account:t,isActive:e,onSelect:n}){let[o,r]=(0,Te.useState)(!1),s=$s[t.namespace]??{name:t.namespace,detail:""},a=(0,Te.useCallback)(i=>{i.stopPropagation();let l=navigator?.clipboard?.writeText;l&&l.call(navigator.clipboard,t.address).then(()=>{r(!0),setTimeout(()=>r(!1),1500)},()=>{})},[t.address]);return(0,q.jsxs)("div",{role:"radio",tabIndex:0,"aria-checked":e,onClick:n,onKeyDown:i=>{i.target===i.currentTarget&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),n())},className:N("flex w-full items-center gap-3 rounded-md border px-3 py-2.5 text-left text-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e?"border-primary bg-accent":"border-border hover:bg-accent/50"),children:[(0,q.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,q.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[s.name,e&&(0,q.jsx)("span",{className:"rounded-sm bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-primary",children:"Signing"})]}),(0,q.jsx)("span",{className:"truncate font-mono text-xs text-muted-foreground",children:Gs(t.address)})]}),(0,q.jsx)("button",{type:"button","aria-label":`Copy ${s.name} address`,onClick:a,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o?(0,q.jsx)(ve.Check,{size:14}):(0,q.jsx)(ve.Copy,{size:14})}),e&&(0,q.jsx)(ve.Check,{size:16,className:"shrink-0 text-primary"})]})}function Cn({className:t,hideBackfill:e=!1,onSelect:n,accounts:o,activeNamespace:r,canDerive:s,setActiveNamespace:a,backfillAccounts:i}){let[l,c]=(0,Te.useState)(!1),[u,d]=(0,Te.useState)(null),m=(0,Te.useCallback)(f=>{if(f!==r)try{a(f),d(null),n?.(f)}catch(v){d(v instanceof Error?v.message:"Could not switch account")}},[r,a,n]),y=(0,Te.useCallback)(async()=>{c(!0),d(null);try{await i()}catch(f){d(f instanceof Error?f.message:"Could not derive accounts")}finally{c(!1)}},[i]);if(o.length===0)return null;let w=!e&&s;return(0,q.jsxs)("div",{className:N("flex flex-col gap-2",t),children:[(0,q.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,q.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Accounts"}),(0,q.jsx)("span",{className:"text-[11px] text-muted-foreground",children:"Chooses the signing key, not the network"})]}),(0,q.jsx)("div",{role:"radiogroup","aria-label":"Wallet accounts",className:"flex flex-col gap-1.5",children:o.map(f=>(0,q.jsx)(Ys,{account:f,isActive:f.namespace===r,onSelect:()=>m(f.namespace)},f.namespace))}),w&&(0,q.jsxs)("button",{type:"button",onClick:y,disabled:l,className:N("flex items-center justify-center gap-2 rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground","hover:bg-accent/50 disabled:opacity-60"),children:[l?(0,q.jsx)(ve.Loader2,{size:14,className:"animate-spin"}):(0,q.jsx)(ve.Plus,{size:14}),l?"Deriving\u2026":"Show accounts this phrase already owns"]}),u&&(0,q.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:u})]})}function or(t){let{wallet:e,accounts:n,activeNamespace:o,setActiveNamespace:r,backfillAccounts:s}=(0,nr.useEmbeddedWallet)();return e?(0,q.jsx)(Cn,{...t,accounts:n,activeNamespace:o,canDerive:e.recoveryAvailable&&n.length<2,setActiveNamespace:r,backfillAccounts:s}):null}var Ce=require("lucide-react"),sr=require("@naculus/connect-appkit-react");var W=require("react/jsx-runtime"),Js={critical:Ce.ShieldAlert,warning:Ce.AlertTriangle,info:Ce.Info},Xs={critical:"text-destructive",warning:"text-amber-600 dark:text-amber-500",info:"text-muted-foreground"};function rr(t){return t>=90?"text-emerald-600 dark:text-emerald-500":t>=70?"text-amber-600 dark:text-amber-500":"text-destructive"}function Zs({finding:t}){let e=Js[t.severity]??Ce.Info;return(0,W.jsxs)("li",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[(0,W.jsx)(e,{size:16,className:N("mt-0.5 shrink-0",Xs[t.severity])}),(0,W.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,W.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,W.jsx)("span",{className:"text-sm font-medium",children:t.title}),t.deduction>0&&(0,W.jsxs)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:["\u2212",t.deduction]})]}),(0,W.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:t.detail}),t.remedy&&(0,W.jsxs)("p",{className:"text-xs leading-relaxed",children:[(0,W.jsx)("span",{className:"font-medium",children:"What helps: "}),(0,W.jsx)("span",{className:"text-muted-foreground",children:t.remedy})]})]})]})}function wn({className:t,hideInformational:e=!1,report:n}){if(!n)return null;let{score:o,level:r,findings:s,encrypted:a,backend:i,unlock:l}=n,c=e?s.filter(d=>d.deduction>0):s,u=s.every(d=>d.deduction===0);return(0,W.jsxs)("div",{className:N("flex flex-col gap-3",t),children:[(0,W.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border px-4 py-3",children:[(0,W.jsx)(Ce.ShieldCheck,{size:22,className:N("shrink-0",rr(o))}),(0,W.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,W.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,W.jsx)("span",{className:N("text-2xl font-semibold tabular-nums",rr(o)),children:o}),(0,W.jsx)("span",{className:"text-sm text-muted-foreground",children:"/ 100"}),(0,W.jsxs)("span",{className:"ml-auto text-xs text-muted-foreground",children:["Tier ",r]})]}),(0,W.jsxs)("span",{className:"text-xs text-muted-foreground",children:[i==="localStorage"?"localStorage":"IndexedDB",a?" \xB7 encrypted":" \xB7 not encrypted",l.sealedWith?.includes("prf")?" \xB7 passkey":""]})]})]}),u?(0,W.jsx)("p",{className:"text-xs text-muted-foreground",children:"Nothing is holding this score down."}):(0,W.jsx)("p",{className:"text-xs text-muted-foreground",children:"Scored against this SDK's own published rubric, not an external standard. Each item below names the points it costs."}),(0,W.jsx)("ul",{className:"flex flex-col gap-1.5",children:c.map(d=>(0,W.jsx)(Zs,{finding:d},d.id))})]})}function ar(t){let{securityReport:e}=(0,sr.useEmbeddedWallet)();return(0,W.jsx)(wn,{...t,report:e})}var he=require("react"),Pe=require("lucide-react"),ir=require("@naculus/connect-appkit-react");var D=require("react/jsx-runtime"),Nn=8,ea=12;function kn({className:t,request:e,submit:n,cancel:o}){let[r,s]=(0,he.useState)(""),[a,i]=(0,he.useState)(""),[l,c]=(0,he.useState)(!1),u=(0,he.useRef)(null),d=e?.intent==="create";(0,he.useEffect)(()=>{if(!e){s(""),i(""),c(!1);return}s(""),i(""),u.current?.focus()},[e]);let m=d&&r.length>0&&r.length<Nn,y=d&&a.length>0&&a!==r,w=d?r.length>=Nn&&a===r:r.length>0,f=(0,he.useCallback)(v=>{v.preventDefault(),w&&n(r)},[w,n,r]);return e?(0,D.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"presentation",children:(0,D.jsxs)("form",{role:"dialog","aria-modal":"true","aria-label":d?"Choose a passphrase":"Unlock your wallet",onSubmit:f,className:N("flex w-full max-w-sm flex-col gap-4 rounded-lg border border-border bg-card p-5 shadow-lg",t),children:[(0,D.jsxs)("div",{className:"flex items-center gap-2",children:[(0,D.jsx)(Pe.KeyRound,{size:18,className:"shrink-0 text-primary"}),(0,D.jsx)("h2",{className:"text-base font-semibold",children:d?"Choose a passphrase":"Unlock your wallet"})]}),e.previousError&&(0,D.jsx)("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:e.previousError}),(0,D.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:d?"This encrypts your wallet on this device. Without it, anything that can run script on this page can read your keys.":"Your wallet is encrypted on this device. Enter the passphrase you chose to open it."}),(0,D.jsxs)("label",{className:"flex flex-col gap-1.5",children:[(0,D.jsx)("span",{className:"text-xs font-medium",children:"Passphrase"}),(0,D.jsxs)("span",{className:"relative flex items-center",children:[(0,D.jsx)("input",{ref:u,type:l?"text":"password",value:r,onChange:v=>s(v.target.value),autoComplete:d?"new-password":"current-password",autoFocus:!0,className:"w-full rounded-md border border-border bg-background px-3 py-2 pr-9 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),(0,D.jsx)("button",{type:"button","aria-label":l?"Hide passphrase":"Show passphrase",onClick:()=>c(v=>!v),className:"absolute right-2 text-muted-foreground hover:text-foreground",children:l?(0,D.jsx)(Pe.EyeOff,{size:15}):(0,D.jsx)(Pe.Eye,{size:15})})]})]}),d&&(0,D.jsxs)("label",{className:"flex flex-col gap-1.5",children:[(0,D.jsx)("span",{className:"text-xs font-medium",children:"Type it again"}),(0,D.jsx)("input",{type:l?"text":"password",value:a,onChange:v=>i(v.target.value),autoComplete:"new-password",className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),m&&(0,D.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["At least ",Nn," characters."]}),y&&(0,D.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:"These do not match."}),d&&!m&&r.length>0&&r.length<ea&&(0,D.jsx)("p",{className:"text-xs text-muted-foreground",children:"Short. Several ordinary words are far harder to guess than a short one with symbols in it."}),d&&(0,D.jsxs)("p",{className:"flex gap-2 rounded-md bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-500",children:[(0,D.jsx)(Pe.ShieldAlert,{size:14,className:"mt-0.5 shrink-0"}),(0,D.jsx)("span",{children:"If you forget this, nothing can open this copy of the wallet \u2014 not us, not your browser. Your recovery phrase is the only thing that gets it back."})]}),(0,D.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,D.jsx)("button",{type:"button",onClick:()=>o(),className:"rounded-md border border-border px-3 py-2 text-sm hover:bg-accent",children:"Cancel"}),(0,D.jsx)("button",{type:"submit",disabled:!w,className:"rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:d?"Encrypt wallet":"Unlock"})]})]})}):null}function lr(t){let{request:e,submit:n,cancel:o}=(0,ir.usePassphraseGate)();return(0,D.jsx)(kn,{...t,request:e,submit:n,cancel:o})}var ze=require("react"),de=require("lucide-react"),Vt=require("@naculus/connect-appkit-react");var O=require("react/jsx-runtime");function Rn({className:t,passkeys:e,unlock:n,onRegistered:o}){let[r,s]=(0,ze.useState)(!1),[a,i]=(0,ze.useState)(null),[l,c]=(0,ze.useState)(!1),u=!!e?.hasCredential?.()||l,d=(0,ze.useCallback)(async()=>{if(e){s(!0),i(null);try{await e.createPasskey(),c(!0),await o?.()}catch(f){i(f instanceof Error?f.message:"Could not register a passkey")}finally{s(!1)}}},[e,o]);if(!e)return null;let m=n?.sealedWith?.includes("prf")??!1,y=null;if(u)switch(n?.prf){case"available":y=m?{tone:"good",icon:(0,O.jsx)(de.ShieldCheck,{size:16}),title:"Your passkey unlocks this wallet",detail:"Opening it needs your fingerprint or face, not a value a script on this page can supply."}:{tone:"warn",icon:(0,O.jsx)(de.TriangleAlert,{size:16}),title:"Registered, but not applied yet",detail:"This device can produce the key material. The next time the wallet is saved, the record is sealed under it."};break;case"unavailable":y={tone:"bad",icon:(0,O.jsx)(de.ShieldAlert,{size:16}),title:"This passkey cannot unlock the wallet",detail:"The authenticator did not return the key material. Firefox does not implement the extension, and a passkey created before it was requested cannot have it added afterwards \u2014 a new one has to be registered on a browser that supports it."};break;default:y={tone:"neutral",icon:(0,O.jsx)(de.Fingerprint,{size:16}),title:"A passkey is registered",detail:"Whether it can unlock this wallet is not known until the wallet is opened once. It will be used if it works."};break}let w={good:"text-emerald-600 dark:text-emerald-500",warn:"text-amber-600 dark:text-amber-500",bad:"text-destructive",neutral:"text-muted-foreground"};return(0,O.jsxs)("div",{className:N("flex flex-col gap-3",t),children:[y?(0,O.jsxs)("div",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[(0,O.jsx)("span",{className:N("mt-0.5 shrink-0",w[y.tone]),children:y.icon}),(0,O.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,O.jsx)("span",{className:"text-sm font-medium",children:y.title}),(0,O.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:y.detail})]})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"A passkey raises what it takes to read your stored keys from \u201Cany script on this page\u201D to your fingerprint or face. The passphrase keeps working, so a broken or replaced authenticator does not cost you this copy."}),(0,O.jsxs)("p",{className:"flex gap-2 rounded-md bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-500",children:[(0,O.jsx)(de.ShieldAlert,{size:14,className:"mt-0.5 shrink-0"}),(0,O.jsx)("span",{children:"This protects the copy on this device. It does not back up your wallet \u2014 the recovery phrase is still the only thing that survives losing this device."})]}),(0,O.jsxs)("button",{type:"button",onClick:d,disabled:r,className:"flex items-center justify-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-60",children:[r?(0,O.jsx)(de.Loader2,{size:15,className:"animate-spin"}):(0,O.jsx)(de.Fingerprint,{size:15}),r?"Waiting for your device\u2026":"Protect with a passkey"]})]}),a&&(0,O.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:a})]})}function cr(t){let{client:e}=(0,Vt.useWeb3)(),{securityReport:n,hasWallet:o}=(0,Vt.useEmbeddedWallet)(),r=(0,ze.useCallback)(async()=>{let s=e?.embeddedConnector;s&&o&&await s.save()},[e,o]);return(0,O.jsx)(Rn,{...t,passkeys:e?.passkeysConnector??null,unlock:n?.unlock,onRegistered:r})}var oe=require("@naculus/connect-appkit-react"),X=require("react");var fe=require("react/jsx-runtime"),dr=(0,X.createContext)(null);function Sn(){let t=(0,X.useContext)(dr);if(!t)throw new Error("useAppKit must be used within an <AppKit> component");return t}function Tn({projectId:t,metadata:e,enableEmbedded:n=!1,enablePasskeys:o=!1,chains:r,embeddedConfig:s,encryptionKey:a,siwx:i,children:l,className:c,autoConnect:u=!1,theme:d,defaultDark:m=!1,themePriority:y="computed",detectionMode:w="auto"}){let[f,v]=(0,X.useState)(!1),[R,p]=(0,X.useState)(!1),k=(0,X.useMemo)(()=>({projectId:t,metadata:e,enableEmbedded:n,enablePasskeys:o,chains:r,embeddedConfig:s,encryptionKey:a,siwx:i}),[t,e,n,o,r,s,a,i]);return(0,fe.jsx)(Ze,{config:k,autoConnect:u,detectionMode:w,theme:d,defaultDark:m,themePriority:y,children:(0,fe.jsx)(ta,{className:c,open:f,setOpen:v,backupOpen:R,setBackupOpen:p,children:l})})}function ta({children:t,className:e,open:n,setOpen:o,backupOpen:r,setBackupOpen:s}){let{isConnected:a,isConnecting:i}=(0,oe.useWallet)(),{primaryAccount:l}=(0,oe.useAccount)(),{currentChain:c,availableChains:u,switchChain:d}=(0,oe.useChain)(),m=(0,oe.useEmbeddedWallet)(),{disconnect:y}=(0,oe.useDisconnect)(),{wallets:w,hasWallets:f}=He(),{formatted:v}=(0,oe.useBalance)(),R=v??null,p=(0,X.useCallback)(async()=>{await y()},[y]),k=(0,X.useCallback)(()=>{m.confirmBackup(),s(!1)},[m,s]),P=(0,X.useCallback)(()=>{m.confirmBackup(),s(!1)},[m,s]),S=(0,X.useCallback)(()=>m.getPrivateKey(),[m]),Y=(0,X.useMemo)(()=>({connect:()=>o(!0),disconnect:p,isConnected:a,isConnecting:i,address:l,balance:R,balanceSymbol:c?.token??null,chainName:c?.name??null,availableChains:u.map(L=>({caip2:L.caip2,name:L.name,token:L.token})),switchChain:d,wallets:w,hasWallets:f,backupPending:m.backupPending,seedPhrase:m.seedPhrase,confirmBackup:k,skipBackup:P,open:n,setOpen:o}),[a,i,l,R,c,u,d,w,f,m.backupPending,m.seedPhrase,k,P,p,n,o]);return(0,X.useEffect)(()=>{m.seedPhrase&&m.backupPending&&s(!0)},[m.seedPhrase,m.backupPending,s]),(0,fe.jsxs)(dr.Provider,{value:Y,children:[t,m.seedPhrase&&r&&(0,fe.jsx)($e,{seedPhrase:m.seedPhrase,onConfirm:k,onSkip:P,onExportPrivateKey:S,open:r,onOpenChange:s})]})}function Pn({className:t}){let e=Sn(),{connectInjected:n}=(0,oe.useWeb3)(),{primaryAccount:o}=(0,oe.useAccount)(),{disconnect:r}=(0,oe.useDisconnect)(),s=(0,X.useCallback)(async(a,i,l)=>{a==="injected"&&(await n(l),i())},[n]);return e.isConnected&&o?(0,fe.jsxs)("div",{className:N("inline-flex items-center gap-2",t),children:[(0,fe.jsx)(Le,{variant:"minimal"}),(0,fe.jsx)(we,{isConnected:e.isConnected,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:s,className:t})]}):(0,fe.jsx)(we,{isConnected:e.isConnected,isConnecting:e.isConnecting,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:s,className:t})}function Bn({className:t,variant:e="dropdown"}){return(0,fe.jsx)(Le,{className:t,variant:e})}try{let t=xn;t&&Object.assign(t,{AppKit:Tn,AppKitButton:Pn,AppKitChainSelector:Bn})}catch{}var re=require("lucide-react");var h=require("react/jsx-runtime");function na(t){if(t<1e3)return"<1s";if(t<6e4)return`~${Math.round(t/1e3)}s`;let e=Math.floor(t/6e4),n=Math.round(t%6e4/1e3);return n>0?`~${e}m ${n}s`:`~${e}m`}function ur(t){return t.symbol||"UNKNOWN"}function oa(t){let e=t.toLowerCase();return e.includes("lifi")?"default":e.includes("axelar")?"secondary":"outline"}function ra(t){return t.length>12?`${t.slice(0,6)}...${t.slice(-6)}`:t}function sa({route:t,onSelect:e}){let n=B(),o=n.Button,r=n.Badge,s=t.provider??"Route";return(0,h.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4 transition-colors hover:bg-accent/30",children:[(0,h.jsxs)("div",{className:"flex flex-col gap-1.5 min-w-0",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[r?(0,h.jsx)(r,{variant:oa(s),children:s}):(0,h.jsx)("span",{className:"inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",children:s}),t.steps.length>1&&(0,h.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t.steps.length," steps"]})]}),(0,h.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm",children:[(0,h.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,h.jsx)(re.DollarSign,{className:"h-3.5 w-3.5"}),"$",t.gasCosts.totalUsd]}),(0,h.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,h.jsx)(re.Clock,{className:"h-3.5 w-3.5"}),na(t.steps.reduce((a,i)=>{let l=t.estimatedTime>0?15e3:0;return a+l},0))]}),(0,h.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[t.gasCosts.totalUsd," cost"]})]})]}),(0,h.jsx)(o,{variant:"outline",size:"sm",onClick:e,children:"Select"})]})}function aa(){let e=B().Skeleton;return(0,h.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"route-selector-loading",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,h.jsx)(re.Loader2,{className:"h-4 w-4 animate-spin"}),(0,h.jsx)("span",{children:"Fetching best routes..."})]}),[1,2,3].map(n=>(0,h.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4",children:[(0,h.jsx)("div",{className:"flex flex-col gap-2 flex-1",children:e?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(e,{className:"h-4 w-24"}),(0,h.jsx)(e,{className:"h-3 w-48"})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),(0,h.jsx)("div",{className:"h-3 w-48 animate-pulse rounded bg-muted"})]})}),e?(0,h.jsx)(e,{className:"h-8 w-20 rounded-md"}):(0,h.jsx)("div",{className:"h-8 w-20 animate-pulse rounded-md bg-muted"})]},n))]})}function ia(){return(0,h.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground","data-testid":"route-selector-empty",children:[(0,h.jsx)(re.AlertCircle,{className:"h-8 w-8 opacity-40"}),(0,h.jsx)("span",{children:"No routes found for this pair"}),(0,h.jsx)("span",{className:"text-xs",children:"Try a different token or amount"})]})}function la({error:t,onRetry:e}){let o=B().Button;return(0,h.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-6","data-testid":"route-selector-error",children:[(0,h.jsx)(re.XCircle,{className:"h-8 w-8 text-destructive"}),(0,h.jsx)("p",{className:"text-sm text-destructive font-medium",children:"Failed to fetch routes"}),(0,h.jsx)("p",{className:"text-xs text-muted-foreground max-w-xs text-center",children:t}),e&&(0,h.jsx)(o,{variant:"outline",size:"sm",onClick:e,children:"Retry"})]})}function ca(){let e=B().Progress;return(0,h.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6","data-testid":"route-selector-executing",children:[(0,h.jsx)(re.Loader2,{className:"h-6 w-6 animate-spin text-primary"}),(0,h.jsx)("p",{className:"text-sm font-medium",children:"Executing route..."}),(0,h.jsx)("p",{className:"text-xs text-muted-foreground",children:"Please confirm the transaction in your wallet"}),e?(0,h.jsx)(e,{value:50,className:"w-48 h-1.5"}):(0,h.jsx)("div",{className:"h-1.5 w-48 rounded-full bg-muted",children:(0,h.jsx)("div",{className:"h-full w-1/2 rounded-full bg-primary animate-pulse"})})]})}function da({txHash:t}){return(0,h.jsxs)("div",{className:"flex flex-col items-center gap-2 py-6","data-testid":"route-selector-success",children:[(0,h.jsx)(re.CheckCircle2,{className:"h-8 w-8 text-green-500"}),(0,h.jsx)("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Route executed successfully!"}),(0,h.jsxs)("p",{className:"text-xs text-muted-foreground font-mono",children:["TX: ",ra(t)]})]})}function mr({chainId:t,className:e}){let n=xt(`eip155:${t}`);return n?(0,h.jsx)("span",{className:N("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function pr({inputToken:t,outputToken:e,amount:n,routes:o=[],loading:r=!1,executing:s=!1,onRouteSelected:a,onCancel:i,successTxHash:l,error:c,className:u}){let d=B(),m=d.Card,y=d.Button;if(l)return(0,h.jsx)("div",{className:N("rounded-lg border border-border",u),children:(0,h.jsx)(da,{txHash:l})});if(s)return(0,h.jsx)("div",{className:N("rounded-lg border border-border",u),children:(0,h.jsx)(ca,{})});return m?(0,h.jsxs)(m,{className:N("p-4",u),children:[f(),v(),R()]}):(0,h.jsxs)("div",{className:N("rounded-lg border border-border p-4",u),children:[f(),v(),R()]});function f(){return!t&&!e?null:(0,h.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2 text-sm",children:[t&&(0,h.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[(0,h.jsx)(mr,{chainId:t.chainId,className:"h-4 w-4"}),n?`${n.toString()} `:"",ur(t)]}),t&&e&&(0,h.jsx)(re.ArrowRight,{className:"h-3.5 w-3.5 text-muted-foreground"}),e&&(0,h.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[(0,h.jsx)(mr,{chainId:e.chainId,className:"h-4 w-4"}),ur(e)]})]})}function v(){return r?(0,h.jsx)(aa,{}):c?(0,h.jsx)(la,{error:c}):o.length===0?(0,h.jsx)(ia,{}):(0,h.jsx)("div",{className:"flex flex-col gap-2","data-testid":"route-selector-routes",children:o.map((p,k)=>(0,h.jsx)(sa,{route:p,onSelect:()=>a?.(p)},`${p.fromChain}-${p.toChain}-${p.gasCosts.totalUsd}-${k}`))})}function R(){return!r&&o.length===0&&!c?null:(0,h.jsx)("div",{className:"mt-4 flex justify-end",children:(0,h.jsx)(y,{variant:"ghost",size:"sm",onClick:i,children:"Cancel"})})}}var fr=Ot(require("react"),1),_=require("lucide-react");var x=require("react/jsx-runtime");function ua(t){let e=Number(t)/1e18;return e<.001?`~${e.toFixed(6)} ETH`:`~${e.toFixed(3)} ETH`}function gr({isDeployed:t=!1,isDeploying:e=!1,estimatedGas:n,error:o=null,onUpgrade:r,onShowSettings:s,onRetry:a}){let i=B(),l=i.Button,c=i.Card,u=i.Badge,d=s?(0,x.jsxs)(l,{variant:"outline",className:"w-full",onClick:s,children:[(0,x.jsx)(_.Settings,{size:15})," Advanced Settings ",(0,x.jsx)(_.ChevronRight,{size:14,className:"text-muted-foreground"})]}):null;return t?(0,x.jsxs)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,x.jsx)("div",{className:"flex items-start justify-between",children:(0,x.jsxs)("div",{className:"flex items-center gap-3",children:[(0,x.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-green-500/10",children:(0,x.jsx)(_.ShieldCheck,{size:22,className:"text-green-500"})}),(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{className:"flex items-center gap-2",children:[(0,x.jsx)("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),(0,x.jsxs)(u,{variant:"secondary",className:"rounded-full bg-green-500/10 px-2 py-0 text-xs font-medium text-green-500",children:[(0,x.jsx)(_.CheckCircle2,{size:12,className:"mr-0.5 inline"})," Deployed"]})]}),(0,x.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Your wallet has been upgraded to a smart wallet"})]})]})}),(0,x.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[[_.Fuel,"Gas Sponsorship","Enabled"],[_.RefreshCw,"Recovery","Enabled"]].map(([m,y,w],f)=>(0,x.jsxs)("div",{className:"rounded-lg bg-muted/50 p-3",children:[(0,x.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[fr.default.createElement(m,{size:14}),(0,x.jsx)("span",{children:y})]}),(0,x.jsx)("div",{className:"mt-1 text-sm font-medium text-foreground",children:w})]},f))}),s&&(0,x.jsx)("div",{className:"mt-4",children:d})]}):e?(0,x.jsx)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:(0,x.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,x.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:(0,x.jsx)(_.LoaderCircle,{size:28,className:"animate-spin text-primary"})}),(0,x.jsx)("h3",{className:"mb-1 text-base font-semibold text-foreground",children:"Deploying Smart Wallet..."}),(0,x.jsx)("p",{className:"mb-4 text-sm text-muted-foreground",children:"Please wait, contract deployment may take a few seconds"}),(0,x.jsx)("div",{className:"h-2 w-full max-w-[200px] overflow-hidden rounded-full bg-muted",children:(0,x.jsx)("div",{className:"h-full w-full animate-pulse rounded-full bg-primary",style:{animationDuration:"1.5s"}})})]})}):o?(0,x.jsxs)(c,{className:"w-full rounded-xl border border-destructive/30 bg-destructive/5 p-5 shadow-sm",children:[(0,x.jsxs)("div",{className:"flex items-start gap-3",children:[(0,x.jsx)("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-destructive/10",children:(0,x.jsx)(_.AlertCircle,{size:18,className:"text-destructive"})}),(0,x.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,x.jsx)("h4",{className:"text-sm font-semibold text-destructive",children:"Deployment Failed"}),(0,x.jsx)("p",{className:"mt-1 text-xs text-destructive/80 break-words",children:o}),a&&(0,x.jsxs)(l,{variant:"outline",size:"sm",className:"mt-3 border-destructive/30 text-destructive hover:bg-destructive/10",onClick:a,children:[(0,x.jsx)(_.RotateCcw,{size:13})," Retry"]})]})]}),s&&(0,x.jsx)("div",{className:"mt-3",children:d})]}):(0,x.jsxs)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,x.jsxs)("div",{className:"flex items-center gap-3",children:[(0,x.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/10",children:(0,x.jsx)(_.Shield,{size:20,className:"text-amber-500"})}),(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{className:"flex items-center gap-2",children:[(0,x.jsx)("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),(0,x.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:"Not Upgraded"})]}),(0,x.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Upgrade to a smart wallet for more features"})]})]}),(0,x.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,x.jsx)(En,{icon:_.Zap,color:"text-green-500",text:"No ETH needed for transactions \u2014 pay gas with USDC/USDT"}),(0,x.jsx)(En,{icon:_.Fuel,color:"text-blue-500",text:"Optional dApp sponsorship, zero-cost transactions"}),(0,x.jsx)(En,{icon:_.ShieldCheck,color:"text-purple-500",text:"Secure recovery mechanism, no fear of losing keys"})]}),r&&(0,x.jsxs)(l,{className:"mt-4 w-full",onClick:r,children:["Upgrade Now",n!==void 0&&(0,x.jsxs)("span",{className:"ml-1 text-xs opacity-80",children:["(Estimated gas fee: ",ua(n),")"]})]}),s&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"mt-4 mb-3 flex items-center gap-2",children:[(0,x.jsx)("div",{className:"h-px flex-1 bg-border"}),(0,x.jsx)("span",{className:"text-xs text-muted-foreground",children:"or"}),(0,x.jsx)("div",{className:"h-px flex-1 bg-border"})]}),d]})]})}function En({icon:t,color:e,text:n}){return(0,x.jsxs)("div",{className:"flex items-center gap-2.5 text-sm text-foreground/80",children:[(0,x.jsx)(t,{size:14,className:`shrink-0 ${e}`}),(0,x.jsx)("span",{children:n})]})}var We=require("react"),j=require("lucide-react");var b=require("react/jsx-runtime"),ma=[{value:"simple",label:"Single Sign (default)",description:"Single key control, simple and secure",icon:(0,b.jsx)(j.Shield,{size:16})},{value:"multi-sig",label:"Multi-Sign (2-of-3)",description:"Requires multiple signers to authorize transactions",icon:(0,b.jsx)(j.Users,{size:16})},{value:"social-recovery",label:"Social Recovery",description:"Set guardian accounts to help recover",icon:(0,b.jsx)(j.KeyRound,{size:16})}],pa=[{value:"self",label:"Pay Self (ETH)",description:"Pay gas fees with ETH"},{value:"sponsor",label:"Sponsored by dApp",description:"dApp covers your gas fees"},{value:"erc20",label:"Pay with USDC/USDT",description:"Use ERC-20 tokens for gas"},{value:"custom",label:"Custom Paymaster URL",description:"Use a custom paymaster service"}],fa=[{value:"pimlico",label:"Pimlico",description:"High-performance bundler service"},{value:"stackup",label:"Stackup",description:"Decentralized bundler network"},{value:"alchemy",label:"Alchemy",description:"Alchemy AA infrastructure"},{value:"custom",label:"Custom Bundler URL",description:"Use custom bundler endpoint"}];function ga(){return{accountType:"simple",paymasterType:"self",customPaymasterUrl:"",bundlerPreset:"pimlico",customBundlerUrl:"",guardians:[],threshold:2}}function hr({currentConfig:t,onSave:e,onBack:n}){let o=B(),r=o.Button,s=o.Input,a=o.Card,i=o.Separator,[l,c]=(0,We.useState)({...ga(),...t}),[u,d]=(0,We.useState)(""),[m,y]=(0,We.useState)(!1),w=p=>N("flex cursor-pointer items-center gap-3 rounded-lg border px-4 py-3 transition-all duration-200",p?"border-primary bg-primary/5":"border-border hover:bg-accent"),f="w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:border-ring focus:ring-2 focus:ring-ring focus:ring-offset-2 transition-all duration-200",v=(0,We.useCallback)(()=>{e?.(l),y(!0),setTimeout(()=>y(!1),2e3)},[l,e]),R=(0,We.useCallback)(()=>{let p=u.trim();!p||l.guardians.includes(p)||(c(k=>({...k,guardians:[...k.guardians,p]})),d(""))},[u,l.guardians]);return(0,b.jsxs)(a,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,b.jsx)("div",{className:"flex items-center justify-between mb-5",children:(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,b.jsxs)(r,{variant:"ghost",size:"sm",onClick:n,children:[(0,b.jsx)(j.ArrowLeft,{size:15}),"Back"]}),(0,b.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Smart Wallet Settings"})]})}),(0,b.jsxs)("section",{className:"mb-6",children:[(0,b.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,b.jsx)(j.Shield,{size:15})," Verification Method"]}),(0,b.jsx)("div",{className:"space-y-2",children:ma.map(p=>(0,b.jsxs)("label",{className:w(l.accountType===p.value),children:[(0,b.jsx)("input",{type:"radio",name:"accountType",value:p.value,checked:l.accountType===p.value,onChange:()=>c(k=>({...k,accountType:p.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,b.jsx)("div",{className:"flex items-center gap-2 text-foreground",children:p.icon}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-sm font-medium text-foreground",children:p.label}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))})]}),l.accountType==="social-recovery"&&(0,b.jsxs)("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[(0,b.jsxs)("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,b.jsx)(j.KeyRound,{size:14})," Guardian Addresses"]}),(0,b.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set at least one guardian to help recover your wallet if you lose your key"}),l.guardians.length>0&&(0,b.jsx)("div",{className:"mb-3 space-y-1.5",children:l.guardians.map(p=>(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-card px-3 py-2 text-sm",children:[(0,b.jsxs)("span",{className:"font-mono text-xs text-foreground",children:[p.slice(0,8),"...",p.slice(-6)]}),(0,b.jsx)(r,{variant:"ghost",size:"icon",onClick:()=>c(k=>({...k,guardians:k.guardians.filter(P=>P!==p)})),children:(0,b.jsx)(j.X,{size:14})})]},p))}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(s,{type:"text",placeholder:"Enter guardian address (0x...)",value:u,onChange:p=>d(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),R())},className:"flex-1"}),(0,b.jsxs)(r,{size:"sm",onClick:R,disabled:!u.trim(),children:[(0,b.jsx)(j.Plus,{size:14})," Add"]})]})]}),l.accountType==="multi-sig"&&(0,b.jsxs)("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[(0,b.jsxs)("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,b.jsx)(j.Users,{size:14})," Signing Threshold"]}),(0,b.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set how many signers are needed to authorize a transaction"}),(0,b.jsx)("div",{className:"flex items-center gap-3",children:[1,2,3].map(p=>(0,b.jsxs)("label",{className:w(l.threshold===p),children:[(0,b.jsx)("input",{type:"radio",name:"threshold",value:p,checked:l.threshold===p,onChange:()=>c(k=>({...k,threshold:p})),className:"sr-only"}),p,"-of-3"]},p))})]}),(0,b.jsx)(i,{className:"my-4"}),(0,b.jsxs)("section",{className:"mb-6",children:[(0,b.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,b.jsx)(j.Fuel,{size:15})," Gas Fees"]}),(0,b.jsx)("div",{className:"space-y-2",children:pa.map(p=>(0,b.jsxs)("label",{className:w(l.paymasterType===p.value),children:[(0,b.jsx)("input",{type:"radio",name:"paymasterType",value:p.value,checked:l.paymasterType===p.value,onChange:()=>c(k=>({...k,paymasterType:p.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("div",{className:"text-sm font-medium text-foreground",children:p.label}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))}),l.paymasterType==="custom"&&(0,b.jsx)("div",{className:"mt-3",children:(0,b.jsx)("input",{type:"text",placeholder:"Custom Paymaster URL",value:l.customPaymasterUrl,onChange:p=>c(k=>({...k,customPaymasterUrl:p.target.value})),className:f})})]}),(0,b.jsx)(i,{className:"my-4"}),(0,b.jsxs)("section",{className:"mb-6",children:[(0,b.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,b.jsx)(j.Wrench,{size:15})," Bundler"]}),(0,b.jsx)("div",{className:"space-y-2",children:fa.map(p=>(0,b.jsxs)("label",{className:w(l.bundlerPreset===p.value),children:[(0,b.jsx)("input",{type:"radio",name:"bundlerPreset",value:p.value,checked:l.bundlerPreset===p.value,onChange:()=>c(k=>({...k,bundlerPreset:p.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("div",{className:"text-sm font-medium text-foreground",children:p.label}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))}),l.bundlerPreset==="custom"&&(0,b.jsx)("div",{className:"mt-3",children:(0,b.jsx)("input",{type:"text",placeholder:"Custom Bundler URL",value:l.customBundlerUrl,onChange:p=>c(k=>({...k,customBundlerUrl:p.target.value})),className:f})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsxs)(r,{className:"flex-1",onClick:v,children:[(0,b.jsx)(j.Save,{size:15}),m?"Saved \u2713":"Save Settings"]}),n&&(0,b.jsxs)(r,{variant:"outline",onClick:n,children:[(0,b.jsx)(j.ArrowLeft,{size:15}),"\u2190 Back to Simple Mode"]})]})]})}var Be=require("lucide-react");var br=require("@naculus/connect-appkit-react"),I=require("react/jsx-runtime"),ha={ok:{icon:(0,I.jsx)(Be.CheckCircle,{size:20}),label:"No problem found",colorClass:"text-muted-foreground",bgClass:"bg-muted",buttonVariant:"default"},warning:{icon:(0,I.jsx)(Be.AlertTriangle,{size:20}),label:"Warning",colorClass:"text-[hsl(var(--warning,38_92%_50%))]",bgClass:"bg-[hsl(var(--warning)/0.1)]",buttonVariant:"default"},blocked:{icon:(0,I.jsx)(Be.ShieldAlert,{size:20}),label:"Blocked",colorClass:"text-destructive",bgClass:"bg-destructive/10",buttonVariant:"destructive"}};function yr({address:t,open:e,onClose:n,onProceed:o}){let r=B(),s=r.Button,a=r.Dialog,i=r.DialogContent,l=r.DialogHeader,c=r.DialogTitle,{validation:u}=(0,br.useValidateDestination)({address:t}),{level:d,warning:m}=u,y=ha[d],w=d==="blocked",f=t.length>12?`${t.slice(0,6)}...${t.slice(-4)}`:t,v=p=>N("inline-flex items-center justify-center whitespace-nowrap rounded-lg","text-sm font-medium transition-all duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50","h-10 px-4 py-2",p==="outline"&&"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",p==="destructive"&&"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm",p==="default"&&"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm"),R=(0,I.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,I.jsxs)("div",{className:N("flex items-center gap-3 rounded-lg p-4",y.bgClass),children:[(0,I.jsx)("span",{className:y.colorClass,children:y.icon}),(0,I.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,I.jsx)("span",{className:N("text-sm font-semibold",y.colorClass),children:y.label}),(0,I.jsx)("span",{className:"text-xs text-muted-foreground break-all font-mono",children:f})]})]}),m&&(0,I.jsx)("p",{className:"text-sm text-muted-foreground m-0",children:m}),(0,I.jsxs)("div",{className:"flex gap-2 justify-end pt-2",children:[s?(0,I.jsx)(s,{onClick:n,variant:"outline",className:"w-full sm:w-auto",children:"Cancel"}):(0,I.jsx)("button",{type:"button",onClick:n,className:N(v("outline"),"w-full sm:w-auto"),children:"Cancel"}),o&&(s?(0,I.jsx)(s,{onClick:o,variant:w?"destructive":"default",disabled:w,className:"w-full sm:w-auto",children:"Proceed anyway"}):(0,I.jsx)("button",{type:"button",onClick:o,disabled:w,className:N(v(w?"destructive":"default"),"w-full sm:w-auto"),children:"Proceed anyway"}))]})]});return a&&i&&l&&c?(0,I.jsx)(a,{open:e,onOpenChange:p=>{p||n()},children:(0,I.jsxs)(i,{className:"sm:max-w-md",children:[(0,I.jsx)(l,{children:(0,I.jsx)(c,{children:"Address Warning"})}),R]})}):e?(0,I.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,I.jsx)("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:n}),(0,I.jsxs)("div",{role:"dialog","aria-modal":"true",className:"relative z-10 w-full max-w-sm rounded-xl border bg-card text-card-foreground shadow-2xl p-6",children:[(0,I.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,I.jsx)("h2",{className:"text-lg font-semibold m-0",children:"Address Warning"}),(0,I.jsx)("button",{onClick:n,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close",children:(0,I.jsx)(Be.X,{size:16})})]}),R]})]}):null}var mt=require("lucide-react");var F=require("react/jsx-runtime");function xr({wallets:t,onSelect:e,loading:n=!1,error:o=null}){let s=B().Card,a=i=>s?(0,F.jsx)(s,{className:"p-4",children:i}):(0,F.jsx)("div",{className:"rounded-xl border bg-card text-card-foreground shadow-sm p-4",children:i});return n?a((0,F.jsxs)("div",{className:"flex flex-col gap-3",children:[Array.from({length:3}).map((i,l)=>(0,F.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg animate-pulse",children:[(0,F.jsx)("div",{className:"h-10 w-10 rounded-full bg-muted"}),(0,F.jsx)("div",{className:"h-4 w-32 rounded bg-muted"})]},l)),(0,F.jsx)("p",{className:"text-xs text-muted-foreground text-center m-0",children:"Detecting wallets..."})]})):o?a((0,F.jsxs)("div",{className:"flex flex-col items-center gap-3 py-4",children:[(0,F.jsx)(mt.AlertCircle,{size:24,className:"text-destructive"}),(0,F.jsx)("p",{className:"text-sm text-destructive m-0 font-medium",children:o})]})):t.length===0?a((0,F.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,F.jsx)(mt.Wallet,{size:32,className:"text-muted-foreground"}),(0,F.jsxs)("p",{className:"text-sm text-muted-foreground m-0 text-center",children:["No wallets detected.",(0,F.jsx)("br",{}),"Install a browser wallet extension to get started."]})]})):(0,F.jsx)("div",{className:"flex flex-col gap-2",children:t.map(i=>(0,F.jsxs)("button",{type:"button",onClick:()=>e(i),className:N("flex items-center gap-3 w-full p-3 rounded-lg","border border-input bg-card hover:bg-accent hover:text-accent-foreground","transition-all duration-200 cursor-pointer","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[i.icon?(0,F.jsx)("img",{src:i.icon,alt:i.name,className:"h-10 w-10 rounded-full object-cover shrink-0",onError:l=>{l.target.style.display="none"}}):(0,F.jsx)("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center shrink-0",children:(0,F.jsx)(mt.Wallet,{size:18,className:"text-muted-foreground"})}),(0,F.jsxs)("div",{className:"flex flex-col items-start gap-0.5 text-left min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-medium truncate w-full",children:i.name}),(0,F.jsx)("span",{className:"text-xs text-muted-foreground truncate w-full",children:i.rdns})]})]},i.id))})}0&&(module.exports={AccountButton,AccountSelector,AccountSelectorView,AddressWarningDialog,AppKit,AppKitButton,AppKitChainSelector,ChainSelector,ConnectButton,ErrorBoundary,PasskeySetup,PasskeySetupView,PassphraseDialog,PassphraseDialogView,QRCodeModal,RouteSelector,SeedPhraseBackup,SignInButton,SmartWalletSettings,SmartWalletToggle,ThemeProvider,WalletConnectProvider,WalletPicker,WalletSecurityPanel,WalletSecurityPanelView,Web3ComponentProvider,Web3ConnectUI,cn,useAppKit,useComponent,useComponentRegistry,useDetectionMode,useEIP6963,useIsMobile,useTheme,useThemeVariable,useWalletConnect,useWalletConnectOptional});
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|