(()=>{"use strict";const n="data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128">\n      <rect width="128" height="128" rx="24" fill="#7C3AED"/>\n      <text x="64" y="90" font-family="Arial,sans-serif" font-size="80" font-weight="bold"\n            fill="white" text-anchor="middle">S</text>\n    </svg>'),t="solana:mainnet",e="solana:devnet";function s(n,t={}){return new Promise((e,s)=>{const i=`super_req_${crypto.randomUUID()}`,a=n=>{if(n.source!==window)return;const t=n.data;t&&"from-content-script"===t.direction&&t.id===i&&(window.removeEventListener("message",a),t.error?s(new Error(t.error)):e(t.payload))};window.addEventListener("message",a),window.postMessage({direction:"from-page",type:`SUPER_WALLET_${n}`,id:i,payload:t},window.location.origin),setTimeout(()=>{window.removeEventListener("message",a),s(new Error("Super Wallet: request timed out"))},6e4)})}function i(n){const t=atob(n),e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function a(n){let t="";for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return btoa(t)}class r{constructor(n,s){this.address=n,this.publicKey=s,this.chains=[t,e],this.features=["standard:connect","standard:disconnect","standard:events","solana:signTransaction","solana:signMessage"]}}class o{constructor(){this.version="1.0.0",this.name="Super Wallet",this.icon=n,this.chains=[t,e],this._accounts=[],this._listeners={}}get accounts(){return this._accounts}get features(){return{"standard:connect":{version:"1.0.0",connect:this._connect.bind(this)},"standard:disconnect":{version:"1.0.0",disconnect:this._disconnect.bind(this)},"standard:events":{version:"1.0.0",on:this._on.bind(this)},"solana:signTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:this._signTransaction.bind(this)},"solana:signMessage":{version:"1.0.0",signMessage:this._signMessage.bind(this)}}}async _connect(n){try{const t=await s("CONNECT",{silent:n?.silent??!1}),e=i(t.publicKey),a=new r(t.address,e);return this._accounts=[a],this._emit("change"),{accounts:[a]}}catch(t){if(n?.silent)return{accounts:[]};throw t}}async _disconnect(){await s("DISCONNECT"),this._accounts=[],this._emit("change")}_on(n,t){return this._listeners[n]||(this._listeners[n]=[]),this._listeners[n].push(t),()=>{const e=this._listeners[n]?.indexOf(t);void 0!==e&&e>=0&&this._listeners[n].splice(e,1)}}_emit(n){const t=this._listeners[n];if(t)for(const n of t)try{n()}catch{}}async _signTransaction(...n){const t=[];for(const e of n){const n=a(e.transaction),r=await s("SIGN_TRANSACTION",{transaction:n,chain:e.chain});t.push({signedTransaction:i(r.signedTransaction)})}return t}async _signMessage(...n){const t=[];for(const e of n){const n=a(e.message),r=await s("SIGN_MESSAGE",{message:n});t.push({signedMessage:e.message,signature:i(r.signature)})}return t}}!function(){if(window.__superWalletInjected)return;window.__superWalletInjected=!0;const n=new o;!function(n){window.addEventListener("wallet-standard:app-ready",({detail:{register:t}})=>{t(n)});try{window.dispatchEvent(new CustomEvent("wallet-standard:register-wallet",{detail:{register:t=>{t(n)}}}))}catch{}}(n);const t=function(n){const t={},e={isSuperWallet:!0,get publicKey(){const t=n.accounts;if(0===t.length)return null;const e=t[0];return{toBase58:()=>e.address,toBytes:()=>new Uint8Array(e.publicKey)}},get isConnected(){return n.accounts.length>0},async connect(t){const e=n.features,s=(await e["standard:connect"].connect({silent:t?.onlyIfTrusted??!1})).accounts[0];if(!s)throw new Error("No account returned");return{publicKey:{toBase58:()=>s.address,toBytes:()=>new Uint8Array(s.publicKey)}}},async disconnect(){const t=n.features;await t["standard:disconnect"].disconnect()},async signTransaction(t){const e=n.features,[s]=await e["solana:signTransaction"].signTransaction({transaction:t});return s.signedTransaction},async signMessage(t){const e=n.features,s=n.accounts[0];if(!s)throw new Error("Not connected");const[i]=await e["solana:signMessage"].signMessage({message:t,account:s});return{signature:i.signature}},on(n,e){t[n]||(t[n]=[]),t[n].push(e)},off(n,e){const s=t[n]?.indexOf(e);void 0!==s&&s>=0&&t[n].splice(s,1)}};return n.features["standard:events"].on("change",()=>{const s=n.accounts.length>0,i=t[s?"connect":"disconnect"];if(i)for(const n of i)try{n(s?e.publicKey:void 0)}catch{}}),e}(n);Object.defineProperty(window,"superWallet",{value:t,writable:!1,configurable:!1}),console.log("[Super Wallet] Provider injected and registered")}()})();