@naculus/connect-appkit-ui 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/styles/components.css +2 -0
- package/dist/styles/index.css +1 -0
- package/dist/styles/preflight.css +2 -0
- package/package.json +17 -9
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
]))+`;
|
|
3
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),t.put(n,13)}};
|
|
4
|
-
Suggested mode is: `+P.toString(o));switch(n===P.KANJI&&!
|
|
1
|
+
var Fr=Object.create;var kn=Object.defineProperty;var Kr=Object.getOwnPropertyDescriptor;var qr=Object.getOwnPropertyNames;var jr=Object.getPrototypeOf,Qr=Object.prototype.hasOwnProperty;var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var $r=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of qr(e))!Qr.call(t,r)&&r!==n&&kn(t,r,{get:()=>e[r],enumerable:!(o=Kr(e,r))||o.enumerable});return t};var Gr=(t,e,n)=>(n=t!=null?Fr(jr(t)):{},$r(e||!t||!t.__esModule?kn(n,"default",{value:t,enumerable:!0}):n,t));var Vn=E((Tc,Wn)=>{"use strict";Wn.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var me=E(ve=>{"use strict";var It,va=[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];ve.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};ve.getSymbolTotalCodewords=function(e){return va[e]};ve.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};ve.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');It=e};ve.isKanjiModeEnabled=function(){return typeof It<"u"};ve.toSJIS=function(e){return It(e)}});var dt=E(oe=>{"use strict";oe.L={bit:1};oe.M={bit:0};oe.Q={bit:3};oe.H={bit:2};function Ca(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return oe.L;case"m":case"medium":return oe.M;case"q":case"quartile":return oe.Q;case"h":case"high":return oe.H;default:throw new Error("Unknown EC Level: "+t)}}oe.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};oe.from=function(e,n){if(oe.isValid(e))return e;try{return Ca(e)}catch{return n}}});var On=E((Ec,Hn)=>{"use strict";function Un(){this.buffer=[],this.length=0}Un.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++}};Hn.exports=Un});var Fn=E((Ac,_n)=>{"use strict";function Ke(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)}Ke.prototype.set=function(t,e,n,o){let r=t*this.size+e;this.data[r]=n,o&&(this.reservedBit[r]=!0)};Ke.prototype.get=function(t,e){return this.data[t*this.size+e]};Ke.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n};Ke.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};_n.exports=Ke});var Kn=E(ut=>{"use strict";var wa=me().getSymbolSize;ut.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,o=wa(e),r=o===145?26:Math.ceil((o-13)/(2*n-2))*2,a=[o-7];for(let s=1;s<n-1;s++)a[s]=a[s-1]-r;return a.push(6),a.reverse()};ut.getPositions=function(e){let n=[],o=ut.getRowColCoords(e),r=o.length;for(let a=0;a<r;a++)for(let s=0;s<r;s++)a===0&&s===0||a===0&&s===r-1||a===r-1&&s===0||n.push([o[a],o[s]]);return n}});var Qn=E(jn=>{"use strict";var Na=me().getSymbolSize,qn=7;jn.getPositions=function(e){let n=Na(e);return[[0,0],[n-qn,0],[0,n-qn]]}});var $n=E(I=>{"use strict";I.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Ce={N1:3,N2:3,N3:40,N4:10};I.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};I.from=function(e){return I.isValid(e)?parseInt(e,10):void 0};I.getPenaltyN1=function(e){let n=e.size,o=0,r=0,a=0,s=null,i=null;for(let l=0;l<n;l++){r=a=0,s=i=null;for(let c=0;c<n;c++){let u=e.get(l,c);u===s?r++:(r>=5&&(o+=Ce.N1+(r-5)),s=u,r=1),u=e.get(c,l),u===i?a++:(a>=5&&(o+=Ce.N1+(a-5)),i=u,a=1)}r>=5&&(o+=Ce.N1+(r-5)),a>=5&&(o+=Ce.N1+(a-5))}return o};I.getPenaltyN2=function(e){let n=e.size,o=0;for(let r=0;r<n-1;r++)for(let a=0;a<n-1;a++){let s=e.get(r,a)+e.get(r,a+1)+e.get(r+1,a)+e.get(r+1,a+1);(s===4||s===0)&&o++}return o*Ce.N2};I.getPenaltyN3=function(e){let n=e.size,o=0,r=0,a=0;for(let s=0;s<n;s++){r=a=0;for(let i=0;i<n;i++)r=r<<1&2047|e.get(s,i),i>=10&&(r===1488||r===93)&&o++,a=a<<1&2047|e.get(i,s),i>=10&&(a===1488||a===93)&&o++}return o*Ce.N3};I.getPenaltyN4=function(e){let n=0,o=e.data.length;for(let a=0;a<o;a++)n+=e.data[a];return Math.abs(Math.ceil(n*100/o/5)-10)*Ce.N4};function ka(t,e,n){switch(t){case I.Patterns.PATTERN000:return(e+n)%2===0;case I.Patterns.PATTERN001:return e%2===0;case I.Patterns.PATTERN010:return n%3===0;case I.Patterns.PATTERN011:return(e+n)%3===0;case I.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(n/3))%2===0;case I.Patterns.PATTERN101:return e*n%2+e*n%3===0;case I.Patterns.PATTERN110:return(e*n%2+e*n%3)%2===0;case I.Patterns.PATTERN111:return(e*n%3+(e+n)%2)%2===0;default:throw new Error("bad maskPattern:"+t)}}I.applyMask=function(e,n){let o=n.size;for(let r=0;r<o;r++)for(let a=0;a<o;a++)n.isReserved(a,r)||n.xor(a,r,ka(e,a,r))};I.getBestMask=function(e,n){let o=Object.keys(I.Patterns).length,r=0,a=1/0;for(let s=0;s<o;s++){n(s),I.applyMask(s,e);let i=I.getPenaltyN1(e)+I.getPenaltyN2(e)+I.getPenaltyN3(e)+I.getPenaltyN4(e);I.applyMask(s,e),i<a&&(a=i,r=s)}return r}});var zt=E(Lt=>{"use strict";var pe=dt(),mt=[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],pt=[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];Lt.getBlocksCount=function(e,n){switch(n){case pe.L:return mt[(e-1)*4+0];case pe.M:return mt[(e-1)*4+1];case pe.Q:return mt[(e-1)*4+2];case pe.H:return mt[(e-1)*4+3];default:return}};Lt.getTotalCodewordsCount=function(e,n){switch(n){case pe.L:return pt[(e-1)*4+0];case pe.M:return pt[(e-1)*4+1];case pe.Q:return pt[(e-1)*4+2];case pe.H:return pt[(e-1)*4+3];default:return}}});var Gn=E(gt=>{"use strict";var qe=new Uint8Array(512),ft=new Uint8Array(256);(function(){let e=1;for(let n=0;n<255;n++)qe[n]=e,ft[e]=n,e<<=1,e&256&&(e^=285);for(let n=255;n<512;n++)qe[n]=qe[n-255]})();gt.log=function(e){if(e<1)throw new Error("log("+e+")");return ft[e]};gt.exp=function(e){return qe[e]};gt.mul=function(e,n){return e===0||n===0?0:qe[ft[e]+ft[n]]}});var Yn=E(je=>{"use strict";var Wt=Gn();je.mul=function(e,n){let o=new Uint8Array(e.length+n.length-1);for(let r=0;r<e.length;r++)for(let a=0;a<n.length;a++)o[r+a]^=Wt.mul(e[r],n[a]);return o};je.mod=function(e,n){let o=new Uint8Array(e);for(;o.length-n.length>=0;){let r=o[0];for(let s=0;s<n.length;s++)o[s]^=Wt.mul(n[s],r);let a=0;for(;a<o.length&&o[a]===0;)a++;o=o.slice(a)}return o};je.generateECPolynomial=function(e){let n=new Uint8Array([1]);for(let o=0;o<e;o++)n=je.mul(n,new Uint8Array([1,Wt.exp(o)]));return n}});var Zn=E((Vc,Xn)=>{"use strict";var Jn=Yn();function Vt(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}Vt.prototype.initialize=function(e){this.degree=e,this.genPoly=Jn.generateECPolynomial(this.degree)};Vt.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=Jn.mod(n,this.genPoly),r=this.degree-o.length;if(r>0){let a=new Uint8Array(this.degree);return a.set(o,r),a}return o};Xn.exports=Vt});var Ut=E(eo=>{"use strict";eo.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var Ht=E(ce=>{"use strict";var to="[0-9]+",Sa="[A-Z $%*+\\-./:]+",Qe="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Qe=Qe.replace(/u/g,"\\u");var Ra="(?:(?![A-Z0-9 $%*+\\-./:]|"+Qe+`)(?:.|[\r
|
|
2
|
+
]))+`;ce.KANJI=new RegExp(Qe,"g");ce.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ce.BYTE=new RegExp(Ra,"g");ce.NUMERIC=new RegExp(to,"g");ce.ALPHANUMERIC=new RegExp(Sa,"g");var Ta=new RegExp("^"+Qe+"$"),Pa=new RegExp("^"+to+"$"),Ba=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ce.testKanji=function(e){return Ta.test(e)};ce.testNumeric=function(e){return Pa.test(e)};ce.testAlphanumeric=function(e){return Ba.test(e)}});var fe=E(U=>{"use strict";var Ea=Ut(),Ot=Ht();U.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};U.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};U.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};U.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};U.MIXED={bit:-1};U.getCharCountIndicator=function(e,n){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Ea.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]};U.getBestModeForData=function(e){return Ot.testNumeric(e)?U.NUMERIC:Ot.testAlphanumeric(e)?U.ALPHANUMERIC:Ot.testKanji(e)?U.KANJI:U.BYTE};U.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};U.isValid=function(e){return e&&e.bit&&e.ccBits};function Aa(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return U.NUMERIC;case"alphanumeric":return U.ALPHANUMERIC;case"kanji":return U.KANJI;case"byte":return U.BYTE;default:throw new Error("Unknown mode: "+t)}}U.from=function(e,n){if(U.isValid(e))return e;try{return Aa(e)}catch{return n}}});var so=E(we=>{"use strict";var ht=me(),Da=zt(),no=dt(),ge=fe(),_t=Ut(),ro=7973,oo=ht.getBCHDigit(ro);function Ma(t,e,n){for(let o=1;o<=40;o++)if(e<=we.getCapacity(o,n,t))return o}function ao(t,e){return ge.getCharCountIndicator(t,e)+4}function Ia(t,e){let n=0;return t.forEach(function(o){let r=ao(o.mode,e);n+=r+o.getBitsLength()}),n}function La(t,e){for(let n=1;n<=40;n++)if(Ia(t,n)<=we.getCapacity(n,e,ge.MIXED))return n}we.from=function(e,n){return _t.isValid(e)?parseInt(e,10):n};we.getCapacity=function(e,n,o){if(!_t.isValid(e))throw new Error("Invalid QR Code version");typeof o>"u"&&(o=ge.BYTE);let r=ht.getSymbolTotalCodewords(e),a=Da.getTotalCodewordsCount(e,n),s=(r-a)*8;if(o===ge.MIXED)return s;let i=s-ao(o,e);switch(o){case ge.NUMERIC:return Math.floor(i/10*3);case ge.ALPHANUMERIC:return Math.floor(i/11*2);case ge.KANJI:return Math.floor(i/13);case ge.BYTE:default:return Math.floor(i/8)}};we.getBestVersionForData=function(e,n){let o,r=no.from(n,no.M);if(Array.isArray(e)){if(e.length>1)return La(e,r);if(e.length===0)return 1;o=e[0]}else o=e;return Ma(o.mode,o.getLength(),r)};we.getEncodedBits=function(e){if(!_t.isValid(e)||e<7)throw new Error("Invalid QR Code version");let n=e<<12;for(;ht.getBCHDigit(n)-oo>=0;)n^=ro<<ht.getBCHDigit(n)-oo;return e<<12|n}});var uo=E(co=>{"use strict";var Ft=me(),lo=1335,za=21522,io=Ft.getBCHDigit(lo);co.getEncodedBits=function(e,n){let o=e.bit<<3|n,r=o<<10;for(;Ft.getBCHDigit(r)-io>=0;)r^=lo<<Ft.getBCHDigit(r)-io;return(o<<10|r)^za}});var po=E((Kc,mo)=>{"use strict";var Wa=fe();function Ae(t){this.mode=Wa.NUMERIC,this.data=t.toString()}Ae.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Ae.prototype.getLength=function(){return this.data.length};Ae.prototype.getBitsLength=function(){return Ae.getBitsLength(this.data.length)};Ae.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 a=this.data.length-n;a>0&&(o=this.data.substr(n),r=parseInt(o,10),e.put(r,a*3+1))};mo.exports=Ae});var go=E((qc,fo)=>{"use strict";var Va=fe(),Kt=["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 De(t){this.mode=Va.ALPHANUMERIC,this.data=t}De.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};De.prototype.getLength=function(){return this.data.length};De.prototype.getBitsLength=function(){return De.getBitsLength(this.data.length)};De.prototype.write=function(e){let n;for(n=0;n+2<=this.data.length;n+=2){let o=Kt.indexOf(this.data[n])*45;o+=Kt.indexOf(this.data[n+1]),e.put(o,11)}this.data.length%2&&e.put(Kt.indexOf(this.data[n]),6)};fo.exports=De});var yo=E((jc,ho)=>{"use strict";var Ua=fe();function Me(t){this.mode=Ua.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}Me.getBitsLength=function(e){return e*8};Me.prototype.getLength=function(){return this.data.length};Me.prototype.getBitsLength=function(){return Me.getBitsLength(this.data.length)};Me.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)};ho.exports=Me});var xo=E((Qc,bo)=>{"use strict";var Ha=fe(),Oa=me();function Ie(t){this.mode=Ha.KANJI,this.data=t}Ie.getBitsLength=function(e){return e*13};Ie.prototype.getLength=function(){return this.data.length};Ie.prototype.getBitsLength=function(){return Ie.getBitsLength(this.data.length)};Ie.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=Oa.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)}};bo.exports=Ie});var vo=E(($c,qt)=>{"use strict";var $e={single_source_shortest_paths:function(t,e,n){var o={},r={};r[e]=0;var a=$e.PriorityQueue.make();a.push(e,0);for(var s,i,l,c,u,d,m,h,g;!a.empty();){s=a.pop(),i=s.value,c=s.cost,u=t[i]||{};for(l in u)u.hasOwnProperty(l)&&(d=u[l],m=c+d,h=r[l],g=typeof r[l]>"u",(g||h>m)&&(r[l]=m,a.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=$e.single_source_shortest_paths(t,e,n);return $e.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(t){var e=$e.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 qt<"u"&&(qt.exports=$e)});var Po=E(Le=>{"use strict";var P=fe(),No=po(),ko=go(),So=yo(),Ro=xo(),Ge=Ht(),yt=me(),_a=vo();function Co(t){return unescape(encodeURIComponent(t)).length}function Ye(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 To(t){let e=Ye(Ge.NUMERIC,P.NUMERIC,t),n=Ye(Ge.ALPHANUMERIC,P.ALPHANUMERIC,t),o,r;return yt.isKanjiModeEnabled()?(o=Ye(Ge.BYTE,P.BYTE,t),r=Ye(Ge.KANJI,P.KANJI,t)):(o=Ye(Ge.BYTE_KANJI,P.BYTE,t),r=[]),e.concat(n,o,r).sort(function(s,i){return s.index-i.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function jt(t,e){switch(e){case P.NUMERIC:return No.getBitsLength(t);case P.ALPHANUMERIC:return ko.getBitsLength(t);case P.KANJI:return Ro.getBitsLength(t);case P.BYTE:return So.getBitsLength(t)}}function Fa(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 Ka(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n];switch(o.mode){case P.NUMERIC:e.push([o,{data:o.data,mode:P.ALPHANUMERIC,length:o.length},{data:o.data,mode:P.BYTE,length:o.length}]);break;case P.ALPHANUMERIC:e.push([o,{data:o.data,mode:P.BYTE,length:o.length}]);break;case P.KANJI:e.push([o,{data:o.data,mode:P.BYTE,length:Co(o.data)}]);break;case P.BYTE:e.push([{data:o.data,mode:P.BYTE,length:Co(o.data)}])}}return e}function qa(t,e){let n={},o={start:{}},r=["start"];for(let a=0;a<t.length;a++){let s=t[a],i=[];for(let l=0;l<s.length;l++){let c=s[l],u=""+a+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]=jt(n[m].lastCount+c.length,c.mode)-jt(n[m].lastCount,c.mode),n[m].lastCount+=c.length):(n[m]&&(n[m].lastCount=c.length),o[m][u]=jt(c.length,c.mode)+4+P.getCharCountIndicator(c.mode,e))}}r=i}for(let a=0;a<r.length;a++)o[r[a]].end=0;return{map:o,table:n}}function wo(t,e){let n,o=P.getBestModeForData(t);if(n=P.from(e,o),n!==P.BYTE&&n.bit<o.bit)throw new Error('"'+t+'" cannot be encoded with mode '+P.toString(n)+`.
|
|
4
|
+
Suggested mode is: `+P.toString(o));switch(n===P.KANJI&&!yt.isKanjiModeEnabled()&&(n=P.BYTE),n){case P.NUMERIC:return new No(t);case P.ALPHANUMERIC:return new ko(t);case P.KANJI:return new Ro(t);case P.BYTE:return new So(t)}}Le.fromArray=function(e){return e.reduce(function(n,o){return typeof o=="string"?n.push(wo(o,null)):o.data&&n.push(wo(o.data,o.mode)),n},[])};Le.fromString=function(e,n){let o=To(e,yt.isKanjiModeEnabled()),r=Ka(o),a=qa(r,n),s=_a.find_path(a.map,"start","end"),i=[];for(let l=1;l<s.length-1;l++)i.push(a.table[s[l]].node);return Le.fromArray(Fa(i))};Le.rawSplit=function(e){return Le.fromArray(To(e,yt.isKanjiModeEnabled()))}});var Eo=E(Bo=>{"use strict";var xt=me(),Qt=dt(),ja=On(),Qa=Fn(),$a=Kn(),Ga=Qn(),Yt=$n(),Jt=zt(),Ya=Zn(),bt=so(),Ja=uo(),Xa=fe(),$t=Po();function Za(t,e){let n=t.size,o=Ga.getPositions(e);for(let r=0;r<o.length;r++){let a=o[r][0],s=o[r][1];for(let i=-1;i<=7;i++)if(!(a+i<=-1||n<=a+i))for(let l=-1;l<=7;l++)s+l<=-1||n<=s+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(a+i,s+l,!0,!0):t.set(a+i,s+l,!1,!0))}}function es(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 ts(t,e){let n=$a.getPositions(e);for(let o=0;o<n.length;o++){let r=n[o][0],a=n[o][1];for(let s=-2;s<=2;s++)for(let i=-2;i<=2;i++)s===-2||s===2||i===-2||i===2||s===0&&i===0?t.set(r+s,a+i,!0,!0):t.set(r+s,a+i,!1,!0)}}function ns(t,e){let n=t.size,o=bt.getEncodedBits(e),r,a,s;for(let i=0;i<18;i++)r=Math.floor(i/3),a=i%3+n-8-3,s=(o>>i&1)===1,t.set(r,a,s,!0),t.set(a,r,s,!0)}function Gt(t,e,n){let o=t.size,r=Ja.getEncodedBits(e,n),a,s;for(a=0;a<15;a++)s=(r>>a&1)===1,a<6?t.set(a,8,s,!0):a<8?t.set(a+1,8,s,!0):t.set(o-15+a,8,s,!0),a<8?t.set(8,o-a-1,s,!0):a<9?t.set(8,15-a-1+1,s,!0):t.set(8,15-a-1,s,!0);t.set(o-8,8,1,!0)}function os(t,e){let n=t.size,o=-1,r=n-1,a=7,s=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;s<e.length&&(c=(e[s]>>>a&1)===1),t.set(r,i-l,c),a--,a===-1&&(s++,a=7)}if(r+=o,r<0||n<=r){r-=o,o=-o;break}}}function rs(t,e,n){let o=new ja;n.forEach(function(l){o.put(l.mode.bit,4),o.put(l.getLength(),Xa.getCharCountIndicator(l.mode,t)),l.write(o)});let r=xt.getSymbolTotalCodewords(t),a=Jt.getTotalCodewordsCount(t,e),s=(r-a)*8;for(o.getLengthInBits()+4<=s&&o.put(0,4);o.getLengthInBits()%8!==0;)o.putBit(0);let i=(s-o.getLengthInBits())/8;for(let l=0;l<i;l++)o.put(l%2?17:236,8);return as(o,t,e)}function as(t,e,n){let o=xt.getSymbolTotalCodewords(e),r=Jt.getTotalCodewordsCount(e,n),a=o-r,s=Jt.getBlocksCount(e,n),i=o%s,l=s-i,c=Math.floor(o/s),u=Math.floor(a/s),d=u+1,m=c-u,h=new Ya(m),g=0,f=new Array(s),y=new Array(s),R=0,p=new Uint8Array(t.buffer);for(let D=0;D<s;D++){let ie=D<l?u:d;f[D]=p.slice(g,g+ie),y[D]=h.encode(f[D]),g+=ie,R=Math.max(R,ie)}let x=new Uint8Array(o),T=0,S,_;for(S=0;S<R;S++)for(_=0;_<s;_++)S<f[_].length&&(x[T++]=f[_][S]);for(S=0;S<m;S++)for(_=0;_<s;_++)x[T++]=y[_][S];return x}function ss(t,e,n,o){let r;if(Array.isArray(t))r=$t.fromArray(t);else if(typeof t=="string"){let c=e;if(!c){let u=$t.rawSplit(t);c=bt.getBestVersionForData(u,n)}r=$t.fromString(t,c||40)}else throw new Error("Invalid data");let a=bt.getBestVersionForData(r,n);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=a;else if(e<a)throw new Error(`
|
|
5
5
|
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
-
Minimum version required to store current data is: `+
|
|
7
|
-
`);let
|
|
8
|
-
`;return typeof o=="function"&&o(null,m),m}});var Ao=E(Ge=>{"use strict";var aa=Dn(),Xt=ko(),Eo=Ro(),ia=Bo();function Zt(t,e,n,o,r){let s=[].slice.call(arguments,1),a=s.length,i=typeof s[a-1]=="function";if(!i&&!aa())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=Xt.create(n,o);l(t(u,e,o))}catch(u){c(u)}})}try{let l=Xt.create(n,o);r(null,t(l,e,o))}catch(l){r(l)}}Ge.create=Xt.create;Ge.toCanvas=Zt.bind(null,Eo.render);Ge.toDataURL=Zt.bind(null,Eo.renderToDataURL);Ge.toString=Zt.bind(null,function(t,e,n){return ia.render(t,n)})});import{useState as Tt,useEffect as es,useCallback as Sn,useRef as ts}from"react";import{AppkitConnectButton as ns}from"@naculus/connect-appkit-react";import{createContext as qr,useContext as Nn,useState as st,useCallback as wt,useEffect as jr,useMemo as wn,useRef as Nt}from"react";import{useWeb3 as Qr}from"@naculus/connect-appkit-react";import{jsx as Gr}from"react/jsx-runtime";var kt=qr(null);function St({children:t}){let e=Qr(),[n,o]=st(null),[r,s]=st(!1),[a,i]=st("idle"),[l,c]=st(null),u=Nt(0),d=Nt(null);jr(()=>()=>{d.current&&clearTimeout(d.current)},[]);let m=wt(()=>{u.current+=1,e.cancelPairing?.(),d.current&&(clearTimeout(d.current),d.current=null),o(null),s(!1),i("cancelled"),c(null)},[e]),h=Nt(void 0);h.current=async()=>{if(!e.startPairing||!e.completePairing){c("WalletConnect pairing not available"),i("error");return}let p=++u.current,x=()=>u.current===p;i("loading"),c(null),s(!0);try{let T=await e.startPairing();if(!x())return;o(T),i("ready");try{if(await e.completePairing(),!x())return;d.current=setTimeout(()=>{d.current=null,x()&&(s(!1),o(null),i("idle"))},1e3)}catch(S){if(!x())return;i("error"),c(S instanceof Error?S.message:"Connection failed")}}catch(T){if(!x())return;i("error"),c(T instanceof Error?T.message:"Failed to generate QR code")}};let g=wt(async()=>{await h.current?.()},[]),f=wt(()=>{o(null),c(null),i("loading"),h.current?.()},[]),y=wn(()=>({qrUri:n,showQR:r,qrStatus:a,error:l}),[n,r,a,l]),R=wn(()=>({state:y,connectWalletConnect:g,cancelQR:m,retryQR:f}),[y,g,m,f]);return Gr(kt.Provider,{value:R,children:t})}function $r(){let t=Nn(kt);if(!t)throw new Error("useWalletConnect must be used within a WalletConnectProvider");return t}function Rt(){return Nn(kt)}import{useState as kn,useEffect as Yr,useRef as Jr}from"react";function Ue(){let[t,e]=kn([]),[n,o]=kn(!0),r=Jr(new Set);return Yr(()=>{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(h=>h.find(g=>g.id===d.rdns)?h:[...h,{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(h=>h.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}}import{useState as Xr,useEffect as Zr}from"react";function Oe(){let[t,e]=Xr(!1);return Zr(()=>{if(typeof navigator>"u"||typeof window>"u")return;let n=navigator.userAgent.toLowerCase();e(/(iphone|ipad|ipod|android|mobile)/i.test(n))},[]),t}import{jsx as Rn}from"react/jsx-runtime";function be({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:h,explorerUrl:g,explorerLabel:f}){let y=Rt(),{wallets:R}=Ue(),p=Oe(),x=JSON.stringify(R.map(({id:_,name:re,icon:j,rdns:Te})=>({id:_,name:re,icon:j,rdns:Te}))),[T,S]=Tt(null),[O,D]=Tt(!1),[ae,q]=Tt(null),Z=ts({aborted:!1}),He=Sn(()=>{Z.current.aborted=!0,y?.cancelQR(),D(!1),S(null),q(null)},[y]);es(()=>{if(!y)return;let{qrStatus:_,qrUri:re,error:j}=y.state;_==="loading"?(D(!0),S(null),q(null)):_==="ready"&&re?(D(!1),S(re),q(null)):_==="error"?(D(!1),q(j)):(_==="idle"||_==="cancelled")&&(D(!1),S(null),q(null))},[y?.state?.qrStatus,y?.state?.qrUri,y?.state?.error]);let ie=Sn((_,re)=>{if(_==="walletconnect"){if(y){y.connectWalletConnect();return}if(i&&l){D(!0),q(null),Z.current.aborted=!1,i().then(j=>{Z.current.aborted||(S(j),D(!1),l().then(()=>{Z.current.aborted||S(null)}).catch(Te=>{Z.current.aborted||q(Te instanceof Error?Te.message:"Connection failed")}))}).catch(j=>{Z.current.aborted||(D(!1),q(j instanceof Error?j.message:"Connection failed"))});return}}o?.(_,()=>{},re)},[y,i,l,o]);return Rn("div",{className:t,children:Rn(ns,{connected:e??!1,connecting:n??!1,address:c??"",balance:u??null,balanceSymbol:d??"",isBalanceLoading:h??!1,tokenBalancesJson:JSON.stringify(m??[]),explorerUrl:g??"",explorerLabel:f??"",walletsJson:x,isMobile:p,mobileWalletName:a??"",qrUri:T,qrLoading:O,qrError:ae,onAppkitConnect:_=>{ie(_.detail.kind,_.detail.walletId)},onAppkitDisconnect:()=>r?.(),onAppkitStartPairing:()=>ie("walletconnect"),onAppkitRetry:()=>{Z.current.aborted=!0,q(null),S(null),ie("walletconnect")},onAppkitCancelPairing:He,onAppkitMobileDeepLink:()=>s?.(),onAppkitCopyAddress:_=>{navigator.clipboard?.writeText(_.detail).catch(()=>{})}})})}import{logger as Xa}from"@naculus/connect-core";import{useState as Za,useRef as ei,useEffect as ti}from"react";import{useChain as ni,useWallet as oi}from"@naculus/connect-appkit-react";import{clsx as os}from"clsx";import{twMerge as rs}from"tailwind-merge";function b(...t){return rs(os(t))}var Tn='<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>',ss='<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>',as='<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>',is='<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>',ls='<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>',cs='<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>',ds='<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>',us={"eip155:1":Tn,"eip155:137":ss,"eip155:56":as,"eip155:42161":is,"eip155:10":ls,"eip155:43114":cs,"eip155:250":ds,"eip155:11155111":Tn};function at(t){return us[t]}import{createContext as ja,useContext as Qa,useMemo as $a}from"react";import{Wallet as ms}from"lucide-react";import{jsx as Pe,jsxs as Pt}from"react/jsx-runtime";function ps({children:t}){return Pe("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground",children:t})}function Bt({className:t,showAddress:e=!0,showBalance:n=!1,address:o,balance:r,balanceSymbol:s,onConnect:a}){let l=B().Button;if(!o)return Pt(l,{"aria-label":"Connect Wallet",onClick:a,className:t,children:[Pe(ms,{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 Pt(l,{className:t,children:[Pe(ps,{children:"W"}),Pt("div",{className:"flex flex-col items-start gap-0",children:[e&&Pe("span",{className:"font-mono text-xs",children:u}),n&&d&&Pe("span",{className:"text-xs text-muted-foreground",children:d}),n&&!d&&r===null&&Pe("span",{className:"text-xs text-muted-foreground",children:"Loading..."})]})]})}import{useRef as Do,useEffect as Mo,useState as Io,useCallback as la}from"react";import{Smartphone as ca,RefreshCw as Lo,CheckCircle2 as da,AlertCircle as zo,Loader2 as ua}from"lucide-react";import{useEffect as Pn}from"react";import{X as fs}from"lucide-react";import{jsx as de,jsxs as Et}from"react/jsx-runtime";function Be({open:t,onClose:e,children:n,closable:o,className:r}){return Pn(()=>{if(!t)return;let s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s}},[t]),Pn(()=>{if(!t||!e)return;let s=a=>{a.key==="Escape"&&e()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t,e]),t?Et("div",{className:b("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:[de("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)"}}),Et("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&&de("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:de("svg",{"aria-hidden":"true",className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:de("path",{d:"M18 6 6 18M6 6l12 12","data-testid":"x-icon"})})}),n]})]}):null}function Bn({title:t,onClose:e,showCloseButton:n=!0}){return Et("div",{className:"flex items-center justify-between mb-4",children:[de("h2",{className:"text-lg font-semibold m-0",children:t}),n&&e&&de("button",{onClick:e,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200","aria-label":"Close",children:de(fs,{size:16})})]})}function En({children:t,className:e=""}){return de("div",{className:b("flex flex-col gap-4",e),children:t})}import{jsx as H,jsxs as se}from"react/jsx-runtime";async function ma(t,e){let n=await Promise.resolve().then(()=>Kr(Ao(),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 Ye({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=Do(null),[m,h]=Io(null),[g,f]=Io(0),y=Oe(),R=B(),p=R.Button,x=a??y,T=Do(null);Mo(()=>{!e||!t||!d.current||(h(null),ma(d.current,t).catch(j=>{h(j instanceof Error?j.message:"Unable to render QR code")}))},[e,t]),Mo(()=>{if(!e||s!=="pending"){T.current&&(clearInterval(T.current),T.current=null),f(0);return}let j=Date.now();return T.current=setInterval(()=>f(Date.now()-j),1e3),()=>{T.current&&clearInterval(T.current)}},[e,s,i]);let S=g>=i&&s==="pending",O=S||s==="expired"||s==="error",D=Math.max(0,Math.ceil((i-g)/1e3)),ae=Math.floor(D/60),q=D%60,Z=Math.min(g/i,1),He=la(()=>{t&&o&&o(t)},[t,o]),ie=t&&!S&&s==="pending"?m?se("div",{className:"w-[280px] h-[280px] flex flex-col items-center justify-center bg-muted rounded-lg gap-2",children:[H(zo,{size:24,className:"text-muted-foreground"}),H("span",{className:"text-sm text-muted-foreground",children:"Failed to render QR code"})]}):H("canvas",{ref:d,width:280,height:280,role:"img","aria-label":"WalletConnect pairing QR code",className:"rounded-lg border border-border"}):se("div",{className:"flex flex-col items-center justify-center gap-3 bg-muted rounded-lg w-[280px] h-[280px]",children:[s==="scanned"?H(da,{size:48,className:"text-[hsl(var(--primary))]"}):H(zo,{size:48,className:"text-destructive"}),H("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."})]}),re=R.Modal??Be;return H(re,{open:e,onClose:n,closable:!0,title:l,className:u,children:se("div",{className:"p-6",children:[se("div",{className:"text-center mb-5",children:[H("div",{className:"flex justify-center mb-3",children:s==="pending"&&!S&&H(ua,{size:20,className:"animate-spin text-primary","data-testid":"loader-icon-inline"})}),H("h3",{className:"text-lg font-semibold m-0 text-foreground",children:l}),c&&H("p",{className:"text-sm text-muted-foreground mt-1.5 mb-0",children:c})]}),H("div",{className:"flex justify-center mb-4",children:ie}),s==="pending"&&!S&&se("div",{className:"mb-3",children:[H("div",{className:"h-1 bg-muted rounded-full overflow-hidden",role:"progressbar","aria-valuenow":Math.round((1-Z)*100),"aria-valuemin":0,"aria-valuemax":100,children:H("div",{className:"h-full bg-primary rounded-full transition-all duration-1000",style:{width:`${(1-Z)*100}%`}})}),se("p",{"data-testid":"countdown",className:"text-xs text-muted-foreground text-center mt-1.5 mb-0",children:["Expires in ",ae,":",q.toString().padStart(2,"0")]})]}),se("div",{className:"flex flex-col gap-2",children:[x&&t&&s==="pending"&&!S&&se("button",{type:"button",onClick:He,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:[H(ca,{size:16})," Open in Wallet App"]}),O&&r&&(p?se(p,{onClick:r,variant:"default",size:"default",className:"w-full",children:[H(Lo,{size:16})," Generate New QR Code"]}):se("button",{type:"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:[H(Lo,{size:16})," Generate New QR Code"]})),p?H(p,{onClick:n,variant:"outline",size:"default",className:"w-full",children:"Cancel"}):H("button",{type:"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"})]})]})})}import{useState as en}from"react";import{LogIn as pa,Loader2 as fa,CheckCircle2 as nn,AlertCircle as ga,X as ha,Copy as ya,Check as ba}from"lucide-react";import{Fragment as Wo,jsx as N,jsxs as F}from"react/jsx-runtime";function on({className:t,isSignedIn:e=!1,isSigningIn:n=!1,result:o=null,error:r=null,onSignIn:s,onClearError:a,children:i}){let[l,c]=en(!1),[u,d]=en(!1),[m,h]=en(!1),g=B(),f=g.Button,y=g.Dialog,R=g.DialogContent,p=g.DialogHeader,x=g.DialogTitle,T=async()=>{if(o?.signature)try{await navigator.clipboard.writeText(o.signature),h(!1),d(!0),setTimeout(()=>d(!1),2e3)}catch{d(!1),h(!0)}};return!e&&!n&&!r?N(f,{onClick:s,className:t,"aria-label":"Sign In",children:F("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[N(pa,{size:16}),i??"Sign In"]})}):n?N(f,{disabled:!0,className:t,"aria-label":"Signing In",children:F("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[N(fa,{size:16,className:"animate-spin"}),"Signing In..."]})}):r&&!e?F("div",{style:{position:"relative",display:"inline-flex",flexDirection:"column"},children:[N(f,{onClick:s,className:t,"aria-label":"Retry Sign In",children:F("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[N(ga,{size:16,style:{color:"var(--destructive, #ef4444)"}}),i??"Retry Sign In"]})}),N("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})]}):F("div",{style:{position:"relative",display:"inline-block"},children:[N(f,{onClick:()=>c(S=>!S),className:t,children:F("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[N(nn,{size:16,style:{color:"#22c55e"}}),N("span",{style:{fontSize:"0.875rem",fontWeight:500},children:"Signed In"})]})}),l&&(y&&R?N(y,{open:!0,onOpenChange:S=>{S||c(!1)},children:N(R,{children:p&&x?F(Wo,{children:[N(p,{children:N(x,{children:"Sign-In Details"})}),N(tn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:m,onCopy:T})]}):F(Wo,{children:[N("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Sign-In Details"}),N(tn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:m,onCopy:T})]})})}):l&&N("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:N(tn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:m,onCopy:T})}))]})}function tn({result:t,onClose:e,copiedSign:n,onCopy:o,copyFailed:r}){let a=B().Button;if(!t)return F("div",{style:{textAlign:"center",padding:"1rem 0"},children:[N(nn,{size:32,style:{color:"#22c55e",margin:"0 auto 0.75rem"}}),N("p",{style:{fontSize:"0.875rem",color:"var(--muted-foreground, #64748b)"},children:"Authenticated successfully"}),N(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 F("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[F("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[F("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[N(nn,{size:18,color:"#22c55e"}),N("span",{style:{fontWeight:600,fontSize:"0.9375rem"},children:"Signed In"})]}),N(a,{variant:"ghost",size:"icon",onClick:e,children:N(ha,{size:16})})]}),F("div",{style:{display:"grid",gap:"0.375rem"},children:[F("div",{children:[N("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Domain"}),N("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:i.domain})]}),F("div",{children:[N("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Address"}),N("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem",wordBreak:"break-all"},children:i.address})]}),F("div",{children:[N("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Chain"}),N("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:i.chainId})]})]}),i.statement&&N("div",{style:{padding:"0.5rem 0.625rem",borderRadius:"0.375rem",background:"var(--muted, #f1f5f9)",fontSize:"0.8125rem",lineHeight:1.5},children:i.statement}),F("div",{children:[F("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.25rem"},children:[N("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Signature"}),N(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?N(ba,{size:12,color:"#22c55e"}):N(ya,{size:12})})]}),N("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})]}),N(a,{variant:"outline",className:"w-full",onClick:e,children:"Close"})]})}import{useState as ce,useCallback as Ne,useMemo as Vo}from"react";import{AlertTriangle as xa,Check as rn,Copy as va,Download as Ca,Eye as wa,EyeOff as Na,SkipForward as Ho,ArrowLeft as ka,ArrowRight as Sa,Shield as Ra,X as Ta}from"lucide-react";import{Fragment as an,jsx as w,jsxs as A}from"react/jsx-runtime";function Pa(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 sn(t){let e=[...t];for(let n=e.length-1;n>0;n--){let o=Pa(n+1);[e[n],e[o]]=[e[o],e[n]]}return e}function Uo(t,e=3){let n=t.trim().split(/\s+/);return sn(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=sn(a).slice(0,3),l=sn([s,...i]);return{index:r,correct:s,options:l}})}function Je({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,h=c.DialogHeader,g=c.DialogTitle,[f,y]=ce("reveal"),[R,p]=ce(!1),[x,T]=ce(!1),[S,O]=ce(!1),[D,ae]=ce(()=>Uo(t,3)),[q,Z]=ce({}),[He,ie]=ce([]),[_,re]=ce(!1),[j,Te]=ce(null),xn=Vo(()=>t.trim().split(/\s+/),[t]),Rr=Vo(()=>{let L=new Map;return xn.map(Q=>{let ee=L.get(Q)??0;return L.set(Q,ee+1),{word:Q,key:`${Q}-${ee}`}})},[xn]),Tr=Ne(()=>p(!0),[]),Pr=Ne(async()=>{try{await navigator.clipboard.writeText(t),O(!1),T(!0),setTimeout(()=>T(!1),2e3)}catch{T(!1),O(!0)}},[t]),Br=Ne(()=>{ae(Uo(t,3)),Z({}),ie([]),y("confirm")},[t]),Er=Ne((L,Q)=>{Z(ee=>({...ee,[L]:Q})),ie(ee=>ee.filter(Ct=>Ct!==L))},[]),Ar=Ne(()=>{let L=[];for(let Q of D)q[Q.index]!==Q.correct&&L.push(Q.index);if(L.length>0){ie(L);return}y("done"),e()},[D,q,e]),vn=Ne(()=>{n?.()},[n]),Dr=Ne(()=>{if(o){let L=o();Te(L),re(!0)}},[o]),Mr=D.every(L=>q[L.index]!==void 0),Ir=A("div",{className:"space-y-4",children:[w("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:A("div",{className:"flex items-start gap-2",children:[w(xa,{size:16,className:"mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"}),w("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?A(an,{children:[w("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:Rr.map(({word:L,key:Q},ee)=>A("div",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2.5 py-1.5 text-sm",children:[w("span",{className:"text-xs text-muted-foreground w-5 shrink-0 text-right",children:ee+1}),w("span",{className:"font-mono font-medium",children:L})]},Q))}),A("div",{className:"flex flex-wrap gap-2",children:[A(u,{onClick:Pr,variant:"outline",size:"sm",children:[x?w(rn,{size:14}):w(va,{size:14}),x?"Copied":S?"Copy failed":"Copy"]}),o&&A(u,{onClick:Dr,variant:"outline",size:"sm",children:[w(Ca,{size:14}),"Export Private Key"]})]}),S&&w("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&&A("div",{className:"rounded-lg border border-border bg-muted p-3 space-y-2",children:[A("div",{className:"flex items-center gap-2",children:[w(Na,{size:14,className:"text-muted-foreground"}),w("span",{className:"text-xs font-medium text-muted-foreground",children:"Private Key (keep secret!)"})]}),w("p",{className:"font-mono text-xs break-all select-all",children:j})]}),A("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[A(u,{onClick:Br,variant:"default",children:["I've Saved It",w(Sa,{size:16})]}),n&&A(u,{onClick:vn,variant:"ghost",size:"sm",children:[w(Ho,{size:14}),"Skip Backup"]})]})]}):A("div",{className:"flex flex-col items-center gap-3 py-6",children:[w(Ra,{size:40,className:"text-muted-foreground"}),w("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."}),A(u,{onClick:Tr,variant:"default",children:[w(wa,{size:16}),"Reveal Seed Phrase"]})]})]}),Lr=A("div",{className:"space-y-4",children:[w("p",{className:"text-sm text-muted-foreground",children:"Verify your backup by selecting the correct word for each position."}),D.map(L=>{let Q=He.includes(L.index);return A("div",{className:"space-y-2",children:[A("p",{className:b("text-sm font-medium",Q?"text-destructive":"text-foreground"),children:["Word #",L.index+1,Q&&w("span",{className:"ml-2 text-xs text-destructive",children:"(incorrect)"})]}),w("div",{className:"grid grid-cols-2 gap-2",children:L.options.map(ee=>{let Ct=q[L.index]===ee;return w("button",{type:"button",onClick:()=>Er(L.index,ee),className:b("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",Ct?"border-primary bg-primary/10 text-primary font-medium":Q?"border-destructive/50 bg-destructive/5":"border-border bg-card hover:border-primary/50"),children:ee},`${L.index}-${ee}`)})})]},L.index)}),A("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[A(u,{onClick:Ar,variant:"default",disabled:!Mr,children:[w(rn,{size:16}),"Verify & Confirm"]}),A("div",{className:"flex gap-2",children:[A(u,{onClick:()=>y("reveal"),variant:"ghost",size:"sm",children:[w(ka,{size:14}),"Back"]}),n&&A(u,{onClick:vn,variant:"ghost",size:"sm",children:[w(Ho,{size:14}),"Skip"]})]})]})]}),zr={reveal:Ir,confirm:Lr,done:A("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[w("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:w(rn,{size:24,className:"text-green-600 dark:text-green-400"})}),w("p",{className:"font-medium text-foreground",children:"Backup Confirmed"}),w("p",{className:"text-sm text-muted-foreground",children:"Your seed phrase has been backed up successfully."})]})},Wr={reveal:"Backup Seed Phrase",confirm:"Verify Backup",done:"Backup Complete"},ot=zr[f],rt=Wr[f];return a?A("div",{className:b("space-y-4",r),children:[f!=="done"&&w("h3",{className:"text-lg font-semibold",children:rt}),ot]}):i?d&&m?w(d,{open:!0,onOpenChange:L=>{L||l?.(!1)},children:w(m,{children:h&&g?A(an,{children:[w(h,{children:w(g,{children:rt})}),w("div",{className:"mt-2 max-h-[55vh] overflow-y-auto",children:ot})]}):A(an,{children:[w("div",{className:"mb-3 text-lg font-semibold",children:rt}),w("div",{className:"max-h-[55vh] overflow-y-auto",children:ot})]})})}):A(Be,{open:!0,onClose:()=>l?.(!1),children:[A("div",{className:"flex items-center justify-between mb-4",children:[w("h2",{className:"text-lg font-semibold m-0",children:rt}),l&&w("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:w(Ta,{size:16})})]}),ot]}):null}import Ba from"react";import{Fragment as Oo,jsx as $,jsxs as ge}from"react/jsx-runtime";function Ea({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 $(a,{open:!0,onOpenChange:()=>{},children:$(i,{children:l&&c?ge(Oo,{children:[$(l,{children:$(c,{children:"Something went wrong"})}),ge("div",{style:{marginTop:"0.5rem"},children:[$("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."}),ge("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&$(s,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),$(s,{variant:"default",size:"default",onClick:e,children:o})]})]})]}):ge(Oo,{children:[$("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Something went wrong"}),$("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."}),ge("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&$(s,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),$(s,{variant:"default",size:"default",onClick:e,children:o})]})]})})});let u=!0,d=n??void 0;return ge(Be,{open:u,onClose:d,children:[$(Bn,{title:"Something went wrong",onClose:d,showCloseButton:!!n}),ge(En,{children:[$("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."}),ge("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&$(s,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),$(s,{variant:"default",size:"default",onClick:e,children:o})]})]})]})}var Xe=class extends Ba.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}):$(Ea,{error:this.state.error,reset:this.handleReset,dismiss:this.props.onDismiss?this.handleDismiss:void 0,retryLabel:this.props.retryLabel}):this.props.children}};import{createContext as Oa,useContext as _a,useMemo as Fa}from"react";import{Web3ConnectProvider as Ka}from"@naculus/connect-appkit-react";import{createContext as Da,useContext as Ma,useMemo as bt,useEffect as xt,useCallback as Ia,useState as vt}from"react";var Le={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"}},Aa=new Map;function ln(){Aa.clear()}import{jsx as Ha,jsxs as Ua}from"react/jsx-runtime";var _o=Da({theme:{},isDark:!1,setTheme:()=>{},toggleDarkMode:()=>{}}),La=/[;{}<>\r\n\\]/;function za(t){let e=[];for(let[n,o]of Object.entries(t)){let r=Le[n];r&&o&&!La.test(String(o))&&e.push(" "+r.name+": "+o+";")}return e.length===0?"":`:root {
|
|
6
|
+
Minimum version required to store current data is: `+a+`.
|
|
7
|
+
`);let s=rs(e,n,r),i=xt.getSymbolSize(e),l=new Qa(i);return Za(l,e),es(l),ts(l,e),Gt(l,n,0),e>=7&&ns(l,e),os(l,s),isNaN(o)&&(o=Yt.getBestMask(l,Gt.bind(null,l,n))),Yt.applyMask(o,l),Gt(l,n,o),{modules:l,version:e,errorCorrectionLevel:n,maskPattern:o,segments:r}}Bo.create=function(e,n){if(typeof e>"u"||e==="")throw new Error("No input text");let o=Qt.M,r,a;return typeof n<"u"&&(o=Qt.from(n.errorCorrectionLevel,Qt.M),r=bt.from(n.version),a=Yt.from(n.maskPattern),n.toSJISFunc&&xt.setToSJISFunction(n.toSJISFunc)),ss(e,r,o,a)}});var Xt=E(Ne=>{"use strict";function Ao(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("")}}Ne.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:Ao(e.color.dark||"#000000ff"),light:Ao(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Ne.getScale=function(e,n){return n.width&&n.width>=e+n.margin*2?n.width/(e+n.margin*2):n.scale};Ne.getImageWidth=function(e,n){let o=Ne.getScale(e,n);return Math.floor((e+n.margin*2)*o)};Ne.qrToImageData=function(e,n,o){let r=n.modules.size,a=n.modules.data,s=Ne.getScale(r,o),i=Math.floor((r+o.margin*2)*s),l=o.margin*s,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,h=o.color.light;if(u>=l&&d>=l&&u<i-l&&d<i-l){let g=Math.floor((u-l)/s),f=Math.floor((d-l)/s);h=c[a[g*r+f]?1:0]}e[m++]=h.r,e[m++]=h.g,e[m++]=h.b,e[m]=h.a}}});var Do=E(vt=>{"use strict";var Zt=Xt();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")}}vt.render=function(e,n,o){let r=o,a=n;typeof r>"u"&&(!n||!n.getContext)&&(r=n,n=void 0),n||(a=ls()),r=Zt.getOptions(r);let s=Zt.getImageWidth(e.modules.size,r),i=a.getContext("2d"),l=i.createImageData(s,s);return Zt.qrToImageData(l.data,e,r),is(i,a,s),i.putImageData(l,0,0),a};vt.renderToDataURL=function(e,n,o){let r=o;typeof r>"u"&&(!n||!n.getContext)&&(r=n,n=void 0),r||(r={});let a=vt.render(e,n,r),s=r.type||"image/png",i=r.rendererOpts||{};return a.toDataURL(s,i.quality)}});var Lo=E(Io=>{"use strict";var cs=Xt();function Mo(t,e){let n=t.a/255,o=e+'="'+t.hex+'"';return n<1?o+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':o}function en(t,e,n){let o=t+e;return typeof n<"u"&&(o+=" "+n),o}function ds(t,e,n){let o="",r=0,a=!1,s=0;for(let i=0;i<t.length;i++){let l=Math.floor(i%e),c=Math.floor(i/e);!l&&!a&&(a=!0),t[i]?(s++,i>0&&l>0&&t[i-1]||(o+=a?en("M",l+n,.5+c+n):en("m",r,0),r=0,a=!1),l+1<e&&t[i+1]||(o+=en("h",s),s=0)):r++}return o}Io.render=function(e,n,o){let r=cs.getOptions(n),a=e.modules.size,s=e.modules.data,i=a+r.margin*2,l=r.color.light.a?"<path "+Mo(r.color.light,"fill")+' d="M0 0h'+i+"v"+i+'H0z"/>':"",c="<path "+Mo(r.color.dark,"stroke")+' d="'+ds(s,a,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 Wo=E(Je=>{"use strict";var us=Vn(),tn=Eo(),zo=Do(),ms=Lo();function nn(t,e,n,o,r){let a=[].slice.call(arguments,1),s=a.length,i=typeof a[s-1]=="function";if(!i&&!us())throw new Error("Callback required as last argument");if(i){if(s<2)throw new Error("Too few arguments provided");s===2?(r=n,n=e,e=o=void 0):s===3&&(e.getContext&&typeof r>"u"?(r=o,o=void 0):(r=o,o=n,n=e,e=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(n=e,e=o=void 0):s===2&&!e.getContext&&(o=n,n=e,e=void 0),new Promise(function(l,c){try{let u=tn.create(n,o);l(t(u,e,o))}catch(u){c(u)}})}try{let l=tn.create(n,o);r(null,t(l,e,o))}catch(l){r(l)}}Je.create=tn.create;Je.toCanvas=nn.bind(null,zo.render);Je.toDataURL=nn.bind(null,zo.renderToDataURL);Je.toString=nn.bind(null,function(t,e,n){return ms.render(t,n)})});import{useState as Et,useEffect as aa,useCallback as Pn,useRef as sa}from"react";import{AppkitConnectButton as ia}from"@naculus/connect-appkit-react";import{createContext as Yr,useContext as Rn,useState as it,useCallback as St,useEffect as Jr,useMemo as Sn,useRef as Rt}from"react";import{useWeb3 as Xr}from"@naculus/connect-appkit-react";import{jsx as ea}from"react/jsx-runtime";var Tt=Yr(null);function Pt({children:t}){let e=Xr(),[n,o]=it(null),[r,a]=it(!1),[s,i]=it("idle"),[l,c]=it(null),u=Rt(0),d=Rt(null);Jr(()=>()=>{d.current&&clearTimeout(d.current)},[]);let m=St(()=>{u.current+=1,e.cancelPairing?.(),d.current&&(clearTimeout(d.current),d.current=null),o(null),a(!1),i("cancelled"),c(null)},[e]),h=Rt(void 0);h.current=async()=>{if(!e.startPairing||!e.completePairing){c("WalletConnect pairing not available"),i("error");return}let p=++u.current,x=()=>u.current===p;i("loading"),c(null),a(!0);try{let T=await e.startPairing();if(!x())return;o(T),i("ready");try{if(await e.completePairing(),!x())return;d.current=setTimeout(()=>{d.current=null,x()&&(a(!1),o(null),i("idle"))},1e3)}catch(S){if(!x())return;i("error"),c(S instanceof Error?S.message:"Connection failed")}}catch(T){if(!x())return;i("error"),c(T instanceof Error?T.message:"Failed to generate QR code")}};let g=St(async()=>{await h.current?.()},[]),f=St(()=>{o(null),c(null),i("loading"),h.current?.()},[]),y=Sn(()=>({qrUri:n,showQR:r,qrStatus:s,error:l}),[n,r,s,l]),R=Sn(()=>({state:y,connectWalletConnect:g,cancelQR:m,retryQR:f}),[y,g,m,f]);return ea(Tt.Provider,{value:R,children:t})}function Zr(){let t=Rn(Tt);if(!t)throw new Error("useWalletConnect must be used within a WalletConnectProvider");return t}function Bt(){return Rn(Tt)}import{useState as Tn,useEffect as ta,useRef as na}from"react";function Oe(){let[t,e]=Tn([]),[n,o]=Tn(!0),r=na(new Set);return ta(()=>{r.current.clear(),o(!0);let a=c=>{let u=c.detail,d=u?.info,m=u?.provider;!d?.rdns||r.current.has(d.rdns)||(r.current.add(d.rdns),e(h=>h.find(g=>g.id===d.rdns)?h:[...h,{id:d.rdns,name:d.name||d.rdns,icon:d.icon||"",rdns:d.rdns,provider:m}]))};window.addEventListener("eip6963:announceProvider",a);let s=window,i=(c,u,d)=>{r.current.has(c)||(r.current.add(c),e(m=>m.some(h=>h.id===c)?m:[...m,{id:c,name:u,icon:"",rdns:c,provider:d}]))};s.ethereum?.isMetaMask&&i("io.metamask","MetaMask",s.ethereum),s.phantom?i("app.phantom","Phantom",s.phantom):s.solana?.isPhantom&&i("app.phantom","Phantom",s.solana),window.dispatchEvent(new Event("eip6963:requestProvider"));let l=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",a),clearTimeout(l)}},[]),{wallets:t,isDetecting:n,hasWallets:t.length>0}}import{useState as oa,useEffect as ra}from"react";function _e(){let[t,e]=oa(!1);return ra(()=>{if(typeof navigator>"u"||typeof window>"u")return;let n=navigator.userAgent.toLowerCase();e(/(iphone|ipad|ipod|android|mobile)/i.test(n))},[]),t}import{jsx as Bn}from"react/jsx-runtime";function xe({className:t,isConnected:e,isConnecting:n,onConnect:o,onDisconnect:r,onMobileDeepLink:a,mobileWalletName:s,startPairing:i,completePairing:l,address:c,balance:u,balanceSymbol:d,tokenBalances:m,isBalanceLoading:h,explorerUrl:g,explorerLabel:f}){let y=Bt(),{wallets:R}=Oe(),p=_e(),x=JSON.stringify(R.map(({id:F,name:ae,icon:Q,rdns:Pe})=>({id:F,name:ae,icon:Q,rdns:Pe}))),[T,S]=Et(null),[_,D]=Et(!1),[ie,j]=Et(null),ee=sa({aborted:!1}),He=Pn(()=>{ee.current.aborted=!0,y?.cancelQR(),D(!1),S(null),j(null)},[y]);aa(()=>{if(!y)return;let{qrStatus:F,qrUri:ae,error:Q}=y.state;F==="loading"?(D(!0),S(null),j(null)):F==="ready"&&ae?(D(!1),S(ae),j(null)):F==="error"?(D(!1),j(Q)):(F==="idle"||F==="cancelled")&&(D(!1),S(null),j(null))},[y?.state?.qrStatus,y?.state?.qrUri,y?.state?.error]);let le=Pn((F,ae)=>{if(F==="walletconnect"){if(y){y.connectWalletConnect();return}if(i&&l){D(!0),j(null),ee.current.aborted=!1,i().then(Q=>{ee.current.aborted||(S(Q),D(!1),l().then(()=>{ee.current.aborted||S(null)}).catch(Pe=>{ee.current.aborted||j(Pe instanceof Error?Pe.message:"Connection failed")}))}).catch(Q=>{ee.current.aborted||(D(!1),j(Q instanceof Error?Q.message:"Connection failed"))});return}}o?.(F,()=>{},ae)},[y,i,l,o]);return Bn("div",{className:t,children:Bn(ia,{connected:e??!1,connecting:n??!1,address:c??"",balance:u??null,balanceSymbol:d??"",isBalanceLoading:h??!1,tokenBalancesJson:JSON.stringify(m??[]),explorerUrl:g??"",explorerLabel:f??"",walletsJson:x,isMobile:p,mobileWalletName:s??"",qrUri:T,qrLoading:_,qrError:ie,onAppkitConnect:F=>{le(F.detail.kind,F.detail.walletId)},onAppkitDisconnect:()=>r?.(),onAppkitStartPairing:()=>le("walletconnect"),onAppkitRetry:()=>{ee.current.aborted=!0,j(null),S(null),le("walletconnect")},onAppkitCancelPairing:He,onAppkitMobileDeepLink:()=>a?.(),onAppkitCopyAddress:F=>{navigator.clipboard?.writeText(F.detail).catch(()=>{})}})})}import{logger as oi}from"@naculus/connect-core";import{useState as ri,useRef as ai,useEffect as si}from"react";import{useChain as ii,useWallet as li}from"@naculus/connect-appkit-react";import{clsx as la}from"clsx";import{twMerge as ca}from"tailwind-merge";function b(...t){return ca(la(t))}var En='<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>',da='<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>',ua='<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>',ma='<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>',pa='<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>',fa='<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>',ga='<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>',ha={"eip155:1":En,"eip155:137":da,"eip155:56":ua,"eip155:42161":ma,"eip155:10":pa,"eip155:43114":fa,"eip155:250":ga,"eip155:11155111":En};function lt(t){return ha[t]}import{createContext as Js,useContext as Xs,useMemo as Zs}from"react";import{Wallet as ya}from"lucide-react";import{jsx as Fe}from"react/jsx-runtime";function V({className:t,variant:e,size:n,type:o="button",...r}){return Fe("button",{type:o,className:b("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":e==="ghost"?"border-transparent 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),...r})}function ct({className:t,...e}){return Fe("div",{className:b("rounded-xl border border-border bg-card text-card-foreground shadow-sm",t),...e})}function An({className:t,variant:e,...n}){return Fe("span",{className:b("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",t),...n})}function Dn(t){return Fe("input",{...t})}function Mn({className:t,...e}){return Fe("hr",{className:b("h-px bg-border",t),...e})}import{jsx as Be,jsxs as At}from"react/jsx-runtime";function ba({children:t}){return Be("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground",children:t})}function Dt({className:t,showAddress:e=!0,showBalance:n=!1,address:o,balance:r,balanceSymbol:a,onConnect:s}){let l=B().Button??V;if(!o)return At(l,{"aria-label":"Connect Wallet",onClick:s,className:t,children:[Be(ya,{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})+(a?` ${a}`:""):null;return At(l,{className:t,children:[Be(ba,{children:"W"}),At("div",{className:"flex flex-col items-start gap-0",children:[e&&Be("span",{className:"font-mono text-xs",children:u}),n&&d&&Be("span",{className:"text-xs text-muted-foreground",children:d}),n&&!d&&r===null&&Be("span",{className:"text-xs text-muted-foreground",children:"Loading..."})]})]})}import{useRef as Vo,useEffect as Uo,useState as Ho,useCallback as ps}from"react";import{Smartphone as fs,RefreshCw as Oo,CheckCircle2 as gs,AlertCircle as _o,Loader2 as hs}from"lucide-react";import{useEffect as In}from"react";import{X as xa}from"lucide-react";import{jsx as ue,jsxs as Mt}from"react/jsx-runtime";function Ee({open:t,onClose:e,children:n,closable:o,className:r}){return In(()=>{if(!t)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[t]),In(()=>{if(!t||!e)return;let a=s=>{s.key==="Escape"&&e()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,e]),t?Mt("div",{className:b("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:[ue("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)"}}),Mt("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&&ue("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:ue("svg",{"aria-hidden":"true",className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:ue("path",{d:"M18 6 6 18M6 6l12 12","data-testid":"x-icon"})})}),n]})]}):null}function Ln({title:t,onClose:e,showCloseButton:n=!0}){return Mt("div",{className:"flex items-center justify-between mb-4",children:[ue("h2",{className:"text-lg font-semibold m-0",children:t}),n&&e&&ue("button",{onClick:e,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200","aria-label":"Close",children:ue(xa,{size:16})})]})}function zn({children:t,className:e=""}){return ue("div",{className:b("flex flex-col gap-4",e),children:t})}import{jsx as H,jsxs as se}from"react/jsx-runtime";async function ys(t,e){let n=await Promise.resolve().then(()=>Gr(Wo(),1)),r=(n.default??n).toCanvas??n.toCanvas;if(typeof r!="function")throw new Error("qrcode.toCanvas is unavailable");return new Promise((a,s)=>{r(t,e,{width:280,margin:2},i=>{i?s(i):a()})})}function Xe({uri:t,open:e,onClose:n,onDeepLink:o,onRetry:r,status:a="pending",showDeepLink:s,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=Vo(null),[m,h]=Ho(null),[g,f]=Ho(0),y=_e(),R=B(),p=R.Button,x=s??y,T=Vo(null);Uo(()=>{!e||!t||!d.current||(h(null),ys(d.current,t).catch(Q=>{h(Q instanceof Error?Q.message:"Unable to render QR code")}))},[e,t]),Uo(()=>{if(!e||a!=="pending"){T.current&&(clearInterval(T.current),T.current=null),f(0);return}let Q=Date.now();return T.current=setInterval(()=>f(Date.now()-Q),1e3),()=>{T.current&&clearInterval(T.current)}},[e,a,i]);let S=g>=i&&a==="pending",_=S||a==="expired"||a==="error",D=Math.max(0,Math.ceil((i-g)/1e3)),ie=Math.floor(D/60),j=D%60,ee=Math.min(g/i,1),He=ps(()=>{t&&o&&o(t)},[t,o]),le=t&&!S&&a==="pending"?m?se("div",{className:"w-[280px] h-[280px] flex flex-col items-center justify-center bg-muted rounded-lg gap-2",children:[H(_o,{size:24,className:"text-muted-foreground"}),H("span",{className:"text-sm text-muted-foreground",children:"Failed to render QR code"})]}):H("canvas",{ref:d,width:280,height:280,role:"img","aria-label":"WalletConnect pairing QR code",className:"rounded-lg border border-border"}):se("div",{className:"flex flex-col items-center justify-center gap-3 bg-muted rounded-lg w-[280px] h-[280px]",children:[a==="scanned"?H(gs,{size:48,className:"text-[hsl(var(--primary))]"}):H(_o,{size:48,className:"text-destructive"}),H("span",{className:"text-sm text-muted-foreground","data-testid":"status-label",children:a==="scanned"?"QR code scanned! Connecting...":S||a==="expired"?"Connection timed out.":"Something went wrong. Try again."})]}),ae=R.Modal??Ee;return H(ae,{open:e,onClose:n,closable:!0,title:l,className:u,children:se("div",{className:"p-6",children:[se("div",{className:"text-center mb-5",children:[H("div",{className:"flex justify-center mb-3",children:a==="pending"&&!S&&H(hs,{size:20,className:"animate-spin text-primary","data-testid":"loader-icon-inline"})}),H("h3",{className:"text-lg font-semibold m-0 text-foreground",children:l}),c&&H("p",{className:"text-sm text-muted-foreground mt-1.5 mb-0",children:c})]}),H("div",{className:"flex justify-center mb-4",children:le}),a==="pending"&&!S&&se("div",{className:"mb-3",children:[H("div",{className:"h-1 bg-muted rounded-full overflow-hidden",role:"progressbar","aria-valuenow":Math.round((1-ee)*100),"aria-valuemin":0,"aria-valuemax":100,children:H("div",{className:"h-full bg-primary rounded-full transition-all duration-1000",style:{width:`${(1-ee)*100}%`}})}),se("p",{"data-testid":"countdown",className:"text-xs text-muted-foreground text-center mt-1.5 mb-0",children:["Expires in ",ie,":",j.toString().padStart(2,"0")]})]}),se("div",{className:"flex flex-col gap-2",children:[x&&t&&a==="pending"&&!S&&se("button",{type:"button",onClick:He,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:[H(fs,{size:16})," Open in Wallet App"]}),_&&r&&(p?se(p,{onClick:r,variant:"default",size:"default",className:"w-full",children:[H(Oo,{size:16})," Generate New QR Code"]}):se("button",{type:"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:[H(Oo,{size:16})," Generate New QR Code"]})),p?H(p,{onClick:n,variant:"outline",size:"default",className:"w-full",children:"Cancel"}):H("button",{type:"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"})]})]})})}import{useState as on}from"react";import{LogIn as bs,Loader2 as xs,CheckCircle2 as an,AlertCircle as vs,X as Cs,Copy as ws,Check as Ns}from"lucide-react";import{Fragment as Fo,jsx as N,jsxs as K}from"react/jsx-runtime";function sn({className:t,isSignedIn:e=!1,isSigningIn:n=!1,result:o=null,error:r=null,onSignIn:a,onClearError:s,children:i}){let[l,c]=on(!1),[u,d]=on(!1),[m,h]=on(!1),g=B(),f=g.Button??V,y=g.Dialog,R=g.DialogContent,p=g.DialogHeader,x=g.DialogTitle,T=async()=>{if(o?.signature)try{await navigator.clipboard.writeText(o.signature),h(!1),d(!0),setTimeout(()=>d(!1),2e3)}catch{d(!1),h(!0)}};return!e&&!n&&!r?N(f,{onClick:a,className:t,"aria-label":"Sign In",children:K("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[N(bs,{size:16}),i??"Sign In"]})}):n?N(f,{disabled:!0,className:t,"aria-label":"Signing In",children:K("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[N(xs,{size:16,className:"animate-spin"}),"Signing In..."]})}):r&&!e?K("div",{style:{position:"relative",display:"inline-flex",flexDirection:"column"},children:[N(f,{onClick:a,className:t,"aria-label":"Retry Sign In",children:K("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[N(vs,{size:16,style:{color:"var(--destructive, #ef4444)"}}),i??"Retry Sign In"]})}),N("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})]}):K("div",{style:{position:"relative",display:"inline-block"},children:[N(f,{onClick:()=>c(S=>!S),className:t,children:K("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[N(an,{size:16,style:{color:"#22c55e"}}),N("span",{style:{fontSize:"0.875rem",fontWeight:500},children:"Signed In"})]})}),l&&(y&&R?N(y,{open:!0,onOpenChange:S=>{S||c(!1)},children:N(R,{children:p&&x?K(Fo,{children:[N(p,{children:N(x,{children:"Sign-In Details"})}),N(rn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:m,onCopy:T})]}):K(Fo,{children:[N("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Sign-In Details"}),N(rn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:m,onCopy:T})]})})}):l&&N("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:N(rn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:m,onCopy:T})}))]})}function rn({result:t,onClose:e,copiedSign:n,onCopy:o,copyFailed:r}){let s=B().Button??V;if(!t)return K("div",{style:{textAlign:"center",padding:"1rem 0"},children:[N(an,{size:32,style:{color:"#22c55e",margin:"0 auto 0.75rem"}}),N("p",{style:{fontSize:"0.875rem",color:"var(--muted-foreground, #64748b)"},children:"Authenticated successfully"}),N(s,{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 K("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[K("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[K("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[N(an,{size:18,color:"#22c55e"}),N("span",{style:{fontWeight:600,fontSize:"0.9375rem"},children:"Signed In"})]}),N(s,{variant:"ghost",size:"icon",onClick:e,children:N(Cs,{size:16})})]}),K("div",{style:{display:"grid",gap:"0.375rem"},children:[K("div",{children:[N("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Domain"}),N("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:i.domain})]}),K("div",{children:[N("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Address"}),N("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem",wordBreak:"break-all"},children:i.address})]}),K("div",{children:[N("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Chain"}),N("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:i.chainId})]})]}),i.statement&&N("div",{style:{padding:"0.5rem 0.625rem",borderRadius:"0.375rem",background:"var(--muted, #f1f5f9)",fontSize:"0.8125rem",lineHeight:1.5},children:i.statement}),K("div",{children:[K("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.25rem"},children:[N("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Signature"}),N(s,{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?N(Ns,{size:12,color:"#22c55e"}):N(ws,{size:12})})]}),N("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})]}),N(s,{variant:"outline",className:"w-full",onClick:e,children:"Close"})]})}import{useState as de,useCallback as ke,useMemo as Ko}from"react";import{AlertTriangle as ks,Check as ln,Copy as Ss,Download as Rs,Eye as Ts,EyeOff as Ps,SkipForward as qo,ArrowLeft as Bs,ArrowRight as Es,Shield as As,X as Ds}from"lucide-react";import{Fragment as dn,jsx as w,jsxs as A}from"react/jsx-runtime";function Ms(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 cn(t){let e=[...t];for(let n=e.length-1;n>0;n--){let o=Ms(n+1);[e[n],e[o]]=[e[o],e[n]]}return e}function jo(t,e=3){let n=t.trim().split(/\s+/);return cn(n.map((r,a)=>a)).slice(0,Math.min(e,n.length)).map(r=>{let a=n[r],s=n.filter((c,u)=>u!==r),i=cn(s).slice(0,3),l=cn([a,...i]);return{index:r,correct:a,options:l}})}function Ze({seedPhrase:t,onConfirm:e,onSkip:n,onExportPrivateKey:o,className:r,wordCount:a,inline:s=!1,open:i=!0,onOpenChange:l}){let c=B(),u=c.Button??V,d=c.Dialog,m=c.DialogContent,h=c.DialogHeader,g=c.DialogTitle,[f,y]=de("reveal"),[R,p]=de(!1),[x,T]=de(!1),[S,_]=de(!1),[D,ie]=de(()=>jo(t,3)),[j,ee]=de({}),[He,le]=de([]),[F,ae]=de(!1),[Q,Pe]=de(null),wn=Ko(()=>t.trim().split(/\s+/),[t]),Ar=Ko(()=>{let L=new Map;return wn.map($=>{let te=L.get($)??0;return L.set($,te+1),{word:$,key:`${$}-${te}`}})},[wn]),Dr=ke(()=>p(!0),[]),Mr=ke(async()=>{try{await navigator.clipboard.writeText(t),_(!1),T(!0),setTimeout(()=>T(!1),2e3)}catch{T(!1),_(!0)}},[t]),Ir=ke(()=>{ie(jo(t,3)),ee({}),le([]),y("confirm")},[t]),Lr=ke((L,$)=>{ee(te=>({...te,[L]:$})),le(te=>te.filter(kt=>kt!==L))},[]),zr=ke(()=>{let L=[];for(let $ of D)j[$.index]!==$.correct&&L.push($.index);if(L.length>0){le(L);return}y("done"),e()},[D,j,e]),Nn=ke(()=>{n?.()},[n]),Wr=ke(()=>{if(o){let L=o();Pe(L),ae(!0)}},[o]),Vr=D.every(L=>j[L.index]!==void 0),Ur=A("div",{className:"space-y-4",children:[w("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:A("div",{className:"flex items-start gap-2",children:[w(ks,{size:16,className:"mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"}),w("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?A(dn,{children:[w("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:Ar.map(({word:L,key:$},te)=>A("div",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2.5 py-1.5 text-sm",children:[w("span",{className:"text-xs text-muted-foreground w-5 shrink-0 text-right",children:te+1}),w("span",{className:"font-mono font-medium",children:L})]},$))}),A("div",{className:"flex flex-wrap gap-2",children:[A(u,{onClick:Mr,variant:"outline",size:"sm",children:[x?w(ln,{size:14}):w(Ss,{size:14}),x?"Copied":S?"Copy failed":"Copy"]}),o&&A(u,{onClick:Wr,variant:"outline",size:"sm",children:[w(Rs,{size:14}),"Export Private Key"]})]}),S&&w("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."}),F&&Q&&A("div",{className:"rounded-lg border border-border bg-muted p-3 space-y-2",children:[A("div",{className:"flex items-center gap-2",children:[w(Ps,{size:14,className:"text-muted-foreground"}),w("span",{className:"text-xs font-medium text-muted-foreground",children:"Private Key (keep secret!)"})]}),w("p",{className:"font-mono text-xs break-all select-all",children:Q})]}),A("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[A(u,{onClick:Ir,variant:"default",children:["I've Saved It",w(Es,{size:16})]}),n&&A(u,{onClick:Nn,variant:"ghost",size:"sm",children:[w(qo,{size:14}),"Skip Backup"]})]})]}):A("div",{className:"flex flex-col items-center gap-3 py-6",children:[w(As,{size:40,className:"text-muted-foreground"}),w("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."}),A(u,{onClick:Dr,variant:"default",children:[w(Ts,{size:16}),"Reveal Seed Phrase"]})]})]}),Hr=A("div",{className:"space-y-4",children:[w("p",{className:"text-sm text-muted-foreground",children:"Verify your backup by selecting the correct word for each position."}),D.map(L=>{let $=He.includes(L.index);return A("div",{className:"space-y-2",children:[A("p",{className:b("text-sm font-medium",$?"text-destructive":"text-foreground"),children:["Word #",L.index+1,$&&w("span",{className:"ml-2 text-xs text-destructive",children:"(incorrect)"})]}),w("div",{className:"grid grid-cols-2 gap-2",children:L.options.map(te=>{let kt=j[L.index]===te;return w("button",{type:"button",onClick:()=>Lr(L.index,te),className:b("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",kt?"border-primary bg-primary/10 text-primary font-medium":$?"border-destructive/50 bg-destructive/5":"border-border bg-card hover:border-primary/50"),children:te},`${L.index}-${te}`)})})]},L.index)}),A("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-between",children:[A(u,{onClick:zr,variant:"default",disabled:!Vr,children:[w(ln,{size:16}),"Verify & Confirm"]}),A("div",{className:"flex gap-2",children:[A(u,{onClick:()=>y("reveal"),variant:"ghost",size:"sm",children:[w(Bs,{size:14}),"Back"]}),n&&A(u,{onClick:Nn,variant:"ghost",size:"sm",children:[w(qo,{size:14}),"Skip"]})]})]})]}),Or={reveal:Ur,confirm:Hr,done:A("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[w("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:w(ln,{size:24,className:"text-green-600 dark:text-green-400"})}),w("p",{className:"font-medium text-foreground",children:"Backup Confirmed"}),w("p",{className:"text-sm text-muted-foreground",children:"Your seed phrase has been backed up successfully."})]})},_r={reveal:"Backup Seed Phrase",confirm:"Verify Backup",done:"Backup Complete"},at=Or[f],st=_r[f];return s?A("div",{className:b("space-y-4",r),children:[f!=="done"&&w("h3",{className:"text-lg font-semibold",children:st}),at]}):i?d&&m?w(d,{open:!0,onOpenChange:L=>{L||l?.(!1)},children:w(m,{children:h&&g?A(dn,{children:[w(h,{children:w(g,{children:st})}),w("div",{className:"mt-2 max-h-[55vh] overflow-y-auto",children:at})]}):A(dn,{children:[w("div",{className:"mb-3 text-lg font-semibold",children:st}),w("div",{className:"max-h-[55vh] overflow-y-auto",children:at})]})})}):A(Ee,{open:!0,onClose:()=>l?.(!1),children:[A("div",{className:"flex items-center justify-between mb-4",children:[w("h2",{className:"text-lg font-semibold m-0",children:st}),l&&w("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:w(Ds,{size:16})})]}),at]}):null}import Is from"react";import{Fragment as Qo,jsx as G,jsxs as he}from"react/jsx-runtime";function Ls({error:t,reset:e,dismiss:n,retryLabel:o="Try Again"}){let r=B(),a=r.Button??V,s=r.Dialog,i=r.DialogContent,l=r.DialogHeader,c=r.DialogTitle;if(s&&i)return G(s,{open:!0,onOpenChange:()=>{},children:G(i,{children:l&&c?he(Qo,{children:[G(l,{children:G(c,{children:"Something went wrong"})}),he("div",{style:{marginTop:"0.5rem"},children:[G("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."}),he("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&G(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),G(a,{variant:"default",size:"default",onClick:e,children:o})]})]})]}):he(Qo,{children:[G("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Something went wrong"}),G("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."}),he("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&G(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),G(a,{variant:"default",size:"default",onClick:e,children:o})]})]})})});let u=!0,d=n??void 0;return he(Ee,{open:u,onClose:d,children:[G(Ln,{title:"Something went wrong",onClose:d,showCloseButton:!!n}),he(zn,{children:[G("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."}),he("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&G(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),G(a,{variant:"default",size:"default",onClick:e,children:o})]})]})]})}var et=class extends Is.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}):G(Ls,{error:this.state.error,reset:this.handleReset,dismiss:this.props.onDismiss?this.handleDismiss:void 0,retryLabel:this.props.retryLabel}):this.props.children}};import{createContext as js,useContext as Qs,useMemo as $s}from"react";import{Web3ConnectProvider as Gs}from"@naculus/connect-appkit-react";import{createContext as Ws,useContext as Vs,useMemo as Ct,useEffect as wt,useCallback as Us,useState as Nt}from"react";var ze={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"}},zs=new Map;function un(){zs.clear()}import{jsx as Ks,jsxs as qs}from"react/jsx-runtime";var $o=Ws({theme:{},isDark:!1,setTheme:()=>{},toggleDarkMode:()=>{}}),Hs=/[;{}<>\r\n\\]/;function Os(t){let e=[];for(let[n,o]of Object.entries(t)){let r=ze[n];r&&o&&!Hs.test(String(o))&&e.push(" "+r.name+": "+o+";")}return e.length===0?"":`:root {
|
|
9
9
|
`+e.join(`
|
|
10
10
|
`)+`
|
|
11
|
-
}`}function Wa(t){let e=new Set;if(t!=="computed"||typeof document>"u")return e;for(let n of Object.keys(Le)){let o=Le[n],r=getComputedStyle(document.documentElement).getPropertyValue(o.name).trim();r&&r!==o.fallback&&e.add(n)}return e}function cn({children:t,theme:e={},defaultDark:n=!1,priority:o="fallback"}){let[r,s]=vt(e),[a,i]=vt(n);xt(()=>{ln()},[r]);let[l,c]=vt(new Set);xt(()=>{c(Wa(o))},[o]);let u=bt(()=>{if(o==="fallback"||l.size===0)return r;let f={};for(let[y,R]of Object.entries(r))!l.has(y)&&R&&(f[y]=R);return f},[r,o,l]),d=bt(()=>za(u),[u]);xt(()=>{if(typeof document>"u")return;let f=document.documentElement;a?f.classList.add("dark"):f.classList.remove("dark"),ln()},[a]);let m=bt(()=>"w3c-theme-"+Math.random().toString(36).slice(2,9),[]),h=Ia(()=>i(f=>!f),[]),g=bt(()=>({theme:r,isDark:a,setTheme:s,toggleDarkMode:h}),[r,a,h]);return Ua(_o.Provider,{value:g,children:[d?Ha("style",{id:m,children:d}):null,t]})}function Fo(){return Ma(_o)}function Va(t){let{theme:e}=Fo(),[n,o]=vt("");return xt(()=>{let r=Le[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||Le[t]?.fallback||""}import{jsx as Ze}from"react/jsx-runtime";var Ko=Oa({mode:"walletconnect"});function qa(){return _a(Ko)}function et({config:t,children:e,autoConnect:n=!1,detectionMode:o="walletconnect",theme:r,defaultDark:s=!1,themePriority:a="computed"}){let i=Fa(()=>({mode:o}),[o]),l=o==="walletconnect"||o==="auto";return Ze(Ko.Provider,{value:i,children:Ze(cn,{theme:r,defaultDark:s,priority:a,children:Ze(dn,{components:{QRCodeModal:Ye},children:Ze(Ka,{config:t,autoConnect:n,children:l?Ze(St,{children:e}):e})})})})}import{jsx as jo}from"react/jsx-runtime";function Ga({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 jo("button",{type:"button",className:r,...o})}var un={Button:Ga,ConnectButton:be,AccountButton:Bt,ChainSelector:ze,QRCodeModal:Ye,SignInButton:on,SeedPhraseBackup:Je,ErrorBoundary:Xe,Web3ConnectUI:et},qo=ja({});function dn({children:t,components:e={}}){let n=$a(()=>({...un,...e}),[e]);return jo(qo.Provider,{value:n,children:t})}function B(){return Qa(qo)}function Ya(t){return B()[t]}import{jsx as G,jsxs as ke}from"react/jsx-runtime";function Qo(t){let e=t&&typeof t=="object"&&"details"in t?t.details:void 0,n=e instanceof Error?`${e.name}: ${e.message}`:e;Xa.error("ui/ChainSelector","switchChain failed",t,n)}function tt({chainId:t,className:e}){let n=at(t);return n?G("span",{className:b("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function ze({className:t,showLabel:e=!0,variant:n="dropdown"}){let{currentChain:o,availableChains:r,switchChain:s}=ni(),{isConnected:a}=oi(),[i,l]=Za(!1),u=B().Button,d=ei(null);if(ti(()=>{function g(f){d.current&&!d.current.contains(f.target)&&l(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),!a)return null;let m=o?.name??"Unknown Chain",h=r.length>1;return n==="minimal"?ke("div",{className:b("inline-flex items-center gap-1.5 text-xs text-muted-foreground",t),children:[o&&G(tt,{chainId:o.caip2,className:"h-3.5 w-3.5"}),m]}):n==="buttons"?G("div",{className:b("flex flex-wrap gap-2",t),children:r.map(g=>{let f=g.caip2,y=f===o?.caip2;return ke(u,{className:y?b("bg-accent","border-primary"):"",onClick:()=>{y||s(f).catch(Qo)},children:[G(tt,{chainId:f,className:"h-4 w-4"}),g.name,g.token&&G("span",{className:"text-xs opacity-60",children:g.token})]},f)})}):h?ke("div",{ref:d,className:b("relative inline-block",t),children:[ke(u,{onClick:()=>l(!i),children:[o&&G(tt,{chainId:o.caip2,className:"h-4 w-4"}),m,G("svg",{"aria-hidden":"true",className:b("h-3 w-3 transition-transform",i&&"rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:G("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),i&&ke("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&&G("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Switch Network"}),r.map(g=>{let f=g.caip2,y=f===o?.caip2;return ke(u,{onClick:()=>{y||s(f).catch(Qo),l(!1)},className:b("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",y?"bg-accent font-medium":"hover:bg-accent/50"),children:[G(tt,{chainId:f,className:"h-4 w-4"}),G("span",{className:"flex-1 text-left",children:g.name}),g.token&&G("span",{className:"text-xs text-muted-foreground",children:g.token}),y&&G("svg",{"aria-hidden":"true",className:"h-4 w-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:G("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},f)})]})]}):ke("div",{className:b("inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm opacity-60 cursor-default",t),children:[o&&G(tt,{chainId:o.caip2,className:"h-4 w-4"}),m]})}import{useEmbeddedWallet as ri}from"@naculus/connect-appkit-react";import{Check as $o,Copy as si,Loader2 as ai,Plus as ii}from"lucide-react";import{useCallback as mn,useState as pn}from"react";import{jsx as J,jsxs as We}from"react/jsx-runtime";var li={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 ci(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-4)}`}function di({account:t,isActive:e,onSelect:n}){let[o,r]=pn(!1),s=li[t.namespace]??{name:t.namespace,detail:""},a=mn(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 We("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:b("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:[We("span",{className:"flex min-w-0 flex-1 flex-col",children:[We("span",{className:"flex items-center gap-2 font-medium",children:[s.name,e&&J("span",{className:"rounded-sm bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-primary",children:"Signing"})]}),J("span",{className:"truncate font-mono text-xs text-muted-foreground",children:ci(t.address)})]}),J("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?J($o,{size:14}):J(si,{size:14})}),e&&J($o,{size:16,className:"shrink-0 text-primary"})]})}function Go({className:t,hideBackfill:e=!1,onSelect:n,accounts:o,activeNamespace:r,canDerive:s,setActiveNamespace:a,backfillAccounts:i}){let[l,c]=pn(!1),[u,d]=pn(null),m=mn(f=>{if(f!==r)try{a(f),d(null),n?.(f)}catch(y){d(y instanceof Error?y.message:"Could not switch account")}},[r,a,n]),h=mn(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 g=!e&&s;return We("div",{className:b("flex flex-col gap-2",t),children:[We("div",{className:"flex items-baseline justify-between",children:[J("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Accounts"}),J("span",{className:"text-[11px] text-muted-foreground",children:"Chooses the signing key, not the network"})]}),J("div",{role:"radiogroup","aria-label":"Wallet accounts",className:"flex flex-col gap-1.5",children:o.map(f=>J(di,{account:f,isActive:f.namespace===r,onSelect:()=>m(f.namespace)},f.namespace))}),g&&We("button",{type:"button",onClick:h,disabled:l,className:b("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?J(ai,{size:14,className:"animate-spin"}):J(ii,{size:14}),l?"Deriving\u2026":"Show accounts this phrase already owns"]}),u&&J("p",{role:"alert",className:"text-xs text-destructive",children:u})]})}function ui(t){let{wallet:e,accounts:n,activeNamespace:o,setActiveNamespace:r,backfillAccounts:s}=ri();return e?J(Go,{...t,accounts:n,activeNamespace:o,canDerive:e.recoveryAvailable&&n.length<2,setActiveNamespace:r,backfillAccounts:s}):null}import{AlertTriangle as mi,Info as Jo,ShieldAlert as pi,ShieldCheck as fi}from"lucide-react";import{useEmbeddedWallet as gi}from"@naculus/connect-appkit-react";import{jsx as te,jsxs as oe}from"react/jsx-runtime";var hi={critical:pi,warning:mi,info:Jo},yi={critical:"text-destructive",warning:"text-amber-600 dark:text-amber-500",info:"text-muted-foreground"};function Yo(t){return t>=90?"text-emerald-600 dark:text-emerald-500":t>=70?"text-amber-600 dark:text-amber-500":"text-destructive"}function bi({finding:t}){let e=hi[t.severity]??Jo;return oe("li",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[te(e,{size:16,className:b("mt-0.5 shrink-0",yi[t.severity])}),oe("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[oe("div",{className:"flex items-baseline justify-between gap-2",children:[te("span",{className:"text-sm font-medium",children:t.title}),t.deduction>0&&oe("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:["\u2212",t.deduction]})]}),te("p",{className:"text-xs leading-relaxed text-muted-foreground",children:t.detail}),t.remedy&&oe("p",{className:"text-xs leading-relaxed",children:[te("span",{className:"font-medium",children:"What helps: "}),te("span",{className:"text-muted-foreground",children:t.remedy})]})]})]})}function Xo({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 oe("div",{className:b("flex flex-col gap-3",t),children:[oe("div",{className:"flex items-center gap-3 rounded-lg border border-border px-4 py-3",children:[te(fi,{size:22,className:b("shrink-0",Yo(o))}),oe("div",{className:"flex min-w-0 flex-1 flex-col",children:[oe("div",{className:"flex items-baseline gap-2",children:[te("span",{className:b("text-2xl font-semibold tabular-nums",Yo(o)),children:o}),te("span",{className:"text-sm text-muted-foreground",children:"/ 100"}),oe("span",{className:"ml-auto text-xs text-muted-foreground",children:["Tier ",r]})]}),oe("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?te("p",{className:"text-xs text-muted-foreground",children:"Nothing is holding this score down."}):te("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."}),te("ul",{className:"flex flex-col gap-1.5",children:c.map(d=>te(bi,{finding:d},d.id))})]})}function xi(t){let{securityReport:e}=gi();return te(Xo,{...t,report:e})}import{useCallback as vi,useEffect as Ci,useRef as wi,useState as fn}from"react";import{Eye as Ni,EyeOff as ki,KeyRound as Si,ShieldAlert as Ri}from"lucide-react";import{usePassphraseGate as Ti}from"@naculus/connect-appkit-react";import{jsx as U,jsxs as he}from"react/jsx-runtime";var gn=8,Pi=12;function Zo({className:t,request:e,submit:n,cancel:o}){let[r,s]=fn(""),[a,i]=fn(""),[l,c]=fn(!1),u=wi(null),d=e?.intent==="create";Ci(()=>{if(!e){s(""),i(""),c(!1);return}s(""),i(""),u.current?.focus()},[e]);let m=d&&r.length>0&&r.length<gn,h=d&&a.length>0&&a!==r,g=d?r.length>=gn&&a===r:r.length>0,f=vi(y=>{y.preventDefault(),g&&n(r)},[g,n,r]);return e?U("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"presentation",children:he("form",{role:"dialog","aria-modal":"true","aria-label":d?"Choose a passphrase":"Unlock your wallet",onSubmit:f,className:b("flex w-full max-w-sm flex-col gap-4 rounded-lg border border-border bg-card p-5 shadow-lg",t),children:[he("div",{className:"flex items-center gap-2",children:[U(Si,{size:18,className:"shrink-0 text-primary"}),U("h2",{className:"text-base font-semibold",children:d?"Choose a passphrase":"Unlock your wallet"})]}),e.previousError&&U("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:e.previousError}),U("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."}),he("label",{className:"flex flex-col gap-1.5",children:[U("span",{className:"text-xs font-medium",children:"Passphrase"}),he("span",{className:"relative flex items-center",children:[U("input",{ref:u,type:l?"text":"password",value:r,onChange:y=>s(y.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"}),U("button",{type:"button","aria-label":l?"Hide passphrase":"Show passphrase",onClick:()=>c(y=>!y),className:"absolute right-2 text-muted-foreground hover:text-foreground",children:l?U(ki,{size:15}):U(Ni,{size:15})})]})]}),d&&he("label",{className:"flex flex-col gap-1.5",children:[U("span",{className:"text-xs font-medium",children:"Type it again"}),U("input",{type:l?"text":"password",value:a,onChange:y=>i(y.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&&he("p",{role:"alert",className:"text-xs text-destructive",children:["At least ",gn," characters."]}),h&&U("p",{role:"alert",className:"text-xs text-destructive",children:"These do not match."}),d&&!m&&r.length>0&&r.length<Pi&&U("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&&he("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:[U(Ri,{size:14,className:"mt-0.5 shrink-0"}),U("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."})]}),he("div",{className:"flex justify-end gap-2 pt-1",children:[U("button",{type:"button",onClick:()=>o(),className:"rounded-md border border-border px-3 py-2 text-sm hover:bg-accent",children:"Cancel"}),U("button",{type:"submit",disabled:!g,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 Bi(t){let{request:e,submit:n,cancel:o}=Ti();return U(Zo,{...t,request:e,submit:n,cancel:o})}import{useCallback as nr,useState as hn}from"react";import{Fingerprint as er,Loader2 as Ei,ShieldAlert as tr,ShieldCheck as Ai,TriangleAlert as Di}from"lucide-react";import{useEmbeddedWallet as Mi,useWeb3 as Ii}from"@naculus/connect-appkit-react";import{Fragment as zi,jsx as X,jsxs as Ve}from"react/jsx-runtime";function or({className:t,passkeys:e,unlock:n,onRegistered:o}){let[r,s]=hn(!1),[a,i]=hn(null),[l,c]=hn(!1),u=!!e?.hasCredential?.()||l,d=nr(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,h=null;if(u)switch(n?.prf){case"available":h=m?{tone:"good",icon:X(Ai,{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:X(Di,{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":h={tone:"bad",icon:X(tr,{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:h={tone:"neutral",icon:X(er,{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 g={good:"text-emerald-600 dark:text-emerald-500",warn:"text-amber-600 dark:text-amber-500",bad:"text-destructive",neutral:"text-muted-foreground"};return Ve("div",{className:b("flex flex-col gap-3",t),children:[h?Ve("div",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[X("span",{className:b("mt-0.5 shrink-0",g[h.tone]),children:h.icon}),Ve("div",{className:"flex min-w-0 flex-col gap-1",children:[X("span",{className:"text-sm font-medium",children:h.title}),X("p",{className:"text-xs leading-relaxed text-muted-foreground",children:h.detail})]})]}):Ve(zi,{children:[X("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."}),Ve("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:[X(tr,{size:14,className:"mt-0.5 shrink-0"}),X("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."})]}),Ve("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?X(Ei,{size:15,className:"animate-spin"}):X(er,{size:15}),r?"Waiting for your device\u2026":"Protect with a passkey"]})]}),a&&X("p",{role:"alert",className:"text-xs text-destructive",children:a})]})}function Li(t){let{client:e}=Ii(),{securityReport:n,hasWallet:o}=Mi(),r=nr(async()=>{let s=e?.embeddedConnector;s&&o&&await s.save()},[e,o]);return X(or,{...t,passkeys:e?.passkeysConnector??null,unlock:n?.unlock,onRegistered:r})}import{useAccount as sr,useBalance as Wi,useChain as Vi,useDisconnect as ar,useEmbeddedWallet as Hi,useWallet as Ui,useWeb3 as Oi}from"@naculus/connect-appkit-react";import{createContext as _i,useCallback as nt,useContext as Fi,useEffect as Ki,useMemo as ir,useState as rr}from"react";import{jsx as Se,jsxs as pr}from"react/jsx-runtime";var lr=_i(null);function cr(){let t=Fi(lr);if(!t)throw new Error("useAppKit must be used within an <AppKit> component");return t}function dr({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:h="computed",detectionMode:g="auto"}){let[f,y]=rr(!1),[R,p]=rr(!1),x=ir(()=>({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 Se(et,{config:x,autoConnect:u,detectionMode:g,theme:d,defaultDark:m,themePriority:h,children:Se(qi,{className:c,open:f,setOpen:y,backupOpen:R,setBackupOpen:p,children:l})})}function qi({children:t,className:e,open:n,setOpen:o,backupOpen:r,setBackupOpen:s}){let{isConnected:a,isConnecting:i}=Ui(),{primaryAccount:l}=sr(),{currentChain:c,availableChains:u,switchChain:d}=Vi(),m=Hi(),{disconnect:h}=ar(),{wallets:g,hasWallets:f}=Ue(),{formatted:y}=Wi(),R=y??null,p=nt(async()=>{await h()},[h]),x=nt(()=>{m.confirmBackup(),s(!1)},[m,s]),T=nt(()=>{m.confirmBackup(),s(!1)},[m,s]),S=nt(()=>m.getPrivateKey(),[m]),O=ir(()=>({connect:()=>o(!0),disconnect:p,isConnected:a,isConnecting:i,address:l,balance:R,balanceSymbol:c?.token??null,chainName:c?.name??null,availableChains:u.map(D=>({caip2:D.caip2,name:D.name,token:D.token})),switchChain:d,wallets:g,hasWallets:f,backupPending:m.backupPending,seedPhrase:m.seedPhrase,confirmBackup:x,skipBackup:T,open:n,setOpen:o}),[a,i,l,R,c,u,d,g,f,m.backupPending,m.seedPhrase,x,T,p,n,o]);return Ki(()=>{m.seedPhrase&&m.backupPending&&s(!0)},[m.seedPhrase,m.backupPending,s]),pr(lr.Provider,{value:O,children:[t,m.seedPhrase&&r&&Se(Je,{seedPhrase:m.seedPhrase,onConfirm:x,onSkip:T,onExportPrivateKey:S,open:r,onOpenChange:s})]})}function ur({className:t}){let e=cr(),{connectInjected:n}=Oi(),{primaryAccount:o}=sr(),{disconnect:r}=ar(),s=nt(async(a,i,l)=>{a==="injected"&&(await n(l),i())},[n]);return e.isConnected&&o?pr("div",{className:b("inline-flex items-center gap-2",t),children:[Se(ze,{variant:"minimal"}),Se(be,{isConnected:e.isConnected,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:s,className:t})]}):Se(be,{isConnected:e.isConnected,isConnecting:e.isConnecting,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:s,className:t})}function mr({className:t,variant:e="dropdown"}){return Se(ze,{className:t,variant:e})}try{let t=un;t&&Object.assign(t,{AppKit:dr,AppKitButton:ur,AppKitChainSelector:mr})}catch{}import{ArrowRight as ji,CheckCircle2 as Qi,Clock as $i,DollarSign as Gi,Loader2 as yr,XCircle as Yi,AlertCircle as Ji}from"lucide-react";import{Fragment as hr,jsx as v,jsxs as z}from"react/jsx-runtime";function Xi(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 fr(t){return t.symbol||"UNKNOWN"}function Zi(t){let e=t.toLowerCase();return e.includes("lifi")?"default":e.includes("axelar")?"secondary":"outline"}function el(t){return t.length>12?`${t.slice(0,6)}...${t.slice(-6)}`:t}function tl({route:t,onSelect:e}){let n=B(),o=n.Button,r=n.Badge,s=t.provider??"Route";return z("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4 transition-colors hover:bg-accent/30",children:[z("div",{className:"flex flex-col gap-1.5 min-w-0",children:[z("div",{className:"flex items-center gap-2",children:[r?v(r,{variant:Zi(s),children:s}):v("span",{className:"inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",children:s}),t.steps.length>1&&z("span",{className:"text-xs text-muted-foreground",children:[t.steps.length," steps"]})]}),z("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm",children:[z("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[v(Gi,{className:"h-3.5 w-3.5"}),"$",t.gasCosts.totalUsd]}),z("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[v($i,{className:"h-3.5 w-3.5"}),Xi(t.steps.reduce((a,i)=>{let l=t.estimatedTime>0?15e3:0;return a+l},0))]}),z("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[t.gasCosts.totalUsd," cost"]})]})]}),v(o,{variant:"outline",size:"sm",onClick:e,children:"Select"})]})}function nl(){let e=B().Skeleton;return z("div",{className:"flex flex-col gap-3","data-testid":"route-selector-loading",children:[z("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[v(yr,{className:"h-4 w-4 animate-spin"}),v("span",{children:"Fetching best routes..."})]}),[1,2,3].map(n=>z("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4",children:[v("div",{className:"flex flex-col gap-2 flex-1",children:e?z(hr,{children:[v(e,{className:"h-4 w-24"}),v(e,{className:"h-3 w-48"})]}):z(hr,{children:[v("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),v("div",{className:"h-3 w-48 animate-pulse rounded bg-muted"})]})}),e?v(e,{className:"h-8 w-20 rounded-md"}):v("div",{className:"h-8 w-20 animate-pulse rounded-md bg-muted"})]},n))]})}function ol(){return z("div",{className:"flex flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground","data-testid":"route-selector-empty",children:[v(Ji,{className:"h-8 w-8 opacity-40"}),v("span",{children:"No routes found for this pair"}),v("span",{className:"text-xs",children:"Try a different token or amount"})]})}function rl({error:t,onRetry:e}){let o=B().Button;return z("div",{className:"flex flex-col items-center justify-center gap-2 py-6","data-testid":"route-selector-error",children:[v(Yi,{className:"h-8 w-8 text-destructive"}),v("p",{className:"text-sm text-destructive font-medium",children:"Failed to fetch routes"}),v("p",{className:"text-xs text-muted-foreground max-w-xs text-center",children:t}),e&&v(o,{variant:"outline",size:"sm",onClick:e,children:"Retry"})]})}function sl(){let e=B().Progress;return z("div",{className:"flex flex-col items-center gap-3 py-6","data-testid":"route-selector-executing",children:[v(yr,{className:"h-6 w-6 animate-spin text-primary"}),v("p",{className:"text-sm font-medium",children:"Executing route..."}),v("p",{className:"text-xs text-muted-foreground",children:"Please confirm the transaction in your wallet"}),e?v(e,{value:50,className:"w-48 h-1.5"}):v("div",{className:"h-1.5 w-48 rounded-full bg-muted",children:v("div",{className:"h-full w-1/2 rounded-full bg-primary animate-pulse"})})]})}function al({txHash:t}){return z("div",{className:"flex flex-col items-center gap-2 py-6","data-testid":"route-selector-success",children:[v(Qi,{className:"h-8 w-8 text-green-500"}),v("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Route executed successfully!"}),z("p",{className:"text-xs text-muted-foreground font-mono",children:["TX: ",el(t)]})]})}function gr({chainId:t,className:e}){let n=at(`eip155:${t}`);return n?v("span",{className:b("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function il({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,h=d.Button;if(l)return v("div",{className:b("rounded-lg border border-border",u),children:v(al,{txHash:l})});if(s)return v("div",{className:b("rounded-lg border border-border",u),children:v(sl,{})});return m?z(m,{className:b("p-4",u),children:[f(),y(),R()]}):z("div",{className:b("rounded-lg border border-border p-4",u),children:[f(),y(),R()]});function f(){return!t&&!e?null:z("div",{className:"mb-4 flex flex-wrap items-center gap-2 text-sm",children:[t&&z("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[v(gr,{chainId:t.chainId,className:"h-4 w-4"}),n?`${n.toString()} `:"",fr(t)]}),t&&e&&v(ji,{className:"h-3.5 w-3.5 text-muted-foreground"}),e&&z("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[v(gr,{chainId:e.chainId,className:"h-4 w-4"}),fr(e)]})]})}function y(){return r?v(nl,{}):c?v(rl,{error:c}):o.length===0?v(ol,{}):v("div",{className:"flex flex-col gap-2","data-testid":"route-selector-routes",children:o.map((p,x)=>v(tl,{route:p,onSelect:()=>a?.(p)},`${p.fromChain}-${p.toChain}-${p.gasCosts.totalUsd}-${x}`))})}function R(){return!r&&o.length===0&&!c?null:v("div",{className:"mt-4 flex justify-end",children:v(h,{variant:"ghost",size:"sm",onClick:i,children:"Cancel"})})}}import ll from"react";import{Shield as cl,ShieldCheck as br,LoaderCircle as dl,Settings as ul,ChevronRight as ml,AlertCircle as pl,RotateCcw as fl,CheckCircle2 as gl,Fuel as xr,Zap as hl,RefreshCw as yl}from"lucide-react";import{Fragment as vl,jsx as k,jsxs as W}from"react/jsx-runtime";function bl(t){let e=Number(t)/1e18;return e<.001?`~${e.toFixed(6)} ETH`:`~${e.toFixed(3)} ETH`}function xl({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?W(l,{variant:"outline",className:"w-full",onClick:s,children:[k(ul,{size:15})," Advanced Settings ",k(ml,{size:14,className:"text-muted-foreground"})]}):null;return t?W(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[k("div",{className:"flex items-start justify-between",children:W("div",{className:"flex items-center gap-3",children:[k("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-green-500/10",children:k(br,{size:22,className:"text-green-500"})}),W("div",{children:[W("div",{className:"flex items-center gap-2",children:[k("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),W(u,{variant:"secondary",className:"rounded-full bg-green-500/10 px-2 py-0 text-xs font-medium text-green-500",children:[k(gl,{size:12,className:"mr-0.5 inline"})," Deployed"]})]}),k("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Your wallet has been upgraded to a smart wallet"})]})]})}),k("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[[xr,"Gas Sponsorship","Enabled"],[yl,"Recovery","Enabled"]].map(([m,h,g])=>W("div",{className:"rounded-lg bg-muted/50 p-3",children:[W("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[ll.createElement(m,{size:14}),k("span",{children:h})]}),k("div",{className:"mt-1 text-sm font-medium text-foreground",children:g})]},h))}),s&&k("div",{className:"mt-4",children:d})]}):e?k(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:W("div",{className:"flex flex-col items-center text-center",children:[k("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:k(dl,{size:28,className:"animate-spin text-primary"})}),k("h3",{className:"mb-1 text-base font-semibold text-foreground",children:"Deploying Smart Wallet..."}),k("p",{className:"mb-4 text-sm text-muted-foreground",children:"Please wait, contract deployment may take a few seconds"}),k("div",{className:"h-2 w-full max-w-[200px] overflow-hidden rounded-full bg-muted",children:k("div",{className:"h-full w-full animate-pulse rounded-full bg-primary",style:{animationDuration:"1.5s"}})})]})}):o?W(c,{className:"w-full rounded-xl border border-destructive/30 bg-destructive/5 p-5 shadow-sm",children:[W("div",{className:"flex items-start gap-3",children:[k("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-destructive/10",children:k(pl,{size:18,className:"text-destructive"})}),W("div",{className:"min-w-0 flex-1",children:[k("h4",{className:"text-sm font-semibold text-destructive",children:"Deployment Failed"}),k("p",{className:"mt-1 text-xs text-destructive/80 break-words",children:o}),a&&W(l,{variant:"outline",size:"sm",className:"mt-3 border-destructive/30 text-destructive hover:bg-destructive/10",onClick:a,children:[k(fl,{size:13})," Retry"]})]})]}),s&&k("div",{className:"mt-3",children:d})]}):W(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[W("div",{className:"flex items-center gap-3",children:[k("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/10",children:k(cl,{size:20,className:"text-amber-500"})}),W("div",{children:[W("div",{className:"flex items-center gap-2",children:[k("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),k("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:"Not Upgraded"})]}),k("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Upgrade to a smart wallet for more features"})]})]}),W("div",{className:"mt-4 space-y-2",children:[k(yn,{icon:hl,color:"text-green-500",text:"No ETH needed for transactions \u2014 pay gas with USDC/USDT"}),k(yn,{icon:xr,color:"text-blue-500",text:"Optional dApp sponsorship, zero-cost transactions"}),k(yn,{icon:br,color:"text-purple-500",text:"Secure recovery mechanism, no fear of losing keys"})]}),r&&W(l,{className:"mt-4 w-full",onClick:r,children:["Upgrade Now",n!==void 0&&W("span",{className:"ml-1 text-xs opacity-80",children:["(Estimated gas fee: ",bl(n),")"]})]}),s&&W(vl,{children:[W("div",{className:"mt-4 mb-3 flex items-center gap-2",children:[k("div",{className:"h-px flex-1 bg-border"}),k("span",{className:"text-xs text-muted-foreground",children:"or"}),k("div",{className:"h-px flex-1 bg-border"})]}),d]})]})}function yn({icon:t,color:e,text:n}){return W("div",{className:"flex items-center gap-2.5 text-sm text-foreground/80",children:[k(t,{size:14,className:`shrink-0 ${e}`}),k("span",{children:n})]})}import{useState as bn,useCallback as vr}from"react";import{ArrowLeft as Cr,Save as Cl,Shield as wr,Users as Nr,KeyRound as kr,Fuel as wl,Wrench as Nl,Plus as kl,X as Sl}from"lucide-react";import{jsx as C,jsxs as M}from"react/jsx-runtime";var Rl=[{value:"simple",label:"Single Sign (default)",description:"Single key control, simple and secure",icon:C(wr,{size:16})},{value:"multi-sig",label:"Multi-Sign (2-of-3)",description:"Requires multiple signers to authorize transactions",icon:C(Nr,{size:16})},{value:"social-recovery",label:"Social Recovery",description:"Set guardian accounts to help recover",icon:C(kr,{size:16})}],Tl=[{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"}],Pl=[{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 Bl(){return{accountType:"simple",paymasterType:"self",customPaymasterUrl:"",bundlerPreset:"pimlico",customBundlerUrl:"",guardians:[],threshold:2}}function El({currentConfig:t,onSave:e,onBack:n}){let o=B(),r=o.Button,s=o.Input,a=o.Card,i=o.Separator,[l,c]=bn({...Bl(),...t}),[u,d]=bn(""),[m,h]=bn(!1),g=p=>b("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",y=vr(()=>{e?.(l),h(!0),setTimeout(()=>h(!1),2e3)},[l,e]),R=vr(()=>{let p=u.trim();!p||l.guardians.includes(p)||(c(x=>({...x,guardians:[...x.guardians,p]})),d(""))},[u,l.guardians]);return M(a,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[C("div",{className:"flex items-center justify-between mb-5",children:M("div",{className:"flex items-center gap-2",children:[n&&M(r,{variant:"ghost",size:"sm",onClick:n,children:[C(Cr,{size:15}),"Back"]}),C("h2",{className:"text-lg font-semibold text-foreground",children:"Smart Wallet Settings"})]})}),M("section",{className:"mb-6",children:[M("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[C(wr,{size:15})," Verification Method"]}),C("div",{className:"space-y-2",children:Rl.map(p=>M("label",{className:g(l.accountType===p.value),children:[C("input",{type:"radio",name:"accountType",value:p.value,checked:l.accountType===p.value,onChange:()=>c(x=>({...x,accountType:p.value})),className:"h-4 w-4 text-primary accent-primary"}),C("div",{className:"flex items-center gap-2 text-foreground",children:p.icon}),M("div",{children:[C("div",{className:"text-sm font-medium text-foreground",children:p.label}),C("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))})]}),l.accountType==="social-recovery"&&M("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[M("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[C(kr,{size:14})," Guardian Addresses"]}),C("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&&C("div",{className:"mb-3 space-y-1.5",children:l.guardians.map(p=>M("div",{className:"flex items-center justify-between rounded-md bg-card px-3 py-2 text-sm",children:[M("span",{className:"font-mono text-xs text-foreground",children:[p.slice(0,8),"...",p.slice(-6)]}),C(r,{variant:"ghost",size:"icon",onClick:()=>c(x=>({...x,guardians:x.guardians.filter(T=>T!==p)})),children:C(Sl,{size:14})})]},p))}),M("div",{className:"flex gap-2",children:[C(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"}),M(r,{size:"sm",onClick:R,disabled:!u.trim(),children:[C(kl,{size:14})," Add"]})]})]}),l.accountType==="multi-sig"&&M("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[M("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[C(Nr,{size:14})," Signing Threshold"]}),C("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set how many signers are needed to authorize a transaction"}),C("div",{className:"flex items-center gap-3",children:[1,2,3].map(p=>M("label",{className:g(l.threshold===p),children:[C("input",{type:"radio",name:"threshold",value:p,checked:l.threshold===p,onChange:()=>c(x=>({...x,threshold:p})),className:"sr-only"}),p,"-of-3"]},p))})]}),C(i,{className:"my-4"}),M("section",{className:"mb-6",children:[M("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[C(wl,{size:15})," Gas Fees"]}),C("div",{className:"space-y-2",children:Tl.map(p=>M("label",{className:g(l.paymasterType===p.value),children:[C("input",{type:"radio",name:"paymasterType",value:p.value,checked:l.paymasterType===p.value,onChange:()=>c(x=>({...x,paymasterType:p.value})),className:"h-4 w-4 text-primary accent-primary"}),M("div",{className:"flex-1",children:[C("div",{className:"text-sm font-medium text-foreground",children:p.label}),C("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))}),l.paymasterType==="custom"&&C("div",{className:"mt-3",children:C("input",{type:"text",placeholder:"Custom Paymaster URL",value:l.customPaymasterUrl,onChange:p=>c(x=>({...x,customPaymasterUrl:p.target.value})),className:f})})]}),C(i,{className:"my-4"}),M("section",{className:"mb-6",children:[M("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[C(Nl,{size:15})," Bundler"]}),C("div",{className:"space-y-2",children:Pl.map(p=>M("label",{className:g(l.bundlerPreset===p.value),children:[C("input",{type:"radio",name:"bundlerPreset",value:p.value,checked:l.bundlerPreset===p.value,onChange:()=>c(x=>({...x,bundlerPreset:p.value})),className:"h-4 w-4 text-primary accent-primary"}),M("div",{className:"flex-1",children:[C("div",{className:"text-sm font-medium text-foreground",children:p.label}),C("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))}),l.bundlerPreset==="custom"&&C("div",{className:"mt-3",children:C("input",{type:"text",placeholder:"Custom Bundler URL",value:l.customBundlerUrl,onChange:p=>c(x=>({...x,customBundlerUrl:p.target.value})),className:f})})]}),M("div",{className:"flex items-center gap-3",children:[M(r,{className:"flex-1",onClick:y,children:[C(Cl,{size:15}),m?"Saved \u2713":"Save Settings"]}),n&&M(r,{variant:"outline",onClick:n,children:[C(Cr,{size:15}),"\u2190 Back to Simple Mode"]})]})]})}import{AlertTriangle as Al,CheckCircle as Dl,ShieldAlert as Ml,X as Il}from"lucide-react";import{useValidateDestination as Ll}from"@naculus/connect-appkit-react";import{jsx as K,jsxs as ye}from"react/jsx-runtime";var zl={ok:{icon:K(Dl,{size:20}),label:"No problem found",colorClass:"text-muted-foreground",bgClass:"bg-muted",buttonVariant:"default"},warning:{icon:K(Al,{size:20}),label:"Warning",colorClass:"text-[hsl(var(--warning,38_92%_50%))]",bgClass:"bg-[hsl(var(--warning)/0.1)]",buttonVariant:"default"},blocked:{icon:K(Ml,{size:20}),label:"Blocked",colorClass:"text-destructive",bgClass:"bg-destructive/10",buttonVariant:"destructive"}};function Wl({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}=Ll({address:t}),{level:d,warning:m}=u,h=zl[d],g=d==="blocked",f=t.length>12?`${t.slice(0,6)}...${t.slice(-4)}`:t,y=p=>b("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=ye("div",{className:"flex flex-col gap-4",children:[ye("div",{className:b("flex items-center gap-3 rounded-lg p-4",h.bgClass),children:[K("span",{className:h.colorClass,children:h.icon}),ye("div",{className:"flex flex-col gap-0.5",children:[K("span",{className:b("text-sm font-semibold",h.colorClass),children:h.label}),K("span",{className:"text-xs text-muted-foreground break-all font-mono",children:f})]})]}),m&&K("p",{className:"text-sm text-muted-foreground m-0",children:m}),ye("div",{className:"flex gap-2 justify-end pt-2",children:[s?K(s,{onClick:n,variant:"outline",className:"w-full sm:w-auto",children:"Cancel"}):K("button",{type:"button",onClick:n,className:b(y("outline"),"w-full sm:w-auto"),children:"Cancel"}),o&&(s?K(s,{onClick:o,variant:g?"destructive":"default",disabled:g,className:"w-full sm:w-auto",children:"Proceed anyway"}):K("button",{type:"button",onClick:o,disabled:g,className:b(y(g?"destructive":"default"),"w-full sm:w-auto"),children:"Proceed anyway"}))]})]});return a&&i&&l&&c?K(a,{open:e,onOpenChange:p=>{p||n()},children:ye(i,{className:"sm:max-w-md",children:[K(l,{children:K(c,{children:"Address Warning"})}),R]})}):e?ye("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[K("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:n}),ye("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:[ye("div",{className:"flex items-center justify-between mb-4",children:[K("h2",{className:"text-lg font-semibold m-0",children:"Address Warning"}),K("button",{onClick:n,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close",children:K(Il,{size:16})})]}),R]})]}):null}import{Wallet as Sr,AlertCircle as Vl}from"lucide-react";import{jsx as Y,jsxs as Re}from"react/jsx-runtime";function Hl({wallets:t,onSelect:e,loading:n=!1,error:o=null}){let s=B().Card,a=i=>s?Y(s,{className:"p-4",children:i}):Y("div",{className:"rounded-xl border bg-card text-card-foreground shadow-sm p-4",children:i});return n?a(Re("div",{className:"flex flex-col gap-3",children:[Array.from({length:3}).map((i,l)=>Re("div",{className:"flex items-center gap-3 p-3 rounded-lg animate-pulse",children:[Y("div",{className:"h-10 w-10 rounded-full bg-muted"}),Y("div",{className:"h-4 w-32 rounded bg-muted"})]},l)),Y("p",{className:"text-xs text-muted-foreground text-center m-0",children:"Detecting wallets..."})]})):o?a(Re("div",{className:"flex flex-col items-center gap-3 py-4",children:[Y(Vl,{size:24,className:"text-destructive"}),Y("p",{className:"text-sm text-destructive m-0 font-medium",children:o})]})):t.length===0?a(Re("div",{className:"flex flex-col items-center gap-3 py-6",children:[Y(Sr,{size:32,className:"text-muted-foreground"}),Re("p",{className:"text-sm text-muted-foreground m-0 text-center",children:["No wallets detected.",Y("br",{}),"Install a browser wallet extension to get started."]})]})):Y("div",{className:"flex flex-col gap-2",children:t.map(i=>Re("button",{type:"button",onClick:()=>e(i),className:b("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?Y("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"}}):Y("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center shrink-0",children:Y(Sr,{size:18,className:"text-muted-foreground"})}),Re("div",{className:"flex flex-col items-start gap-0.5 text-left min-w-0",children:[Y("span",{className:"text-sm font-medium truncate w-full",children:i.name}),Y("span",{className:"text-xs text-muted-foreground truncate w-full",children:i.rdns})]})]},i.id))})}export{Bt as AccountButton,ui as AccountSelector,Go as AccountSelectorView,Wl as AddressWarningDialog,dr as AppKit,ur as AppKitButton,mr as AppKitChainSelector,ze as ChainSelector,be as ConnectButton,Xe as ErrorBoundary,Li as PasskeySetup,or as PasskeySetupView,Bi as PassphraseDialog,Zo as PassphraseDialogView,Ye as QRCodeModal,il as RouteSelector,Je as SeedPhraseBackup,on as SignInButton,El as SmartWalletSettings,xl as SmartWalletToggle,cn as ThemeProvider,St as WalletConnectProvider,Hl as WalletPicker,xi as WalletSecurityPanel,Xo as WalletSecurityPanelView,dn as Web3ComponentProvider,et as Web3ConnectUI,b as cn,cr as useAppKit,Ya as useComponent,B as useComponentRegistry,qa as useDetectionMode,Ue as useEIP6963,Oe as useIsMobile,Fo as useTheme,Va as useThemeVariable,$r as useWalletConnect,Rt as useWalletConnectOptional};
|
|
11
|
+
}`}function _s(t){let e=new Set;if(t!=="computed"||typeof document>"u")return e;for(let n of Object.keys(ze)){let o=ze[n],r=getComputedStyle(document.documentElement).getPropertyValue(o.name).trim();r&&r!==o.fallback&&e.add(n)}return e}function mn({children:t,theme:e={},defaultDark:n=!1,priority:o="fallback"}){let[r,a]=Nt(e),[s,i]=Nt(n);wt(()=>{un()},[r]);let[l,c]=Nt(new Set);wt(()=>{c(_s(o))},[o]);let u=Ct(()=>{if(o==="fallback"||l.size===0)return r;let f={};for(let[y,R]of Object.entries(r))!l.has(y)&&R&&(f[y]=R);return f},[r,o,l]),d=Ct(()=>Os(u),[u]);wt(()=>{if(typeof document>"u")return;let f=document.documentElement;s?f.classList.add("dark"):f.classList.remove("dark"),un()},[s]);let m=Ct(()=>"w3c-theme-"+Math.random().toString(36).slice(2,9),[]),h=Us(()=>i(f=>!f),[]),g=Ct(()=>({theme:r,isDark:s,setTheme:a,toggleDarkMode:h}),[r,s,h]);return qs($o.Provider,{value:g,children:[d?Ks("style",{id:m,children:d}):null,t]})}function Go(){return Vs($o)}function Fs(t){let{theme:e}=Go(),[n,o]=Nt("");return wt(()=>{let r=ze[t];if(!r)return;let a=e[t];if(a){o(a);return}if(typeof document>"u"){o(r.fallback);return}let s=getComputedStyle(document.documentElement).getPropertyValue(r.name).trim();o(s||r.fallback)},[t,e]),n||ze[t]?.fallback||""}import{jsx as tt}from"react/jsx-runtime";var Yo=js({mode:"walletconnect"});function Ys(){return Qs(Yo)}function nt({config:t,children:e,autoConnect:n=!1,detectionMode:o="walletconnect",theme:r,defaultDark:a=!1,themePriority:s="computed"}){let i=$s(()=>({mode:o}),[o]),l=o==="walletconnect"||o==="auto";return tt(Yo.Provider,{value:i,children:tt(mn,{theme:r,defaultDark:a,priority:s,children:tt(pn,{components:{QRCodeModal:Xe},children:tt(Gs,{config:t,autoConnect:n,children:l?tt(Pt,{children:e}):e})})})})}import{jsx as ni}from"react/jsx-runtime";var fn={Button:V,ConnectButton:xe,AccountButton:Dt,ChainSelector:We,QRCodeModal:Xe,SignInButton:sn,SeedPhraseBackup:Ze,ErrorBoundary:et,Web3ConnectUI:nt},Jo=Js({});function pn({children:t,components:e={}}){let n=Zs(()=>({...fn,...e}),[e]);return ni(Jo.Provider,{value:n,children:t})}function B(){return Xs(Jo)}function ei(t){return B()[t]}import{jsx as Y,jsxs as Se}from"react/jsx-runtime";function Xo(t){let e=t&&typeof t=="object"&&"details"in t?t.details:void 0,n=e instanceof Error?`${e.name}: ${e.message}`:e;oi.error("ui/ChainSelector","switchChain failed",t,n)}function ot({chainId:t,className:e}){let n=lt(t);return n?Y("span",{className:b("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function We({className:t,showLabel:e=!0,variant:n="dropdown"}){let{currentChain:o,availableChains:r,switchChain:a}=ii(),{isConnected:s}=li(),[i,l]=ri(!1),u=B().Button??V,d=ai(null);if(si(()=>{function g(f){d.current&&!d.current.contains(f.target)&&l(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),!s)return null;let m=o?.name??"Unknown Chain",h=r.length>1;return n==="minimal"?Se("div",{className:b("inline-flex items-center gap-1.5 text-xs text-muted-foreground",t),children:[o&&Y(ot,{chainId:o.caip2,className:"h-3.5 w-3.5"}),m]}):n==="buttons"?Y("div",{className:b("flex flex-wrap gap-2",t),children:r.map(g=>{let f=g.caip2,y=f===o?.caip2;return Se(u,{className:y?b("bg-accent","border-primary"):"",onClick:()=>{y||a(f).catch(Xo)},children:[Y(ot,{chainId:f,className:"h-4 w-4"}),g.name,g.token&&Y("span",{className:"text-xs opacity-60",children:g.token})]},f)})}):h?Se("div",{ref:d,className:b("relative inline-block",t),children:[Se(u,{onClick:()=>l(!i),children:[o&&Y(ot,{chainId:o.caip2,className:"h-4 w-4"}),m,Y("svg",{"aria-hidden":"true",className:b("h-3 w-3 transition-transform",i&&"rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:Y("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),i&&Se("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&&Y("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Switch Network"}),r.map(g=>{let f=g.caip2,y=f===o?.caip2;return Se(u,{onClick:()=>{y||a(f).catch(Xo),l(!1)},className:b("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",y?"bg-accent font-medium":"hover:bg-accent/50"),children:[Y(ot,{chainId:f,className:"h-4 w-4"}),Y("span",{className:"flex-1 text-left",children:g.name}),g.token&&Y("span",{className:"text-xs text-muted-foreground",children:g.token}),y&&Y("svg",{"aria-hidden":"true",className:"h-4 w-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:Y("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},f)})]})]}):Se("div",{className:b("inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm opacity-60 cursor-default",t),children:[o&&Y(ot,{chainId:o.caip2,className:"h-4 w-4"}),m]})}import{useEmbeddedWallet as ci}from"@naculus/connect-appkit-react";import{Check as Zo,Copy as di,Loader2 as ui,Plus as mi}from"lucide-react";import{useCallback as gn,useState as hn}from"react";import{jsx as X,jsxs as Ve}from"react/jsx-runtime";var pi={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 fi(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-4)}`}function gi({account:t,isActive:e,onSelect:n}){let[o,r]=hn(!1),a=pi[t.namespace]??{name:t.namespace,detail:""},s=gn(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 Ve("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:b("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:[Ve("span",{className:"flex min-w-0 flex-1 flex-col",children:[Ve("span",{className:"flex items-center gap-2 font-medium",children:[a.name,e&&X("span",{className:"rounded-sm bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-primary",children:"Signing"})]}),X("span",{className:"truncate font-mono text-xs text-muted-foreground",children:fi(t.address)})]}),X("button",{type:"button","aria-label":`Copy ${a.name} address`,onClick:s,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o?X(Zo,{size:14}):X(di,{size:14})}),e&&X(Zo,{size:16,className:"shrink-0 text-primary"})]})}function er({className:t,hideBackfill:e=!1,onSelect:n,accounts:o,activeNamespace:r,canDerive:a,setActiveNamespace:s,backfillAccounts:i}){let[l,c]=hn(!1),[u,d]=hn(null),m=gn(f=>{if(f!==r)try{s(f),d(null),n?.(f)}catch(y){d(y instanceof Error?y.message:"Could not switch account")}},[r,s,n]),h=gn(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 g=!e&&a;return Ve("div",{className:b("flex flex-col gap-2",t),children:[Ve("div",{className:"flex items-baseline justify-between",children:[X("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Accounts"}),X("span",{className:"text-[11px] text-muted-foreground",children:"Chooses the signing key, not the network"})]}),X("div",{role:"radiogroup","aria-label":"Wallet accounts",className:"flex flex-col gap-1.5",children:o.map(f=>X(gi,{account:f,isActive:f.namespace===r,onSelect:()=>m(f.namespace)},f.namespace))}),g&&Ve("button",{type:"button",onClick:h,disabled:l,className:b("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?X(ui,{size:14,className:"animate-spin"}):X(mi,{size:14}),l?"Deriving\u2026":"Show accounts this phrase already owns"]}),u&&X("p",{role:"alert",className:"text-xs text-destructive",children:u})]})}function hi(t){let{wallet:e,accounts:n,activeNamespace:o,setActiveNamespace:r,backfillAccounts:a}=ci();return e?X(er,{...t,accounts:n,activeNamespace:o,canDerive:e.recoveryAvailable&&n.length<2,setActiveNamespace:r,backfillAccounts:a}):null}import{AlertTriangle as yi,Info as nr,ShieldAlert as bi,ShieldCheck as xi}from"lucide-react";import{useEmbeddedWallet as vi}from"@naculus/connect-appkit-react";import{jsx as ne,jsxs as re}from"react/jsx-runtime";var Ci={critical:bi,warning:yi,info:nr},wi={critical:"text-destructive",warning:"text-amber-600 dark:text-amber-500",info:"text-muted-foreground"};function tr(t){return t>=90?"text-emerald-600 dark:text-emerald-500":t>=70?"text-amber-600 dark:text-amber-500":"text-destructive"}function Ni({finding:t}){let e=Ci[t.severity]??nr;return re("li",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[ne(e,{size:16,className:b("mt-0.5 shrink-0",wi[t.severity])}),re("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[re("div",{className:"flex items-baseline justify-between gap-2",children:[ne("span",{className:"text-sm font-medium",children:t.title}),t.deduction>0&&re("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:["\u2212",t.deduction]})]}),ne("p",{className:"text-xs leading-relaxed text-muted-foreground",children:t.detail}),t.remedy&&re("p",{className:"text-xs leading-relaxed",children:[ne("span",{className:"font-medium",children:"What helps: "}),ne("span",{className:"text-muted-foreground",children:t.remedy})]})]})]})}function or({className:t,hideInformational:e=!1,report:n}){if(!n)return null;let{score:o,level:r,findings:a,encrypted:s,backend:i,unlock:l}=n,c=e?a.filter(d=>d.deduction>0):a,u=a.every(d=>d.deduction===0);return re("div",{className:b("flex flex-col gap-3",t),children:[re("div",{className:"flex items-center gap-3 rounded-lg border border-border px-4 py-3",children:[ne(xi,{size:22,className:b("shrink-0",tr(o))}),re("div",{className:"flex min-w-0 flex-1 flex-col",children:[re("div",{className:"flex items-baseline gap-2",children:[ne("span",{className:b("text-2xl font-semibold tabular-nums",tr(o)),children:o}),ne("span",{className:"text-sm text-muted-foreground",children:"/ 100"}),re("span",{className:"ml-auto text-xs text-muted-foreground",children:["Tier ",r]})]}),re("span",{className:"text-xs text-muted-foreground",children:[i==="localStorage"?"localStorage":"IndexedDB",s?" \xB7 encrypted":" \xB7 not encrypted",l.sealedWith?.includes("prf")?" \xB7 passkey":""]})]})]}),u?ne("p",{className:"text-xs text-muted-foreground",children:"Nothing is holding this score down."}):ne("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."}),ne("ul",{className:"flex flex-col gap-1.5",children:c.map(d=>ne(Ni,{finding:d},d.id))})]})}function ki(t){let{securityReport:e}=vi();return ne(or,{...t,report:e})}import{useCallback as Si,useEffect as Ri,useRef as Ti,useState as yn}from"react";import{Eye as Pi,EyeOff as Bi,KeyRound as Ei,ShieldAlert as Ai}from"lucide-react";import{usePassphraseGate as Di}from"@naculus/connect-appkit-react";import{jsx as O,jsxs as ye}from"react/jsx-runtime";var bn=8,Mi=12;function rr({className:t,request:e,submit:n,cancel:o}){let[r,a]=yn(""),[s,i]=yn(""),[l,c]=yn(!1),u=Ti(null),d=e?.intent==="create";Ri(()=>{if(!e){a(""),i(""),c(!1);return}a(""),i(""),u.current?.focus()},[e]);let m=d&&r.length>0&&r.length<bn,h=d&&s.length>0&&s!==r,g=d?r.length>=bn&&s===r:r.length>0,f=Si(y=>{y.preventDefault(),g&&n(r)},[g,n,r]);return e?O("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"presentation",children:ye("form",{role:"dialog","aria-modal":"true","aria-label":d?"Choose a passphrase":"Unlock your wallet",onSubmit:f,className:b("flex w-full max-w-sm flex-col gap-4 rounded-lg border border-border bg-card p-5 shadow-lg",t),children:[ye("div",{className:"flex items-center gap-2",children:[O(Ei,{size:18,className:"shrink-0 text-primary"}),O("h2",{className:"text-base font-semibold",children:d?"Choose a passphrase":"Unlock your wallet"})]}),e.previousError&&O("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:e.previousError}),O("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."}),ye("label",{className:"flex flex-col gap-1.5",children:[O("span",{className:"text-xs font-medium",children:"Passphrase"}),ye("span",{className:"relative flex items-center",children:[O("input",{ref:u,type:l?"text":"password",value:r,onChange:y=>a(y.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"}),O("button",{type:"button","aria-label":l?"Hide passphrase":"Show passphrase",onClick:()=>c(y=>!y),className:"absolute right-2 text-muted-foreground hover:text-foreground",children:l?O(Bi,{size:15}):O(Pi,{size:15})})]})]}),d&&ye("label",{className:"flex flex-col gap-1.5",children:[O("span",{className:"text-xs font-medium",children:"Type it again"}),O("input",{type:l?"text":"password",value:s,onChange:y=>i(y.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&&ye("p",{role:"alert",className:"text-xs text-destructive",children:["At least ",bn," characters."]}),h&&O("p",{role:"alert",className:"text-xs text-destructive",children:"These do not match."}),d&&!m&&r.length>0&&r.length<Mi&&O("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&&ye("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:[O(Ai,{size:14,className:"mt-0.5 shrink-0"}),O("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."})]}),ye("div",{className:"flex justify-end gap-2 pt-1",children:[O("button",{type:"button",onClick:()=>o(),className:"rounded-md border border-border px-3 py-2 text-sm hover:bg-accent",children:"Cancel"}),O("button",{type:"submit",disabled:!g,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 Ii(t){let{request:e,submit:n,cancel:o}=Di();return O(rr,{...t,request:e,submit:n,cancel:o})}import{useCallback as ir,useState as xn}from"react";import{Fingerprint as ar,Loader2 as Li,ShieldAlert as sr,ShieldCheck as zi,TriangleAlert as Wi}from"lucide-react";import{useEmbeddedWallet as Vi,useWeb3 as Ui}from"@naculus/connect-appkit-react";import{Fragment as Oi,jsx as Z,jsxs as Ue}from"react/jsx-runtime";function lr({className:t,passkeys:e,unlock:n,onRegistered:o}){let[r,a]=xn(!1),[s,i]=xn(null),[l,c]=xn(!1),u=!!e?.hasCredential?.()||l,d=ir(async()=>{if(e){a(!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{a(!1)}}},[e,o]);if(!e)return null;let m=n?.sealedWith?.includes("prf")??!1,h=null;if(u)switch(n?.prf){case"available":h=m?{tone:"good",icon:Z(zi,{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:Z(Wi,{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":h={tone:"bad",icon:Z(sr,{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:h={tone:"neutral",icon:Z(ar,{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 g={good:"text-emerald-600 dark:text-emerald-500",warn:"text-amber-600 dark:text-amber-500",bad:"text-destructive",neutral:"text-muted-foreground"};return Ue("div",{className:b("flex flex-col gap-3",t),children:[h?Ue("div",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[Z("span",{className:b("mt-0.5 shrink-0",g[h.tone]),children:h.icon}),Ue("div",{className:"flex min-w-0 flex-col gap-1",children:[Z("span",{className:"text-sm font-medium",children:h.title}),Z("p",{className:"text-xs leading-relaxed text-muted-foreground",children:h.detail})]})]}):Ue(Oi,{children:[Z("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."}),Ue("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:[Z(sr,{size:14,className:"mt-0.5 shrink-0"}),Z("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."})]}),Ue("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?Z(Li,{size:15,className:"animate-spin"}):Z(ar,{size:15}),r?"Waiting for your device\u2026":"Protect with a passkey"]})]}),s&&Z("p",{role:"alert",className:"text-xs text-destructive",children:s})]})}function Hi(t){let{client:e}=Ui(),{securityReport:n,hasWallet:o}=Vi(),r=ir(async()=>{let a=e?.embeddedConnector;a&&o&&await a.save()},[e,o]);return Z(lr,{...t,passkeys:e?.passkeysConnector??null,unlock:n?.unlock,onRegistered:r})}import{useAccount as dr,useBalance as _i,useChain as Fi,useDisconnect as ur,useEmbeddedWallet as Ki,useWallet as qi,useWeb3 as ji}from"@naculus/connect-appkit-react";import{createContext as Qi,useCallback as rt,useContext as $i,useEffect as Gi,useMemo as mr,useState as cr}from"react";import{jsx as Re,jsxs as br}from"react/jsx-runtime";var pr=Qi(null);function fr(){let t=$i(pr);if(!t)throw new Error("useAppKit must be used within an <AppKit> component");return t}function gr({projectId:t,metadata:e,enableEmbedded:n=!1,enablePasskeys:o=!1,chains:r,embeddedConfig:a,encryptionKey:s,siwx:i,children:l,className:c,autoConnect:u=!1,theme:d,defaultDark:m=!1,themePriority:h="computed",detectionMode:g="auto"}){let[f,y]=cr(!1),[R,p]=cr(!1),x=mr(()=>({projectId:t,metadata:e,enableEmbedded:n,enablePasskeys:o,chains:r,embeddedConfig:a,encryptionKey:s,siwx:i}),[t,e,n,o,r,a,s,i]);return Re(nt,{config:x,autoConnect:u,detectionMode:g,theme:d,defaultDark:m,themePriority:h,children:Re(Yi,{className:c,open:f,setOpen:y,backupOpen:R,setBackupOpen:p,children:l})})}function Yi({children:t,className:e,open:n,setOpen:o,backupOpen:r,setBackupOpen:a}){let{isConnected:s,isConnecting:i}=qi(),{primaryAccount:l}=dr(),{currentChain:c,availableChains:u,switchChain:d}=Fi(),m=Ki(),{disconnect:h}=ur(),{wallets:g,hasWallets:f}=Oe(),{formatted:y}=_i(),R=y??null,p=rt(async()=>{await h()},[h]),x=rt(()=>{m.confirmBackup(),a(!1)},[m,a]),T=rt(()=>{m.confirmBackup(),a(!1)},[m,a]),S=rt(()=>m.getPrivateKey(),[m]),_=mr(()=>({connect:()=>o(!0),disconnect:p,isConnected:s,isConnecting:i,address:l,balance:R,balanceSymbol:c?.token??null,chainName:c?.name??null,availableChains:u.map(D=>({caip2:D.caip2,name:D.name,token:D.token})),switchChain:d,wallets:g,hasWallets:f,backupPending:m.backupPending,seedPhrase:m.seedPhrase,confirmBackup:x,skipBackup:T,open:n,setOpen:o}),[s,i,l,R,c,u,d,g,f,m.backupPending,m.seedPhrase,x,T,p,n,o]);return Gi(()=>{m.seedPhrase&&m.backupPending&&a(!0)},[m.seedPhrase,m.backupPending,a]),br(pr.Provider,{value:_,children:[t,m.seedPhrase&&r&&Re(Ze,{seedPhrase:m.seedPhrase,onConfirm:x,onSkip:T,onExportPrivateKey:S,open:r,onOpenChange:a})]})}function hr({className:t}){let e=fr(),{connectInjected:n}=ji(),{primaryAccount:o}=dr(),{disconnect:r}=ur(),a=rt(async(s,i,l)=>{s==="injected"&&(await n(l),i())},[n]);return e.isConnected&&o?br("div",{className:b("inline-flex items-center gap-2",t),children:[Re(We,{variant:"minimal"}),Re(xe,{isConnected:e.isConnected,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:a,className:t})]}):Re(xe,{isConnected:e.isConnected,isConnecting:e.isConnecting,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:a,className:t})}function yr({className:t,variant:e="dropdown"}){return Re(We,{className:t,variant:e})}try{let t=fn;t&&Object.assign(t,{AppKit:gr,AppKitButton:hr,AppKitChainSelector:yr})}catch{}import{ArrowRight as Ji,CheckCircle2 as Xi,Clock as Zi,DollarSign as el,Loader2 as wr,XCircle as tl,AlertCircle as nl}from"lucide-react";import{Fragment as Cr,jsx as v,jsxs as z}from"react/jsx-runtime";function ol(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 xr(t){return t.symbol||"UNKNOWN"}function rl(t){let e=t.toLowerCase();return e.includes("lifi")?"default":e.includes("axelar")?"secondary":"outline"}function al(t){return t.length>12?`${t.slice(0,6)}...${t.slice(-6)}`:t}function sl({route:t,onSelect:e}){let n=B(),o=n.Button??V,r=n.Badge,a=t.provider??"Route";return z("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4 transition-colors hover:bg-accent/30",children:[z("div",{className:"flex flex-col gap-1.5 min-w-0",children:[z("div",{className:"flex items-center gap-2",children:[r?v(r,{variant:rl(a),children:a}):v("span",{className:"inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",children:a}),t.steps.length>1&&z("span",{className:"text-xs text-muted-foreground",children:[t.steps.length," steps"]})]}),z("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm",children:[z("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[v(el,{className:"h-3.5 w-3.5"}),"$",t.gasCosts.totalUsd]}),z("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[v(Zi,{className:"h-3.5 w-3.5"}),ol(t.steps.reduce((s,i)=>{let l=t.estimatedTime>0?15e3:0;return s+l},0))]}),z("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[t.gasCosts.totalUsd," cost"]})]})]}),v(o,{variant:"outline",size:"sm",onClick:e,children:"Select"})]})}function il(){let e=B().Skeleton;return z("div",{className:"flex flex-col gap-3","data-testid":"route-selector-loading",children:[z("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[v(wr,{className:"h-4 w-4 animate-spin"}),v("span",{children:"Fetching best routes..."})]}),[1,2,3].map(n=>z("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4",children:[v("div",{className:"flex flex-col gap-2 flex-1",children:e?z(Cr,{children:[v(e,{className:"h-4 w-24"}),v(e,{className:"h-3 w-48"})]}):z(Cr,{children:[v("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),v("div",{className:"h-3 w-48 animate-pulse rounded bg-muted"})]})}),e?v(e,{className:"h-8 w-20 rounded-md"}):v("div",{className:"h-8 w-20 animate-pulse rounded-md bg-muted"})]},n))]})}function ll(){return z("div",{className:"flex flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground","data-testid":"route-selector-empty",children:[v(nl,{className:"h-8 w-8 opacity-40"}),v("span",{children:"No routes found for this pair"}),v("span",{className:"text-xs",children:"Try a different token or amount"})]})}function cl({error:t,onRetry:e}){let o=B().Button??V;return z("div",{className:"flex flex-col items-center justify-center gap-2 py-6","data-testid":"route-selector-error",children:[v(tl,{className:"h-8 w-8 text-destructive"}),v("p",{className:"text-sm text-destructive font-medium",children:"Failed to fetch routes"}),v("p",{className:"text-xs text-muted-foreground max-w-xs text-center",children:t}),e&&v(o,{variant:"outline",size:"sm",onClick:e,children:"Retry"})]})}function dl(){let e=B().Progress;return z("div",{className:"flex flex-col items-center gap-3 py-6","data-testid":"route-selector-executing",children:[v(wr,{className:"h-6 w-6 animate-spin text-primary"}),v("p",{className:"text-sm font-medium",children:"Executing route..."}),v("p",{className:"text-xs text-muted-foreground",children:"Please confirm the transaction in your wallet"}),e?v(e,{value:50,className:"w-48 h-1.5"}):v("div",{className:"h-1.5 w-48 rounded-full bg-muted",children:v("div",{className:"h-full w-1/2 rounded-full bg-primary animate-pulse"})})]})}function ul({txHash:t}){return z("div",{className:"flex flex-col items-center gap-2 py-6","data-testid":"route-selector-success",children:[v(Xi,{className:"h-8 w-8 text-green-500"}),v("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Route executed successfully!"}),z("p",{className:"text-xs text-muted-foreground font-mono",children:["TX: ",al(t)]})]})}function vr({chainId:t,className:e}){let n=lt(`eip155:${t}`);return n?v("span",{className:b("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function ml({inputToken:t,outputToken:e,amount:n,routes:o=[],loading:r=!1,executing:a=!1,onRouteSelected:s,onCancel:i,successTxHash:l,error:c,className:u}){let d=B(),m=d.Card,h=d.Button??V;if(l)return v("div",{className:b("rounded-lg border border-border",u),children:v(ul,{txHash:l})});if(a)return v("div",{className:b("rounded-lg border border-border",u),children:v(dl,{})});return m?z(m,{className:b("p-4",u),children:[f(),y(),R()]}):z("div",{className:b("rounded-lg border border-border p-4",u),children:[f(),y(),R()]});function f(){return!t&&!e?null:z("div",{className:"mb-4 flex flex-wrap items-center gap-2 text-sm",children:[t&&z("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[v(vr,{chainId:t.chainId,className:"h-4 w-4"}),n?`${n.toString()} `:"",xr(t)]}),t&&e&&v(Ji,{className:"h-3.5 w-3.5 text-muted-foreground"}),e&&z("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[v(vr,{chainId:e.chainId,className:"h-4 w-4"}),xr(e)]})]})}function y(){return r?v(il,{}):c?v(cl,{error:c}):o.length===0?v(ll,{}):v("div",{className:"flex flex-col gap-2","data-testid":"route-selector-routes",children:o.map((p,x)=>v(sl,{route:p,onSelect:()=>s?.(p)},`${p.fromChain}-${p.toChain}-${p.gasCosts.totalUsd}-${x}`))})}function R(){return!r&&o.length===0&&!c?null:v("div",{className:"mt-4 flex justify-end",children:v(h,{variant:"ghost",size:"sm",onClick:i,children:"Cancel"})})}}import pl from"react";import{Shield as fl,ShieldCheck as Nr,LoaderCircle as gl,Settings as hl,ChevronRight as yl,AlertCircle as bl,RotateCcw as xl,CheckCircle2 as vl,Fuel as kr,Zap as Cl,RefreshCw as wl}from"lucide-react";import{Fragment as Sl,jsx as k,jsxs as W}from"react/jsx-runtime";function Nl(t){let e=Number(t)/1e18;return e<.001?`~${e.toFixed(6)} ETH`:`~${e.toFixed(3)} ETH`}function kl({isDeployed:t=!1,isDeploying:e=!1,estimatedGas:n,error:o=null,onUpgrade:r,onShowSettings:a,onRetry:s}){let i=B(),l=i.Button??V,c=i.Card??ct,u=i.Badge??An,d=a?W(l,{variant:"outline",className:"w-full",onClick:a,children:[k(hl,{size:15})," Advanced Settings ",k(yl,{size:14,className:"text-muted-foreground"})]}):null;return t?W(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[k("div",{className:"flex items-start justify-between",children:W("div",{className:"flex items-center gap-3",children:[k("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-green-500/10",children:k(Nr,{size:22,className:"text-green-500"})}),W("div",{children:[W("div",{className:"flex items-center gap-2",children:[k("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),W(u,{variant:"secondary",className:"rounded-full bg-green-500/10 px-2 py-0 text-xs font-medium text-green-500",children:[k(vl,{size:12,className:"mr-0.5 inline"})," Deployed"]})]}),k("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Your wallet has been upgraded to a smart wallet"})]})]})}),k("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[[kr,"Gas Sponsorship","Enabled"],[wl,"Recovery","Enabled"]].map(([m,h,g])=>W("div",{className:"rounded-lg bg-muted/50 p-3",children:[W("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[pl.createElement(m,{size:14}),k("span",{children:h})]}),k("div",{className:"mt-1 text-sm font-medium text-foreground",children:g})]},h))}),a&&k("div",{className:"mt-4",children:d})]}):e?k(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:W("div",{className:"flex flex-col items-center text-center",children:[k("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:k(gl,{size:28,className:"animate-spin text-primary"})}),k("h3",{className:"mb-1 text-base font-semibold text-foreground",children:"Deploying Smart Wallet..."}),k("p",{className:"mb-4 text-sm text-muted-foreground",children:"Please wait, contract deployment may take a few seconds"}),k("div",{className:"h-2 w-full max-w-[200px] overflow-hidden rounded-full bg-muted",children:k("div",{className:"h-full w-full animate-pulse rounded-full bg-primary",style:{animationDuration:"1.5s"}})})]})}):o?W(c,{className:"w-full rounded-xl border border-destructive/30 bg-destructive/5 p-5 shadow-sm",children:[W("div",{className:"flex items-start gap-3",children:[k("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-destructive/10",children:k(bl,{size:18,className:"text-destructive"})}),W("div",{className:"min-w-0 flex-1",children:[k("h4",{className:"text-sm font-semibold text-destructive",children:"Deployment Failed"}),k("p",{className:"mt-1 text-xs text-destructive/80 break-words",children:o}),s&&W(l,{variant:"outline",size:"sm",className:"mt-3 border-destructive/30 text-destructive hover:bg-destructive/10",onClick:s,children:[k(xl,{size:13})," Retry"]})]})]}),a&&k("div",{className:"mt-3",children:d})]}):W(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[W("div",{className:"flex items-center gap-3",children:[k("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/10",children:k(fl,{size:20,className:"text-amber-500"})}),W("div",{children:[W("div",{className:"flex items-center gap-2",children:[k("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),k("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:"Not Upgraded"})]}),k("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Upgrade to a smart wallet for more features"})]})]}),W("div",{className:"mt-4 space-y-2",children:[k(vn,{icon:Cl,color:"text-green-500",text:"No ETH needed for transactions \u2014 pay gas with USDC/USDT"}),k(vn,{icon:kr,color:"text-blue-500",text:"Optional dApp sponsorship, zero-cost transactions"}),k(vn,{icon:Nr,color:"text-purple-500",text:"Secure recovery mechanism, no fear of losing keys"})]}),r&&W(l,{className:"mt-4 w-full",onClick:r,children:["Upgrade Now",n!==void 0&&W("span",{className:"ml-1 text-xs opacity-80",children:["(Estimated gas fee: ",Nl(n),")"]})]}),a&&W(Sl,{children:[W("div",{className:"mt-4 mb-3 flex items-center gap-2",children:[k("div",{className:"h-px flex-1 bg-border"}),k("span",{className:"text-xs text-muted-foreground",children:"or"}),k("div",{className:"h-px flex-1 bg-border"})]}),d]})]})}function vn({icon:t,color:e,text:n}){return W("div",{className:"flex items-center gap-2.5 text-sm text-foreground/80",children:[k(t,{size:14,className:`shrink-0 ${e}`}),k("span",{children:n})]})}import{useState as Cn,useCallback as Sr}from"react";import{ArrowLeft as Rr,Save as Rl,Shield as Tr,Users as Pr,KeyRound as Br,Fuel as Tl,Wrench as Pl,Plus as Bl,X as El}from"lucide-react";import{jsx as C,jsxs as M}from"react/jsx-runtime";var Al=[{value:"simple",label:"Single Sign (default)",description:"Single key control, simple and secure",icon:C(Tr,{size:16})},{value:"multi-sig",label:"Multi-Sign (2-of-3)",description:"Requires multiple signers to authorize transactions",icon:C(Pr,{size:16})},{value:"social-recovery",label:"Social Recovery",description:"Set guardian accounts to help recover",icon:C(Br,{size:16})}],Dl=[{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"}],Ml=[{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 Il(){return{accountType:"simple",paymasterType:"self",customPaymasterUrl:"",bundlerPreset:"pimlico",customBundlerUrl:"",guardians:[],threshold:2}}function Ll({currentConfig:t,onSave:e,onBack:n}){let o=B(),r=o.Button??V,a=o.Input??Dn,s=o.Card??ct,i=o.Separator??Mn,[l,c]=Cn({...Il(),...t}),[u,d]=Cn(""),[m,h]=Cn(!1),g=p=>b("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",y=Sr(()=>{e?.(l),h(!0),setTimeout(()=>h(!1),2e3)},[l,e]),R=Sr(()=>{let p=u.trim();!p||l.guardians.includes(p)||(c(x=>({...x,guardians:[...x.guardians,p]})),d(""))},[u,l.guardians]);return M(s,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[C("div",{className:"flex items-center justify-between mb-5",children:M("div",{className:"flex items-center gap-2",children:[n&&M(r,{variant:"ghost",size:"sm",onClick:n,children:[C(Rr,{size:15}),"Back"]}),C("h2",{className:"text-lg font-semibold text-foreground",children:"Smart Wallet Settings"})]})}),M("section",{className:"mb-6",children:[M("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[C(Tr,{size:15})," Verification Method"]}),C("div",{className:"space-y-2",children:Al.map(p=>M("label",{className:g(l.accountType===p.value),children:[C("input",{type:"radio",name:"accountType",value:p.value,checked:l.accountType===p.value,onChange:()=>c(x=>({...x,accountType:p.value})),className:"h-4 w-4 text-primary accent-primary"}),C("div",{className:"flex items-center gap-2 text-foreground",children:p.icon}),M("div",{children:[C("div",{className:"text-sm font-medium text-foreground",children:p.label}),C("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))})]}),l.accountType==="social-recovery"&&M("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[M("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[C(Br,{size:14})," Guardian Addresses"]}),C("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&&C("div",{className:"mb-3 space-y-1.5",children:l.guardians.map(p=>M("div",{className:"flex items-center justify-between rounded-md bg-card px-3 py-2 text-sm",children:[M("span",{className:"font-mono text-xs text-foreground",children:[p.slice(0,8),"...",p.slice(-6)]}),C(r,{variant:"ghost",size:"icon",onClick:()=>c(x=>({...x,guardians:x.guardians.filter(T=>T!==p)})),children:C(El,{size:14})})]},p))}),M("div",{className:"flex gap-2",children:[C(a,{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"}),M(r,{size:"sm",onClick:R,disabled:!u.trim(),children:[C(Bl,{size:14})," Add"]})]})]}),l.accountType==="multi-sig"&&M("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[M("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[C(Pr,{size:14})," Signing Threshold"]}),C("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set how many signers are needed to authorize a transaction"}),C("div",{className:"flex items-center gap-3",children:[1,2,3].map(p=>M("label",{className:g(l.threshold===p),children:[C("input",{type:"radio",name:"threshold",value:p,checked:l.threshold===p,onChange:()=>c(x=>({...x,threshold:p})),className:"sr-only"}),p,"-of-3"]},p))})]}),C(i,{className:"my-4"}),M("section",{className:"mb-6",children:[M("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[C(Tl,{size:15})," Gas Fees"]}),C("div",{className:"space-y-2",children:Dl.map(p=>M("label",{className:g(l.paymasterType===p.value),children:[C("input",{type:"radio",name:"paymasterType",value:p.value,checked:l.paymasterType===p.value,onChange:()=>c(x=>({...x,paymasterType:p.value})),className:"h-4 w-4 text-primary accent-primary"}),M("div",{className:"flex-1",children:[C("div",{className:"text-sm font-medium text-foreground",children:p.label}),C("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))}),l.paymasterType==="custom"&&C("div",{className:"mt-3",children:C("input",{type:"text",placeholder:"Custom Paymaster URL",value:l.customPaymasterUrl,onChange:p=>c(x=>({...x,customPaymasterUrl:p.target.value})),className:f})})]}),C(i,{className:"my-4"}),M("section",{className:"mb-6",children:[M("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[C(Pl,{size:15})," Bundler"]}),C("div",{className:"space-y-2",children:Ml.map(p=>M("label",{className:g(l.bundlerPreset===p.value),children:[C("input",{type:"radio",name:"bundlerPreset",value:p.value,checked:l.bundlerPreset===p.value,onChange:()=>c(x=>({...x,bundlerPreset:p.value})),className:"h-4 w-4 text-primary accent-primary"}),M("div",{className:"flex-1",children:[C("div",{className:"text-sm font-medium text-foreground",children:p.label}),C("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))}),l.bundlerPreset==="custom"&&C("div",{className:"mt-3",children:C("input",{type:"text",placeholder:"Custom Bundler URL",value:l.customBundlerUrl,onChange:p=>c(x=>({...x,customBundlerUrl:p.target.value})),className:f})})]}),M("div",{className:"flex items-center gap-3",children:[M(r,{className:"flex-1",onClick:y,children:[C(Rl,{size:15}),m?"Saved \u2713":"Save Settings"]}),n&&M(r,{variant:"outline",onClick:n,children:[C(Rr,{size:15}),"\u2190 Back to Simple Mode"]})]})]})}import{AlertTriangle as zl,CheckCircle as Wl,ShieldAlert as Vl,X as Ul}from"lucide-react";import{useValidateDestination as Hl}from"@naculus/connect-appkit-react";import{jsx as q,jsxs as be}from"react/jsx-runtime";var Ol={ok:{icon:q(Wl,{size:20}),label:"No problem found",colorClass:"text-muted-foreground",bgClass:"bg-muted",buttonVariant:"default"},warning:{icon:q(zl,{size:20}),label:"Warning",colorClass:"text-[hsl(var(--warning,38_92%_50%))]",bgClass:"bg-[hsl(var(--warning)/0.1)]",buttonVariant:"default"},blocked:{icon:q(Vl,{size:20}),label:"Blocked",colorClass:"text-destructive",bgClass:"bg-destructive/10",buttonVariant:"destructive"}};function _l({address:t,open:e,onClose:n,onProceed:o}){let r=B(),a=r.Button,s=r.Dialog,i=r.DialogContent,l=r.DialogHeader,c=r.DialogTitle,{validation:u}=Hl({address:t}),{level:d,warning:m}=u,h=Ol[d],g=d==="blocked",f=t.length>12?`${t.slice(0,6)}...${t.slice(-4)}`:t,y=p=>b("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=be("div",{className:"flex flex-col gap-4",children:[be("div",{className:b("flex items-center gap-3 rounded-lg p-4",h.bgClass),children:[q("span",{className:h.colorClass,children:h.icon}),be("div",{className:"flex flex-col gap-0.5",children:[q("span",{className:b("text-sm font-semibold",h.colorClass),children:h.label}),q("span",{className:"text-xs text-muted-foreground break-all font-mono",children:f})]})]}),m&&q("p",{className:"text-sm text-muted-foreground m-0",children:m}),be("div",{className:"flex gap-2 justify-end pt-2",children:[a?q(a,{onClick:n,variant:"outline",className:"w-full sm:w-auto",children:"Cancel"}):q("button",{type:"button",onClick:n,className:b(y("outline"),"w-full sm:w-auto"),children:"Cancel"}),o&&(a?q(a,{onClick:o,variant:g?"destructive":"default",disabled:g,className:"w-full sm:w-auto",children:"Proceed anyway"}):q("button",{type:"button",onClick:o,disabled:g,className:b(y(g?"destructive":"default"),"w-full sm:w-auto"),children:"Proceed anyway"}))]})]});return s&&i&&l&&c?q(s,{open:e,onOpenChange:p=>{p||n()},children:be(i,{className:"sm:max-w-md",children:[q(l,{children:q(c,{children:"Address Warning"})}),R]})}):e?be("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[q("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:n}),be("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:[be("div",{className:"flex items-center justify-between mb-4",children:[q("h2",{className:"text-lg font-semibold m-0",children:"Address Warning"}),q("button",{onClick:n,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close",children:q(Ul,{size:16})})]}),R]})]}):null}import{Wallet as Er,AlertCircle as Fl}from"lucide-react";import{jsx as J,jsxs as Te}from"react/jsx-runtime";function Kl({wallets:t,onSelect:e,loading:n=!1,error:o=null}){let a=B().Card,s=i=>a?J(a,{className:"p-4",children:i}):J("div",{className:"rounded-xl border bg-card text-card-foreground shadow-sm p-4",children:i});return n?s(Te("div",{className:"flex flex-col gap-3",children:[Array.from({length:3}).map((i,l)=>Te("div",{className:"flex items-center gap-3 p-3 rounded-lg animate-pulse",children:[J("div",{className:"h-10 w-10 rounded-full bg-muted"}),J("div",{className:"h-4 w-32 rounded bg-muted"})]},l)),J("p",{className:"text-xs text-muted-foreground text-center m-0",children:"Detecting wallets..."})]})):o?s(Te("div",{className:"flex flex-col items-center gap-3 py-4",children:[J(Fl,{size:24,className:"text-destructive"}),J("p",{className:"text-sm text-destructive m-0 font-medium",children:o})]})):t.length===0?s(Te("div",{className:"flex flex-col items-center gap-3 py-6",children:[J(Er,{size:32,className:"text-muted-foreground"}),Te("p",{className:"text-sm text-muted-foreground m-0 text-center",children:["No wallets detected.",J("br",{}),"Install a browser wallet extension to get started."]})]})):J("div",{className:"flex flex-col gap-2",children:t.map(i=>Te("button",{type:"button",onClick:()=>e(i),className:b("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?J("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"}}):J("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center shrink-0",children:J(Er,{size:18,className:"text-muted-foreground"})}),Te("div",{className:"flex flex-col items-start gap-0.5 text-left min-w-0",children:[J("span",{className:"text-sm font-medium truncate w-full",children:i.name}),J("span",{className:"text-xs text-muted-foreground truncate w-full",children:i.rdns})]})]},i.id))})}export{Dt as AccountButton,hi as AccountSelector,er as AccountSelectorView,_l as AddressWarningDialog,gr as AppKit,hr as AppKitButton,yr as AppKitChainSelector,We as ChainSelector,xe as ConnectButton,et as ErrorBoundary,Hi as PasskeySetup,lr as PasskeySetupView,Ii as PassphraseDialog,rr as PassphraseDialogView,Xe as QRCodeModal,ml as RouteSelector,Ze as SeedPhraseBackup,sn as SignInButton,Ll as SmartWalletSettings,kl as SmartWalletToggle,mn as ThemeProvider,Pt as WalletConnectProvider,Kl as WalletPicker,ki as WalletSecurityPanel,or as WalletSecurityPanelView,pn as Web3ComponentProvider,nt as Web3ConnectUI,b as cn,fr as useAppKit,ei as useComponent,B as useComponentRegistry,Ys as useDetectionMode,Oe as useEIP6963,_e as useIsMobile,Go as useTheme,Fs as useThemeVariable,Zr as useWalletConnect,Bt as useWalletConnectOptional};
|
|
12
12
|
//# sourceMappingURL=index.js.map
|