@recoilpay/intent-widget 0.7.2 → 0.9.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 CHANGED
@@ -90,7 +90,7 @@ python3 -m http.server 5299
90
90
  ## Notes
91
91
 
92
92
  - **Hugging Face token:** Plain-English parsing calls a language model on Hugging Face **from the browser**, with your own access token. The token is visible to anyone who loads your page, so use a fine-grained token with only the "Make calls to Inference Providers" permission, use it for nothing else, and rotate it if it's abused. Without a token, parsing is off and users see an example sentence.
93
- - **Testnets only** for now: Base Sepolia, OP Sepolia, Ethereum Sepolia, Polygon Amoy and BNB Chain Testnet, with mock tokens, plus Solana devnet.
93
+ - **Testnets only** for now: Base Sepolia, OP Sepolia, Ethereum Sepolia, Polygon Amoy, BNB Chain Testnet and Avalanche Fuji, with mock tokens, plus Solana devnet.
94
94
  - **The first swap of a token needs a one-time Permit2 approval.** The widget explains this before it happens.
95
95
  - **Cash out to a bank (testnet, NGN):** "cash out 50 USDC on Base Sepolia to NGN". Bank details are encrypted on the visitor's device for the solver who pays out. A cash-out in progress is remembered in `localStorage` (its trade id only), so a visitor who reloads comes back to confirm it. This adds about 10 KB gzipped. On Solana devnet ("cash out 2 USDC on Solana to NGN") the visitor signs the lock with their Solana wallet and needs no SOL: the solver pays the fees.
96
96
  - **Buy with a bank transfer (testnet, NGN):** "buy ₦50,000 of USDC on Base Sepolia". A first purchase needs a one-time identity check in Dojah's widget, which loads from `widget.dojah.io` when it's needed and opens above the page; allow it in your Content Security Policy if you have one. Where to pay is shown only once the solver's USDC is locked for the visitor. A purchase in progress is remembered in `localStorage` (its trade id only), so a visitor who reloads can still pay.
@@ -0,0 +1 @@
1
+ import{A as e,c as T,i as b,j as k,l as y,x as S,z as C}from"./chunk-FP3JV5NJ.js";import{g as m,h,i as n,q as s,u as i,w as u}from"./chunk-JJCC4FMA.js";var N=e({id:421614,name:"Arbitrum Sepolia",blockTime:250,nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://sepolia.arbiscan.io",apiUrl:"https://api-sepolia.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:81930}},testnet:!0});var F=e({id:43113,name:"Avalanche Fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://testnet.snowtrace.io",apiUrl:"https://api-testnet.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7096959}},testnet:!0});var v={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}};var g={block:y({format(o){return{transactions:o.transactions?.map(t=>{if(typeof t=="string")return t;let p=b(t);return p.typeHex==="0x7e"&&(p.isSystemTx=t.isSystemTx,p.mint=t.mint?m(t.mint):void 0,p.sourceHash=t.sourceHash,p.type="deposit"),p}),stateRoot:o.stateRoot}}}),transaction:k({format(o){let r={};return o.type==="0x7e"&&(r.isSystemTx=o.isSystemTx,r.mint=o.mint?m(o.mint):void 0,r.sourceHash=o.sourceHash,r.type="deposit"),r}}),transactionReceipt:S({format(o){return{...o.depositNonce?{depositNonce:m(o.depositNonce)}:{},...o.depositReceiptVersion?{depositReceiptVersion:h(o.depositReceiptVersion)}:{},l1GasPrice:o.l1GasPrice?m(o.l1GasPrice):null,l1GasUsed:o.l1GasUsed?m(o.l1GasUsed):null,l1Fee:o.l1Fee?m(o.l1Fee):null,l1FeeScalar:o.l1FeeScalar?Number(o.l1FeeScalar):null}}})};function D(o,r){return P(o)?j(o):C(o,r)}var z={transaction:D};function j(o){A(o);let{sourceHash:r,data:t,from:p,gas:l,isSystemTx:E,mint:c,to:B,value:d}=o,M=[r,p,B??"0x",c?n(c):"0x",d?n(d):"0x",l?n(l):"0x",E?"0x1":"0x",t??"0x"];return u(["0x7e",T(M)])}function P(o){return o.type==="deposit"||typeof o.sourceHash<"u"}function A(o){let{from:r,to:t}=o;if(r&&!i(r))throw new s({address:r});if(t&&!i(t))throw new s({address:t})}var a={blockTime:2e3,contracts:v,formatters:g,serializers:z};var f=11155111,w=e({...a,id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://sepolia.basescan.org",apiUrl:"https://api-sepolia.basescan.org/api"}},contracts:{...a.contracts,disputeGameFactory:{[f]:{address:"0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"}},l2OutputOracle:{[f]:{address:"0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"}},portal:{[f]:{address:"0x49f53e41452c74589e85ca1677426ba426459e85",blockCreated:4446677}},l1StandardBridge:{[f]:{address:"0xfd0Bf71F60660E2f608ed56e1659C450eB113120",blockCreated:4446677}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1059647}},testnet:!0,sourceId:f}),H=e({...w,experimental_preconfirmationTime:200,rpcUrls:{default:{http:["https://sepolia-preconf.base.org"]}}});var G=e({id:97,name:"BNB Smart Chain Testnet",nativeCurrency:{decimals:18,name:"BNB",symbol:"tBNB"},rpcUrls:{default:{http:["https://data-seed-prebsc-1-s1.bnbchain.org:8545"]}},blockExplorers:{default:{name:"BscScan",url:"https://testnet.bscscan.com",apiUrl:"https://api-testnet.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:17422483}},testnet:!0});var x=11155111,L=e({...a,id:11155420,name:"OP Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.optimism.io"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com",apiUrl:"https://optimism-sepolia.blockscout.com/api"}},contracts:{...a.contracts,disputeGameFactory:{[x]:{address:"0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1"}},l2OutputOracle:{[x]:{address:"0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204},portal:{[x]:{address:"0x16Fc5058F25648194471939df75CF27A2fdC48BC"}},l1StandardBridge:{[x]:{address:"0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1"}}},testnet:!0,sourceId:x});var q=e({id:80002,name:"Polygon Amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-amoy.drpc.org"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://amoy.polygonscan.com",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3127388}},testnet:!0});var U=e({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://11155111.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:8928790}},testnet:!0});export{N as a,F as b,w as c,G as d,L as e,q as f,U as g};
@@ -1,4 +1,4 @@
1
- import{a as Bt,b as ai,c as Ra,d as ss,e as xa,f as vs,g as ae,h as ka}from"./chunk-Q6Q2PMYM.js";import{A as ws,B as Sa,D as ji,E as $i,I as Ua,J as Da,a as ee,b as _a,c as St,h as Ce,i as Ue,j as Me,k as L,m as Pa,n as $t,o as ys,p as qi,q as oi,r as gt,s as oe,t as Br,u as Ve,v as Mr,w as Aa,x as C,y as Vr,z as H}from"./chunk-SDAGVFL2.js";import{a as ha,b as Lr,c as pa,d as ip,e as Fi,f as ua,g as ii,h as qr,i as da,j as fs,k as $e,l as Te,m as ga,n as Zt,o as Qt,p as fa,q as ma,r as ya,s as jr,t as wa,u as va,v as ba,w as Ea,x as Ca}from"./chunk-LQZA24C3.js";import{a as Di,b as gs,c as si,d as ms,e as es,f as ke,g as Ie,h as Ia,j as At,k as jt,l as dt,m as ts,n as Li,q as ri,r as ni,s as it,t as Xe,u as $r,v as Fe,w as Be}from"./chunk-BFNNKT2C.js";import{a as Hr,b as zr,c as Na,d as Kr,e as Ta,f as Oa}from"./chunk-QOQKSUB7.js";import"./chunk-MYICIF4X.js";import"./chunk-OKQEFB6X.js";import"./chunk-34LCQXEL.js";import"./chunk-FP3JV5NJ.js";import"./chunk-DBYA227G.js";import{i as Fr}from"./chunk-JJCC4FMA.js";import"./chunk-WWDFPBJY.js";import{e as ut}from"./chunk-MYQCVH5Z.js";var Lt=ut(Di());var rp="idb-keyval",np=(s={})=>{let e=s.base&&s.base.length>0?`${s.base}:`:"",t=r=>e+r,i;return s.dbName&&s.storeName&&(i=ya(s.dbName,s.storeName)),{name:rp,options:s,async hasItem(r){return!(typeof await jr(t(r),i)>"u")},async getItem(r){return await jr(t(r),i)??null},setItem(r,n){return wa(t(r),n,i)},removeItem(r){return va(t(r),i)},getKeys(){return Ea(i)},clear(){return ba(i)}}},op="WALLET_CONNECT_V2_INDEXED_DB",ap="keyvaluestorage",Gr=class{constructor(){this.indexedDb=ma({driver:np({dbName:op,storeName:ap})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,si(t))}async removeItem(e){await this.indexedDb.removeItem(e)}},Wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},Bi={exports:{}};(function(){let s;function e(){}s=e,s.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},s.prototype.setItem=function(t,i){this[t]=String(i)},s.prototype.removeItem=function(t){delete this[t]},s.prototype.clear=function(){let t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},s.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},s.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Wr<"u"&&Wr.localStorage?Bi.exports=Wr.localStorage:typeof window<"u"&&window.localStorage?Bi.exports=window.localStorage:Bi.exports=new e})();function cp(s){var e;return[s[0],gs((e=s[1])!=null?e:"")]}var Yr=class{constructor(){this.localStorage=Bi.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(cp)}async getItem(e){let t=this.localStorage.getItem(e);if(t!==null)return gs(t)}async setItem(e,t){this.localStorage.setItem(e,si(t))}async removeItem(e){this.localStorage.removeItem(e)}},lp="wc_storage_version",Fa=1,hp=async(s,e,t)=>{let i=lp,r=await e.getItem(i);if(r&&r>=Fa){t(e);return}let n=await s.getKeys();if(!n.length){t(e);return}let o=[];for(;n.length;){let a=n.shift();if(!a)continue;let c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){let l=await s.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(i,Fa),t(e),pp(s,o)},pp=async(s,e)=>{e.length&&e.forEach(async t=>{await s.removeItem(t)})},Mi=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};let e=new Yr;this.storage=e;try{let t=new Gr;hp(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}};var ja=ut(Di()),up=Object.defineProperty,dp=(s,e,t)=>e in s?up(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,La=(s,e,t)=>dp(s,typeof e!="symbol"?e+"":e,t),Vi=class extends Zt{constructor(e){super(),this.opts=e,La(this,"protocol","wc"),La(this,"version",2)}};var gp=Object.defineProperty,fp=(s,e,t)=>e in s?gp(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,mp=(s,e,t)=>fp(s,typeof e!="symbol"?e+"":e,t),Hi=class extends Zt{constructor(e,t){super(),this.core=e,this.logger=t,mp(this,"records",new Map)}},zi=class{constructor(e,t){this.logger=e,this.core=t}},Ki=class extends Zt{constructor(e,t){super(),this.relayer=e,this.logger=t}},Wi=class extends Zt{constructor(e){super()}},Gi=class{constructor(e,t,i,r){this.core=e,this.logger=t,this.name=i}};var Yi=class extends Zt{constructor(e,t){super(),this.relayer=e,this.logger=t}};var Ji=class extends Zt{constructor(e,t){super(),this.core=e,this.logger=t}};var Xi=class{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}},Zi=class{constructor(e,t){this.projectId=e,this.logger=t}},Qi=class{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}},yp=Object.defineProperty,wp=(s,e,t)=>e in s?yp(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,qa=(s,e,t)=>wp(s,typeof e!="symbol"?e+"":e,t);var er=class{constructor(e){this.opts=e,qa(this,"protocol","wc"),qa(this,"version",2)}};var tr=class{constructor(e){this.client=e}};var q=ut(Lr());var xt=ut(Lr()),ot=ut(pa()),Ec=ut(ip());function $a(s){let e=Ta(`0x${s.substring(4)}`).substring(26);return Oa(`0x${e}`)}async function Ma({hash:s,signature:e}){let t=Hr(s)?s:Kr(s),{secp256k1:i}=await import("./secp256k1-6A42G7KH.js");return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){let{r:l,s:h,v:p,yParity:u}=e,g=Number(u??p),f=Ba(g);return new i.Signature(zr(l),zr(h)).addRecoveryBit(f)}let o=Hr(e)?e:Kr(e),a=Na(`0x${o.slice(130)}`),c=Ba(a);return i.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(t.substring(2)).toHex(!1)}`}function Ba(s){if(s===0||s===1)return s;if(s===27)return 0;if(s===28)return 1;throw new Error("Invalid yParityOrV value")}async function Jr({hash:s,signature:e}){return $a(await Ma({hash:s,signature:e}))}var vp=":";function Wt(s){let[e,t]=s.split(vp);return{namespace:e,reference:t}}function Ic(s,e){return s.includes(":")?[s]:e.chains||[]}var bp=Object.defineProperty,Ep=Object.defineProperties,Ip=Object.getOwnPropertyDescriptors,Va=Object.getOwnPropertySymbols,Cp=Object.prototype.hasOwnProperty,_p=Object.prototype.propertyIsEnumerable,Ha=(s,e,t)=>e in s?bp(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,za=(s,e)=>{for(var t in e||(e={}))Cp.call(e,t)&&Ha(s,t,e[t]);if(Va)for(var t of Va(e))_p.call(e,t)&&Ha(s,t,e[t]);return s},Pp=(s,e)=>Ep(s,Ip(e)),Ap="ReactNative",qe={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"};var Sp="js";function fi(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function kt(){return!(0,ot.getDocument)()&&!!(0,ot.getNavigator)()&&navigator.product===Ap}function Cc(){return kt()&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"&&globalThis?.Platform.OS==="android"}function _c(){return kt()&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"&&globalThis?.Platform.OS==="ios"}function cs(){return!fi()&&!!(0,ot.getNavigator)()&&!!(0,ot.getDocument)()}function mi(){return kt()?qe.reactNative:fi()?qe.node:cs()?qe.browser:qe.unknown}function In(){var s;try{return kt()&&typeof globalThis<"u"&&typeof globalThis?.Application<"u"?(s=globalThis.Application)==null?void 0:s.applicationId:void 0}catch{return}}function Np(s,e){let t=new URLSearchParams(s);for(let i of Object.keys(e).sort())if(e.hasOwnProperty(i)){let r=e[i];r!==void 0&&t.set(i,r)}return t.toString()}function Pc(s){var e,t;let i=Cn();try{return s!=null&&s.url&&i.url&&new URL(s.url).host!==new URL(i.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${s.url} differs from the actual page url:${i.url}. This is probably unintended and can lead to issues.`),s.url=i.url),(e=s?.icons)!=null&&e.length&&s.icons.length>0&&(s.icons=s.icons.filter(r=>r!=="")),Pp(za(za({},i),s),{url:s?.url||i.url,name:s?.name||i.name,description:s?.description||i.description,icons:(t=s?.icons)!=null&&t.length&&s.icons.length>0?s.icons:i.icons})}catch(r){return console.warn("Error populating app metadata",r),s||i}}function Cn(){return(0,Ec.getWindowMetadata)()||{name:"",description:"",url:"",icons:[""]}}function Tp(){if(mi()===qe.reactNative&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"){let{OS:t,Version:i}=globalThis.Platform;return[t,i].join("-")}let s=ha();if(s===null)return"unknown";let e=s.os?s.os.replace(" ","").toLowerCase():"unknown";return s.type==="browser"?[e,s.name,s.version].join("-"):[e,s.version].join("-")}function Op(){var s;let e=mi();return e===qe.browser?[e,((s=(0,ot.getLocation)())==null?void 0:s.host)||"unknown"].join(":"):e}function _n(s,e,t){let i=Tp(),r=Op();return[[s,e].join("-"),[Sp,t].join("-"),i,r].join("/")}function Ac({protocol:s,version:e,relayUrl:t,sdkVersion:i,auth:r,projectId:n,useOnCloseEvent:o,bundleId:a,packageName:c}){let l=t.split("?"),h=_n(s,e,i),p={auth:r,ua:h,projectId:n,useOnCloseEvent:o||void 0,packageName:c||void 0,bundleId:a||void 0},u=Np(l[1]||"",p);return l[0]+"?"+u}function rs(s,e){return s.filter(t=>e.includes(t)).length===s.length}function ar(s){return Object.fromEntries(s.entries())}function cr(s){return new Map(Object.entries(s))}function Ut(s=xt.FIVE_MINUTES,e){let t=(0,xt.toMiliseconds)(s||xt.FIVE_MINUTES),i,r,n,o;return{resolve:a=>{n&&i&&(clearTimeout(n),i(a),o=Promise.resolve(a))},reject:a=>{n&&r&&(clearTimeout(n),r(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);n=setTimeout(()=>{let l=new Error(e);o=Promise.reject(l),c(l)},t),i=a,r=c})}}function Dt(s,e,t){return new Promise(async(i,r)=>{let n=setTimeout(()=>r(new Error(t)),e);try{let o=await s;i(o)}catch(o){r(o)}clearTimeout(n)})}function Sc(s,e){if(typeof e=="string"&&e.startsWith(`${s}:`))return e;if(s.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(s.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${s}`)}function Nc(s){return Sc("topic",s)}function Tc(s){return Sc("id",s)}function lr(s){let[e,t]=s.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function he(s,e){return(0,xt.fromMiliseconds)((e||Date.now())+(0,xt.toMiliseconds)(s))}function mt(s){return Date.now()>=(0,xt.toMiliseconds)(s)}function Y(s,e){return`${s}${e?`:${e}`:""}`}function nt(s=[],e=[]){return[...new Set([...s,...e])]}async function Oc({id:s,topic:e,wcDeepLink:t}){var i;try{if(!t)return;let r=typeof t=="string"?JSON.parse(t):t,n=r?.href;if(typeof n!="string")return;let o=Rp(n,s,e),a=mi();if(a===qe.browser){if(!((i=(0,ot.getDocument)())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}xp(o)}else a===qe.reactNative&&typeof globalThis?.Linking<"u"&&await globalThis.Linking.openURL(o)}catch(r){console.error(r)}}function Rp(s,e,t){let i=`requestId=${e}&sessionTopic=${t}`;s.endsWith("/")&&(s=s.slice(0,-1));let r=`${s}`;if(s.startsWith("https://t.me")){let n=s.includes("?")?"&startapp=":"?startapp=";r=`${r}${n}${Dp(i,!0)}`}else r=`${r}/wc?${i}`;return r}function xp(s){let e="_self";Up()?e="_top":(kp()||s.startsWith("https://")||s.startsWith("http://"))&&(e="_blank"),window.open(s,e,"noreferrer noopener")}async function Rc(s,e){let t="";try{if(cs()&&(t=localStorage.getItem(e),t))return t;t=await s.getItem(e)}catch(i){console.error(i)}return t}function Pn(s,e){if(!s.includes(e))return null;let t=s.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function An(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,s=>{let e=Math.random()*16|0;return(s==="x"?e:e&3|8).toString(16)})}function yi(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function kp(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Up(){try{return window.self!==window.top}catch{return!1}}function Dp(s,e=!1){let t=Buffer.from(s).toString("base64");return e?t.replace(/[=]/g,""):t}function xc(s){return Buffer.from(s,"base64").toString("utf-8")}function kc(s){return new Promise(e=>setTimeout(e,s))}function hi(s){if(!Number.isSafeInteger(s)||s<0)throw new Error("positive integer expected, got "+s)}function Fp(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function wi(s,...e){if(!Fp(s))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(s.length))throw new Error("Uint8Array expected of length "+e+", got length="+s.length)}function Sn(s){if(typeof s!="function"||typeof s.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");hi(s.outputLen),hi(s.blockLen)}function Cs(s,e=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(e&&s.finished)throw new Error("Hash#digest() has already been called")}function Uc(s,e){wi(s);let t=e.outputLen;if(s.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}var sr=BigInt(2**32-1),Ka=BigInt(32);function Lp(s,e=!1){return e?{h:Number(s&sr),l:Number(s>>Ka&sr)}:{h:Number(s>>Ka&sr)|0,l:Number(s&sr)|0}}function qp(s,e=!1){let t=new Uint32Array(s.length),i=new Uint32Array(s.length);for(let r=0;r<s.length;r++){let{h:n,l:o}=Lp(s[r],e);[t[r],i[r]]=[n,o]}return[t,i]}var jp=(s,e,t)=>s<<t|e>>>32-t,$p=(s,e,t)=>e<<t|s>>>32-t,Bp=(s,e,t)=>e<<t-32|s>>>64-t,Mp=(s,e,t)=>s<<t-32|e>>>64-t,bs=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Vp(s){return new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4))}function Xr(s){return new DataView(s.buffer,s.byteOffset,s.byteLength)}function ft(s,e){return s<<32-e|s>>>e}var Wa=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Hp(s){return s<<24&4278190080|s<<8&16711680|s>>>8&65280|s>>>24&255}function Ga(s){for(let e=0;e<s.length;e++)s[e]=Hp(s[e])}function zp(s){if(typeof s!="string")throw new Error("utf8ToBytes expected string, got "+typeof s);return new Uint8Array(new TextEncoder().encode(s))}function _s(s){return typeof s=="string"&&(s=zp(s)),wi(s),s}function Kp(...s){let e=0;for(let i=0;i<s.length;i++){let r=s[i];wi(r),e+=r.length}let t=new Uint8Array(e);for(let i=0,r=0;i<s.length;i++){let n=s[i];t.set(n,r),r+=n.length}return t}var pi=class{clone(){return this._cloneInto()}};function Dc(s){let e=i=>s().update(_s(i)).digest(),t=s();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>s(),e}function Os(s=32){if(bs&&typeof bs.getRandomValues=="function")return bs.getRandomValues(new Uint8Array(s));if(bs&&typeof bs.randomBytes=="function")return bs.randomBytes(s);throw new Error("crypto.getRandomValues must be defined")}var Fc=[],Lc=[],qc=[],Wp=BigInt(0),ci=BigInt(1),Gp=BigInt(2),Yp=BigInt(7),Jp=BigInt(256),Xp=BigInt(113);for(let s=0,e=ci,t=1,i=0;s<24;s++){[t,i]=[i,(2*t+3*i)%5],Fc.push(2*(5*i+t)),Lc.push((s+1)*(s+2)/2%64);let r=Wp;for(let n=0;n<7;n++)e=(e<<ci^(e>>Yp)*Xp)%Jp,e&Gp&&(r^=ci<<(ci<<BigInt(n))-ci);qc.push(r)}var[Zp,Qp]=qp(qc,!0),Ya=(s,e,t)=>t>32?Bp(s,e,t):jp(s,e,t),Ja=(s,e,t)=>t>32?Mp(s,e,t):$p(s,e,t);function eu(s,e=24){let t=new Uint32Array(10);for(let i=24-e;i<24;i++){for(let o=0;o<10;o++)t[o]=s[o]^s[o+10]^s[o+20]^s[o+30]^s[o+40];for(let o=0;o<10;o+=2){let a=(o+8)%10,c=(o+2)%10,l=t[c],h=t[c+1],p=Ya(l,h,1)^t[a],u=Ja(l,h,1)^t[a+1];for(let g=0;g<50;g+=10)s[o+g]^=p,s[o+g+1]^=u}let r=s[2],n=s[3];for(let o=0;o<24;o++){let a=Lc[o],c=Ya(r,n,a),l=Ja(r,n,a),h=Fc[o];r=s[h],n=s[h+1],s[h]=c,s[h+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=s[o+a];for(let a=0;a<10;a++)s[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}s[0]^=Zp[i],s[1]^=Qp[i]}t.fill(0)}var ln=class s extends pi{constructor(e,t,i,r=!1,n=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=i,this.enableXOF=r,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,hi(i),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Vp(this.state)}keccak(){Wa||Ga(this.state32),eu(this.state32,this.rounds),Wa||Ga(this.state32),this.posOut=0,this.pos=0}update(e){Cs(this);let{blockLen:t,state:i}=this;e=_s(e);let r=e.length;for(let n=0;n<r;){let o=Math.min(t-this.pos,r-n);for(let a=0;a<o;a++)i[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:i,blockLen:r}=this;e[i]^=t,(t&128)!==0&&i===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){Cs(this,!1),wi(e),this.finish();let t=this.state,{blockLen:i}=this;for(let r=0,n=e.length;r<n;){this.posOut>=i&&this.keccak();let o=Math.min(i-this.posOut,n-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return hi(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Uc(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:i,outputLen:r,rounds:n,enableXOF:o}=this;return e||(e=new s(t,i,r,o,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=i,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}},tu=(s,e,t)=>Dc(()=>new ln(e,s,t)),su=tu(1,136,256/8),iu="https://rpc.walletconnect.org/v1";function jc(s){let e=`Ethereum Signed Message:
1
+ import{a as Bt,b as ai,c as Ra,d as ss,e as xa,f as vs,g as ae,h as ka}from"./chunk-Q6Q2PMYM.js";import{A as ws,B as Sa,D as ji,E as $i,I as Ua,J as Da,a as ee,b as _a,c as St,h as Ce,i as Ue,j as Me,k as L,m as Pa,n as $t,o as ys,p as qi,q as oi,r as gt,s as oe,t as Br,u as Ve,v as Mr,w as Aa,x as C,y as Vr,z as H}from"./chunk-SDAGVFL2.js";import{a as ha,b as Lr,c as pa,d as ip,e as Fi,f as ua,g as ii,h as qr,i as da,j as fs,k as $e,l as Te,m as ga,n as Zt,o as Qt,p as fa,q as ma,r as ya,s as jr,t as wa,u as va,v as ba,w as Ea,x as Ca}from"./chunk-LQZA24C3.js";import{a as Di,b as gs,c as si,d as ms,e as es,f as ke,g as Ie,h as Ia,j as At,k as jt,l as dt,m as ts,n as Li,q as ri,r as ni,s as it,t as Xe,u as $r,v as Fe,w as Be}from"./chunk-BFNNKT2C.js";import{a as Hr,b as zr,c as Na,d as Kr,e as Ta,f as Oa}from"./chunk-QOQKSUB7.js";import"./chunk-MYICIF4X.js";import"./chunk-OKQEFB6X.js";import"./chunk-5CFV4JME.js";import"./chunk-FP3JV5NJ.js";import"./chunk-DBYA227G.js";import{i as Fr}from"./chunk-JJCC4FMA.js";import"./chunk-WWDFPBJY.js";import{e as ut}from"./chunk-MYQCVH5Z.js";var Lt=ut(Di());var rp="idb-keyval",np=(s={})=>{let e=s.base&&s.base.length>0?`${s.base}:`:"",t=r=>e+r,i;return s.dbName&&s.storeName&&(i=ya(s.dbName,s.storeName)),{name:rp,options:s,async hasItem(r){return!(typeof await jr(t(r),i)>"u")},async getItem(r){return await jr(t(r),i)??null},setItem(r,n){return wa(t(r),n,i)},removeItem(r){return va(t(r),i)},getKeys(){return Ea(i)},clear(){return ba(i)}}},op="WALLET_CONNECT_V2_INDEXED_DB",ap="keyvaluestorage",Gr=class{constructor(){this.indexedDb=ma({driver:np({dbName:op,storeName:ap})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,si(t))}async removeItem(e){await this.indexedDb.removeItem(e)}},Wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},Bi={exports:{}};(function(){let s;function e(){}s=e,s.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},s.prototype.setItem=function(t,i){this[t]=String(i)},s.prototype.removeItem=function(t){delete this[t]},s.prototype.clear=function(){let t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},s.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},s.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Wr<"u"&&Wr.localStorage?Bi.exports=Wr.localStorage:typeof window<"u"&&window.localStorage?Bi.exports=window.localStorage:Bi.exports=new e})();function cp(s){var e;return[s[0],gs((e=s[1])!=null?e:"")]}var Yr=class{constructor(){this.localStorage=Bi.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(cp)}async getItem(e){let t=this.localStorage.getItem(e);if(t!==null)return gs(t)}async setItem(e,t){this.localStorage.setItem(e,si(t))}async removeItem(e){this.localStorage.removeItem(e)}},lp="wc_storage_version",Fa=1,hp=async(s,e,t)=>{let i=lp,r=await e.getItem(i);if(r&&r>=Fa){t(e);return}let n=await s.getKeys();if(!n.length){t(e);return}let o=[];for(;n.length;){let a=n.shift();if(!a)continue;let c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){let l=await s.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(i,Fa),t(e),pp(s,o)},pp=async(s,e)=>{e.length&&e.forEach(async t=>{await s.removeItem(t)})},Mi=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};let e=new Yr;this.storage=e;try{let t=new Gr;hp(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}};var ja=ut(Di()),up=Object.defineProperty,dp=(s,e,t)=>e in s?up(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,La=(s,e,t)=>dp(s,typeof e!="symbol"?e+"":e,t),Vi=class extends Zt{constructor(e){super(),this.opts=e,La(this,"protocol","wc"),La(this,"version",2)}};var gp=Object.defineProperty,fp=(s,e,t)=>e in s?gp(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,mp=(s,e,t)=>fp(s,typeof e!="symbol"?e+"":e,t),Hi=class extends Zt{constructor(e,t){super(),this.core=e,this.logger=t,mp(this,"records",new Map)}},zi=class{constructor(e,t){this.logger=e,this.core=t}},Ki=class extends Zt{constructor(e,t){super(),this.relayer=e,this.logger=t}},Wi=class extends Zt{constructor(e){super()}},Gi=class{constructor(e,t,i,r){this.core=e,this.logger=t,this.name=i}};var Yi=class extends Zt{constructor(e,t){super(),this.relayer=e,this.logger=t}};var Ji=class extends Zt{constructor(e,t){super(),this.core=e,this.logger=t}};var Xi=class{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}},Zi=class{constructor(e,t){this.projectId=e,this.logger=t}},Qi=class{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}},yp=Object.defineProperty,wp=(s,e,t)=>e in s?yp(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,qa=(s,e,t)=>wp(s,typeof e!="symbol"?e+"":e,t);var er=class{constructor(e){this.opts=e,qa(this,"protocol","wc"),qa(this,"version",2)}};var tr=class{constructor(e){this.client=e}};var q=ut(Lr());var xt=ut(Lr()),ot=ut(pa()),Ec=ut(ip());function $a(s){let e=Ta(`0x${s.substring(4)}`).substring(26);return Oa(`0x${e}`)}async function Ma({hash:s,signature:e}){let t=Hr(s)?s:Kr(s),{secp256k1:i}=await import("./secp256k1-6A42G7KH.js");return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){let{r:l,s:h,v:p,yParity:u}=e,g=Number(u??p),f=Ba(g);return new i.Signature(zr(l),zr(h)).addRecoveryBit(f)}let o=Hr(e)?e:Kr(e),a=Na(`0x${o.slice(130)}`),c=Ba(a);return i.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(t.substring(2)).toHex(!1)}`}function Ba(s){if(s===0||s===1)return s;if(s===27)return 0;if(s===28)return 1;throw new Error("Invalid yParityOrV value")}async function Jr({hash:s,signature:e}){return $a(await Ma({hash:s,signature:e}))}var vp=":";function Wt(s){let[e,t]=s.split(vp);return{namespace:e,reference:t}}function Ic(s,e){return s.includes(":")?[s]:e.chains||[]}var bp=Object.defineProperty,Ep=Object.defineProperties,Ip=Object.getOwnPropertyDescriptors,Va=Object.getOwnPropertySymbols,Cp=Object.prototype.hasOwnProperty,_p=Object.prototype.propertyIsEnumerable,Ha=(s,e,t)=>e in s?bp(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,za=(s,e)=>{for(var t in e||(e={}))Cp.call(e,t)&&Ha(s,t,e[t]);if(Va)for(var t of Va(e))_p.call(e,t)&&Ha(s,t,e[t]);return s},Pp=(s,e)=>Ep(s,Ip(e)),Ap="ReactNative",qe={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"};var Sp="js";function fi(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function kt(){return!(0,ot.getDocument)()&&!!(0,ot.getNavigator)()&&navigator.product===Ap}function Cc(){return kt()&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"&&globalThis?.Platform.OS==="android"}function _c(){return kt()&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"&&globalThis?.Platform.OS==="ios"}function cs(){return!fi()&&!!(0,ot.getNavigator)()&&!!(0,ot.getDocument)()}function mi(){return kt()?qe.reactNative:fi()?qe.node:cs()?qe.browser:qe.unknown}function In(){var s;try{return kt()&&typeof globalThis<"u"&&typeof globalThis?.Application<"u"?(s=globalThis.Application)==null?void 0:s.applicationId:void 0}catch{return}}function Np(s,e){let t=new URLSearchParams(s);for(let i of Object.keys(e).sort())if(e.hasOwnProperty(i)){let r=e[i];r!==void 0&&t.set(i,r)}return t.toString()}function Pc(s){var e,t;let i=Cn();try{return s!=null&&s.url&&i.url&&new URL(s.url).host!==new URL(i.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${s.url} differs from the actual page url:${i.url}. This is probably unintended and can lead to issues.`),s.url=i.url),(e=s?.icons)!=null&&e.length&&s.icons.length>0&&(s.icons=s.icons.filter(r=>r!=="")),Pp(za(za({},i),s),{url:s?.url||i.url,name:s?.name||i.name,description:s?.description||i.description,icons:(t=s?.icons)!=null&&t.length&&s.icons.length>0?s.icons:i.icons})}catch(r){return console.warn("Error populating app metadata",r),s||i}}function Cn(){return(0,Ec.getWindowMetadata)()||{name:"",description:"",url:"",icons:[""]}}function Tp(){if(mi()===qe.reactNative&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"){let{OS:t,Version:i}=globalThis.Platform;return[t,i].join("-")}let s=ha();if(s===null)return"unknown";let e=s.os?s.os.replace(" ","").toLowerCase():"unknown";return s.type==="browser"?[e,s.name,s.version].join("-"):[e,s.version].join("-")}function Op(){var s;let e=mi();return e===qe.browser?[e,((s=(0,ot.getLocation)())==null?void 0:s.host)||"unknown"].join(":"):e}function _n(s,e,t){let i=Tp(),r=Op();return[[s,e].join("-"),[Sp,t].join("-"),i,r].join("/")}function Ac({protocol:s,version:e,relayUrl:t,sdkVersion:i,auth:r,projectId:n,useOnCloseEvent:o,bundleId:a,packageName:c}){let l=t.split("?"),h=_n(s,e,i),p={auth:r,ua:h,projectId:n,useOnCloseEvent:o||void 0,packageName:c||void 0,bundleId:a||void 0},u=Np(l[1]||"",p);return l[0]+"?"+u}function rs(s,e){return s.filter(t=>e.includes(t)).length===s.length}function ar(s){return Object.fromEntries(s.entries())}function cr(s){return new Map(Object.entries(s))}function Ut(s=xt.FIVE_MINUTES,e){let t=(0,xt.toMiliseconds)(s||xt.FIVE_MINUTES),i,r,n,o;return{resolve:a=>{n&&i&&(clearTimeout(n),i(a),o=Promise.resolve(a))},reject:a=>{n&&r&&(clearTimeout(n),r(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);n=setTimeout(()=>{let l=new Error(e);o=Promise.reject(l),c(l)},t),i=a,r=c})}}function Dt(s,e,t){return new Promise(async(i,r)=>{let n=setTimeout(()=>r(new Error(t)),e);try{let o=await s;i(o)}catch(o){r(o)}clearTimeout(n)})}function Sc(s,e){if(typeof e=="string"&&e.startsWith(`${s}:`))return e;if(s.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(s.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${s}`)}function Nc(s){return Sc("topic",s)}function Tc(s){return Sc("id",s)}function lr(s){let[e,t]=s.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function he(s,e){return(0,xt.fromMiliseconds)((e||Date.now())+(0,xt.toMiliseconds)(s))}function mt(s){return Date.now()>=(0,xt.toMiliseconds)(s)}function Y(s,e){return`${s}${e?`:${e}`:""}`}function nt(s=[],e=[]){return[...new Set([...s,...e])]}async function Oc({id:s,topic:e,wcDeepLink:t}){var i;try{if(!t)return;let r=typeof t=="string"?JSON.parse(t):t,n=r?.href;if(typeof n!="string")return;let o=Rp(n,s,e),a=mi();if(a===qe.browser){if(!((i=(0,ot.getDocument)())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}xp(o)}else a===qe.reactNative&&typeof globalThis?.Linking<"u"&&await globalThis.Linking.openURL(o)}catch(r){console.error(r)}}function Rp(s,e,t){let i=`requestId=${e}&sessionTopic=${t}`;s.endsWith("/")&&(s=s.slice(0,-1));let r=`${s}`;if(s.startsWith("https://t.me")){let n=s.includes("?")?"&startapp=":"?startapp=";r=`${r}${n}${Dp(i,!0)}`}else r=`${r}/wc?${i}`;return r}function xp(s){let e="_self";Up()?e="_top":(kp()||s.startsWith("https://")||s.startsWith("http://"))&&(e="_blank"),window.open(s,e,"noreferrer noopener")}async function Rc(s,e){let t="";try{if(cs()&&(t=localStorage.getItem(e),t))return t;t=await s.getItem(e)}catch(i){console.error(i)}return t}function Pn(s,e){if(!s.includes(e))return null;let t=s.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function An(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,s=>{let e=Math.random()*16|0;return(s==="x"?e:e&3|8).toString(16)})}function yi(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function kp(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Up(){try{return window.self!==window.top}catch{return!1}}function Dp(s,e=!1){let t=Buffer.from(s).toString("base64");return e?t.replace(/[=]/g,""):t}function xc(s){return Buffer.from(s,"base64").toString("utf-8")}function kc(s){return new Promise(e=>setTimeout(e,s))}function hi(s){if(!Number.isSafeInteger(s)||s<0)throw new Error("positive integer expected, got "+s)}function Fp(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function wi(s,...e){if(!Fp(s))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(s.length))throw new Error("Uint8Array expected of length "+e+", got length="+s.length)}function Sn(s){if(typeof s!="function"||typeof s.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");hi(s.outputLen),hi(s.blockLen)}function Cs(s,e=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(e&&s.finished)throw new Error("Hash#digest() has already been called")}function Uc(s,e){wi(s);let t=e.outputLen;if(s.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}var sr=BigInt(2**32-1),Ka=BigInt(32);function Lp(s,e=!1){return e?{h:Number(s&sr),l:Number(s>>Ka&sr)}:{h:Number(s>>Ka&sr)|0,l:Number(s&sr)|0}}function qp(s,e=!1){let t=new Uint32Array(s.length),i=new Uint32Array(s.length);for(let r=0;r<s.length;r++){let{h:n,l:o}=Lp(s[r],e);[t[r],i[r]]=[n,o]}return[t,i]}var jp=(s,e,t)=>s<<t|e>>>32-t,$p=(s,e,t)=>e<<t|s>>>32-t,Bp=(s,e,t)=>e<<t-32|s>>>64-t,Mp=(s,e,t)=>s<<t-32|e>>>64-t,bs=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Vp(s){return new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4))}function Xr(s){return new DataView(s.buffer,s.byteOffset,s.byteLength)}function ft(s,e){return s<<32-e|s>>>e}var Wa=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Hp(s){return s<<24&4278190080|s<<8&16711680|s>>>8&65280|s>>>24&255}function Ga(s){for(let e=0;e<s.length;e++)s[e]=Hp(s[e])}function zp(s){if(typeof s!="string")throw new Error("utf8ToBytes expected string, got "+typeof s);return new Uint8Array(new TextEncoder().encode(s))}function _s(s){return typeof s=="string"&&(s=zp(s)),wi(s),s}function Kp(...s){let e=0;for(let i=0;i<s.length;i++){let r=s[i];wi(r),e+=r.length}let t=new Uint8Array(e);for(let i=0,r=0;i<s.length;i++){let n=s[i];t.set(n,r),r+=n.length}return t}var pi=class{clone(){return this._cloneInto()}};function Dc(s){let e=i=>s().update(_s(i)).digest(),t=s();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>s(),e}function Os(s=32){if(bs&&typeof bs.getRandomValues=="function")return bs.getRandomValues(new Uint8Array(s));if(bs&&typeof bs.randomBytes=="function")return bs.randomBytes(s);throw new Error("crypto.getRandomValues must be defined")}var Fc=[],Lc=[],qc=[],Wp=BigInt(0),ci=BigInt(1),Gp=BigInt(2),Yp=BigInt(7),Jp=BigInt(256),Xp=BigInt(113);for(let s=0,e=ci,t=1,i=0;s<24;s++){[t,i]=[i,(2*t+3*i)%5],Fc.push(2*(5*i+t)),Lc.push((s+1)*(s+2)/2%64);let r=Wp;for(let n=0;n<7;n++)e=(e<<ci^(e>>Yp)*Xp)%Jp,e&Gp&&(r^=ci<<(ci<<BigInt(n))-ci);qc.push(r)}var[Zp,Qp]=qp(qc,!0),Ya=(s,e,t)=>t>32?Bp(s,e,t):jp(s,e,t),Ja=(s,e,t)=>t>32?Mp(s,e,t):$p(s,e,t);function eu(s,e=24){let t=new Uint32Array(10);for(let i=24-e;i<24;i++){for(let o=0;o<10;o++)t[o]=s[o]^s[o+10]^s[o+20]^s[o+30]^s[o+40];for(let o=0;o<10;o+=2){let a=(o+8)%10,c=(o+2)%10,l=t[c],h=t[c+1],p=Ya(l,h,1)^t[a],u=Ja(l,h,1)^t[a+1];for(let g=0;g<50;g+=10)s[o+g]^=p,s[o+g+1]^=u}let r=s[2],n=s[3];for(let o=0;o<24;o++){let a=Lc[o],c=Ya(r,n,a),l=Ja(r,n,a),h=Fc[o];r=s[h],n=s[h+1],s[h]=c,s[h+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=s[o+a];for(let a=0;a<10;a++)s[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}s[0]^=Zp[i],s[1]^=Qp[i]}t.fill(0)}var ln=class s extends pi{constructor(e,t,i,r=!1,n=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=i,this.enableXOF=r,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,hi(i),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Vp(this.state)}keccak(){Wa||Ga(this.state32),eu(this.state32,this.rounds),Wa||Ga(this.state32),this.posOut=0,this.pos=0}update(e){Cs(this);let{blockLen:t,state:i}=this;e=_s(e);let r=e.length;for(let n=0;n<r;){let o=Math.min(t-this.pos,r-n);for(let a=0;a<o;a++)i[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:i,blockLen:r}=this;e[i]^=t,(t&128)!==0&&i===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){Cs(this,!1),wi(e),this.finish();let t=this.state,{blockLen:i}=this;for(let r=0,n=e.length;r<n;){this.posOut>=i&&this.keccak();let o=Math.min(i-this.posOut,n-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return hi(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Uc(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:i,outputLen:r,rounds:n,enableXOF:o}=this;return e||(e=new s(t,i,r,o,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=i,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}},tu=(s,e,t)=>Dc(()=>new ln(e,s,t)),su=tu(1,136,256/8),iu="https://rpc.walletconnect.org/v1";function jc(s){let e=`Ethereum Signed Message:
2
2
  ${s.length}`,t=new TextEncoder().encode(e+s);return"0x"+Buffer.from(su(t)).toString("hex")}async function ru(s,e,t,i,r,n){switch(t.t){case"eip191":return await nu(s,e,t.s);case"eip1271":return await ou(s,e,t.s,i,r,n);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}async function nu(s,e,t){return(await Jr({hash:jc(e),signature:t})).toLowerCase()===s.toLowerCase()}async function ou(s,e,t,i,r,n){let o=Wt(i);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{let a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",h=t.substring(2),p=jc(e).substring(2),u=a+p+c+l+h,g=await fetch(`${n||iu}/?chainId=${i}&projectId=${r}`,{method:"POST",body:JSON.stringify({id:au(),jsonrpc:"2.0",method:"eth_call",params:[{to:s,data:u},"latest"]})}),{result:f}=await g.json();return f?f.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function au(){return Date.now()+Math.floor(Math.random()*1e3)}function $c(s){let e=atob(s),t=new Uint8Array(e.length);for(let o=0;o<e.length;o++)t[o]=e.charCodeAt(o);let i=t[0];if(i===0)throw new Error("No signatures found");let r=1+i*64;if(t.length<r)throw new Error("Transaction data too short for claimed signature count");if(t.length<100)throw new Error("Transaction too short");let n=Buffer.from(s,"base64").slice(1,65);return Fi.encode(n)}var cu=Object.defineProperty,lu=Object.defineProperties,hu=Object.getOwnPropertyDescriptors,Xa=Object.getOwnPropertySymbols,pu=Object.prototype.hasOwnProperty,uu=Object.prototype.propertyIsEnumerable,Za=(s,e,t)=>e in s?cu(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,du=(s,e)=>{for(var t in e||(e={}))pu.call(e,t)&&Za(s,t,e[t]);if(Xa)for(var t of Xa(e))uu.call(e,t)&&Za(s,t,e[t]);return s},gu=(s,e)=>lu(s,hu(e)),fu="did:pkh:",Nn=s=>s?.split(":"),mu=s=>{let e=s&&Nn(s);if(e)return s.includes(fu)?e[3]:e[1]},hr=s=>{let e=s&&Nn(s);if(e)return e[2]+":"+e[3]},vi=s=>{let e=s&&Nn(s);if(e)return e.pop()};async function Tn(s){let{cacao:e,projectId:t}=s,{s:i,p:r}=e,n=On(r,r.iss),o=vi(r.iss);return await ru(o,n,i,hr(r.iss),t)}var On=(s,e)=>{let t=`${s.domain} wants you to sign in with your Ethereum account:`,i=vi(e);if(!s.aud&&!s.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let r=s.statement||void 0,n=`URI: ${s.aud||s.uri}`,o=`Version: ${s.version}`,a=`Chain ID: ${mu(e)}`,c=`Nonce: ${s.nonce}`,l=`Issued At: ${s.iat}`,h=s.exp?`Expiration Time: ${s.exp}`:void 0,p=s.nbf?`Not Before: ${s.nbf}`:void 0,u=s.requestId?`Request ID: ${s.requestId}`:void 0,g=s.resources?`Resources:${s.resources.map(m=>`
3
3
  - ${m}`).join("")}`:void 0,f=bi(s.resources);if(f){let m=ui(f);r=Cu(r,m)}return[t,i,"",r,"",n,o,a,c,l,h,p,u,g].filter(m=>m!=null).join(`
4
4
  `)};function yu(s){return Buffer.from(JSON.stringify(s)).toString("base64")}function wu(s){return JSON.parse(Buffer.from(s,"base64").toString("utf-8"))}function os(s){if(!s)throw new Error("No recap provided, value is undefined");if(!s.att)throw new Error("No `att` property found");let e=Object.keys(s.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{let i=s.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(r=>{let n=i[r];if(!Array.isArray(n))throw new Error(`Ability limits ${r} must be an array of objects, found: ${n}`);if(!n.length)throw new Error(`Value of ${r} is empty array, must be an array with objects`);n.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${r}) must be an array of objects, found: ${o}`)})})})}function vu(s,e,t,i={}){return t?.sort((r,n)=>r.localeCompare(n)),{att:{[s]:bu(e,t,i)}}}function bu(s,e,t={}){e=e?.sort((r,n)=>r.localeCompare(n));let i=e.map(r=>({[`${s}/${r}`]:[t]}));return Object.assign({},...i)}function Bc(s){return os(s),`urn:recap:${yu(s).replace(/=/g,"")}`}function ui(s){let e=wu(s.replace("urn:recap:",""));return os(e),e}function Mc(s,e,t){let i=vu(s,e,t);return Bc(i)}function Eu(s){return s&&s.includes("urn:recap:")}function Vc(s,e){let t=ui(s),i=ui(e),r=Iu(t,i);return Bc(r)}function Iu(s,e){os(s),os(e);let t=Object.keys(s.att).concat(Object.keys(e.att)).sort((r,n)=>r.localeCompare(n)),i={att:{}};return t.forEach(r=>{var n,o;Object.keys(((n=s.att)==null?void 0:n[r])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[r])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,l;i.att[r]=gu(du({},i.att[r]),{[a]:((c=s.att[r])==null?void 0:c[a])||((l=e.att[r])==null?void 0:l[a])})})}),i}function Cu(s="",e){os(e);let t="I further authorize the stated URI to perform the following actions on my behalf: ";if(s.includes(t))return s;let i=[],r=0;Object.keys(e.att).forEach(a=>{let c=Object.keys(e.att[a]).map(p=>({ability:p.split("/")[0],action:p.split("/")[1]}));c.sort((p,u)=>p.action.localeCompare(u.action));let l={};c.forEach(p=>{l[p.ability]||(l[p.ability]=[]),l[p.ability].push(p.action)});let h=Object.keys(l).map(p=>(r++,`(${r}) '${p}': '${l[p].join("', '")}' for '${a}'.`));i.push(h.join(", ").replace(".,","."))});let n=i.join(" "),o=`${t}${n}`;return`${s?s+" ":""}${o}`}function Rn(s){var e;let t=ui(s);os(t);let i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(r=>r.split("/")[1]):[]}function xn(s){let e=ui(s);os(e);let t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(r=>{var n;(n=r?.[0])!=null&&n.chains&&t.push(r[0].chains)})}),[...new Set(t.flat())]}function bi(s){if(!s)return;let e=s?.[s.length-1];return Eu(e)?e:void 0}function Zr(s){if(!Number.isSafeInteger(s)||s<0)throw new Error("positive integer expected, got "+s)}function Hc(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function ze(s,...e){if(!Hc(s))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(s.length))throw new Error("Uint8Array expected of length "+e+", got length="+s.length)}function Qa(s,e=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(e&&s.finished)throw new Error("Hash#digest() has already been called")}function _u(s,e){ze(s);let t=e.outputLen;if(s.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function ec(s){if(typeof s!="boolean")throw new Error(`boolean expected, not ${s}`)}var Ht=s=>new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4)),Pu=s=>new DataView(s.buffer,s.byteOffset,s.byteLength),Au=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Au)throw new Error("Non little-endian hardware is not supported");function Su(s){if(typeof s!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(s))}function hn(s){if(typeof s=="string")s=Su(s);else if(Hc(s))s=pn(s);else throw new Error("Uint8Array expected, got "+typeof s);return s}function Nu(s,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(s,e)}function Tu(s,e){if(s.length!==e.length)return!1;let t=0;for(let i=0;i<s.length;i++)t|=s[i]^e[i];return t===0}var Ou=(s,e)=>{function t(i,...r){if(ze(i),s.nonceLength!==void 0){let l=r[0];if(!l)throw new Error("nonce / iv required");s.varSizeNonce?ze(l):ze(l,s.nonceLength)}let n=s.tagLength;n&&r[1]!==void 0&&ze(r[1]);let o=e(i,...r),a=(l,h)=>{if(h!==void 0){if(l!==2)throw new Error("cipher output not supported");ze(h)}},c=!1;return{encrypt(l,h){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,ze(l),a(o.encrypt.length,h),o.encrypt(l,h)},decrypt(l,h){if(ze(l),n&&l.length<n)throw new Error("invalid ciphertext length: smaller than tagLength="+n);return a(o.decrypt.length,h),o.decrypt(l,h)}}}return Object.assign(t,s),t};function tc(s,e,t=!0){if(e===void 0)return new Uint8Array(s);if(e.length!==s)throw new Error("invalid output length, expected "+s+", got: "+e.length);if(t&&!Ru(e))throw new Error("invalid output, must be aligned");return e}function sc(s,e,t,i){if(typeof s.setBigUint64=="function")return s.setBigUint64(e,t,i);let r=BigInt(32),n=BigInt(4294967295),o=Number(t>>r&n),a=Number(t&n),c=i?4:0,l=i?0:4;s.setUint32(e+c,o,i),s.setUint32(e+l,a,i)}function Ru(s){return s.byteOffset%4===0}function pn(s){return Uint8Array.from(s)}function Ps(...s){for(let e=0;e<s.length;e++)s[e].fill(0)}var zc=s=>Uint8Array.from(s.split("").map(e=>e.charCodeAt(0))),xu=zc("expand 16-byte k"),ku=zc("expand 32-byte k"),Uu=Ht(xu),Du=Ht(ku);function G(s,e){return s<<e|s>>>32-e}function un(s){return s.byteOffset%4===0}var ir=64,Fu=16,Kc=2**32-1,ic=new Uint32Array;function Lu(s,e,t,i,r,n,o,a){let c=r.length,l=new Uint8Array(ir),h=Ht(l),p=un(r)&&un(n),u=p?Ht(r):ic,g=p?Ht(n):ic;for(let f=0;f<c;o++){if(s(e,t,i,h,o,a),o>=Kc)throw new Error("arx: counter overflow");let m=Math.min(ir,c-f);if(p&&m===ir){let d=f/4;if(f%4!==0)throw new Error("arx: invalid block position");for(let w=0,y;w<Fu;w++)y=d+w,g[y]=u[y]^h[w];f+=ir;continue}for(let d=0,w;d<m;d++)w=f+d,n[w]=r[w]^l[d];f+=m}}function qu(s,e){let{allowShortKeys:t,extendNonceFn:i,counterLength:r,counterRight:n,rounds:o}=Nu({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof s!="function")throw new Error("core must be a function");return Zr(r),Zr(o),ec(n),ec(t),(a,c,l,h,p=0)=>{ze(a),ze(c),ze(l);let u=l.length;if(h===void 0&&(h=new Uint8Array(u)),ze(h),Zr(p),p<0||p>=Kc)throw new Error("arx: counter overflow");if(h.length<u)throw new Error(`arx: output (${h.length}) is shorter than data (${u})`);let g=[],f=a.length,m,d;if(f===32)g.push(m=pn(a)),d=Du;else if(f===16&&t)m=new Uint8Array(32),m.set(a),m.set(a,16),d=Uu,g.push(m);else throw new Error(`arx: invalid 32-byte key, got length=${f}`);un(c)||g.push(c=pn(c));let w=Ht(m);if(i){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");i(d,w,Ht(c.subarray(0,16)),w),c=c.subarray(16)}let y=16-r;if(y!==c.length)throw new Error(`arx: nonce must be ${y} or 16 bytes`);if(y!==12){let T=new Uint8Array(12);T.set(c,n?0:12-c.length),c=T,g.push(c)}let I=Ht(c);return Lu(s,d,w,I,l,h,p,o),Ps(...g),h}}var _e=(s,e)=>s[e++]&255|(s[e++]&255)<<8,dn=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=hn(e),ze(e,32);let t=_e(e,0),i=_e(e,2),r=_e(e,4),n=_e(e,6),o=_e(e,8),a=_e(e,10),c=_e(e,12),l=_e(e,14);this.r[0]=t&8191,this.r[1]=(t>>>13|i<<3)&8191,this.r[2]=(i>>>10|r<<6)&7939,this.r[3]=(r>>>7|n<<9)&8191,this.r[4]=(n>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let h=0;h<8;h++)this.pad[h]=_e(e,16+2*h)}process(e,t,i=!1){let r=i?0:2048,{h:n,r:o}=this,a=o[0],c=o[1],l=o[2],h=o[3],p=o[4],u=o[5],g=o[6],f=o[7],m=o[8],d=o[9],w=_e(e,t+0),y=_e(e,t+2),I=_e(e,t+4),T=_e(e,t+6),R=_e(e,t+8),_=_e(e,t+10),A=_e(e,t+12),x=_e(e,t+14),v=n[0]+(w&8191),j=n[1]+((w>>>13|y<<3)&8191),U=n[2]+((y>>>10|I<<6)&8191),F=n[3]+((I>>>7|T<<9)&8191),B=n[4]+((T>>>4|R<<12)&8191),E=n[5]+(R>>>1&8191),N=n[6]+((R>>>14|_<<2)&8191),S=n[7]+((_>>>11|A<<5)&8191),k=n[8]+((A>>>8|x<<8)&8191),D=n[9]+(x>>>5|r),P=0,$=P+v*a+j*(5*d)+U*(5*m)+F*(5*f)+B*(5*g);P=$>>>13,$&=8191,$+=E*(5*u)+N*(5*p)+S*(5*h)+k*(5*l)+D*(5*c),P+=$>>>13,$&=8191;let M=P+v*c+j*a+U*(5*d)+F*(5*m)+B*(5*f);P=M>>>13,M&=8191,M+=E*(5*g)+N*(5*u)+S*(5*p)+k*(5*h)+D*(5*l),P+=M>>>13,M&=8191;let V=P+v*l+j*c+U*a+F*(5*d)+B*(5*m);P=V>>>13,V&=8191,V+=E*(5*f)+N*(5*g)+S*(5*u)+k*(5*p)+D*(5*h),P+=V>>>13,V&=8191;let ie=P+v*h+j*l+U*c+F*a+B*(5*d);P=ie>>>13,ie&=8191,ie+=E*(5*m)+N*(5*f)+S*(5*g)+k*(5*u)+D*(5*p),P+=ie>>>13,ie&=8191;let Q=P+v*p+j*h+U*l+F*c+B*a;P=Q>>>13,Q&=8191,Q+=E*(5*d)+N*(5*m)+S*(5*f)+k*(5*g)+D*(5*u),P+=Q>>>13,Q&=8191;let pe=P+v*u+j*p+U*h+F*l+B*c;P=pe>>>13,pe&=8191,pe+=E*a+N*(5*d)+S*(5*m)+k*(5*f)+D*(5*g),P+=pe>>>13,pe&=8191;let ye=P+v*g+j*u+U*p+F*h+B*l;P=ye>>>13,ye&=8191,ye+=E*c+N*a+S*(5*d)+k*(5*m)+D*(5*f),P+=ye>>>13,ye&=8191;let Ne=P+v*f+j*g+U*u+F*p+B*h;P=Ne>>>13,Ne&=8191,Ne+=E*l+N*c+S*a+k*(5*d)+D*(5*m),P+=Ne>>>13,Ne&=8191;let de=P+v*m+j*f+U*g+F*u+B*p;P=de>>>13,de&=8191,de+=E*h+N*l+S*c+k*a+D*(5*d),P+=de>>>13,de&=8191;let ge=P+v*d+j*m+U*f+F*g+B*u;P=ge>>>13,ge&=8191,ge+=E*p+N*h+S*l+k*c+D*a,P+=ge>>>13,ge&=8191,P=(P<<2)+P|0,P=P+$|0,$=P&8191,P=P>>>13,M+=P,n[0]=$,n[1]=M,n[2]=V,n[3]=ie,n[4]=Q,n[5]=pe,n[6]=ye,n[7]=Ne,n[8]=de,n[9]=ge}finalize(){let{h:e,pad:t}=this,i=new Uint16Array(10),r=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=r,r=e[a]>>>13,e[a]&=8191;e[0]+=r*5,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,i[0]=e[0]+5,r=i[0]>>>13,i[0]&=8191;for(let a=1;a<10;a++)i[a]=e[a]+r,r=i[a]>>>13,i[a]&=8191;i[9]-=8192;let n=(r^1)-1;for(let a=0;a<10;a++)i[a]&=n;n=~n;for(let a=0;a<10;a++)e[a]=e[a]&n|i[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let o=e[0]+t[0];e[0]=o&65535;for(let a=1;a<8;a++)o=(e[a]+t[a]|0)+(o>>>16)|0,e[a]=o&65535;Ps(i)}update(e){Qa(this);let{buffer:t,blockLen:i}=this;e=hn(e);let r=e.length;for(let n=0;n<r;){let o=Math.min(i-this.pos,r-n);if(o===i){for(;i<=r-n;n+=i)this.process(e,n);continue}t.set(e.subarray(n,n+o),this.pos),this.pos+=o,n+=o,this.pos===i&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){Ps(this.h,this.r,this.buffer,this.pad)}digestInto(e){Qa(this),_u(e,this),this.finished=!0;let{buffer:t,h:i}=this,{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let n=0;for(let o=0;o<8;o++)e[n++]=i[o]>>>0,e[n++]=i[o]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let i=e.slice(0,t);return this.destroy(),i}};function ju(s){let e=(i,r)=>s(r).update(hn(i)).digest(),t=s(new Uint8Array(32));return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=i=>s(i),e}var $u=ju(s=>new dn(s));function Bu(s,e,t,i,r,n=20){let o=s[0],a=s[1],c=s[2],l=s[3],h=e[0],p=e[1],u=e[2],g=e[3],f=e[4],m=e[5],d=e[6],w=e[7],y=r,I=t[0],T=t[1],R=t[2],_=o,A=a,x=c,v=l,j=h,U=p,F=u,B=g,E=f,N=m,S=d,k=w,D=y,P=I,$=T,M=R;for(let ie=0;ie<n;ie+=2)_=_+j|0,D=G(D^_,16),E=E+D|0,j=G(j^E,12),_=_+j|0,D=G(D^_,8),E=E+D|0,j=G(j^E,7),A=A+U|0,P=G(P^A,16),N=N+P|0,U=G(U^N,12),A=A+U|0,P=G(P^A,8),N=N+P|0,U=G(U^N,7),x=x+F|0,$=G($^x,16),S=S+$|0,F=G(F^S,12),x=x+F|0,$=G($^x,8),S=S+$|0,F=G(F^S,7),v=v+B|0,M=G(M^v,16),k=k+M|0,B=G(B^k,12),v=v+B|0,M=G(M^v,8),k=k+M|0,B=G(B^k,7),_=_+U|0,M=G(M^_,16),S=S+M|0,U=G(U^S,12),_=_+U|0,M=G(M^_,8),S=S+M|0,U=G(U^S,7),A=A+F|0,D=G(D^A,16),k=k+D|0,F=G(F^k,12),A=A+F|0,D=G(D^A,8),k=k+D|0,F=G(F^k,7),x=x+B|0,P=G(P^x,16),E=E+P|0,B=G(B^E,12),x=x+B|0,P=G(P^x,8),E=E+P|0,B=G(B^E,7),v=v+j|0,$=G($^v,16),N=N+$|0,j=G(j^N,12),v=v+j|0,$=G($^v,8),N=N+$|0,j=G(j^N,7);let V=0;i[V++]=o+_|0,i[V++]=a+A|0,i[V++]=c+x|0,i[V++]=l+v|0,i[V++]=h+j|0,i[V++]=p+U|0,i[V++]=u+F|0,i[V++]=g+B|0,i[V++]=f+E|0,i[V++]=m+N|0,i[V++]=d+S|0,i[V++]=w+k|0,i[V++]=y+D|0,i[V++]=I+P|0,i[V++]=T+$|0,i[V++]=R+M|0}var Mu=qu(Bu,{counterRight:!1,counterLength:4,allowShortKeys:!1}),Vu=new Uint8Array(16),rc=(s,e)=>{s.update(e);let t=e.length%16;t&&s.update(Vu.subarray(t))},Hu=new Uint8Array(32);function nc(s,e,t,i,r){let n=s(e,t,Hu),o=$u.create(n);r&&rc(o,r),rc(o,i);let a=new Uint8Array(16),c=Pu(a);sc(c,0,BigInt(r?r.length:0),!0),sc(c,8,BigInt(i.length),!0),o.update(a);let l=o.digest();return Ps(n,a),l}var zu=s=>(e,t,i)=>({encrypt(r,n){let o=r.length;n=tc(o+16,n,!1),n.set(r);let a=n.subarray(0,-16);s(e,t,a,a,1);let c=nc(s,e,t,a,i);return n.set(c,o),Ps(c),n},decrypt(r,n){n=tc(r.length-16,n,!1);let o=r.subarray(0,-16),a=r.subarray(-16),c=nc(s,e,t,o,i);if(!Tu(a,c))throw new Error("invalid tag");return n.set(r.subarray(0,-16)),s(e,t,n,n,1),Ps(c),n}}),Wc=Ou({blockSize:64,nonceLength:12,tagLength:16},zu(Mu)),nr=class extends pi{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Sn(e);let i=_s(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,n=new Uint8Array(r);n.set(i.length>r?e.create().update(i).digest():i);for(let o=0;o<n.length;o++)n[o]^=54;this.iHash.update(n),this.oHash=e.create();for(let o=0;o<n.length;o++)n[o]^=106;this.oHash.update(n),n.fill(0)}update(e){return Cs(this),this.iHash.update(e),this}digestInto(e){Cs(this),wi(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:i,finished:r,destroyed:n,blockLen:o,outputLen:a}=this;return e=e,e.finished=r,e.destroyed=n,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},pr=(s,e,t)=>new nr(s,e).update(t).digest();pr.create=(s,e)=>new nr(s,e);function Ku(s,e,t){return Sn(s),t===void 0&&(t=new Uint8Array(s.outputLen)),pr(s,_s(t),_s(e))}var Qr=new Uint8Array([0]),oc=new Uint8Array;function Wu(s,e,t,i=32){if(Sn(s),hi(i),i>255*s.outputLen)throw new Error("Length should be <= 255*HashLen");let r=Math.ceil(i/s.outputLen);t===void 0&&(t=oc);let n=new Uint8Array(r*s.outputLen),o=pr.create(s,e),a=o._cloneInto(),c=new Uint8Array(o.outputLen);for(let l=0;l<r;l++)Qr[0]=l+1,a.update(l===0?oc:c).update(t).update(Qr).digestInto(c),n.set(c,s.outputLen*l),o._cloneInto(a);return o.destroy(),a.destroy(),c.fill(0),Qr.fill(0),n.slice(0,i)}var Gu=(s,e,t,i,r)=>Wu(s,Ku(s,e,t),i,r);function Yu(s,e,t,i){if(typeof s.setBigUint64=="function")return s.setBigUint64(e,t,i);let r=BigInt(32),n=BigInt(4294967295),o=Number(t>>r&n),a=Number(t&n),c=i?4:0,l=i?0:4;s.setUint32(e+c,o,i),s.setUint32(e+l,a,i)}function Ju(s,e,t){return s&e^~s&t}function Xu(s,e,t){return s&e^s&t^e&t}var gn=class extends pi{constructor(e,t,i,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=i,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Xr(this.buffer)}update(e){Cs(this);let{view:t,buffer:i,blockLen:r}=this;e=_s(e);let n=e.length;for(let o=0;o<n;){let a=Math.min(r-this.pos,n-o);if(a===r){let c=Xr(e);for(;r<=n-o;o+=r)this.process(c,o);continue}i.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Cs(this),Uc(e,this),this.finished=!0;let{buffer:t,view:i,blockLen:r,isLE:n}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(i,0),o=0);for(let p=o;p<r;p++)t[p]=0;Yu(i,r-8,BigInt(this.length*8),n),this.process(i,0);let a=Xr(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p<l;p++)a.setUint32(4*p,h[p],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let i=e.slice(0,t);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:i,length:r,finished:n,destroyed:o,pos:a}=this;return e.length=r,e.pos=a,e.finished=n,e.destroyed=o,r%t&&e.buffer.set(i),e}},Zu=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Mt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Vt=new Uint32Array(64),fn=class extends gn{constructor(){super(64,32,8,!1),this.A=Mt[0]|0,this.B=Mt[1]|0,this.C=Mt[2]|0,this.D=Mt[3]|0,this.E=Mt[4]|0,this.F=Mt[5]|0,this.G=Mt[6]|0,this.H=Mt[7]|0}get(){let{A:e,B:t,C:i,D:r,E:n,F:o,G:a,H:c}=this;return[e,t,i,r,n,o,a,c]}set(e,t,i,r,n,o,a,c){this.A=e|0,this.B=t|0,this.C=i|0,this.D=r|0,this.E=n|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,t){for(let p=0;p<16;p++,t+=4)Vt[p]=e.getUint32(t,!1);for(let p=16;p<64;p++){let u=Vt[p-15],g=Vt[p-2],f=ft(u,7)^ft(u,18)^u>>>3,m=ft(g,17)^ft(g,19)^g>>>10;Vt[p]=m+Vt[p-7]+f+Vt[p-16]|0}let{A:i,B:r,C:n,D:o,E:a,F:c,G:l,H:h}=this;for(let p=0;p<64;p++){let u=ft(a,6)^ft(a,11)^ft(a,25),g=h+u+Ju(a,c,l)+Zu[p]+Vt[p]|0,f=(ft(i,2)^ft(i,13)^ft(i,22))+Xu(i,r,n)|0;h=l,l=c,c=a,a=o+g|0,o=n,n=r,r=i,i=g+f|0}i=i+this.A|0,r=r+this.B|0,n=n+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(i,r,n,o,a,c,l,h)}roundClean(){Vt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Ei=Dc(()=>new fn);var ur=BigInt(0),dr=BigInt(1),Qu=BigInt(2);function as(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function Ii(s){if(!as(s))throw new Error("Uint8Array expected")}function As(s,e){if(typeof e!="boolean")throw new Error(s+" boolean expected, got "+e)}var ed=Array.from({length:256},(s,e)=>e.toString(16).padStart(2,"0"));function Ss(s){Ii(s);let e="";for(let t=0;t<s.length;t++)e+=ed[s[t]];return e}function Is(s){let e=s.toString(16);return e.length&1?"0"+e:e}function kn(s){if(typeof s!="string")throw new Error("hex string expected, got "+typeof s);return s===""?ur:BigInt("0x"+s)}var Nt={_0:48,_9:57,A:65,F:70,a:97,f:102};function ac(s){if(s>=Nt._0&&s<=Nt._9)return s-Nt._0;if(s>=Nt.A&&s<=Nt.F)return s-(Nt.A-10);if(s>=Nt.a&&s<=Nt.f)return s-(Nt.a-10)}function Ns(s){if(typeof s!="string")throw new Error("hex string expected, got "+typeof s);let e=s.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let i=new Uint8Array(t);for(let r=0,n=0;r<t;r++,n+=2){let o=ac(s.charCodeAt(n)),a=ac(s.charCodeAt(n+1));if(o===void 0||a===void 0){let c=s[n]+s[n+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+n)}i[r]=o*16+a}return i}function ns(s){return kn(Ss(s))}function di(s){return Ii(s),kn(Ss(Uint8Array.from(s).reverse()))}function Ts(s,e){return Ns(s.toString(16).padStart(e*2,"0"))}function gr(s,e){return Ts(s,e).reverse()}function td(s){return Ns(Is(s))}function He(s,e,t){let i;if(typeof e=="string")try{i=Ns(e)}catch(n){throw new Error(s+" must be hex string or Uint8Array, cause: "+n)}else if(as(e))i=Uint8Array.from(e);else throw new Error(s+" must be hex string or Uint8Array");let r=i.length;if(typeof t=="number"&&r!==t)throw new Error(s+" of length "+t+" expected, got "+r);return i}function gi(...s){let e=0;for(let i=0;i<s.length;i++){let r=s[i];Ii(r),e+=r.length}let t=new Uint8Array(e);for(let i=0,r=0;i<s.length;i++){let n=s[i];t.set(n,r),r+=n.length}return t}function sd(s,e){if(s.length!==e.length)return!1;let t=0;for(let i=0;i<s.length;i++)t|=s[i]^e[i];return t===0}function id(s){if(typeof s!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(s))}var en=s=>typeof s=="bigint"&&ur<=s;function fr(s,e,t){return en(s)&&en(e)&&en(t)&&e<=s&&s<t}function Rt(s,e,t,i){if(!fr(e,t,i))throw new Error("expected valid "+s+": "+t+" <= n < "+i+", got "+e)}function Gc(s){let e;for(e=0;s>ur;s>>=dr,e+=1);return e}function rd(s,e){return s>>BigInt(e)&dr}function nd(s,e,t){return s|(t?dr:ur)<<BigInt(e)}var Un=s=>(Qu<<BigInt(s-1))-dr,tn=s=>new Uint8Array(s),cc=s=>Uint8Array.from(s);function Yc(s,e,t){if(typeof s!="number"||s<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let i=tn(s),r=tn(s),n=0,o=()=>{i.fill(1),r.fill(0),n=0},a=(...h)=>t(r,i,...h),c=(h=tn())=>{r=a(cc([0]),h),i=a(),h.length!==0&&(r=a(cc([1]),h),i=a())},l=()=>{if(n++>=1e3)throw new Error("drbg: tried 1000 values");let h=0,p=[];for(;h<e;){i=a();let u=i.slice();p.push(u),h+=i.length}return gi(...p)};return(h,p)=>{o(),c(h);let u;for(;!(u=p(l()));)c();return o(),u}}var od={bigint:s=>typeof s=="bigint",function:s=>typeof s=="function",boolean:s=>typeof s=="boolean",string:s=>typeof s=="string",stringOrUint8Array:s=>typeof s=="string"||as(s),isSafeInteger:s=>Number.isSafeInteger(s),array:s=>Array.isArray(s),field:(s,e)=>e.Fp.isValid(s),hash:s=>typeof s=="function"&&Number.isSafeInteger(s.outputLen)};function Rs(s,e,t={}){let i=(r,n,o)=>{let a=od[n];if(typeof a!="function")throw new Error("invalid validator function");let c=s[r];if(!(o&&c===void 0)&&!a(c,s))throw new Error("param "+String(r)+" is invalid. Expected "+n+", got "+c)};for(let[r,n]of Object.entries(e))i(r,n,!1);for(let[r,n]of Object.entries(t))i(r,n,!0);return s}var ad=()=>{throw new Error("not implemented")};function mn(s){let e=new WeakMap;return(t,...i)=>{let r=e.get(t);if(r!==void 0)return r;let n=s(t,...i);return e.set(t,n),n}}var cd=Object.freeze({__proto__:null,isBytes:as,abytes:Ii,abool:As,bytesToHex:Ss,numberToHexUnpadded:Is,hexToNumber:kn,hexToBytes:Ns,bytesToNumberBE:ns,bytesToNumberLE:di,numberToBytesBE:Ts,numberToBytesLE:gr,numberToVarBytesBE:td,ensureBytes:He,concatBytes:gi,equalBytes:sd,utf8ToBytes:id,inRange:fr,aInRange:Rt,bitLen:Gc,bitGet:rd,bitSet:nd,bitMask:Un,createHmacDrbg:Yc,validateObject:Rs,notImplemented:ad,memoized:mn}),ve=BigInt(0),le=BigInt(1),is=BigInt(2),ld=BigInt(3),yn=BigInt(4),lc=BigInt(5),hc=BigInt(8);function Le(s,e){let t=s%e;return t>=ve?t:e+t}function Jc(s,e,t){if(e<ve)throw new Error("invalid exponent, negatives unsupported");if(t<=ve)throw new Error("invalid modulus");if(t===le)return ve;let i=le;for(;e>ve;)e&le&&(i=i*s%t),s=s*s%t,e>>=le;return i}function rt(s,e,t){let i=s;for(;e-- >ve;)i*=i,i%=t;return i}function wn(s,e){if(s===ve)throw new Error("invert: expected non-zero number");if(e<=ve)throw new Error("invert: expected positive modulus, got "+e);let t=Le(s,e),i=e,r=ve,n=le;for(;t!==ve;){let o=i/t,a=i%t,c=r-n*o;i=t,t=a,r=n,n=c}if(i!==le)throw new Error("invert: does not exist");return Le(r,e)}function hd(s){let e=(s-le)/is,t,i,r;for(t=s-le,i=0;t%is===ve;t/=is,i++);for(r=is;r<s&&Jc(r,e,s)!==s-le;r++)if(r>1e3)throw new Error("Cannot find square root: likely non-prime P");if(i===1){let o=(s+le)/yn;return function(a,c){let l=a.pow(c,o);if(!a.eql(a.sqr(l),c))throw new Error("Cannot find square root");return l}}let n=(t+le)/is;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=i,l=o.pow(o.mul(o.ONE,r),t),h=o.pow(a,n),p=o.pow(a,t);for(;!o.eql(p,o.ONE);){if(o.eql(p,o.ZERO))return o.ZERO;let u=1;for(let f=o.sqr(p);u<c&&!o.eql(f,o.ONE);u++)f=o.sqr(f);let g=o.pow(l,le<<BigInt(c-u-1));l=o.sqr(g),h=o.mul(h,g),p=o.mul(p,l),c=u}return h}}function pd(s){if(s%yn===ld){let e=(s+le)/yn;return function(t,i){let r=t.pow(i,e);if(!t.eql(t.sqr(r),i))throw new Error("Cannot find square root");return r}}if(s%hc===lc){let e=(s-lc)/hc;return function(t,i){let r=t.mul(i,is),n=t.pow(r,e),o=t.mul(i,n),a=t.mul(t.mul(o,is),n),c=t.mul(o,t.sub(a,t.ONE));if(!t.eql(t.sqr(c),i))throw new Error("Cannot find square root");return c}}return hd(s)}var ud=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function dd(s){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=ud.reduce((i,r)=>(i[r]="function",i),e);return Rs(s,t)}function gd(s,e,t){if(t<ve)throw new Error("invalid exponent, negatives unsupported");if(t===ve)return s.ONE;if(t===le)return e;let i=s.ONE,r=e;for(;t>ve;)t&le&&(i=s.mul(i,r)),r=s.sqr(r),t>>=le;return i}function fd(s,e){let t=new Array(e.length),i=e.reduce((n,o,a)=>s.is0(o)?n:(t[a]=n,s.mul(n,o)),s.ONE),r=s.inv(i);return e.reduceRight((n,o,a)=>s.is0(o)?n:(t[a]=s.mul(n,t[a]),s.mul(n,o)),r),t}function Xc(s,e){let t=e!==void 0?e:s.toString(2).length,i=Math.ceil(t/8);return{nBitLength:t,nByteLength:i}}function Zc(s,e,t=!1,i={}){if(s<=ve)throw new Error("invalid field: expected ORDER > 0, got "+s);let{nBitLength:r,nByteLength:n}=Xc(s,e);if(n>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o,a=Object.freeze({ORDER:s,isLE:t,BITS:r,BYTES:n,MASK:Un(r),ZERO:ve,ONE:le,create:c=>Le(c,s),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return ve<=c&&c<s},is0:c=>c===ve,isOdd:c=>(c&le)===le,neg:c=>Le(-c,s),eql:(c,l)=>c===l,sqr:c=>Le(c*c,s),add:(c,l)=>Le(c+l,s),sub:(c,l)=>Le(c-l,s),mul:(c,l)=>Le(c*l,s),pow:(c,l)=>gd(a,c,l),div:(c,l)=>Le(c*wn(l,s),s),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>wn(c,s),sqrt:i.sqrt||(c=>(o||(o=pd(s)),o(a,c))),invertBatch:c=>fd(a,c),cmov:(c,l,h)=>h?l:c,toBytes:c=>t?gr(c,n):Ts(c,n),fromBytes:c=>{if(c.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+c.length);return t?di(c):ns(c)}});return Object.freeze(a)}function Qc(s){if(typeof s!="bigint")throw new Error("field order must be bigint");let e=s.toString(2).length;return Math.ceil(e/8)}function el(s){let e=Qc(s);return e+Math.ceil(e/2)}function md(s,e,t=!1){let i=s.length,r=Qc(e),n=el(e);if(i<16||i<n||i>1024)throw new Error("expected "+n+"-1024 bytes of input, got "+i);let o=t?di(s):ns(s),a=Le(o,e-le)+le;return t?gr(a,r):Ts(a,r)}var pc=BigInt(0),rr=BigInt(1);function sn(s,e){let t=e.negate();return s?t:e}function tl(s,e){if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+s)}function rn(s,e){tl(s,e);let t=Math.ceil(e/s)+1,i=2**(s-1);return{windows:t,windowSize:i}}function yd(s,e){if(!Array.isArray(s))throw new Error("array expected");s.forEach((t,i)=>{if(!(t instanceof e))throw new Error("invalid point at index "+i)})}function wd(s,e){if(!Array.isArray(s))throw new Error("array of scalars expected");s.forEach((t,i)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+i)})}var nn=new WeakMap,sl=new WeakMap;function on(s){return sl.get(s)||1}function vd(s,e){return{constTimeNegate:sn,hasPrecomputes(t){return on(t)!==1},unsafeLadder(t,i,r=s.ZERO){let n=t;for(;i>pc;)i&rr&&(r=r.add(n)),n=n.double(),i>>=rr;return r},precomputeWindow(t,i){let{windows:r,windowSize:n}=rn(i,e),o=[],a=t,c=a;for(let l=0;l<r;l++){c=a,o.push(c);for(let h=1;h<n;h++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(t,i,r){let{windows:n,windowSize:o}=rn(t,e),a=s.ZERO,c=s.BASE,l=BigInt(2**t-1),h=2**t,p=BigInt(t);for(let u=0;u<n;u++){let g=u*o,f=Number(r&l);r>>=p,f>o&&(f-=h,r+=rr);let m=g,d=g+Math.abs(f)-1,w=u%2!==0,y=f<0;f===0?c=c.add(sn(w,i[m])):a=a.add(sn(y,i[d]))}return{p:a,f:c}},wNAFUnsafe(t,i,r,n=s.ZERO){let{windows:o,windowSize:a}=rn(t,e),c=BigInt(2**t-1),l=2**t,h=BigInt(t);for(let p=0;p<o;p++){let u=p*a;if(r===pc)break;let g=Number(r&c);if(r>>=h,g>a&&(g-=l,r+=rr),g===0)continue;let f=i[u+Math.abs(g)-1];g<0&&(f=f.negate()),n=n.add(f)}return n},getPrecomputes(t,i,r){let n=nn.get(i);return n||(n=this.precomputeWindow(i,t),t!==1&&nn.set(i,r(n))),n},wNAFCached(t,i,r){let n=on(t);return this.wNAF(n,this.getPrecomputes(n,t,r),i)},wNAFCachedUnsafe(t,i,r,n){let o=on(t);return o===1?this.unsafeLadder(t,i,n):this.wNAFUnsafe(o,this.getPrecomputes(o,t,r),i,n)},setWindowSize(t,i){tl(i,e),sl.set(t,i),nn.delete(t)}}}function bd(s,e,t,i){if(yd(t,s),wd(i,e),t.length!==i.length)throw new Error("arrays of points and scalars must have equal length");let r=s.ZERO,n=Gc(BigInt(t.length)),o=n>12?n-3:n>4?n-2:n?2:1,a=(1<<o)-1,c=new Array(a+1).fill(r),l=Math.floor((e.BITS-1)/o)*o,h=r;for(let p=l;p>=0;p-=o){c.fill(r);for(let g=0;g<i.length;g++){let f=i[g],m=Number(f>>BigInt(p)&BigInt(a));c[m]=c[m].add(t[g])}let u=r;for(let g=c.length-1,f=r;g>0;g--)f=f.add(c[g]),u=u.add(f);if(h=h.add(u),p!==0)for(let g=0;g<o;g++)h=h.double()}return h}function il(s){return dd(s.Fp),Rs(s,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Xc(s.n,s.nBitLength),...s,p:s.Fp.ORDER})}BigInt(0),BigInt(1),BigInt(2),BigInt(8);var Es=BigInt(0),an=BigInt(1);function Ed(s){return Rs(s,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...s})}function Id(s){let e=Ed(s),{P:t}=e,i=y=>Le(y,t),r=e.montgomeryBits,n=Math.ceil(r/8),o=e.nByteLength,a=e.adjustScalarBytes||(y=>y),c=e.powPminus2||(y=>Jc(y,t-BigInt(2),t));function l(y,I,T){let R=i(y*(I-T));return I=i(I-R),T=i(T+R),[I,T]}let h=(e.a-BigInt(2))/BigInt(4);function p(y,I){Rt("u",y,Es,t),Rt("scalar",I,Es,t);let T=I,R=y,_=an,A=Es,x=y,v=an,j=Es,U;for(let B=BigInt(r-1);B>=Es;B--){let E=T>>B&an;j^=E,U=l(j,_,x),_=U[0],x=U[1],U=l(j,A,v),A=U[0],v=U[1],j=E;let N=_+A,S=i(N*N),k=_-A,D=i(k*k),P=S-D,$=x+v,M=x-v,V=i(M*N),ie=i($*k),Q=V+ie,pe=V-ie;x=i(Q*Q),v=i(R*i(pe*pe)),_=i(S*D),A=i(P*(S+i(h*P)))}U=l(j,_,x),_=U[0],x=U[1],U=l(j,A,v),A=U[0],v=U[1];let F=c(A);return i(_*F)}function u(y){return gr(i(y),n)}function g(y){let I=He("u coordinate",y,n);return o===32&&(I[31]&=127),di(I)}function f(y){let I=He("scalar",y),T=I.length;if(T!==n&&T!==o){let R=""+n+" or "+o;throw new Error("invalid scalar, expected "+R+" bytes, got "+T)}return di(a(I))}function m(y,I){let T=g(I),R=f(y),_=p(T,R);if(_===Es)throw new Error("invalid private or public key received");return u(_)}let d=u(e.Gu);function w(y){return m(y,d)}return{scalarMult:m,scalarMultBase:w,getSharedSecret:(y,I)=>m(y,I),getPublicKey:y=>w(y),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:d}}var vn=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);var Cd=BigInt(1),uc=BigInt(2),_d=BigInt(3),Pd=BigInt(5);BigInt(8);function Ad(s){let e=BigInt(10),t=BigInt(20),i=BigInt(40),r=BigInt(80),n=vn,o=s*s%n*s%n,a=rt(o,uc,n)*o%n,c=rt(a,Cd,n)*s%n,l=rt(c,Pd,n)*c%n,h=rt(l,e,n)*l%n,p=rt(h,t,n)*h%n,u=rt(p,i,n)*p%n,g=rt(u,r,n)*u%n,f=rt(g,r,n)*u%n,m=rt(f,e,n)*l%n;return{pow_p_5_8:rt(m,uc,n)*s%n,b2:o}}function Sd(s){return s[0]&=248,s[31]&=127,s[31]|=64,s}var bn=Id({P:vn,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:s=>{let e=vn,{pow_p_5_8:t,b2:i}=Ad(s);return Le(rt(t,_d,e)*i,e)},adjustScalarBytes:Sd,randomBytes:Os});function dc(s){s.lowS!==void 0&&As("lowS",s.lowS),s.prehash!==void 0&&As("prehash",s.prehash)}function Nd(s){let e=il(s);Rs(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:t,Fp:i,a:r}=e;if(t){if(!i.eql(r,i.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:Td,hexToBytes:Od}=cd,En=class extends Error{constructor(e=""){super(e)}},Tt={Err:En,_tlv:{encode:(s,e)=>{let{Err:t}=Tt;if(s<0||s>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");let i=e.length/2,r=Is(i);if(r.length/2&128)throw new t("tlv.encode: long form length too big");let n=i>127?Is(r.length/2|128):"";return Is(s)+n+r+e},decode(s,e){let{Err:t}=Tt,i=0;if(s<0||s>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[i++]!==s)throw new t("tlv.decode: wrong tlv");let r=e[i++],n=!!(r&128),o=0;if(!n)o=r;else{let c=r&127;if(!c)throw new t("tlv.decode(long): indefinite length not supported");if(c>4)throw new t("tlv.decode(long): byte length is too big");let l=e.subarray(i,i+c);if(l.length!==c)throw new t("tlv.decode: length bytes not complete");if(l[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(let h of l)o=o<<8|h;if(i+=c,o<128)throw new t("tlv.decode(long): not minimal encoding")}let a=e.subarray(i,i+o);if(a.length!==o)throw new t("tlv.decode: wrong value length");return{v:a,l:e.subarray(i+o)}}},_int:{encode(s){let{Err:e}=Tt;if(s<Ot)throw new e("integer: negative integers are not allowed");let t=Is(s);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(s){let{Err:e}=Tt;if(s[0]&128)throw new e("invalid signature integer: negative");if(s[0]===0&&!(s[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Td(s)}},toSig(s){let{Err:e,_int:t,_tlv:i}=Tt,r=typeof s=="string"?Od(s):s;Ii(r);let{v:n,l:o}=i.decode(48,r);if(o.length)throw new e("invalid signature: left bytes after parsing");let{v:a,l:c}=i.decode(2,n),{v:l,l:h}=i.decode(2,c);if(h.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(a),s:t.decode(l)}},hexFromSig(s){let{_tlv:e,_int:t}=Tt,i=e.encode(2,t.encode(s.r)),r=e.encode(2,t.encode(s.s)),n=i+r;return e.encode(48,n)}},Ot=BigInt(0),we=BigInt(1);BigInt(2);var gc=BigInt(3);BigInt(4);function Rd(s){let e=Nd(s),{Fp:t}=e,i=Zc(e.n,e.nBitLength),r=e.toBytes||((m,d,w)=>{let y=d.toAffine();return gi(Uint8Array.from([4]),t.toBytes(y.x),t.toBytes(y.y))}),n=e.fromBytes||(m=>{let d=m.subarray(1),w=t.fromBytes(d.subarray(0,t.BYTES)),y=t.fromBytes(d.subarray(t.BYTES,2*t.BYTES));return{x:w,y}});function o(m){let{a:d,b:w}=e,y=t.sqr(m),I=t.mul(y,m);return t.add(t.add(I,t.mul(m,d)),w)}if(!t.eql(t.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(m){return fr(m,we,e.n)}function c(m){let{allowedPrivateKeyLengths:d,nByteLength:w,wrapPrivateKey:y,n:I}=e;if(d&&typeof m!="bigint"){if(as(m)&&(m=Ss(m)),typeof m!="string"||!d.includes(m.length))throw new Error("invalid private key");m=m.padStart(w*2,"0")}let T;try{T=typeof m=="bigint"?m:ns(He("private key",m,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof m)}return y&&(T=Le(T,I)),Rt("private key",T,we,I),T}function l(m){if(!(m instanceof u))throw new Error("ProjectivePoint expected")}let h=mn((m,d)=>{let{px:w,py:y,pz:I}=m;if(t.eql(I,t.ONE))return{x:w,y};let T=m.is0();d==null&&(d=T?t.ONE:t.inv(I));let R=t.mul(w,d),_=t.mul(y,d),A=t.mul(I,d);if(T)return{x:t.ZERO,y:t.ZERO};if(!t.eql(A,t.ONE))throw new Error("invZ was invalid");return{x:R,y:_}}),p=mn(m=>{if(m.is0()){if(e.allowInfinityPoint&&!t.is0(m.py))return;throw new Error("bad point: ZERO")}let{x:d,y:w}=m.toAffine();if(!t.isValid(d)||!t.isValid(w))throw new Error("bad point: x or y not FE");let y=t.sqr(w),I=o(d);if(!t.eql(y,I))throw new Error("bad point: equation left != right");if(!m.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class u{constructor(d,w,y){if(this.px=d,this.py=w,this.pz=y,d==null||!t.isValid(d))throw new Error("x required");if(w==null||!t.isValid(w))throw new Error("y required");if(y==null||!t.isValid(y))throw new Error("z required");Object.freeze(this)}static fromAffine(d){let{x:w,y}=d||{};if(!d||!t.isValid(w)||!t.isValid(y))throw new Error("invalid affine point");if(d instanceof u)throw new Error("projective point not allowed");let I=T=>t.eql(T,t.ZERO);return I(w)&&I(y)?u.ZERO:new u(w,y,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(d){let w=t.invertBatch(d.map(y=>y.pz));return d.map((y,I)=>y.toAffine(w[I])).map(u.fromAffine)}static fromHex(d){let w=u.fromAffine(n(He("pointHex",d)));return w.assertValidity(),w}static fromPrivateKey(d){return u.BASE.multiply(c(d))}static msm(d,w){return bd(u,i,d,w)}_setWindowSize(d){f.setWindowSize(this,d)}assertValidity(){p(this)}hasEvenY(){let{y:d}=this.toAffine();if(t.isOdd)return!t.isOdd(d);throw new Error("Field doesn't support isOdd")}equals(d){l(d);let{px:w,py:y,pz:I}=this,{px:T,py:R,pz:_}=d,A=t.eql(t.mul(w,_),t.mul(T,I)),x=t.eql(t.mul(y,_),t.mul(R,I));return A&&x}negate(){return new u(this.px,t.neg(this.py),this.pz)}double(){let{a:d,b:w}=e,y=t.mul(w,gc),{px:I,py:T,pz:R}=this,_=t.ZERO,A=t.ZERO,x=t.ZERO,v=t.mul(I,I),j=t.mul(T,T),U=t.mul(R,R),F=t.mul(I,T);return F=t.add(F,F),x=t.mul(I,R),x=t.add(x,x),_=t.mul(d,x),A=t.mul(y,U),A=t.add(_,A),_=t.sub(j,A),A=t.add(j,A),A=t.mul(_,A),_=t.mul(F,_),x=t.mul(y,x),U=t.mul(d,U),F=t.sub(v,U),F=t.mul(d,F),F=t.add(F,x),x=t.add(v,v),v=t.add(x,v),v=t.add(v,U),v=t.mul(v,F),A=t.add(A,v),U=t.mul(T,R),U=t.add(U,U),v=t.mul(U,F),_=t.sub(_,v),x=t.mul(U,j),x=t.add(x,x),x=t.add(x,x),new u(_,A,x)}add(d){l(d);let{px:w,py:y,pz:I}=this,{px:T,py:R,pz:_}=d,A=t.ZERO,x=t.ZERO,v=t.ZERO,j=e.a,U=t.mul(e.b,gc),F=t.mul(w,T),B=t.mul(y,R),E=t.mul(I,_),N=t.add(w,y),S=t.add(T,R);N=t.mul(N,S),S=t.add(F,B),N=t.sub(N,S),S=t.add(w,I);let k=t.add(T,_);return S=t.mul(S,k),k=t.add(F,E),S=t.sub(S,k),k=t.add(y,I),A=t.add(R,_),k=t.mul(k,A),A=t.add(B,E),k=t.sub(k,A),v=t.mul(j,S),A=t.mul(U,E),v=t.add(A,v),A=t.sub(B,v),v=t.add(B,v),x=t.mul(A,v),B=t.add(F,F),B=t.add(B,F),E=t.mul(j,E),S=t.mul(U,S),B=t.add(B,E),E=t.sub(F,E),E=t.mul(j,E),S=t.add(S,E),F=t.mul(B,S),x=t.add(x,F),F=t.mul(k,S),A=t.mul(N,A),A=t.sub(A,F),F=t.mul(N,B),v=t.mul(k,v),v=t.add(v,F),new u(A,x,v)}subtract(d){return this.add(d.negate())}is0(){return this.equals(u.ZERO)}wNAF(d){return f.wNAFCached(this,d,u.normalizeZ)}multiplyUnsafe(d){let{endo:w,n:y}=e;Rt("scalar",d,Ot,y);let I=u.ZERO;if(d===Ot)return I;if(this.is0()||d===we)return this;if(!w||f.hasPrecomputes(this))return f.wNAFCachedUnsafe(this,d,u.normalizeZ);let{k1neg:T,k1:R,k2neg:_,k2:A}=w.splitScalar(d),x=I,v=I,j=this;for(;R>Ot||A>Ot;)R&we&&(x=x.add(j)),A&we&&(v=v.add(j)),j=j.double(),R>>=we,A>>=we;return T&&(x=x.negate()),_&&(v=v.negate()),v=new u(t.mul(v.px,w.beta),v.py,v.pz),x.add(v)}multiply(d){let{endo:w,n:y}=e;Rt("scalar",d,we,y);let I,T;if(w){let{k1neg:R,k1:_,k2neg:A,k2:x}=w.splitScalar(d),{p:v,f:j}=this.wNAF(_),{p:U,f:F}=this.wNAF(x);v=f.constTimeNegate(R,v),U=f.constTimeNegate(A,U),U=new u(t.mul(U.px,w.beta),U.py,U.pz),I=v.add(U),T=j.add(F)}else{let{p:R,f:_}=this.wNAF(d);I=R,T=_}return u.normalizeZ([I,T])[0]}multiplyAndAddUnsafe(d,w,y){let I=u.BASE,T=(_,A)=>A===Ot||A===we||!_.equals(I)?_.multiplyUnsafe(A):_.multiply(A),R=T(this,w).add(T(d,y));return R.is0()?void 0:R}toAffine(d){return h(this,d)}isTorsionFree(){let{h:d,isTorsionFree:w}=e;if(d===we)return!0;if(w)return w(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:d,clearCofactor:w}=e;return d===we?this:w?w(u,this):this.multiplyUnsafe(e.h)}toRawBytes(d=!0){return As("isCompressed",d),this.assertValidity(),r(u,this,d)}toHex(d=!0){return As("isCompressed",d),Ss(this.toRawBytes(d))}}u.BASE=new u(e.Gx,e.Gy,t.ONE),u.ZERO=new u(t.ZERO,t.ONE,t.ZERO);let g=e.nBitLength,f=vd(u,e.endo?Math.ceil(g/2):g);return{CURVE:e,ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function xd(s){let e=il(s);return Rs(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function kd(s){let e=xd(s),{Fp:t,n:i}=e,r=t.BYTES+1,n=2*t.BYTES+1;function o(E){return Le(E,i)}function a(E){return wn(E,i)}let{ProjectivePoint:c,normPrivateKeyToScalar:l,weierstrassEquation:h,isWithinCurveOrder:p}=Rd({...e,toBytes(E,N,S){let k=N.toAffine(),D=t.toBytes(k.x),P=gi;return As("isCompressed",S),S?P(Uint8Array.from([N.hasEvenY()?2:3]),D):P(Uint8Array.from([4]),D,t.toBytes(k.y))},fromBytes(E){let N=E.length,S=E[0],k=E.subarray(1);if(N===r&&(S===2||S===3)){let D=ns(k);if(!fr(D,we,t.ORDER))throw new Error("Point is not on curve");let P=h(D),$;try{$=t.sqrt(P)}catch(V){let ie=V instanceof Error?": "+V.message:"";throw new Error("Point is not on curve"+ie)}let M=($&we)===we;return(S&1)===1!==M&&($=t.neg($)),{x:D,y:$}}else if(N===n&&S===4){let D=t.fromBytes(k.subarray(0,t.BYTES)),P=t.fromBytes(k.subarray(t.BYTES,2*t.BYTES));return{x:D,y:P}}else{let D=r,P=n;throw new Error("invalid Point, expected length of "+D+", or uncompressed "+P+", got "+N)}}}),u=E=>Ss(Ts(E,e.nByteLength));function g(E){let N=i>>we;return E>N}function f(E){return g(E)?o(-E):E}let m=(E,N,S)=>ns(E.slice(N,S));class d{constructor(N,S,k){this.r=N,this.s=S,this.recovery=k,this.assertValidity()}static fromCompact(N){let S=e.nByteLength;return N=He("compactSignature",N,S*2),new d(m(N,0,S),m(N,S,2*S))}static fromDER(N){let{r:S,s:k}=Tt.toSig(He("DER",N));return new d(S,k)}assertValidity(){Rt("r",this.r,we,i),Rt("s",this.s,we,i)}addRecoveryBit(N){return new d(this.r,this.s,N)}recoverPublicKey(N){let{r:S,s:k,recovery:D}=this,P=_(He("msgHash",N));if(D==null||![0,1,2,3].includes(D))throw new Error("recovery id invalid");let $=D===2||D===3?S+e.n:S;if($>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");let M=(D&1)===0?"02":"03",V=c.fromHex(M+u($)),ie=a($),Q=o(-P*ie),pe=o(k*ie),ye=c.BASE.multiplyAndAddUnsafe(V,Q,pe);if(!ye)throw new Error("point at infinify");return ye.assertValidity(),ye}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new d(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Ns(this.toDERHex())}toDERHex(){return Tt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ns(this.toCompactHex())}toCompactHex(){return u(this.r)+u(this.s)}}let w={isValidPrivateKey(E){try{return l(E),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{let E=el(e.n);return md(e.randomBytes(E),e.n)},precompute(E=8,N=c.BASE){return N._setWindowSize(E),N.multiply(BigInt(3)),N}};function y(E,N=!0){return c.fromPrivateKey(E).toRawBytes(N)}function I(E){let N=as(E),S=typeof E=="string",k=(N||S)&&E.length;return N?k===r||k===n:S?k===2*r||k===2*n:E instanceof c}function T(E,N,S=!0){if(I(E))throw new Error("first arg must be private key");if(!I(N))throw new Error("second arg must be public key");return c.fromHex(N).multiply(l(E)).toRawBytes(S)}let R=e.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");let N=ns(E),S=E.length*8-e.nBitLength;return S>0?N>>BigInt(S):N},_=e.bits2int_modN||function(E){return o(R(E))},A=Un(e.nBitLength);function x(E){return Rt("num < 2^"+e.nBitLength,E,Ot,A),Ts(E,e.nByteLength)}function v(E,N,S=j){if(["recovered","canonical"].some(de=>de in S))throw new Error("sign() legacy options not supported");let{hash:k,randomBytes:D}=e,{lowS:P,prehash:$,extraEntropy:M}=S;P==null&&(P=!0),E=He("msgHash",E),dc(S),$&&(E=He("prehashed msgHash",k(E)));let V=_(E),ie=l(N),Q=[x(ie),x(V)];if(M!=null&&M!==!1){let de=M===!0?D(t.BYTES):M;Q.push(He("extraEntropy",de))}let pe=gi(...Q),ye=V;function Ne(de){let ge=R(de);if(!p(ge))return;let Xt=a(ge),_t=c.BASE.multiply(ge).toAffine(),pt=o(_t.x);if(pt===Ot)return;let Pt=o(Xt*o(ye+pt*ie));if(Pt===Ot)return;let ds=(_t.x===pt?0:2)|Number(_t.y&we),Ui=Pt;return P&&g(Pt)&&(Ui=f(Pt),ds^=1),new d(pt,Ui,ds)}return{seed:pe,k2sig:Ne}}let j={lowS:e.lowS,prehash:!1},U={lowS:e.lowS,prehash:!1};function F(E,N,S=j){let{seed:k,k2sig:D}=v(E,N,S),P=e;return Yc(P.hash.outputLen,P.nByteLength,P.hmac)(k,D)}c.BASE._setWindowSize(8);function B(E,N,S,k=U){let D=E;N=He("msgHash",N),S=He("publicKey",S);let{lowS:P,prehash:$,format:M}=k;if(dc(k),"strict"in k)throw new Error("options.strict was renamed to lowS");if(M!==void 0&&M!=="compact"&&M!=="der")throw new Error("format must be compact or der");let V=typeof D=="string"||as(D),ie=!V&&!M&&typeof D=="object"&&D!==null&&typeof D.r=="bigint"&&typeof D.s=="bigint";if(!V&&!ie)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let Q,pe;try{if(ie&&(Q=new d(D.r,D.s)),V){try{M!=="compact"&&(Q=d.fromDER(D))}catch(Pt){if(!(Pt instanceof Tt.Err))throw Pt}!Q&&M!=="der"&&(Q=d.fromCompact(D))}pe=c.fromHex(S)}catch{return!1}if(!Q||P&&Q.hasHighS())return!1;$&&(N=e.hash(N));let{r:ye,s:Ne}=Q,de=_(N),ge=a(Ne),Xt=o(de*ge),_t=o(ye*ge),pt=c.BASE.multiplyAndAddUnsafe(pe,Xt,_t)?.toAffine();return pt?o(pt.x)===ye:!1}return{CURVE:e,getPublicKey:y,getSharedSecret:T,sign:F,verify:B,ProjectivePoint:c,Signature:d,utils:w}}function Ud(s){return{hash:s,hmac:(e,...t)=>pr(s,e,Kp(...t)),randomBytes:Os}}function Dd(s,e){let t=i=>kd({...s,...Ud(i)});return{...t(e),create:t}}var rl=Zc(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),Fd=rl.create(BigInt("-3")),Ld=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),qd=Dd({a:Fd,b:Ld,Fp:rl,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},Ei),nl="base10",Oe="base16",Ke="base64pad",Ft="base64url",Ci="utf8",ol=0,at=1,xs=2,jd=0,fc=1,li=12,Dn=32;function al(){let s=bn.utils.randomPrivateKey(),e=bn.getPublicKey(s);return{privateKey:Te(s,Oe),publicKey:Te(e,Oe)}}function mr(){let s=Os(Dn);return Te(s,Oe)}function cl(s,e){let t=bn.getSharedSecret($e(s,Oe),$e(e,Oe)),i=Gu(Ei,t,void 0,void 0,Dn);return Te(i,Oe)}function ks(s){let e=Ei($e(s,Oe));return Te(e,Oe)}function Ze(s){let e=Ei($e(s,Ci));return Te(e,Oe)}function ll(s){return $e(`${s}`,nl)}function zt(s){return Number(Te(s,nl))}function hl(s){return s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function pl(s){let e=s.replace(/-/g,"+").replace(/_/g,"/"),t=(4-e.length%4)%4;return e+"=".repeat(t)}function ul(s){let e=ll(typeof s.type<"u"?s.type:ol);if(zt(e)===at&&typeof s.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let t=typeof s.senderPublicKey<"u"?$e(s.senderPublicKey,Oe):void 0,i=typeof s.iv<"u"?$e(s.iv,Oe):Os(li),r=$e(s.symKey,Oe),n=Wc(r,i).encrypt($e(s.message,Ci)),o=ml({type:e,sealed:n,iv:i,senderPublicKey:t});return s.encoding===Ft?hl(o):o}function dl(s){let e=$e(s.symKey,Oe),{sealed:t,iv:i}=Us({encoded:s.encoded,encoding:s.encoding}),r=Wc(e,i).decrypt(t);if(r===null)throw new Error("Failed to decrypt");return Te(r,Ci)}function gl(s,e){let t=ll(xs),i=Os(li),r=$e(s,Ci),n=ml({type:t,sealed:r,iv:i});return e===Ft?hl(n):n}function fl(s,e){let{sealed:t}=Us({encoded:s,encoding:e});return Te(t,Ci)}function ml(s){if(zt(s.type)===xs)return Te(fs([s.type,s.sealed]),Ke);if(zt(s.type)===at){if(typeof s.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Te(fs([s.type,s.senderPublicKey,s.iv,s.sealed]),Ke)}return Te(fs([s.type,s.iv,s.sealed]),Ke)}function Us(s){let e=(s.encoding||Ke)===Ft?pl(s.encoded):s.encoded,t=$e(e,Ke),i=t.slice(jd,fc),r=fc;if(zt(i)===at){let c=r+Dn,l=c+li,h=t.slice(r,c),p=t.slice(c,l),u=t.slice(l);return{type:i,sealed:u,iv:p,senderPublicKey:h}}if(zt(i)===xs){let c=t.slice(r),l=Os(li);return{type:i,sealed:c,iv:l}}let n=r+li,o=t.slice(r,n),a=t.slice(n);return{type:i,sealed:a,iv:o}}function yl(s,e){let t=Us({encoded:s,encoding:e?.encoding});return Fn({type:zt(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?Te(t.senderPublicKey,Oe):void 0,receiverPublicKey:e?.receiverPublicKey})}function Fn(s){let e=s?.type||ol;if(e===at){if(typeof s?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof s?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:s?.senderPublicKey,receiverPublicKey:s?.receiverPublicKey}}function Ln(s){return s.type===at&&typeof s.senderPublicKey=="string"&&typeof s.receiverPublicKey=="string"}function qn(s){return s.type===xs}function $d(s){let e=Buffer.from(s.x,"base64"),t=Buffer.from(s.y,"base64");return fs([new Uint8Array([4]),e,t])}function wl(s,e){let[t,i,r]=s.split("."),n=Buffer.from(pl(r),"base64");if(n.length!==64)throw new Error("Invalid signature length");let o=n.slice(0,32),a=n.slice(32,64),c=`${t}.${i}`,l=Ei(c),h=$d(e);if(!qd.verify(fs([o,a]),l,h))throw new Error("Invalid signature");return ii(s).payload}var Bd="irn";function _i(s){return s?.relay||{protocol:Bd}}function Ds(s){let e=ga[s];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${s}`);return e}function Md(s,e="-"){let t={},i="relay"+e;return Object.keys(s).forEach(r=>{if(r.startsWith(i)){let n=r.replace(i,""),o=s[r];t[n]=o}}),t}function jn(s){if(!s.includes("wc:")){let l=xc(s);l!=null&&l.includes("wc:")&&(s=l)}s=s.includes("wc://")?s.replace("wc://",""):s,s=s.includes("wc:")?s.replace("wc:",""):s;let e=s.indexOf(":"),t=s.indexOf("?")!==-1?s.indexOf("?"):void 0,i=s.substring(0,e),r=s.substring(e+1,t).split("@"),n=typeof t<"u"?s.substring(t):"",o=new URLSearchParams(n),a={};o.forEach((l,h)=>{a[h]=l});let c=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:i,topic:Vd(r[0]),version:parseInt(r[1],10),symKey:a.symKey,relay:Md(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Vd(s){return s.startsWith("//")?s.substring(2):s}function Hd(s,e="-"){let t="relay",i={};return Object.keys(s).forEach(r=>{let n=r,o=t+e+n;s[n]&&(i[o]=s[n])}),i}function $n(s){let e=new URLSearchParams,t=Hd(s.relay);Object.keys(t).sort().forEach(r=>{e.set(r,t[r])}),e.set("symKey",s.symKey),s.expiryTimestamp&&e.set("expiryTimestamp",s.expiryTimestamp.toString()),s.methods&&e.set("methods",s.methods.join(","));let i=e.toString();return`${s.protocol}:${s.topic}@${s.version}?${i}`}function Pi(s,e,t){return`${s}?wc_ev=${t}&topic=${e}`}var zd=Object.defineProperty,Kd=Object.defineProperties,Wd=Object.getOwnPropertyDescriptors,mc=Object.getOwnPropertySymbols,Gd=Object.prototype.hasOwnProperty,Yd=Object.prototype.propertyIsEnumerable,yc=(s,e,t)=>e in s?zd(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Jd=(s,e)=>{for(var t in e||(e={}))Gd.call(e,t)&&yc(s,t,e[t]);if(mc)for(var t of mc(e))Yd.call(e,t)&&yc(s,t,e[t]);return s},Xd=(s,e)=>Kd(s,Wd(e));function Fs(s){let e=[];return s.forEach(t=>{let[i,r]=t.split(":");e.push(`${i}:${r}`)}),e}function Zd(s){let e=[];return Object.values(s).forEach(t=>{e.push(...Fs(t.accounts))}),e}function Qd(s,e){let t=[];return Object.values(s).forEach(i=>{Fs(i.accounts).includes(e)&&t.push(...i.methods)}),t}function eg(s,e){let t=[];return Object.values(s).forEach(i=>{Fs(i.accounts).includes(e)&&t.push(...i.events)}),t}function Ai(s){return s.includes(":")}function ls(s){return Ai(s)?s.split(":")[0]:s}function wc(s){var e,t,i;let r={};if(!wt(s))return r;for(let[n,o]of Object.entries(s)){let a=Ai(n)?[n]:o.chains,c=o.methods||[],l=o.events||[],h=ls(n);r[h]=Xd(Jd({},r[h]),{chains:nt(a,(e=r[h])==null?void 0:e.chains),methods:nt(c,(t=r[h])==null?void 0:t.methods),events:nt(l,(i=r[h])==null?void 0:i.events)})}return r}function tg(s){let e={};return s?.forEach(t=>{var i;let[r,n]=t.split(":");e[r]||(e[r]={accounts:[],chains:[],events:[],methods:[]}),e[r].accounts.push(t),(i=e[r].chains)==null||i.push(`${r}:${n}`)}),e}function Bn(s,e){e=e.map(i=>i.replace("did:pkh:",""));let t=tg(e);for(let[i,r]of Object.entries(t))r.methods?r.methods=nt(r.methods,s):r.methods=s,r.events=["chainChanged","accountsChanged"];return t}function vl(s,e){var t,i,r,n,o,a;let c=wc(s),l=wc(e),h={},p=Object.keys(c).concat(Object.keys(l));for(let u of p)h[u]={chains:nt((t=c[u])==null?void 0:t.chains,(i=l[u])==null?void 0:i.chains),methods:nt((r=c[u])==null?void 0:r.methods,(n=l[u])==null?void 0:n.methods),events:nt((o=c[u])==null?void 0:o.events,(a=l[u])==null?void 0:a.events)};return h}var sg={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},ig={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function O(s,e){let{message:t,code:i}=ig[s];return{message:e?`${t} ${e}`:t,code:i}}function Z(s,e){let{message:t,code:i}=sg[s];return{message:e?`${t} ${e}`:t,code:i}}function yt(s,e){return Array.isArray(s)?typeof e<"u"&&s.length?s.every(e):!0:!1}function wt(s){return Object.getPrototypeOf(s)===Object.prototype&&Object.keys(s).length}function fe(s){return typeof s>"u"}function ce(s,e){return e&&fe(s)?!0:typeof s=="string"&&!!s.trim().length}function Mn(s,e){return e&&fe(s)?!0:typeof s=="number"&&!isNaN(s)}function bl(s,e){let{requiredNamespaces:t}=e,i=Object.keys(s.namespaces),r=Object.keys(t),n=!0;return rs(r,i)?(i.forEach(o=>{let{accounts:a,methods:c,events:l}=s.namespaces[o],h=Fs(a),p=t[o];(!rs(Ic(o,p),h)||!rs(p.methods,c)||!rs(p.events,l))&&(n=!1)}),n):!1}function or(s){return ce(s,!1)&&s.includes(":")?s.split(":").length===2:!1}function rg(s){if(ce(s,!1)&&s.includes(":")){let e=s.split(":");if(e.length===3){let t=e[0]+":"+e[1];return!!e[2]&&or(t)}}return!1}function El(s){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(ce(s,!1)){if(e(s))return!0;let t=xc(s);return e(t)}}catch{}return!1}function Il(s){var e;return(e=s?.proposer)==null?void 0:e.publicKey}function Cl(s){return s?.topic}function _l(s,e){let t=null;return ce(s?.publicKey,!1)||(t=O("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function vc(s){let e=!0;return yt(s)?s.length&&(e=s.every(t=>ce(t,!1))):e=!1,e}function ng(s,e,t){let i=null;return yt(e)&&e.length?e.forEach(r=>{i||or(r)||(i=Z("UNSUPPORTED_CHAINS",`${t}, chain ${r} should be a string and conform to "namespace:chainId" format`))}):or(s)||(i=Z("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function og(s,e,t){let i=null;return Object.entries(s).forEach(([r,n])=>{if(i)return;let o=ng(r,Ic(r,n),`${e} ${t}`);o&&(i=o)}),i}function ag(s,e){let t=null;return yt(s)?s.forEach(i=>{t||rg(i)||(t=Z("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=Z("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function cg(s,e){let t=null;return Object.values(s).forEach(i=>{if(t)return;let r=ag(i?.accounts,`${e} namespace`);r&&(t=r)}),t}function lg(s,e){let t=null;return vc(s?.methods)?vc(s?.events)||(t=Z("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=Z("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function Pl(s,e){let t=null;return Object.values(s).forEach(i=>{if(t)return;let r=lg(i,`${e}, namespace`);r&&(t=r)}),t}function Al(s,e,t){let i=null;if(s&&wt(s)){let r=Pl(s,e);r&&(i=r);let n=og(s,e,t);n&&(i=n)}else i=O("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function yr(s,e){let t=null;if(s&&wt(s)){let i=Pl(s,e);i&&(t=i);let r=cg(s,e);r&&(t=r)}else t=O("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function Vn(s){return ce(s.protocol,!0)}function Sl(s,e){let t=!1;return e&&!s?t=!0:s&&yt(s)&&s.length&&s.forEach(i=>{t=Vn(i)}),t}function Nl(s){return typeof s=="number"}function Re(s){return typeof s<"u"&&typeof s!==null}function Tl(s){return!(!s||typeof s!="object"||!s.code||!Mn(s.code,!1)||!s.message||!ce(s.message,!1))}function Ol(s){return!(fe(s)||!ce(s.method,!1))}function Rl(s){return!(fe(s)||fe(s.result)&&fe(s.error)||!Mn(s.id,!1)||!ce(s.jsonrpc,!1))}function xl(s){return!(fe(s)||!ce(s.name,!1))}function Hn(s,e){return!(!or(e)||!Zd(s).includes(e))}function kl(s,e,t){return ce(t,!1)?Qd(s,e).includes(t):!1}function Ul(s,e,t){return ce(t,!1)?eg(s,e).includes(t):!1}function zn(s,e,t){let i=null,r=hg(s),n=pg(e),o=Object.keys(r),a=Object.keys(n),c=bc(Object.keys(s)),l=bc(Object.keys(e)),h=c.filter(p=>!l.includes(p));return h.length&&(i=O("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.