diff --git a/assets/index-DBvK_T1-.js b/assets/index-BTRILIvE.js similarity index 98% rename from assets/index-DBvK_T1-.js rename to assets/index-BTRILIvE.js index 95466a3..66c44f3 100644 --- a/assets/index-DBvK_T1-.js +++ b/assets/index-BTRILIvE.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CtcyC_mc.js","assets/index-Btp85TCW.js","assets/index-BJqNCU1U.css"])))=>i.map(i=>d[i]); -import{_ as pe}from"./index-Btp85TCW.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},F=e=>typeof e=="object"&&e!==null,C=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>F(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(w,!0),l.set(o,[g,w]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(w,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(C.has(O)){const[y,H]=C.get(O);A.value=c(y,H(),I)}Object.defineProperty(w,j,A)}),Object.preventExtensions(w)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,w=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],w(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const k=r[3](A(U));y.set(U,[r,k])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&w(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),k=Reflect.get(i,a,h);if(U&&(e(k,r)||d.has(r)&&e(k,d.get(r))))return!0;Z(a),F(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(L=>{r.status="fulfilled",r.value=L,w(["resolve",[a],L])}).catch(L=>{r.status="rejected",r.reason=L,w(["reject",[a],L])});else{!C.has(r)&&s(r)&&(V=W(r));const L=!x.has(V)&&C.get(V);L&&H(a,L)}return Reflect.set(i,a,V,h),w(["set",[a],r,k]),!0}});d.set(o,R);const fe=[q,O,c,ue];return C.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,C,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=C.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=C.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},be=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:be,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(we(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),b.setChains(e.chains),b.setIsAuth(!!e.enableAuthMode),b.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),b.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Ne={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=b.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),b.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=b.state;if(m.removeWalletConnectDeepLink(),b.setWalletConnectUri(e==null?void 0:e.uri),b.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=b.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const N=P({themeMode:Ue()?"dark":"light"}),ce={state:N,subscribe(e){return D(N,()=>e(N))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(N.themeMode=t),s&&(N.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-CtcyC_mc.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),b.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,Ne as E,J as M,b as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D_ntFxfn.js","assets/index-BjDBzBW_.js","assets/index-BJqNCU1U.css"])))=>i.map(i=>d[i]); +import{_ as pe}from"./index-BjDBzBW_.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},F=e=>typeof e=="object"&&e!==null,C=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>F(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(w,!0),l.set(o,[g,w]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(w,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(C.has(O)){const[y,H]=C.get(O);A.value=c(y,H(),I)}Object.defineProperty(w,j,A)}),Object.preventExtensions(w)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,w=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],w(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const k=r[3](A(U));y.set(U,[r,k])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&w(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),k=Reflect.get(i,a,h);if(U&&(e(k,r)||d.has(r)&&e(k,d.get(r))))return!0;Z(a),F(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(L=>{r.status="fulfilled",r.value=L,w(["resolve",[a],L])}).catch(L=>{r.status="rejected",r.reason=L,w(["reject",[a],L])});else{!C.has(r)&&s(r)&&(V=W(r));const L=!x.has(V)&&C.get(V);L&&H(a,L)}return Reflect.set(i,a,V,h),w(["set",[a],r,k]),!0}});d.set(o,R);const fe=[q,O,c,ue];return C.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,C,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=C.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=C.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},be=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:be,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(we(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),b.setChains(e.chains),b.setIsAuth(!!e.enableAuthMode),b.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),b.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Ne={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=b.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),b.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=b.state;if(m.removeWalletConnectDeepLink(),b.setWalletConnectUri(e==null?void 0:e.uri),b.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=b.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const N=P({themeMode:Ue()?"dark":"light"}),ce={state:N,subscribe(e){return D(N,()=>e(N))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(N.themeMode=t),s&&(N.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-D_ntFxfn.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),b.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,Ne as E,J as M,b as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; diff --git a/assets/index-Btp85TCW.js b/assets/index-BjDBzBW_.js similarity index 97% rename from assets/index-Btp85TCW.js rename to assets/index-BjDBzBW_.js index dd4dcf0..33b597f 100644 --- a/assets/index-Btp85TCW.js +++ b/assets/index-BjDBzBW_.js @@ -58,7 +58,7 @@ Error generating stack: `+s.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ZL;function vge(){if(ZL)return nb;ZL=1;var t=qt,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,c,l){var f,u={},h=null,g=null;l!==void 0&&(h=""+l),c.key!==void 0&&(h=""+c.key),c.ref!==void 0&&(g=c.ref);for(f in c)n.call(c,f)&&!s.hasOwnProperty(f)&&(u[f]=c[f]);if(a&&a.defaultProps)for(f in c=a.defaultProps,c)u[f]===void 0&&(u[f]=c[f]);return{$$typeof:e,type:a,key:h,ref:g,props:u,_owner:i.current}}return nb.Fragment=r,nb.jsx=o,nb.jsxs=o,nb}VW.exports=vge();var Y=VW.exports;function gge(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yge(t){var e=gge(t,"string");return typeof e=="symbol"?e:String(e)}function mge(t,e,r){return e=yge(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function XL(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function eF(t){for(var e=1;e{for(var n of Object.keys(t)){var i;if(t[n]!==((i=e[n])!==null&&i!==void 0?i:r[n]))return!1}return!0},jn=t=>{var e=r=>{var n=t.defaultClassName,i=eF(eF({},t.defaultVariants),r);for(var s in i){var o,a=(o=i[s])!==null&&o!==void 0?o:t.defaultVariants[s];if(a!=null){var c=a;typeof c=="boolean"&&(c=c===!0?"true":"false");var l=t.variantClassNames[s][c];l&&(n+=" "+l)}}for(var[f,u]of t.compoundVariants)bge(f,i,t.defaultVariants)&&(n+=" "+u);return n};return e.variants=()=>Object.keys(t.variantClassNames),e.classNames={get base(){return t.defaultClassName.split(" ")[0]},get variants(){return tF(t.variantClassNames,r=>tF(r,n=>n.split(" ")[0]))}},e};jn({defaultClassName:"_2q9vfj7",variantClassNames:{variant:{info:"_2q9vfj8 _2q9vfj0 fyvr11t3",warning:"_2q9vfj9 _2q9vfj1 fyvr11t9",success:"_2q9vfja _2q9vfj2 fyvr11sr",error:"_2q9vfjb _2q9vfj3 fyvr11sx"},size:{sm:"_2q9vfjc _1qxj1ib9 _1qxj1ibf _1qxj1ib5 fyvr11r3 fyvr11ik fyvr11k4 fyvr11k0 fyvr11jc _2q9vfj4 fyvr1zc fyvr111g fyvr144 fyvr1f4",md:"_2q9vfjd _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8 _2q9vfj5 fyvr1zg fyvr111k fyvr148 fyvr1f8",lg:"_2q9vfje _1qxj1ib9 _1qxj1ibd _1qxj1ib3 fyvr11r3 fyvr11is fyvr11kc fyvr11jw fyvr11jk _2q9vfj6 fyvr1zk fyvr111o fyvr14c fyvr1fc"}},defaultVariants:{},compoundVariants:[]});const hi=t=>{const{color:e="borderNormal",marginY:r="4",...n}=t;return Y.jsx(ye,{as:"hr",marginY:r,background:e,height:"px",borderWidth:"none",...n})};var wge=jn({defaultClassName:"_1qxj1ib9",variantClassNames:{variant:{inherit:"_1qxj1iba _1qxj1ib0 fyvr11r2 fyvr11ic fyvr11ko fyvr11jo fyvr11j4",xlarge:"_1qxj1ibb _1qxj1ib1 fyvr11r3 fyvr11j0 fyvr11kk fyvr11js fyvr11jk",large:"_1qxj1ibc _1qxj1ib2 fyvr11r3 fyvr11iw fyvr11kg fyvr11jw fyvr11jg",medium:"_1qxj1ibd _1qxj1ib3 fyvr11r3 fyvr11is fyvr11kc fyvr11jw fyvr11jk",normal:"_1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8",small:"_1qxj1ibf _1qxj1ib5 fyvr11r3 fyvr11ik fyvr11k4 fyvr11k0 fyvr11jc",xsmall:"_1qxj1ibg _1qxj1ib6 fyvr11r3 fyvr11ig fyvr11k4 fyvr11k0 fyvr11jk",code:"_1qxj1ibh _1qxj1ib7 fyvr11r4 fyvr11io fyvr11k8 fyvr11js fyvr11j8"},ellipsis:{true:"_1qxj1ibi _1qxj1ib8 fyvr11q0 fyvr11qg fyvr11rh fyvr11r5"},italic:{true:"_1qxj1ibj"},underline:{true:"_1qxj1ibk"},uppercase:{true:"_1qxj1ibl"},capitalize:{true:"_1qxj1ibm"},hidden:{true:"_1qxj1ibn"}},defaultVariants:{},compoundVariants:[]});const Te=T.forwardRef((t,e)=>{const{as:r="span",variant:n="inherit",className:i,hidden:s,italic:o,underline:a,children:c,ellipsis:l,uppercase:f,capitalize:u,...h}=t,g=nge[n];return Y.jsx(ye,{as:r,className:Li(i,wge({hidden:s,ellipsis:l,italic:o,underline:a,uppercase:f,capitalize:u})),ref:e,...g,...h,children:c})});var xge=jn({defaultClassName:"_140wn8ni _140wn8n0 fyvr11q0 fyvr11qg fyvr11rh fyvr11ow fyvr12s9 fyvr11ra fyvr11l8 _4efw240",variantClassNames:{variant:{base:"_140wn8nj _140wn8n1 fyvr11sl fyvr12w9",ghost:"_140wn8nk _140wn8n2 fyvr11sl fyvr12w9",feature:"_140wn8nl _140wn8n3 fyvr11tr fyvr12sl",primary:"_140wn8nm _140wn8n4 fyvr11tl fyvr12sl",glass:"_140wn8nn _140wn8n5 fyvr11y3 fyvr12w9",emphasis:"_140wn8no _140wn8n6 fyvr11y9 fyvr12w9",raised:"_140wn8np _140wn8n7 fyvr11xx fyvr12w9",danger:"_140wn8nq _140wn8n8 fyvr11sx fyvr12sl",text:"_140wn8nr _1qxj1ib9 _1qxj1ibf _1qxj1ib5 fyvr11r3 fyvr11ik fyvr11k4 fyvr11k0 fyvr11jc _140wn8n9 fyvr11h4 fyvr11hs fyvr11fs fyvr11gg fyvr11sl fyvr12wl"},shape:{circle:"_140wn8ns _140wn8na fyvr11hk fyvr11i8 fyvr11g8 fyvr11gw",square:"_140wn8nt _140wn8nb fyvr11h8 fyvr11hw fyvr11fw fyvr11gk"},disabled:{true:"_140wn8nu _140wn8nc fyvr12z9 fyvr12zx",false:"_140wn8nv _140wn8nd fyvr12zf fyvr1309 fyvr1307"},size:{xs:"_140wn8nw _1qxj1ib9 _1qxj1ibg _1qxj1ib6 fyvr11r3 fyvr11ig fyvr11k4 fyvr11k0 fyvr11jk _140wn8ne fyvr1zg fyvr111k",sm:"_140wn8nx _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8 _140wn8nf fyvr1zk fyvr111o",md:"_140wn8ny _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8 _140wn8ng fyvr1zo fyvr111s",lg:"_140wn8nz _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8 _140wn8nh fyvr1zo fyvr111s"},iconOnly:{true:"_140wn8n10"},hasLeftIcon:{true:"_140wn8n11"},hasRightIcon:{true:"_140wn8n12"},activeOutline:{light:"_140wn8n13",bold:"_140wn8n14"}},defaultVariants:{},compoundVariants:[[{iconOnly:!0,size:"xs"},"_140wn8n15"],[{iconOnly:!0,size:"sm"},"_140wn8n16"],[{iconOnly:!0,size:"md"},"_140wn8n17"],[{iconOnly:!0,size:"lg"},"_140wn8n18"],[{iconOnly:!1,hasLeftIcon:!0,size:"xs"},"_140wn8n19"],[{iconOnly:!1,hasLeftIcon:!0,size:"sm"},"_140wn8n1a"],[{iconOnly:!1,hasLeftIcon:!0,size:"md"},"_140wn8n1b"],[{iconOnly:!1,hasRightIcon:!0,size:"xs"},"_140wn8n1c"],[{iconOnly:!1,hasRightIcon:!0,size:"sm"},"_140wn8n1d"],[{iconOnly:!1,hasRightIcon:!0,size:"md"},"_140wn8n1e"]]});const Kt=T.forwardRef((t,e)=>{const{as:r="button",activeOutline:n,className:i,disabled:s=!1,display:o="inline-flex",fontWeight:a="bold",pending:c=!1,label:l,leftIcon:f,rightIcon:u,size:h="md",variant:g="glass",width:y="fit",shape:m="circle",type:S="button",...E}=t,A=f!==void 0&&l!==void 0,P=u!==void 0&&l!==void 0,N=f!==void 0&&l===void 0,L=h==="xs"?"xs":"sm";return Y.jsx(ye,{as:r,className:Li(i,xge({activeOutline:n,disabled:s||c,hasLeftIcon:A,hasRightIcon:P,iconOnly:N,size:g==="text"?void 0:h,shape:g==="text"?void 0:m,variant:g})),disabled:s||c,display:o,fontWeight:a,ref:e,type:S,width:y,...E,children:N?Y.jsx(f,{size:L}):Y.jsxs(ye,{width:"full",height:"full",justifyContent:"space-between",alignItems:"center",gap:h==="xs"?"1":"2",children:[Y.jsxs(ye,{justifyContent:"flex-start",alignItems:"center",gap:h==="xs"?"1":"2",children:[f&&Y.jsx(f,{size:L}),Y.jsx(Te,{children:l})]}),u&&Y.jsx(u,{size:L})]})})});var Ege=jn({defaultClassName:"rhmai63",variantClassNames:{clickable:{true:"rhmai64 rhmai60 fyvr11ec fyvr11eo fyvr11f0 fyvr11fc fyvr1307 fyvr12zf _4efw240"},disabled:{true:"rhmai65"},outlined:{true:"rhmai66 rhmai61 fyvr11eg fyvr11es fyvr11f4 fyvr11fg fyvr12rf fyvr12k3 fyvr125f fyvr12cr fyvr12rr fyvr12kf fyvr125r fyvr12d3"},blur:{true:"rhmai67 rhmai62 fyvr11r0"}},defaultVariants:{},compoundVariants:[]});const vn=T.forwardRef((t,e)=>{const{className:r,children:n,clickable:i,outlined:s,disabled:o,blur:a,width:c="full",...l}=t;return Y.jsx(ye,{className:Li(r,Ege({clickable:i,outlined:s,disabled:o,blur:a})),background:s?"transparent":"backgroundSecondary",overflow:"hidden",borderRadius:"md",padding:"4",width:c,ref:e,...l,children:n})});function Cge(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function V8(...t){return e=>t.forEach(r=>Cge(r,e))}function Rr(...t){return T.useCallback(V8(...t),t)}function Age(t,e){const r=T.createContext(e);function n(s){const{children:o,...a}=s,c=T.useMemo(()=>a,Object.values(a));return Y.jsx(r.Provider,{value:c,children:o})}function i(s){const o=T.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return n.displayName=t+"Provider",[n,i]}function Us(t,e=[]){let r=[];function n(s,o){const a=T.createContext(o),c=r.length;r=[...r,o];function l(u){const{scope:h,children:g,...y}=u,m=(h==null?void 0:h[t][c])||a,S=T.useMemo(()=>y,Object.values(y));return Y.jsx(m.Provider,{value:S,children:g})}function f(u,h){const g=(h==null?void 0:h[t][c])||a,y=T.useContext(g);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return l.displayName=s+"Provider",[l,f]}const i=()=>{const s=r.map(o=>T.createContext(o));return function(a){const c=(a==null?void 0:a[t])||s;return T.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return i.scopeName=t,[n,Sge(i,...e)]}function Sge(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:l})=>{const u=c(s)[`__scope${l}`];return{...a,...u}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function nt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Fs(t){const e=T.useRef(t);return T.useEffect(()=>{e.current=t}),T.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function sc({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,i]=_ge({defaultProp:e,onChange:r}),s=t!==void 0,o=s?t:n,a=Fs(r),c=T.useCallback(l=>{if(s){const u=typeof l=="function"?l(t):l;u!==t&&a(u)}else i(l)},[s,t,i,a]);return[o,c]}function _ge({defaultProp:t,onChange:e}){const r=T.useState(t),[n]=r,i=T.useRef(n),s=Fs(e);return T.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}function z8(t){const e=T.useRef({value:t,previous:t});return T.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var cs=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{};function H8(t){const[e,r]=T.useState(void 0);return cs(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const c=s.borderBoxSize,l=Array.isArray(c)?c[0]:c;o=l.inlineSize,a=l.blockSize}else o=t.offsetWidth,a=t.offsetHeight;r({width:o,height:a})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}function Ige(t,e){return T.useReducer((r,n)=>e[r][n]??r,t)}var lo=t=>{const{present:e,children:r}=t,n=Tge(e),i=typeof r=="function"?r({present:n.isPresent}):T.Children.only(r),s=Rr(n.ref,Pge(i));return typeof r=="function"||n.isPresent?T.cloneElement(i,{ref:s}):null};lo.displayName="Presence";function Tge(t){const[e,r]=T.useState(),n=T.useRef({}),i=T.useRef(t),s=T.useRef("none"),o=t?"mounted":"unmounted",[a,c]=Ige(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const l=F3(n.current);s.current=a==="mounted"?l:"none"},[a]),cs(()=>{const l=n.current,f=i.current;if(f!==t){const h=s.current,g=F3(l);t?c("MOUNT"):g==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(f&&h!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),cs(()=>{if(e){const l=u=>{const g=F3(n.current).includes(u.animationName);u.target===e&&g&&ff.flushSync(()=>c("ANIMATION_END"))},f=u=>{u.target===e&&(s.current=F3(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",l),e.addEventListener("animationend",l),()=>{e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",l),e.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:T.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function F3(t){return(t==null?void 0:t.animationName)||"none"}function Pge(t){var e,r;let n=(e=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:e.get,i=n&&"isReactWarning"in n&&n.isReactWarning;return i?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,i=n&&"isReactWarning"in n&&n.isReactWarning,i?t.props.ref:t.props.ref||t.ref)}var G1=T.forwardRef((t,e)=>{const{children:r,...n}=t,i=T.Children.toArray(r),s=i.find(kge);if(s){const o=s.props.children,a=i.map(c=>c===s?T.Children.count(o)>1?T.Children.only(null):T.isValidElement(o)?o.props.children:null:c);return Y.jsx(k_,{...n,ref:e,children:T.isValidElement(o)?T.cloneElement(o,void 0,a):null})}return Y.jsx(k_,{...n,ref:e,children:r})});G1.displayName="Slot";var k_=T.forwardRef((t,e)=>{const{children:r,...n}=t;if(T.isValidElement(r)){const i=Mge(r);return T.cloneElement(r,{...Rge(n,r.props),ref:e?V8(e,i):i})}return T.Children.count(r)>1?T.Children.only(null):null});k_.displayName="SlotClone";var zW=({children:t})=>Y.jsx(Y.Fragment,{children:t});function kge(t){return T.isValidElement(t)&&t.type===zW}function Rge(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{s(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function Mge(t){var e,r;let n=(e=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:e.get,i=n&&"isReactWarning"in n&&n.isReactWarning;return i?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,i=n&&"isReactWarning"in n&&n.isReactWarning,i?t.props.ref:t.props.ref||t.ref)}var Oge=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],jt=Oge.reduce((t,e)=>{const r=T.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?G1:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),Y.jsx(a,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Ek(t,e){t&&ff.flushSync(()=>t.dispatchEvent(e))}var Ck="Checkbox",[Dge,hGe]=Us(Ck),[Nge,Bge]=Dge(Ck),HW=T.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:l,...f}=t,[u,h]=T.useState(null),g=Rr(e,P=>h(P)),y=T.useRef(!1),m=u?!!u.closest("form"):!0,[S=!1,E]=sc({prop:i,defaultProp:s,onChange:l}),A=T.useRef(S);return T.useEffect(()=>{const P=u==null?void 0:u.form;if(P){const N=()=>E(A.current);return P.addEventListener("reset",N),()=>P.removeEventListener("reset",N)}},[u,E]),Y.jsxs(Nge,{scope:r,state:S,disabled:a,children:[Y.jsx(jt.button,{type:"button",role:"checkbox","aria-checked":R1(S)?"mixed":S,"aria-required":o,"data-state":KW(S),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:g,onKeyDown:nt(t.onKeyDown,P=>{P.key==="Enter"&&P.preventDefault()}),onClick:nt(t.onClick,P=>{E(N=>R1(N)?!0:!N),m&&(y.current=P.isPropagationStopped(),y.current||P.stopPropagation())})}),m&&Y.jsx(Lge,{control:u,bubbles:!y.current,name:n,value:c,checked:S,required:o,disabled:a,style:{transform:"translateX(-100%)"}})]})});HW.displayName=Ck;var GW="CheckboxIndicator",WW=T.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...i}=t,s=Bge(GW,r);return Y.jsx(lo,{present:n||R1(s.state)||s.state===!0,children:Y.jsx(jt.span,{"data-state":KW(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});WW.displayName=GW;var Lge=t=>{const{control:e,checked:r,bubbles:n=!0,...i}=t,s=T.useRef(null),o=z8(r),a=H8(e);return T.useEffect(()=>{const c=s.current,l=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(l,"checked").set;if(o!==r&&u){const h=new Event("click",{bubbles:n});c.indeterminate=R1(r),u.call(c,R1(r)?!1:r),c.dispatchEvent(h)}},[o,r,n]),Y.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:R1(r)?!1:r,...i,tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function R1(t){return t==="indeterminate"}function KW(t){return R1(t)?"indeterminate":t?"checked":"unchecked"}var Fge=HW,jge=WW,Uge=jn({defaultClassName:"_43lu9r4",variantClassNames:{labelLocation:{top:"_43lu9r5 _43lu9r0 fyvr11p4 fyvr11mc fyvr11ck fyvr11l8",left:"_43lu9r6 _43lu9r1 fyvr11ow fyvr11mk fyvr11ck fyvr11l8",right:"_43lu9r7 _43lu9r2 fyvr11ow fyvr11mk fyvr11ck fyvr11l8",hidden:"_43lu9r8 _43lu9r3 fyvr11c8 fyvr11l8"}},defaultVariants:{},compoundVariants:[]});const Ky=t=>{const{id:e,label:r,description:n,labelLocation:i="top",children:s,...o}=t,a=()=>r||n?Y.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[r&&Y.jsx(Te,{variant:"small",color:"text100",hidden:i==="hidden",children:r}),n&&Y.jsx(Te,{variant:"small",color:"text50",hidden:i==="hidden",children:n})]}):null;return Y.jsxs(ye,{as:"label",className:Uge({labelLocation:i}),htmlFor:e,...o,children:[["left","top","hidden"].includes(i)&&a(),s,i==="right"&&a()]})};var uf=jn({defaultClassName:"_1dizidw0",variantClassNames:{size:{xs:"_1dizidw1",sm:"_1dizidw2",md:"_1dizidw3",lg:"_1dizidw4",xl:"_1dizidw5"}},defaultVariants:{},compoundVariants:[]});const $ge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.168 9.25V2.929h-1.5V9.25h-6.32v1.5h6.32v6.321h1.5V10.75h6.321v-1.5h-6.32Z",clipRule:"evenodd"})}),$w=({size:t="sm",...e})=>Y.jsx(ye,{as:$ge,className:uf({size:t}),...e}),qge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{stroke:"currentColor",strokeWidth:1.5,d:"m4.304 10.232 4.263 4.79 7.13-11.238"})}),qw=({size:t="sm",...e})=>Y.jsx(ye,{as:qge,className:uf({size:t}),...e}),Vge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m3.888 7.53 1.06-1.06 5.47 5.47 5.47-5.47 1.06 1.06-6.53 6.53-6.53-6.53Z",clipRule:"evenodd"})}),Ak=({size:t="sm",...e})=>Y.jsx(ye,{as:Vge,className:uf({size:t}),...e}),zge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m12.888 3.47 1.06 1.06L8.48 10l5.47 5.47-1.061 1.06L6.358 10l6.53-6.53Z",clipRule:"evenodd"})}),YW=({size:t="sm",...e})=>Y.jsx(ye,{as:zge,className:uf({size:t}),...e}),Hge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.418 11.06 4.47 4.47 1.06-1.06L11.48 10l4.47-4.47-1.06-1.06-4.47 4.47-4.47-4.47-1.06 1.06L9.357 10l-4.47 4.47 1.06 1.06 4.47-4.47Z",clipRule:"evenodd"})}),Tu=({size:t="sm",...e})=>Y.jsx(ye,{as:Hge,className:uf({size:t}),...e}),Gge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.918 4.5h-6V6h4.5v6.5h1.5v-8Zm-1.5 9.5v3h-9V6h3V3h9v11h-3Zm-7.5 1.5v-8h6v8h-6Z",clipRule:"evenodd"})}),QW=({size:t="sm",...e})=>Y.jsx(ye,{as:Gge,className:uf({size:t}),...e}),Wge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.608 6.75h-5.19v-1.5h7.75V13h-1.5V7.81l-7.72 7.72-1.06-1.06 7.72-7.72Z",clipRule:"evenodd"})}),G8=({size:t="sm",...e})=>Y.jsx(ye,{as:Wge,className:uf({size:t}),...e}),Kge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.918 9.5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm-.677 4.383a5.5 5.5 0 1 1 1.06-1.06l2.648 2.647-1.061 1.06-2.647-2.647Z",clipRule:"evenodd"})}),Yge=({size:t="sm",...e})=>Y.jsx(ye,{as:Kge,className:uf({size:t}),...e}),Qge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.418 3.25h-5.75v13.5h5.75v-1.5h-4.25V4.75h4.25v-1.5Zm4.53 11.28-1.06-1.06 2.72-2.72h-8.19v-1.5h8.19l-2.72-2.72 1.06-1.06L18.48 10l-4.53 4.53Z",clipRule:"evenodd"})}),Jge=({size:t="sm",...e})=>Y.jsx(ye,{as:Qge,className:uf({size:t}),...e}),Zge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 6.05c0 .443.39.802.87.802H17V16H5.495C4.117 16 3 14.97 3 13.698V6.302C3 5.031 4.117 4 5.495 4H14.5v1.247H5.87c-.48 0-.87.36-.87.802Zm7 5.45a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0Z",clipRule:"evenodd"})}),Xge=({size:t="sm",...e})=>Y.jsx(ye,{as:Zge,className:uf({size:t}),...e});var eye=jn({defaultClassName:"_1c9x66f1 _1c9x66f0 fyvr11eg fyvr11es fyvr11f4 fyvr11fg fyvr11h4 fyvr11hs fyvr11fs fyvr11gg fyvr12rl fyvr12k9 fyvr125l fyvr12cx fyvr12rr fyvr12kf fyvr125r fyvr12d3 fyvr11l8 fyvr11ow fyvr11no fyvr11sl fyvr1309 fyvr1307 fyvr12zz fyvr12zf fyvr12zb _4efw240",variantClassNames:{size:{sm:"_1c9x66f2",lg:"_1c9x66f3"}},defaultVariants:{},compoundVariants:[]}),tye="_1c9x66f4 fyvr12w9 fyvr11l8 fyvr11ow fyvr11no fyvr12g fyvr164";const rye=({size:t="sm"})=>Y.jsx(jge,{className:tye,children:Y.jsx(qw,{size:t==="lg"?"sm":"xs"})});T.forwardRef((t,e)=>{const{disabled:r=!1,id:n,name:i,label:s="",labelLocation:o="left",size:a="sm",...c}=t;return Y.jsx(Ky,{disabled:r,display:"flex",id:n??i,label:s,labelLocation:o,whiteSpace:"nowrap",children:Y.jsx(Fge,{className:eye({size:a}),disabled:r,id:n??i,name:i,ref:e,...c,children:Y.jsx(rye,{size:a})})})});qt.createContext(null);var nye=JT.useId||(()=>{}),iye=0;function ec(t){const[e,r]=T.useState(nye());return cs(()=>{t||r(n=>n??String(iye++))},[t]),t||(e?`radix-${e}`:"")}var Sk="Collapsible",[sye,oye]=Us(Sk),[aye,_k]=sye(Sk),Ik=T.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[c=!1,l]=sc({prop:n,defaultProp:i,onChange:o});return Y.jsx(aye,{scope:r,disabled:s,contentId:ec(),open:c,onOpenToggle:T.useCallback(()=>l(f=>!f),[l]),children:Y.jsx(jt.div,{"data-state":Rk(c),"data-disabled":s?"":void 0,...a,ref:e})})});Ik.displayName=Sk;var JW="CollapsibleTrigger",Tk=T.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,i=_k(JW,r);return Y.jsx(jt.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Rk(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...n,ref:e,onClick:nt(t.onClick,i.onOpenToggle)})});Tk.displayName=JW;var Pk="CollapsibleContent",kk=T.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=_k(Pk,t.__scopeCollapsible);return Y.jsx(lo,{present:r||i.open,children:({present:s})=>Y.jsx(cye,{...n,ref:e,present:s})})});kk.displayName=Pk;var cye=T.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:i,...s}=t,o=_k(Pk,r),[a,c]=T.useState(n),l=T.useRef(null),f=Rr(e,l),u=T.useRef(0),h=u.current,g=T.useRef(0),y=g.current,m=o.open||a,S=T.useRef(m),E=T.useRef();return T.useEffect(()=>{const A=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(A)},[]),cs(()=>{const A=l.current;if(A){E.current=E.current||{transitionDuration:A.style.transitionDuration,animationName:A.style.animationName},A.style.transitionDuration="0s",A.style.animationName="none";const P=A.getBoundingClientRect();u.current=P.height,g.current=P.width,S.current||(A.style.transitionDuration=E.current.transitionDuration,A.style.animationName=E.current.animationName),c(n)}},[o.open,n]),Y.jsx(jt.div,{"data-state":Rk(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...s,ref:f,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:m&&i})});function Rk(t){return t?"open":"closed"}var ZW=Ik,XW=Tk,eK=kk;const B9=Object.freeze(Object.defineProperty({__proto__:null,Collapsible:Ik,CollapsibleContent:kk,CollapsibleTrigger:Tk,Content:eK,Root:ZW,Trigger:XW,createCollapsibleScope:oye},Symbol.toStringTag,{value:"Module"}));var rF="64px",lye="_4j62fl0",fye="_4j62fl2 _4j62fl1 fyvr11hc fyvr11i0 fyvr11g0 fyvr11go fyvr1vc fyvr1xg fyvr1zk fyvr111o fyvr11l8 fyvr11ow fyvr11sl fyvr12g fyvr12zf fyvr11rc _4efw240",uye="_4j62fl4 _4j62fl3 fyvr1zk fyvr111o fyvr1uw fyvr1xg fyvr12g",dye="_4j62fl5";const tK=t=>{const{className:e,children:r,defaultOpen:n,open:i,onOpenChange:s,label:o,...a}=t,[c,l]=T.useState(n),f=i??c,u=g=>{i===void 0&&l(g)},h=g=>{u(g),s==null||s(g)};return Y.jsx(ZW,{open:f,defaultOpen:n,onOpenChange:h,asChild:!0,children:Y.jsxs(ye,{as:k1.div,className:Li(e,lye),initial:{height:f?"auto":rF},animate:{height:f?"auto":rF},transition:{ease:"easeOut",duration:.3},borderRadius:"md",background:"backgroundSecondary",position:"relative",overflow:"hidden",width:"full",...a,children:[Y.jsxs(XW,{className:fye,children:[Y.jsx(Te,{as:"div",variant:"normal",fontWeight:"bold",color:"text80",children:o}),Y.jsx(ye,{as:k1.div,position:"absolute",right:"0",marginRight:"4",initial:{rotate:f?180:0},animate:{rotate:f?180:0},transition:{ease:"linear",duration:.1},children:Y.jsx(Ak,{className:dye,color:"text50"})})]}),Y.jsx(LW,{children:f&&Y.jsx(eK,{className:uye,asChild:!0,forceMount:!0,children:Y.jsx(k1.div,{initial:{opacity:f?1:0},animate:{opacity:1},exit:{opacity:0},transition:{ease:"easeOut",duration:.3},children:r})})})]})})};function W8(t){const e=t+"CollectionProvider",[r,n]=Us(e),[i,s]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:y,children:m}=g,S=qt.useRef(null),E=qt.useRef(new Map).current;return Y.jsx(i,{scope:y,itemMap:E,collectionRef:S,children:m})};o.displayName=e;const a=t+"CollectionSlot",c=qt.forwardRef((g,y)=>{const{scope:m,children:S}=g,E=s(a,m),A=Rr(y,E.collectionRef);return Y.jsx(G1,{ref:A,children:S})});c.displayName=a;const l=t+"CollectionItemSlot",f="data-radix-collection-item",u=qt.forwardRef((g,y)=>{const{scope:m,children:S,...E}=g,A=qt.useRef(null),P=Rr(y,A),N=s(l,m);return qt.useEffect(()=>(N.itemMap.set(A,{ref:A,...E}),()=>void N.itemMap.delete(A))),Y.jsx(G1,{[f]:"",ref:P,children:S})});u.displayName=l;function h(g){const y=s(t+"CollectionConsumer",g);return qt.useCallback(()=>{const S=y.collectionRef.current;if(!S)return[];const E=Array.from(S.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((N,L)=>E.indexOf(N.ref.current)-E.indexOf(L.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:c,ItemSlot:u},h,n]}var hye=T.createContext(void 0);function Vw(t){const e=T.useContext(hye);return t||e||"ltr"}function pye(t,e=globalThis==null?void 0:globalThis.document){const r=Fs(t);T.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var vye="DismissableLayer",R_="dismissableLayer.update",gye="dismissableLayer.pointerDownOutside",yye="dismissableLayer.focusOutside",nF,rK=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Yy=T.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=t,l=T.useContext(rK),[f,u]=T.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=T.useState({}),y=Rr(e,I=>u(I)),m=Array.from(l.layers),[S]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),E=m.indexOf(S),A=f?m.indexOf(f):-1,P=l.layersWithOutsidePointerEventsDisabled.size>0,N=A>=E,L=bye(I=>{const U=I.target,ie=[...l.branches].some(ae=>ae.contains(U));!N||ie||(i==null||i(I),o==null||o(I),I.defaultPrevented||a==null||a())},h),V=wye(I=>{const U=I.target;[...l.branches].some(ae=>ae.contains(U))||(s==null||s(I),o==null||o(I),I.defaultPrevented||a==null||a())},h);return pye(I=>{A===l.layers.size-1&&(n==null||n(I),!I.defaultPrevented&&a&&(I.preventDefault(),a()))},h),T.useEffect(()=>{if(f)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(nF=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),iF(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=nF)}},[f,h,r,l]),T.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),iF())},[f,l]),T.useEffect(()=>{const I=()=>g({});return document.addEventListener(R_,I),()=>document.removeEventListener(R_,I)},[]),Y.jsx(jt.div,{...c,ref:y,style:{pointerEvents:P?N?"auto":"none":void 0,...t.style},onFocusCapture:nt(t.onFocusCapture,V.onFocusCapture),onBlurCapture:nt(t.onBlurCapture,V.onBlurCapture),onPointerDownCapture:nt(t.onPointerDownCapture,L.onPointerDownCapture)})});Yy.displayName=vye;var mye="DismissableLayerBranch",nK=T.forwardRef((t,e)=>{const r=T.useContext(rK),n=T.useRef(null),i=Rr(e,n);return T.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),Y.jsx(jt.div,{...t,ref:i})});nK.displayName=mye;function bye(t,e=globalThis==null?void 0:globalThis.document){const r=Fs(t),n=T.useRef(!1),i=T.useRef(()=>{});return T.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){iK(gye,r,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function wye(t,e=globalThis==null?void 0:globalThis.document){const r=Fs(t),n=T.useRef(!1);return T.useEffect(()=>{const i=s=>{s.target&&!n.current&&iK(yye,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function iF(){const t=new CustomEvent(R_);document.dispatchEvent(t)}function iK(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?Ek(i,s):i.dispatchEvent(s)}var xye=Yy,Eye=nK,L9=0;function Mk(){T.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??sF()),document.body.insertAdjacentElement("beforeend",t[1]??sF()),L9++,()=>{L9===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),L9--}},[])}function sF(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}var F9="focusScope.autoFocusOnMount",j9="focusScope.autoFocusOnUnmount",oF={bubbles:!1,cancelable:!0},Cye="FocusScope",K8=T.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,c]=T.useState(null),l=Fs(i),f=Fs(s),u=T.useRef(null),h=Rr(e,m=>c(m)),g=T.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;T.useEffect(()=>{if(n){let m=function(P){if(g.paused||!a)return;const N=P.target;a.contains(N)?u.current=N:wd(u.current,{select:!0})},S=function(P){if(g.paused||!a)return;const N=P.relatedTarget;N!==null&&(a.contains(N)||wd(u.current,{select:!0}))},E=function(P){if(document.activeElement===document.body)for(const L of P)L.removedNodes.length>0&&wd(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",S);const A=new MutationObserver(E);return a&&A.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",S),A.disconnect()}}},[n,a,g.paused]),T.useEffect(()=>{if(a){cF.add(g);const m=document.activeElement;if(!a.contains(m)){const E=new CustomEvent(F9,oF);a.addEventListener(F9,l),a.dispatchEvent(E),E.defaultPrevented||(Aye(Pye(sK(a)),{select:!0}),document.activeElement===m&&wd(a))}return()=>{a.removeEventListener(F9,l),setTimeout(()=>{const E=new CustomEvent(j9,oF);a.addEventListener(j9,f),a.dispatchEvent(E),E.defaultPrevented||wd(m??document.body,{select:!0}),a.removeEventListener(j9,f),cF.remove(g)},0)}}},[a,l,f,g]);const y=T.useCallback(m=>{if(!r&&!n||g.paused)return;const S=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,E=document.activeElement;if(S&&E){const A=m.currentTarget,[P,N]=Sye(A);P&&N?!m.shiftKey&&E===N?(m.preventDefault(),r&&wd(P,{select:!0})):m.shiftKey&&E===P&&(m.preventDefault(),r&&wd(N,{select:!0})):E===A&&m.preventDefault()}},[r,n,g.paused]);return Y.jsx(jt.div,{tabIndex:-1,...o,ref:h,onKeyDown:y})});K8.displayName=Cye;function Aye(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(wd(n,{select:e}),document.activeElement!==r)return}function Sye(t){const e=sK(t),r=aF(e,t),n=aF(e.reverse(),t);return[r,n]}function sK(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function aF(t,e){for(const r of t)if(!_ye(r,{upTo:e}))return r}function _ye(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Iye(t){return t instanceof HTMLInputElement&&"select"in t}function wd(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Iye(t)&&e&&t.select()}}var cF=Tye();function Tye(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=lF(t,e),t.unshift(e)},remove(e){var r;t=lF(t,e),(r=t[0])==null||r.resume()}}}function lF(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Pye(t){return t.filter(e=>e.tagName!=="A")}const kye=["top","right","bottom","left"],jl=Math.min,na=Math.max,f4=Math.round,j3=Math.floor,Ah=t=>({x:t,y:t}),Rye={left:"right",right:"left",bottom:"top",top:"bottom"},Mye={start:"end",end:"start"};function M_(t,e,r){return na(t,jl(e,r))}function Pu(t,e){return typeof t=="function"?t(e):t}function ku(t){return t.split("-")[0]}function Qy(t){return t.split("-")[1]}function Ok(t){return t==="x"?"y":"x"}function Dk(t){return t==="y"?"height":"width"}function Sh(t){return["top","bottom"].includes(ku(t))?"y":"x"}function Nk(t){return Ok(Sh(t))}function Oye(t,e,r){r===void 0&&(r=!1);const n=Qy(t),i=Nk(t),s=Dk(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=u4(o)),[o,u4(o)]}function Dye(t){const e=u4(t);return[O_(t),e,O_(e)]}function O_(t){return t.replace(/start|end/g,e=>Mye[e])}function Nye(t,e,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return r?e?i:n:e?n:i;case"left":case"right":return e?s:o;default:return[]}}function Bye(t,e,r,n){const i=Qy(t);let s=Nye(ku(t),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(O_)))),s}function u4(t){return t.replace(/left|right|bottom|top/g,e=>Rye[e])}function Lye(t){return{top:0,right:0,bottom:0,left:0,...t}}function oK(t){return typeof t!="number"?Lye(t):{top:t,right:t,bottom:t,left:t}}function d4(t){const{x:e,y:r,width:n,height:i}=t;return{width:n,height:i,top:r,left:e,right:e+n,bottom:r+i,x:e,y:r}}function fF(t,e,r){let{reference:n,floating:i}=t;const s=Sh(e),o=Nk(e),a=Dk(o),c=ku(e),l=s==="y",f=n.x+n.width/2-i.width/2,u=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2;let g;switch(c){case"top":g={x:f,y:n.y-i.height};break;case"bottom":g={x:f,y:n.y+n.height};break;case"right":g={x:n.x+n.width,y:u};break;case"left":g={x:n.x-i.width,y:u};break;default:g={x:n.x,y:n.y}}switch(Qy(e)){case"start":g[o]-=h*(r&&l?-1:1);break;case"end":g[o]+=h*(r&&l?-1:1);break}return g}const Fye=async(t,e,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=fF(l,n,c),h=n,g={},y=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:c}=e,{element:l,padding:f=0}=Pu(t,e)||{};if(l==null)return{};const u=oK(f),h={x:r,y:n},g=Nk(i),y=Dk(g),m=await o.getDimensions(l),S=g==="y",E=S?"top":"left",A=S?"bottom":"right",P=S?"clientHeight":"clientWidth",N=s.reference[y]+s.reference[g]-h[g]-s.floating[y],L=h[g]-s.reference[g],V=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let I=V?V[P]:0;(!I||!await(o.isElement==null?void 0:o.isElement(V)))&&(I=a.floating[P]||s.floating[y]);const U=N/2-L/2,ie=I/2-m[y]/2-1,ae=jl(u[E],ie),K=jl(u[A],ie),R=ae,D=I-m[y]-K,v=I/2-m[y]/2+U,b=M_(R,v,D),M=!c.arrow&&Qy(i)!=null&&v!==b&&s.reference[y]/2-(vv<=0)){var K,R;const v=(((K=s.flip)==null?void 0:K.index)||0)+1,b=I[v];if(b)return{data:{index:v,overflows:ae},reset:{placement:b}};let M=(R=ae.filter(B=>B.overflows[0]<=0).sort((B,x)=>B.overflows[1]-x.overflows[1])[0])==null?void 0:R.placement;if(!M)switch(g){case"bestFit":{var D;const B=(D=ae.filter(x=>{if(V){const C=Sh(x.placement);return C===A||C==="y"}return!0}).map(x=>[x.placement,x.overflows.filter(C=>C>0).reduce((C,w)=>C+w,0)]).sort((x,C)=>x[1]-C[1])[0])==null?void 0:D[0];B&&(M=B);break}case"initialPlacement":M=a;break}if(i!==M)return{reset:{placement:M}}}return{}}}};function uF(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function dF(t){return kye.some(e=>t[e]>=0)}const $ye=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...i}=Pu(t,e);switch(n){case"referenceHidden":{const s=await V2(e,{...i,elementContext:"reference"}),o=uF(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:dF(o)}}}case"escaped":{const s=await V2(e,{...i,altBoundary:!0}),o=uF(s,r.floating);return{data:{escapedOffsets:o,escaped:dF(o)}}}default:return{}}}}};async function qye(t,e){const{placement:r,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=ku(r),a=Qy(r),c=Sh(r)==="y",l=["left","top"].includes(o)?-1:1,f=s&&c?-1:1,u=Pu(e,t);let{mainAxis:h,crossAxis:g,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return a&&typeof y=="number"&&(g=a==="end"?y*-1:y),c?{x:g*f,y:h*l}:{x:h*l,y:g*f}}const Vye=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:i,y:s,placement:o,middlewareData:a}=e,c=await qye(e,t);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},zye=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:S=>{let{x:E,y:A}=S;return{x:E,y:A}}},...c}=Pu(t,e),l={x:r,y:n},f=await V2(e,c),u=Sh(ku(i)),h=Ok(u);let g=l[h],y=l[u];if(s){const S=h==="y"?"top":"left",E=h==="y"?"bottom":"right",A=g+f[S],P=g-f[E];g=M_(A,g,P)}if(o){const S=u==="y"?"top":"left",E=u==="y"?"bottom":"right",A=y+f[S],P=y-f[E];y=M_(A,y,P)}const m=a.fn({...e,[h]:g,[u]:y});return{...m,data:{x:m.x-r,y:m.y-n}}}}},Hye=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=Pu(t,e),f={x:r,y:n},u=Sh(i),h=Ok(u);let g=f[h],y=f[u];const m=Pu(a,e),S=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const P=h==="y"?"height":"width",N=s.reference[h]-s.floating[P]+S.mainAxis,L=s.reference[h]+s.reference[P]-S.mainAxis;gL&&(g=L)}if(l){var E,A;const P=h==="y"?"width":"height",N=["top","left"].includes(ku(i)),L=s.reference[u]-s.floating[P]+(N&&((E=o.offset)==null?void 0:E[u])||0)+(N?0:S.crossAxis),V=s.reference[u]+s.reference[P]+(N?0:((A=o.offset)==null?void 0:A[u])||0)-(N?S.crossAxis:0);yV&&(y=V)}return{[h]:g,[u]:y}}}},Gye=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:r,rects:n,platform:i,elements:s}=e,{apply:o=()=>{},...a}=Pu(t,e),c=await V2(e,a),l=ku(r),f=Qy(r),u=Sh(r)==="y",{width:h,height:g}=n.floating;let y,m;l==="top"||l==="bottom"?(y=l,m=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(m=l,y=f==="end"?"top":"bottom");const S=g-c.top-c.bottom,E=h-c.left-c.right,A=jl(g-c[y],S),P=jl(h-c[m],E),N=!e.middlewareData.shift;let L=A,V=P;if(u?V=f||N?jl(P,E):E:L=f||N?jl(A,S):S,N&&!f){const U=na(c.left,0),ie=na(c.right,0),ae=na(c.top,0),K=na(c.bottom,0);u?V=h-2*(U!==0||ie!==0?U+ie:na(c.left,c.right)):L=g-2*(ae!==0||K!==0?ae+K:na(c.top,c.bottom))}await o({...e,availableWidth:V,availableHeight:L});const I=await i.getDimensions(s.floating);return h!==I.width||g!==I.height?{reset:{rects:!0}}:{}}}};function Jy(t){return aK(t)?(t.nodeName||"").toLowerCase():"#document"}function ua(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Vu(t){var e;return(e=(aK(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function aK(t){return t instanceof Node||t instanceof ua(t).Node}function Xl(t){return t instanceof Element||t instanceof ua(t).Element}function ef(t){return t instanceof HTMLElement||t instanceof ua(t).HTMLElement}function hF(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ua(t).ShadowRoot}function zw(t){const{overflow:e,overflowX:r,overflowY:n,display:i}=Kc(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(i)}function Wye(t){return["table","td","th"].includes(Jy(t))}function Y8(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Bk(t){const e=Lk(),r=Kc(t);return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function Kye(t){let e=_h(t);for(;ef(e)&&!Ey(e);){if(Y8(e))return null;if(Bk(e))return e;e=_h(e)}return null}function Lk(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ey(t){return["html","body","#document"].includes(Jy(t))}function Kc(t){return ua(t).getComputedStyle(t)}function Q8(t){return Xl(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function _h(t){if(Jy(t)==="html")return t;const e=t.assignedSlot||t.parentNode||hF(t)&&t.host||Vu(t);return hF(e)?e.host:e}function cK(t){const e=_h(t);return Ey(e)?t.ownerDocument?t.ownerDocument.body:t.body:ef(e)&&zw(e)?e:cK(e)}function z2(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const i=cK(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),o=ua(i);return s?e.concat(o,o.visualViewport||[],zw(i)?i:[],o.frameElement&&r?z2(o.frameElement):[]):e.concat(i,z2(i,[],r))}function lK(t){const e=Kc(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=ef(t),s=i?t.offsetWidth:r,o=i?t.offsetHeight:n,a=f4(r)!==s||f4(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function Fk(t){return Xl(t)?t:t.contextElement}function ng(t){const e=Fk(t);if(!ef(e))return Ah(1);const r=e.getBoundingClientRect(),{width:n,height:i,$:s}=lK(e);let o=(s?f4(r.width):r.width)/n,a=(s?f4(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Yye=Ah(0);function fK(t){const e=ua(t);return!Lk()||!e.visualViewport?Yye:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Qye(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==ua(t)?!1:e}function W1(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const i=t.getBoundingClientRect(),s=Fk(t);let o=Ah(1);e&&(n?Xl(n)&&(o=ng(n)):o=ng(t));const a=Qye(s,r,n)?fK(s):Ah(0);let c=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,f=i.width/o.x,u=i.height/o.y;if(s){const h=ua(s),g=n&&Xl(n)?ua(n):n;let y=h,m=y.frameElement;for(;m&&n&&g!==y;){const S=ng(m),E=m.getBoundingClientRect(),A=Kc(m),P=E.left+(m.clientLeft+parseFloat(A.paddingLeft))*S.x,N=E.top+(m.clientTop+parseFloat(A.paddingTop))*S.y;c*=S.x,l*=S.y,f*=S.x,u*=S.y,c+=P,l+=N,y=ua(m),m=y.frameElement}}return d4({width:f,height:u,x:c,y:l})}function Jye(t){let{elements:e,rect:r,offsetParent:n,strategy:i}=t;const s=i==="fixed",o=Vu(n),a=e?Y8(e.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},l=Ah(1);const f=Ah(0),u=ef(n);if((u||!u&&!s)&&((Jy(n)!=="body"||zw(o))&&(c=Q8(n)),ef(n))){const h=W1(n);l=ng(n),f.x=h.x+n.clientLeft,f.y=h.y+n.clientTop}return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+f.x,y:r.y*l.y-c.scrollTop*l.y+f.y}}function Zye(t){return Array.from(t.getClientRects())}function uK(t){return W1(Vu(t)).left+Q8(t).scrollLeft}function Xye(t){const e=Vu(t),r=Q8(t),n=t.ownerDocument.body,i=na(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=na(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+uK(t);const a=-r.scrollTop;return Kc(n).direction==="rtl"&&(o+=na(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function eme(t,e){const r=ua(t),n=Vu(t),i=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,c=0;if(i){s=i.width,o=i.height;const l=Lk();(!l||l&&e==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function tme(t,e){const r=W1(t,!0,e==="fixed"),n=r.top+t.clientTop,i=r.left+t.clientLeft,s=ef(t)?ng(t):Ah(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,c=i*s.x,l=n*s.y;return{width:o,height:a,x:c,y:l}}function pF(t,e,r){let n;if(e==="viewport")n=eme(t,r);else if(e==="document")n=Xye(Vu(t));else if(Xl(e))n=tme(e,r);else{const i=fK(t);n={...e,x:e.x-i.x,y:e.y-i.y}}return d4(n)}function dK(t,e){const r=_h(t);return r===e||!Xl(r)||Ey(r)?!1:Kc(r).position==="fixed"||dK(r,e)}function rme(t,e){const r=e.get(t);if(r)return r;let n=z2(t,[],!1).filter(a=>Xl(a)&&Jy(a)!=="body"),i=null;const s=Kc(t).position==="fixed";let o=s?_h(t):t;for(;Xl(o)&&!Ey(o);){const a=Kc(o),c=Bk(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||zw(o)&&!c&&dK(t,o))?n=n.filter(f=>f!==o):i=a,o=_h(o)}return e.set(t,n),n}function nme(t){let{element:e,boundary:r,rootBoundary:n,strategy:i}=t;const o=[...r==="clippingAncestors"?Y8(e)?[]:rme(e,this._c):[].concat(r),n],a=o[0],c=o.reduce((l,f)=>{const u=pF(e,f,i);return l.top=na(u.top,l.top),l.right=jl(u.right,l.right),l.bottom=jl(u.bottom,l.bottom),l.left=na(u.left,l.left),l},pF(e,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function ime(t){const{width:e,height:r}=lK(t);return{width:e,height:r}}function sme(t,e,r){const n=ef(e),i=Vu(e),s=r==="fixed",o=W1(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const c=Ah(0);if(n||!n&&!s)if((Jy(e)!=="body"||zw(i))&&(a=Q8(e)),n){const u=W1(e,!0,s,e);c.x=u.x+e.clientLeft,c.y=u.y+e.clientTop}else i&&(c.x=uK(i));const l=o.left+a.scrollLeft-c.x,f=o.top+a.scrollTop-c.y;return{x:l,y:f,width:o.width,height:o.height}}function U9(t){return Kc(t).position==="static"}function vF(t,e){return!ef(t)||Kc(t).position==="fixed"?null:e?e(t):t.offsetParent}function hK(t,e){const r=ua(t);if(Y8(t))return r;if(!ef(t)){let i=_h(t);for(;i&&!Ey(i);){if(Xl(i)&&!U9(i))return i;i=_h(i)}return r}let n=vF(t,e);for(;n&&Wye(n)&&U9(n);)n=vF(n,e);return n&&Ey(n)&&U9(n)&&!Bk(n)?r:n||Kye(t)||r}const ome=async function(t){const e=this.getOffsetParent||hK,r=this.getDimensions,n=await r(t.floating);return{reference:sme(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ame(t){return Kc(t).direction==="rtl"}const cme={convertOffsetParentRelativeRectToViewportRelativeRect:Jye,getDocumentElement:Vu,getClippingRect:nme,getOffsetParent:hK,getElementRects:ome,getClientRects:Zye,getDimensions:ime,getScale:ng,isElement:Xl,isRTL:ame};function lme(t,e){let r=null,n;const i=Vu(t);function s(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const{left:l,top:f,width:u,height:h}=t.getBoundingClientRect();if(a||e(),!u||!h)return;const g=j3(f),y=j3(i.clientWidth-(l+u)),m=j3(i.clientHeight-(f+h)),S=j3(l),A={rootMargin:-g+"px "+-y+"px "+-m+"px "+-S+"px",threshold:na(0,jl(1,c))||1};let P=!0;function N(L){const V=L[0].intersectionRatio;if(V!==c){if(!P)return o();V?o(!1,V):n=setTimeout(()=>{o(!1,1e-7)},1e3)}P=!1}try{r=new IntersectionObserver(N,{...A,root:i.ownerDocument})}catch{r=new IntersectionObserver(N,A)}r.observe(t)}return o(!0),s}function fme(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,l=Fk(t),f=i||s?[...l?z2(l):[],...z2(e)]:[];f.forEach(E=>{i&&E.addEventListener("scroll",r,{passive:!0}),s&&E.addEventListener("resize",r)});const u=l&&a?lme(l,r):null;let h=-1,g=null;o&&(g=new ResizeObserver(E=>{let[A]=E;A&&A.target===l&&g&&(g.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var P;(P=g)==null||P.observe(e)})),r()}),l&&!c&&g.observe(l),g.observe(e));let y,m=c?W1(t):null;c&&S();function S(){const E=W1(t);m&&(E.x!==m.x||E.y!==m.y||E.width!==m.width||E.height!==m.height)&&r(),m=E,y=requestAnimationFrame(S)}return r(),()=>{var E;f.forEach(A=>{i&&A.removeEventListener("scroll",r),s&&A.removeEventListener("resize",r)}),u==null||u(),(E=g)==null||E.disconnect(),g=null,c&&cancelAnimationFrame(y)}}const ume=Vye,dme=zye,hme=Uye,pme=Gye,vme=$ye,gF=jye,gme=Hye,yme=(t,e,r)=>{const n=new Map,i={platform:cme,...r},s={...i.platform,_c:n};return Fye(t,e,{...i,platform:s})};var q6=typeof document<"u"?T.useLayoutEffect:T.useEffect;function h4(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!h4(t[n],e[n]))return!1;return!0}if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&t.$$typeof)&&!h4(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function pK(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function yF(t,e){const r=pK(t);return Math.round(e*r)/r}function mF(t){const e=T.useRef(t);return q6(()=>{e.current=t}),e}function mme(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:c,open:l}=t,[f,u]=T.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[h,g]=T.useState(n);h4(h,n)||g(n);const[y,m]=T.useState(null),[S,E]=T.useState(null),A=T.useCallback(B=>{B!==V.current&&(V.current=B,m(B))},[]),P=T.useCallback(B=>{B!==I.current&&(I.current=B,E(B))},[]),N=s||y,L=o||S,V=T.useRef(null),I=T.useRef(null),U=T.useRef(f),ie=c!=null,ae=mF(c),K=mF(i),R=T.useCallback(()=>{if(!V.current||!I.current)return;const B={placement:e,strategy:r,middleware:h};K.current&&(B.platform=K.current),yme(V.current,I.current,B).then(x=>{const C={...x,isPositioned:!0};D.current&&!h4(U.current,C)&&(U.current=C,ff.flushSync(()=>{u(C)}))})},[h,e,r,K]);q6(()=>{l===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,u(B=>({...B,isPositioned:!1})))},[l]);const D=T.useRef(!1);q6(()=>(D.current=!0,()=>{D.current=!1}),[]),q6(()=>{if(N&&(V.current=N),L&&(I.current=L),N&&L){if(ae.current)return ae.current(N,L,R);R()}},[N,L,R,ae,ie]);const v=T.useMemo(()=>({reference:V,floating:I,setReference:A,setFloating:P}),[A,P]),b=T.useMemo(()=>({reference:N,floating:L}),[N,L]),M=T.useMemo(()=>{const B={position:r,left:0,top:0};if(!b.floating)return B;const x=yF(b.floating,f.x),C=yF(b.floating,f.y);return a?{...B,transform:"translate("+x+"px, "+C+"px)",...pK(b.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:x,top:C}},[r,a,b.floating,f.x,f.y]);return T.useMemo(()=>({...f,update:R,refs:v,elements:b,floatingStyles:M}),[f,R,v,b,M])}const bme=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:i}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?gF({element:n.current,padding:i}).fn(r):{}:n?gF({element:n,padding:i}).fn(r):{}}}},wme=(t,e)=>({...ume(t),options:[t,e]}),xme=(t,e)=>({...dme(t),options:[t,e]}),Eme=(t,e)=>({...gme(t),options:[t,e]}),Cme=(t,e)=>({...hme(t),options:[t,e]}),Ame=(t,e)=>({...pme(t),options:[t,e]}),Sme=(t,e)=>({...vme(t),options:[t,e]}),_me=(t,e)=>({...bme(t),options:[t,e]});var Ime="Arrow",vK=T.forwardRef((t,e)=>{const{children:r,width:n=10,height:i=5,...s}=t;return Y.jsx(jt.svg,{...s,ref:e,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:Y.jsx("polygon",{points:"0,0 30,0 15,10"})})});vK.displayName=Ime;var Tme=vK,jk="Popper",[gK,Zy]=Us(jk),[Pme,yK]=gK(jk),mK=t=>{const{__scopePopper:e,children:r}=t,[n,i]=T.useState(null);return Y.jsx(Pme,{scope:e,anchor:n,onAnchorChange:i,children:r})};mK.displayName=jk;var bK="PopperAnchor",wK=T.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...i}=t,s=yK(bK,r),o=T.useRef(null),a=Rr(e,o);return T.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:Y.jsx(jt.div,{...i,ref:a})});wK.displayName=bK;var Uk="PopperContent",[kme,Rme]=gK(Uk),xK=T.forwardRef((t,e)=>{var r,n,i,s,o,a;const{__scopePopper:c,side:l="bottom",sideOffset:f=0,align:u="center",alignOffset:h=0,arrowPadding:g=0,avoidCollisions:y=!0,collisionBoundary:m=[],collisionPadding:S=0,sticky:E="partial",hideWhenDetached:A=!1,updatePositionStrategy:P="optimized",onPlaced:N,...L}=t,V=yK(Uk,c),[I,U]=T.useState(null),ie=Rr(e,xe=>U(xe)),[ae,K]=T.useState(null),R=H8(ae),D=(R==null?void 0:R.width)??0,v=(R==null?void 0:R.height)??0,b=l+(u!=="center"?"-"+u:""),M=typeof S=="number"?S:{top:0,right:0,bottom:0,left:0,...S},B=Array.isArray(m)?m:[m],x=B.length>0,C={padding:M,boundary:B.filter(Ome),altBoundary:x},{refs:w,floatingStyles:k,placement:O,isPositioned:G,middlewareData:oe}=mme({strategy:"fixed",placement:b,whileElementsMounted:(...xe)=>fme(...xe,{animationFrame:P==="always"}),elements:{reference:V.anchor},middleware:[wme({mainAxis:f+v,alignmentAxis:h}),y&&xme({mainAxis:!0,crossAxis:!1,limiter:E==="partial"?Eme():void 0,...C}),y&&Cme({...C}),Ame({...C,apply:({elements:xe,rects:_e,availableWidth:Me,availableHeight:Ke})=>{const{width:ze,height:Je}=_e.reference,Xe=xe.floating.style;Xe.setProperty("--radix-popper-available-width",`${Me}px`),Xe.setProperty("--radix-popper-available-height",`${Ke}px`),Xe.setProperty("--radix-popper-anchor-width",`${ze}px`),Xe.setProperty("--radix-popper-anchor-height",`${Je}px`)}}),ae&&_me({element:ae,padding:g}),Dme({arrowWidth:D,arrowHeight:v}),A&&Sme({strategy:"referenceHidden",...C})]}),[$,X]=AK(O),W=Fs(N);cs(()=>{G&&(W==null||W())},[G,W]);const Z=(r=oe.arrow)==null?void 0:r.x,te=(n=oe.arrow)==null?void 0:n.y,F=((i=oe.arrow)==null?void 0:i.centerOffset)!==0,[ee,fe]=T.useState();return cs(()=>{I&&fe(window.getComputedStyle(I).zIndex)},[I]),Y.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...k,transform:G?k.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(s=oe.transformOrigin)==null?void 0:s.x,(o=oe.transformOrigin)==null?void 0:o.y].join(" "),...((a=oe.hide)==null?void 0:a.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:Y.jsx(kme,{scope:c,placedSide:$,onArrowChange:K,arrowX:Z,arrowY:te,shouldHideArrow:F,children:Y.jsx(jt.div,{"data-side":$,"data-align":X,...L,ref:ie,style:{...L.style,animation:G?void 0:"none"}})})})});xK.displayName=Uk;var EK="PopperArrow",Mme={top:"bottom",right:"left",bottom:"top",left:"right"},CK=T.forwardRef(function(e,r){const{__scopePopper:n,...i}=e,s=Rme(EK,n),o=Mme[s.placedSide];return Y.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:Y.jsx(Tme,{...i,ref:r,style:{...i.style,display:"block"}})})});CK.displayName=EK;function Ome(t){return t!==null}var Dme=t=>({name:"transformOrigin",options:t,fn(e){var r,n,i;const{placement:s,rects:o,middlewareData:a}=e,l=((r=a.arrow)==null?void 0:r.centerOffset)!==0,f=l?0:t.arrowWidth,u=l?0:t.arrowHeight,[h,g]=AK(s),y={start:"0%",center:"50%",end:"100%"}[g],m=(((n=a.arrow)==null?void 0:n.x)??0)+f/2,S=(((i=a.arrow)==null?void 0:i.y)??0)+u/2;let E="",A="";return h==="bottom"?(E=l?y:`${m}px`,A=`${-u}px`):h==="top"?(E=l?y:`${m}px`,A=`${o.floating.height+u}px`):h==="right"?(E=`${-u}px`,A=l?y:`${S}px`):h==="left"&&(E=`${o.floating.width+u}px`,A=l?y:`${S}px`),{data:{x:E,y:A}}}});function AK(t){const[e,r="center"]=t.split("-");return[e,r]}var $k=mK,qk=wK,Vk=xK,zk=CK,Nme="Portal",Hw=T.forwardRef((t,e)=>{var r;const{container:n,...i}=t,[s,o]=T.useState(!1);cs(()=>o(!0),[]);const a=n||s&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return a?fG.createPortal(Y.jsx(jt.div,{...i,ref:e}),a):null});Hw.displayName=Nme;var $9="rovingFocusGroup.onEntryFocus",Bme={bubbles:!1,cancelable:!0},J8="RovingFocusGroup",[D_,SK,Lme]=W8(J8),[Fme,Xy]=Us(J8,[Lme]),[jme,Ume]=Fme(J8),_K=T.forwardRef((t,e)=>Y.jsx(D_.Provider,{scope:t.__scopeRovingFocusGroup,children:Y.jsx(D_.Slot,{scope:t.__scopeRovingFocusGroup,children:Y.jsx($me,{...t,ref:e})})}));_K.displayName=J8;var $me=T.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:f=!1,...u}=t,h=T.useRef(null),g=Rr(e,h),y=Vw(s),[m=null,S]=sc({prop:o,defaultProp:a,onChange:c}),[E,A]=T.useState(!1),P=Fs(l),N=SK(r),L=T.useRef(!1),[V,I]=T.useState(0);return T.useEffect(()=>{const U=h.current;if(U)return U.addEventListener($9,P),()=>U.removeEventListener($9,P)},[P]),Y.jsx(jme,{scope:r,orientation:n,dir:y,loop:i,currentTabStopId:m,onItemFocus:T.useCallback(U=>S(U),[S]),onItemShiftTab:T.useCallback(()=>A(!0),[]),onFocusableItemAdd:T.useCallback(()=>I(U=>U+1),[]),onFocusableItemRemove:T.useCallback(()=>I(U=>U-1),[]),children:Y.jsx(jt.div,{tabIndex:E||V===0?-1:0,"data-orientation":n,...u,ref:g,style:{outline:"none",...t.style},onMouseDown:nt(t.onMouseDown,()=>{L.current=!0}),onFocus:nt(t.onFocus,U=>{const ie=!L.current;if(U.target===U.currentTarget&&ie&&!E){const ae=new CustomEvent($9,Bme);if(U.currentTarget.dispatchEvent(ae),!ae.defaultPrevented){const K=N().filter(M=>M.focusable),R=K.find(M=>M.active),D=K.find(M=>M.id===m),b=[R,D,...K].filter(Boolean).map(M=>M.ref.current);PK(b,f)}}L.current=!1}),onBlur:nt(t.onBlur,()=>A(!1))})})}),IK="RovingFocusGroupItem",TK=T.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=t,a=ec(),c=s||a,l=Ume(IK,r),f=l.currentTabStopId===c,u=SK(r),{onFocusableItemAdd:h,onFocusableItemRemove:g}=l;return T.useEffect(()=>{if(n)return h(),()=>g()},[n,h,g]),Y.jsx(D_.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:Y.jsx(jt.span,{tabIndex:f?0:-1,"data-orientation":l.orientation,...o,ref:e,onMouseDown:nt(t.onMouseDown,y=>{n?l.onItemFocus(c):y.preventDefault()}),onFocus:nt(t.onFocus,()=>l.onItemFocus(c)),onKeyDown:nt(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){l.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const m=zme(y,l.orientation,l.dir);if(m!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let E=u().filter(A=>A.focusable).map(A=>A.ref.current);if(m==="last")E.reverse();else if(m==="prev"||m==="next"){m==="prev"&&E.reverse();const A=E.indexOf(y.currentTarget);E=l.loop?Hme(E,A+1):E.slice(A+1)}setTimeout(()=>PK(E))}})})})});TK.displayName=IK;var qme={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Vme(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function zme(t,e,r){const n=Vme(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return qme[n]}function PK(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function Hme(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var Hk=_K,Gk=TK,Gme=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rv=new WeakMap,U3=new WeakMap,$3={},q9=0,kK=function(t){return t&&(t.host||kK(t.parentNode))},Wme=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=kK(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},Kme=function(t,e,r,n){var i=Wme(e,Array.isArray(t)?t:[t]);$3[r]||($3[r]=new WeakMap);var s=$3[r],o=[],a=new Set,c=new Set(i),l=function(u){!u||a.has(u)||(a.add(u),l(u.parentNode))};i.forEach(l);var f=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(a.has(h))f(h);else try{var g=h.getAttribute(n),y=g!==null&&g!=="false",m=(rv.get(h)||0)+1,S=(s.get(h)||0)+1;rv.set(h,m),s.set(h,S),o.push(h),m===1&&y&&U3.set(h,!0),S===1&&h.setAttribute(r,"true"),y||h.setAttribute(n,"true")}catch(E){console.error("aria-hidden: cannot operate on ",h,E)}})};return f(e),a.clear(),q9++,function(){o.forEach(function(u){var h=rv.get(u)-1,g=s.get(u)-1;rv.set(u,h),s.set(u,g),h||(U3.has(u)||u.removeAttribute(n),U3.delete(u)),g||u.removeAttribute(r)}),q9--,q9||(rv=new WeakMap,rv=new WeakMap,U3=new WeakMap,$3={})}},Wk=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=Gme(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),Kme(n,i,r,"aria-hidden")):function(){return null}},Dl=function(){return Dl=Object.assign||function(e){for(var r,n=1,i=arguments.length;n"u")return ube;var e=dbe(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},pbe=DK(),ig="data-scroll-locked",vbe=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),` + */var ZL;function vge(){if(ZL)return nb;ZL=1;var t=qt,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,c,l){var f,u={},h=null,g=null;l!==void 0&&(h=""+l),c.key!==void 0&&(h=""+c.key),c.ref!==void 0&&(g=c.ref);for(f in c)n.call(c,f)&&!s.hasOwnProperty(f)&&(u[f]=c[f]);if(a&&a.defaultProps)for(f in c=a.defaultProps,c)u[f]===void 0&&(u[f]=c[f]);return{$$typeof:e,type:a,key:h,ref:g,props:u,_owner:i.current}}return nb.Fragment=r,nb.jsx=o,nb.jsxs=o,nb}VW.exports=vge();var Y=VW.exports;function gge(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yge(t){var e=gge(t,"string");return typeof e=="symbol"?e:String(e)}function mge(t,e,r){return e=yge(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function XL(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function eF(t){for(var e=1;e{for(var n of Object.keys(t)){var i;if(t[n]!==((i=e[n])!==null&&i!==void 0?i:r[n]))return!1}return!0},jn=t=>{var e=r=>{var n=t.defaultClassName,i=eF(eF({},t.defaultVariants),r);for(var s in i){var o,a=(o=i[s])!==null&&o!==void 0?o:t.defaultVariants[s];if(a!=null){var c=a;typeof c=="boolean"&&(c=c===!0?"true":"false");var l=t.variantClassNames[s][c];l&&(n+=" "+l)}}for(var[f,u]of t.compoundVariants)bge(f,i,t.defaultVariants)&&(n+=" "+u);return n};return e.variants=()=>Object.keys(t.variantClassNames),e.classNames={get base(){return t.defaultClassName.split(" ")[0]},get variants(){return tF(t.variantClassNames,r=>tF(r,n=>n.split(" ")[0]))}},e};jn({defaultClassName:"_2q9vfj7",variantClassNames:{variant:{info:"_2q9vfj8 _2q9vfj0 fyvr11t3",warning:"_2q9vfj9 _2q9vfj1 fyvr11t9",success:"_2q9vfja _2q9vfj2 fyvr11sr",error:"_2q9vfjb _2q9vfj3 fyvr11sx"},size:{sm:"_2q9vfjc _1qxj1ib9 _1qxj1ibf _1qxj1ib5 fyvr11r3 fyvr11ik fyvr11k4 fyvr11k0 fyvr11jc _2q9vfj4 fyvr1zc fyvr111g fyvr144 fyvr1f4",md:"_2q9vfjd _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8 _2q9vfj5 fyvr1zg fyvr111k fyvr148 fyvr1f8",lg:"_2q9vfje _1qxj1ib9 _1qxj1ibd _1qxj1ib3 fyvr11r3 fyvr11is fyvr11kc fyvr11jw fyvr11jk _2q9vfj6 fyvr1zk fyvr111o fyvr14c fyvr1fc"}},defaultVariants:{},compoundVariants:[]});const hi=t=>{const{color:e="borderNormal",marginY:r="4",...n}=t;return Y.jsx(ye,{as:"hr",marginY:r,background:e,height:"px",borderWidth:"none",...n})};var wge=jn({defaultClassName:"_1qxj1ib9",variantClassNames:{variant:{inherit:"_1qxj1iba _1qxj1ib0 fyvr11r2 fyvr11ic fyvr11ko fyvr11jo fyvr11j4",xlarge:"_1qxj1ibb _1qxj1ib1 fyvr11r3 fyvr11j0 fyvr11kk fyvr11js fyvr11jk",large:"_1qxj1ibc _1qxj1ib2 fyvr11r3 fyvr11iw fyvr11kg fyvr11jw fyvr11jg",medium:"_1qxj1ibd _1qxj1ib3 fyvr11r3 fyvr11is fyvr11kc fyvr11jw fyvr11jk",normal:"_1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8",small:"_1qxj1ibf _1qxj1ib5 fyvr11r3 fyvr11ik fyvr11k4 fyvr11k0 fyvr11jc",xsmall:"_1qxj1ibg _1qxj1ib6 fyvr11r3 fyvr11ig fyvr11k4 fyvr11k0 fyvr11jk",code:"_1qxj1ibh _1qxj1ib7 fyvr11r4 fyvr11io fyvr11k8 fyvr11js fyvr11j8"},ellipsis:{true:"_1qxj1ibi _1qxj1ib8 fyvr11q0 fyvr11qg fyvr11rh fyvr11r5"},italic:{true:"_1qxj1ibj"},underline:{true:"_1qxj1ibk"},uppercase:{true:"_1qxj1ibl"},capitalize:{true:"_1qxj1ibm"},hidden:{true:"_1qxj1ibn"}},defaultVariants:{},compoundVariants:[]});const Te=T.forwardRef((t,e)=>{const{as:r="span",variant:n="inherit",className:i,hidden:s,italic:o,underline:a,children:c,ellipsis:l,uppercase:f,capitalize:u,...h}=t,g=nge[n];return Y.jsx(ye,{as:r,className:Li(i,wge({hidden:s,ellipsis:l,italic:o,underline:a,uppercase:f,capitalize:u})),ref:e,...g,...h,children:c})});var xge=jn({defaultClassName:"_140wn8ni _140wn8n0 fyvr11q0 fyvr11qg fyvr11rh fyvr11ow fyvr12s9 fyvr11ra fyvr11l8 _4efw240",variantClassNames:{variant:{base:"_140wn8nj _140wn8n1 fyvr11sl fyvr12w9",ghost:"_140wn8nk _140wn8n2 fyvr11sl fyvr12w9",feature:"_140wn8nl _140wn8n3 fyvr11tr fyvr12sl",primary:"_140wn8nm _140wn8n4 fyvr11tl fyvr12sl",glass:"_140wn8nn _140wn8n5 fyvr11y3 fyvr12w9",emphasis:"_140wn8no _140wn8n6 fyvr11y9 fyvr12w9",raised:"_140wn8np _140wn8n7 fyvr11xx fyvr12w9",danger:"_140wn8nq _140wn8n8 fyvr11sx fyvr12sl",text:"_140wn8nr _1qxj1ib9 _1qxj1ibf _1qxj1ib5 fyvr11r3 fyvr11ik fyvr11k4 fyvr11k0 fyvr11jc _140wn8n9 fyvr11h4 fyvr11hs fyvr11fs fyvr11gg fyvr11sl fyvr12wl"},shape:{circle:"_140wn8ns _140wn8na fyvr11hk fyvr11i8 fyvr11g8 fyvr11gw",square:"_140wn8nt _140wn8nb fyvr11h8 fyvr11hw fyvr11fw fyvr11gk"},disabled:{true:"_140wn8nu _140wn8nc fyvr12z9 fyvr12zx",false:"_140wn8nv _140wn8nd fyvr12zf fyvr1309 fyvr1307"},size:{xs:"_140wn8nw _1qxj1ib9 _1qxj1ibg _1qxj1ib6 fyvr11r3 fyvr11ig fyvr11k4 fyvr11k0 fyvr11jk _140wn8ne fyvr1zg fyvr111k",sm:"_140wn8nx _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8 _140wn8nf fyvr1zk fyvr111o",md:"_140wn8ny _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8 _140wn8ng fyvr1zo fyvr111s",lg:"_140wn8nz _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8 _140wn8nh fyvr1zo fyvr111s"},iconOnly:{true:"_140wn8n10"},hasLeftIcon:{true:"_140wn8n11"},hasRightIcon:{true:"_140wn8n12"},activeOutline:{light:"_140wn8n13",bold:"_140wn8n14"}},defaultVariants:{},compoundVariants:[[{iconOnly:!0,size:"xs"},"_140wn8n15"],[{iconOnly:!0,size:"sm"},"_140wn8n16"],[{iconOnly:!0,size:"md"},"_140wn8n17"],[{iconOnly:!0,size:"lg"},"_140wn8n18"],[{iconOnly:!1,hasLeftIcon:!0,size:"xs"},"_140wn8n19"],[{iconOnly:!1,hasLeftIcon:!0,size:"sm"},"_140wn8n1a"],[{iconOnly:!1,hasLeftIcon:!0,size:"md"},"_140wn8n1b"],[{iconOnly:!1,hasRightIcon:!0,size:"xs"},"_140wn8n1c"],[{iconOnly:!1,hasRightIcon:!0,size:"sm"},"_140wn8n1d"],[{iconOnly:!1,hasRightIcon:!0,size:"md"},"_140wn8n1e"]]});const Vt=T.forwardRef((t,e)=>{const{as:r="button",activeOutline:n,className:i,disabled:s=!1,display:o="inline-flex",fontWeight:a="bold",pending:c=!1,label:l,leftIcon:f,rightIcon:u,size:h="md",variant:g="glass",width:y="fit",shape:m="circle",type:S="button",...E}=t,A=f!==void 0&&l!==void 0,P=u!==void 0&&l!==void 0,N=f!==void 0&&l===void 0,L=h==="xs"?"xs":"sm";return Y.jsx(ye,{as:r,className:Li(i,xge({activeOutline:n,disabled:s||c,hasLeftIcon:A,hasRightIcon:P,iconOnly:N,size:g==="text"?void 0:h,shape:g==="text"?void 0:m,variant:g})),disabled:s||c,display:o,fontWeight:a,ref:e,type:S,width:y,...E,children:N?Y.jsx(f,{size:L}):Y.jsxs(ye,{width:"full",height:"full",justifyContent:"space-between",alignItems:"center",gap:h==="xs"?"1":"2",children:[Y.jsxs(ye,{justifyContent:"flex-start",alignItems:"center",gap:h==="xs"?"1":"2",children:[f&&Y.jsx(f,{size:L}),Y.jsx(Te,{children:l})]}),u&&Y.jsx(u,{size:L})]})})});var Ege=jn({defaultClassName:"rhmai63",variantClassNames:{clickable:{true:"rhmai64 rhmai60 fyvr11ec fyvr11eo fyvr11f0 fyvr11fc fyvr1307 fyvr12zf _4efw240"},disabled:{true:"rhmai65"},outlined:{true:"rhmai66 rhmai61 fyvr11eg fyvr11es fyvr11f4 fyvr11fg fyvr12rf fyvr12k3 fyvr125f fyvr12cr fyvr12rr fyvr12kf fyvr125r fyvr12d3"},blur:{true:"rhmai67 rhmai62 fyvr11r0"}},defaultVariants:{},compoundVariants:[]});const vn=T.forwardRef((t,e)=>{const{className:r,children:n,clickable:i,outlined:s,disabled:o,blur:a,width:c="full",...l}=t;return Y.jsx(ye,{className:Li(r,Ege({clickable:i,outlined:s,disabled:o,blur:a})),background:s?"transparent":"backgroundSecondary",overflow:"hidden",borderRadius:"md",padding:"4",width:c,ref:e,...l,children:n})});function Cge(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function V8(...t){return e=>t.forEach(r=>Cge(r,e))}function Rr(...t){return T.useCallback(V8(...t),t)}function Age(t,e){const r=T.createContext(e);function n(s){const{children:o,...a}=s,c=T.useMemo(()=>a,Object.values(a));return Y.jsx(r.Provider,{value:c,children:o})}function i(s){const o=T.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return n.displayName=t+"Provider",[n,i]}function Us(t,e=[]){let r=[];function n(s,o){const a=T.createContext(o),c=r.length;r=[...r,o];function l(u){const{scope:h,children:g,...y}=u,m=(h==null?void 0:h[t][c])||a,S=T.useMemo(()=>y,Object.values(y));return Y.jsx(m.Provider,{value:S,children:g})}function f(u,h){const g=(h==null?void 0:h[t][c])||a,y=T.useContext(g);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return l.displayName=s+"Provider",[l,f]}const i=()=>{const s=r.map(o=>T.createContext(o));return function(a){const c=(a==null?void 0:a[t])||s;return T.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return i.scopeName=t,[n,Sge(i,...e)]}function Sge(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:l})=>{const u=c(s)[`__scope${l}`];return{...a,...u}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function nt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Fs(t){const e=T.useRef(t);return T.useEffect(()=>{e.current=t}),T.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function sc({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,i]=_ge({defaultProp:e,onChange:r}),s=t!==void 0,o=s?t:n,a=Fs(r),c=T.useCallback(l=>{if(s){const u=typeof l=="function"?l(t):l;u!==t&&a(u)}else i(l)},[s,t,i,a]);return[o,c]}function _ge({defaultProp:t,onChange:e}){const r=T.useState(t),[n]=r,i=T.useRef(n),s=Fs(e);return T.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}function z8(t){const e=T.useRef({value:t,previous:t});return T.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var cs=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{};function H8(t){const[e,r]=T.useState(void 0);return cs(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const c=s.borderBoxSize,l=Array.isArray(c)?c[0]:c;o=l.inlineSize,a=l.blockSize}else o=t.offsetWidth,a=t.offsetHeight;r({width:o,height:a})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}function Ige(t,e){return T.useReducer((r,n)=>e[r][n]??r,t)}var lo=t=>{const{present:e,children:r}=t,n=Tge(e),i=typeof r=="function"?r({present:n.isPresent}):T.Children.only(r),s=Rr(n.ref,Pge(i));return typeof r=="function"||n.isPresent?T.cloneElement(i,{ref:s}):null};lo.displayName="Presence";function Tge(t){const[e,r]=T.useState(),n=T.useRef({}),i=T.useRef(t),s=T.useRef("none"),o=t?"mounted":"unmounted",[a,c]=Ige(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const l=F3(n.current);s.current=a==="mounted"?l:"none"},[a]),cs(()=>{const l=n.current,f=i.current;if(f!==t){const h=s.current,g=F3(l);t?c("MOUNT"):g==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(f&&h!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),cs(()=>{if(e){const l=u=>{const g=F3(n.current).includes(u.animationName);u.target===e&&g&&ff.flushSync(()=>c("ANIMATION_END"))},f=u=>{u.target===e&&(s.current=F3(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",l),e.addEventListener("animationend",l),()=>{e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",l),e.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:T.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function F3(t){return(t==null?void 0:t.animationName)||"none"}function Pge(t){var e,r;let n=(e=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:e.get,i=n&&"isReactWarning"in n&&n.isReactWarning;return i?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,i=n&&"isReactWarning"in n&&n.isReactWarning,i?t.props.ref:t.props.ref||t.ref)}var G1=T.forwardRef((t,e)=>{const{children:r,...n}=t,i=T.Children.toArray(r),s=i.find(kge);if(s){const o=s.props.children,a=i.map(c=>c===s?T.Children.count(o)>1?T.Children.only(null):T.isValidElement(o)?o.props.children:null:c);return Y.jsx(k_,{...n,ref:e,children:T.isValidElement(o)?T.cloneElement(o,void 0,a):null})}return Y.jsx(k_,{...n,ref:e,children:r})});G1.displayName="Slot";var k_=T.forwardRef((t,e)=>{const{children:r,...n}=t;if(T.isValidElement(r)){const i=Mge(r);return T.cloneElement(r,{...Rge(n,r.props),ref:e?V8(e,i):i})}return T.Children.count(r)>1?T.Children.only(null):null});k_.displayName="SlotClone";var zW=({children:t})=>Y.jsx(Y.Fragment,{children:t});function kge(t){return T.isValidElement(t)&&t.type===zW}function Rge(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{s(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function Mge(t){var e,r;let n=(e=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:e.get,i=n&&"isReactWarning"in n&&n.isReactWarning;return i?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,i=n&&"isReactWarning"in n&&n.isReactWarning,i?t.props.ref:t.props.ref||t.ref)}var Oge=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],jt=Oge.reduce((t,e)=>{const r=T.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?G1:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),Y.jsx(a,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Ek(t,e){t&&ff.flushSync(()=>t.dispatchEvent(e))}var Ck="Checkbox",[Dge,hGe]=Us(Ck),[Nge,Bge]=Dge(Ck),HW=T.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:l,...f}=t,[u,h]=T.useState(null),g=Rr(e,P=>h(P)),y=T.useRef(!1),m=u?!!u.closest("form"):!0,[S=!1,E]=sc({prop:i,defaultProp:s,onChange:l}),A=T.useRef(S);return T.useEffect(()=>{const P=u==null?void 0:u.form;if(P){const N=()=>E(A.current);return P.addEventListener("reset",N),()=>P.removeEventListener("reset",N)}},[u,E]),Y.jsxs(Nge,{scope:r,state:S,disabled:a,children:[Y.jsx(jt.button,{type:"button",role:"checkbox","aria-checked":R1(S)?"mixed":S,"aria-required":o,"data-state":KW(S),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:g,onKeyDown:nt(t.onKeyDown,P=>{P.key==="Enter"&&P.preventDefault()}),onClick:nt(t.onClick,P=>{E(N=>R1(N)?!0:!N),m&&(y.current=P.isPropagationStopped(),y.current||P.stopPropagation())})}),m&&Y.jsx(Lge,{control:u,bubbles:!y.current,name:n,value:c,checked:S,required:o,disabled:a,style:{transform:"translateX(-100%)"}})]})});HW.displayName=Ck;var GW="CheckboxIndicator",WW=T.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...i}=t,s=Bge(GW,r);return Y.jsx(lo,{present:n||R1(s.state)||s.state===!0,children:Y.jsx(jt.span,{"data-state":KW(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});WW.displayName=GW;var Lge=t=>{const{control:e,checked:r,bubbles:n=!0,...i}=t,s=T.useRef(null),o=z8(r),a=H8(e);return T.useEffect(()=>{const c=s.current,l=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(l,"checked").set;if(o!==r&&u){const h=new Event("click",{bubbles:n});c.indeterminate=R1(r),u.call(c,R1(r)?!1:r),c.dispatchEvent(h)}},[o,r,n]),Y.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:R1(r)?!1:r,...i,tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function R1(t){return t==="indeterminate"}function KW(t){return R1(t)?"indeterminate":t?"checked":"unchecked"}var Fge=HW,jge=WW,Uge=jn({defaultClassName:"_43lu9r4",variantClassNames:{labelLocation:{top:"_43lu9r5 _43lu9r0 fyvr11p4 fyvr11mc fyvr11ck fyvr11l8",left:"_43lu9r6 _43lu9r1 fyvr11ow fyvr11mk fyvr11ck fyvr11l8",right:"_43lu9r7 _43lu9r2 fyvr11ow fyvr11mk fyvr11ck fyvr11l8",hidden:"_43lu9r8 _43lu9r3 fyvr11c8 fyvr11l8"}},defaultVariants:{},compoundVariants:[]});const Ky=t=>{const{id:e,label:r,description:n,labelLocation:i="top",children:s,...o}=t,a=()=>r||n?Y.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[r&&Y.jsx(Te,{variant:"small",color:"text100",hidden:i==="hidden",children:r}),n&&Y.jsx(Te,{variant:"small",color:"text50",hidden:i==="hidden",children:n})]}):null;return Y.jsxs(ye,{as:"label",className:Uge({labelLocation:i}),htmlFor:e,...o,children:[["left","top","hidden"].includes(i)&&a(),s,i==="right"&&a()]})};var uf=jn({defaultClassName:"_1dizidw0",variantClassNames:{size:{xs:"_1dizidw1",sm:"_1dizidw2",md:"_1dizidw3",lg:"_1dizidw4",xl:"_1dizidw5"}},defaultVariants:{},compoundVariants:[]});const $ge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.168 9.25V2.929h-1.5V9.25h-6.32v1.5h6.32v6.321h1.5V10.75h6.321v-1.5h-6.32Z",clipRule:"evenodd"})}),$w=({size:t="sm",...e})=>Y.jsx(ye,{as:$ge,className:uf({size:t}),...e}),qge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{stroke:"currentColor",strokeWidth:1.5,d:"m4.304 10.232 4.263 4.79 7.13-11.238"})}),qw=({size:t="sm",...e})=>Y.jsx(ye,{as:qge,className:uf({size:t}),...e}),Vge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m3.888 7.53 1.06-1.06 5.47 5.47 5.47-5.47 1.06 1.06-6.53 6.53-6.53-6.53Z",clipRule:"evenodd"})}),Ak=({size:t="sm",...e})=>Y.jsx(ye,{as:Vge,className:uf({size:t}),...e}),zge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m12.888 3.47 1.06 1.06L8.48 10l5.47 5.47-1.061 1.06L6.358 10l6.53-6.53Z",clipRule:"evenodd"})}),YW=({size:t="sm",...e})=>Y.jsx(ye,{as:zge,className:uf({size:t}),...e}),Hge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.418 11.06 4.47 4.47 1.06-1.06L11.48 10l4.47-4.47-1.06-1.06-4.47 4.47-4.47-4.47-1.06 1.06L9.357 10l-4.47 4.47 1.06 1.06 4.47-4.47Z",clipRule:"evenodd"})}),Tu=({size:t="sm",...e})=>Y.jsx(ye,{as:Hge,className:uf({size:t}),...e}),Gge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.918 4.5h-6V6h4.5v6.5h1.5v-8Zm-1.5 9.5v3h-9V6h3V3h9v11h-3Zm-7.5 1.5v-8h6v8h-6Z",clipRule:"evenodd"})}),QW=({size:t="sm",...e})=>Y.jsx(ye,{as:Gge,className:uf({size:t}),...e}),Wge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.608 6.75h-5.19v-1.5h7.75V13h-1.5V7.81l-7.72 7.72-1.06-1.06 7.72-7.72Z",clipRule:"evenodd"})}),G8=({size:t="sm",...e})=>Y.jsx(ye,{as:Wge,className:uf({size:t}),...e}),Kge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.918 9.5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm-.677 4.383a5.5 5.5 0 1 1 1.06-1.06l2.648 2.647-1.061 1.06-2.647-2.647Z",clipRule:"evenodd"})}),Yge=({size:t="sm",...e})=>Y.jsx(ye,{as:Kge,className:uf({size:t}),...e}),Qge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.418 3.25h-5.75v13.5h5.75v-1.5h-4.25V4.75h4.25v-1.5Zm4.53 11.28-1.06-1.06 2.72-2.72h-8.19v-1.5h8.19l-2.72-2.72 1.06-1.06L18.48 10l-4.53 4.53Z",clipRule:"evenodd"})}),Jge=({size:t="sm",...e})=>Y.jsx(ye,{as:Qge,className:uf({size:t}),...e}),Zge=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 6.05c0 .443.39.802.87.802H17V16H5.495C4.117 16 3 14.97 3 13.698V6.302C3 5.031 4.117 4 5.495 4H14.5v1.247H5.87c-.48 0-.87.36-.87.802Zm7 5.45a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0Z",clipRule:"evenodd"})}),Xge=({size:t="sm",...e})=>Y.jsx(ye,{as:Zge,className:uf({size:t}),...e});var eye=jn({defaultClassName:"_1c9x66f1 _1c9x66f0 fyvr11eg fyvr11es fyvr11f4 fyvr11fg fyvr11h4 fyvr11hs fyvr11fs fyvr11gg fyvr12rl fyvr12k9 fyvr125l fyvr12cx fyvr12rr fyvr12kf fyvr125r fyvr12d3 fyvr11l8 fyvr11ow fyvr11no fyvr11sl fyvr1309 fyvr1307 fyvr12zz fyvr12zf fyvr12zb _4efw240",variantClassNames:{size:{sm:"_1c9x66f2",lg:"_1c9x66f3"}},defaultVariants:{},compoundVariants:[]}),tye="_1c9x66f4 fyvr12w9 fyvr11l8 fyvr11ow fyvr11no fyvr12g fyvr164";const rye=({size:t="sm"})=>Y.jsx(jge,{className:tye,children:Y.jsx(qw,{size:t==="lg"?"sm":"xs"})});T.forwardRef((t,e)=>{const{disabled:r=!1,id:n,name:i,label:s="",labelLocation:o="left",size:a="sm",...c}=t;return Y.jsx(Ky,{disabled:r,display:"flex",id:n??i,label:s,labelLocation:o,whiteSpace:"nowrap",children:Y.jsx(Fge,{className:eye({size:a}),disabled:r,id:n??i,name:i,ref:e,...c,children:Y.jsx(rye,{size:a})})})});qt.createContext(null);var nye=JT.useId||(()=>{}),iye=0;function ec(t){const[e,r]=T.useState(nye());return cs(()=>{t||r(n=>n??String(iye++))},[t]),t||(e?`radix-${e}`:"")}var Sk="Collapsible",[sye,oye]=Us(Sk),[aye,_k]=sye(Sk),Ik=T.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[c=!1,l]=sc({prop:n,defaultProp:i,onChange:o});return Y.jsx(aye,{scope:r,disabled:s,contentId:ec(),open:c,onOpenToggle:T.useCallback(()=>l(f=>!f),[l]),children:Y.jsx(jt.div,{"data-state":Rk(c),"data-disabled":s?"":void 0,...a,ref:e})})});Ik.displayName=Sk;var JW="CollapsibleTrigger",Tk=T.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,i=_k(JW,r);return Y.jsx(jt.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Rk(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...n,ref:e,onClick:nt(t.onClick,i.onOpenToggle)})});Tk.displayName=JW;var Pk="CollapsibleContent",kk=T.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=_k(Pk,t.__scopeCollapsible);return Y.jsx(lo,{present:r||i.open,children:({present:s})=>Y.jsx(cye,{...n,ref:e,present:s})})});kk.displayName=Pk;var cye=T.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:i,...s}=t,o=_k(Pk,r),[a,c]=T.useState(n),l=T.useRef(null),f=Rr(e,l),u=T.useRef(0),h=u.current,g=T.useRef(0),y=g.current,m=o.open||a,S=T.useRef(m),E=T.useRef();return T.useEffect(()=>{const A=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(A)},[]),cs(()=>{const A=l.current;if(A){E.current=E.current||{transitionDuration:A.style.transitionDuration,animationName:A.style.animationName},A.style.transitionDuration="0s",A.style.animationName="none";const P=A.getBoundingClientRect();u.current=P.height,g.current=P.width,S.current||(A.style.transitionDuration=E.current.transitionDuration,A.style.animationName=E.current.animationName),c(n)}},[o.open,n]),Y.jsx(jt.div,{"data-state":Rk(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...s,ref:f,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:m&&i})});function Rk(t){return t?"open":"closed"}var ZW=Ik,XW=Tk,eK=kk;const B9=Object.freeze(Object.defineProperty({__proto__:null,Collapsible:Ik,CollapsibleContent:kk,CollapsibleTrigger:Tk,Content:eK,Root:ZW,Trigger:XW,createCollapsibleScope:oye},Symbol.toStringTag,{value:"Module"}));var rF="64px",lye="_4j62fl0",fye="_4j62fl2 _4j62fl1 fyvr11hc fyvr11i0 fyvr11g0 fyvr11go fyvr1vc fyvr1xg fyvr1zk fyvr111o fyvr11l8 fyvr11ow fyvr11sl fyvr12g fyvr12zf fyvr11rc _4efw240",uye="_4j62fl4 _4j62fl3 fyvr1zk fyvr111o fyvr1uw fyvr1xg fyvr12g",dye="_4j62fl5";const tK=t=>{const{className:e,children:r,defaultOpen:n,open:i,onOpenChange:s,label:o,...a}=t,[c,l]=T.useState(n),f=i??c,u=g=>{i===void 0&&l(g)},h=g=>{u(g),s==null||s(g)};return Y.jsx(ZW,{open:f,defaultOpen:n,onOpenChange:h,asChild:!0,children:Y.jsxs(ye,{as:k1.div,className:Li(e,lye),initial:{height:f?"auto":rF},animate:{height:f?"auto":rF},transition:{ease:"easeOut",duration:.3},borderRadius:"md",background:"backgroundSecondary",position:"relative",overflow:"hidden",width:"full",...a,children:[Y.jsxs(XW,{className:fye,children:[Y.jsx(Te,{as:"div",variant:"normal",fontWeight:"bold",color:"text80",children:o}),Y.jsx(ye,{as:k1.div,position:"absolute",right:"0",marginRight:"4",initial:{rotate:f?180:0},animate:{rotate:f?180:0},transition:{ease:"linear",duration:.1},children:Y.jsx(Ak,{className:dye,color:"text50"})})]}),Y.jsx(LW,{children:f&&Y.jsx(eK,{className:uye,asChild:!0,forceMount:!0,children:Y.jsx(k1.div,{initial:{opacity:f?1:0},animate:{opacity:1},exit:{opacity:0},transition:{ease:"easeOut",duration:.3},children:r})})})]})})};function W8(t){const e=t+"CollectionProvider",[r,n]=Us(e),[i,s]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:y,children:m}=g,S=qt.useRef(null),E=qt.useRef(new Map).current;return Y.jsx(i,{scope:y,itemMap:E,collectionRef:S,children:m})};o.displayName=e;const a=t+"CollectionSlot",c=qt.forwardRef((g,y)=>{const{scope:m,children:S}=g,E=s(a,m),A=Rr(y,E.collectionRef);return Y.jsx(G1,{ref:A,children:S})});c.displayName=a;const l=t+"CollectionItemSlot",f="data-radix-collection-item",u=qt.forwardRef((g,y)=>{const{scope:m,children:S,...E}=g,A=qt.useRef(null),P=Rr(y,A),N=s(l,m);return qt.useEffect(()=>(N.itemMap.set(A,{ref:A,...E}),()=>void N.itemMap.delete(A))),Y.jsx(G1,{[f]:"",ref:P,children:S})});u.displayName=l;function h(g){const y=s(t+"CollectionConsumer",g);return qt.useCallback(()=>{const S=y.collectionRef.current;if(!S)return[];const E=Array.from(S.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((N,L)=>E.indexOf(N.ref.current)-E.indexOf(L.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:c,ItemSlot:u},h,n]}var hye=T.createContext(void 0);function Vw(t){const e=T.useContext(hye);return t||e||"ltr"}function pye(t,e=globalThis==null?void 0:globalThis.document){const r=Fs(t);T.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var vye="DismissableLayer",R_="dismissableLayer.update",gye="dismissableLayer.pointerDownOutside",yye="dismissableLayer.focusOutside",nF,rK=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Yy=T.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=t,l=T.useContext(rK),[f,u]=T.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=T.useState({}),y=Rr(e,I=>u(I)),m=Array.from(l.layers),[S]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),E=m.indexOf(S),A=f?m.indexOf(f):-1,P=l.layersWithOutsidePointerEventsDisabled.size>0,N=A>=E,L=bye(I=>{const U=I.target,ie=[...l.branches].some(ae=>ae.contains(U));!N||ie||(i==null||i(I),o==null||o(I),I.defaultPrevented||a==null||a())},h),V=wye(I=>{const U=I.target;[...l.branches].some(ae=>ae.contains(U))||(s==null||s(I),o==null||o(I),I.defaultPrevented||a==null||a())},h);return pye(I=>{A===l.layers.size-1&&(n==null||n(I),!I.defaultPrevented&&a&&(I.preventDefault(),a()))},h),T.useEffect(()=>{if(f)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(nF=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),iF(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=nF)}},[f,h,r,l]),T.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),iF())},[f,l]),T.useEffect(()=>{const I=()=>g({});return document.addEventListener(R_,I),()=>document.removeEventListener(R_,I)},[]),Y.jsx(jt.div,{...c,ref:y,style:{pointerEvents:P?N?"auto":"none":void 0,...t.style},onFocusCapture:nt(t.onFocusCapture,V.onFocusCapture),onBlurCapture:nt(t.onBlurCapture,V.onBlurCapture),onPointerDownCapture:nt(t.onPointerDownCapture,L.onPointerDownCapture)})});Yy.displayName=vye;var mye="DismissableLayerBranch",nK=T.forwardRef((t,e)=>{const r=T.useContext(rK),n=T.useRef(null),i=Rr(e,n);return T.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),Y.jsx(jt.div,{...t,ref:i})});nK.displayName=mye;function bye(t,e=globalThis==null?void 0:globalThis.document){const r=Fs(t),n=T.useRef(!1),i=T.useRef(()=>{});return T.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){iK(gye,r,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function wye(t,e=globalThis==null?void 0:globalThis.document){const r=Fs(t),n=T.useRef(!1);return T.useEffect(()=>{const i=s=>{s.target&&!n.current&&iK(yye,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function iF(){const t=new CustomEvent(R_);document.dispatchEvent(t)}function iK(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?Ek(i,s):i.dispatchEvent(s)}var xye=Yy,Eye=nK,L9=0;function Mk(){T.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??sF()),document.body.insertAdjacentElement("beforeend",t[1]??sF()),L9++,()=>{L9===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),L9--}},[])}function sF(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}var F9="focusScope.autoFocusOnMount",j9="focusScope.autoFocusOnUnmount",oF={bubbles:!1,cancelable:!0},Cye="FocusScope",K8=T.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,c]=T.useState(null),l=Fs(i),f=Fs(s),u=T.useRef(null),h=Rr(e,m=>c(m)),g=T.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;T.useEffect(()=>{if(n){let m=function(P){if(g.paused||!a)return;const N=P.target;a.contains(N)?u.current=N:wd(u.current,{select:!0})},S=function(P){if(g.paused||!a)return;const N=P.relatedTarget;N!==null&&(a.contains(N)||wd(u.current,{select:!0}))},E=function(P){if(document.activeElement===document.body)for(const L of P)L.removedNodes.length>0&&wd(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",S);const A=new MutationObserver(E);return a&&A.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",S),A.disconnect()}}},[n,a,g.paused]),T.useEffect(()=>{if(a){cF.add(g);const m=document.activeElement;if(!a.contains(m)){const E=new CustomEvent(F9,oF);a.addEventListener(F9,l),a.dispatchEvent(E),E.defaultPrevented||(Aye(Pye(sK(a)),{select:!0}),document.activeElement===m&&wd(a))}return()=>{a.removeEventListener(F9,l),setTimeout(()=>{const E=new CustomEvent(j9,oF);a.addEventListener(j9,f),a.dispatchEvent(E),E.defaultPrevented||wd(m??document.body,{select:!0}),a.removeEventListener(j9,f),cF.remove(g)},0)}}},[a,l,f,g]);const y=T.useCallback(m=>{if(!r&&!n||g.paused)return;const S=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,E=document.activeElement;if(S&&E){const A=m.currentTarget,[P,N]=Sye(A);P&&N?!m.shiftKey&&E===N?(m.preventDefault(),r&&wd(P,{select:!0})):m.shiftKey&&E===P&&(m.preventDefault(),r&&wd(N,{select:!0})):E===A&&m.preventDefault()}},[r,n,g.paused]);return Y.jsx(jt.div,{tabIndex:-1,...o,ref:h,onKeyDown:y})});K8.displayName=Cye;function Aye(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(wd(n,{select:e}),document.activeElement!==r)return}function Sye(t){const e=sK(t),r=aF(e,t),n=aF(e.reverse(),t);return[r,n]}function sK(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function aF(t,e){for(const r of t)if(!_ye(r,{upTo:e}))return r}function _ye(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Iye(t){return t instanceof HTMLInputElement&&"select"in t}function wd(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Iye(t)&&e&&t.select()}}var cF=Tye();function Tye(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=lF(t,e),t.unshift(e)},remove(e){var r;t=lF(t,e),(r=t[0])==null||r.resume()}}}function lF(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Pye(t){return t.filter(e=>e.tagName!=="A")}const kye=["top","right","bottom","left"],jl=Math.min,na=Math.max,f4=Math.round,j3=Math.floor,Ah=t=>({x:t,y:t}),Rye={left:"right",right:"left",bottom:"top",top:"bottom"},Mye={start:"end",end:"start"};function M_(t,e,r){return na(t,jl(e,r))}function Pu(t,e){return typeof t=="function"?t(e):t}function ku(t){return t.split("-")[0]}function Qy(t){return t.split("-")[1]}function Ok(t){return t==="x"?"y":"x"}function Dk(t){return t==="y"?"height":"width"}function Sh(t){return["top","bottom"].includes(ku(t))?"y":"x"}function Nk(t){return Ok(Sh(t))}function Oye(t,e,r){r===void 0&&(r=!1);const n=Qy(t),i=Nk(t),s=Dk(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=u4(o)),[o,u4(o)]}function Dye(t){const e=u4(t);return[O_(t),e,O_(e)]}function O_(t){return t.replace(/start|end/g,e=>Mye[e])}function Nye(t,e,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return r?e?i:n:e?n:i;case"left":case"right":return e?s:o;default:return[]}}function Bye(t,e,r,n){const i=Qy(t);let s=Nye(ku(t),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(O_)))),s}function u4(t){return t.replace(/left|right|bottom|top/g,e=>Rye[e])}function Lye(t){return{top:0,right:0,bottom:0,left:0,...t}}function oK(t){return typeof t!="number"?Lye(t):{top:t,right:t,bottom:t,left:t}}function d4(t){const{x:e,y:r,width:n,height:i}=t;return{width:n,height:i,top:r,left:e,right:e+n,bottom:r+i,x:e,y:r}}function fF(t,e,r){let{reference:n,floating:i}=t;const s=Sh(e),o=Nk(e),a=Dk(o),c=ku(e),l=s==="y",f=n.x+n.width/2-i.width/2,u=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2;let g;switch(c){case"top":g={x:f,y:n.y-i.height};break;case"bottom":g={x:f,y:n.y+n.height};break;case"right":g={x:n.x+n.width,y:u};break;case"left":g={x:n.x-i.width,y:u};break;default:g={x:n.x,y:n.y}}switch(Qy(e)){case"start":g[o]-=h*(r&&l?-1:1);break;case"end":g[o]+=h*(r&&l?-1:1);break}return g}const Fye=async(t,e,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=fF(l,n,c),h=n,g={},y=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:c}=e,{element:l,padding:f=0}=Pu(t,e)||{};if(l==null)return{};const u=oK(f),h={x:r,y:n},g=Nk(i),y=Dk(g),m=await o.getDimensions(l),S=g==="y",E=S?"top":"left",A=S?"bottom":"right",P=S?"clientHeight":"clientWidth",N=s.reference[y]+s.reference[g]-h[g]-s.floating[y],L=h[g]-s.reference[g],V=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let I=V?V[P]:0;(!I||!await(o.isElement==null?void 0:o.isElement(V)))&&(I=a.floating[P]||s.floating[y]);const U=N/2-L/2,ie=I/2-m[y]/2-1,ae=jl(u[E],ie),K=jl(u[A],ie),R=ae,D=I-m[y]-K,v=I/2-m[y]/2+U,b=M_(R,v,D),M=!c.arrow&&Qy(i)!=null&&v!==b&&s.reference[y]/2-(vv<=0)){var K,R;const v=(((K=s.flip)==null?void 0:K.index)||0)+1,b=I[v];if(b)return{data:{index:v,overflows:ae},reset:{placement:b}};let M=(R=ae.filter(B=>B.overflows[0]<=0).sort((B,x)=>B.overflows[1]-x.overflows[1])[0])==null?void 0:R.placement;if(!M)switch(g){case"bestFit":{var D;const B=(D=ae.filter(x=>{if(V){const C=Sh(x.placement);return C===A||C==="y"}return!0}).map(x=>[x.placement,x.overflows.filter(C=>C>0).reduce((C,w)=>C+w,0)]).sort((x,C)=>x[1]-C[1])[0])==null?void 0:D[0];B&&(M=B);break}case"initialPlacement":M=a;break}if(i!==M)return{reset:{placement:M}}}return{}}}};function uF(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function dF(t){return kye.some(e=>t[e]>=0)}const $ye=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...i}=Pu(t,e);switch(n){case"referenceHidden":{const s=await V2(e,{...i,elementContext:"reference"}),o=uF(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:dF(o)}}}case"escaped":{const s=await V2(e,{...i,altBoundary:!0}),o=uF(s,r.floating);return{data:{escapedOffsets:o,escaped:dF(o)}}}default:return{}}}}};async function qye(t,e){const{placement:r,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=ku(r),a=Qy(r),c=Sh(r)==="y",l=["left","top"].includes(o)?-1:1,f=s&&c?-1:1,u=Pu(e,t);let{mainAxis:h,crossAxis:g,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return a&&typeof y=="number"&&(g=a==="end"?y*-1:y),c?{x:g*f,y:h*l}:{x:h*l,y:g*f}}const Vye=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:i,y:s,placement:o,middlewareData:a}=e,c=await qye(e,t);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},zye=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:S=>{let{x:E,y:A}=S;return{x:E,y:A}}},...c}=Pu(t,e),l={x:r,y:n},f=await V2(e,c),u=Sh(ku(i)),h=Ok(u);let g=l[h],y=l[u];if(s){const S=h==="y"?"top":"left",E=h==="y"?"bottom":"right",A=g+f[S],P=g-f[E];g=M_(A,g,P)}if(o){const S=u==="y"?"top":"left",E=u==="y"?"bottom":"right",A=y+f[S],P=y-f[E];y=M_(A,y,P)}const m=a.fn({...e,[h]:g,[u]:y});return{...m,data:{x:m.x-r,y:m.y-n}}}}},Hye=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=Pu(t,e),f={x:r,y:n},u=Sh(i),h=Ok(u);let g=f[h],y=f[u];const m=Pu(a,e),S=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const P=h==="y"?"height":"width",N=s.reference[h]-s.floating[P]+S.mainAxis,L=s.reference[h]+s.reference[P]-S.mainAxis;gL&&(g=L)}if(l){var E,A;const P=h==="y"?"width":"height",N=["top","left"].includes(ku(i)),L=s.reference[u]-s.floating[P]+(N&&((E=o.offset)==null?void 0:E[u])||0)+(N?0:S.crossAxis),V=s.reference[u]+s.reference[P]+(N?0:((A=o.offset)==null?void 0:A[u])||0)-(N?S.crossAxis:0);yV&&(y=V)}return{[h]:g,[u]:y}}}},Gye=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:r,rects:n,platform:i,elements:s}=e,{apply:o=()=>{},...a}=Pu(t,e),c=await V2(e,a),l=ku(r),f=Qy(r),u=Sh(r)==="y",{width:h,height:g}=n.floating;let y,m;l==="top"||l==="bottom"?(y=l,m=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(m=l,y=f==="end"?"top":"bottom");const S=g-c.top-c.bottom,E=h-c.left-c.right,A=jl(g-c[y],S),P=jl(h-c[m],E),N=!e.middlewareData.shift;let L=A,V=P;if(u?V=f||N?jl(P,E):E:L=f||N?jl(A,S):S,N&&!f){const U=na(c.left,0),ie=na(c.right,0),ae=na(c.top,0),K=na(c.bottom,0);u?V=h-2*(U!==0||ie!==0?U+ie:na(c.left,c.right)):L=g-2*(ae!==0||K!==0?ae+K:na(c.top,c.bottom))}await o({...e,availableWidth:V,availableHeight:L});const I=await i.getDimensions(s.floating);return h!==I.width||g!==I.height?{reset:{rects:!0}}:{}}}};function Jy(t){return aK(t)?(t.nodeName||"").toLowerCase():"#document"}function ua(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Vu(t){var e;return(e=(aK(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function aK(t){return t instanceof Node||t instanceof ua(t).Node}function Xl(t){return t instanceof Element||t instanceof ua(t).Element}function ef(t){return t instanceof HTMLElement||t instanceof ua(t).HTMLElement}function hF(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ua(t).ShadowRoot}function zw(t){const{overflow:e,overflowX:r,overflowY:n,display:i}=Kc(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(i)}function Wye(t){return["table","td","th"].includes(Jy(t))}function Y8(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Bk(t){const e=Lk(),r=Kc(t);return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function Kye(t){let e=_h(t);for(;ef(e)&&!Ey(e);){if(Y8(e))return null;if(Bk(e))return e;e=_h(e)}return null}function Lk(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ey(t){return["html","body","#document"].includes(Jy(t))}function Kc(t){return ua(t).getComputedStyle(t)}function Q8(t){return Xl(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function _h(t){if(Jy(t)==="html")return t;const e=t.assignedSlot||t.parentNode||hF(t)&&t.host||Vu(t);return hF(e)?e.host:e}function cK(t){const e=_h(t);return Ey(e)?t.ownerDocument?t.ownerDocument.body:t.body:ef(e)&&zw(e)?e:cK(e)}function z2(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const i=cK(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),o=ua(i);return s?e.concat(o,o.visualViewport||[],zw(i)?i:[],o.frameElement&&r?z2(o.frameElement):[]):e.concat(i,z2(i,[],r))}function lK(t){const e=Kc(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=ef(t),s=i?t.offsetWidth:r,o=i?t.offsetHeight:n,a=f4(r)!==s||f4(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function Fk(t){return Xl(t)?t:t.contextElement}function ng(t){const e=Fk(t);if(!ef(e))return Ah(1);const r=e.getBoundingClientRect(),{width:n,height:i,$:s}=lK(e);let o=(s?f4(r.width):r.width)/n,a=(s?f4(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Yye=Ah(0);function fK(t){const e=ua(t);return!Lk()||!e.visualViewport?Yye:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Qye(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==ua(t)?!1:e}function W1(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const i=t.getBoundingClientRect(),s=Fk(t);let o=Ah(1);e&&(n?Xl(n)&&(o=ng(n)):o=ng(t));const a=Qye(s,r,n)?fK(s):Ah(0);let c=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,f=i.width/o.x,u=i.height/o.y;if(s){const h=ua(s),g=n&&Xl(n)?ua(n):n;let y=h,m=y.frameElement;for(;m&&n&&g!==y;){const S=ng(m),E=m.getBoundingClientRect(),A=Kc(m),P=E.left+(m.clientLeft+parseFloat(A.paddingLeft))*S.x,N=E.top+(m.clientTop+parseFloat(A.paddingTop))*S.y;c*=S.x,l*=S.y,f*=S.x,u*=S.y,c+=P,l+=N,y=ua(m),m=y.frameElement}}return d4({width:f,height:u,x:c,y:l})}function Jye(t){let{elements:e,rect:r,offsetParent:n,strategy:i}=t;const s=i==="fixed",o=Vu(n),a=e?Y8(e.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},l=Ah(1);const f=Ah(0),u=ef(n);if((u||!u&&!s)&&((Jy(n)!=="body"||zw(o))&&(c=Q8(n)),ef(n))){const h=W1(n);l=ng(n),f.x=h.x+n.clientLeft,f.y=h.y+n.clientTop}return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+f.x,y:r.y*l.y-c.scrollTop*l.y+f.y}}function Zye(t){return Array.from(t.getClientRects())}function uK(t){return W1(Vu(t)).left+Q8(t).scrollLeft}function Xye(t){const e=Vu(t),r=Q8(t),n=t.ownerDocument.body,i=na(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=na(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+uK(t);const a=-r.scrollTop;return Kc(n).direction==="rtl"&&(o+=na(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function eme(t,e){const r=ua(t),n=Vu(t),i=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,c=0;if(i){s=i.width,o=i.height;const l=Lk();(!l||l&&e==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function tme(t,e){const r=W1(t,!0,e==="fixed"),n=r.top+t.clientTop,i=r.left+t.clientLeft,s=ef(t)?ng(t):Ah(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,c=i*s.x,l=n*s.y;return{width:o,height:a,x:c,y:l}}function pF(t,e,r){let n;if(e==="viewport")n=eme(t,r);else if(e==="document")n=Xye(Vu(t));else if(Xl(e))n=tme(e,r);else{const i=fK(t);n={...e,x:e.x-i.x,y:e.y-i.y}}return d4(n)}function dK(t,e){const r=_h(t);return r===e||!Xl(r)||Ey(r)?!1:Kc(r).position==="fixed"||dK(r,e)}function rme(t,e){const r=e.get(t);if(r)return r;let n=z2(t,[],!1).filter(a=>Xl(a)&&Jy(a)!=="body"),i=null;const s=Kc(t).position==="fixed";let o=s?_h(t):t;for(;Xl(o)&&!Ey(o);){const a=Kc(o),c=Bk(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||zw(o)&&!c&&dK(t,o))?n=n.filter(f=>f!==o):i=a,o=_h(o)}return e.set(t,n),n}function nme(t){let{element:e,boundary:r,rootBoundary:n,strategy:i}=t;const o=[...r==="clippingAncestors"?Y8(e)?[]:rme(e,this._c):[].concat(r),n],a=o[0],c=o.reduce((l,f)=>{const u=pF(e,f,i);return l.top=na(u.top,l.top),l.right=jl(u.right,l.right),l.bottom=jl(u.bottom,l.bottom),l.left=na(u.left,l.left),l},pF(e,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function ime(t){const{width:e,height:r}=lK(t);return{width:e,height:r}}function sme(t,e,r){const n=ef(e),i=Vu(e),s=r==="fixed",o=W1(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const c=Ah(0);if(n||!n&&!s)if((Jy(e)!=="body"||zw(i))&&(a=Q8(e)),n){const u=W1(e,!0,s,e);c.x=u.x+e.clientLeft,c.y=u.y+e.clientTop}else i&&(c.x=uK(i));const l=o.left+a.scrollLeft-c.x,f=o.top+a.scrollTop-c.y;return{x:l,y:f,width:o.width,height:o.height}}function U9(t){return Kc(t).position==="static"}function vF(t,e){return!ef(t)||Kc(t).position==="fixed"?null:e?e(t):t.offsetParent}function hK(t,e){const r=ua(t);if(Y8(t))return r;if(!ef(t)){let i=_h(t);for(;i&&!Ey(i);){if(Xl(i)&&!U9(i))return i;i=_h(i)}return r}let n=vF(t,e);for(;n&&Wye(n)&&U9(n);)n=vF(n,e);return n&&Ey(n)&&U9(n)&&!Bk(n)?r:n||Kye(t)||r}const ome=async function(t){const e=this.getOffsetParent||hK,r=this.getDimensions,n=await r(t.floating);return{reference:sme(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ame(t){return Kc(t).direction==="rtl"}const cme={convertOffsetParentRelativeRectToViewportRelativeRect:Jye,getDocumentElement:Vu,getClippingRect:nme,getOffsetParent:hK,getElementRects:ome,getClientRects:Zye,getDimensions:ime,getScale:ng,isElement:Xl,isRTL:ame};function lme(t,e){let r=null,n;const i=Vu(t);function s(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const{left:l,top:f,width:u,height:h}=t.getBoundingClientRect();if(a||e(),!u||!h)return;const g=j3(f),y=j3(i.clientWidth-(l+u)),m=j3(i.clientHeight-(f+h)),S=j3(l),A={rootMargin:-g+"px "+-y+"px "+-m+"px "+-S+"px",threshold:na(0,jl(1,c))||1};let P=!0;function N(L){const V=L[0].intersectionRatio;if(V!==c){if(!P)return o();V?o(!1,V):n=setTimeout(()=>{o(!1,1e-7)},1e3)}P=!1}try{r=new IntersectionObserver(N,{...A,root:i.ownerDocument})}catch{r=new IntersectionObserver(N,A)}r.observe(t)}return o(!0),s}function fme(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,l=Fk(t),f=i||s?[...l?z2(l):[],...z2(e)]:[];f.forEach(E=>{i&&E.addEventListener("scroll",r,{passive:!0}),s&&E.addEventListener("resize",r)});const u=l&&a?lme(l,r):null;let h=-1,g=null;o&&(g=new ResizeObserver(E=>{let[A]=E;A&&A.target===l&&g&&(g.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var P;(P=g)==null||P.observe(e)})),r()}),l&&!c&&g.observe(l),g.observe(e));let y,m=c?W1(t):null;c&&S();function S(){const E=W1(t);m&&(E.x!==m.x||E.y!==m.y||E.width!==m.width||E.height!==m.height)&&r(),m=E,y=requestAnimationFrame(S)}return r(),()=>{var E;f.forEach(A=>{i&&A.removeEventListener("scroll",r),s&&A.removeEventListener("resize",r)}),u==null||u(),(E=g)==null||E.disconnect(),g=null,c&&cancelAnimationFrame(y)}}const ume=Vye,dme=zye,hme=Uye,pme=Gye,vme=$ye,gF=jye,gme=Hye,yme=(t,e,r)=>{const n=new Map,i={platform:cme,...r},s={...i.platform,_c:n};return Fye(t,e,{...i,platform:s})};var q6=typeof document<"u"?T.useLayoutEffect:T.useEffect;function h4(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!h4(t[n],e[n]))return!1;return!0}if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&t.$$typeof)&&!h4(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function pK(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function yF(t,e){const r=pK(t);return Math.round(e*r)/r}function mF(t){const e=T.useRef(t);return q6(()=>{e.current=t}),e}function mme(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:c,open:l}=t,[f,u]=T.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[h,g]=T.useState(n);h4(h,n)||g(n);const[y,m]=T.useState(null),[S,E]=T.useState(null),A=T.useCallback(B=>{B!==V.current&&(V.current=B,m(B))},[]),P=T.useCallback(B=>{B!==I.current&&(I.current=B,E(B))},[]),N=s||y,L=o||S,V=T.useRef(null),I=T.useRef(null),U=T.useRef(f),ie=c!=null,ae=mF(c),K=mF(i),R=T.useCallback(()=>{if(!V.current||!I.current)return;const B={placement:e,strategy:r,middleware:h};K.current&&(B.platform=K.current),yme(V.current,I.current,B).then(x=>{const C={...x,isPositioned:!0};D.current&&!h4(U.current,C)&&(U.current=C,ff.flushSync(()=>{u(C)}))})},[h,e,r,K]);q6(()=>{l===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,u(B=>({...B,isPositioned:!1})))},[l]);const D=T.useRef(!1);q6(()=>(D.current=!0,()=>{D.current=!1}),[]),q6(()=>{if(N&&(V.current=N),L&&(I.current=L),N&&L){if(ae.current)return ae.current(N,L,R);R()}},[N,L,R,ae,ie]);const v=T.useMemo(()=>({reference:V,floating:I,setReference:A,setFloating:P}),[A,P]),b=T.useMemo(()=>({reference:N,floating:L}),[N,L]),M=T.useMemo(()=>{const B={position:r,left:0,top:0};if(!b.floating)return B;const x=yF(b.floating,f.x),C=yF(b.floating,f.y);return a?{...B,transform:"translate("+x+"px, "+C+"px)",...pK(b.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:x,top:C}},[r,a,b.floating,f.x,f.y]);return T.useMemo(()=>({...f,update:R,refs:v,elements:b,floatingStyles:M}),[f,R,v,b,M])}const bme=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:i}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?gF({element:n.current,padding:i}).fn(r):{}:n?gF({element:n,padding:i}).fn(r):{}}}},wme=(t,e)=>({...ume(t),options:[t,e]}),xme=(t,e)=>({...dme(t),options:[t,e]}),Eme=(t,e)=>({...gme(t),options:[t,e]}),Cme=(t,e)=>({...hme(t),options:[t,e]}),Ame=(t,e)=>({...pme(t),options:[t,e]}),Sme=(t,e)=>({...vme(t),options:[t,e]}),_me=(t,e)=>({...bme(t),options:[t,e]});var Ime="Arrow",vK=T.forwardRef((t,e)=>{const{children:r,width:n=10,height:i=5,...s}=t;return Y.jsx(jt.svg,{...s,ref:e,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:Y.jsx("polygon",{points:"0,0 30,0 15,10"})})});vK.displayName=Ime;var Tme=vK,jk="Popper",[gK,Zy]=Us(jk),[Pme,yK]=gK(jk),mK=t=>{const{__scopePopper:e,children:r}=t,[n,i]=T.useState(null);return Y.jsx(Pme,{scope:e,anchor:n,onAnchorChange:i,children:r})};mK.displayName=jk;var bK="PopperAnchor",wK=T.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...i}=t,s=yK(bK,r),o=T.useRef(null),a=Rr(e,o);return T.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:Y.jsx(jt.div,{...i,ref:a})});wK.displayName=bK;var Uk="PopperContent",[kme,Rme]=gK(Uk),xK=T.forwardRef((t,e)=>{var r,n,i,s,o,a;const{__scopePopper:c,side:l="bottom",sideOffset:f=0,align:u="center",alignOffset:h=0,arrowPadding:g=0,avoidCollisions:y=!0,collisionBoundary:m=[],collisionPadding:S=0,sticky:E="partial",hideWhenDetached:A=!1,updatePositionStrategy:P="optimized",onPlaced:N,...L}=t,V=yK(Uk,c),[I,U]=T.useState(null),ie=Rr(e,xe=>U(xe)),[ae,K]=T.useState(null),R=H8(ae),D=(R==null?void 0:R.width)??0,v=(R==null?void 0:R.height)??0,b=l+(u!=="center"?"-"+u:""),M=typeof S=="number"?S:{top:0,right:0,bottom:0,left:0,...S},B=Array.isArray(m)?m:[m],x=B.length>0,C={padding:M,boundary:B.filter(Ome),altBoundary:x},{refs:w,floatingStyles:k,placement:O,isPositioned:G,middlewareData:oe}=mme({strategy:"fixed",placement:b,whileElementsMounted:(...xe)=>fme(...xe,{animationFrame:P==="always"}),elements:{reference:V.anchor},middleware:[wme({mainAxis:f+v,alignmentAxis:h}),y&&xme({mainAxis:!0,crossAxis:!1,limiter:E==="partial"?Eme():void 0,...C}),y&&Cme({...C}),Ame({...C,apply:({elements:xe,rects:_e,availableWidth:Me,availableHeight:Ke})=>{const{width:ze,height:Je}=_e.reference,Xe=xe.floating.style;Xe.setProperty("--radix-popper-available-width",`${Me}px`),Xe.setProperty("--radix-popper-available-height",`${Ke}px`),Xe.setProperty("--radix-popper-anchor-width",`${ze}px`),Xe.setProperty("--radix-popper-anchor-height",`${Je}px`)}}),ae&&_me({element:ae,padding:g}),Dme({arrowWidth:D,arrowHeight:v}),A&&Sme({strategy:"referenceHidden",...C})]}),[$,X]=AK(O),W=Fs(N);cs(()=>{G&&(W==null||W())},[G,W]);const Z=(r=oe.arrow)==null?void 0:r.x,te=(n=oe.arrow)==null?void 0:n.y,F=((i=oe.arrow)==null?void 0:i.centerOffset)!==0,[ee,fe]=T.useState();return cs(()=>{I&&fe(window.getComputedStyle(I).zIndex)},[I]),Y.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...k,transform:G?k.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(s=oe.transformOrigin)==null?void 0:s.x,(o=oe.transformOrigin)==null?void 0:o.y].join(" "),...((a=oe.hide)==null?void 0:a.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:Y.jsx(kme,{scope:c,placedSide:$,onArrowChange:K,arrowX:Z,arrowY:te,shouldHideArrow:F,children:Y.jsx(jt.div,{"data-side":$,"data-align":X,...L,ref:ie,style:{...L.style,animation:G?void 0:"none"}})})})});xK.displayName=Uk;var EK="PopperArrow",Mme={top:"bottom",right:"left",bottom:"top",left:"right"},CK=T.forwardRef(function(e,r){const{__scopePopper:n,...i}=e,s=Rme(EK,n),o=Mme[s.placedSide];return Y.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:Y.jsx(Tme,{...i,ref:r,style:{...i.style,display:"block"}})})});CK.displayName=EK;function Ome(t){return t!==null}var Dme=t=>({name:"transformOrigin",options:t,fn(e){var r,n,i;const{placement:s,rects:o,middlewareData:a}=e,l=((r=a.arrow)==null?void 0:r.centerOffset)!==0,f=l?0:t.arrowWidth,u=l?0:t.arrowHeight,[h,g]=AK(s),y={start:"0%",center:"50%",end:"100%"}[g],m=(((n=a.arrow)==null?void 0:n.x)??0)+f/2,S=(((i=a.arrow)==null?void 0:i.y)??0)+u/2;let E="",A="";return h==="bottom"?(E=l?y:`${m}px`,A=`${-u}px`):h==="top"?(E=l?y:`${m}px`,A=`${o.floating.height+u}px`):h==="right"?(E=`${-u}px`,A=l?y:`${S}px`):h==="left"&&(E=`${o.floating.width+u}px`,A=l?y:`${S}px`),{data:{x:E,y:A}}}});function AK(t){const[e,r="center"]=t.split("-");return[e,r]}var $k=mK,qk=wK,Vk=xK,zk=CK,Nme="Portal",Hw=T.forwardRef((t,e)=>{var r;const{container:n,...i}=t,[s,o]=T.useState(!1);cs(()=>o(!0),[]);const a=n||s&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return a?fG.createPortal(Y.jsx(jt.div,{...i,ref:e}),a):null});Hw.displayName=Nme;var $9="rovingFocusGroup.onEntryFocus",Bme={bubbles:!1,cancelable:!0},J8="RovingFocusGroup",[D_,SK,Lme]=W8(J8),[Fme,Xy]=Us(J8,[Lme]),[jme,Ume]=Fme(J8),_K=T.forwardRef((t,e)=>Y.jsx(D_.Provider,{scope:t.__scopeRovingFocusGroup,children:Y.jsx(D_.Slot,{scope:t.__scopeRovingFocusGroup,children:Y.jsx($me,{...t,ref:e})})}));_K.displayName=J8;var $me=T.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:f=!1,...u}=t,h=T.useRef(null),g=Rr(e,h),y=Vw(s),[m=null,S]=sc({prop:o,defaultProp:a,onChange:c}),[E,A]=T.useState(!1),P=Fs(l),N=SK(r),L=T.useRef(!1),[V,I]=T.useState(0);return T.useEffect(()=>{const U=h.current;if(U)return U.addEventListener($9,P),()=>U.removeEventListener($9,P)},[P]),Y.jsx(jme,{scope:r,orientation:n,dir:y,loop:i,currentTabStopId:m,onItemFocus:T.useCallback(U=>S(U),[S]),onItemShiftTab:T.useCallback(()=>A(!0),[]),onFocusableItemAdd:T.useCallback(()=>I(U=>U+1),[]),onFocusableItemRemove:T.useCallback(()=>I(U=>U-1),[]),children:Y.jsx(jt.div,{tabIndex:E||V===0?-1:0,"data-orientation":n,...u,ref:g,style:{outline:"none",...t.style},onMouseDown:nt(t.onMouseDown,()=>{L.current=!0}),onFocus:nt(t.onFocus,U=>{const ie=!L.current;if(U.target===U.currentTarget&&ie&&!E){const ae=new CustomEvent($9,Bme);if(U.currentTarget.dispatchEvent(ae),!ae.defaultPrevented){const K=N().filter(M=>M.focusable),R=K.find(M=>M.active),D=K.find(M=>M.id===m),b=[R,D,...K].filter(Boolean).map(M=>M.ref.current);PK(b,f)}}L.current=!1}),onBlur:nt(t.onBlur,()=>A(!1))})})}),IK="RovingFocusGroupItem",TK=T.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=t,a=ec(),c=s||a,l=Ume(IK,r),f=l.currentTabStopId===c,u=SK(r),{onFocusableItemAdd:h,onFocusableItemRemove:g}=l;return T.useEffect(()=>{if(n)return h(),()=>g()},[n,h,g]),Y.jsx(D_.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:Y.jsx(jt.span,{tabIndex:f?0:-1,"data-orientation":l.orientation,...o,ref:e,onMouseDown:nt(t.onMouseDown,y=>{n?l.onItemFocus(c):y.preventDefault()}),onFocus:nt(t.onFocus,()=>l.onItemFocus(c)),onKeyDown:nt(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){l.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const m=zme(y,l.orientation,l.dir);if(m!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let E=u().filter(A=>A.focusable).map(A=>A.ref.current);if(m==="last")E.reverse();else if(m==="prev"||m==="next"){m==="prev"&&E.reverse();const A=E.indexOf(y.currentTarget);E=l.loop?Hme(E,A+1):E.slice(A+1)}setTimeout(()=>PK(E))}})})})});TK.displayName=IK;var qme={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Vme(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function zme(t,e,r){const n=Vme(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return qme[n]}function PK(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function Hme(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var Hk=_K,Gk=TK,Gme=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rv=new WeakMap,U3=new WeakMap,$3={},q9=0,kK=function(t){return t&&(t.host||kK(t.parentNode))},Wme=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=kK(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},Kme=function(t,e,r,n){var i=Wme(e,Array.isArray(t)?t:[t]);$3[r]||($3[r]=new WeakMap);var s=$3[r],o=[],a=new Set,c=new Set(i),l=function(u){!u||a.has(u)||(a.add(u),l(u.parentNode))};i.forEach(l);var f=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(a.has(h))f(h);else try{var g=h.getAttribute(n),y=g!==null&&g!=="false",m=(rv.get(h)||0)+1,S=(s.get(h)||0)+1;rv.set(h,m),s.set(h,S),o.push(h),m===1&&y&&U3.set(h,!0),S===1&&h.setAttribute(r,"true"),y||h.setAttribute(n,"true")}catch(E){console.error("aria-hidden: cannot operate on ",h,E)}})};return f(e),a.clear(),q9++,function(){o.forEach(function(u){var h=rv.get(u)-1,g=s.get(u)-1;rv.set(u,h),s.set(u,g),h||(U3.has(u)||u.removeAttribute(n),U3.delete(u)),g||u.removeAttribute(r)}),q9--,q9||(rv=new WeakMap,rv=new WeakMap,U3=new WeakMap,$3={})}},Wk=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=Gme(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),Kme(n,i,r,"aria-hidden")):function(){return null}},Dl=function(){return Dl=Object.assign||function(e){for(var r,n=1,i=arguments.length;n"u")return ube;var e=dbe(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},pbe=DK(),ig="data-scroll-locked",vbe=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),` .`.concat(Qme,` { overflow: hidden `).concat(n,`; padding-right: `).concat(a,"px ").concat(n,`; @@ -98,7 +98,7 @@ Error generating stack: `+s.message+` `)},wF=function(){var t=parseInt(document.body.getAttribute(ig)||"0",10);return isFinite(t)?t:0},gbe=function(){T.useEffect(function(){return document.body.setAttribute(ig,(wF()+1).toString()),function(){var t=wF()-1;t<=0?document.body.removeAttribute(ig):document.body.setAttribute(ig,t.toString())}},[])},ybe=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,i=n===void 0?"margin":n;gbe();var s=T.useMemo(function(){return hbe(i)},[i]);return T.createElement(pbe,{styles:vbe(s,!e,i,r?"":"!important")})},N_=!1;if(typeof window<"u")try{var q3=Object.defineProperty({},"passive",{get:function(){return N_=!0,!0}});window.addEventListener("test",q3,q3),window.removeEventListener("test",q3,q3)}catch{N_=!1}var nv=N_?{passive:!1}:!1,mbe=function(t){return t.tagName==="TEXTAREA"},NK=function(t,e){var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!mbe(t)&&r[e]==="visible")},bbe=function(t){return NK(t,"overflowY")},wbe=function(t){return NK(t,"overflowX")},xF=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=BK(t,n);if(i){var s=LK(t,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},xbe=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Ebe=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},BK=function(t,e){return t==="v"?bbe(e):wbe(e)},LK=function(t,e){return t==="v"?xbe(e):Ebe(e)},Cbe=function(t,e){return t==="h"&&e==="rtl"?-1:1},Abe=function(t,e,r,n,i){var s=Cbe(t,window.getComputedStyle(e).direction),o=s*n,a=r.target,c=e.contains(a),l=!1,f=o>0,u=0,h=0;do{var g=LK(t,a),y=g[0],m=g[1],S=g[2],E=m-S-s*y;(y||E)&&BK(t,a)&&(u+=E,h+=y),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(e.contains(a)||e===a));return(f&&(Math.abs(u)<1||!i)||!f&&(Math.abs(h)<1||!i))&&(l=!0),l},V3=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},EF=function(t){return[t.deltaX,t.deltaY]},CF=function(t){return t&&"current"in t?t.current:t},Sbe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},_be=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},Ibe=0,iv=[];function Tbe(t){var e=T.useRef([]),r=T.useRef([0,0]),n=T.useRef(),i=T.useState(Ibe++)[0],s=T.useState(DK)[0],o=T.useRef(t);T.useEffect(function(){o.current=t},[t]),T.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=Yme([t.lockRef.current],(t.shards||[]).map(CF)).filter(Boolean);return m.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=T.useCallback(function(m,S){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var E=V3(m),A=r.current,P="deltaX"in m?m.deltaX:A[0]-E[0],N="deltaY"in m?m.deltaY:A[1]-E[1],L,V=m.target,I=Math.abs(P)>Math.abs(N)?"h":"v";if("touches"in m&&I==="h"&&V.type==="range")return!1;var U=xF(I,V);if(!U)return!0;if(U?L=I:(L=I==="v"?"h":"v",U=xF(I,V)),!U)return!1;if(!n.current&&"changedTouches"in m&&(P||N)&&(n.current=L),!L)return!0;var ie=n.current||L;return Abe(ie,S,m,ie==="h"?P:N,!0)},[]),c=T.useCallback(function(m){var S=m;if(!(!iv.length||iv[iv.length-1]!==s)){var E="deltaY"in S?EF(S):V3(S),A=e.current.filter(function(L){return L.name===S.type&&(L.target===S.target||S.target===L.shadowParent)&&Sbe(L.delta,E)})[0];if(A&&A.should){S.cancelable&&S.preventDefault();return}if(!A){var P=(o.current.shards||[]).map(CF).filter(Boolean).filter(function(L){return L.contains(S.target)}),N=P.length>0?a(S,P[0]):!o.current.noIsolation;N&&S.cancelable&&S.preventDefault()}}},[]),l=T.useCallback(function(m,S,E,A){var P={name:m,delta:S,target:E,should:A,shadowParent:Pbe(E)};e.current.push(P),setTimeout(function(){e.current=e.current.filter(function(N){return N!==P})},1)},[]),f=T.useCallback(function(m){r.current=V3(m),n.current=void 0},[]),u=T.useCallback(function(m){l(m.type,EF(m),m.target,a(m,t.lockRef.current))},[]),h=T.useCallback(function(m){l(m.type,V3(m),m.target,a(m,t.lockRef.current))},[]);T.useEffect(function(){return iv.push(s),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,nv),document.addEventListener("touchmove",c,nv),document.addEventListener("touchstart",f,nv),function(){iv=iv.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,nv),document.removeEventListener("touchmove",c,nv),document.removeEventListener("touchstart",f,nv)}},[]);var g=t.removeScrollBar,y=t.inert;return T.createElement(T.Fragment,null,y?T.createElement(s,{styles:_be(i)}):null,g?T.createElement(ybe,{gapMode:t.gapMode}):null)}function Pbe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const kbe=ibe(OK,Tbe);var X8=T.forwardRef(function(t,e){return T.createElement(Z8,Dl({},t,{ref:e,sideCar:kbe}))});X8.classNames=Z8.classNames;var B_=["Enter"," "],Rbe=["ArrowDown","PageUp","Home"],FK=["ArrowUp","PageDown","End"],Mbe=[...Rbe,...FK],Obe={ltr:[...B_,"ArrowRight"],rtl:[...B_,"ArrowLeft"]},Dbe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Gw="Menu",[H2,Nbe,Bbe]=W8(Gw),[gp,jK]=Us(Gw,[Bbe,Zy,Xy]),eE=Zy(),UK=Xy(),[Lbe,yp]=gp(Gw),[Fbe,Ww]=gp(Gw),$K=t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=t,a=eE(e),[c,l]=T.useState(null),f=T.useRef(!1),u=Fs(s),h=Vw(i);return T.useEffect(()=>{const g=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),Y.jsx($k,{...a,children:Y.jsx(Lbe,{scope:e,open:r,onOpenChange:u,content:c,onContentChange:l,children:Y.jsx(Fbe,{scope:e,onClose:T.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:h,modal:o,children:n})})})};$K.displayName=Gw;var jbe="MenuAnchor",Kk=T.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,i=eE(r);return Y.jsx(qk,{...i,...n,ref:e})});Kk.displayName=jbe;var Yk="MenuPortal",[Ube,qK]=gp(Yk,{forceMount:void 0}),VK=t=>{const{__scopeMenu:e,forceMount:r,children:n,container:i}=t,s=yp(Yk,e);return Y.jsx(Ube,{scope:e,forceMount:r,children:Y.jsx(lo,{present:r||s.open,children:Y.jsx(Hw,{asChild:!0,container:i,children:n})})})};VK.displayName=Yk;var tc="MenuContent",[$be,Qk]=gp(tc),zK=T.forwardRef((t,e)=>{const r=qK(tc,t.__scopeMenu),{forceMount:n=r.forceMount,...i}=t,s=yp(tc,t.__scopeMenu),o=Ww(tc,t.__scopeMenu);return Y.jsx(H2.Provider,{scope:t.__scopeMenu,children:Y.jsx(lo,{present:n||s.open,children:Y.jsx(H2.Slot,{scope:t.__scopeMenu,children:o.modal?Y.jsx(qbe,{...i,ref:e}):Y.jsx(Vbe,{...i,ref:e})})})})}),qbe=T.forwardRef((t,e)=>{const r=yp(tc,t.__scopeMenu),n=T.useRef(null),i=Rr(e,n);return T.useEffect(()=>{const s=n.current;if(s)return Wk(s)},[]),Y.jsx(Jk,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:nt(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Vbe=T.forwardRef((t,e)=>{const r=yp(tc,t.__scopeMenu);return Y.jsx(Jk,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Jk=T.forwardRef((t,e)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:h,onDismiss:g,disableOutsideScroll:y,...m}=t,S=yp(tc,r),E=Ww(tc,r),A=eE(r),P=UK(r),N=Nbe(r),[L,V]=T.useState(null),I=T.useRef(null),U=Rr(e,I,S.onContentChange),ie=T.useRef(0),ae=T.useRef(""),K=T.useRef(0),R=T.useRef(null),D=T.useRef("right"),v=T.useRef(0),b=y?X8:T.Fragment,M=y?{as:G1,allowPinchZoom:!0}:void 0,B=C=>{var w,k;const O=ae.current+C,G=N().filter(te=>!te.disabled),oe=document.activeElement,$=(w=G.find(te=>te.ref.current===oe))==null?void 0:w.textValue,X=G.map(te=>te.textValue),W=t2e(X,O,$),Z=(k=G.find(te=>te.textValue===W))==null?void 0:k.ref.current;(function te(F){ae.current=F,window.clearTimeout(ie.current),F!==""&&(ie.current=window.setTimeout(()=>te(""),1e3))})(O),Z&&setTimeout(()=>Z.focus())};T.useEffect(()=>()=>window.clearTimeout(ie.current),[]),Mk();const x=T.useCallback(C=>{var w,k;return D.current===((w=R.current)==null?void 0:w.side)&&n2e(C,(k=R.current)==null?void 0:k.area)},[]);return Y.jsx($be,{scope:r,searchRef:ae,onItemEnter:T.useCallback(C=>{x(C)&&C.preventDefault()},[x]),onItemLeave:T.useCallback(C=>{var w;x(C)||((w=I.current)==null||w.focus(),V(null))},[x]),onTriggerLeave:T.useCallback(C=>{x(C)&&C.preventDefault()},[x]),pointerGraceTimerRef:K,onPointerGraceIntentChange:T.useCallback(C=>{R.current=C},[]),children:Y.jsx(b,{...M,children:Y.jsx(K8,{asChild:!0,trapped:i,onMountAutoFocus:nt(s,C=>{var w;C.preventDefault(),(w=I.current)==null||w.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:Y.jsx(Yy,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:h,onDismiss:g,children:Y.jsx(Hk,{asChild:!0,...P,dir:E.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:V,onEntryFocus:nt(c,C=>{E.isUsingKeyboardRef.current||C.preventDefault()}),preventScrollOnEntryFocus:!0,children:Y.jsx(Vk,{role:"menu","aria-orientation":"vertical","data-state":oY(S.open),"data-radix-menu-content":"",dir:E.dir,...A,...m,ref:U,style:{outline:"none",...m.style},onKeyDown:nt(m.onKeyDown,C=>{const k=C.target.closest("[data-radix-menu-content]")===C.currentTarget,O=C.ctrlKey||C.altKey||C.metaKey,G=C.key.length===1;k&&(C.key==="Tab"&&C.preventDefault(),!O&&G&&B(C.key));const oe=I.current;if(C.target!==oe||!Mbe.includes(C.key))return;C.preventDefault();const X=N().filter(W=>!W.disabled).map(W=>W.ref.current);FK.includes(C.key)&&X.reverse(),Xbe(X)}),onBlur:nt(t.onBlur,C=>{C.currentTarget.contains(C.target)||(window.clearTimeout(ie.current),ae.current="")}),onPointerMove:nt(t.onPointerMove,G2(C=>{const w=C.target,k=v.current!==C.clientX;if(C.currentTarget.contains(w)&&k){const O=C.clientX>v.current?"right":"left";D.current=O,v.current=C.clientX}}))})})})})})})});zK.displayName=tc;var zbe="MenuGroup",Zk=T.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return Y.jsx(jt.div,{role:"group",...n,ref:e})});Zk.displayName=zbe;var Hbe="MenuLabel",HK=T.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return Y.jsx(jt.div,{...n,ref:e})});HK.displayName=Hbe;var p4="MenuItem",AF="menu.itemSelect",tE=T.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...i}=t,s=T.useRef(null),o=Ww(p4,t.__scopeMenu),a=Qk(p4,t.__scopeMenu),c=Rr(e,s),l=T.useRef(!1),f=()=>{const u=s.current;if(!r&&u){const h=new CustomEvent(AF,{bubbles:!0,cancelable:!0});u.addEventListener(AF,g=>n==null?void 0:n(g),{once:!0}),Ek(u,h),h.defaultPrevented?l.current=!1:o.onClose()}};return Y.jsx(GK,{...i,ref:c,disabled:r,onClick:nt(t.onClick,f),onPointerDown:u=>{var h;(h=t.onPointerDown)==null||h.call(t,u),l.current=!0},onPointerUp:nt(t.onPointerUp,u=>{var h;l.current||(h=u.currentTarget)==null||h.click()}),onKeyDown:nt(t.onKeyDown,u=>{const h=a.searchRef.current!=="";r||h&&u.key===" "||B_.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});tE.displayName=p4;var GK=T.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=t,o=Qk(p4,r),a=UK(r),c=T.useRef(null),l=Rr(e,c),[f,u]=T.useState(!1),[h,g]=T.useState("");return T.useEffect(()=>{const y=c.current;y&&g((y.textContent??"").trim())},[s.children]),Y.jsx(H2.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:Y.jsx(Gk,{asChild:!0,...a,focusable:!n,children:Y.jsx(jt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:l,onPointerMove:nt(t.onPointerMove,G2(y=>{n?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:nt(t.onPointerLeave,G2(y=>o.onItemLeave(y))),onFocus:nt(t.onFocus,()=>u(!0)),onBlur:nt(t.onBlur,()=>u(!1))})})})}),Gbe="MenuCheckboxItem",WK=T.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...i}=t;return Y.jsx(ZK,{scope:t.__scopeMenu,checked:r,children:Y.jsx(tE,{role:"menuitemcheckbox","aria-checked":v4(r)?"mixed":r,...i,ref:e,"data-state":eR(r),onSelect:nt(i.onSelect,()=>n==null?void 0:n(v4(r)?!0:!r),{checkForDefaultPrevented:!1})})})});WK.displayName=Gbe;var KK="MenuRadioGroup",[Wbe,Kbe]=gp(KK,{value:void 0,onValueChange:()=>{}}),YK=T.forwardRef((t,e)=>{const{value:r,onValueChange:n,...i}=t,s=Fs(n);return Y.jsx(Wbe,{scope:t.__scopeMenu,value:r,onValueChange:s,children:Y.jsx(Zk,{...i,ref:e})})});YK.displayName=KK;var QK="MenuRadioItem",JK=T.forwardRef((t,e)=>{const{value:r,...n}=t,i=Kbe(QK,t.__scopeMenu),s=r===i.value;return Y.jsx(ZK,{scope:t.__scopeMenu,checked:s,children:Y.jsx(tE,{role:"menuitemradio","aria-checked":s,...n,ref:e,"data-state":eR(s),onSelect:nt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});JK.displayName=QK;var Xk="MenuItemIndicator",[ZK,Ybe]=gp(Xk,{checked:!1}),XK=T.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...i}=t,s=Ybe(Xk,r);return Y.jsx(lo,{present:n||v4(s.checked)||s.checked===!0,children:Y.jsx(jt.span,{...i,ref:e,"data-state":eR(s.checked)})})});XK.displayName=Xk;var Qbe="MenuSeparator",eY=T.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return Y.jsx(jt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});eY.displayName=Qbe;var Jbe="MenuArrow",tY=T.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,i=eE(r);return Y.jsx(zk,{...i,...n,ref:e})});tY.displayName=Jbe;var Zbe="MenuSub",[pGe,rY]=gp(Zbe),Tb="MenuSubTrigger",nY=T.forwardRef((t,e)=>{const r=yp(Tb,t.__scopeMenu),n=Ww(Tb,t.__scopeMenu),i=rY(Tb,t.__scopeMenu),s=Qk(Tb,t.__scopeMenu),o=T.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,l={__scopeMenu:t.__scopeMenu},f=T.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return T.useEffect(()=>f,[f]),T.useEffect(()=>{const u=a.current;return()=>{window.clearTimeout(u),c(null)}},[a,c]),Y.jsx(Kk,{asChild:!0,...l,children:Y.jsx(GK,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":oY(r.open),...t,ref:V8(e,i.onTriggerChange),onClick:u=>{var h;(h=t.onClick)==null||h.call(t,u),!(t.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:nt(t.onPointerMove,G2(u=>{s.onItemEnter(u),!u.defaultPrevented&&!t.disabled&&!r.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),f()},100))})),onPointerLeave:nt(t.onPointerLeave,G2(u=>{var h,g;f();const y=(h=r.content)==null?void 0:h.getBoundingClientRect();if(y){const m=(g=r.content)==null?void 0:g.dataset.side,S=m==="right",E=S?-5:5,A=y[S?"left":"right"],P=y[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:u.clientX+E,y:u.clientY},{x:A,y:y.top},{x:P,y:y.top},{x:P,y:y.bottom},{x:A,y:y.bottom}],side:m}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(u),u.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:nt(t.onKeyDown,u=>{var h;const g=s.searchRef.current!=="";t.disabled||g&&u.key===" "||Obe[n.dir].includes(u.key)&&(r.onOpenChange(!0),(h=r.content)==null||h.focus(),u.preventDefault())})})})});nY.displayName=Tb;var iY="MenuSubContent",sY=T.forwardRef((t,e)=>{const r=qK(tc,t.__scopeMenu),{forceMount:n=r.forceMount,...i}=t,s=yp(tc,t.__scopeMenu),o=Ww(tc,t.__scopeMenu),a=rY(iY,t.__scopeMenu),c=T.useRef(null),l=Rr(e,c);return Y.jsx(H2.Provider,{scope:t.__scopeMenu,children:Y.jsx(lo,{present:n||s.open,children:Y.jsx(H2.Slot,{scope:t.__scopeMenu,children:Y.jsx(Jk,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:l,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var u;o.isUsingKeyboardRef.current&&((u=c.current)==null||u.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:nt(t.onFocusOutside,f=>{f.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:nt(t.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:nt(t.onKeyDown,f=>{var u;const h=f.currentTarget.contains(f.target),g=Dbe[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(u=a.trigger)==null||u.focus(),f.preventDefault())})})})})})});sY.displayName=iY;function oY(t){return t?"open":"closed"}function v4(t){return t==="indeterminate"}function eR(t){return v4(t)?"indeterminate":t?"checked":"unchecked"}function Xbe(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function e2e(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function t2e(t,e,r){const i=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,s=r?t.indexOf(r):-1;let o=e2e(t,Math.max(s,0));i.length===1&&(o=o.filter(l=>l!==r));const c=o.find(l=>l.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function r2e(t,e){const{x:r,y:n}=t;let i=!1;for(let s=0,o=e.length-1;sn!=f>n&&r<(l-a)*(n-c)/(f-c)+a&&(i=!i)}return i}function n2e(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return r2e(r,e)}function G2(t){return e=>e.pointerType==="mouse"?t(e):void 0}var i2e=$K,s2e=Kk,o2e=VK,a2e=zK,c2e=Zk,l2e=HK,f2e=tE,u2e=WK,d2e=YK,h2e=JK,p2e=XK,v2e=eY,g2e=tY,y2e=nY,m2e=sY,tR="DropdownMenu",[b2e,vGe]=Us(tR,[jK]),fo=jK(),[w2e,aY]=b2e(tR),x2e=t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,c=fo(e),l=T.useRef(null),[f=!1,u]=sc({prop:i,defaultProp:s,onChange:o});return Y.jsx(w2e,{scope:e,triggerId:ec(),triggerRef:l,contentId:ec(),open:f,onOpenChange:u,onOpenToggle:T.useCallback(()=>u(h=>!h),[u]),modal:a,children:Y.jsx(i2e,{...c,open:f,onOpenChange:u,dir:n,modal:a,children:r})})};x2e.displayName=tR;var cY="DropdownMenuTrigger",E2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=t,s=aY(cY,r),o=fo(r);return Y.jsx(s2e,{asChild:!0,...o,children:Y.jsx(jt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:V8(e,s.triggerRef),onPointerDown:nt(t.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:nt(t.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});E2e.displayName=cY;var C2e="DropdownMenuPortal",A2e=t=>{const{__scopeDropdownMenu:e,...r}=t,n=fo(e);return Y.jsx(o2e,{...n,...r})};A2e.displayName=C2e;var lY="DropdownMenuContent",S2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=aY(lY,r),s=fo(r),o=T.useRef(!1);return Y.jsx(a2e,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:e,onCloseAutoFocus:nt(t.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:nt(t.onInteractOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,f=c.button===2||l;(!i.modal||f)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});S2e.displayName=lY;var _2e="DropdownMenuGroup",I2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(c2e,{...i,...n,ref:e})});I2e.displayName=_2e;var T2e="DropdownMenuLabel",P2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(l2e,{...i,...n,ref:e})});P2e.displayName=T2e;var k2e="DropdownMenuItem",R2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(f2e,{...i,...n,ref:e})});R2e.displayName=k2e;var M2e="DropdownMenuCheckboxItem",fY=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(u2e,{...i,...n,ref:e})});fY.displayName=M2e;var O2e="DropdownMenuRadioGroup",D2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(d2e,{...i,...n,ref:e})});D2e.displayName=O2e;var N2e="DropdownMenuRadioItem",uY=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(h2e,{...i,...n,ref:e})});uY.displayName=N2e;var B2e="DropdownMenuItemIndicator",dY=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(p2e,{...i,...n,ref:e})});dY.displayName=B2e;var L2e="DropdownMenuSeparator",F2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(v2e,{...i,...n,ref:e})});F2e.displayName=L2e;var j2e="DropdownMenuArrow",U2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(g2e,{...i,...n,ref:e})});U2e.displayName=j2e;var $2e="DropdownMenuSubTrigger",q2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(y2e,{...i,...n,ref:e})});q2e.displayName=$2e;var V2e="DropdownMenuSubContent",z2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(m2e,{...i,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});z2e.displayName=V2e;var H2e=fY,G2e=uY,hY=dY,pY="_1k2mbvi4 _1k2mbvi3 fyvr11h4 fyvr11hs fyvr11fs fyvr11gg fyvr1zs fyvr111g fyvr1v0 fyvr1x4 fyvr1310 fyvr130u fyvr11l8 fyvr11ow fyvr11o4 fyvr12zf fyvr11rc fyvr11m4 fyvr12wf",vY="_1k2mbvi5";const W2e=({children:t})=>Y.jsx(hY,{className:vY,children:t});T.forwardRef(({className:t,children:e,...r},n)=>Y.jsxs(H2e,{className:Li(pY,t),...r,ref:n,children:[Y.jsx(W2e,{children:Y.jsx(qw,{size:"xs"})}),Y.jsx(Te,{variant:"small",children:e})]}));T.forwardRef(({className:t,children:e,...r},n)=>Y.jsxs(G2e,{className:Li(pY,t),...r,ref:n,children:[Y.jsx(hY,{className:vY,children:Y.jsx(Te,{children:"•"})}),Y.jsx(Te,{variant:"small",children:e})]}));const mp=T.forwardRef((t,e)=>{const{icon:r,size:n="md",...i}=t;return Y.jsx(Kt,{leftIcon:r,size:n,flexShrink:"0",ref:e,...i})}),K2e=(...t)=>e=>t.forEach(r=>{r&&(typeof r=="function"?r(e):r.current=e)});var Y2e="_1hq71vk1 _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8 _1hq71vk0 fyvr11eg fyvr11es fyvr11f4 fyvr11fg fyvr1vc fyvr1xg fyvr1zk fyvr111o fyvr12rf fyvr12k3 fyvr125f fyvr12cr fyvr12rx fyvr12kl fyvr125x fyvr12d9 fyvr11ow fyvr11lk fyvr11mk fyvr11nk fyvr1h4 fyvr11m4",Q2e=jn({defaultClassName:"_1hq71vk5",variantClassNames:{borderRadius:{xs:"_1hq71vk6 _1hq71vk2 fyvr11h4 fyvr11hs fyvr11fs fyvr11gg",sm:"_1hq71vk7 _1hq71vk3 fyvr11h8 fyvr11hw fyvr11fw fyvr11gk",md:"_1hq71vk8 _1hq71vk4 fyvr11hc fyvr11i0 fyvr11g0 fyvr11go"}},defaultVariants:{},compoundVariants:[]}),J2e="_1hq71vka _1hq71vk9 fyvr130x fyvr130r fyvr11lw fyvr12zr fyvr1m0 fyvr1qg fyvr1o8 fyvr1so";const Z2e={png:".png,image/png",jpeg:".jpeg,image/jpeg",jpg:".jpg,image/jpg",images:"image/*, video/*",pdf:".pdf,application/pdf",mp4:".mp4,video/mp4",csv:".csv,text/csv",json:".json,application/json"};T.forwardRef((t,e)=>{const{borderRadius:r="md",description:n,disabled:i=!1,id:s,label:o="",labelLocation:a="hidden",name:c,onValueChange:l,placeholder:f="Upload a file",validExtensions:u,...h}=t,g=T.useRef(null),y=K2e(g,e),[m,S]=T.useState(null),E=P=>{const N=P.currentTarget.files;if(!N||!N[0])return;const L=N[0],V=L.name,I=L.size/1e3;S({name:V,size:I,extension:V.split(".").pop()??""}),l==null||l(L)},A=u.map(P=>Z2e[P]).join(",");return Y.jsx(Ky,{description:n,disabled:i,display:"grid",id:s??c,label:o,labelLocation:a,children:Y.jsxs(ye,{width:"full",minWidth:"0",justifyContent:m?"space-between":"flex-start",gap:"2",color:m?"text100":"text50",className:Li(Y2e,Q2e({borderRadius:r})),children:[m?Y.jsxs(ye,{flexDirection:"row",gap:"2",alignItems:"center",minWidth:"0",children:[Y.jsx(Te,{ellipsis:!0,children:m.name}),Y.jsxs(Te,{color:"text50",variant:"xsmall",whiteSpace:"nowrap",children:[m.size.toFixed(2)," kb"]})]}):Y.jsx(Te,{ellipsis:!0,children:f}),Y.jsx(ye,{accept:A,as:"input",className:J2e,cursor:"pointer",disabled:i,id:s??c,name:c,onChange:E,ref:y,type:"file",...h}),m&&Y.jsx(mp,{cursor:"pointer",icon:Tu,size:"xs",onClick:P=>{var N;P.preventDefault(),P.stopPropagation(),(N=g.current)!=null&&N.value&&(g.current.value=""),l==null||l(null),S(null)},zIndex:"10"})]})})});var X2e=jn({defaultClassName:"_1bhyzin0",variantClassNames:{size:{xs:"_1bhyzin1",sm:"_1bhyzin2",md:"_1bhyzin3",lg:"_1bhyzin4",xl:"_1bhyzin5"}},defaultVariants:{},compoundVariants:[]});const L_=1e3,sg=64,G9=sg/2,W9=(t,e=L_)=>t%e/(L_/sg),sv=(t,e=0)=>{let r=3735928559^e,n=1103547991^e;for(let i=0,s;i>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&n)+(r>>>0)},ewe=(t,e,r)=>{const n=t%360,i=(t+120)%360,s=r%360;return{a:`hsl(${n}deg 100% 40%)`,b:`hsl(${i}deg 100% 50%)`,c:`hsl(${s}deg 100% 50%)`}},twe=(t,e)=>{const r=[];for(let n=0;n{const s=sg/10+W9(n.r,L_*1.5/(i+1));return{...ewe(n.a,n.b,n.c),x:W9(n.x),y:W9(n.y),r:s}})},rwe=T.memo(t=>{const{className:e,address:r,size:n="md",complexity:i=1,...s}=t,o=twe(r,i);return Y.jsxs(ye,{as:"svg",className:Li(e,X2e({size:n})),viewBox:`0 0 ${sg} ${sg}`,version:"1.1",flexShrink:"0",borderRadius:"circle",overflow:"hidden",xmlns:"http://www.w3.org/2000/svg",...s,children:[Y.jsxs("defs",{children:[Y.jsx("clipPath",{id:"circle-clip",children:Y.jsx("circle",{cx:G9,cy:G9,r:G9})}),Y.jsxs("filter",{id:"blur",x:"-10%",y:"-10%",width:"120%",height:"120%",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[Y.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),Y.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),Y.jsx("feGaussianBlur",{stdDeviation:sg/10,result:"effect1_foregroundBlur"})]}),Y.jsxs("linearGradient",{id:`gradient-background-${r}`,x1:"0",y1:"0",x2:"1",y2:"1",children:[Y.jsx("stop",{offset:"0",stopColor:o[0].c}),Y.jsx("stop",{offset:"1",stopColor:o[0].a})]}),o.map((a,c)=>Y.jsxs(T.Fragment,{children:[Y.jsxs("radialGradient",{id:`gradient-primary-${r}-${c}`,children:[Y.jsx("stop",{offset:"0",stopColor:a.a}),Y.jsx("stop",{offset:"1",stopColor:a.b})]}),Y.jsxs("radialGradient",{id:`gradient-secondary-${r}-${c}`,children:[Y.jsx("stop",{offset:"0",stopColor:a.c}),Y.jsx("stop",{offset:"1",stopColor:a.b})]})]},c))]}),Y.jsxs("g",{clipPath:"url(#circle-clip)",children:[Y.jsx("rect",{width:"100%",height:"100%",fill:`url(#gradient-background-${r})`}),Y.jsx("g",{filter:"url(#blur)",children:o.map((a,c)=>Y.jsxs(T.Fragment,{children:[Y.jsx("circle",{fill:`url(#gradient-primary-${r}-${c})`,cx:a.x,cy:a.y,r:a.r}),Y.jsx("circle",{fill:`url(#gradient-secondary-${r}-${c})`,cx:a.y,cy:a.x,r:a.r/2})]},c))})]})]})}),Fi=t=>{const{disableAnimation:e=!1,onLoad:r,...n}=t,[i,s]=T.useState(!1),o=a=>{s(!0),r==null||r(a)};return Y.jsx(ye,{as:k1.img,initial:e?void 0:{opacity:0},animate:e?void 0:{opacity:i?1:0},transition:{duration:.2},onLoad:e?void 0:o,...n})};var rR="Dialog",[gY,gGe]=Us(rR),[nwe,el]=gY(rR),yY=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=T.useRef(null),c=T.useRef(null),[l=!1,f]=sc({prop:n,defaultProp:i,onChange:s});return Y.jsx(nwe,{scope:e,triggerRef:a,contentRef:c,contentId:ec(),titleId:ec(),descriptionId:ec(),open:l,onOpenChange:f,onOpenToggle:T.useCallback(()=>f(u=>!u),[f]),modal:o,children:r})};yY.displayName=rR;var mY="DialogTrigger",iwe=T.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=el(mY,r),s=Rr(e,i.triggerRef);return Y.jsx(jt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":sR(i.open),...n,ref:s,onClick:nt(t.onClick,i.onOpenToggle)})});iwe.displayName=mY;var nR="DialogPortal",[swe,bY]=gY(nR,{forceMount:void 0}),wY=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:i}=t,s=el(nR,e);return Y.jsx(swe,{scope:e,forceMount:r,children:T.Children.map(n,o=>Y.jsx(lo,{present:r||s.open,children:Y.jsx(Hw,{asChild:!0,container:i,children:o})}))})};wY.displayName=nR;var g4="DialogOverlay",xY=T.forwardRef((t,e)=>{const r=bY(g4,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=el(g4,t.__scopeDialog);return s.modal?Y.jsx(lo,{present:n||s.open,children:Y.jsx(owe,{...i,ref:e})}):null});xY.displayName=g4;var owe=T.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=el(g4,r);return Y.jsx(X8,{as:G1,allowPinchZoom:!0,shards:[i.contentRef],children:Y.jsx(jt.div,{"data-state":sR(i.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),K1="DialogContent",EY=T.forwardRef((t,e)=>{const r=bY(K1,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=el(K1,t.__scopeDialog);return Y.jsx(lo,{present:n||s.open,children:s.modal?Y.jsx(awe,{...i,ref:e}):Y.jsx(cwe,{...i,ref:e})})});EY.displayName=K1;var awe=T.forwardRef((t,e)=>{const r=el(K1,t.__scopeDialog),n=T.useRef(null),i=Rr(e,r.contentRef,n);return T.useEffect(()=>{const s=n.current;if(s)return Wk(s)},[]),Y.jsx(CY,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nt(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:nt(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:nt(t.onFocusOutside,s=>s.preventDefault())})}),cwe=T.forwardRef((t,e)=>{const r=el(K1,t.__scopeDialog),n=T.useRef(!1),i=T.useRef(!1);return Y.jsx(CY,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),s.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:s=>{var o,a;(o=t.onInteractOutside)==null||o.call(t,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=s.target;((a=r.triggerRef.current)==null?void 0:a.contains(c))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),CY=T.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=el(K1,r),c=T.useRef(null),l=Rr(e,c);return Mk(),Y.jsxs(Y.Fragment,{children:[Y.jsx(K8,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:Y.jsx(Yy,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":sR(a.open),...o,ref:l,onDismiss:()=>a.onOpenChange(!1)})}),Y.jsxs(Y.Fragment,{children:[Y.jsx(uwe,{titleId:a.titleId}),Y.jsx(hwe,{contentRef:c,descriptionId:a.descriptionId})]})]})}),iR="DialogTitle",lwe=T.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=el(iR,r);return Y.jsx(jt.h2,{id:i.titleId,...n,ref:e})});lwe.displayName=iR;var AY="DialogDescription",fwe=T.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=el(AY,r);return Y.jsx(jt.p,{id:i.descriptionId,...n,ref:e})});fwe.displayName=AY;var SY="DialogClose",_Y=T.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=el(SY,r);return Y.jsx(jt.button,{type:"button",...n,ref:e,onClick:nt(t.onClick,()=>i.onOpenChange(!1))})});_Y.displayName=SY;function sR(t){return t?"open":"closed"}var IY="DialogTitleWarning",[yGe,TY]=Age(IY,{contentName:K1,titleName:iR,docsSlug:"dialog"}),uwe=({titleId:t})=>{const e=TY(IY),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. +`)},Ibe=0,iv=[];function Tbe(t){var e=T.useRef([]),r=T.useRef([0,0]),n=T.useRef(),i=T.useState(Ibe++)[0],s=T.useState(DK)[0],o=T.useRef(t);T.useEffect(function(){o.current=t},[t]),T.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=Yme([t.lockRef.current],(t.shards||[]).map(CF)).filter(Boolean);return m.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=T.useCallback(function(m,S){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var E=V3(m),A=r.current,P="deltaX"in m?m.deltaX:A[0]-E[0],N="deltaY"in m?m.deltaY:A[1]-E[1],L,V=m.target,I=Math.abs(P)>Math.abs(N)?"h":"v";if("touches"in m&&I==="h"&&V.type==="range")return!1;var U=xF(I,V);if(!U)return!0;if(U?L=I:(L=I==="v"?"h":"v",U=xF(I,V)),!U)return!1;if(!n.current&&"changedTouches"in m&&(P||N)&&(n.current=L),!L)return!0;var ie=n.current||L;return Abe(ie,S,m,ie==="h"?P:N,!0)},[]),c=T.useCallback(function(m){var S=m;if(!(!iv.length||iv[iv.length-1]!==s)){var E="deltaY"in S?EF(S):V3(S),A=e.current.filter(function(L){return L.name===S.type&&(L.target===S.target||S.target===L.shadowParent)&&Sbe(L.delta,E)})[0];if(A&&A.should){S.cancelable&&S.preventDefault();return}if(!A){var P=(o.current.shards||[]).map(CF).filter(Boolean).filter(function(L){return L.contains(S.target)}),N=P.length>0?a(S,P[0]):!o.current.noIsolation;N&&S.cancelable&&S.preventDefault()}}},[]),l=T.useCallback(function(m,S,E,A){var P={name:m,delta:S,target:E,should:A,shadowParent:Pbe(E)};e.current.push(P),setTimeout(function(){e.current=e.current.filter(function(N){return N!==P})},1)},[]),f=T.useCallback(function(m){r.current=V3(m),n.current=void 0},[]),u=T.useCallback(function(m){l(m.type,EF(m),m.target,a(m,t.lockRef.current))},[]),h=T.useCallback(function(m){l(m.type,V3(m),m.target,a(m,t.lockRef.current))},[]);T.useEffect(function(){return iv.push(s),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,nv),document.addEventListener("touchmove",c,nv),document.addEventListener("touchstart",f,nv),function(){iv=iv.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,nv),document.removeEventListener("touchmove",c,nv),document.removeEventListener("touchstart",f,nv)}},[]);var g=t.removeScrollBar,y=t.inert;return T.createElement(T.Fragment,null,y?T.createElement(s,{styles:_be(i)}):null,g?T.createElement(ybe,{gapMode:t.gapMode}):null)}function Pbe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const kbe=ibe(OK,Tbe);var X8=T.forwardRef(function(t,e){return T.createElement(Z8,Dl({},t,{ref:e,sideCar:kbe}))});X8.classNames=Z8.classNames;var B_=["Enter"," "],Rbe=["ArrowDown","PageUp","Home"],FK=["ArrowUp","PageDown","End"],Mbe=[...Rbe,...FK],Obe={ltr:[...B_,"ArrowRight"],rtl:[...B_,"ArrowLeft"]},Dbe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Gw="Menu",[H2,Nbe,Bbe]=W8(Gw),[gp,jK]=Us(Gw,[Bbe,Zy,Xy]),eE=Zy(),UK=Xy(),[Lbe,yp]=gp(Gw),[Fbe,Ww]=gp(Gw),$K=t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=t,a=eE(e),[c,l]=T.useState(null),f=T.useRef(!1),u=Fs(s),h=Vw(i);return T.useEffect(()=>{const g=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),Y.jsx($k,{...a,children:Y.jsx(Lbe,{scope:e,open:r,onOpenChange:u,content:c,onContentChange:l,children:Y.jsx(Fbe,{scope:e,onClose:T.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:h,modal:o,children:n})})})};$K.displayName=Gw;var jbe="MenuAnchor",Kk=T.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,i=eE(r);return Y.jsx(qk,{...i,...n,ref:e})});Kk.displayName=jbe;var Yk="MenuPortal",[Ube,qK]=gp(Yk,{forceMount:void 0}),VK=t=>{const{__scopeMenu:e,forceMount:r,children:n,container:i}=t,s=yp(Yk,e);return Y.jsx(Ube,{scope:e,forceMount:r,children:Y.jsx(lo,{present:r||s.open,children:Y.jsx(Hw,{asChild:!0,container:i,children:n})})})};VK.displayName=Yk;var tc="MenuContent",[$be,Qk]=gp(tc),zK=T.forwardRef((t,e)=>{const r=qK(tc,t.__scopeMenu),{forceMount:n=r.forceMount,...i}=t,s=yp(tc,t.__scopeMenu),o=Ww(tc,t.__scopeMenu);return Y.jsx(H2.Provider,{scope:t.__scopeMenu,children:Y.jsx(lo,{present:n||s.open,children:Y.jsx(H2.Slot,{scope:t.__scopeMenu,children:o.modal?Y.jsx(qbe,{...i,ref:e}):Y.jsx(Vbe,{...i,ref:e})})})})}),qbe=T.forwardRef((t,e)=>{const r=yp(tc,t.__scopeMenu),n=T.useRef(null),i=Rr(e,n);return T.useEffect(()=>{const s=n.current;if(s)return Wk(s)},[]),Y.jsx(Jk,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:nt(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Vbe=T.forwardRef((t,e)=>{const r=yp(tc,t.__scopeMenu);return Y.jsx(Jk,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Jk=T.forwardRef((t,e)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:h,onDismiss:g,disableOutsideScroll:y,...m}=t,S=yp(tc,r),E=Ww(tc,r),A=eE(r),P=UK(r),N=Nbe(r),[L,V]=T.useState(null),I=T.useRef(null),U=Rr(e,I,S.onContentChange),ie=T.useRef(0),ae=T.useRef(""),K=T.useRef(0),R=T.useRef(null),D=T.useRef("right"),v=T.useRef(0),b=y?X8:T.Fragment,M=y?{as:G1,allowPinchZoom:!0}:void 0,B=C=>{var w,k;const O=ae.current+C,G=N().filter(te=>!te.disabled),oe=document.activeElement,$=(w=G.find(te=>te.ref.current===oe))==null?void 0:w.textValue,X=G.map(te=>te.textValue),W=t2e(X,O,$),Z=(k=G.find(te=>te.textValue===W))==null?void 0:k.ref.current;(function te(F){ae.current=F,window.clearTimeout(ie.current),F!==""&&(ie.current=window.setTimeout(()=>te(""),1e3))})(O),Z&&setTimeout(()=>Z.focus())};T.useEffect(()=>()=>window.clearTimeout(ie.current),[]),Mk();const x=T.useCallback(C=>{var w,k;return D.current===((w=R.current)==null?void 0:w.side)&&n2e(C,(k=R.current)==null?void 0:k.area)},[]);return Y.jsx($be,{scope:r,searchRef:ae,onItemEnter:T.useCallback(C=>{x(C)&&C.preventDefault()},[x]),onItemLeave:T.useCallback(C=>{var w;x(C)||((w=I.current)==null||w.focus(),V(null))},[x]),onTriggerLeave:T.useCallback(C=>{x(C)&&C.preventDefault()},[x]),pointerGraceTimerRef:K,onPointerGraceIntentChange:T.useCallback(C=>{R.current=C},[]),children:Y.jsx(b,{...M,children:Y.jsx(K8,{asChild:!0,trapped:i,onMountAutoFocus:nt(s,C=>{var w;C.preventDefault(),(w=I.current)==null||w.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:Y.jsx(Yy,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:h,onDismiss:g,children:Y.jsx(Hk,{asChild:!0,...P,dir:E.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:V,onEntryFocus:nt(c,C=>{E.isUsingKeyboardRef.current||C.preventDefault()}),preventScrollOnEntryFocus:!0,children:Y.jsx(Vk,{role:"menu","aria-orientation":"vertical","data-state":oY(S.open),"data-radix-menu-content":"",dir:E.dir,...A,...m,ref:U,style:{outline:"none",...m.style},onKeyDown:nt(m.onKeyDown,C=>{const k=C.target.closest("[data-radix-menu-content]")===C.currentTarget,O=C.ctrlKey||C.altKey||C.metaKey,G=C.key.length===1;k&&(C.key==="Tab"&&C.preventDefault(),!O&&G&&B(C.key));const oe=I.current;if(C.target!==oe||!Mbe.includes(C.key))return;C.preventDefault();const X=N().filter(W=>!W.disabled).map(W=>W.ref.current);FK.includes(C.key)&&X.reverse(),Xbe(X)}),onBlur:nt(t.onBlur,C=>{C.currentTarget.contains(C.target)||(window.clearTimeout(ie.current),ae.current="")}),onPointerMove:nt(t.onPointerMove,G2(C=>{const w=C.target,k=v.current!==C.clientX;if(C.currentTarget.contains(w)&&k){const O=C.clientX>v.current?"right":"left";D.current=O,v.current=C.clientX}}))})})})})})})});zK.displayName=tc;var zbe="MenuGroup",Zk=T.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return Y.jsx(jt.div,{role:"group",...n,ref:e})});Zk.displayName=zbe;var Hbe="MenuLabel",HK=T.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return Y.jsx(jt.div,{...n,ref:e})});HK.displayName=Hbe;var p4="MenuItem",AF="menu.itemSelect",tE=T.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...i}=t,s=T.useRef(null),o=Ww(p4,t.__scopeMenu),a=Qk(p4,t.__scopeMenu),c=Rr(e,s),l=T.useRef(!1),f=()=>{const u=s.current;if(!r&&u){const h=new CustomEvent(AF,{bubbles:!0,cancelable:!0});u.addEventListener(AF,g=>n==null?void 0:n(g),{once:!0}),Ek(u,h),h.defaultPrevented?l.current=!1:o.onClose()}};return Y.jsx(GK,{...i,ref:c,disabled:r,onClick:nt(t.onClick,f),onPointerDown:u=>{var h;(h=t.onPointerDown)==null||h.call(t,u),l.current=!0},onPointerUp:nt(t.onPointerUp,u=>{var h;l.current||(h=u.currentTarget)==null||h.click()}),onKeyDown:nt(t.onKeyDown,u=>{const h=a.searchRef.current!=="";r||h&&u.key===" "||B_.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});tE.displayName=p4;var GK=T.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=t,o=Qk(p4,r),a=UK(r),c=T.useRef(null),l=Rr(e,c),[f,u]=T.useState(!1),[h,g]=T.useState("");return T.useEffect(()=>{const y=c.current;y&&g((y.textContent??"").trim())},[s.children]),Y.jsx(H2.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:Y.jsx(Gk,{asChild:!0,...a,focusable:!n,children:Y.jsx(jt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:l,onPointerMove:nt(t.onPointerMove,G2(y=>{n?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:nt(t.onPointerLeave,G2(y=>o.onItemLeave(y))),onFocus:nt(t.onFocus,()=>u(!0)),onBlur:nt(t.onBlur,()=>u(!1))})})})}),Gbe="MenuCheckboxItem",WK=T.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...i}=t;return Y.jsx(ZK,{scope:t.__scopeMenu,checked:r,children:Y.jsx(tE,{role:"menuitemcheckbox","aria-checked":v4(r)?"mixed":r,...i,ref:e,"data-state":eR(r),onSelect:nt(i.onSelect,()=>n==null?void 0:n(v4(r)?!0:!r),{checkForDefaultPrevented:!1})})})});WK.displayName=Gbe;var KK="MenuRadioGroup",[Wbe,Kbe]=gp(KK,{value:void 0,onValueChange:()=>{}}),YK=T.forwardRef((t,e)=>{const{value:r,onValueChange:n,...i}=t,s=Fs(n);return Y.jsx(Wbe,{scope:t.__scopeMenu,value:r,onValueChange:s,children:Y.jsx(Zk,{...i,ref:e})})});YK.displayName=KK;var QK="MenuRadioItem",JK=T.forwardRef((t,e)=>{const{value:r,...n}=t,i=Kbe(QK,t.__scopeMenu),s=r===i.value;return Y.jsx(ZK,{scope:t.__scopeMenu,checked:s,children:Y.jsx(tE,{role:"menuitemradio","aria-checked":s,...n,ref:e,"data-state":eR(s),onSelect:nt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});JK.displayName=QK;var Xk="MenuItemIndicator",[ZK,Ybe]=gp(Xk,{checked:!1}),XK=T.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...i}=t,s=Ybe(Xk,r);return Y.jsx(lo,{present:n||v4(s.checked)||s.checked===!0,children:Y.jsx(jt.span,{...i,ref:e,"data-state":eR(s.checked)})})});XK.displayName=Xk;var Qbe="MenuSeparator",eY=T.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return Y.jsx(jt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});eY.displayName=Qbe;var Jbe="MenuArrow",tY=T.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,i=eE(r);return Y.jsx(zk,{...i,...n,ref:e})});tY.displayName=Jbe;var Zbe="MenuSub",[pGe,rY]=gp(Zbe),Tb="MenuSubTrigger",nY=T.forwardRef((t,e)=>{const r=yp(Tb,t.__scopeMenu),n=Ww(Tb,t.__scopeMenu),i=rY(Tb,t.__scopeMenu),s=Qk(Tb,t.__scopeMenu),o=T.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,l={__scopeMenu:t.__scopeMenu},f=T.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return T.useEffect(()=>f,[f]),T.useEffect(()=>{const u=a.current;return()=>{window.clearTimeout(u),c(null)}},[a,c]),Y.jsx(Kk,{asChild:!0,...l,children:Y.jsx(GK,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":oY(r.open),...t,ref:V8(e,i.onTriggerChange),onClick:u=>{var h;(h=t.onClick)==null||h.call(t,u),!(t.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:nt(t.onPointerMove,G2(u=>{s.onItemEnter(u),!u.defaultPrevented&&!t.disabled&&!r.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),f()},100))})),onPointerLeave:nt(t.onPointerLeave,G2(u=>{var h,g;f();const y=(h=r.content)==null?void 0:h.getBoundingClientRect();if(y){const m=(g=r.content)==null?void 0:g.dataset.side,S=m==="right",E=S?-5:5,A=y[S?"left":"right"],P=y[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:u.clientX+E,y:u.clientY},{x:A,y:y.top},{x:P,y:y.top},{x:P,y:y.bottom},{x:A,y:y.bottom}],side:m}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(u),u.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:nt(t.onKeyDown,u=>{var h;const g=s.searchRef.current!=="";t.disabled||g&&u.key===" "||Obe[n.dir].includes(u.key)&&(r.onOpenChange(!0),(h=r.content)==null||h.focus(),u.preventDefault())})})})});nY.displayName=Tb;var iY="MenuSubContent",sY=T.forwardRef((t,e)=>{const r=qK(tc,t.__scopeMenu),{forceMount:n=r.forceMount,...i}=t,s=yp(tc,t.__scopeMenu),o=Ww(tc,t.__scopeMenu),a=rY(iY,t.__scopeMenu),c=T.useRef(null),l=Rr(e,c);return Y.jsx(H2.Provider,{scope:t.__scopeMenu,children:Y.jsx(lo,{present:n||s.open,children:Y.jsx(H2.Slot,{scope:t.__scopeMenu,children:Y.jsx(Jk,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:l,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var u;o.isUsingKeyboardRef.current&&((u=c.current)==null||u.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:nt(t.onFocusOutside,f=>{f.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:nt(t.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:nt(t.onKeyDown,f=>{var u;const h=f.currentTarget.contains(f.target),g=Dbe[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(u=a.trigger)==null||u.focus(),f.preventDefault())})})})})})});sY.displayName=iY;function oY(t){return t?"open":"closed"}function v4(t){return t==="indeterminate"}function eR(t){return v4(t)?"indeterminate":t?"checked":"unchecked"}function Xbe(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function e2e(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function t2e(t,e,r){const i=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,s=r?t.indexOf(r):-1;let o=e2e(t,Math.max(s,0));i.length===1&&(o=o.filter(l=>l!==r));const c=o.find(l=>l.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function r2e(t,e){const{x:r,y:n}=t;let i=!1;for(let s=0,o=e.length-1;sn!=f>n&&r<(l-a)*(n-c)/(f-c)+a&&(i=!i)}return i}function n2e(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return r2e(r,e)}function G2(t){return e=>e.pointerType==="mouse"?t(e):void 0}var i2e=$K,s2e=Kk,o2e=VK,a2e=zK,c2e=Zk,l2e=HK,f2e=tE,u2e=WK,d2e=YK,h2e=JK,p2e=XK,v2e=eY,g2e=tY,y2e=nY,m2e=sY,tR="DropdownMenu",[b2e,vGe]=Us(tR,[jK]),fo=jK(),[w2e,aY]=b2e(tR),x2e=t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,c=fo(e),l=T.useRef(null),[f=!1,u]=sc({prop:i,defaultProp:s,onChange:o});return Y.jsx(w2e,{scope:e,triggerId:ec(),triggerRef:l,contentId:ec(),open:f,onOpenChange:u,onOpenToggle:T.useCallback(()=>u(h=>!h),[u]),modal:a,children:Y.jsx(i2e,{...c,open:f,onOpenChange:u,dir:n,modal:a,children:r})})};x2e.displayName=tR;var cY="DropdownMenuTrigger",E2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=t,s=aY(cY,r),o=fo(r);return Y.jsx(s2e,{asChild:!0,...o,children:Y.jsx(jt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:V8(e,s.triggerRef),onPointerDown:nt(t.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:nt(t.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});E2e.displayName=cY;var C2e="DropdownMenuPortal",A2e=t=>{const{__scopeDropdownMenu:e,...r}=t,n=fo(e);return Y.jsx(o2e,{...n,...r})};A2e.displayName=C2e;var lY="DropdownMenuContent",S2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=aY(lY,r),s=fo(r),o=T.useRef(!1);return Y.jsx(a2e,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:e,onCloseAutoFocus:nt(t.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:nt(t.onInteractOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,f=c.button===2||l;(!i.modal||f)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});S2e.displayName=lY;var _2e="DropdownMenuGroup",I2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(c2e,{...i,...n,ref:e})});I2e.displayName=_2e;var T2e="DropdownMenuLabel",P2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(l2e,{...i,...n,ref:e})});P2e.displayName=T2e;var k2e="DropdownMenuItem",R2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(f2e,{...i,...n,ref:e})});R2e.displayName=k2e;var M2e="DropdownMenuCheckboxItem",fY=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(u2e,{...i,...n,ref:e})});fY.displayName=M2e;var O2e="DropdownMenuRadioGroup",D2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(d2e,{...i,...n,ref:e})});D2e.displayName=O2e;var N2e="DropdownMenuRadioItem",uY=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(h2e,{...i,...n,ref:e})});uY.displayName=N2e;var B2e="DropdownMenuItemIndicator",dY=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(p2e,{...i,...n,ref:e})});dY.displayName=B2e;var L2e="DropdownMenuSeparator",F2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(v2e,{...i,...n,ref:e})});F2e.displayName=L2e;var j2e="DropdownMenuArrow",U2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(g2e,{...i,...n,ref:e})});U2e.displayName=j2e;var $2e="DropdownMenuSubTrigger",q2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(y2e,{...i,...n,ref:e})});q2e.displayName=$2e;var V2e="DropdownMenuSubContent",z2e=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=fo(r);return Y.jsx(m2e,{...i,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});z2e.displayName=V2e;var H2e=fY,G2e=uY,hY=dY,pY="_1k2mbvi4 _1k2mbvi3 fyvr11h4 fyvr11hs fyvr11fs fyvr11gg fyvr1zs fyvr111g fyvr1v0 fyvr1x4 fyvr1310 fyvr130u fyvr11l8 fyvr11ow fyvr11o4 fyvr12zf fyvr11rc fyvr11m4 fyvr12wf",vY="_1k2mbvi5";const W2e=({children:t})=>Y.jsx(hY,{className:vY,children:t});T.forwardRef(({className:t,children:e,...r},n)=>Y.jsxs(H2e,{className:Li(pY,t),...r,ref:n,children:[Y.jsx(W2e,{children:Y.jsx(qw,{size:"xs"})}),Y.jsx(Te,{variant:"small",children:e})]}));T.forwardRef(({className:t,children:e,...r},n)=>Y.jsxs(G2e,{className:Li(pY,t),...r,ref:n,children:[Y.jsx(hY,{className:vY,children:Y.jsx(Te,{children:"•"})}),Y.jsx(Te,{variant:"small",children:e})]}));const mp=T.forwardRef((t,e)=>{const{icon:r,size:n="md",...i}=t;return Y.jsx(Vt,{leftIcon:r,size:n,flexShrink:"0",ref:e,...i})}),K2e=(...t)=>e=>t.forEach(r=>{r&&(typeof r=="function"?r(e):r.current=e)});var Y2e="_1hq71vk1 _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11r3 fyvr11io fyvr11k8 fyvr11k0 fyvr11j8 _1hq71vk0 fyvr11eg fyvr11es fyvr11f4 fyvr11fg fyvr1vc fyvr1xg fyvr1zk fyvr111o fyvr12rf fyvr12k3 fyvr125f fyvr12cr fyvr12rx fyvr12kl fyvr125x fyvr12d9 fyvr11ow fyvr11lk fyvr11mk fyvr11nk fyvr1h4 fyvr11m4",Q2e=jn({defaultClassName:"_1hq71vk5",variantClassNames:{borderRadius:{xs:"_1hq71vk6 _1hq71vk2 fyvr11h4 fyvr11hs fyvr11fs fyvr11gg",sm:"_1hq71vk7 _1hq71vk3 fyvr11h8 fyvr11hw fyvr11fw fyvr11gk",md:"_1hq71vk8 _1hq71vk4 fyvr11hc fyvr11i0 fyvr11g0 fyvr11go"}},defaultVariants:{},compoundVariants:[]}),J2e="_1hq71vka _1hq71vk9 fyvr130x fyvr130r fyvr11lw fyvr12zr fyvr1m0 fyvr1qg fyvr1o8 fyvr1so";const Z2e={png:".png,image/png",jpeg:".jpeg,image/jpeg",jpg:".jpg,image/jpg",images:"image/*, video/*",pdf:".pdf,application/pdf",mp4:".mp4,video/mp4",csv:".csv,text/csv",json:".json,application/json"};T.forwardRef((t,e)=>{const{borderRadius:r="md",description:n,disabled:i=!1,id:s,label:o="",labelLocation:a="hidden",name:c,onValueChange:l,placeholder:f="Upload a file",validExtensions:u,...h}=t,g=T.useRef(null),y=K2e(g,e),[m,S]=T.useState(null),E=P=>{const N=P.currentTarget.files;if(!N||!N[0])return;const L=N[0],V=L.name,I=L.size/1e3;S({name:V,size:I,extension:V.split(".").pop()??""}),l==null||l(L)},A=u.map(P=>Z2e[P]).join(",");return Y.jsx(Ky,{description:n,disabled:i,display:"grid",id:s??c,label:o,labelLocation:a,children:Y.jsxs(ye,{width:"full",minWidth:"0",justifyContent:m?"space-between":"flex-start",gap:"2",color:m?"text100":"text50",className:Li(Y2e,Q2e({borderRadius:r})),children:[m?Y.jsxs(ye,{flexDirection:"row",gap:"2",alignItems:"center",minWidth:"0",children:[Y.jsx(Te,{ellipsis:!0,children:m.name}),Y.jsxs(Te,{color:"text50",variant:"xsmall",whiteSpace:"nowrap",children:[m.size.toFixed(2)," kb"]})]}):Y.jsx(Te,{ellipsis:!0,children:f}),Y.jsx(ye,{accept:A,as:"input",className:J2e,cursor:"pointer",disabled:i,id:s??c,name:c,onChange:E,ref:y,type:"file",...h}),m&&Y.jsx(mp,{cursor:"pointer",icon:Tu,size:"xs",onClick:P=>{var N;P.preventDefault(),P.stopPropagation(),(N=g.current)!=null&&N.value&&(g.current.value=""),l==null||l(null),S(null)},zIndex:"10"})]})})});var X2e=jn({defaultClassName:"_1bhyzin0",variantClassNames:{size:{xs:"_1bhyzin1",sm:"_1bhyzin2",md:"_1bhyzin3",lg:"_1bhyzin4",xl:"_1bhyzin5"}},defaultVariants:{},compoundVariants:[]});const L_=1e3,sg=64,G9=sg/2,W9=(t,e=L_)=>t%e/(L_/sg),sv=(t,e=0)=>{let r=3735928559^e,n=1103547991^e;for(let i=0,s;i>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&n)+(r>>>0)},ewe=(t,e,r)=>{const n=t%360,i=(t+120)%360,s=r%360;return{a:`hsl(${n}deg 100% 40%)`,b:`hsl(${i}deg 100% 50%)`,c:`hsl(${s}deg 100% 50%)`}},twe=(t,e)=>{const r=[];for(let n=0;n{const s=sg/10+W9(n.r,L_*1.5/(i+1));return{...ewe(n.a,n.b,n.c),x:W9(n.x),y:W9(n.y),r:s}})},rwe=T.memo(t=>{const{className:e,address:r,size:n="md",complexity:i=1,...s}=t,o=twe(r,i);return Y.jsxs(ye,{as:"svg",className:Li(e,X2e({size:n})),viewBox:`0 0 ${sg} ${sg}`,version:"1.1",flexShrink:"0",borderRadius:"circle",overflow:"hidden",xmlns:"http://www.w3.org/2000/svg",...s,children:[Y.jsxs("defs",{children:[Y.jsx("clipPath",{id:"circle-clip",children:Y.jsx("circle",{cx:G9,cy:G9,r:G9})}),Y.jsxs("filter",{id:"blur",x:"-10%",y:"-10%",width:"120%",height:"120%",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[Y.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),Y.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),Y.jsx("feGaussianBlur",{stdDeviation:sg/10,result:"effect1_foregroundBlur"})]}),Y.jsxs("linearGradient",{id:`gradient-background-${r}`,x1:"0",y1:"0",x2:"1",y2:"1",children:[Y.jsx("stop",{offset:"0",stopColor:o[0].c}),Y.jsx("stop",{offset:"1",stopColor:o[0].a})]}),o.map((a,c)=>Y.jsxs(T.Fragment,{children:[Y.jsxs("radialGradient",{id:`gradient-primary-${r}-${c}`,children:[Y.jsx("stop",{offset:"0",stopColor:a.a}),Y.jsx("stop",{offset:"1",stopColor:a.b})]}),Y.jsxs("radialGradient",{id:`gradient-secondary-${r}-${c}`,children:[Y.jsx("stop",{offset:"0",stopColor:a.c}),Y.jsx("stop",{offset:"1",stopColor:a.b})]})]},c))]}),Y.jsxs("g",{clipPath:"url(#circle-clip)",children:[Y.jsx("rect",{width:"100%",height:"100%",fill:`url(#gradient-background-${r})`}),Y.jsx("g",{filter:"url(#blur)",children:o.map((a,c)=>Y.jsxs(T.Fragment,{children:[Y.jsx("circle",{fill:`url(#gradient-primary-${r}-${c})`,cx:a.x,cy:a.y,r:a.r}),Y.jsx("circle",{fill:`url(#gradient-secondary-${r}-${c})`,cx:a.y,cy:a.x,r:a.r/2})]},c))})]})]})}),Fi=t=>{const{disableAnimation:e=!1,onLoad:r,...n}=t,[i,s]=T.useState(!1),o=a=>{s(!0),r==null||r(a)};return Y.jsx(ye,{as:k1.img,initial:e?void 0:{opacity:0},animate:e?void 0:{opacity:i?1:0},transition:{duration:.2},onLoad:e?void 0:o,...n})};var rR="Dialog",[gY,gGe]=Us(rR),[nwe,el]=gY(rR),yY=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=T.useRef(null),c=T.useRef(null),[l=!1,f]=sc({prop:n,defaultProp:i,onChange:s});return Y.jsx(nwe,{scope:e,triggerRef:a,contentRef:c,contentId:ec(),titleId:ec(),descriptionId:ec(),open:l,onOpenChange:f,onOpenToggle:T.useCallback(()=>f(u=>!u),[f]),modal:o,children:r})};yY.displayName=rR;var mY="DialogTrigger",iwe=T.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=el(mY,r),s=Rr(e,i.triggerRef);return Y.jsx(jt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":sR(i.open),...n,ref:s,onClick:nt(t.onClick,i.onOpenToggle)})});iwe.displayName=mY;var nR="DialogPortal",[swe,bY]=gY(nR,{forceMount:void 0}),wY=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:i}=t,s=el(nR,e);return Y.jsx(swe,{scope:e,forceMount:r,children:T.Children.map(n,o=>Y.jsx(lo,{present:r||s.open,children:Y.jsx(Hw,{asChild:!0,container:i,children:o})}))})};wY.displayName=nR;var g4="DialogOverlay",xY=T.forwardRef((t,e)=>{const r=bY(g4,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=el(g4,t.__scopeDialog);return s.modal?Y.jsx(lo,{present:n||s.open,children:Y.jsx(owe,{...i,ref:e})}):null});xY.displayName=g4;var owe=T.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=el(g4,r);return Y.jsx(X8,{as:G1,allowPinchZoom:!0,shards:[i.contentRef],children:Y.jsx(jt.div,{"data-state":sR(i.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),K1="DialogContent",EY=T.forwardRef((t,e)=>{const r=bY(K1,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=el(K1,t.__scopeDialog);return Y.jsx(lo,{present:n||s.open,children:s.modal?Y.jsx(awe,{...i,ref:e}):Y.jsx(cwe,{...i,ref:e})})});EY.displayName=K1;var awe=T.forwardRef((t,e)=>{const r=el(K1,t.__scopeDialog),n=T.useRef(null),i=Rr(e,r.contentRef,n);return T.useEffect(()=>{const s=n.current;if(s)return Wk(s)},[]),Y.jsx(CY,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nt(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:nt(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:nt(t.onFocusOutside,s=>s.preventDefault())})}),cwe=T.forwardRef((t,e)=>{const r=el(K1,t.__scopeDialog),n=T.useRef(!1),i=T.useRef(!1);return Y.jsx(CY,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),s.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:s=>{var o,a;(o=t.onInteractOutside)==null||o.call(t,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=s.target;((a=r.triggerRef.current)==null?void 0:a.contains(c))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),CY=T.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=el(K1,r),c=T.useRef(null),l=Rr(e,c);return Mk(),Y.jsxs(Y.Fragment,{children:[Y.jsx(K8,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:Y.jsx(Yy,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":sR(a.open),...o,ref:l,onDismiss:()=>a.onOpenChange(!1)})}),Y.jsxs(Y.Fragment,{children:[Y.jsx(uwe,{titleId:a.titleId}),Y.jsx(hwe,{contentRef:c,descriptionId:a.descriptionId})]})]})}),iR="DialogTitle",lwe=T.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=el(iR,r);return Y.jsx(jt.h2,{id:i.titleId,...n,ref:e})});lwe.displayName=iR;var AY="DialogDescription",fwe=T.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=el(AY,r);return Y.jsx(jt.p,{id:i.descriptionId,...n,ref:e})});fwe.displayName=AY;var SY="DialogClose",_Y=T.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=el(SY,r);return Y.jsx(jt.button,{type:"button",...n,ref:e,onClick:nt(t.onClick,()=>i.onOpenChange(!1))})});_Y.displayName=SY;function sR(t){return t?"open":"closed"}var IY="DialogTitleWarning",[yGe,TY]=Age(IY,{contentName:K1,titleName:iR,docsSlug:"dialog"}),uwe=({titleId:t})=>{const e=TY(IY),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. @@ -925,7 +925,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 - L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z`,fill:"currentColor",className:"octo-body"})]})})]})},g_e="/assets/sequence-logo-B9LB7ao9.svg";function dte({variant:t="md",...e}){return j.jsxs(ye,{gap:"2",...e,children:[j.jsx(Fi,{src:g_e,height:t==="md"?"7":"10"}),j.jsx(Te,{variant:t==="md"?"large":"xlarge",fontWeight:"bold",color:"text100",children:"Sequence"}),j.jsx(Te,{variant:t==="md"?"large":"xlarge",fontWeight:"bold",color:"text50",children:"Wallet Recovery"})]})}function y_e(){return j.jsx(ye,{justifyContent:"flex-end",width:"full",position:"absolute",bottom:"0",padding:"10",children:j.jsx(Kt,{label:j.jsx(ye,{children:j.jsx(Te,{variant:"small",fontWeight:"bold",color:"text50",children:"Learn more"})}),variant:"text",onClick:()=>window.open("https://docs.sequence.xyz/")})})}const m_e="data:image/svg+xml,%3csvg%20width='20'%20height='21'%20viewBox='0%200%2020%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Contracts'%3e%3cg%20id='Subtract'%3e%3cpath%20d='M7%2017.5L7%209.89599C6.55852%209.7031%206.25%209.26258%206.25%208.75C6.25%208.05964%206.80964%207.5%207.5%207.5C8.19036%207.5%208.75%208.05964%208.75%208.75C8.75%209.26258%208.44148%209.7031%208%209.89599L8%2014.9244L10.7331%2013.8995V12.8884C10.3007%2012.6918%2010%2012.256%2010%2011.75C10%2011.0596%2010.5596%2010.5%2011.25%2010.5C11.9404%2010.5%2012.5%2011.0596%2012.5%2011.75C12.5%2012.2691%2012.1836%2012.7143%2011.7331%2012.9032V14.5925L8%2015.9924L8%2017.5L16%2017.5V8.64587L10.4552%208.64587V3.5H4V17.5L7%2017.5Z'%20fill='white'/%3e%3cpath%20d='M15.931%207.65688L11.5103%203.56422L11.5661%207.65688L15.931%207.65688Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",b_e="data:image/svg+xml,%3csvg%20width='20'%20height='21'%20viewBox='0%200%2020%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Wallet'%3e%3cpath%20id='Exclude'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5%206.54947C5%206.99261%205.38931%207.35185%205.86954%207.35185H16C16.5523%207.35185%2017%207.79957%2017%208.35185V15.5C17%2016.0523%2016.5523%2016.5%2016%2016.5H5.49505C4.11707%2016.5%203%2015.4692%203%2014.1977V6.80233C3%205.53079%204.11707%204.5%205.49505%204.5H13.8765C14.2208%204.5%2014.5%204.77917%2014.5%205.12355C14.5%205.46792%2014.2208%205.74709%2013.8765%205.74709H5.86955C5.38931%205.74709%205%206.10633%205%206.54947ZM12%2012C12%2011.1716%2012.6716%2010.5%2013.5%2010.5C14.3284%2010.5%2015%2011.1716%2015%2012C15%2012.8284%2014.3284%2013.5%2013.5%2013.5C12.6716%2013.5%2012%2012.8284%2012%2012Z'%20fill='white'/%3e%3c/g%3e%3c/svg%3e";function w_e(){const t=fr(oi),e=Wr(t.isLoadingAccount),[r,n]=T.useState(""),[i,s]=T.useState(!1),[o,a]=T.useState(!1),c=async()=>{try{await t.loadAccount(r)}catch(u){console.warn(u),a(!0)}},l=()=>{s(!0)},f=()=>{t.logout(),s(!1),t.isLoadingAccount.set(!1)};return j.jsxs(ye,{justifyContent:"center",height:"vh",style:{background:"linear-gradient(to bottom, #280a6b, #000000 50%)"},children:[j.jsxs(ye,{flexDirection:"column",justifyContent:"center",alignItems:"center",width:"full",style:{maxWidth:"1000px"},gap:"10",children:[j.jsxs(ye,{flexDirection:"column",gap:"6",children:[j.jsx(dte,{variant:"lg",justifyContent:"center"}),j.jsx(Te,{textAlign:"center",variant:"xlarge",color:"text100",style:{fontSize:"40px",lineHeight:"44px"},children:"A fully open source and forever accessible way to recover your Sequence Wallet"})]}),e?j.jsxs(j.Fragment,{children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Enter your password to continue and unlock your wallet"}),j.jsxs(ye,{flexDirection:"column",gap:"4",width:"3/4",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Password"}),j.jsx(Sn,{type:"password",value:r,autoFocus:!0,onKeyPress:u=>{u.key==="Enter"&&c()},onChange:u=>{n(u.target.value),a(!1)}}),o&&j.jsx(Te,{variant:"small",color:"negative",marginLeft:"2",marginTop:"1",children:"Incorrect password"})]}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",gap:"4",children:[j.jsx(Kt,{label:"Forgot password?",variant:"text",shape:"square",onClick:()=>l()}),j.jsx(Kt,{label:"Continue",variant:"primary",shape:"square",onClick:()=>c()})]})]})]}):j.jsxs(j.Fragment,{children:[j.jsxs(ye,{gap:"2",children:[j.jsx(Kt,{label:"Learn more",size:"md",onClick:()=>window.open("https://docs.sequence.xyz/")}),j.jsx(Kt,{as:JQ,to:"/recovery",label:"Start Recovery",variant:"primary",size:"md"})]}),j.jsxs(ye,{flexDirection:"row",gap:"2",width:"2/3",children:[j.jsxs(vn,{flexDirection:"column",gap:"2",children:[j.jsxs(ye,{flexDirection:"row",gap:"2",children:[j.jsx(Fi,{src:m_e}),j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:"Connect to Applications"})]}),j.jsx(Te,{variant:"normal",color:"text50",children:"Connect your wallet to any web3 application via Walletconnect"})]}),j.jsxs(vn,{flexDirection:"column",gap:"2",children:[j.jsxs(ye,{flexDirection:"row",gap:"2",children:[j.jsx(Fi,{src:b_e}),j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:"Move funds anywhere"})]}),j.jsx(Te,{variant:"normal",color:"text50",children:"Transfer funds securely to any wallet, fully decentralized"})]})]})]})]}),i&&j.jsx(oa,{size:"md",onClose:()=>s(!1),children:j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",color:"text100",marginRight:"8",children:"Are you sure you want to sign out?"}),j.jsxs(Te,{variant:"normal",color:"text50",children:["If you do not remember your password, you can reset and start over.",j.jsx("br",{})," This will require you to re-enter your mnemonic."]}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",gap:"2",children:[j.jsx(Kt,{label:"Yes, reset",shape:"square",variant:"primary",onClick:()=>f()}),j.jsx(Kt,{label:"Cancel",shape:"square",onClick:()=>s(!1)})]})]})}),j.jsx(y_e,{})]})}const x_e={"0x087Aa00C1f09464D1D6a9Ff0eE2377dBB7c7B324":[{wallet:"0xaf39AE56e001250FaCBd122b11A90d32A0aD6686",subdigest:"0x0f4490a7aa40f15929635252953ce594ba3342401c2c53eff56451dc147475da"}],"0x09A820a9109E5EC82DCfF24484b2047739a92Abc":[{wallet:"0xcF47342c7064AAA5BA0F4163bEA0c7545756b8BF",subdigest:"0xa598ddbe6372b985f60367a1a9c12cb99e20e38c782d9bc941ddaa9f4c9296e5"}],"0x0aBb5b9d20f06DAdF752CEeBe4df26E585A1d897":[{wallet:"0x3F00C5A7fEadD358429645b29b3d776C5f61892d",subdigest:"0x7c33d7864e6e6f92e39328b407fc8fa0206c6ebdb5a31d9056dcc96bba5eb108"}],"0x0f286489b5b85EAcC4E00e1902e138b5Aa662F1c":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x76009a037ebbb28a9f71f1e68c38291e3b2b1a4bf772a56a79e1a6336cbbc7ab"}],"0x1A535D13c62F240cC7985B05a0229182D546550e":[{wallet:"0x46Ba18e7eCB93362A1804cC47EaD90244945016D",subdigest:"0x0acff6ca38c72b9287ba8163569a452ce12c9ffd64c082feba8a5f7300546579"}],"0x1B9498d7177a09d98ABE532e472e1b9f32dAc9B8":[{wallet:"0x848045071DbdBa2F352dF2f0335e02ba61f205aC"}],"0x253ff3Dd87c440A9565814756f85219F487e2FFe":[{wallet:"0xd18a46E40b29FA6CFC0D9f5A930E72cD0EC1e4D2",subdigest:"0x12822b7fde91535103ee7757fe362bfdca0dc2e25211c6ca7c133c20a66d604f"}],"0x27D263a5707510378823fa496674EeC7656780B6":[{wallet:"0xBc4f7bB193ac09D7eC53eF0a499B073A296A94f0",subdigest:"0xbf3913760753e93aba2f40235dd03e693f85853d7c9f9c5f1f62ce7ee91c6313"}],"0x36fA6B68007575C100c1C2916942ee857dE0778E":[{wallet:"0x52CE3cab58639223cf870A73942175e6C7BA9A0C",subdigest:"0x455b01f5c47ece34a3f4dee5d9b3d3b590d524029f4e845b2d4eccb7e8d9472b"}],"0x3Ed9724712417687eb0eaBc2cA2e452E3d2DCdEc":[{wallet:"0x4955338954fFF19396Fe4bA17D93370cA8b77d2B",subdigest:"0x96c4ddf36a03af12b56cf6dc618ab83d814b86a01c69464f1b94bfca826e47fa"}],"0x3F0c7e32678Bc6dCf9dEfB6368EcaE7B88C69036":[{wallet:"0x592625C316A2F184F0C6a4b2952e9b40Ef111a26",subdigest:"0x5e9cf684e8dcf38d5b079a89ff4644de144c85ca16e3b618ab4ae490becff25f"},{wallet:"0xEBB418588FFc0785B6a2559a281A37c117679D6F",subdigest:"0x98be9228917ad8193e14102ed0a989689ec6af1f04bd731f3cca43c02c1abc07"}],"0x4577CAF3A5caBcaF2038863d361cb32f423d5d53":[{wallet:"0xF68f5A97abAAa940A9Ad3AeD723C2179F8551502",subdigest:"0x336448a71e4188cd95c39b278d6d26144d51dc5b3edfdd2af67c3b0425a2e2d3"}],"0x50d27302c45FE4FC8d7cc435920a22D477d3DEB2":[{wallet:"0x97692217ca8e06D7156ef7f4606faB4624bd10C0",subdigest:"0x898993e7c2394c1c9b63b2cfa637a8a2c7b04ce9387c9ecc9c56ef1f56ae58be"}],"0x57160B380fF4Edf3DA3b1c27e723dc2AB3f057Be":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x89f982d77ae08a8ea17d6755d297615f5756e5363db8a9b95758d5a981f8e4ae"}],"0x6647b94603e0D90265d8869a3656C1b0F9B6caC5":[{wallet:"0x6cDe6f20610FF172Cd838CDF69Aae3c27521CBa4",subdigest:"0xab2d0dbda84cffb9a3934412172236a9d98fd3d6b80d47b35956cc5f935c69de"}],"0x69DD1F76595E8a49252F16DDa69474c3a818E3c0":[{wallet:"0x756F9E22591e0aC2Aa0C365708aF0a516F269979",subdigest:"0x261126c464ac19bb769c407ec28fe026f297357938ba9024bd66bb5a48ca9349"}],"0x6Ae23160FBB280Ae4eE78C476ca9FDb51bBcC444":[{wallet:"0xDfA3338DD0147b5e7793cE040F92462177e00024",subdigest:"0xae67c59800e8dd98b955a5fb857c39971fe5fb29e3e5083246fd122b37c4ee88"}],"0x6B917b4459Db2C9cb774e0a9B0eee668273e191a":[{wallet:"0x676b5FaCD2380F51d4EB1A2492057A31FfB100c5",subdigest:"0x60a62db58b5be8277ff22e8104ead5c4d87d6d1173fd7b2b0174978e663974c7"}],"0x6b593de1F2c6cEf51693323edc4467c2A4D5B78B":[{wallet:"0xD9DF096A66A89e63eE977C5Fda59a65f872a6901",subdigest:"0x8ef909db0fd633cac1445a89dace09c5b2fa1bda2d85e5915f6afc2d547f6a87"}],"0x6c77214450C1060f2f6a093c8054278b77E8769b":[{wallet:"0x16b47E837ff421382D516cA5A79b76aFd8473675",subdigest:"0x67521db115964b2559b99d5854ab07bae09e6e6cb0c1cd3de3d1f553c31c515f"}],"0x70F2E179c95a6e3b9a2Fe742B88568a12FFF7f8B":[{wallet:"0x649ba7F76D856aB021C9EEB8bac3B46f3e72EfD0",subdigest:"0x178be5e2d834d0224794dfbe49cf9621127d3396b75246a32093a21e6db320eb"}],"0x77fCC4D33ae477f217a09Ec8dBEBC22E7e8F5e33":[{wallet:"0xD09C7A6Af7046F45343978A1620391D6237c3762",subdigest:"0xca780c4505a811222e215eceeb2b28f222c1a6b126e9ccc86560f5199c34d5da"}],"0x78C22edc81d7a7A1D690e6C91824Cf9Eff2760c8":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xd84553d4372b26e3eb96fa77bd157e4e1b593bff1c54c7e69ad8857673d2266e"}],"0x79621cB0c2c8FbB8Ca20E4177b7DF0Aa7a931e73":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0xbd64f6f75e64b49c6a4f46b2715ca3bf11e21a7e07702b89ea1607e3884e9d40"}],"0x79A7DF6E89da1AEa293bFa11987d7CE828223a7A":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x858235d87309c9e2d72dca9bfa41b61fbb635ac6d9e099b868ff8a8c99bf8c37"}],"0x7b1A301155c0Fad8e5b95055e2A100333D464eA3":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x31001033b765a3cc9407304daeafeeda015d318e73be3de8832a9dc1377f9340"}],"0x85c5B1f9464723A2cC81F69A71a11dA528E0CBCe":[{wallet:"0xF178cE73DB2bA1C575D5c63ecA490b09ec31949b",subdigest:"0x65e9c76ef7e14697c6fd1822fbd39719b43091f13d2d051c911d1373175c2c42"}],"0x943237FFB0024Bf758A79db00e043789FD8299f0":[{wallet:"0x639b6017C4b8F8a5322205A68a1331A817Dd46e2",subdigest:"0xa3bc90cafcccb0fe0b8c0939fa908216ddc667d6b022fe54efca05ec815c163c"}],"0x9EeA332285d7B3755CB46f7D0D49CF0edcC112Ef":[{wallet:"0x04EfBe99e49001b78bB68c35B0354CD4a2Ac4Fd8",subdigest:"0xd3c43ef36d4347d1b5323fa188cf8482de05631a86bc05b12b8ce3b661f4d2f9"}],"0x9b704574e65F8b785FD125F5f3C4F7E34690Bd02":[{wallet:"0xBA9498300dFE650a2b59A42271ec771B6Ed6a091",subdigest:"0x9894f57b20f78245e02d424a21f0d361038905285f53c51c1949e27f39a9fbb8"}],"0xA923984d96b7327c60f246da366b2525B34C6984":[{wallet:"0x7ae10aA190513577D9Ac9ae146128d97df4F4fF0",subdigest:"0x3b849360d50831070d92bec368b63cf0725525cd7b60f406cee5357731b75457"}],"0xACFC6D1DB5875Cb72E1b6BaddaCe28F45044ee6a":[{wallet:"0xAdAf943368aB95208763ccAcCD5ecB9a7772de40",subdigest:"0xb0d0da150a42bca8103e1c40e5e99c7a190043b3121f52c6d41ae473597d0ebe"}],"0xB278dd7c9FC754dBc82Ac29C6f78B6301BE8E8C6":[{wallet:"0xeCc653CB03a9B6587Bcb58A8372535b6Ea5a17d6",subdigest:"0x6fd9bb4768107b4bd0f3c8e11b00027ee5e6417b1d4ab3d5e56c1724eeb2e3b2"}],"0xBaA9D704C8244071e6B9bF6BcbC2c2281dB75096":[{wallet:"0xb547CcA265A91f7a92d9a97804807962B2A4D7d8",subdigest:"0xfca7ea635bf9e89d7034ce6d9378ff6948eaa340ab2d428e5b157efc82b9f8d5"}],"0xC29fD04F9079c36dC15549e8AAF8F058214F0Dae":[{wallet:"0xB7005885711d54BD3594Be1955266d37470BD053",subdigest:"0xb0bc66ea204ea2cb93ca190189471392b59fb8608cb75a69a7b01b7096338428"}],"0xD2751030a5007895968414443efae561BdCB1Af2":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0x2872f961dd02e7b3fabd4a7bed036259085de28fe2f1c0f49a5d1be6ae4c7b07"}],"0xD721d5849fDE7862E77D251B6fA711114f4579Ab":[{wallet:"0x77415fb6aFe8A13275b088f1e197Bd9EDa1AA95C",subdigest:"0xc775316600b59750707446a7915cf88cc6f1827ce931dd688bf5990a7b95ec29"}],"0xE1B6c2c194dF83A8E01F8C582ddA58840fE46318":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xde7ebed8b2c62552e8ff5a08d2e5b33d336d709e6cf2812b9874cd7b5fd5189e"}],"0xE5Ed2A916971Fa6fe07EbD4564DeAaF2c20A7684":[{wallet:"0xFDB7922bA08BAbad2e3e36b66e0521c7EEA0faEF"}],"0xF9ED1e54dc86Bf248FBe059D4aEfD8183F0A816F":[{wallet:"0xCdFdaDB6F2b2f3c7db93521AbD05a3C32aF6b226",subdigest:"0x0433c483ced183cee562b8061788fc93d0c9f666af896096a5e184076f787eac"}],"0xa3CF0b935AccFd8bbE569B984D9Bc7Ec775ce22d":[{wallet:"0x23C6B8E47fa9f40e73E6627598d13085130f3ed6",subdigest:"0x13e9cd21769bc2a4f779b0f73c1cc7ca6c96c6af3262721eec17ac72104fef32"}],"0xbe9f4fB13fbC98042a32dC8354A339258abf1456":[{wallet:"0x81fF1aD4232671403e0f3CC85D021144511E3B6e",subdigest:"0x130c5b993a04ab84b0b074ea69241d6f3c040eced24dbe7c2015263718526670"}],"0xd4b26195aD1487DE6a42Fd69bC81CEbc8b86f0b5":[{wallet:"0xF36A0bd53d85307b35f90756263984329FBfA176",subdigest:"0x13d918ac4e97df0477fcab1c210ef1f96a999abe64dd07e48017b96c4902f50b"}],"0xdaD0038b8BBf78Ac84a4566E75269339Daa0dEdC":[{wallet:"0x8Fd48EB1ecDc0652306de1A0A8BA5561Ba733351",subdigest:"0x3541d7b2f07d87fa8b30c9ef1594da2353d45c40830f0c8e01126e3c89b9b508"}],"0xe7d51Cd5097A287a3B63014dc453Cfb8D9A03152":[{wallet:"0x4E5B1F98F81372BD4B763Be9bF50Aa6C5B7b9913",subdigest:"0x818fbd74398f446b4d7fcb207bf6377393fa923732243995d8464844ec8d42ce"}],"0xed7F28464630398E06e0Fa0Fc04FEa2fe40427aB":[{wallet:"0x6D0f613C239ed1d409C4e41758ACd55E0b1Cb410",subdigest:"0xe6baef08a191785d5d3897cb3e96f3473585d2f034657a4134754c5206b87268"}],"0xf24d3aFE0768827EAe9f671F3C1c283BfFAF0C19":[{wallet:"0xf03Bf61943e00fa3557E496409e1E9c95a1c24E4",subdigest:"0x3d1192dcd531e9ec60795b4129b03eb54b9226bc2d08be3f2b2524ae80244afb"}],"0xf3bf75114bEf71abE4E87f8CA4dD82E372b948A9":[{wallet:"0x3e270820e36EC3C29903C2635B0f53f192Dc29ab",subdigest:"0x70f563cb3ba62214e88d61e55450a8f4245bc5666aa006c93802ad2e96d3ac05"}],"0xf95C86e3a52dEbf8b984983852CAc5d8652C8A9A":[{wallet:"0xb07d236F2B5d1f4AB12236e94ac8049dE40321F4",subdigest:"0x877c04b91ea48703e9cc936f4506d89943ed8b9ec32b15990eea41ce0c59dde7"}],"0xfed1D937a8708001A23AFD8AEd02f9E05de9f251":[{wallet:"0x6743b60A94898E228c5aa642A2e11cb595dCB1fB"}]},E_e="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Checkmark'%3e%3cpath%20id='Vector%20332%20(Stroke)'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13.0635%204.14864L6.93414%2013.8114L2.99475%209.38482L3.89118%208.58706L6.77296%2011.8253L12.0502%203.50586L13.0635%204.14864Z'%20fill='white'/%3e%3c/g%3e%3c/svg%3e",C_e="data:image/svg+xml,%3csvg%20width='22'%20height='22'%20viewBox='0%200%2022%2022'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='atoms/square%20checkbox'%3e%3cpath%20id='checkbox'%20d='M0.5%204C0.5%202.067%202.067%200.5%204%200.5H18C19.933%200.5%2021.5%202.067%2021.5%204V18C21.5%2019.933%2019.933%2021.5%2018%2021.5H4C2.067%2021.5%200.5%2019.933%200.5%2018V4Z'%20stroke='%234F4F4F'/%3e%3c/g%3e%3c/svg%3e";function ux({checked:t,size:e="lg"}){return j.jsx(ye,{width:e==="lg"?"7":"5",height:e==="lg"?"7":"5",justifyContent:"center",alignItems:"center",style:{borderRadius:e==="lg"?"6px":"3px",background:t?"#4F4F4F":"inherit"},children:t?j.jsx("img",{src:E_e,alt:"Checkmark",style:{width:e==="lg"?"16px":"12px",height:e==="lg"?"16px":"12px"}}):j.jsx("img",{src:C_e,alt:"Empty Checkbox",style:{width:e==="lg"?"28px":"20px",height:e==="lg"?"28px":"20px"}})})}function A_e({onClose:t}){const e=fr(In),r=tm(),[n,i]=T.useState(),[s,o]=T.useState(),[a,c]=T.useState(),[l,f]=T.useState(),[u,h]=T.useState(),[g,y]=T.useState(),m=async()=>{if(n&&s&&a)await e.addNetwork({chainId:Number(n),name:s,title:s,type:Mt.MAINNET,rpcUrl:a,blockExplorer:l?{rootUrl:l}:void 0,nativeToken:{name:u||"Ether",symbol:g||"ETH",decimals:18}});else throw new Error("Please fill in all required fields, marked with *")},S=()=>{i(void 0),o(void 0),c(void 0),f(void 0),h(void 0),y(void 0)};return j.jsxs(ye,{flexDirection:"column",width:"full",children:[j.jsxs(ye,{flexDirection:"row",alignItems:"center",padding:"6",gap:"4",children:[j.jsx(Kt,{leftIcon:YW,onClick:t,size:"sm"}),j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Add Network"})]}),j.jsxs(ye,{flexDirection:"column",paddingX:"6",gap:"6",children:[j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Chain ID *"}),j.jsx(Sn,{name:"chainId",spellCheck:!1,value:n??"",onChange:E=>{i(E.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Network Name *"}),j.jsx(Sn,{name:"networkName",spellCheck:!1,value:s??"",onChange:E=>{o(E.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"RPC URL *"}),j.jsx(Sn,{name:"rpcUrl",spellCheck:!1,value:a??"",onChange:E=>{c(E.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Block Explorer URL (Optional)"}),j.jsx(Sn,{name:"blockExplorerUrl",spellCheck:!1,value:l??"",onChange:E=>{f(E.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Native Token Name (default: ETH)"}),j.jsx(Sn,{name:"tokenName",spellCheck:!1,value:u??"",onChange:E=>{h(E.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Native Token Symbol (default: ETH)"}),j.jsx(Sn,{name:"tokenSymbol",spellCheck:!1,value:g??"",onChange:E=>{y(E.target.value)}})]})]}),j.jsxs(ye,{position:"absolute",bottom:"0",right:"0",width:"full",children:[j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",gap:"2",padding:"6",children:[j.jsx(Kt,{label:"Cancel",shape:"square",onClick:()=>{S(),t()}}),j.jsx(Kt,{label:"Add Network",variant:"primary",shape:"square",onClick:async()=>{try{await m(),r({variant:"success",title:"Network added",description:`You can now use ${s} network`}),S(),t()}catch(E){r({variant:"error",title:"Could not add network",description:E.message}),console.error(E)}}})]})]})]})}function S_e(){const t=fr(In),[e,r]=T.useState(t.arweaveGatewayUrl.get()),[n,i]=T.useState(t.arweaveGraphqlUrl.get()),s=Object.values(Wr(t.unsavedArweaveURLs)||{}).length>0;return T.useEffect(()=>{e&&n&&(e!==t.arweaveGatewayUrl.get()||n!==t.arweaveGraphqlUrl.get()||s)&&t.addUnsavedArweaveURLs(e,n)},[e,n]),j.jsxs(ye,{flexDirection:"column",gap:"2",paddingTop:"6",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Gateway URL"}),j.jsx(Sn,{name:"arweaveGatewayUrl",spellCheck:!1,value:e??"",onChange:o=>{r(o.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"GraphQL URL"}),j.jsx(Sn,{name:"arweaveGraphqlUrl",spellCheck:!1,value:n??"",onChange:o=>{i(o.target.value)}})]})]})}function __e(){const t=fr(In),e=Wr(t.unsavedNetworkEditChainIds),r=Wr(t.unsavedArweaveURLs);return j.jsxs(ye,{flexDirection:"column",width:"full",position:"absolute",bottom:"0",background:"backgroundPrimary",children:[j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{alignSelf:"flex-end",padding:"5",gap:"2",children:[j.jsx(Kt,{leftIcon:$w,label:"Add Network",shape:"square",onClick:()=>t.isAddingNetwork.set(!0)}),j.jsx(Kt,{label:"Confirm",variant:"primary",shape:"square",disabled:e.length===0&&!Object.values(r||{}).length,onClick:()=>t.saveUnsavedNetworkEdits()})]})]})}function kS({value:t,selectedNetworkType:e}){const r=t===Mt.MAINNET?"Mainnets":t===Mt.TESTNET?"Testnets":"Arweave";return j.jsxs(mR.TabsTrigger,{value:t,style:{backgroundColor:"inherit",border:"none",cursor:"pointer"},children:[j.jsx(Te,{variant:"medium",fontWeight:"semibold",color:e===t?"text100":"text50",paddingX:"4",children:r}),e===t&&j.jsx(hi,{color:"white",height:"0.5",position:"relative",marginY:"0",style:{top:"6px"}})]})}function I_e({selectedNetworkType:t}){return j.jsxs(ye,{flexDirection:"column",width:"full",position:"absolute",background:"backgroundPrimary",children:[j.jsxs(ye,{paddingTop:"6",paddingX:"6",children:[j.jsx(Te,{variant:"xlarge",color:"text100",children:"Networks"}),j.jsx(mR.TabsList,{style:{marginTop:"24px"},children:j.jsxs(ye,{flexDirection:"row",style:{height:"36px"},children:[j.jsx(kS,{value:Mt.MAINNET,selectedNetworkType:t}),j.jsx(kS,{value:Mt.TESTNET,selectedNetworkType:t}),j.jsx(kS,{value:"arweave",selectedNetworkType:t})]})})]}),j.jsx(hi,{marginY:"0"})]})}function T_e({network:t}){var y;const e=fr(In),r=Wr(e.unsavedNetworkEditChainIds).includes(t.chainId),i=Wr(e.userAdditionNetworkChainIds).includes(t.chainId),s=e.editedNetworkChainIds.get().includes(t.chainId),[o,a]=T.useState(t.rpcUrl),[c,l]=T.useState(((y=t.blockExplorer)==null?void 0:y.rootUrl)??""),[f,u]=T.useState(t.disabled),[h,g]=T.useState(!0);return T.useEffect(()=>{(async()=>{const S=await e.isValidRpcUrl(o);g(S)})()},[o]),T.useEffect(()=>{var m;if(o!==t.rpcUrl||c!==((m=t.blockExplorer)==null?void 0:m.rootUrl)||f!==t.disabled||r){const S={...t};S.rpcUrl=o,S.blockExplorer={rootUrl:c},S.relayer=p5(o),S.disabled=f,e.addUnsavedNetworkEdit(S)}},[o,c,f]),j.jsxs(vn,{flexDirection:"column",gap:"4",children:[j.jsx(ye,{flexDirection:"row",gap:"3",children:j.jsx(Kt,{variant:"text",label:j.jsxs(ye,{flexDirection:"row",gap:"2",alignItems:"center",children:[j.jsx(ux,{checked:!f}),j.jsxs(Te,{variant:"medium",fontWeight:"semibold",color:h?r?"warning":"text80":"negative",children:[t.title," ",!h&&"(Invalid RPC URL)"," ",r&&"*"]}),(s||i)&&j.jsx(Te,{variant:"normal",color:"text50",children:i?`(Chain Id "${t.chainId}", added by you)`:"(edited)"})]}),onClick:()=>u(!f)})}),j.jsxs(B9.Root,{children:[j.jsx(B9.Trigger,{style:{backgroundColor:"inherit",border:"none",cursor:"pointer",width:"100%"},children:j.jsxs(ye,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[j.jsx(Te,{variant:"medium",fontWeight:"bold",color:f?"borderNormal":"text50",children:"Network Settings"}),j.jsx(Ak,{color:f?"text50":"text100"})]})}),j.jsx(B9.Content,{children:j.jsxs(ye,{flexDirection:"column",paddingTop:"4",gap:"3",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"RPC URL"}),j.jsx(Sn,{name:"rpcUrl",spellCheck:!1,value:o??"",onChange:m=>{a(m.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Block Explorer URL"}),j.jsx(Sn,{name:"blockExplorerUrl",spellCheck:!1,value:c??"",onChange:m=>{l(m.target.value)}})]})]})})]})]})}function VU({networks:t}){return j.jsx(ye,{flexDirection:"column",gap:"3",paddingY:"6",children:t.map((e,r)=>j.jsx(T_e,{network:e},r))})}function hte(){const t=fr(In),e=Wr(t.networks),r=Wr(t.userAdditionNetworkChainIds),n=Wr(t.isAddingNetwork),s=e.filter(l=>l.type===Mt.MAINNET).sort((l,f)=>r.includes(l.chainId)?-1:1),o=e.filter(l=>l.type===Mt.TESTNET),[a,c]=T.useState(Mt.MAINNET);return j.jsx(ye,{flexDirection:"column",children:n?j.jsx(A_e,{onClose:()=>t.isAddingNetwork.set(!1)}):j.jsxs(ye,{flexDirection:"column",justifyContent:"space-between",children:[j.jsxs(mR.Root,{value:a,onValueChange:l=>c(l),children:[j.jsx(I_e,{selectedNetworkType:a}),j.jsxs(ye,{paddingX:"6",style:{marginTop:"120px",marginBottom:"85px"},children:[j.jsx(K9,{value:Mt.MAINNET,children:j.jsx(VU,{networks:s})}),j.jsx(K9,{value:Mt.TESTNET,children:j.jsx(VU,{networks:o})}),j.jsx(K9,{value:"arweave",children:j.jsx(S_e,{})})]})]}),j.jsx(__e,{})]})})}const P_e="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='chain'%3e%3cpath%20id='Union'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.2383%203.6704L8.99999%201.80078L5.76172%203.6704V7.40963L8.99999%209.27924L12.2383%207.40963V3.6704ZM6.66172%204.37375V6.89001L8.54994%207.98018V5.33263L6.66172%204.37375ZM9.44994%205.31023V7.98023L11.3383%206.89001V4.3701L9.44994%205.31023Z'%20fill='%23888888'/%3e%3cpath%20id='Union_2'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.27659%2010.2798L5.03832%208.41016L1.80005%2010.2798V14.019L5.03832%2015.8886L8.27659%2014.019V10.2798ZM2.70005%2010.9831V13.4994L4.58827%2014.5896V11.942L2.70005%2010.9831ZM5.48827%2011.9196V14.5896L7.37659%2013.4994V10.9795L5.48827%2011.9196Z'%20fill='%23888888'/%3e%3cpath%20id='Union_3'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M16.3764%2010.2798L13.1382%208.41016L9.8999%2010.2798V14.019L13.1382%2015.8886L16.3764%2014.019V10.2798ZM10.7999%2010.9831V13.4994L12.6881%2014.5896V11.942L10.7999%2010.9831ZM13.5881%2011.9196V14.5896L15.4764%2013.4994V10.9795L13.5881%2011.9196Z'%20fill='%23888888'/%3e%3c/g%3e%3c/svg%3e",k_e="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='External%20Link%20Arrow'%3e%3cpath%20id='Union'%20d='M11.3471%206.07461H6.67672V4.72461H13.6517V11.6996H12.3017V7.0292L5.35401%2013.9769L4.39941%2013.0223L11.3471%206.07461Z'%20fill='%23888888'/%3e%3c/g%3e%3c/svg%3e";function mh(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function R_e(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function pte(...t){return e=>t.forEach(r=>R_e(r,e))}function Qh(...t){return T.useCallback(pte(...t),t)}function M_e(t,e=[]){let r=[];function n(s,o){const a=T.createContext(o),c=r.length;r=[...r,o];const l=u=>{var E;const{scope:h,children:g,...y}=u,m=((E=h==null?void 0:h[t])==null?void 0:E[c])||a,S=T.useMemo(()=>y,Object.values(y));return j.jsx(m.Provider,{value:S,children:g})};l.displayName=s+"Provider";function f(u,h){var m;const g=((m=h==null?void 0:h[t])==null?void 0:m[c])||a,y=T.useContext(g);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return[l,f]}const i=()=>{const s=r.map(o=>T.createContext(o));return function(a){const c=(a==null?void 0:a[t])||s;return T.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return i.scopeName=t,[n,O_e(i,...e)]}function O_e(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:l})=>{const u=c(s)[`__scope${l}`];return{...a,...u}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}var zM=T.forwardRef((t,e)=>{const{children:r,...n}=t,i=T.Children.toArray(r),s=i.find(N_e);if(s){const o=s.props.children,a=i.map(c=>c===s?T.Children.count(o)>1?T.Children.only(null):T.isValidElement(o)?o.props.children:null:c);return j.jsx(cT,{...n,ref:e,children:T.isValidElement(o)?T.cloneElement(o,void 0,a):null})}return j.jsx(cT,{...n,ref:e,children:r})});zM.displayName="Slot";var cT=T.forwardRef((t,e)=>{const{children:r,...n}=t;if(T.isValidElement(r)){const i=L_e(r);return T.cloneElement(r,{...B_e(n,r.props),ref:e?pte(e,i):i})}return T.Children.count(r)>1?T.Children.only(null):null});cT.displayName="SlotClone";var D_e=({children:t})=>j.jsx(j.Fragment,{children:t});function N_e(t){return T.isValidElement(t)&&t.type===D_e}function B_e(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{s(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function L_e(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var F_e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ku=F_e.reduce((t,e)=>{const r=T.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?zM:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),j.jsx(a,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function j_e(t,e){t&&ff.flushSync(()=>t.dispatchEvent(e))}function kh(t){const e=T.useRef(t);return T.useEffect(()=>{e.current=t}),T.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function U_e(t,e=globalThis==null?void 0:globalThis.document){const r=kh(t);T.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var $_e="DismissableLayer",lT="dismissableLayer.update",q_e="dismissableLayer.pointerDownOutside",V_e="dismissableLayer.focusOutside",zU,vte=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gte=T.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=t,l=T.useContext(vte),[f,u]=T.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=T.useState({}),y=Qh(e,I=>u(I)),m=Array.from(l.layers),[S]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),E=m.indexOf(S),A=f?m.indexOf(f):-1,P=l.layersWithOutsidePointerEventsDisabled.size>0,N=A>=E,L=G_e(I=>{const U=I.target,ie=[...l.branches].some(ae=>ae.contains(U));!N||ie||(i==null||i(I),o==null||o(I),I.defaultPrevented||a==null||a())},h),V=W_e(I=>{const U=I.target;[...l.branches].some(ae=>ae.contains(U))||(s==null||s(I),o==null||o(I),I.defaultPrevented||a==null||a())},h);return U_e(I=>{A===l.layers.size-1&&(n==null||n(I),!I.defaultPrevented&&a&&(I.preventDefault(),a()))},h),T.useEffect(()=>{if(f)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(zU=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),HU(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=zU)}},[f,h,r,l]),T.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),HU())},[f,l]),T.useEffect(()=>{const I=()=>g({});return document.addEventListener(lT,I),()=>document.removeEventListener(lT,I)},[]),j.jsx(Ku.div,{...c,ref:y,style:{pointerEvents:P?N?"auto":"none":void 0,...t.style},onFocusCapture:mh(t.onFocusCapture,V.onFocusCapture),onBlurCapture:mh(t.onBlurCapture,V.onBlurCapture),onPointerDownCapture:mh(t.onPointerDownCapture,L.onPointerDownCapture)})});gte.displayName=$_e;var z_e="DismissableLayerBranch",H_e=T.forwardRef((t,e)=>{const r=T.useContext(vte),n=T.useRef(null),i=Qh(e,n);return T.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),j.jsx(Ku.div,{...t,ref:i})});H_e.displayName=z_e;function G_e(t,e=globalThis==null?void 0:globalThis.document){const r=kh(t),n=T.useRef(!1),i=T.useRef(()=>{});return T.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){yte(q_e,r,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function W_e(t,e=globalThis==null?void 0:globalThis.document){const r=kh(t),n=T.useRef(!1);return T.useEffect(()=>{const i=s=>{s.target&&!n.current&&yte(V_e,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function HU(){const t=new CustomEvent(lT);document.dispatchEvent(t)}function yte(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?j_e(i,s):i.dispatchEvent(s)}var RS=0;function K_e(){T.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??GU()),document.body.insertAdjacentElement("beforeend",t[1]??GU()),RS++,()=>{RS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),RS--}},[])}function GU(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var MS="focusScope.autoFocusOnMount",OS="focusScope.autoFocusOnUnmount",WU={bubbles:!1,cancelable:!0},Y_e="FocusScope",mte=T.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,c]=T.useState(null),l=kh(i),f=kh(s),u=T.useRef(null),h=Qh(e,m=>c(m)),g=T.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;T.useEffect(()=>{if(n){let m=function(P){if(g.paused||!a)return;const N=P.target;a.contains(N)?u.current=N:Ed(u.current,{select:!0})},S=function(P){if(g.paused||!a)return;const N=P.relatedTarget;N!==null&&(a.contains(N)||Ed(u.current,{select:!0}))},E=function(P){if(document.activeElement===document.body)for(const L of P)L.removedNodes.length>0&&Ed(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",S);const A=new MutationObserver(E);return a&&A.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",S),A.disconnect()}}},[n,a,g.paused]),T.useEffect(()=>{if(a){YU.add(g);const m=document.activeElement;if(!a.contains(m)){const E=new CustomEvent(MS,WU);a.addEventListener(MS,l),a.dispatchEvent(E),E.defaultPrevented||(Q_e(tIe(bte(a)),{select:!0}),document.activeElement===m&&Ed(a))}return()=>{a.removeEventListener(MS,l),setTimeout(()=>{const E=new CustomEvent(OS,WU);a.addEventListener(OS,f),a.dispatchEvent(E),E.defaultPrevented||Ed(m??document.body,{select:!0}),a.removeEventListener(OS,f),YU.remove(g)},0)}}},[a,l,f,g]);const y=T.useCallback(m=>{if(!r&&!n||g.paused)return;const S=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,E=document.activeElement;if(S&&E){const A=m.currentTarget,[P,N]=J_e(A);P&&N?!m.shiftKey&&E===N?(m.preventDefault(),r&&Ed(P,{select:!0})):m.shiftKey&&E===P&&(m.preventDefault(),r&&Ed(N,{select:!0})):E===A&&m.preventDefault()}},[r,n,g.paused]);return j.jsx(Ku.div,{tabIndex:-1,...o,ref:h,onKeyDown:y})});mte.displayName=Y_e;function Q_e(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(Ed(n,{select:e}),document.activeElement!==r)return}function J_e(t){const e=bte(t),r=KU(e,t),n=KU(e.reverse(),t);return[r,n]}function bte(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function KU(t,e){for(const r of t)if(!Z_e(r,{upTo:e}))return r}function Z_e(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function X_e(t){return t instanceof HTMLInputElement&&"select"in t}function Ed(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&X_e(t)&&e&&t.select()}}var YU=eIe();function eIe(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=QU(t,e),t.unshift(e)},remove(e){var r;t=QU(t,e),(r=t[0])==null||r.resume()}}}function QU(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function tIe(t){return t.filter(e=>e.tagName!=="A")}var sp=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{},rIe=JT.useId||(()=>{}),nIe=0;function iIe(t){const[e,r]=T.useState(rIe());return sp(()=>{t||r(n=>n??String(nIe++))},[t]),t||(e?`radix-${e}`:"")}const sIe=["top","right","bottom","left"],Rh=Math.min,sa=Math.max,z4=Math.round,u6=Math.floor,Gl=t=>({x:t,y:t}),oIe={left:"right",right:"left",bottom:"top",top:"bottom"},aIe={start:"end",end:"start"};function fT(t,e,r){return sa(t,Rh(e,r))}function Bu(t,e){return typeof t=="function"?t(e):t}function Lu(t){return t.split("-")[0]}function dm(t){return t.split("-")[1]}function HM(t){return t==="x"?"y":"x"}function GM(t){return t==="y"?"height":"width"}function Mh(t){return["top","bottom"].includes(Lu(t))?"y":"x"}function WM(t){return HM(Mh(t))}function cIe(t,e,r){r===void 0&&(r=!1);const n=dm(t),i=WM(t),s=GM(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=H4(o)),[o,H4(o)]}function lIe(t){const e=H4(t);return[uT(t),e,uT(e)]}function uT(t){return t.replace(/start|end/g,e=>aIe[e])}function fIe(t,e,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return r?e?i:n:e?n:i;case"left":case"right":return e?s:o;default:return[]}}function uIe(t,e,r,n){const i=dm(t);let s=fIe(Lu(t),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(uT)))),s}function H4(t){return t.replace(/left|right|bottom|top/g,e=>oIe[e])}function dIe(t){return{top:0,right:0,bottom:0,left:0,...t}}function wte(t){return typeof t!="number"?dIe(t):{top:t,right:t,bottom:t,left:t}}function G4(t){const{x:e,y:r,width:n,height:i}=t;return{width:n,height:i,top:r,left:e,right:e+n,bottom:r+i,x:e,y:r}}function JU(t,e,r){let{reference:n,floating:i}=t;const s=Mh(e),o=WM(e),a=GM(o),c=Lu(e),l=s==="y",f=n.x+n.width/2-i.width/2,u=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2;let g;switch(c){case"top":g={x:f,y:n.y-i.height};break;case"bottom":g={x:f,y:n.y+n.height};break;case"right":g={x:n.x+n.width,y:u};break;case"left":g={x:n.x-i.width,y:u};break;default:g={x:n.x,y:n.y}}switch(dm(e)){case"start":g[o]-=h*(r&&l?-1:1);break;case"end":g[o]+=h*(r&&l?-1:1);break}return g}const hIe=async(t,e,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=JU(l,n,c),h=n,g={},y=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:c}=e,{element:l,padding:f=0}=Bu(t,e)||{};if(l==null)return{};const u=wte(f),h={x:r,y:n},g=WM(i),y=GM(g),m=await o.getDimensions(l),S=g==="y",E=S?"top":"left",A=S?"bottom":"right",P=S?"clientHeight":"clientWidth",N=s.reference[y]+s.reference[g]-h[g]-s.floating[y],L=h[g]-s.reference[g],V=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let I=V?V[P]:0;(!I||!await(o.isElement==null?void 0:o.isElement(V)))&&(I=a.floating[P]||s.floating[y]);const U=N/2-L/2,ie=I/2-m[y]/2-1,ae=Rh(u[E],ie),K=Rh(u[A],ie),R=ae,D=I-m[y]-K,v=I/2-m[y]/2+U,b=fT(R,v,D),M=!c.arrow&&dm(i)!=null&&v!==b&&s.reference[y]/2-(vv<=0)){var K,R;const v=(((K=s.flip)==null?void 0:K.index)||0)+1,b=I[v];if(b)return{data:{index:v,overflows:ae},reset:{placement:b}};let M=(R=ae.filter(B=>B.overflows[0]<=0).sort((B,x)=>B.overflows[1]-x.overflows[1])[0])==null?void 0:R.placement;if(!M)switch(g){case"bestFit":{var D;const B=(D=ae.filter(x=>{if(V){const C=Mh(x.placement);return C===A||C==="y"}return!0}).map(x=>[x.placement,x.overflows.filter(C=>C>0).reduce((C,w)=>C+w,0)]).sort((x,C)=>x[1]-C[1])[0])==null?void 0:D[0];B&&(M=B);break}case"initialPlacement":M=a;break}if(i!==M)return{reset:{placement:M}}}return{}}}};function ZU(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function XU(t){return sIe.some(e=>t[e]>=0)}const gIe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...i}=Bu(t,e);switch(n){case"referenceHidden":{const s=await cw(e,{...i,elementContext:"reference"}),o=ZU(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:XU(o)}}}case"escaped":{const s=await cw(e,{...i,altBoundary:!0}),o=ZU(s,r.floating);return{data:{escapedOffsets:o,escaped:XU(o)}}}default:return{}}}}};async function yIe(t,e){const{placement:r,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Lu(r),a=dm(r),c=Mh(r)==="y",l=["left","top"].includes(o)?-1:1,f=s&&c?-1:1,u=Bu(e,t);let{mainAxis:h,crossAxis:g,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof y=="number"&&(g=a==="end"?y*-1:y),c?{x:g*f,y:h*l}:{x:h*l,y:g*f}}const mIe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:i,y:s,placement:o,middlewareData:a}=e,c=await yIe(e,t);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},bIe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:S=>{let{x:E,y:A}=S;return{x:E,y:A}}},...c}=Bu(t,e),l={x:r,y:n},f=await cw(e,c),u=Mh(Lu(i)),h=HM(u);let g=l[h],y=l[u];if(s){const S=h==="y"?"top":"left",E=h==="y"?"bottom":"right",A=g+f[S],P=g-f[E];g=fT(A,g,P)}if(o){const S=u==="y"?"top":"left",E=u==="y"?"bottom":"right",A=y+f[S],P=y-f[E];y=fT(A,y,P)}const m=a.fn({...e,[h]:g,[u]:y});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[h]:s,[u]:o}}}}}},wIe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=Bu(t,e),f={x:r,y:n},u=Mh(i),h=HM(u);let g=f[h],y=f[u];const m=Bu(a,e),S=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const P=h==="y"?"height":"width",N=s.reference[h]-s.floating[P]+S.mainAxis,L=s.reference[h]+s.reference[P]-S.mainAxis;gL&&(g=L)}if(l){var E,A;const P=h==="y"?"width":"height",N=["top","left"].includes(Lu(i)),L=s.reference[u]-s.floating[P]+(N&&((E=o.offset)==null?void 0:E[u])||0)+(N?0:S.crossAxis),V=s.reference[u]+s.reference[P]+(N?0:((A=o.offset)==null?void 0:A[u])||0)-(N?S.crossAxis:0);yV&&(y=V)}return{[h]:g,[u]:y}}}},xIe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:c=()=>{},...l}=Bu(t,e),f=await cw(e,l),u=Lu(i),h=dm(i),g=Mh(i)==="y",{width:y,height:m}=s.floating;let S,E;u==="top"||u==="bottom"?(S=u,E=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(E=u,S=h==="end"?"top":"bottom");const A=m-f.top-f.bottom,P=y-f.left-f.right,N=Rh(m-f[S],A),L=Rh(y-f[E],P),V=!e.middlewareData.shift;let I=N,U=L;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(U=P),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(I=A),V&&!h){const ae=sa(f.left,0),K=sa(f.right,0),R=sa(f.top,0),D=sa(f.bottom,0);g?U=y-2*(ae!==0||K!==0?ae+K:sa(f.left,f.right)):I=m-2*(R!==0||D!==0?R+D:sa(f.top,f.bottom))}await c({...e,availableWidth:U,availableHeight:I});const ie=await o.getDimensions(a.floating);return y!==ie.width||m!==ie.height?{reset:{rects:!0}}:{}}}};function tC(){return typeof window<"u"}function hm(t){return xte(t)?(t.nodeName||"").toLowerCase():"#document"}function ha(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function df(t){var e;return(e=(xte(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function xte(t){return tC()?t instanceof Node||t instanceof ha(t).Node:!1}function Jc(t){return tC()?t instanceof Element||t instanceof ha(t).Element:!1}function nf(t){return tC()?t instanceof HTMLElement||t instanceof ha(t).HTMLElement:!1}function e$(t){return!tC()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ha(t).ShadowRoot}function dx(t){const{overflow:e,overflowX:r,overflowY:n,display:i}=Zc(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(i)}function EIe(t){return["table","td","th"].includes(hm(t))}function rC(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function KM(t){const e=YM(),r=Jc(t)?Zc(t):t;return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function CIe(t){let e=Oh(t);for(;nf(e)&&!Ly(e);){if(KM(e))return e;if(rC(e))return null;e=Oh(e)}return null}function YM(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ly(t){return["html","body","#document"].includes(hm(t))}function Zc(t){return ha(t).getComputedStyle(t)}function nC(t){return Jc(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Oh(t){if(hm(t)==="html")return t;const e=t.assignedSlot||t.parentNode||e$(t)&&t.host||df(t);return e$(e)?e.host:e}function Ete(t){const e=Oh(t);return Ly(e)?t.ownerDocument?t.ownerDocument.body:t.body:nf(e)&&dx(e)?e:Ete(e)}function lw(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const i=Ete(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),o=ha(i);if(s){const a=dT(o);return e.concat(o,o.visualViewport||[],dx(i)?i:[],a&&r?lw(a):[])}return e.concat(i,lw(i,[],r))}function dT(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Cte(t){const e=Zc(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=nf(t),s=i?t.offsetWidth:r,o=i?t.offsetHeight:n,a=z4(r)!==s||z4(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function QM(t){return Jc(t)?t:t.contextElement}function gg(t){const e=QM(t);if(!nf(e))return Gl(1);const r=e.getBoundingClientRect(),{width:n,height:i,$:s}=Cte(e);let o=(s?z4(r.width):r.width)/n,a=(s?z4(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const AIe=Gl(0);function Ate(t){const e=ha(t);return!YM()||!e.visualViewport?AIe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function SIe(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==ha(t)?!1:e}function op(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const i=t.getBoundingClientRect(),s=QM(t);let o=Gl(1);e&&(n?Jc(n)&&(o=gg(n)):o=gg(t));const a=SIe(s,r,n)?Ate(s):Gl(0);let c=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,f=i.width/o.x,u=i.height/o.y;if(s){const h=ha(s),g=n&&Jc(n)?ha(n):n;let y=h,m=dT(y);for(;m&&n&&g!==y;){const S=gg(m),E=m.getBoundingClientRect(),A=Zc(m),P=E.left+(m.clientLeft+parseFloat(A.paddingLeft))*S.x,N=E.top+(m.clientTop+parseFloat(A.paddingTop))*S.y;c*=S.x,l*=S.y,f*=S.x,u*=S.y,c+=P,l+=N,y=ha(m),m=dT(y)}}return G4({width:f,height:u,x:c,y:l})}function JM(t,e){const r=nC(t).scrollLeft;return e?e.left+r:op(df(t)).left+r}function Ste(t,e,r){r===void 0&&(r=!1);const n=t.getBoundingClientRect(),i=n.left+e.scrollLeft-(r?0:JM(t,n)),s=n.top+e.scrollTop;return{x:i,y:s}}function _Ie(t){let{elements:e,rect:r,offsetParent:n,strategy:i}=t;const s=i==="fixed",o=df(n),a=e?rC(e.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},l=Gl(1);const f=Gl(0),u=nf(n);if((u||!u&&!s)&&((hm(n)!=="body"||dx(o))&&(c=nC(n)),nf(n))){const g=op(n);l=gg(n),f.x=g.x+n.clientLeft,f.y=g.y+n.clientTop}const h=o&&!u&&!s?Ste(o,c,!0):Gl(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+f.x+h.x,y:r.y*l.y-c.scrollTop*l.y+f.y+h.y}}function IIe(t){return Array.from(t.getClientRects())}function TIe(t){const e=df(t),r=nC(t),n=t.ownerDocument.body,i=sa(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=sa(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+JM(t);const a=-r.scrollTop;return Zc(n).direction==="rtl"&&(o+=sa(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function PIe(t,e){const r=ha(t),n=df(t),i=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,c=0;if(i){s=i.width,o=i.height;const l=YM();(!l||l&&e==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function kIe(t,e){const r=op(t,!0,e==="fixed"),n=r.top+t.clientTop,i=r.left+t.clientLeft,s=nf(t)?gg(t):Gl(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,c=i*s.x,l=n*s.y;return{width:o,height:a,x:c,y:l}}function t$(t,e,r){let n;if(e==="viewport")n=PIe(t,r);else if(e==="document")n=TIe(df(t));else if(Jc(e))n=kIe(e,r);else{const i=Ate(t);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return G4(n)}function _te(t,e){const r=Oh(t);return r===e||!Jc(r)||Ly(r)?!1:Zc(r).position==="fixed"||_te(r,e)}function RIe(t,e){const r=e.get(t);if(r)return r;let n=lw(t,[],!1).filter(a=>Jc(a)&&hm(a)!=="body"),i=null;const s=Zc(t).position==="fixed";let o=s?Oh(t):t;for(;Jc(o)&&!Ly(o);){const a=Zc(o),c=KM(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||dx(o)&&!c&&_te(t,o))?n=n.filter(f=>f!==o):i=a,o=Oh(o)}return e.set(t,n),n}function MIe(t){let{element:e,boundary:r,rootBoundary:n,strategy:i}=t;const o=[...r==="clippingAncestors"?rC(e)?[]:RIe(e,this._c):[].concat(r),n],a=o[0],c=o.reduce((l,f)=>{const u=t$(e,f,i);return l.top=sa(u.top,l.top),l.right=Rh(u.right,l.right),l.bottom=Rh(u.bottom,l.bottom),l.left=sa(u.left,l.left),l},t$(e,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function OIe(t){const{width:e,height:r}=Cte(t);return{width:e,height:r}}function DIe(t,e,r){const n=nf(e),i=df(e),s=r==="fixed",o=op(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const c=Gl(0);if(n||!n&&!s)if((hm(e)!=="body"||dx(i))&&(a=nC(e)),n){const h=op(e,!0,s,e);c.x=h.x+e.clientLeft,c.y=h.y+e.clientTop}else i&&(c.x=JM(i));const l=i&&!n&&!s?Ste(i,a):Gl(0),f=o.left+a.scrollLeft-c.x-l.x,u=o.top+a.scrollTop-c.y-l.y;return{x:f,y:u,width:o.width,height:o.height}}function DS(t){return Zc(t).position==="static"}function r$(t,e){if(!nf(t)||Zc(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return df(t)===r&&(r=r.ownerDocument.body),r}function Ite(t,e){const r=ha(t);if(rC(t))return r;if(!nf(t)){let i=Oh(t);for(;i&&!Ly(i);){if(Jc(i)&&!DS(i))return i;i=Oh(i)}return r}let n=r$(t,e);for(;n&&EIe(n)&&DS(n);)n=r$(n,e);return n&&Ly(n)&&DS(n)&&!KM(n)?r:n||CIe(t)||r}const NIe=async function(t){const e=this.getOffsetParent||Ite,r=this.getDimensions,n=await r(t.floating);return{reference:DIe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function BIe(t){return Zc(t).direction==="rtl"}const LIe={convertOffsetParentRelativeRectToViewportRelativeRect:_Ie,getDocumentElement:df,getClippingRect:MIe,getOffsetParent:Ite,getElementRects:NIe,getClientRects:IIe,getDimensions:OIe,getScale:gg,isElement:Jc,isRTL:BIe};function FIe(t,e){let r=null,n;const i=df(t);function s(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const{left:l,top:f,width:u,height:h}=t.getBoundingClientRect();if(a||e(),!u||!h)return;const g=u6(f),y=u6(i.clientWidth-(l+u)),m=u6(i.clientHeight-(f+h)),S=u6(l),A={rootMargin:-g+"px "+-y+"px "+-m+"px "+-S+"px",threshold:sa(0,Rh(1,c))||1};let P=!0;function N(L){const V=L[0].intersectionRatio;if(V!==c){if(!P)return o();V?o(!1,V):n=setTimeout(()=>{o(!1,1e-7)},1e3)}P=!1}try{r=new IntersectionObserver(N,{...A,root:i.ownerDocument})}catch{r=new IntersectionObserver(N,A)}r.observe(t)}return o(!0),s}function jIe(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,l=QM(t),f=i||s?[...l?lw(l):[],...lw(e)]:[];f.forEach(E=>{i&&E.addEventListener("scroll",r,{passive:!0}),s&&E.addEventListener("resize",r)});const u=l&&a?FIe(l,r):null;let h=-1,g=null;o&&(g=new ResizeObserver(E=>{let[A]=E;A&&A.target===l&&g&&(g.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var P;(P=g)==null||P.observe(e)})),r()}),l&&!c&&g.observe(l),g.observe(e));let y,m=c?op(t):null;c&&S();function S(){const E=op(t);m&&(E.x!==m.x||E.y!==m.y||E.width!==m.width||E.height!==m.height)&&r(),m=E,y=requestAnimationFrame(S)}return r(),()=>{var E;f.forEach(A=>{i&&A.removeEventListener("scroll",r),s&&A.removeEventListener("resize",r)}),u==null||u(),(E=g)==null||E.disconnect(),g=null,c&&cancelAnimationFrame(y)}}const UIe=mIe,$Ie=bIe,qIe=vIe,VIe=xIe,zIe=gIe,n$=pIe,HIe=wIe,GIe=(t,e,r)=>{const n=new Map,i={platform:LIe,...r},s={...i.platform,_c:n};return hIe(t,e,{...i,platform:s})};var g5=typeof document<"u"?T.useLayoutEffect:T.useEffect;function W4(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!W4(t[n],e[n]))return!1;return!0}if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&t.$$typeof)&&!W4(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Tte(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function i$(t,e){const r=Tte(t);return Math.round(e*r)/r}function NS(t){const e=T.useRef(t);return g5(()=>{e.current=t}),e}function WIe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:c,open:l}=t,[f,u]=T.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[h,g]=T.useState(n);W4(h,n)||g(n);const[y,m]=T.useState(null),[S,E]=T.useState(null),A=T.useCallback(x=>{x!==V.current&&(V.current=x,m(x))},[]),P=T.useCallback(x=>{x!==I.current&&(I.current=x,E(x))},[]),N=s||y,L=o||S,V=T.useRef(null),I=T.useRef(null),U=T.useRef(f),ie=c!=null,ae=NS(c),K=NS(i),R=NS(l),D=T.useCallback(()=>{if(!V.current||!I.current)return;const x={placement:e,strategy:r,middleware:h};K.current&&(x.platform=K.current),GIe(V.current,I.current,x).then(C=>{const w={...C,isPositioned:R.current!==!1};v.current&&!W4(U.current,w)&&(U.current=w,ff.flushSync(()=>{u(w)}))})},[h,e,r,K,R]);g5(()=>{l===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,u(x=>({...x,isPositioned:!1})))},[l]);const v=T.useRef(!1);g5(()=>(v.current=!0,()=>{v.current=!1}),[]),g5(()=>{if(N&&(V.current=N),L&&(I.current=L),N&&L){if(ae.current)return ae.current(N,L,D);D()}},[N,L,D,ae,ie]);const b=T.useMemo(()=>({reference:V,floating:I,setReference:A,setFloating:P}),[A,P]),M=T.useMemo(()=>({reference:N,floating:L}),[N,L]),B=T.useMemo(()=>{const x={position:r,left:0,top:0};if(!M.floating)return x;const C=i$(M.floating,f.x),w=i$(M.floating,f.y);return a?{...x,transform:"translate("+C+"px, "+w+"px)",...Tte(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:C,top:w}},[r,a,M.floating,f.x,f.y]);return T.useMemo(()=>({...f,update:D,refs:b,elements:M,floatingStyles:B}),[f,D,b,M,B])}const KIe=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:i}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?n$({element:n.current,padding:i}).fn(r):{}:n?n$({element:n,padding:i}).fn(r):{}}}},YIe=(t,e)=>({...UIe(t),options:[t,e]}),QIe=(t,e)=>({...$Ie(t),options:[t,e]}),JIe=(t,e)=>({...HIe(t),options:[t,e]}),ZIe=(t,e)=>({...qIe(t),options:[t,e]}),XIe=(t,e)=>({...VIe(t),options:[t,e]}),eTe=(t,e)=>({...zIe(t),options:[t,e]}),tTe=(t,e)=>({...KIe(t),options:[t,e]});var rTe="Arrow",Pte=T.forwardRef((t,e)=>{const{children:r,width:n=10,height:i=5,...s}=t;return j.jsx(Ku.svg,{...s,ref:e,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:j.jsx("polygon",{points:"0,0 30,0 15,10"})})});Pte.displayName=rTe;var nTe=Pte;function iTe(t,e=[]){let r=[];function n(s,o){const a=T.createContext(o),c=r.length;r=[...r,o];function l(u){const{scope:h,children:g,...y}=u,m=(h==null?void 0:h[t][c])||a,S=T.useMemo(()=>y,Object.values(y));return j.jsx(m.Provider,{value:S,children:g})}function f(u,h){const g=(h==null?void 0:h[t][c])||a,y=T.useContext(g);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return l.displayName=s+"Provider",[l,f]}const i=()=>{const s=r.map(o=>T.createContext(o));return function(a){const c=(a==null?void 0:a[t])||s;return T.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return i.scopeName=t,[n,sTe(i,...e)]}function sTe(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:l})=>{const u=c(s)[`__scope${l}`];return{...a,...u}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function oTe(t){const[e,r]=T.useState(void 0);return sp(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const c=s.borderBoxSize,l=Array.isArray(c)?c[0]:c;o=l.inlineSize,a=l.blockSize}else o=t.offsetWidth,a=t.offsetHeight;r({width:o,height:a})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var ZM="Popper",[kte,Rte]=iTe(ZM),[aTe,Mte]=kte(ZM),Ote=t=>{const{__scopePopper:e,children:r}=t,[n,i]=T.useState(null);return j.jsx(aTe,{scope:e,anchor:n,onAnchorChange:i,children:r})};Ote.displayName=ZM;var Dte="PopperAnchor",Nte=T.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...i}=t,s=Mte(Dte,r),o=T.useRef(null),a=Qh(e,o);return T.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:j.jsx(Ku.div,{...i,ref:a})});Nte.displayName=Dte;var XM="PopperContent",[cTe,lTe]=kte(XM),Bte=T.forwardRef((t,e)=>{var W,Z,te,F,ee,fe;const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:y,...m}=t,S=Mte(XM,r),[E,A]=T.useState(null),P=Qh(e,xe=>A(xe)),[N,L]=T.useState(null),V=oTe(N),I=(V==null?void 0:V.width)??0,U=(V==null?void 0:V.height)??0,ie=n+(s!=="center"?"-"+s:""),ae=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},K=Array.isArray(l)?l:[l],R=K.length>0,D={padding:ae,boundary:K.filter(uTe),altBoundary:R},{refs:v,floatingStyles:b,placement:M,isPositioned:B,middlewareData:x}=WIe({strategy:"fixed",placement:ie,whileElementsMounted:(...xe)=>jIe(...xe,{animationFrame:g==="always"}),elements:{reference:S.anchor},middleware:[YIe({mainAxis:i+U,alignmentAxis:o}),c&&QIe({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?JIe():void 0,...D}),c&&ZIe({...D}),XIe({...D,apply:({elements:xe,rects:_e,availableWidth:Me,availableHeight:Ke})=>{const{width:ze,height:Je}=_e.reference,Xe=xe.floating.style;Xe.setProperty("--radix-popper-available-width",`${Me}px`),Xe.setProperty("--radix-popper-available-height",`${Ke}px`),Xe.setProperty("--radix-popper-anchor-width",`${ze}px`),Xe.setProperty("--radix-popper-anchor-height",`${Je}px`)}}),N&&tTe({element:N,padding:a}),dTe({arrowWidth:I,arrowHeight:U}),h&&eTe({strategy:"referenceHidden",...D})]}),[C,w]=jte(M),k=kh(y);sp(()=>{B&&(k==null||k())},[B,k]);const O=(W=x.arrow)==null?void 0:W.x,G=(Z=x.arrow)==null?void 0:Z.y,oe=((te=x.arrow)==null?void 0:te.centerOffset)!==0,[$,X]=T.useState();return sp(()=>{E&&X(window.getComputedStyle(E).zIndex)},[E]),j.jsx("div",{ref:v.setFloating,"data-radix-popper-content-wrapper":"",style:{...b,transform:B?b.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:$,"--radix-popper-transform-origin":[(F=x.transformOrigin)==null?void 0:F.x,(ee=x.transformOrigin)==null?void 0:ee.y].join(" "),...((fe=x.hide)==null?void 0:fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:j.jsx(cTe,{scope:r,placedSide:C,onArrowChange:L,arrowX:O,arrowY:G,shouldHideArrow:oe,children:j.jsx(Ku.div,{"data-side":C,"data-align":w,...m,ref:P,style:{...m.style,animation:B?void 0:"none"}})})})});Bte.displayName=XM;var Lte="PopperArrow",fTe={top:"bottom",right:"left",bottom:"top",left:"right"},Fte=T.forwardRef(function(e,r){const{__scopePopper:n,...i}=e,s=lTe(Lte,n),o=fTe[s.placedSide];return j.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:j.jsx(nTe,{...i,ref:r,style:{...i.style,display:"block"}})})});Fte.displayName=Lte;function uTe(t){return t!==null}var dTe=t=>({name:"transformOrigin",options:t,fn(e){var S,E,A;const{placement:r,rects:n,middlewareData:i}=e,o=((S=i.arrow)==null?void 0:S.centerOffset)!==0,a=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[l,f]=jte(r),u={start:"0%",center:"50%",end:"100%"}[f],h=(((E=i.arrow)==null?void 0:E.x)??0)+a/2,g=(((A=i.arrow)==null?void 0:A.y)??0)+c/2;let y="",m="";return l==="bottom"?(y=o?u:`${h}px`,m=`${-c}px`):l==="top"?(y=o?u:`${h}px`,m=`${n.floating.height+c}px`):l==="right"?(y=`${-c}px`,m=o?u:`${g}px`):l==="left"&&(y=`${n.floating.width+c}px`,m=o?u:`${g}px`),{data:{x:y,y:m}}}});function jte(t){const[e,r="center"]=t.split("-");return[e,r]}var hTe=Ote,Ute=Nte,pTe=Bte,vTe=Fte,gTe="Portal",$te=T.forwardRef((t,e)=>{var a;const{container:r,...n}=t,[i,s]=T.useState(!1);sp(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?fG.createPortal(j.jsx(Ku.div,{...n,ref:e}),o):null});$te.displayName=gTe;function yTe(t,e){return T.useReducer((r,n)=>e[r][n]??r,t)}var eO=t=>{const{present:e,children:r}=t,n=mTe(e),i=typeof r=="function"?r({present:n.isPresent}):T.Children.only(r),s=Qh(n.ref,bTe(i));return typeof r=="function"||n.isPresent?T.cloneElement(i,{ref:s}):null};eO.displayName="Presence";function mTe(t){const[e,r]=T.useState(),n=T.useRef({}),i=T.useRef(t),s=T.useRef("none"),o=t?"mounted":"unmounted",[a,c]=yTe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const l=d6(n.current);s.current=a==="mounted"?l:"none"},[a]),sp(()=>{const l=n.current,f=i.current;if(f!==t){const h=s.current,g=d6(l);t?c("MOUNT"):g==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(f&&h!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),sp(()=>{if(e){let l;const f=e.ownerDocument.defaultView??window,u=g=>{const m=d6(n.current).includes(g.animationName);if(g.target===e&&m&&(c("ANIMATION_END"),!i.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",l=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},h=g=>{g.target===e&&(s.current=d6(n.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{f.clearTimeout(l),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:T.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function d6(t){return(t==null?void 0:t.animationName)||"none"}function bTe(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function wTe({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,i]=xTe({defaultProp:e,onChange:r}),s=t!==void 0,o=s?t:n,a=kh(r),c=T.useCallback(l=>{if(s){const u=typeof l=="function"?l(t):l;u!==t&&a(u)}else i(l)},[s,t,i,a]);return[o,c]}function xTe({defaultProp:t,onChange:e}){const r=T.useState(t),[n]=r,i=T.useRef(n),s=kh(e);return T.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var ETe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},dv=new WeakMap,h6=new WeakMap,p6={},BS=0,qte=function(t){return t&&(t.host||qte(t.parentNode))},CTe=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=qte(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},ATe=function(t,e,r,n){var i=CTe(e,Array.isArray(t)?t:[t]);p6[r]||(p6[r]=new WeakMap);var s=p6[r],o=[],a=new Set,c=new Set(i),l=function(u){!u||a.has(u)||(a.add(u),l(u.parentNode))};i.forEach(l);var f=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(a.has(h))f(h);else try{var g=h.getAttribute(n),y=g!==null&&g!=="false",m=(dv.get(h)||0)+1,S=(s.get(h)||0)+1;dv.set(h,m),s.set(h,S),o.push(h),m===1&&y&&h6.set(h,!0),S===1&&h.setAttribute(r,"true"),y||h.setAttribute(n,"true")}catch(E){console.error("aria-hidden: cannot operate on ",h,E)}})};return f(e),a.clear(),BS++,function(){o.forEach(function(u){var h=dv.get(u)-1,g=s.get(u)-1;dv.set(u,h),s.set(u,g),h||(h6.has(u)||u.removeAttribute(n),h6.delete(u)),g||u.removeAttribute(r)}),BS--,BS||(dv=new WeakMap,dv=new WeakMap,h6=new WeakMap,p6={})}},STe=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=ETe(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),ATe(n,i,r,"aria-hidden")):function(){return null}},Ll=function(){return Ll=Object.assign||function(e){for(var r,n=1,i=arguments.length;n"u")return qTe;var e=VTe(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},HTe=Gte(),yg="data-scroll-locked",GTe=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),` + L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z`,fill:"currentColor",className:"octo-body"})]})})]})},g_e="/assets/sequence-logo-B9LB7ao9.svg";function dte({variant:t="md",...e}){return j.jsxs(ye,{gap:"2",...e,children:[j.jsx(Fi,{src:g_e,height:t==="md"?"7":"10"}),j.jsx(Te,{variant:t==="md"?"large":"xlarge",fontWeight:"bold",color:"text100",children:"Sequence"}),j.jsx(Te,{variant:t==="md"?"large":"xlarge",fontWeight:"bold",color:"text50",children:"Wallet Recovery"})]})}function y_e(){return j.jsx(ye,{justifyContent:"flex-end",width:"full",position:"absolute",bottom:"0",padding:"10",children:j.jsx(Vt,{label:j.jsx(ye,{children:j.jsx(Te,{variant:"small",fontWeight:"bold",color:"text50",children:"Learn more"})}),variant:"text",onClick:()=>window.open("https://docs.sequence.xyz/")})})}const m_e="data:image/svg+xml,%3csvg%20width='20'%20height='21'%20viewBox='0%200%2020%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Contracts'%3e%3cg%20id='Subtract'%3e%3cpath%20d='M7%2017.5L7%209.89599C6.55852%209.7031%206.25%209.26258%206.25%208.75C6.25%208.05964%206.80964%207.5%207.5%207.5C8.19036%207.5%208.75%208.05964%208.75%208.75C8.75%209.26258%208.44148%209.7031%208%209.89599L8%2014.9244L10.7331%2013.8995V12.8884C10.3007%2012.6918%2010%2012.256%2010%2011.75C10%2011.0596%2010.5596%2010.5%2011.25%2010.5C11.9404%2010.5%2012.5%2011.0596%2012.5%2011.75C12.5%2012.2691%2012.1836%2012.7143%2011.7331%2012.9032V14.5925L8%2015.9924L8%2017.5L16%2017.5V8.64587L10.4552%208.64587V3.5H4V17.5L7%2017.5Z'%20fill='white'/%3e%3cpath%20d='M15.931%207.65688L11.5103%203.56422L11.5661%207.65688L15.931%207.65688Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",b_e="data:image/svg+xml,%3csvg%20width='20'%20height='21'%20viewBox='0%200%2020%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Wallet'%3e%3cpath%20id='Exclude'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5%206.54947C5%206.99261%205.38931%207.35185%205.86954%207.35185H16C16.5523%207.35185%2017%207.79957%2017%208.35185V15.5C17%2016.0523%2016.5523%2016.5%2016%2016.5H5.49505C4.11707%2016.5%203%2015.4692%203%2014.1977V6.80233C3%205.53079%204.11707%204.5%205.49505%204.5H13.8765C14.2208%204.5%2014.5%204.77917%2014.5%205.12355C14.5%205.46792%2014.2208%205.74709%2013.8765%205.74709H5.86955C5.38931%205.74709%205%206.10633%205%206.54947ZM12%2012C12%2011.1716%2012.6716%2010.5%2013.5%2010.5C14.3284%2010.5%2015%2011.1716%2015%2012C15%2012.8284%2014.3284%2013.5%2013.5%2013.5C12.6716%2013.5%2012%2012.8284%2012%2012Z'%20fill='white'/%3e%3c/g%3e%3c/svg%3e";function w_e(){const t=fr(oi),e=Wr(t.isLoadingAccount),[r,n]=T.useState(""),[i,s]=T.useState(!1),[o,a]=T.useState(!1),c=async()=>{try{await t.loadAccount(r)}catch(u){console.warn(u),a(!0)}},l=()=>{s(!0)},f=()=>{t.logout(),s(!1),t.isLoadingAccount.set(!1)};return j.jsxs(ye,{justifyContent:"center",height:"vh",style:{background:"linear-gradient(to bottom, #280a6b, #000000 50%)"},children:[j.jsxs(ye,{flexDirection:"column",justifyContent:"center",alignItems:"center",width:"full",style:{maxWidth:"1000px"},gap:"10",children:[j.jsxs(ye,{flexDirection:"column",gap:"6",children:[j.jsx(dte,{variant:"lg",justifyContent:"center"}),j.jsx(Te,{textAlign:"center",variant:"xlarge",color:"text100",style:{fontSize:"40px",lineHeight:"44px"},children:"A fully open source and forever accessible way to recover your Sequence Wallet"})]}),e?j.jsxs(j.Fragment,{children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Enter your password to continue and unlock your wallet"}),j.jsxs(ye,{flexDirection:"column",gap:"4",width:"3/4",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Password"}),j.jsx(Sn,{type:"password",value:r,autoFocus:!0,onKeyPress:u=>{u.key==="Enter"&&c()},onChange:u=>{n(u.target.value),a(!1)}}),o&&j.jsx(Te,{variant:"small",color:"negative",marginLeft:"2",marginTop:"1",children:"Incorrect password"})]}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",gap:"4",children:[j.jsx(Vt,{label:"Forgot password?",variant:"text",shape:"square",onClick:()=>l()}),j.jsx(Vt,{label:"Continue",variant:"primary",shape:"square",onClick:()=>c()})]})]})]}):j.jsxs(j.Fragment,{children:[j.jsxs(ye,{gap:"2",children:[j.jsx(Vt,{label:"Learn more",size:"md",onClick:()=>window.open("https://docs.sequence.xyz/")}),j.jsx(Vt,{as:JQ,to:"/recovery",label:"Start Recovery",variant:"primary",size:"md"})]}),j.jsxs(ye,{flexDirection:"row",gap:"2",width:"2/3",children:[j.jsxs(vn,{flexDirection:"column",gap:"2",children:[j.jsxs(ye,{flexDirection:"row",gap:"2",children:[j.jsx(Fi,{src:m_e}),j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:"Connect to Applications"})]}),j.jsx(Te,{variant:"normal",color:"text50",children:"Connect your wallet to any web3 application via Walletconnect"})]}),j.jsxs(vn,{flexDirection:"column",gap:"2",children:[j.jsxs(ye,{flexDirection:"row",gap:"2",children:[j.jsx(Fi,{src:b_e}),j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:"Move funds anywhere"})]}),j.jsx(Te,{variant:"normal",color:"text50",children:"Transfer funds securely to any wallet, fully decentralized"})]})]})]})]}),i&&j.jsx(oa,{size:"md",onClose:()=>s(!1),children:j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",color:"text100",marginRight:"8",children:"Are you sure you want to sign out?"}),j.jsxs(Te,{variant:"normal",color:"text50",children:["If you do not remember your password, you can reset and start over.",j.jsx("br",{})," This will require you to re-enter your mnemonic."]}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",gap:"2",children:[j.jsx(Vt,{label:"Yes, reset",shape:"square",variant:"primary",onClick:()=>f()}),j.jsx(Vt,{label:"Cancel",shape:"square",onClick:()=>s(!1)})]})]})}),j.jsx(y_e,{})]})}const x_e={"0x087Aa00C1f09464D1D6a9Ff0eE2377dBB7c7B324":[{wallet:"0xaf39AE56e001250FaCBd122b11A90d32A0aD6686",subdigest:"0x0f4490a7aa40f15929635252953ce594ba3342401c2c53eff56451dc147475da"}],"0x09A820a9109E5EC82DCfF24484b2047739a92Abc":[{wallet:"0xcF47342c7064AAA5BA0F4163bEA0c7545756b8BF",subdigest:"0xa598ddbe6372b985f60367a1a9c12cb99e20e38c782d9bc941ddaa9f4c9296e5"}],"0x0aBb5b9d20f06DAdF752CEeBe4df26E585A1d897":[{wallet:"0x3F00C5A7fEadD358429645b29b3d776C5f61892d",subdigest:"0x7c33d7864e6e6f92e39328b407fc8fa0206c6ebdb5a31d9056dcc96bba5eb108"}],"0x0f286489b5b85EAcC4E00e1902e138b5Aa662F1c":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x76009a037ebbb28a9f71f1e68c38291e3b2b1a4bf772a56a79e1a6336cbbc7ab"}],"0x1A535D13c62F240cC7985B05a0229182D546550e":[{wallet:"0x46Ba18e7eCB93362A1804cC47EaD90244945016D",subdigest:"0x0acff6ca38c72b9287ba8163569a452ce12c9ffd64c082feba8a5f7300546579"}],"0x1B9498d7177a09d98ABE532e472e1b9f32dAc9B8":[{wallet:"0x848045071DbdBa2F352dF2f0335e02ba61f205aC"}],"0x253ff3Dd87c440A9565814756f85219F487e2FFe":[{wallet:"0xd18a46E40b29FA6CFC0D9f5A930E72cD0EC1e4D2",subdigest:"0x12822b7fde91535103ee7757fe362bfdca0dc2e25211c6ca7c133c20a66d604f"}],"0x27D263a5707510378823fa496674EeC7656780B6":[{wallet:"0xBc4f7bB193ac09D7eC53eF0a499B073A296A94f0",subdigest:"0xbf3913760753e93aba2f40235dd03e693f85853d7c9f9c5f1f62ce7ee91c6313"}],"0x36fA6B68007575C100c1C2916942ee857dE0778E":[{wallet:"0x52CE3cab58639223cf870A73942175e6C7BA9A0C",subdigest:"0x455b01f5c47ece34a3f4dee5d9b3d3b590d524029f4e845b2d4eccb7e8d9472b"}],"0x3Ed9724712417687eb0eaBc2cA2e452E3d2DCdEc":[{wallet:"0x4955338954fFF19396Fe4bA17D93370cA8b77d2B",subdigest:"0x96c4ddf36a03af12b56cf6dc618ab83d814b86a01c69464f1b94bfca826e47fa"}],"0x3F0c7e32678Bc6dCf9dEfB6368EcaE7B88C69036":[{wallet:"0x592625C316A2F184F0C6a4b2952e9b40Ef111a26",subdigest:"0x5e9cf684e8dcf38d5b079a89ff4644de144c85ca16e3b618ab4ae490becff25f"},{wallet:"0xEBB418588FFc0785B6a2559a281A37c117679D6F",subdigest:"0x98be9228917ad8193e14102ed0a989689ec6af1f04bd731f3cca43c02c1abc07"}],"0x4577CAF3A5caBcaF2038863d361cb32f423d5d53":[{wallet:"0xF68f5A97abAAa940A9Ad3AeD723C2179F8551502",subdigest:"0x336448a71e4188cd95c39b278d6d26144d51dc5b3edfdd2af67c3b0425a2e2d3"}],"0x50d27302c45FE4FC8d7cc435920a22D477d3DEB2":[{wallet:"0x97692217ca8e06D7156ef7f4606faB4624bd10C0",subdigest:"0x898993e7c2394c1c9b63b2cfa637a8a2c7b04ce9387c9ecc9c56ef1f56ae58be"}],"0x57160B380fF4Edf3DA3b1c27e723dc2AB3f057Be":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x89f982d77ae08a8ea17d6755d297615f5756e5363db8a9b95758d5a981f8e4ae"}],"0x6647b94603e0D90265d8869a3656C1b0F9B6caC5":[{wallet:"0x6cDe6f20610FF172Cd838CDF69Aae3c27521CBa4",subdigest:"0xab2d0dbda84cffb9a3934412172236a9d98fd3d6b80d47b35956cc5f935c69de"}],"0x69DD1F76595E8a49252F16DDa69474c3a818E3c0":[{wallet:"0x756F9E22591e0aC2Aa0C365708aF0a516F269979",subdigest:"0x261126c464ac19bb769c407ec28fe026f297357938ba9024bd66bb5a48ca9349"}],"0x6Ae23160FBB280Ae4eE78C476ca9FDb51bBcC444":[{wallet:"0xDfA3338DD0147b5e7793cE040F92462177e00024",subdigest:"0xae67c59800e8dd98b955a5fb857c39971fe5fb29e3e5083246fd122b37c4ee88"}],"0x6B917b4459Db2C9cb774e0a9B0eee668273e191a":[{wallet:"0x676b5FaCD2380F51d4EB1A2492057A31FfB100c5",subdigest:"0x60a62db58b5be8277ff22e8104ead5c4d87d6d1173fd7b2b0174978e663974c7"}],"0x6b593de1F2c6cEf51693323edc4467c2A4D5B78B":[{wallet:"0xD9DF096A66A89e63eE977C5Fda59a65f872a6901",subdigest:"0x8ef909db0fd633cac1445a89dace09c5b2fa1bda2d85e5915f6afc2d547f6a87"}],"0x6c77214450C1060f2f6a093c8054278b77E8769b":[{wallet:"0x16b47E837ff421382D516cA5A79b76aFd8473675",subdigest:"0x67521db115964b2559b99d5854ab07bae09e6e6cb0c1cd3de3d1f553c31c515f"}],"0x70F2E179c95a6e3b9a2Fe742B88568a12FFF7f8B":[{wallet:"0x649ba7F76D856aB021C9EEB8bac3B46f3e72EfD0",subdigest:"0x178be5e2d834d0224794dfbe49cf9621127d3396b75246a32093a21e6db320eb"}],"0x77fCC4D33ae477f217a09Ec8dBEBC22E7e8F5e33":[{wallet:"0xD09C7A6Af7046F45343978A1620391D6237c3762",subdigest:"0xca780c4505a811222e215eceeb2b28f222c1a6b126e9ccc86560f5199c34d5da"}],"0x78C22edc81d7a7A1D690e6C91824Cf9Eff2760c8":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xd84553d4372b26e3eb96fa77bd157e4e1b593bff1c54c7e69ad8857673d2266e"}],"0x79621cB0c2c8FbB8Ca20E4177b7DF0Aa7a931e73":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0xbd64f6f75e64b49c6a4f46b2715ca3bf11e21a7e07702b89ea1607e3884e9d40"}],"0x79A7DF6E89da1AEa293bFa11987d7CE828223a7A":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x858235d87309c9e2d72dca9bfa41b61fbb635ac6d9e099b868ff8a8c99bf8c37"}],"0x7b1A301155c0Fad8e5b95055e2A100333D464eA3":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x31001033b765a3cc9407304daeafeeda015d318e73be3de8832a9dc1377f9340"}],"0x85c5B1f9464723A2cC81F69A71a11dA528E0CBCe":[{wallet:"0xF178cE73DB2bA1C575D5c63ecA490b09ec31949b",subdigest:"0x65e9c76ef7e14697c6fd1822fbd39719b43091f13d2d051c911d1373175c2c42"}],"0x943237FFB0024Bf758A79db00e043789FD8299f0":[{wallet:"0x639b6017C4b8F8a5322205A68a1331A817Dd46e2",subdigest:"0xa3bc90cafcccb0fe0b8c0939fa908216ddc667d6b022fe54efca05ec815c163c"}],"0x9EeA332285d7B3755CB46f7D0D49CF0edcC112Ef":[{wallet:"0x04EfBe99e49001b78bB68c35B0354CD4a2Ac4Fd8",subdigest:"0xd3c43ef36d4347d1b5323fa188cf8482de05631a86bc05b12b8ce3b661f4d2f9"}],"0x9b704574e65F8b785FD125F5f3C4F7E34690Bd02":[{wallet:"0xBA9498300dFE650a2b59A42271ec771B6Ed6a091",subdigest:"0x9894f57b20f78245e02d424a21f0d361038905285f53c51c1949e27f39a9fbb8"}],"0xA923984d96b7327c60f246da366b2525B34C6984":[{wallet:"0x7ae10aA190513577D9Ac9ae146128d97df4F4fF0",subdigest:"0x3b849360d50831070d92bec368b63cf0725525cd7b60f406cee5357731b75457"}],"0xACFC6D1DB5875Cb72E1b6BaddaCe28F45044ee6a":[{wallet:"0xAdAf943368aB95208763ccAcCD5ecB9a7772de40",subdigest:"0xb0d0da150a42bca8103e1c40e5e99c7a190043b3121f52c6d41ae473597d0ebe"}],"0xB278dd7c9FC754dBc82Ac29C6f78B6301BE8E8C6":[{wallet:"0xeCc653CB03a9B6587Bcb58A8372535b6Ea5a17d6",subdigest:"0x6fd9bb4768107b4bd0f3c8e11b00027ee5e6417b1d4ab3d5e56c1724eeb2e3b2"}],"0xBaA9D704C8244071e6B9bF6BcbC2c2281dB75096":[{wallet:"0xb547CcA265A91f7a92d9a97804807962B2A4D7d8",subdigest:"0xfca7ea635bf9e89d7034ce6d9378ff6948eaa340ab2d428e5b157efc82b9f8d5"}],"0xC29fD04F9079c36dC15549e8AAF8F058214F0Dae":[{wallet:"0xB7005885711d54BD3594Be1955266d37470BD053",subdigest:"0xb0bc66ea204ea2cb93ca190189471392b59fb8608cb75a69a7b01b7096338428"}],"0xD2751030a5007895968414443efae561BdCB1Af2":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0x2872f961dd02e7b3fabd4a7bed036259085de28fe2f1c0f49a5d1be6ae4c7b07"}],"0xD721d5849fDE7862E77D251B6fA711114f4579Ab":[{wallet:"0x77415fb6aFe8A13275b088f1e197Bd9EDa1AA95C",subdigest:"0xc775316600b59750707446a7915cf88cc6f1827ce931dd688bf5990a7b95ec29"}],"0xE1B6c2c194dF83A8E01F8C582ddA58840fE46318":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xde7ebed8b2c62552e8ff5a08d2e5b33d336d709e6cf2812b9874cd7b5fd5189e"}],"0xE5Ed2A916971Fa6fe07EbD4564DeAaF2c20A7684":[{wallet:"0xFDB7922bA08BAbad2e3e36b66e0521c7EEA0faEF"}],"0xF9ED1e54dc86Bf248FBe059D4aEfD8183F0A816F":[{wallet:"0xCdFdaDB6F2b2f3c7db93521AbD05a3C32aF6b226",subdigest:"0x0433c483ced183cee562b8061788fc93d0c9f666af896096a5e184076f787eac"}],"0xa3CF0b935AccFd8bbE569B984D9Bc7Ec775ce22d":[{wallet:"0x23C6B8E47fa9f40e73E6627598d13085130f3ed6",subdigest:"0x13e9cd21769bc2a4f779b0f73c1cc7ca6c96c6af3262721eec17ac72104fef32"}],"0xbe9f4fB13fbC98042a32dC8354A339258abf1456":[{wallet:"0x81fF1aD4232671403e0f3CC85D021144511E3B6e",subdigest:"0x130c5b993a04ab84b0b074ea69241d6f3c040eced24dbe7c2015263718526670"}],"0xd4b26195aD1487DE6a42Fd69bC81CEbc8b86f0b5":[{wallet:"0xF36A0bd53d85307b35f90756263984329FBfA176",subdigest:"0x13d918ac4e97df0477fcab1c210ef1f96a999abe64dd07e48017b96c4902f50b"}],"0xdaD0038b8BBf78Ac84a4566E75269339Daa0dEdC":[{wallet:"0x8Fd48EB1ecDc0652306de1A0A8BA5561Ba733351",subdigest:"0x3541d7b2f07d87fa8b30c9ef1594da2353d45c40830f0c8e01126e3c89b9b508"}],"0xe7d51Cd5097A287a3B63014dc453Cfb8D9A03152":[{wallet:"0x4E5B1F98F81372BD4B763Be9bF50Aa6C5B7b9913",subdigest:"0x818fbd74398f446b4d7fcb207bf6377393fa923732243995d8464844ec8d42ce"}],"0xed7F28464630398E06e0Fa0Fc04FEa2fe40427aB":[{wallet:"0x6D0f613C239ed1d409C4e41758ACd55E0b1Cb410",subdigest:"0xe6baef08a191785d5d3897cb3e96f3473585d2f034657a4134754c5206b87268"}],"0xf24d3aFE0768827EAe9f671F3C1c283BfFAF0C19":[{wallet:"0xf03Bf61943e00fa3557E496409e1E9c95a1c24E4",subdigest:"0x3d1192dcd531e9ec60795b4129b03eb54b9226bc2d08be3f2b2524ae80244afb"}],"0xf3bf75114bEf71abE4E87f8CA4dD82E372b948A9":[{wallet:"0x3e270820e36EC3C29903C2635B0f53f192Dc29ab",subdigest:"0x70f563cb3ba62214e88d61e55450a8f4245bc5666aa006c93802ad2e96d3ac05"}],"0xf95C86e3a52dEbf8b984983852CAc5d8652C8A9A":[{wallet:"0xb07d236F2B5d1f4AB12236e94ac8049dE40321F4",subdigest:"0x877c04b91ea48703e9cc936f4506d89943ed8b9ec32b15990eea41ce0c59dde7"}],"0xfed1D937a8708001A23AFD8AEd02f9E05de9f251":[{wallet:"0x6743b60A94898E228c5aa642A2e11cb595dCB1fB"}]},E_e="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Checkmark'%3e%3cpath%20id='Vector%20332%20(Stroke)'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13.0635%204.14864L6.93414%2013.8114L2.99475%209.38482L3.89118%208.58706L6.77296%2011.8253L12.0502%203.50586L13.0635%204.14864Z'%20fill='white'/%3e%3c/g%3e%3c/svg%3e",C_e="data:image/svg+xml,%3csvg%20width='22'%20height='22'%20viewBox='0%200%2022%2022'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='atoms/square%20checkbox'%3e%3cpath%20id='checkbox'%20d='M0.5%204C0.5%202.067%202.067%200.5%204%200.5H18C19.933%200.5%2021.5%202.067%2021.5%204V18C21.5%2019.933%2019.933%2021.5%2018%2021.5H4C2.067%2021.5%200.5%2019.933%200.5%2018V4Z'%20stroke='%234F4F4F'/%3e%3c/g%3e%3c/svg%3e";function ux({checked:t,size:e="lg"}){return j.jsx(ye,{width:e==="lg"?"7":"5",height:e==="lg"?"7":"5",justifyContent:"center",alignItems:"center",style:{borderRadius:e==="lg"?"6px":"3px",background:t?"#4F4F4F":"inherit"},children:t?j.jsx("img",{src:E_e,alt:"Checkmark",style:{width:e==="lg"?"16px":"12px",height:e==="lg"?"16px":"12px"}}):j.jsx("img",{src:C_e,alt:"Empty Checkbox",style:{width:e==="lg"?"28px":"20px",height:e==="lg"?"28px":"20px"}})})}function A_e({onClose:t}){const e=fr(In),r=tm(),[n,i]=T.useState(),[s,o]=T.useState(),[a,c]=T.useState(),[l,f]=T.useState(),[u,h]=T.useState(),[g,y]=T.useState(),m=async()=>{if(n&&s&&a)await e.addNetwork({chainId:Number(n),name:s,title:s,type:Mt.MAINNET,rpcUrl:a,blockExplorer:l?{rootUrl:l}:void 0,nativeToken:{name:u||"Ether",symbol:g||"ETH",decimals:18}});else throw new Error("Please fill in all required fields, marked with *")},S=()=>{i(void 0),o(void 0),c(void 0),f(void 0),h(void 0),y(void 0)};return j.jsxs(ye,{flexDirection:"column",width:"full",children:[j.jsxs(ye,{flexDirection:"row",alignItems:"center",padding:"6",gap:"4",children:[j.jsx(Vt,{leftIcon:YW,onClick:t,size:"sm"}),j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Add Network"})]}),j.jsxs(ye,{flexDirection:"column",paddingX:"6",gap:"6",children:[j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Chain ID *"}),j.jsx(Sn,{name:"chainId",spellCheck:!1,value:n??"",onChange:E=>{i(E.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Network Name *"}),j.jsx(Sn,{name:"networkName",spellCheck:!1,value:s??"",onChange:E=>{o(E.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"RPC URL *"}),j.jsx(Sn,{name:"rpcUrl",spellCheck:!1,value:a??"",onChange:E=>{c(E.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Block Explorer URL (Optional)"}),j.jsx(Sn,{name:"blockExplorerUrl",spellCheck:!1,value:l??"",onChange:E=>{f(E.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Native Token Name (default: ETH)"}),j.jsx(Sn,{name:"tokenName",spellCheck:!1,value:u??"",onChange:E=>{h(E.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Native Token Symbol (default: ETH)"}),j.jsx(Sn,{name:"tokenSymbol",spellCheck:!1,value:g??"",onChange:E=>{y(E.target.value)}})]})]}),j.jsxs(ye,{position:"absolute",bottom:"0",right:"0",width:"full",children:[j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",gap:"2",padding:"6",children:[j.jsx(Vt,{label:"Cancel",shape:"square",onClick:()=>{S(),t()}}),j.jsx(Vt,{label:"Add Network",variant:"primary",shape:"square",onClick:async()=>{try{await m(),r({variant:"success",title:"Network added",description:`You can now use ${s} network`}),S(),t()}catch(E){r({variant:"error",title:"Could not add network",description:E.message}),console.error(E)}}})]})]})]})}function S_e(){const t=fr(In),[e,r]=T.useState(t.arweaveGatewayUrl.get()),[n,i]=T.useState(t.arweaveGraphqlUrl.get()),s=Object.values(Wr(t.unsavedArweaveURLs)||{}).length>0;return T.useEffect(()=>{e&&n&&(e!==t.arweaveGatewayUrl.get()||n!==t.arweaveGraphqlUrl.get()||s)&&t.addUnsavedArweaveURLs(e,n)},[e,n]),j.jsxs(ye,{flexDirection:"column",gap:"2",paddingTop:"6",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Gateway URL"}),j.jsx(Sn,{name:"arweaveGatewayUrl",spellCheck:!1,value:e??"",onChange:o=>{r(o.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"GraphQL URL"}),j.jsx(Sn,{name:"arweaveGraphqlUrl",spellCheck:!1,value:n??"",onChange:o=>{i(o.target.value)}})]})]})}function __e(){const t=fr(In),e=Wr(t.unsavedNetworkEditChainIds),r=Wr(t.unsavedArweaveURLs);return j.jsxs(ye,{flexDirection:"column",width:"full",position:"absolute",bottom:"0",background:"backgroundPrimary",children:[j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{alignSelf:"flex-end",padding:"5",gap:"2",children:[j.jsx(Vt,{leftIcon:$w,label:"Add Network",shape:"square",onClick:()=>t.isAddingNetwork.set(!0)}),j.jsx(Vt,{label:"Confirm",variant:"primary",shape:"square",disabled:e.length===0&&!Object.values(r||{}).length,onClick:()=>t.saveUnsavedNetworkEdits()})]})]})}function kS({value:t,selectedNetworkType:e}){const r=t===Mt.MAINNET?"Mainnets":t===Mt.TESTNET?"Testnets":"Arweave";return j.jsxs(mR.TabsTrigger,{value:t,style:{backgroundColor:"inherit",border:"none",cursor:"pointer"},children:[j.jsx(Te,{variant:"medium",fontWeight:"semibold",color:e===t?"text100":"text50",paddingX:"4",children:r}),e===t&&j.jsx(hi,{color:"white",height:"0.5",position:"relative",marginY:"0",style:{top:"6px"}})]})}function I_e({selectedNetworkType:t}){return j.jsxs(ye,{flexDirection:"column",width:"full",position:"absolute",background:"backgroundPrimary",children:[j.jsxs(ye,{paddingTop:"6",paddingX:"6",children:[j.jsx(Te,{variant:"xlarge",color:"text100",children:"Networks"}),j.jsx(mR.TabsList,{style:{marginTop:"24px"},children:j.jsxs(ye,{flexDirection:"row",style:{height:"36px"},children:[j.jsx(kS,{value:Mt.MAINNET,selectedNetworkType:t}),j.jsx(kS,{value:Mt.TESTNET,selectedNetworkType:t}),j.jsx(kS,{value:"arweave",selectedNetworkType:t})]})})]}),j.jsx(hi,{marginY:"0"})]})}function T_e({network:t}){var y;const e=fr(In),r=Wr(e.unsavedNetworkEditChainIds).includes(t.chainId),i=Wr(e.userAdditionNetworkChainIds).includes(t.chainId),s=e.editedNetworkChainIds.get().includes(t.chainId),[o,a]=T.useState(t.rpcUrl),[c,l]=T.useState(((y=t.blockExplorer)==null?void 0:y.rootUrl)??""),[f,u]=T.useState(t.disabled),[h,g]=T.useState(!0);return T.useEffect(()=>{(async()=>{const S=await e.isValidRpcUrl(o);g(S)})()},[o]),T.useEffect(()=>{var m;if(o!==t.rpcUrl||c!==((m=t.blockExplorer)==null?void 0:m.rootUrl)||f!==t.disabled||r){const S={...t};S.rpcUrl=o,S.blockExplorer={rootUrl:c},S.relayer=p5(o),S.disabled=f,e.addUnsavedNetworkEdit(S)}},[o,c,f]),j.jsxs(vn,{flexDirection:"column",gap:"4",children:[j.jsx(ye,{flexDirection:"row",gap:"3",children:j.jsx(Vt,{variant:"text",label:j.jsxs(ye,{flexDirection:"row",gap:"2",alignItems:"center",children:[j.jsx(ux,{checked:!f}),j.jsxs(Te,{variant:"medium",fontWeight:"semibold",color:h?r?"warning":"text80":"negative",children:[t.title," ",!h&&"(Invalid RPC URL)"," ",r&&"*"]}),(s||i)&&j.jsx(Te,{variant:"normal",color:"text50",children:i?`(Chain Id "${t.chainId}", added by you)`:"(edited)"})]}),onClick:()=>u(!f)})}),j.jsxs(B9.Root,{children:[j.jsx(B9.Trigger,{style:{backgroundColor:"inherit",border:"none",cursor:"pointer",width:"100%"},children:j.jsxs(ye,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[j.jsx(Te,{variant:"medium",fontWeight:"bold",color:f?"borderNormal":"text50",children:"Network Settings"}),j.jsx(Ak,{color:f?"text50":"text100"})]})}),j.jsx(B9.Content,{children:j.jsxs(ye,{flexDirection:"column",paddingTop:"4",gap:"3",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"RPC URL"}),j.jsx(Sn,{name:"rpcUrl",spellCheck:!1,value:o??"",onChange:m=>{a(m.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text100",children:"Block Explorer URL"}),j.jsx(Sn,{name:"blockExplorerUrl",spellCheck:!1,value:c??"",onChange:m=>{l(m.target.value)}})]})]})})]})]})}function VU({networks:t}){return j.jsx(ye,{flexDirection:"column",gap:"3",paddingY:"6",children:t.map((e,r)=>j.jsx(T_e,{network:e},r))})}function hte(){const t=fr(In),e=Wr(t.networks),r=Wr(t.userAdditionNetworkChainIds),n=Wr(t.isAddingNetwork),s=e.filter(l=>l.type===Mt.MAINNET).sort((l,f)=>r.includes(l.chainId)?-1:1),o=e.filter(l=>l.type===Mt.TESTNET),[a,c]=T.useState(Mt.MAINNET);return j.jsx(ye,{flexDirection:"column",children:n?j.jsx(A_e,{onClose:()=>t.isAddingNetwork.set(!1)}):j.jsxs(ye,{flexDirection:"column",justifyContent:"space-between",children:[j.jsxs(mR.Root,{value:a,onValueChange:l=>c(l),children:[j.jsx(I_e,{selectedNetworkType:a}),j.jsxs(ye,{paddingX:"6",style:{marginTop:"120px",marginBottom:"85px"},children:[j.jsx(K9,{value:Mt.MAINNET,children:j.jsx(VU,{networks:s})}),j.jsx(K9,{value:Mt.TESTNET,children:j.jsx(VU,{networks:o})}),j.jsx(K9,{value:"arweave",children:j.jsx(S_e,{})})]})]}),j.jsx(__e,{})]})})}const P_e="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='chain'%3e%3cpath%20id='Union'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.2383%203.6704L8.99999%201.80078L5.76172%203.6704V7.40963L8.99999%209.27924L12.2383%207.40963V3.6704ZM6.66172%204.37375V6.89001L8.54994%207.98018V5.33263L6.66172%204.37375ZM9.44994%205.31023V7.98023L11.3383%206.89001V4.3701L9.44994%205.31023Z'%20fill='%23888888'/%3e%3cpath%20id='Union_2'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.27659%2010.2798L5.03832%208.41016L1.80005%2010.2798V14.019L5.03832%2015.8886L8.27659%2014.019V10.2798ZM2.70005%2010.9831V13.4994L4.58827%2014.5896V11.942L2.70005%2010.9831ZM5.48827%2011.9196V14.5896L7.37659%2013.4994V10.9795L5.48827%2011.9196Z'%20fill='%23888888'/%3e%3cpath%20id='Union_3'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M16.3764%2010.2798L13.1382%208.41016L9.8999%2010.2798V14.019L13.1382%2015.8886L16.3764%2014.019V10.2798ZM10.7999%2010.9831V13.4994L12.6881%2014.5896V11.942L10.7999%2010.9831ZM13.5881%2011.9196V14.5896L15.4764%2013.4994V10.9795L13.5881%2011.9196Z'%20fill='%23888888'/%3e%3c/g%3e%3c/svg%3e",k_e="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='External%20Link%20Arrow'%3e%3cpath%20id='Union'%20d='M11.3471%206.07461H6.67672V4.72461H13.6517V11.6996H12.3017V7.0292L5.35401%2013.9769L4.39941%2013.0223L11.3471%206.07461Z'%20fill='%23888888'/%3e%3c/g%3e%3c/svg%3e";function mh(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function R_e(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function pte(...t){return e=>t.forEach(r=>R_e(r,e))}function Qh(...t){return T.useCallback(pte(...t),t)}function M_e(t,e=[]){let r=[];function n(s,o){const a=T.createContext(o),c=r.length;r=[...r,o];const l=u=>{var E;const{scope:h,children:g,...y}=u,m=((E=h==null?void 0:h[t])==null?void 0:E[c])||a,S=T.useMemo(()=>y,Object.values(y));return j.jsx(m.Provider,{value:S,children:g})};l.displayName=s+"Provider";function f(u,h){var m;const g=((m=h==null?void 0:h[t])==null?void 0:m[c])||a,y=T.useContext(g);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return[l,f]}const i=()=>{const s=r.map(o=>T.createContext(o));return function(a){const c=(a==null?void 0:a[t])||s;return T.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return i.scopeName=t,[n,O_e(i,...e)]}function O_e(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:l})=>{const u=c(s)[`__scope${l}`];return{...a,...u}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}var zM=T.forwardRef((t,e)=>{const{children:r,...n}=t,i=T.Children.toArray(r),s=i.find(N_e);if(s){const o=s.props.children,a=i.map(c=>c===s?T.Children.count(o)>1?T.Children.only(null):T.isValidElement(o)?o.props.children:null:c);return j.jsx(cT,{...n,ref:e,children:T.isValidElement(o)?T.cloneElement(o,void 0,a):null})}return j.jsx(cT,{...n,ref:e,children:r})});zM.displayName="Slot";var cT=T.forwardRef((t,e)=>{const{children:r,...n}=t;if(T.isValidElement(r)){const i=L_e(r);return T.cloneElement(r,{...B_e(n,r.props),ref:e?pte(e,i):i})}return T.Children.count(r)>1?T.Children.only(null):null});cT.displayName="SlotClone";var D_e=({children:t})=>j.jsx(j.Fragment,{children:t});function N_e(t){return T.isValidElement(t)&&t.type===D_e}function B_e(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{s(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function L_e(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var F_e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ku=F_e.reduce((t,e)=>{const r=T.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?zM:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),j.jsx(a,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function j_e(t,e){t&&ff.flushSync(()=>t.dispatchEvent(e))}function kh(t){const e=T.useRef(t);return T.useEffect(()=>{e.current=t}),T.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function U_e(t,e=globalThis==null?void 0:globalThis.document){const r=kh(t);T.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var $_e="DismissableLayer",lT="dismissableLayer.update",q_e="dismissableLayer.pointerDownOutside",V_e="dismissableLayer.focusOutside",zU,vte=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gte=T.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=t,l=T.useContext(vte),[f,u]=T.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=T.useState({}),y=Qh(e,I=>u(I)),m=Array.from(l.layers),[S]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),E=m.indexOf(S),A=f?m.indexOf(f):-1,P=l.layersWithOutsidePointerEventsDisabled.size>0,N=A>=E,L=G_e(I=>{const U=I.target,ie=[...l.branches].some(ae=>ae.contains(U));!N||ie||(i==null||i(I),o==null||o(I),I.defaultPrevented||a==null||a())},h),V=W_e(I=>{const U=I.target;[...l.branches].some(ae=>ae.contains(U))||(s==null||s(I),o==null||o(I),I.defaultPrevented||a==null||a())},h);return U_e(I=>{A===l.layers.size-1&&(n==null||n(I),!I.defaultPrevented&&a&&(I.preventDefault(),a()))},h),T.useEffect(()=>{if(f)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(zU=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),HU(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=zU)}},[f,h,r,l]),T.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),HU())},[f,l]),T.useEffect(()=>{const I=()=>g({});return document.addEventListener(lT,I),()=>document.removeEventListener(lT,I)},[]),j.jsx(Ku.div,{...c,ref:y,style:{pointerEvents:P?N?"auto":"none":void 0,...t.style},onFocusCapture:mh(t.onFocusCapture,V.onFocusCapture),onBlurCapture:mh(t.onBlurCapture,V.onBlurCapture),onPointerDownCapture:mh(t.onPointerDownCapture,L.onPointerDownCapture)})});gte.displayName=$_e;var z_e="DismissableLayerBranch",H_e=T.forwardRef((t,e)=>{const r=T.useContext(vte),n=T.useRef(null),i=Qh(e,n);return T.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),j.jsx(Ku.div,{...t,ref:i})});H_e.displayName=z_e;function G_e(t,e=globalThis==null?void 0:globalThis.document){const r=kh(t),n=T.useRef(!1),i=T.useRef(()=>{});return T.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){yte(q_e,r,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function W_e(t,e=globalThis==null?void 0:globalThis.document){const r=kh(t),n=T.useRef(!1);return T.useEffect(()=>{const i=s=>{s.target&&!n.current&&yte(V_e,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function HU(){const t=new CustomEvent(lT);document.dispatchEvent(t)}function yte(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?j_e(i,s):i.dispatchEvent(s)}var RS=0;function K_e(){T.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??GU()),document.body.insertAdjacentElement("beforeend",t[1]??GU()),RS++,()=>{RS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),RS--}},[])}function GU(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var MS="focusScope.autoFocusOnMount",OS="focusScope.autoFocusOnUnmount",WU={bubbles:!1,cancelable:!0},Y_e="FocusScope",mte=T.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,c]=T.useState(null),l=kh(i),f=kh(s),u=T.useRef(null),h=Qh(e,m=>c(m)),g=T.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;T.useEffect(()=>{if(n){let m=function(P){if(g.paused||!a)return;const N=P.target;a.contains(N)?u.current=N:Ed(u.current,{select:!0})},S=function(P){if(g.paused||!a)return;const N=P.relatedTarget;N!==null&&(a.contains(N)||Ed(u.current,{select:!0}))},E=function(P){if(document.activeElement===document.body)for(const L of P)L.removedNodes.length>0&&Ed(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",S);const A=new MutationObserver(E);return a&&A.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",S),A.disconnect()}}},[n,a,g.paused]),T.useEffect(()=>{if(a){YU.add(g);const m=document.activeElement;if(!a.contains(m)){const E=new CustomEvent(MS,WU);a.addEventListener(MS,l),a.dispatchEvent(E),E.defaultPrevented||(Q_e(tIe(bte(a)),{select:!0}),document.activeElement===m&&Ed(a))}return()=>{a.removeEventListener(MS,l),setTimeout(()=>{const E=new CustomEvent(OS,WU);a.addEventListener(OS,f),a.dispatchEvent(E),E.defaultPrevented||Ed(m??document.body,{select:!0}),a.removeEventListener(OS,f),YU.remove(g)},0)}}},[a,l,f,g]);const y=T.useCallback(m=>{if(!r&&!n||g.paused)return;const S=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,E=document.activeElement;if(S&&E){const A=m.currentTarget,[P,N]=J_e(A);P&&N?!m.shiftKey&&E===N?(m.preventDefault(),r&&Ed(P,{select:!0})):m.shiftKey&&E===P&&(m.preventDefault(),r&&Ed(N,{select:!0})):E===A&&m.preventDefault()}},[r,n,g.paused]);return j.jsx(Ku.div,{tabIndex:-1,...o,ref:h,onKeyDown:y})});mte.displayName=Y_e;function Q_e(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(Ed(n,{select:e}),document.activeElement!==r)return}function J_e(t){const e=bte(t),r=KU(e,t),n=KU(e.reverse(),t);return[r,n]}function bte(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function KU(t,e){for(const r of t)if(!Z_e(r,{upTo:e}))return r}function Z_e(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function X_e(t){return t instanceof HTMLInputElement&&"select"in t}function Ed(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&X_e(t)&&e&&t.select()}}var YU=eIe();function eIe(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=QU(t,e),t.unshift(e)},remove(e){var r;t=QU(t,e),(r=t[0])==null||r.resume()}}}function QU(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function tIe(t){return t.filter(e=>e.tagName!=="A")}var sp=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{},rIe=JT.useId||(()=>{}),nIe=0;function iIe(t){const[e,r]=T.useState(rIe());return sp(()=>{t||r(n=>n??String(nIe++))},[t]),t||(e?`radix-${e}`:"")}const sIe=["top","right","bottom","left"],Rh=Math.min,sa=Math.max,z4=Math.round,u6=Math.floor,Gl=t=>({x:t,y:t}),oIe={left:"right",right:"left",bottom:"top",top:"bottom"},aIe={start:"end",end:"start"};function fT(t,e,r){return sa(t,Rh(e,r))}function Bu(t,e){return typeof t=="function"?t(e):t}function Lu(t){return t.split("-")[0]}function dm(t){return t.split("-")[1]}function HM(t){return t==="x"?"y":"x"}function GM(t){return t==="y"?"height":"width"}function Mh(t){return["top","bottom"].includes(Lu(t))?"y":"x"}function WM(t){return HM(Mh(t))}function cIe(t,e,r){r===void 0&&(r=!1);const n=dm(t),i=WM(t),s=GM(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=H4(o)),[o,H4(o)]}function lIe(t){const e=H4(t);return[uT(t),e,uT(e)]}function uT(t){return t.replace(/start|end/g,e=>aIe[e])}function fIe(t,e,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return r?e?i:n:e?n:i;case"left":case"right":return e?s:o;default:return[]}}function uIe(t,e,r,n){const i=dm(t);let s=fIe(Lu(t),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(uT)))),s}function H4(t){return t.replace(/left|right|bottom|top/g,e=>oIe[e])}function dIe(t){return{top:0,right:0,bottom:0,left:0,...t}}function wte(t){return typeof t!="number"?dIe(t):{top:t,right:t,bottom:t,left:t}}function G4(t){const{x:e,y:r,width:n,height:i}=t;return{width:n,height:i,top:r,left:e,right:e+n,bottom:r+i,x:e,y:r}}function JU(t,e,r){let{reference:n,floating:i}=t;const s=Mh(e),o=WM(e),a=GM(o),c=Lu(e),l=s==="y",f=n.x+n.width/2-i.width/2,u=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2;let g;switch(c){case"top":g={x:f,y:n.y-i.height};break;case"bottom":g={x:f,y:n.y+n.height};break;case"right":g={x:n.x+n.width,y:u};break;case"left":g={x:n.x-i.width,y:u};break;default:g={x:n.x,y:n.y}}switch(dm(e)){case"start":g[o]-=h*(r&&l?-1:1);break;case"end":g[o]+=h*(r&&l?-1:1);break}return g}const hIe=async(t,e,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=JU(l,n,c),h=n,g={},y=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:c}=e,{element:l,padding:f=0}=Bu(t,e)||{};if(l==null)return{};const u=wte(f),h={x:r,y:n},g=WM(i),y=GM(g),m=await o.getDimensions(l),S=g==="y",E=S?"top":"left",A=S?"bottom":"right",P=S?"clientHeight":"clientWidth",N=s.reference[y]+s.reference[g]-h[g]-s.floating[y],L=h[g]-s.reference[g],V=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let I=V?V[P]:0;(!I||!await(o.isElement==null?void 0:o.isElement(V)))&&(I=a.floating[P]||s.floating[y]);const U=N/2-L/2,ie=I/2-m[y]/2-1,ae=Rh(u[E],ie),K=Rh(u[A],ie),R=ae,D=I-m[y]-K,v=I/2-m[y]/2+U,b=fT(R,v,D),M=!c.arrow&&dm(i)!=null&&v!==b&&s.reference[y]/2-(vv<=0)){var K,R;const v=(((K=s.flip)==null?void 0:K.index)||0)+1,b=I[v];if(b)return{data:{index:v,overflows:ae},reset:{placement:b}};let M=(R=ae.filter(B=>B.overflows[0]<=0).sort((B,x)=>B.overflows[1]-x.overflows[1])[0])==null?void 0:R.placement;if(!M)switch(g){case"bestFit":{var D;const B=(D=ae.filter(x=>{if(V){const C=Mh(x.placement);return C===A||C==="y"}return!0}).map(x=>[x.placement,x.overflows.filter(C=>C>0).reduce((C,w)=>C+w,0)]).sort((x,C)=>x[1]-C[1])[0])==null?void 0:D[0];B&&(M=B);break}case"initialPlacement":M=a;break}if(i!==M)return{reset:{placement:M}}}return{}}}};function ZU(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function XU(t){return sIe.some(e=>t[e]>=0)}const gIe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...i}=Bu(t,e);switch(n){case"referenceHidden":{const s=await cw(e,{...i,elementContext:"reference"}),o=ZU(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:XU(o)}}}case"escaped":{const s=await cw(e,{...i,altBoundary:!0}),o=ZU(s,r.floating);return{data:{escapedOffsets:o,escaped:XU(o)}}}default:return{}}}}};async function yIe(t,e){const{placement:r,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Lu(r),a=dm(r),c=Mh(r)==="y",l=["left","top"].includes(o)?-1:1,f=s&&c?-1:1,u=Bu(e,t);let{mainAxis:h,crossAxis:g,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof y=="number"&&(g=a==="end"?y*-1:y),c?{x:g*f,y:h*l}:{x:h*l,y:g*f}}const mIe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:i,y:s,placement:o,middlewareData:a}=e,c=await yIe(e,t);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},bIe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:S=>{let{x:E,y:A}=S;return{x:E,y:A}}},...c}=Bu(t,e),l={x:r,y:n},f=await cw(e,c),u=Mh(Lu(i)),h=HM(u);let g=l[h],y=l[u];if(s){const S=h==="y"?"top":"left",E=h==="y"?"bottom":"right",A=g+f[S],P=g-f[E];g=fT(A,g,P)}if(o){const S=u==="y"?"top":"left",E=u==="y"?"bottom":"right",A=y+f[S],P=y-f[E];y=fT(A,y,P)}const m=a.fn({...e,[h]:g,[u]:y});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[h]:s,[u]:o}}}}}},wIe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=Bu(t,e),f={x:r,y:n},u=Mh(i),h=HM(u);let g=f[h],y=f[u];const m=Bu(a,e),S=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const P=h==="y"?"height":"width",N=s.reference[h]-s.floating[P]+S.mainAxis,L=s.reference[h]+s.reference[P]-S.mainAxis;gL&&(g=L)}if(l){var E,A;const P=h==="y"?"width":"height",N=["top","left"].includes(Lu(i)),L=s.reference[u]-s.floating[P]+(N&&((E=o.offset)==null?void 0:E[u])||0)+(N?0:S.crossAxis),V=s.reference[u]+s.reference[P]+(N?0:((A=o.offset)==null?void 0:A[u])||0)-(N?S.crossAxis:0);yV&&(y=V)}return{[h]:g,[u]:y}}}},xIe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:c=()=>{},...l}=Bu(t,e),f=await cw(e,l),u=Lu(i),h=dm(i),g=Mh(i)==="y",{width:y,height:m}=s.floating;let S,E;u==="top"||u==="bottom"?(S=u,E=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(E=u,S=h==="end"?"top":"bottom");const A=m-f.top-f.bottom,P=y-f.left-f.right,N=Rh(m-f[S],A),L=Rh(y-f[E],P),V=!e.middlewareData.shift;let I=N,U=L;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(U=P),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(I=A),V&&!h){const ae=sa(f.left,0),K=sa(f.right,0),R=sa(f.top,0),D=sa(f.bottom,0);g?U=y-2*(ae!==0||K!==0?ae+K:sa(f.left,f.right)):I=m-2*(R!==0||D!==0?R+D:sa(f.top,f.bottom))}await c({...e,availableWidth:U,availableHeight:I});const ie=await o.getDimensions(a.floating);return y!==ie.width||m!==ie.height?{reset:{rects:!0}}:{}}}};function tC(){return typeof window<"u"}function hm(t){return xte(t)?(t.nodeName||"").toLowerCase():"#document"}function ha(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function df(t){var e;return(e=(xte(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function xte(t){return tC()?t instanceof Node||t instanceof ha(t).Node:!1}function Jc(t){return tC()?t instanceof Element||t instanceof ha(t).Element:!1}function nf(t){return tC()?t instanceof HTMLElement||t instanceof ha(t).HTMLElement:!1}function e$(t){return!tC()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ha(t).ShadowRoot}function dx(t){const{overflow:e,overflowX:r,overflowY:n,display:i}=Zc(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(i)}function EIe(t){return["table","td","th"].includes(hm(t))}function rC(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function KM(t){const e=YM(),r=Jc(t)?Zc(t):t;return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function CIe(t){let e=Oh(t);for(;nf(e)&&!Ly(e);){if(KM(e))return e;if(rC(e))return null;e=Oh(e)}return null}function YM(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ly(t){return["html","body","#document"].includes(hm(t))}function Zc(t){return ha(t).getComputedStyle(t)}function nC(t){return Jc(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Oh(t){if(hm(t)==="html")return t;const e=t.assignedSlot||t.parentNode||e$(t)&&t.host||df(t);return e$(e)?e.host:e}function Ete(t){const e=Oh(t);return Ly(e)?t.ownerDocument?t.ownerDocument.body:t.body:nf(e)&&dx(e)?e:Ete(e)}function lw(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const i=Ete(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),o=ha(i);if(s){const a=dT(o);return e.concat(o,o.visualViewport||[],dx(i)?i:[],a&&r?lw(a):[])}return e.concat(i,lw(i,[],r))}function dT(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Cte(t){const e=Zc(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=nf(t),s=i?t.offsetWidth:r,o=i?t.offsetHeight:n,a=z4(r)!==s||z4(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function QM(t){return Jc(t)?t:t.contextElement}function gg(t){const e=QM(t);if(!nf(e))return Gl(1);const r=e.getBoundingClientRect(),{width:n,height:i,$:s}=Cte(e);let o=(s?z4(r.width):r.width)/n,a=(s?z4(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const AIe=Gl(0);function Ate(t){const e=ha(t);return!YM()||!e.visualViewport?AIe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function SIe(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==ha(t)?!1:e}function op(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const i=t.getBoundingClientRect(),s=QM(t);let o=Gl(1);e&&(n?Jc(n)&&(o=gg(n)):o=gg(t));const a=SIe(s,r,n)?Ate(s):Gl(0);let c=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,f=i.width/o.x,u=i.height/o.y;if(s){const h=ha(s),g=n&&Jc(n)?ha(n):n;let y=h,m=dT(y);for(;m&&n&&g!==y;){const S=gg(m),E=m.getBoundingClientRect(),A=Zc(m),P=E.left+(m.clientLeft+parseFloat(A.paddingLeft))*S.x,N=E.top+(m.clientTop+parseFloat(A.paddingTop))*S.y;c*=S.x,l*=S.y,f*=S.x,u*=S.y,c+=P,l+=N,y=ha(m),m=dT(y)}}return G4({width:f,height:u,x:c,y:l})}function JM(t,e){const r=nC(t).scrollLeft;return e?e.left+r:op(df(t)).left+r}function Ste(t,e,r){r===void 0&&(r=!1);const n=t.getBoundingClientRect(),i=n.left+e.scrollLeft-(r?0:JM(t,n)),s=n.top+e.scrollTop;return{x:i,y:s}}function _Ie(t){let{elements:e,rect:r,offsetParent:n,strategy:i}=t;const s=i==="fixed",o=df(n),a=e?rC(e.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},l=Gl(1);const f=Gl(0),u=nf(n);if((u||!u&&!s)&&((hm(n)!=="body"||dx(o))&&(c=nC(n)),nf(n))){const g=op(n);l=gg(n),f.x=g.x+n.clientLeft,f.y=g.y+n.clientTop}const h=o&&!u&&!s?Ste(o,c,!0):Gl(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+f.x+h.x,y:r.y*l.y-c.scrollTop*l.y+f.y+h.y}}function IIe(t){return Array.from(t.getClientRects())}function TIe(t){const e=df(t),r=nC(t),n=t.ownerDocument.body,i=sa(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=sa(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+JM(t);const a=-r.scrollTop;return Zc(n).direction==="rtl"&&(o+=sa(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function PIe(t,e){const r=ha(t),n=df(t),i=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,c=0;if(i){s=i.width,o=i.height;const l=YM();(!l||l&&e==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function kIe(t,e){const r=op(t,!0,e==="fixed"),n=r.top+t.clientTop,i=r.left+t.clientLeft,s=nf(t)?gg(t):Gl(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,c=i*s.x,l=n*s.y;return{width:o,height:a,x:c,y:l}}function t$(t,e,r){let n;if(e==="viewport")n=PIe(t,r);else if(e==="document")n=TIe(df(t));else if(Jc(e))n=kIe(e,r);else{const i=Ate(t);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return G4(n)}function _te(t,e){const r=Oh(t);return r===e||!Jc(r)||Ly(r)?!1:Zc(r).position==="fixed"||_te(r,e)}function RIe(t,e){const r=e.get(t);if(r)return r;let n=lw(t,[],!1).filter(a=>Jc(a)&&hm(a)!=="body"),i=null;const s=Zc(t).position==="fixed";let o=s?Oh(t):t;for(;Jc(o)&&!Ly(o);){const a=Zc(o),c=KM(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||dx(o)&&!c&&_te(t,o))?n=n.filter(f=>f!==o):i=a,o=Oh(o)}return e.set(t,n),n}function MIe(t){let{element:e,boundary:r,rootBoundary:n,strategy:i}=t;const o=[...r==="clippingAncestors"?rC(e)?[]:RIe(e,this._c):[].concat(r),n],a=o[0],c=o.reduce((l,f)=>{const u=t$(e,f,i);return l.top=sa(u.top,l.top),l.right=Rh(u.right,l.right),l.bottom=Rh(u.bottom,l.bottom),l.left=sa(u.left,l.left),l},t$(e,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function OIe(t){const{width:e,height:r}=Cte(t);return{width:e,height:r}}function DIe(t,e,r){const n=nf(e),i=df(e),s=r==="fixed",o=op(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const c=Gl(0);if(n||!n&&!s)if((hm(e)!=="body"||dx(i))&&(a=nC(e)),n){const h=op(e,!0,s,e);c.x=h.x+e.clientLeft,c.y=h.y+e.clientTop}else i&&(c.x=JM(i));const l=i&&!n&&!s?Ste(i,a):Gl(0),f=o.left+a.scrollLeft-c.x-l.x,u=o.top+a.scrollTop-c.y-l.y;return{x:f,y:u,width:o.width,height:o.height}}function DS(t){return Zc(t).position==="static"}function r$(t,e){if(!nf(t)||Zc(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return df(t)===r&&(r=r.ownerDocument.body),r}function Ite(t,e){const r=ha(t);if(rC(t))return r;if(!nf(t)){let i=Oh(t);for(;i&&!Ly(i);){if(Jc(i)&&!DS(i))return i;i=Oh(i)}return r}let n=r$(t,e);for(;n&&EIe(n)&&DS(n);)n=r$(n,e);return n&&Ly(n)&&DS(n)&&!KM(n)?r:n||CIe(t)||r}const NIe=async function(t){const e=this.getOffsetParent||Ite,r=this.getDimensions,n=await r(t.floating);return{reference:DIe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function BIe(t){return Zc(t).direction==="rtl"}const LIe={convertOffsetParentRelativeRectToViewportRelativeRect:_Ie,getDocumentElement:df,getClippingRect:MIe,getOffsetParent:Ite,getElementRects:NIe,getClientRects:IIe,getDimensions:OIe,getScale:gg,isElement:Jc,isRTL:BIe};function FIe(t,e){let r=null,n;const i=df(t);function s(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const{left:l,top:f,width:u,height:h}=t.getBoundingClientRect();if(a||e(),!u||!h)return;const g=u6(f),y=u6(i.clientWidth-(l+u)),m=u6(i.clientHeight-(f+h)),S=u6(l),A={rootMargin:-g+"px "+-y+"px "+-m+"px "+-S+"px",threshold:sa(0,Rh(1,c))||1};let P=!0;function N(L){const V=L[0].intersectionRatio;if(V!==c){if(!P)return o();V?o(!1,V):n=setTimeout(()=>{o(!1,1e-7)},1e3)}P=!1}try{r=new IntersectionObserver(N,{...A,root:i.ownerDocument})}catch{r=new IntersectionObserver(N,A)}r.observe(t)}return o(!0),s}function jIe(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,l=QM(t),f=i||s?[...l?lw(l):[],...lw(e)]:[];f.forEach(E=>{i&&E.addEventListener("scroll",r,{passive:!0}),s&&E.addEventListener("resize",r)});const u=l&&a?FIe(l,r):null;let h=-1,g=null;o&&(g=new ResizeObserver(E=>{let[A]=E;A&&A.target===l&&g&&(g.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var P;(P=g)==null||P.observe(e)})),r()}),l&&!c&&g.observe(l),g.observe(e));let y,m=c?op(t):null;c&&S();function S(){const E=op(t);m&&(E.x!==m.x||E.y!==m.y||E.width!==m.width||E.height!==m.height)&&r(),m=E,y=requestAnimationFrame(S)}return r(),()=>{var E;f.forEach(A=>{i&&A.removeEventListener("scroll",r),s&&A.removeEventListener("resize",r)}),u==null||u(),(E=g)==null||E.disconnect(),g=null,c&&cancelAnimationFrame(y)}}const UIe=mIe,$Ie=bIe,qIe=vIe,VIe=xIe,zIe=gIe,n$=pIe,HIe=wIe,GIe=(t,e,r)=>{const n=new Map,i={platform:LIe,...r},s={...i.platform,_c:n};return hIe(t,e,{...i,platform:s})};var g5=typeof document<"u"?T.useLayoutEffect:T.useEffect;function W4(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!W4(t[n],e[n]))return!1;return!0}if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&t.$$typeof)&&!W4(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Tte(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function i$(t,e){const r=Tte(t);return Math.round(e*r)/r}function NS(t){const e=T.useRef(t);return g5(()=>{e.current=t}),e}function WIe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:c,open:l}=t,[f,u]=T.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[h,g]=T.useState(n);W4(h,n)||g(n);const[y,m]=T.useState(null),[S,E]=T.useState(null),A=T.useCallback(x=>{x!==V.current&&(V.current=x,m(x))},[]),P=T.useCallback(x=>{x!==I.current&&(I.current=x,E(x))},[]),N=s||y,L=o||S,V=T.useRef(null),I=T.useRef(null),U=T.useRef(f),ie=c!=null,ae=NS(c),K=NS(i),R=NS(l),D=T.useCallback(()=>{if(!V.current||!I.current)return;const x={placement:e,strategy:r,middleware:h};K.current&&(x.platform=K.current),GIe(V.current,I.current,x).then(C=>{const w={...C,isPositioned:R.current!==!1};v.current&&!W4(U.current,w)&&(U.current=w,ff.flushSync(()=>{u(w)}))})},[h,e,r,K,R]);g5(()=>{l===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,u(x=>({...x,isPositioned:!1})))},[l]);const v=T.useRef(!1);g5(()=>(v.current=!0,()=>{v.current=!1}),[]),g5(()=>{if(N&&(V.current=N),L&&(I.current=L),N&&L){if(ae.current)return ae.current(N,L,D);D()}},[N,L,D,ae,ie]);const b=T.useMemo(()=>({reference:V,floating:I,setReference:A,setFloating:P}),[A,P]),M=T.useMemo(()=>({reference:N,floating:L}),[N,L]),B=T.useMemo(()=>{const x={position:r,left:0,top:0};if(!M.floating)return x;const C=i$(M.floating,f.x),w=i$(M.floating,f.y);return a?{...x,transform:"translate("+C+"px, "+w+"px)",...Tte(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:C,top:w}},[r,a,M.floating,f.x,f.y]);return T.useMemo(()=>({...f,update:D,refs:b,elements:M,floatingStyles:B}),[f,D,b,M,B])}const KIe=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:i}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?n$({element:n.current,padding:i}).fn(r):{}:n?n$({element:n,padding:i}).fn(r):{}}}},YIe=(t,e)=>({...UIe(t),options:[t,e]}),QIe=(t,e)=>({...$Ie(t),options:[t,e]}),JIe=(t,e)=>({...HIe(t),options:[t,e]}),ZIe=(t,e)=>({...qIe(t),options:[t,e]}),XIe=(t,e)=>({...VIe(t),options:[t,e]}),eTe=(t,e)=>({...zIe(t),options:[t,e]}),tTe=(t,e)=>({...KIe(t),options:[t,e]});var rTe="Arrow",Pte=T.forwardRef((t,e)=>{const{children:r,width:n=10,height:i=5,...s}=t;return j.jsx(Ku.svg,{...s,ref:e,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:j.jsx("polygon",{points:"0,0 30,0 15,10"})})});Pte.displayName=rTe;var nTe=Pte;function iTe(t,e=[]){let r=[];function n(s,o){const a=T.createContext(o),c=r.length;r=[...r,o];function l(u){const{scope:h,children:g,...y}=u,m=(h==null?void 0:h[t][c])||a,S=T.useMemo(()=>y,Object.values(y));return j.jsx(m.Provider,{value:S,children:g})}function f(u,h){const g=(h==null?void 0:h[t][c])||a,y=T.useContext(g);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return l.displayName=s+"Provider",[l,f]}const i=()=>{const s=r.map(o=>T.createContext(o));return function(a){const c=(a==null?void 0:a[t])||s;return T.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return i.scopeName=t,[n,sTe(i,...e)]}function sTe(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:l})=>{const u=c(s)[`__scope${l}`];return{...a,...u}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function oTe(t){const[e,r]=T.useState(void 0);return sp(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const c=s.borderBoxSize,l=Array.isArray(c)?c[0]:c;o=l.inlineSize,a=l.blockSize}else o=t.offsetWidth,a=t.offsetHeight;r({width:o,height:a})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var ZM="Popper",[kte,Rte]=iTe(ZM),[aTe,Mte]=kte(ZM),Ote=t=>{const{__scopePopper:e,children:r}=t,[n,i]=T.useState(null);return j.jsx(aTe,{scope:e,anchor:n,onAnchorChange:i,children:r})};Ote.displayName=ZM;var Dte="PopperAnchor",Nte=T.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...i}=t,s=Mte(Dte,r),o=T.useRef(null),a=Qh(e,o);return T.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:j.jsx(Ku.div,{...i,ref:a})});Nte.displayName=Dte;var XM="PopperContent",[cTe,lTe]=kte(XM),Bte=T.forwardRef((t,e)=>{var W,Z,te,F,ee,fe;const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:y,...m}=t,S=Mte(XM,r),[E,A]=T.useState(null),P=Qh(e,xe=>A(xe)),[N,L]=T.useState(null),V=oTe(N),I=(V==null?void 0:V.width)??0,U=(V==null?void 0:V.height)??0,ie=n+(s!=="center"?"-"+s:""),ae=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},K=Array.isArray(l)?l:[l],R=K.length>0,D={padding:ae,boundary:K.filter(uTe),altBoundary:R},{refs:v,floatingStyles:b,placement:M,isPositioned:B,middlewareData:x}=WIe({strategy:"fixed",placement:ie,whileElementsMounted:(...xe)=>jIe(...xe,{animationFrame:g==="always"}),elements:{reference:S.anchor},middleware:[YIe({mainAxis:i+U,alignmentAxis:o}),c&&QIe({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?JIe():void 0,...D}),c&&ZIe({...D}),XIe({...D,apply:({elements:xe,rects:_e,availableWidth:Me,availableHeight:Ke})=>{const{width:ze,height:Je}=_e.reference,Xe=xe.floating.style;Xe.setProperty("--radix-popper-available-width",`${Me}px`),Xe.setProperty("--radix-popper-available-height",`${Ke}px`),Xe.setProperty("--radix-popper-anchor-width",`${ze}px`),Xe.setProperty("--radix-popper-anchor-height",`${Je}px`)}}),N&&tTe({element:N,padding:a}),dTe({arrowWidth:I,arrowHeight:U}),h&&eTe({strategy:"referenceHidden",...D})]}),[C,w]=jte(M),k=kh(y);sp(()=>{B&&(k==null||k())},[B,k]);const O=(W=x.arrow)==null?void 0:W.x,G=(Z=x.arrow)==null?void 0:Z.y,oe=((te=x.arrow)==null?void 0:te.centerOffset)!==0,[$,X]=T.useState();return sp(()=>{E&&X(window.getComputedStyle(E).zIndex)},[E]),j.jsx("div",{ref:v.setFloating,"data-radix-popper-content-wrapper":"",style:{...b,transform:B?b.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:$,"--radix-popper-transform-origin":[(F=x.transformOrigin)==null?void 0:F.x,(ee=x.transformOrigin)==null?void 0:ee.y].join(" "),...((fe=x.hide)==null?void 0:fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:j.jsx(cTe,{scope:r,placedSide:C,onArrowChange:L,arrowX:O,arrowY:G,shouldHideArrow:oe,children:j.jsx(Ku.div,{"data-side":C,"data-align":w,...m,ref:P,style:{...m.style,animation:B?void 0:"none"}})})})});Bte.displayName=XM;var Lte="PopperArrow",fTe={top:"bottom",right:"left",bottom:"top",left:"right"},Fte=T.forwardRef(function(e,r){const{__scopePopper:n,...i}=e,s=lTe(Lte,n),o=fTe[s.placedSide];return j.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:j.jsx(nTe,{...i,ref:r,style:{...i.style,display:"block"}})})});Fte.displayName=Lte;function uTe(t){return t!==null}var dTe=t=>({name:"transformOrigin",options:t,fn(e){var S,E,A;const{placement:r,rects:n,middlewareData:i}=e,o=((S=i.arrow)==null?void 0:S.centerOffset)!==0,a=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[l,f]=jte(r),u={start:"0%",center:"50%",end:"100%"}[f],h=(((E=i.arrow)==null?void 0:E.x)??0)+a/2,g=(((A=i.arrow)==null?void 0:A.y)??0)+c/2;let y="",m="";return l==="bottom"?(y=o?u:`${h}px`,m=`${-c}px`):l==="top"?(y=o?u:`${h}px`,m=`${n.floating.height+c}px`):l==="right"?(y=`${-c}px`,m=o?u:`${g}px`):l==="left"&&(y=`${n.floating.width+c}px`,m=o?u:`${g}px`),{data:{x:y,y:m}}}});function jte(t){const[e,r="center"]=t.split("-");return[e,r]}var hTe=Ote,Ute=Nte,pTe=Bte,vTe=Fte,gTe="Portal",$te=T.forwardRef((t,e)=>{var a;const{container:r,...n}=t,[i,s]=T.useState(!1);sp(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?fG.createPortal(j.jsx(Ku.div,{...n,ref:e}),o):null});$te.displayName=gTe;function yTe(t,e){return T.useReducer((r,n)=>e[r][n]??r,t)}var eO=t=>{const{present:e,children:r}=t,n=mTe(e),i=typeof r=="function"?r({present:n.isPresent}):T.Children.only(r),s=Qh(n.ref,bTe(i));return typeof r=="function"||n.isPresent?T.cloneElement(i,{ref:s}):null};eO.displayName="Presence";function mTe(t){const[e,r]=T.useState(),n=T.useRef({}),i=T.useRef(t),s=T.useRef("none"),o=t?"mounted":"unmounted",[a,c]=yTe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const l=d6(n.current);s.current=a==="mounted"?l:"none"},[a]),sp(()=>{const l=n.current,f=i.current;if(f!==t){const h=s.current,g=d6(l);t?c("MOUNT"):g==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(f&&h!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),sp(()=>{if(e){let l;const f=e.ownerDocument.defaultView??window,u=g=>{const m=d6(n.current).includes(g.animationName);if(g.target===e&&m&&(c("ANIMATION_END"),!i.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",l=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},h=g=>{g.target===e&&(s.current=d6(n.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{f.clearTimeout(l),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:T.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function d6(t){return(t==null?void 0:t.animationName)||"none"}function bTe(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function wTe({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,i]=xTe({defaultProp:e,onChange:r}),s=t!==void 0,o=s?t:n,a=kh(r),c=T.useCallback(l=>{if(s){const u=typeof l=="function"?l(t):l;u!==t&&a(u)}else i(l)},[s,t,i,a]);return[o,c]}function xTe({defaultProp:t,onChange:e}){const r=T.useState(t),[n]=r,i=T.useRef(n),s=kh(e);return T.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var ETe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},dv=new WeakMap,h6=new WeakMap,p6={},BS=0,qte=function(t){return t&&(t.host||qte(t.parentNode))},CTe=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=qte(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},ATe=function(t,e,r,n){var i=CTe(e,Array.isArray(t)?t:[t]);p6[r]||(p6[r]=new WeakMap);var s=p6[r],o=[],a=new Set,c=new Set(i),l=function(u){!u||a.has(u)||(a.add(u),l(u.parentNode))};i.forEach(l);var f=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(a.has(h))f(h);else try{var g=h.getAttribute(n),y=g!==null&&g!=="false",m=(dv.get(h)||0)+1,S=(s.get(h)||0)+1;dv.set(h,m),s.set(h,S),o.push(h),m===1&&y&&h6.set(h,!0),S===1&&h.setAttribute(r,"true"),y||h.setAttribute(n,"true")}catch(E){console.error("aria-hidden: cannot operate on ",h,E)}})};return f(e),a.clear(),BS++,function(){o.forEach(function(u){var h=dv.get(u)-1,g=s.get(u)-1;dv.set(u,h),s.set(u,g),h||(h6.has(u)||u.removeAttribute(n),h6.delete(u)),g||u.removeAttribute(r)}),BS--,BS||(dv=new WeakMap,dv=new WeakMap,h6=new WeakMap,p6={})}},STe=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=ETe(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),ATe(n,i,r,"aria-hidden")):function(){return null}},Ll=function(){return Ll=Object.assign||function(e){for(var r,n=1,i=arguments.length;n"u")return qTe;var e=VTe(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},HTe=Gte(),yg="data-scroll-locked",GTe=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),` .`.concat(ITe,` { overflow: hidden `).concat(n,`; padding-right: `).concat(a,"px ").concat(n,`; @@ -965,7 +965,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `)},o$=function(){var t=parseInt(document.body.getAttribute(yg)||"0",10);return isFinite(t)?t:0},WTe=function(){T.useEffect(function(){return document.body.setAttribute(yg,(o$()+1).toString()),function(){var t=o$()-1;t<=0?document.body.removeAttribute(yg):document.body.setAttribute(yg,t.toString())}},[])},KTe=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,i=n===void 0?"margin":n;WTe();var s=T.useMemo(function(){return zTe(i)},[i]);return T.createElement(HTe,{styles:GTe(s,!e,i,r?"":"!important")})},hT=!1;if(typeof window<"u")try{var v6=Object.defineProperty({},"passive",{get:function(){return hT=!0,!0}});window.addEventListener("test",v6,v6),window.removeEventListener("test",v6,v6)}catch{hT=!1}var hv=hT?{passive:!1}:!1,YTe=function(t){return t.tagName==="TEXTAREA"},Wte=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!YTe(t)&&r[e]==="visible")},QTe=function(t){return Wte(t,"overflowY")},JTe=function(t){return Wte(t,"overflowX")},a$=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=Kte(t,n);if(i){var s=Yte(t,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},ZTe=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},XTe=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},Kte=function(t,e){return t==="v"?QTe(e):JTe(e)},Yte=function(t,e){return t==="v"?ZTe(e):XTe(e)},ePe=function(t,e){return t==="h"&&e==="rtl"?-1:1},tPe=function(t,e,r,n,i){var s=ePe(t,window.getComputedStyle(e).direction),o=s*n,a=r.target,c=e.contains(a),l=!1,f=o>0,u=0,h=0;do{var g=Yte(t,a),y=g[0],m=g[1],S=g[2],E=m-S-s*y;(y||E)&&Kte(t,a)&&(u+=E,h+=y),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(e.contains(a)||e===a));return(f&&(Math.abs(u)<1||!i)||!f&&(Math.abs(h)<1||!i))&&(l=!0),l},g6=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},c$=function(t){return[t.deltaX,t.deltaY]},l$=function(t){return t&&"current"in t?t.current:t},rPe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},nPe=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},iPe=0,pv=[];function sPe(t){var e=T.useRef([]),r=T.useRef([0,0]),n=T.useRef(),i=T.useState(iPe++)[0],s=T.useState(Gte)[0],o=T.useRef(t);T.useEffect(function(){o.current=t},[t]),T.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=_Te([t.lockRef.current],(t.shards||[]).map(l$),!0).filter(Boolean);return m.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=T.useCallback(function(m,S){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var E=g6(m),A=r.current,P="deltaX"in m?m.deltaX:A[0]-E[0],N="deltaY"in m?m.deltaY:A[1]-E[1],L,V=m.target,I=Math.abs(P)>Math.abs(N)?"h":"v";if("touches"in m&&I==="h"&&V.type==="range")return!1;var U=a$(I,V);if(!U)return!0;if(U?L=I:(L=I==="v"?"h":"v",U=a$(I,V)),!U)return!1;if(!n.current&&"changedTouches"in m&&(P||N)&&(n.current=L),!L)return!0;var ie=n.current||L;return tPe(ie,S,m,ie==="h"?P:N,!0)},[]),c=T.useCallback(function(m){var S=m;if(!(!pv.length||pv[pv.length-1]!==s)){var E="deltaY"in S?c$(S):g6(S),A=e.current.filter(function(L){return L.name===S.type&&(L.target===S.target||S.target===L.shadowParent)&&rPe(L.delta,E)})[0];if(A&&A.should){S.cancelable&&S.preventDefault();return}if(!A){var P=(o.current.shards||[]).map(l$).filter(Boolean).filter(function(L){return L.contains(S.target)}),N=P.length>0?a(S,P[0]):!o.current.noIsolation;N&&S.cancelable&&S.preventDefault()}}},[]),l=T.useCallback(function(m,S,E,A){var P={name:m,delta:S,target:E,should:A,shadowParent:oPe(E)};e.current.push(P),setTimeout(function(){e.current=e.current.filter(function(N){return N!==P})},1)},[]),f=T.useCallback(function(m){r.current=g6(m),n.current=void 0},[]),u=T.useCallback(function(m){l(m.type,c$(m),m.target,a(m,t.lockRef.current))},[]),h=T.useCallback(function(m){l(m.type,g6(m),m.target,a(m,t.lockRef.current))},[]);T.useEffect(function(){return pv.push(s),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,hv),document.addEventListener("touchmove",c,hv),document.addEventListener("touchstart",f,hv),function(){pv=pv.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,hv),document.removeEventListener("touchmove",c,hv),document.removeEventListener("touchstart",f,hv)}},[]);var g=t.removeScrollBar,y=t.inert;return T.createElement(T.Fragment,null,y?T.createElement(s,{styles:nPe(i)}):null,g?T.createElement(KTe,{gapMode:t.gapMode}):null)}function oPe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const aPe=NTe(Hte,sPe);var Qte=T.forwardRef(function(t,e){return T.createElement(iC,Ll({},t,{ref:e,sideCar:aPe}))});Qte.classNames=iC.classNames;var tO="Popover",[Jte,RGe]=M_e(tO,[Rte]),hx=Rte(),[cPe,Jh]=Jte(tO),Zte=t=>{const{__scopePopover:e,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=hx(e),c=T.useRef(null),[l,f]=T.useState(!1),[u=!1,h]=wTe({prop:n,defaultProp:i,onChange:s});return j.jsx(hTe,{...a,children:j.jsx(cPe,{scope:e,contentId:iIe(),triggerRef:c,open:u,onOpenChange:h,onOpenToggle:T.useCallback(()=>h(g=>!g),[h]),hasCustomAnchor:l,onCustomAnchorAdd:T.useCallback(()=>f(!0),[]),onCustomAnchorRemove:T.useCallback(()=>f(!1),[]),modal:o,children:r})})};Zte.displayName=tO;var Xte="PopoverAnchor",lPe=T.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=Jh(Xte,r),s=hx(r),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return T.useEffect(()=>(o(),()=>a()),[o,a]),j.jsx(Ute,{...s,...n,ref:e})});lPe.displayName=Xte;var ere="PopoverTrigger",tre=T.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=Jh(ere,r),s=hx(r),o=Qh(e,i.triggerRef),a=j.jsx(Ku.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ore(i.open),...n,ref:o,onClick:mh(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:j.jsx(Ute,{asChild:!0,...s,children:a})});tre.displayName=ere;var rO="PopoverPortal",[fPe,uPe]=Jte(rO,{forceMount:void 0}),rre=t=>{const{__scopePopover:e,forceMount:r,children:n,container:i}=t,s=Jh(rO,e);return j.jsx(fPe,{scope:e,forceMount:r,children:j.jsx(eO,{present:r||s.open,children:j.jsx($te,{asChild:!0,container:i,children:n})})})};rre.displayName=rO;var Fy="PopoverContent",nre=T.forwardRef((t,e)=>{const r=uPe(Fy,t.__scopePopover),{forceMount:n=r.forceMount,...i}=t,s=Jh(Fy,t.__scopePopover);return j.jsx(eO,{present:n||s.open,children:s.modal?j.jsx(dPe,{...i,ref:e}):j.jsx(hPe,{...i,ref:e})})});nre.displayName=Fy;var dPe=T.forwardRef((t,e)=>{const r=Jh(Fy,t.__scopePopover),n=T.useRef(null),i=Qh(e,n),s=T.useRef(!1);return T.useEffect(()=>{const o=n.current;if(o)return STe(o)},[]),j.jsx(Qte,{as:zM,allowPinchZoom:!0,children:j.jsx(ire,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mh(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=r.triggerRef.current)==null||a.focus()}),onPointerDownOutside:mh(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,l=a.button===2||c;s.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:mh(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),hPe=T.forwardRef((t,e)=>{const r=Jh(Fy,t.__scopePopover),n=T.useRef(!1),i=T.useRef(!1);return j.jsx(ire,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),s.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:s=>{var c,l;(c=t.onInteractOutside)==null||c.call(t,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((l=r.triggerRef.current)==null?void 0:l.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),ire=T.forwardRef((t,e)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:f,...u}=t,h=Jh(Fy,r),g=hx(r);return K_e(),j.jsx(mte,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:j.jsx(gte,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),children:j.jsx(pTe,{"data-state":ore(h.open),role:"dialog",id:h.contentId,...g,...u,ref:e,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),sre="PopoverClose",pPe=T.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=Jh(sre,r);return j.jsx(Ku.button,{type:"button",...n,ref:e,onClick:mh(t.onClick,()=>i.onOpenChange(!1))})});pPe.displayName=sre;var vPe="PopoverArrow",gPe=T.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=hx(r);return j.jsx(vTe,{...i,...n,ref:e})});gPe.displayName=vPe;function ore(t){return t?"open":"closed"}var yPe=Zte,mPe=tre,bPe=rre,wPe=nre;function xPe(t,e=6,r=4){if(t.length<=e+r+3)return t;const n=t.slice(0,e),i=t.slice(-r);return`${n}...${i}`}function EPe({handleSignOut:t}){return j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",color:"text100",marginRight:"8",children:"Are you sure you want to sign out?"}),j.jsx(Te,{variant:"normal",color:"text50",children:"This will disconnect all Dapps, tokens, and relay wallet connections, and you’ll need to reconnect them manually."}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",gap:"2",children:[j.jsx(Kt,{label:"Yes, sign out",shape:"square",variant:"primary",onClick:()=>t(!0)}),j.jsx(Kt,{label:"Cancel",shape:"square",onClick:()=>t()})]})]})}function CPe(){const t=fr(oi),e=Wr(t.accountAddress),[r,n]=T.useState(!1),[i,s]=T.useState(!1),[o,a]=T.useState(!1),c=MR();T.useEffect(()=>{if(o){const f=setTimeout(()=>{a(!1)},1e3);return()=>clearTimeout(f)}},[o]);const l=async()=>{await navigator.clipboard.writeText(e),a(!0)};return j.jsxs(yPe,{open:r,onOpenChange:n,children:[j.jsx(mPe,{asChild:!0,children:j.jsx(Kt,{label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(rwe,{address:e,size:"sm"}),j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:xPe(e,4,4)})]}),variant:"text"})}),r&&j.jsx(bPe,{forceMount:!0,children:j.jsx(wPe,{asChild:!0,side:"bottom",sideOffset:8,align:"center",children:j.jsxs(vn,{flexDirection:"column",backdropFilter:"blur",gap:"2",children:[j.jsx(Kt,{leftIcon:o?qw:QW,label:"Copy wallet address",shape:"square",size:"sm",width:"full",onClick:l}),j.jsx(Kt,{leftIcon:Jge,label:"Sign out",shape:"square",size:"sm",width:"full",onClick:()=>s(!0)})]})})}),i&&j.jsx(oa,{size:"sm",onClose:()=>s(!1),children:j.jsx(EPe,{handleSignOut:f=>{f&&(t.logout(),c("/")),s(!1)}})})]})}function are({handleNetworkModal:t}){const e=fr(oi),r=Wr(e.accountAddress);return j.jsx(ye,{flexDirection:"column",style:{paddingBottom:"60px"},children:j.jsxs(ye,{background:"backgroundPrimary",position:"fixed",width:"full",children:[j.jsxs(ye,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",style:{height:"59px"},children:[j.jsx(dte,{variant:"md",marginLeft:"5"}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"5",style:{marginRight:"80px"},children:[j.jsx(Kt,{label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Fi,{src:k_e,height:"5"}),j.jsx(Te,{variant:"medium",lineHeight:"5",color:"text50",children:"Docs"})]}),variant:"text",onClick:()=>window.open("https://docs.sequence.xyz/")}),j.jsx(Kt,{label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Fi,{src:P_e,height:"5"}),j.jsx(Te,{variant:"medium",lineHeight:"5",color:"text50",children:"Networks"})]}),variant:"text",onClick:()=>t()}),r&&j.jsx(CPe,{})]})]}),j.jsx(hi,{marginY:"0"})]})})}const APe="modulepreload",SPe=function(t){return"/"+t},f$={},_Pe=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(r.map(c=>{if(c=SPe(c),c in f$)return;f$[c]=!0;const l=c.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":APe,l||(u.as="script"),u.crossOrigin="",u.href=c,a&&u.setAttribute("nonce",a),document.head.appendChild(u),l)return new Promise((h,g)=>{u.addEventListener("load",h),u.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};var nO={exports:{}},mg=typeof Reflect=="object"?Reflect:null,u$=mg&&typeof mg.apply=="function"?mg.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},b5;mg&&typeof mg.ownKeys=="function"?b5=mg.ownKeys:Object.getOwnPropertySymbols?b5=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:b5=function(e){return Object.getOwnPropertyNames(e)};function IPe(t){console&&console.warn&&console.warn(t)}var cre=Number.isNaN||function(e){return e!==e};function dn(){dn.init.call(this)}nO.exports=dn;nO.exports.once=RPe;dn.EventEmitter=dn;dn.prototype._events=void 0;dn.prototype._eventsCount=0;dn.prototype._maxListeners=void 0;var d$=10;function sC(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(dn,"defaultMaxListeners",{enumerable:!0,get:function(){return d$},set:function(t){if(typeof t!="number"||t<0||cre(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");d$=t}});dn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};dn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||cre(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function lre(t){return t._maxListeners===void 0?dn.defaultMaxListeners:t._maxListeners}dn.prototype.getMaxListeners=function(){return lre(this)};dn.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")u$(c,this,r);else for(var l=c.length,f=pre(c,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,IPe(a)}return t}dn.prototype.addListener=function(e,r){return fre(this,e,r,!1)};dn.prototype.on=dn.prototype.addListener;dn.prototype.prependListener=function(e,r){return fre(this,e,r,!0)};function TPe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ure(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=TPe.bind(n);return i.listener=r,n.wrapFn=i,i}dn.prototype.once=function(e,r){return sC(r),this.on(e,ure(this,e,r)),this};dn.prototype.prependOnceListener=function(e,r){return sC(r),this.prependListener(e,ure(this,e,r)),this};dn.prototype.removeListener=function(e,r){var n,i,s,o,a;if(sC(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():PPe(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};dn.prototype.off=dn.prototype.removeListener;dn.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function dre(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?kPe(i):pre(i,i.length)}dn.prototype.listeners=function(e){return dre(this,e,!0)};dn.prototype.rawListeners=function(e){return dre(this,e,!1)};dn.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):hre.call(t,e)};dn.prototype.listenerCount=hre;function hre(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}dn.prototype.eventNames=function(){return this._eventsCount>0?b5(this._events):[]};function pre(t,e){for(var r=new Array(e),n=0;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new LPe:typeof navigator<"u"?VPe(navigator.userAgent):HPe()}function qPe(t){return t!==""&&UPe.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function VPe(t){var e=qPe(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new BPe;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.lengthMath.abs(N)?"h":"v";if("touches"in m&&I==="h"&&V.type==="range")return!1;var U=a$(I,V);if(!U)return!0;if(U?L=I:(L=I==="v"?"h":"v",U=a$(I,V)),!U)return!1;if(!n.current&&"changedTouches"in m&&(P||N)&&(n.current=L),!L)return!0;var ie=n.current||L;return tPe(ie,S,m,ie==="h"?P:N,!0)},[]),c=T.useCallback(function(m){var S=m;if(!(!pv.length||pv[pv.length-1]!==s)){var E="deltaY"in S?c$(S):g6(S),A=e.current.filter(function(L){return L.name===S.type&&(L.target===S.target||S.target===L.shadowParent)&&rPe(L.delta,E)})[0];if(A&&A.should){S.cancelable&&S.preventDefault();return}if(!A){var P=(o.current.shards||[]).map(l$).filter(Boolean).filter(function(L){return L.contains(S.target)}),N=P.length>0?a(S,P[0]):!o.current.noIsolation;N&&S.cancelable&&S.preventDefault()}}},[]),l=T.useCallback(function(m,S,E,A){var P={name:m,delta:S,target:E,should:A,shadowParent:oPe(E)};e.current.push(P),setTimeout(function(){e.current=e.current.filter(function(N){return N!==P})},1)},[]),f=T.useCallback(function(m){r.current=g6(m),n.current=void 0},[]),u=T.useCallback(function(m){l(m.type,c$(m),m.target,a(m,t.lockRef.current))},[]),h=T.useCallback(function(m){l(m.type,g6(m),m.target,a(m,t.lockRef.current))},[]);T.useEffect(function(){return pv.push(s),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,hv),document.addEventListener("touchmove",c,hv),document.addEventListener("touchstart",f,hv),function(){pv=pv.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,hv),document.removeEventListener("touchmove",c,hv),document.removeEventListener("touchstart",f,hv)}},[]);var g=t.removeScrollBar,y=t.inert;return T.createElement(T.Fragment,null,y?T.createElement(s,{styles:nPe(i)}):null,g?T.createElement(KTe,{gapMode:t.gapMode}):null)}function oPe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const aPe=NTe(Hte,sPe);var Qte=T.forwardRef(function(t,e){return T.createElement(iC,Ll({},t,{ref:e,sideCar:aPe}))});Qte.classNames=iC.classNames;var tO="Popover",[Jte,RGe]=M_e(tO,[Rte]),hx=Rte(),[cPe,Jh]=Jte(tO),Zte=t=>{const{__scopePopover:e,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=hx(e),c=T.useRef(null),[l,f]=T.useState(!1),[u=!1,h]=wTe({prop:n,defaultProp:i,onChange:s});return j.jsx(hTe,{...a,children:j.jsx(cPe,{scope:e,contentId:iIe(),triggerRef:c,open:u,onOpenChange:h,onOpenToggle:T.useCallback(()=>h(g=>!g),[h]),hasCustomAnchor:l,onCustomAnchorAdd:T.useCallback(()=>f(!0),[]),onCustomAnchorRemove:T.useCallback(()=>f(!1),[]),modal:o,children:r})})};Zte.displayName=tO;var Xte="PopoverAnchor",lPe=T.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=Jh(Xte,r),s=hx(r),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return T.useEffect(()=>(o(),()=>a()),[o,a]),j.jsx(Ute,{...s,...n,ref:e})});lPe.displayName=Xte;var ere="PopoverTrigger",tre=T.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=Jh(ere,r),s=hx(r),o=Qh(e,i.triggerRef),a=j.jsx(Ku.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ore(i.open),...n,ref:o,onClick:mh(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:j.jsx(Ute,{asChild:!0,...s,children:a})});tre.displayName=ere;var rO="PopoverPortal",[fPe,uPe]=Jte(rO,{forceMount:void 0}),rre=t=>{const{__scopePopover:e,forceMount:r,children:n,container:i}=t,s=Jh(rO,e);return j.jsx(fPe,{scope:e,forceMount:r,children:j.jsx(eO,{present:r||s.open,children:j.jsx($te,{asChild:!0,container:i,children:n})})})};rre.displayName=rO;var Fy="PopoverContent",nre=T.forwardRef((t,e)=>{const r=uPe(Fy,t.__scopePopover),{forceMount:n=r.forceMount,...i}=t,s=Jh(Fy,t.__scopePopover);return j.jsx(eO,{present:n||s.open,children:s.modal?j.jsx(dPe,{...i,ref:e}):j.jsx(hPe,{...i,ref:e})})});nre.displayName=Fy;var dPe=T.forwardRef((t,e)=>{const r=Jh(Fy,t.__scopePopover),n=T.useRef(null),i=Qh(e,n),s=T.useRef(!1);return T.useEffect(()=>{const o=n.current;if(o)return STe(o)},[]),j.jsx(Qte,{as:zM,allowPinchZoom:!0,children:j.jsx(ire,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mh(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=r.triggerRef.current)==null||a.focus()}),onPointerDownOutside:mh(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,l=a.button===2||c;s.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:mh(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),hPe=T.forwardRef((t,e)=>{const r=Jh(Fy,t.__scopePopover),n=T.useRef(!1),i=T.useRef(!1);return j.jsx(ire,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),s.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:s=>{var c,l;(c=t.onInteractOutside)==null||c.call(t,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((l=r.triggerRef.current)==null?void 0:l.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),ire=T.forwardRef((t,e)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:f,...u}=t,h=Jh(Fy,r),g=hx(r);return K_e(),j.jsx(mte,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:j.jsx(gte,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),children:j.jsx(pTe,{"data-state":ore(h.open),role:"dialog",id:h.contentId,...g,...u,ref:e,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),sre="PopoverClose",pPe=T.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=Jh(sre,r);return j.jsx(Ku.button,{type:"button",...n,ref:e,onClick:mh(t.onClick,()=>i.onOpenChange(!1))})});pPe.displayName=sre;var vPe="PopoverArrow",gPe=T.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=hx(r);return j.jsx(vTe,{...i,...n,ref:e})});gPe.displayName=vPe;function ore(t){return t?"open":"closed"}var yPe=Zte,mPe=tre,bPe=rre,wPe=nre;function xPe(t,e=6,r=4){if(t.length<=e+r+3)return t;const n=t.slice(0,e),i=t.slice(-r);return`${n}...${i}`}function EPe({handleSignOut:t}){return j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",color:"text100",marginRight:"8",children:"Are you sure you want to sign out?"}),j.jsx(Te,{variant:"normal",color:"text50",children:"This will disconnect all Dapps, tokens, and relay wallet connections, and you’ll need to reconnect them manually."}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",gap:"2",children:[j.jsx(Vt,{label:"Yes, sign out",shape:"square",variant:"primary",onClick:()=>t(!0)}),j.jsx(Vt,{label:"Cancel",shape:"square",onClick:()=>t()})]})]})}function CPe(){const t=fr(oi),e=Wr(t.accountAddress),[r,n]=T.useState(!1),[i,s]=T.useState(!1),[o,a]=T.useState(!1),c=MR();T.useEffect(()=>{if(o){const f=setTimeout(()=>{a(!1)},1e3);return()=>clearTimeout(f)}},[o]);const l=async()=>{await navigator.clipboard.writeText(e),a(!0)};return j.jsxs(yPe,{open:r,onOpenChange:n,children:[j.jsx(mPe,{asChild:!0,children:j.jsx(Vt,{label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(rwe,{address:e,size:"sm"}),j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:xPe(e,4,4)})]}),variant:"text"})}),r&&j.jsx(bPe,{forceMount:!0,children:j.jsx(wPe,{asChild:!0,side:"bottom",sideOffset:8,align:"center",children:j.jsxs(vn,{flexDirection:"column",backdropFilter:"blur",gap:"2",children:[j.jsx(Vt,{leftIcon:o?qw:QW,label:"Copy wallet address",shape:"square",size:"sm",width:"full",onClick:l}),j.jsx(Vt,{leftIcon:Jge,label:"Sign out",shape:"square",size:"sm",width:"full",onClick:()=>s(!0)})]})})}),i&&j.jsx(oa,{size:"sm",onClose:()=>s(!1),children:j.jsx(EPe,{handleSignOut:f=>{f&&(t.logout(),c("/")),s(!1)}})})]})}function are({handleNetworkModal:t}){const e=fr(oi),r=Wr(e.accountAddress);return j.jsx(ye,{flexDirection:"column",style:{paddingBottom:"60px"},children:j.jsxs(ye,{background:"backgroundPrimary",position:"fixed",width:"full",children:[j.jsxs(ye,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",style:{height:"59px"},children:[j.jsx(dte,{variant:"md",marginLeft:"5"}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"5",style:{marginRight:"80px"},children:[j.jsx(Vt,{label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Fi,{src:k_e,height:"5"}),j.jsx(Te,{variant:"medium",lineHeight:"5",color:"text50",children:"Docs"})]}),variant:"text",onClick:()=>window.open("https://docs.sequence.xyz/")}),j.jsx(Vt,{label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Fi,{src:P_e,height:"5"}),j.jsx(Te,{variant:"medium",lineHeight:"5",color:"text50",children:"Networks"})]}),variant:"text",onClick:()=>t()}),r&&j.jsx(CPe,{})]})]}),j.jsx(hi,{marginY:"0"})]})})}const APe="modulepreload",SPe=function(t){return"/"+t},f$={},_Pe=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(r.map(c=>{if(c=SPe(c),c in f$)return;f$[c]=!0;const l=c.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":APe,l||(u.as="script"),u.crossOrigin="",u.href=c,a&&u.setAttribute("nonce",a),document.head.appendChild(u),l)return new Promise((h,g)=>{u.addEventListener("load",h),u.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};var nO={exports:{}},mg=typeof Reflect=="object"?Reflect:null,u$=mg&&typeof mg.apply=="function"?mg.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},b5;mg&&typeof mg.ownKeys=="function"?b5=mg.ownKeys:Object.getOwnPropertySymbols?b5=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:b5=function(e){return Object.getOwnPropertyNames(e)};function IPe(t){console&&console.warn&&console.warn(t)}var cre=Number.isNaN||function(e){return e!==e};function dn(){dn.init.call(this)}nO.exports=dn;nO.exports.once=RPe;dn.EventEmitter=dn;dn.prototype._events=void 0;dn.prototype._eventsCount=0;dn.prototype._maxListeners=void 0;var d$=10;function sC(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(dn,"defaultMaxListeners",{enumerable:!0,get:function(){return d$},set:function(t){if(typeof t!="number"||t<0||cre(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");d$=t}});dn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};dn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||cre(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function lre(t){return t._maxListeners===void 0?dn.defaultMaxListeners:t._maxListeners}dn.prototype.getMaxListeners=function(){return lre(this)};dn.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")u$(c,this,r);else for(var l=c.length,f=pre(c,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,IPe(a)}return t}dn.prototype.addListener=function(e,r){return fre(this,e,r,!1)};dn.prototype.on=dn.prototype.addListener;dn.prototype.prependListener=function(e,r){return fre(this,e,r,!0)};function TPe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ure(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=TPe.bind(n);return i.listener=r,n.wrapFn=i,i}dn.prototype.once=function(e,r){return sC(r),this.on(e,ure(this,e,r)),this};dn.prototype.prependOnceListener=function(e,r){return sC(r),this.prependListener(e,ure(this,e,r)),this};dn.prototype.removeListener=function(e,r){var n,i,s,o,a;if(sC(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():PPe(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};dn.prototype.off=dn.prototype.removeListener;dn.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function dre(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?kPe(i):pre(i,i.length)}dn.prototype.listeners=function(e){return dre(this,e,!0)};dn.prototype.rawListeners=function(e){return dre(this,e,!1)};dn.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):hre.call(t,e)};dn.prototype.listenerCount=hre;function hre(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}dn.prototype.eventNames=function(){return this._eventsCount>0?b5(this._events):[]};function pre(t,e){for(var r=new Array(e),n=0;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new LPe:typeof navigator<"u"?VPe(navigator.userAgent):HPe()}function qPe(t){return t!==""&&UPe.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function VPe(t){var e=qPe(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new BPe;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length>5,this.byteCount=this.blockCount<<2,this.outputBlocks=W>>5,this.extraBytes=(W&31)>>3;for(var Z=0;Z<50;++Z)this.s[Z]=0}O.prototype.update=function($){if(this.finalized)throw new Error(r);var X,W=typeof $;if(W!=="string"){if(W==="object"){if($===null)throw new Error(e);if(c&&$.constructor===ArrayBuffer)$=new Uint8Array($);else if(!Array.isArray($)&&(!c||!ArrayBuffer.isView($)))throw new Error(e)}else throw new Error(e);X=!0}for(var Z=this.blocks,te=this.byteCount,F=$.length,ee=this.blockCount,fe=0,xe=this.s,_e,Me;fe>2]|=$[fe]<>2]|=Me<>2]|=(192|Me>>6)<>2]|=(128|Me&63)<=57344?(Z[_e>>2]|=(224|Me>>12)<>2]|=(128|Me>>6&63)<>2]|=(128|Me&63)<>2]|=(240|Me>>18)<>2]|=(128|Me>>12&63)<>2]|=(128|Me>>6&63)<>2]|=(128|Me&63)<=te){for(this.start=_e-te,this.block=Z[ee],_e=0;_e>8,W=$&255;W>0;)te.unshift(W),$=$>>8,W=$&255,++Z;return X?te.push(Z):te.unshift(Z),this.update(te),te.length},O.prototype.encodeString=function($){var X,W=typeof $;if(W!=="string"){if(W==="object"){if($===null)throw new Error(e);if(c&&$.constructor===ArrayBuffer)$=new Uint8Array($);else if(!Array.isArray($)&&(!c||!ArrayBuffer.isView($)))throw new Error(e)}else throw new Error(e);X=!0}var Z=0,te=$.length;if(X)Z=te;else for(var F=0;F<$.length;++F){var ee=$.charCodeAt(F);ee<128?Z+=1:ee<2048?Z+=2:ee<55296||ee>=57344?Z+=3:(ee=65536+((ee&1023)<<10|$.charCodeAt(++F)&1023),Z+=4)}return Z+=this.encode(Z*8),this.update($),Z},O.prototype.bytepad=function($,X){for(var W=this.encode(X),Z=0;Z<$.length;++Z)W+=this.encodeString($[Z]);var te=X-W%X,F=[];return F.length=te,this.update(F),this},O.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var $=this.blocks,X=this.lastByteIndex,W=this.blockCount,Z=this.s;if($[X>>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for($[0]=$[W],X=1;X>4&15]+l[fe&15]+l[fe>>12&15]+l[fe>>8&15]+l[fe>>20&15]+l[fe>>16&15]+l[fe>>28&15]+l[fe>>24&15];F%$===0&&(oe(X),te=0)}return Z&&(fe=X[te],ee+=l[fe>>4&15]+l[fe&15],Z>1&&(ee+=l[fe>>12&15]+l[fe>>8&15]),Z>2&&(ee+=l[fe>>20&15]+l[fe>>16&15])),ee},O.prototype.arrayBuffer=function(){this.finalize();var $=this.blockCount,X=this.s,W=this.outputBlocks,Z=this.extraBytes,te=0,F=0,ee=this.outputBits>>3,fe;Z?fe=new ArrayBuffer(W+1<<2):fe=new ArrayBuffer(ee);for(var xe=new Uint32Array(fe);F>8&255,ee[fe+2]=xe>>16&255,ee[fe+3]=xe>>24&255;F%$===0&&oe(X)}return Z&&(fe=F<<2,xe=X[te],ee[fe]=xe&255,Z>1&&(ee[fe+1]=xe>>8&255),Z>2&&(ee[fe+2]=xe>>16&255)),ee};function G($,X,W){O.call(this,$,X,W)}G.prototype=new O,G.prototype.finalize=function(){return this.encode(this.outputBits,!0),O.prototype.finalize.call(this)};var oe=function($){var X,W,Z,te,F,ee,fe,xe,_e,Me,Ke,ze,Je,Xe,lt,Re,$e,st,Qe,ct,tt,He,at,pt,Ge,vt,bt,Ze,_t,Ct,It,er,dr,wt,lr,ir,Pt,Dt,Nt,dt,Lt,kt,ut,Vt,zt,ht,xt,Bt,Ve,$t,Et,ot,Ht,Nr,Ut,Pr,tr,Or,pi,vi,gi,_i,Tn;for(Z=0;Z<48;Z+=2)te=$[0]^$[10]^$[20]^$[30]^$[40],F=$[1]^$[11]^$[21]^$[31]^$[41],ee=$[2]^$[12]^$[22]^$[32]^$[42],fe=$[3]^$[13]^$[23]^$[33]^$[43],xe=$[4]^$[14]^$[24]^$[34]^$[44],_e=$[5]^$[15]^$[25]^$[35]^$[45],Me=$[6]^$[16]^$[26]^$[36]^$[46],Ke=$[7]^$[17]^$[27]^$[37]^$[47],ze=$[8]^$[18]^$[28]^$[38]^$[48],Je=$[9]^$[19]^$[29]^$[39]^$[49],X=ze^(ee<<1|fe>>>31),W=Je^(fe<<1|ee>>>31),$[0]^=X,$[1]^=W,$[10]^=X,$[11]^=W,$[20]^=X,$[21]^=W,$[30]^=X,$[31]^=W,$[40]^=X,$[41]^=W,X=te^(xe<<1|_e>>>31),W=F^(_e<<1|xe>>>31),$[2]^=X,$[3]^=W,$[12]^=X,$[13]^=W,$[22]^=X,$[23]^=W,$[32]^=X,$[33]^=W,$[42]^=X,$[43]^=W,X=ee^(Me<<1|Ke>>>31),W=fe^(Ke<<1|Me>>>31),$[4]^=X,$[5]^=W,$[14]^=X,$[15]^=W,$[24]^=X,$[25]^=W,$[34]^=X,$[35]^=W,$[44]^=X,$[45]^=W,X=xe^(ze<<1|Je>>>31),W=_e^(Je<<1|ze>>>31),$[6]^=X,$[7]^=W,$[16]^=X,$[17]^=W,$[26]^=X,$[27]^=W,$[36]^=X,$[37]^=W,$[46]^=X,$[47]^=W,X=Me^(te<<1|F>>>31),W=Ke^(F<<1|te>>>31),$[8]^=X,$[9]^=W,$[18]^=X,$[19]^=W,$[28]^=X,$[29]^=W,$[38]^=X,$[39]^=W,$[48]^=X,$[49]^=W,Xe=$[0],lt=$[1],ht=$[11]<<4|$[10]>>>28,xt=$[10]<<4|$[11]>>>28,Ze=$[20]<<3|$[21]>>>29,_t=$[21]<<3|$[20]>>>29,vi=$[31]<<9|$[30]>>>23,gi=$[30]<<9|$[31]>>>23,kt=$[40]<<18|$[41]>>>14,ut=$[41]<<18|$[40]>>>14,wt=$[2]<<1|$[3]>>>31,lr=$[3]<<1|$[2]>>>31,Re=$[13]<<12|$[12]>>>20,$e=$[12]<<12|$[13]>>>20,Bt=$[22]<<10|$[23]>>>22,Ve=$[23]<<10|$[22]>>>22,Ct=$[33]<<13|$[32]>>>19,It=$[32]<<13|$[33]>>>19,_i=$[42]<<2|$[43]>>>30,Tn=$[43]<<2|$[42]>>>30,Nr=$[5]<<30|$[4]>>>2,Ut=$[4]<<30|$[5]>>>2,ir=$[14]<<6|$[15]>>>26,Pt=$[15]<<6|$[14]>>>26,st=$[25]<<11|$[24]>>>21,Qe=$[24]<<11|$[25]>>>21,$t=$[34]<<15|$[35]>>>17,Et=$[35]<<15|$[34]>>>17,er=$[45]<<29|$[44]>>>3,dr=$[44]<<29|$[45]>>>3,pt=$[6]<<28|$[7]>>>4,Ge=$[7]<<28|$[6]>>>4,Pr=$[17]<<23|$[16]>>>9,tr=$[16]<<23|$[17]>>>9,Dt=$[26]<<25|$[27]>>>7,Nt=$[27]<<25|$[26]>>>7,ct=$[36]<<21|$[37]>>>11,tt=$[37]<<21|$[36]>>>11,ot=$[47]<<24|$[46]>>>8,Ht=$[46]<<24|$[47]>>>8,Vt=$[8]<<27|$[9]>>>5,zt=$[9]<<27|$[8]>>>5,vt=$[18]<<20|$[19]>>>12,bt=$[19]<<20|$[18]>>>12,Or=$[29]<<7|$[28]>>>25,pi=$[28]<<7|$[29]>>>25,dt=$[38]<<8|$[39]>>>24,Lt=$[39]<<8|$[38]>>>24,He=$[48]<<14|$[49]>>>18,at=$[49]<<14|$[48]>>>18,$[0]=Xe^~Re&st,$[1]=lt^~$e&Qe,$[10]=pt^~vt&Ze,$[11]=Ge^~bt&_t,$[20]=wt^~ir&Dt,$[21]=lr^~Pt&Nt,$[30]=Vt^~ht&Bt,$[31]=zt^~xt&Ve,$[40]=Nr^~Pr&Or,$[41]=Ut^~tr&pi,$[2]=Re^~st&ct,$[3]=$e^~Qe&tt,$[12]=vt^~Ze&Ct,$[13]=bt^~_t&It,$[22]=ir^~Dt&dt,$[23]=Pt^~Nt&Lt,$[32]=ht^~Bt&$t,$[33]=xt^~Ve&Et,$[42]=Pr^~Or&vi,$[43]=tr^~pi&gi,$[4]=st^~ct&He,$[5]=Qe^~tt&at,$[14]=Ze^~Ct&er,$[15]=_t^~It&dr,$[24]=Dt^~dt&kt,$[25]=Nt^~Lt&ut,$[34]=Bt^~$t&ot,$[35]=Ve^~Et&Ht,$[44]=Or^~vi&_i,$[45]=pi^~gi&Tn,$[6]=ct^~He&Xe,$[7]=tt^~at<,$[16]=Ct^~er&pt,$[17]=It^~dr&Ge,$[26]=dt^~kt&wt,$[27]=Lt^~ut&lr,$[36]=$t^~ot&Vt,$[37]=Et^~Ht&zt,$[46]=vi^~_i&Nr,$[47]=gi^~Tn&Ut,$[8]=He^~Xe&Re,$[9]=at^~lt&$e,$[18]=er^~pt&vt,$[19]=dr^~Ge&bt,$[28]=kt^~wt&ir,$[29]=ut^~lr&Pt,$[38]=ot^~Vt&ht,$[39]=Ht^~zt&xt,$[48]=_i^~Nr&Pr,$[49]=Tn^~Ut&tr,$[0]^=m[Z],$[1]^=m[Z+1]};if(a)t.exports=v;else for(M=0;M{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const R$=$ke();var mT;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(mT||(mT={}));var Mc;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Mc||(Mc={}));const M$="0123456789abcdef";class Cn{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();w5[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(k$>w5[n])&&console.log.apply(console,r)}debug(...e){this._log(Cn.levels.DEBUG,e)}info(...e){this._log(Cn.levels.INFO,e)}warn(...e){this._log(Cn.levels.WARNING,e)}makeError(e,r,n){if(P$)return this.makeError("censored error",r,{});r||(r=Cn.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(c=>{const l=n[c];try{if(l instanceof Uint8Array){let f="";for(let u=0;u>4],f+=M$[l[u]&15];i.push(c+"=Uint8Array(0x"+f+")")}else i.push(c+"="+JSON.stringify(l))}catch{i.push(c+"="+JSON.stringify(n[c].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case Mc.NUMERIC_FAULT:{o="NUMERIC_FAULT";const c=e;switch(c){case"overflow":case"underflow":case"division-by-zero":o+="-"+c;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Mc.CALL_EXCEPTION:case Mc.INSUFFICIENT_FUNDS:case Mc.MISSING_NEW:case Mc.NONCE_EXPIRED:case Mc.REPLACEMENT_UNDERPRICED:case Mc.TRANSACTION_REPLACED:case Mc.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(c){a[c]=n[c]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Cn.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){R$&&this.throwError("platform missing String.prototype.normalize",Cn.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:R$})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Cn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Cn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Cn.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Cn.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Cn.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Cn.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return zS||(zS=new Cn(Uke)),zS}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Cn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),T$){if(!e)return;this.globalLogger().throwError("error censorship permanent",Cn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}P$=!!e,T$=!!r}static setLogLevel(e){const r=w5[e.toLowerCase()];if(r==null){Cn.globalLogger().warn("invalid log level - "+e);return}k$=r}static from(e){return new Cn(e)}}Cn.errors=Mc;Cn.levels=mT;const qke="bytes/5.7.0",Xn=new Cn(qke);function Ere(t){return!!t.toHexString}function bg(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return bg(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Vke(t){return Wl(t)&&!(t.length%2)||aO(t)}function O$(t){return typeof t=="number"&&t==t&&t%1===0}function aO(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!O$(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function ui(t,e){if(e||(e={}),typeof t=="number"){Xn.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),bg(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Ere(t)&&(t=t.toHexString()),Wl(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":Xn.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;iui(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),bg(n)}function Hke(t,e){t=ui(t),t.length>e&&Xn.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),bg(r)}function Wl(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const HS="0123456789abcdef";function ra(t,e){if(e||(e={}),typeof t=="number"){Xn.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=HS[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Ere(t))return t.toHexString();if(Wl(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Xn.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(aO(t)){let r="0x";for(let n=0;n>4]+HS[i&15]}return r}return Xn.throwArgumentError("invalid hexlify value","value",t)}function Gke(t){if(typeof t!="string")t=ra(t);else if(!Wl(t)||t.length%2)return null;return(t.length-2)/2}function D$(t,e,r){return typeof t!="string"?t=ra(t):(!Wl(t)||t.length%2)&&Xn.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function wg(t,e){for(typeof t!="string"?t=ra(t):Wl(t)||Xn.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Xn.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Cre(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Vke(t)){let r=ui(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=ra(r.slice(0,32)),e.s=ra(r.slice(32,64))):r.length===65?(e.r=ra(r.slice(0,32)),e.s=ra(r.slice(32,64)),e.v=r[64]):Xn.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:Xn.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=ra(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=Hke(ui(e._vs),32);e._vs=ra(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Xn.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=ra(i);e.s==null?e.s=o:e.s!==o&&Xn.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?Xn.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Xn.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Wl(e.r)?Xn.throwArgumentError("signature missing or invalid r","signature",t):e.r=wg(e.r,32),e.s==null||!Wl(e.s)?Xn.throwArgumentError("signature missing or invalid s","signature",t):e.s=wg(e.s,32);const r=ui(e.s);r[0]>=128&&Xn.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=ra(r);e._vs&&(Wl(e._vs)||Xn.throwArgumentError("signature invalid _vs","signature",t),e._vs=wg(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&Xn.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function cO(t){return"0x"+jke.keccak_256(ui(t))}var lO={exports:{}};const Wke={},Kke=Object.freeze(Object.defineProperty({__proto__:null,default:Wke},Symbol.toStringTag,{value:"Module"})),oC=JV(Kke);lO.exports;(function(t){(function(e,r){function n(D,v){if(!D)throw new Error(v||"Assertion failed")}function i(D,v){D.super_=v;var b=function(){};b.prototype=v.prototype,D.prototype=new b,D.prototype.constructor=D}function s(D,v,b){if(s.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((v==="le"||v==="be")&&(b=v,v=10),this._init(D||0,v||10,b||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=oC.Buffer}catch{}s.isBN=function(v){return v instanceof s?!0:v!==null&&typeof v=="object"&&v.constructor.wordSize===s.wordSize&&Array.isArray(v.words)},s.max=function(v,b){return v.cmp(b)>0?v:b},s.min=function(v,b){return v.cmp(b)<0?v:b},s.prototype._init=function(v,b,M){if(typeof v=="number")return this._initNumber(v,b,M);if(typeof v=="object")return this._initArray(v,b,M);b==="hex"&&(b=16),n(b===(b|0)&&b>=2&&b<=36),v=v.toString().replace(/\s+/g,"");var B=0;v[0]==="-"&&(B++,this.negative=1),B=0;B-=3)C=v[B]|v[B-1]<<8|v[B-2]<<16,this.words[x]|=C<>>26-w&67108863,w+=24,w>=26&&(w-=26,x++);else if(M==="le")for(B=0,x=0;B>>26-w&67108863,w+=24,w>=26&&(w-=26,x++);return this._strip()};function a(D,v){var b=D.charCodeAt(v);if(b>=48&&b<=57)return b-48;if(b>=65&&b<=70)return b-55;if(b>=97&&b<=102)return b-87;n(!1,"Invalid character in "+D)}function c(D,v,b){var M=a(D,b);return b-1>=v&&(M|=a(D,b-1)<<4),M}s.prototype._parseHex=function(v,b,M){this.length=Math.ceil((v.length-b)/6),this.words=new Array(this.length);for(var B=0;B=b;B-=2)w=c(v,b,B)<=18?(x-=18,C+=1,this.words[C]|=w>>>26):x+=8;else{var k=v.length-b;for(B=k%2===0?b+1:b;B=18?(x-=18,C+=1,this.words[C]|=w>>>26):x+=8}this._strip()};function l(D,v,b,M){for(var B=0,x=0,C=Math.min(D.length,b),w=v;w=49?x=k-49+10:k>=17?x=k-17+10:x=k,n(k>=0&&x1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?""}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],g=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(v,b){v=v||10,b=b|0||1;var M;if(v===16||v==="hex"){M="";for(var B=0,x=0,C=0;C>>24-B&16777215,B+=2,B>=26&&(B-=26,C--),x!==0||C!==this.length-1?M=h[6-k.length]+k+M:M=k+M}for(x!==0&&(M=x.toString(16)+M);M.length%b!==0;)M="0"+M;return this.negative!==0&&(M="-"+M),M}if(v===(v|0)&&v>=2&&v<=36){var O=g[v],G=y[v];M="";var oe=this.clone();for(oe.negative=0;!oe.isZero();){var $=oe.modrn(G).toString(v);oe=oe.idivn(G),oe.isZero()?M=$+M:M=h[O-$.length]+$+M}for(this.isZero()&&(M="0"+M);M.length%b!==0;)M="0"+M;return this.negative!==0&&(M="-"+M),M}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(v,b){return this.toArrayLike(o,v,b)}),s.prototype.toArray=function(v,b){return this.toArrayLike(Array,v,b)};var m=function(v,b){return v.allocUnsafe?v.allocUnsafe(b):new v(b)};s.prototype.toArrayLike=function(v,b,M){this._strip();var B=this.byteLength(),x=M||Math.max(1,B);n(B<=x,"byte array longer than desired length"),n(x>0,"Requested array length <= 0");var C=m(v,x),w=b==="le"?"LE":"BE";return this["_toArrayLike"+w](C,B),C},s.prototype._toArrayLikeLE=function(v,b){for(var M=0,B=0,x=0,C=0;x>8&255),M>16&255),C===6?(M>24&255),B=0,C=0):(B=w>>>24,C+=2)}if(M=0&&(v[M--]=w>>8&255),M>=0&&(v[M--]=w>>16&255),C===6?(M>=0&&(v[M--]=w>>24&255),B=0,C=0):(B=w>>>24,C+=2)}if(M>=0)for(v[M--]=B;M>=0;)v[M--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var b=v,M=0;return b>=4096&&(M+=13,b>>>=13),b>=64&&(M+=7,b>>>=7),b>=8&&(M+=4,b>>>=4),b>=2&&(M+=2,b>>>=2),M+b},s.prototype._zeroBits=function(v){if(v===0)return 26;var b=v,M=0;return b&8191||(M+=13,b>>>=13),b&127||(M+=7,b>>>=7),b&15||(M+=4,b>>>=4),b&3||(M+=2,b>>>=2),b&1||M++,M},s.prototype.bitLength=function(){var v=this.words[this.length-1],b=this._countBits(v);return(this.length-1)*26+b};function S(D){for(var v=new Array(D.bitLength()),b=0;b>>B&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,b=0;bv.length?this.clone().ior(v):v.clone().ior(this)},s.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},s.prototype.iuand=function(v){var b;this.length>v.length?b=v:b=this;for(var M=0;Mv.length?this.clone().iand(v):v.clone().iand(this)},s.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},s.prototype.iuxor=function(v){var b,M;this.length>v.length?(b=this,M=v):(b=v,M=this);for(var B=0;Bv.length?this.clone().ixor(v):v.clone().ixor(this)},s.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},s.prototype.inotn=function(v){n(typeof v=="number"&&v>=0);var b=Math.ceil(v/26)|0,M=v%26;this._expand(b),M>0&&b--;for(var B=0;B0&&(this.words[B]=~this.words[B]&67108863>>26-M),this._strip()},s.prototype.notn=function(v){return this.clone().inotn(v)},s.prototype.setn=function(v,b){n(typeof v=="number"&&v>=0);var M=v/26|0,B=v%26;return this._expand(M+1),b?this.words[M]=this.words[M]|1<v.length?(M=this,B=v):(M=v,B=this);for(var x=0,C=0;C>>26;for(;x!==0&&C>>26;if(this.length=M.length,x!==0)this.words[this.length]=x,this.length++;else if(M!==this)for(;Cv.length?this.clone().iadd(v):v.clone().iadd(this)},s.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var b=this.iadd(v);return v.negative=1,b._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var M=this.cmp(v);if(M===0)return this.negative=0,this.length=1,this.words[0]=0,this;var B,x;M>0?(B=this,x=v):(B=v,x=this);for(var C=0,w=0;w>26,this.words[w]=b&67108863;for(;C!==0&&w>26,this.words[w]=b&67108863;if(C===0&&w>>26,oe=k&67108863,$=Math.min(O,v.length-1),X=Math.max(0,O-D.length+1);X<=$;X++){var W=O-X|0;B=D.words[W]|0,x=v.words[X]|0,C=B*x+oe,G+=C/67108864|0,oe=C&67108863}b.words[O]=oe|0,k=G|0}return k!==0?b.words[O]=k|0:b.length--,b._strip()}var A=function(v,b,M){var B=v.words,x=b.words,C=M.words,w=0,k,O,G,oe=B[0]|0,$=oe&8191,X=oe>>>13,W=B[1]|0,Z=W&8191,te=W>>>13,F=B[2]|0,ee=F&8191,fe=F>>>13,xe=B[3]|0,_e=xe&8191,Me=xe>>>13,Ke=B[4]|0,ze=Ke&8191,Je=Ke>>>13,Xe=B[5]|0,lt=Xe&8191,Re=Xe>>>13,$e=B[6]|0,st=$e&8191,Qe=$e>>>13,ct=B[7]|0,tt=ct&8191,He=ct>>>13,at=B[8]|0,pt=at&8191,Ge=at>>>13,vt=B[9]|0,bt=vt&8191,Ze=vt>>>13,_t=x[0]|0,Ct=_t&8191,It=_t>>>13,er=x[1]|0,dr=er&8191,wt=er>>>13,lr=x[2]|0,ir=lr&8191,Pt=lr>>>13,Dt=x[3]|0,Nt=Dt&8191,dt=Dt>>>13,Lt=x[4]|0,kt=Lt&8191,ut=Lt>>>13,Vt=x[5]|0,zt=Vt&8191,ht=Vt>>>13,xt=x[6]|0,Bt=xt&8191,Ve=xt>>>13,$t=x[7]|0,Et=$t&8191,ot=$t>>>13,Ht=x[8]|0,Nr=Ht&8191,Ut=Ht>>>13,Pr=x[9]|0,tr=Pr&8191,Or=Pr>>>13;M.negative=v.negative^b.negative,M.length=19,k=Math.imul($,Ct),O=Math.imul($,It),O=O+Math.imul(X,Ct)|0,G=Math.imul(X,It);var pi=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(pi>>>26)|0,pi&=67108863,k=Math.imul(Z,Ct),O=Math.imul(Z,It),O=O+Math.imul(te,Ct)|0,G=Math.imul(te,It),k=k+Math.imul($,dr)|0,O=O+Math.imul($,wt)|0,O=O+Math.imul(X,dr)|0,G=G+Math.imul(X,wt)|0;var vi=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(vi>>>26)|0,vi&=67108863,k=Math.imul(ee,Ct),O=Math.imul(ee,It),O=O+Math.imul(fe,Ct)|0,G=Math.imul(fe,It),k=k+Math.imul(Z,dr)|0,O=O+Math.imul(Z,wt)|0,O=O+Math.imul(te,dr)|0,G=G+Math.imul(te,wt)|0,k=k+Math.imul($,ir)|0,O=O+Math.imul($,Pt)|0,O=O+Math.imul(X,ir)|0,G=G+Math.imul(X,Pt)|0;var gi=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(gi>>>26)|0,gi&=67108863,k=Math.imul(_e,Ct),O=Math.imul(_e,It),O=O+Math.imul(Me,Ct)|0,G=Math.imul(Me,It),k=k+Math.imul(ee,dr)|0,O=O+Math.imul(ee,wt)|0,O=O+Math.imul(fe,dr)|0,G=G+Math.imul(fe,wt)|0,k=k+Math.imul(Z,ir)|0,O=O+Math.imul(Z,Pt)|0,O=O+Math.imul(te,ir)|0,G=G+Math.imul(te,Pt)|0,k=k+Math.imul($,Nt)|0,O=O+Math.imul($,dt)|0,O=O+Math.imul(X,Nt)|0,G=G+Math.imul(X,dt)|0;var _i=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(_i>>>26)|0,_i&=67108863,k=Math.imul(ze,Ct),O=Math.imul(ze,It),O=O+Math.imul(Je,Ct)|0,G=Math.imul(Je,It),k=k+Math.imul(_e,dr)|0,O=O+Math.imul(_e,wt)|0,O=O+Math.imul(Me,dr)|0,G=G+Math.imul(Me,wt)|0,k=k+Math.imul(ee,ir)|0,O=O+Math.imul(ee,Pt)|0,O=O+Math.imul(fe,ir)|0,G=G+Math.imul(fe,Pt)|0,k=k+Math.imul(Z,Nt)|0,O=O+Math.imul(Z,dt)|0,O=O+Math.imul(te,Nt)|0,G=G+Math.imul(te,dt)|0,k=k+Math.imul($,kt)|0,O=O+Math.imul($,ut)|0,O=O+Math.imul(X,kt)|0,G=G+Math.imul(X,ut)|0;var Tn=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,k=Math.imul(lt,Ct),O=Math.imul(lt,It),O=O+Math.imul(Re,Ct)|0,G=Math.imul(Re,It),k=k+Math.imul(ze,dr)|0,O=O+Math.imul(ze,wt)|0,O=O+Math.imul(Je,dr)|0,G=G+Math.imul(Je,wt)|0,k=k+Math.imul(_e,ir)|0,O=O+Math.imul(_e,Pt)|0,O=O+Math.imul(Me,ir)|0,G=G+Math.imul(Me,Pt)|0,k=k+Math.imul(ee,Nt)|0,O=O+Math.imul(ee,dt)|0,O=O+Math.imul(fe,Nt)|0,G=G+Math.imul(fe,dt)|0,k=k+Math.imul(Z,kt)|0,O=O+Math.imul(Z,ut)|0,O=O+Math.imul(te,kt)|0,G=G+Math.imul(te,ut)|0,k=k+Math.imul($,zt)|0,O=O+Math.imul($,ht)|0,O=O+Math.imul(X,zt)|0,G=G+Math.imul(X,ht)|0;var ps=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(ps>>>26)|0,ps&=67108863,k=Math.imul(st,Ct),O=Math.imul(st,It),O=O+Math.imul(Qe,Ct)|0,G=Math.imul(Qe,It),k=k+Math.imul(lt,dr)|0,O=O+Math.imul(lt,wt)|0,O=O+Math.imul(Re,dr)|0,G=G+Math.imul(Re,wt)|0,k=k+Math.imul(ze,ir)|0,O=O+Math.imul(ze,Pt)|0,O=O+Math.imul(Je,ir)|0,G=G+Math.imul(Je,Pt)|0,k=k+Math.imul(_e,Nt)|0,O=O+Math.imul(_e,dt)|0,O=O+Math.imul(Me,Nt)|0,G=G+Math.imul(Me,dt)|0,k=k+Math.imul(ee,kt)|0,O=O+Math.imul(ee,ut)|0,O=O+Math.imul(fe,kt)|0,G=G+Math.imul(fe,ut)|0,k=k+Math.imul(Z,zt)|0,O=O+Math.imul(Z,ht)|0,O=O+Math.imul(te,zt)|0,G=G+Math.imul(te,ht)|0,k=k+Math.imul($,Bt)|0,O=O+Math.imul($,Ve)|0,O=O+Math.imul(X,Bt)|0,G=G+Math.imul(X,Ve)|0;var vs=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(vs>>>26)|0,vs&=67108863,k=Math.imul(tt,Ct),O=Math.imul(tt,It),O=O+Math.imul(He,Ct)|0,G=Math.imul(He,It),k=k+Math.imul(st,dr)|0,O=O+Math.imul(st,wt)|0,O=O+Math.imul(Qe,dr)|0,G=G+Math.imul(Qe,wt)|0,k=k+Math.imul(lt,ir)|0,O=O+Math.imul(lt,Pt)|0,O=O+Math.imul(Re,ir)|0,G=G+Math.imul(Re,Pt)|0,k=k+Math.imul(ze,Nt)|0,O=O+Math.imul(ze,dt)|0,O=O+Math.imul(Je,Nt)|0,G=G+Math.imul(Je,dt)|0,k=k+Math.imul(_e,kt)|0,O=O+Math.imul(_e,ut)|0,O=O+Math.imul(Me,kt)|0,G=G+Math.imul(Me,ut)|0,k=k+Math.imul(ee,zt)|0,O=O+Math.imul(ee,ht)|0,O=O+Math.imul(fe,zt)|0,G=G+Math.imul(fe,ht)|0,k=k+Math.imul(Z,Bt)|0,O=O+Math.imul(Z,Ve)|0,O=O+Math.imul(te,Bt)|0,G=G+Math.imul(te,Ve)|0,k=k+Math.imul($,Et)|0,O=O+Math.imul($,ot)|0,O=O+Math.imul(X,Et)|0,G=G+Math.imul(X,ot)|0;var gs=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(gs>>>26)|0,gs&=67108863,k=Math.imul(pt,Ct),O=Math.imul(pt,It),O=O+Math.imul(Ge,Ct)|0,G=Math.imul(Ge,It),k=k+Math.imul(tt,dr)|0,O=O+Math.imul(tt,wt)|0,O=O+Math.imul(He,dr)|0,G=G+Math.imul(He,wt)|0,k=k+Math.imul(st,ir)|0,O=O+Math.imul(st,Pt)|0,O=O+Math.imul(Qe,ir)|0,G=G+Math.imul(Qe,Pt)|0,k=k+Math.imul(lt,Nt)|0,O=O+Math.imul(lt,dt)|0,O=O+Math.imul(Re,Nt)|0,G=G+Math.imul(Re,dt)|0,k=k+Math.imul(ze,kt)|0,O=O+Math.imul(ze,ut)|0,O=O+Math.imul(Je,kt)|0,G=G+Math.imul(Je,ut)|0,k=k+Math.imul(_e,zt)|0,O=O+Math.imul(_e,ht)|0,O=O+Math.imul(Me,zt)|0,G=G+Math.imul(Me,ht)|0,k=k+Math.imul(ee,Bt)|0,O=O+Math.imul(ee,Ve)|0,O=O+Math.imul(fe,Bt)|0,G=G+Math.imul(fe,Ve)|0,k=k+Math.imul(Z,Et)|0,O=O+Math.imul(Z,ot)|0,O=O+Math.imul(te,Et)|0,G=G+Math.imul(te,ot)|0,k=k+Math.imul($,Nr)|0,O=O+Math.imul($,Ut)|0,O=O+Math.imul(X,Nr)|0,G=G+Math.imul(X,Ut)|0;var Hi=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,k=Math.imul(bt,Ct),O=Math.imul(bt,It),O=O+Math.imul(Ze,Ct)|0,G=Math.imul(Ze,It),k=k+Math.imul(pt,dr)|0,O=O+Math.imul(pt,wt)|0,O=O+Math.imul(Ge,dr)|0,G=G+Math.imul(Ge,wt)|0,k=k+Math.imul(tt,ir)|0,O=O+Math.imul(tt,Pt)|0,O=O+Math.imul(He,ir)|0,G=G+Math.imul(He,Pt)|0,k=k+Math.imul(st,Nt)|0,O=O+Math.imul(st,dt)|0,O=O+Math.imul(Qe,Nt)|0,G=G+Math.imul(Qe,dt)|0,k=k+Math.imul(lt,kt)|0,O=O+Math.imul(lt,ut)|0,O=O+Math.imul(Re,kt)|0,G=G+Math.imul(Re,ut)|0,k=k+Math.imul(ze,zt)|0,O=O+Math.imul(ze,ht)|0,O=O+Math.imul(Je,zt)|0,G=G+Math.imul(Je,ht)|0,k=k+Math.imul(_e,Bt)|0,O=O+Math.imul(_e,Ve)|0,O=O+Math.imul(Me,Bt)|0,G=G+Math.imul(Me,Ve)|0,k=k+Math.imul(ee,Et)|0,O=O+Math.imul(ee,ot)|0,O=O+Math.imul(fe,Et)|0,G=G+Math.imul(fe,ot)|0,k=k+Math.imul(Z,Nr)|0,O=O+Math.imul(Z,Ut)|0,O=O+Math.imul(te,Nr)|0,G=G+Math.imul(te,Ut)|0,k=k+Math.imul($,tr)|0,O=O+Math.imul($,Or)|0,O=O+Math.imul(X,tr)|0,G=G+Math.imul(X,Or)|0;var ys=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(ys>>>26)|0,ys&=67108863,k=Math.imul(bt,dr),O=Math.imul(bt,wt),O=O+Math.imul(Ze,dr)|0,G=Math.imul(Ze,wt),k=k+Math.imul(pt,ir)|0,O=O+Math.imul(pt,Pt)|0,O=O+Math.imul(Ge,ir)|0,G=G+Math.imul(Ge,Pt)|0,k=k+Math.imul(tt,Nt)|0,O=O+Math.imul(tt,dt)|0,O=O+Math.imul(He,Nt)|0,G=G+Math.imul(He,dt)|0,k=k+Math.imul(st,kt)|0,O=O+Math.imul(st,ut)|0,O=O+Math.imul(Qe,kt)|0,G=G+Math.imul(Qe,ut)|0,k=k+Math.imul(lt,zt)|0,O=O+Math.imul(lt,ht)|0,O=O+Math.imul(Re,zt)|0,G=G+Math.imul(Re,ht)|0,k=k+Math.imul(ze,Bt)|0,O=O+Math.imul(ze,Ve)|0,O=O+Math.imul(Je,Bt)|0,G=G+Math.imul(Je,Ve)|0,k=k+Math.imul(_e,Et)|0,O=O+Math.imul(_e,ot)|0,O=O+Math.imul(Me,Et)|0,G=G+Math.imul(Me,ot)|0,k=k+Math.imul(ee,Nr)|0,O=O+Math.imul(ee,Ut)|0,O=O+Math.imul(fe,Nr)|0,G=G+Math.imul(fe,Ut)|0,k=k+Math.imul(Z,tr)|0,O=O+Math.imul(Z,Or)|0,O=O+Math.imul(te,tr)|0,G=G+Math.imul(te,Or)|0;var ms=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(ms>>>26)|0,ms&=67108863,k=Math.imul(bt,ir),O=Math.imul(bt,Pt),O=O+Math.imul(Ze,ir)|0,G=Math.imul(Ze,Pt),k=k+Math.imul(pt,Nt)|0,O=O+Math.imul(pt,dt)|0,O=O+Math.imul(Ge,Nt)|0,G=G+Math.imul(Ge,dt)|0,k=k+Math.imul(tt,kt)|0,O=O+Math.imul(tt,ut)|0,O=O+Math.imul(He,kt)|0,G=G+Math.imul(He,ut)|0,k=k+Math.imul(st,zt)|0,O=O+Math.imul(st,ht)|0,O=O+Math.imul(Qe,zt)|0,G=G+Math.imul(Qe,ht)|0,k=k+Math.imul(lt,Bt)|0,O=O+Math.imul(lt,Ve)|0,O=O+Math.imul(Re,Bt)|0,G=G+Math.imul(Re,Ve)|0,k=k+Math.imul(ze,Et)|0,O=O+Math.imul(ze,ot)|0,O=O+Math.imul(Je,Et)|0,G=G+Math.imul(Je,ot)|0,k=k+Math.imul(_e,Nr)|0,O=O+Math.imul(_e,Ut)|0,O=O+Math.imul(Me,Nr)|0,G=G+Math.imul(Me,Ut)|0,k=k+Math.imul(ee,tr)|0,O=O+Math.imul(ee,Or)|0,O=O+Math.imul(fe,tr)|0,G=G+Math.imul(fe,Or)|0;var qs=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(qs>>>26)|0,qs&=67108863,k=Math.imul(bt,Nt),O=Math.imul(bt,dt),O=O+Math.imul(Ze,Nt)|0,G=Math.imul(Ze,dt),k=k+Math.imul(pt,kt)|0,O=O+Math.imul(pt,ut)|0,O=O+Math.imul(Ge,kt)|0,G=G+Math.imul(Ge,ut)|0,k=k+Math.imul(tt,zt)|0,O=O+Math.imul(tt,ht)|0,O=O+Math.imul(He,zt)|0,G=G+Math.imul(He,ht)|0,k=k+Math.imul(st,Bt)|0,O=O+Math.imul(st,Ve)|0,O=O+Math.imul(Qe,Bt)|0,G=G+Math.imul(Qe,Ve)|0,k=k+Math.imul(lt,Et)|0,O=O+Math.imul(lt,ot)|0,O=O+Math.imul(Re,Et)|0,G=G+Math.imul(Re,ot)|0,k=k+Math.imul(ze,Nr)|0,O=O+Math.imul(ze,Ut)|0,O=O+Math.imul(Je,Nr)|0,G=G+Math.imul(Je,Ut)|0,k=k+Math.imul(_e,tr)|0,O=O+Math.imul(_e,Or)|0,O=O+Math.imul(Me,tr)|0,G=G+Math.imul(Me,Or)|0;var ho=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(ho>>>26)|0,ho&=67108863,k=Math.imul(bt,kt),O=Math.imul(bt,ut),O=O+Math.imul(Ze,kt)|0,G=Math.imul(Ze,ut),k=k+Math.imul(pt,zt)|0,O=O+Math.imul(pt,ht)|0,O=O+Math.imul(Ge,zt)|0,G=G+Math.imul(Ge,ht)|0,k=k+Math.imul(tt,Bt)|0,O=O+Math.imul(tt,Ve)|0,O=O+Math.imul(He,Bt)|0,G=G+Math.imul(He,Ve)|0,k=k+Math.imul(st,Et)|0,O=O+Math.imul(st,ot)|0,O=O+Math.imul(Qe,Et)|0,G=G+Math.imul(Qe,ot)|0,k=k+Math.imul(lt,Nr)|0,O=O+Math.imul(lt,Ut)|0,O=O+Math.imul(Re,Nr)|0,G=G+Math.imul(Re,Ut)|0,k=k+Math.imul(ze,tr)|0,O=O+Math.imul(ze,Or)|0,O=O+Math.imul(Je,tr)|0,G=G+Math.imul(Je,Or)|0;var Pn=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,k=Math.imul(bt,zt),O=Math.imul(bt,ht),O=O+Math.imul(Ze,zt)|0,G=Math.imul(Ze,ht),k=k+Math.imul(pt,Bt)|0,O=O+Math.imul(pt,Ve)|0,O=O+Math.imul(Ge,Bt)|0,G=G+Math.imul(Ge,Ve)|0,k=k+Math.imul(tt,Et)|0,O=O+Math.imul(tt,ot)|0,O=O+Math.imul(He,Et)|0,G=G+Math.imul(He,ot)|0,k=k+Math.imul(st,Nr)|0,O=O+Math.imul(st,Ut)|0,O=O+Math.imul(Qe,Nr)|0,G=G+Math.imul(Qe,Ut)|0,k=k+Math.imul(lt,tr)|0,O=O+Math.imul(lt,Or)|0,O=O+Math.imul(Re,tr)|0,G=G+Math.imul(Re,Or)|0;var Gi=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,k=Math.imul(bt,Bt),O=Math.imul(bt,Ve),O=O+Math.imul(Ze,Bt)|0,G=Math.imul(Ze,Ve),k=k+Math.imul(pt,Et)|0,O=O+Math.imul(pt,ot)|0,O=O+Math.imul(Ge,Et)|0,G=G+Math.imul(Ge,ot)|0,k=k+Math.imul(tt,Nr)|0,O=O+Math.imul(tt,Ut)|0,O=O+Math.imul(He,Nr)|0,G=G+Math.imul(He,Ut)|0,k=k+Math.imul(st,tr)|0,O=O+Math.imul(st,Or)|0,O=O+Math.imul(Qe,tr)|0,G=G+Math.imul(Qe,Or)|0;var po=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(po>>>26)|0,po&=67108863,k=Math.imul(bt,Et),O=Math.imul(bt,ot),O=O+Math.imul(Ze,Et)|0,G=Math.imul(Ze,ot),k=k+Math.imul(pt,Nr)|0,O=O+Math.imul(pt,Ut)|0,O=O+Math.imul(Ge,Nr)|0,G=G+Math.imul(Ge,Ut)|0,k=k+Math.imul(tt,tr)|0,O=O+Math.imul(tt,Or)|0,O=O+Math.imul(He,tr)|0,G=G+Math.imul(He,Or)|0;var Vs=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(Vs>>>26)|0,Vs&=67108863,k=Math.imul(bt,Nr),O=Math.imul(bt,Ut),O=O+Math.imul(Ze,Nr)|0,G=Math.imul(Ze,Ut),k=k+Math.imul(pt,tr)|0,O=O+Math.imul(pt,Or)|0,O=O+Math.imul(Ge,tr)|0,G=G+Math.imul(Ge,Or)|0;var gf=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(gf>>>26)|0,gf&=67108863,k=Math.imul(bt,tr),O=Math.imul(bt,Or),O=O+Math.imul(Ze,tr)|0,G=Math.imul(Ze,Or);var nl=(w+k|0)+((O&8191)<<13)|0;return w=(G+(O>>>13)|0)+(nl>>>26)|0,nl&=67108863,C[0]=pi,C[1]=vi,C[2]=gi,C[3]=_i,C[4]=Tn,C[5]=ps,C[6]=vs,C[7]=gs,C[8]=Hi,C[9]=ys,C[10]=ms,C[11]=qs,C[12]=ho,C[13]=Pn,C[14]=Gi,C[15]=po,C[16]=Vs,C[17]=gf,C[18]=nl,w!==0&&(C[19]=w,M.length++),M};Math.imul||(A=E);function P(D,v,b){b.negative=v.negative^D.negative,b.length=D.length+v.length;for(var M=0,B=0,x=0;x>>26)|0,B+=C>>>26,C&=67108863}b.words[x]=w,M=C,C=B}return M!==0?b.words[x]=M:b.length--,b._strip()}function N(D,v,b){return P(D,v,b)}s.prototype.mulTo=function(v,b){var M,B=this.length+v.length;return this.length===10&&v.length===10?M=A(this,v,b):B<63?M=E(this,v,b):B<1024?M=P(this,v,b):M=N(this,v,b),M},s.prototype.mul=function(v){var b=new s(null);return b.words=new Array(this.length+v.length),this.mulTo(v,b)},s.prototype.mulf=function(v){var b=new s(null);return b.words=new Array(this.length+v.length),N(this,v,b)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var b=v<0;b&&(v=-v),n(typeof v=="number"),n(v<67108864);for(var M=0,B=0;B>=26,M+=x/67108864|0,M+=C>>>26,this.words[B]=C&67108863}return M!==0&&(this.words[B]=M,this.length++),b?this.ineg():this},s.prototype.muln=function(v){return this.clone().imuln(v)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(v){var b=S(v);if(b.length===0)return new s(1);for(var M=this,B=0;B=0);var b=v%26,M=(v-b)/26,B=67108863>>>26-b<<26-b,x;if(b!==0){var C=0;for(x=0;x>>26-b}C&&(this.words[x]=C,this.length++)}if(M!==0){for(x=this.length-1;x>=0;x--)this.words[x+M]=this.words[x];for(x=0;x=0);var B;b?B=(b-b%26)/26:B=0;var x=v%26,C=Math.min((v-x)/26,this.length),w=67108863^67108863>>>x<C)for(this.length-=C,O=0;O=0&&(G!==0||O>=B);O--){var oe=this.words[O]|0;this.words[O]=G<<26-x|oe>>>x,G=oe&w}return k&&G!==0&&(k.words[k.length++]=G),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,b,M){return n(this.negative===0),this.iushrn(v,b,M)},s.prototype.shln=function(v){return this.clone().ishln(v)},s.prototype.ushln=function(v){return this.clone().iushln(v)},s.prototype.shrn=function(v){return this.clone().ishrn(v)},s.prototype.ushrn=function(v){return this.clone().iushrn(v)},s.prototype.testn=function(v){n(typeof v=="number"&&v>=0);var b=v%26,M=(v-b)/26,B=1<=0);var b=v%26,M=(v-b)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=M)return this;if(b!==0&&M++,this.length=Math.min(M,this.length),b!==0){var B=67108863^67108863>>>b<=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},s.prototype.isubn=function(v){if(n(typeof v=="number"),n(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b>26)-(k/67108864|0),this.words[x+M]=C&67108863}for(;x>26,this.words[x+M]=C&67108863;if(w===0)return this._strip();for(n(w===-1),w=0,x=0;x>26,this.words[x]=C&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,b){var M=this.length-v.length,B=this.clone(),x=v,C=x.words[x.length-1]|0,w=this._countBits(C);M=26-w,M!==0&&(x=x.ushln(M),B.iushln(M),C=x.words[x.length-1]|0);var k=B.length-x.length,O;if(b!=="mod"){O=new s(null),O.length=k+1,O.words=new Array(O.length);for(var G=0;G=0;$--){var X=(B.words[x.length+$]|0)*67108864+(B.words[x.length+$-1]|0);for(X=Math.min(X/C|0,67108863),B._ishlnsubmul(x,X,$);B.negative!==0;)X--,B.negative=0,B._ishlnsubmul(x,1,$),B.isZero()||(B.negative^=1);O&&(O.words[$]=X)}return O&&O._strip(),B._strip(),b!=="div"&&M!==0&&B.iushrn(M),{div:O||null,mod:B}},s.prototype.divmod=function(v,b,M){if(n(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var B,x,C;return this.negative!==0&&v.negative===0?(C=this.neg().divmod(v,b),b!=="mod"&&(B=C.div.neg()),b!=="div"&&(x=C.mod.neg(),M&&x.negative!==0&&x.iadd(v)),{div:B,mod:x}):this.negative===0&&v.negative!==0?(C=this.divmod(v.neg(),b),b!=="mod"&&(B=C.div.neg()),{div:B,mod:C.mod}):this.negative&v.negative?(C=this.neg().divmod(v.neg(),b),b!=="div"&&(x=C.mod.neg(),M&&x.negative!==0&&x.isub(v)),{div:C.div,mod:x}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?b==="div"?{div:this.divn(v.words[0]),mod:null}:b==="mod"?{div:null,mod:new s(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new s(this.modrn(v.words[0]))}:this._wordDiv(v,b)},s.prototype.div=function(v){return this.divmod(v,"div",!1).div},s.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},s.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},s.prototype.divRound=function(v){var b=this.divmod(v);if(b.mod.isZero())return b.div;var M=b.div.negative!==0?b.mod.isub(v):b.mod,B=v.ushrn(1),x=v.andln(1),C=M.cmp(B);return C<0||x===1&&C===0?b.div:b.div.negative!==0?b.div.isubn(1):b.div.iaddn(1)},s.prototype.modrn=function(v){var b=v<0;b&&(v=-v),n(v<=67108863);for(var M=(1<<26)%v,B=0,x=this.length-1;x>=0;x--)B=(M*B+(this.words[x]|0))%v;return b?-B:B},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var b=v<0;b&&(v=-v),n(v<=67108863);for(var M=0,B=this.length-1;B>=0;B--){var x=(this.words[B]|0)+M*67108864;this.words[B]=x/v|0,M=x%v}return this._strip(),b?this.ineg():this},s.prototype.divn=function(v){return this.clone().idivn(v)},s.prototype.egcd=function(v){n(v.negative===0),n(!v.isZero());var b=this,M=v.clone();b.negative!==0?b=b.umod(v):b=b.clone();for(var B=new s(1),x=new s(0),C=new s(0),w=new s(1),k=0;b.isEven()&&M.isEven();)b.iushrn(1),M.iushrn(1),++k;for(var O=M.clone(),G=b.clone();!b.isZero();){for(var oe=0,$=1;!(b.words[0]&$)&&oe<26;++oe,$<<=1);if(oe>0)for(b.iushrn(oe);oe-- >0;)(B.isOdd()||x.isOdd())&&(B.iadd(O),x.isub(G)),B.iushrn(1),x.iushrn(1);for(var X=0,W=1;!(M.words[0]&W)&&X<26;++X,W<<=1);if(X>0)for(M.iushrn(X);X-- >0;)(C.isOdd()||w.isOdd())&&(C.iadd(O),w.isub(G)),C.iushrn(1),w.iushrn(1);b.cmp(M)>=0?(b.isub(M),B.isub(C),x.isub(w)):(M.isub(b),C.isub(B),w.isub(x))}return{a:C,b:w,gcd:M.iushln(k)}},s.prototype._invmp=function(v){n(v.negative===0),n(!v.isZero());var b=this,M=v.clone();b.negative!==0?b=b.umod(v):b=b.clone();for(var B=new s(1),x=new s(0),C=M.clone();b.cmpn(1)>0&&M.cmpn(1)>0;){for(var w=0,k=1;!(b.words[0]&k)&&w<26;++w,k<<=1);if(w>0)for(b.iushrn(w);w-- >0;)B.isOdd()&&B.iadd(C),B.iushrn(1);for(var O=0,G=1;!(M.words[0]&G)&&O<26;++O,G<<=1);if(O>0)for(M.iushrn(O);O-- >0;)x.isOdd()&&x.iadd(C),x.iushrn(1);b.cmp(M)>=0?(b.isub(M),B.isub(x)):(M.isub(b),x.isub(B))}var oe;return b.cmpn(1)===0?oe=B:oe=x,oe.cmpn(0)<0&&oe.iadd(v),oe},s.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var b=this.clone(),M=v.clone();b.negative=0,M.negative=0;for(var B=0;b.isEven()&&M.isEven();B++)b.iushrn(1),M.iushrn(1);do{for(;b.isEven();)b.iushrn(1);for(;M.isEven();)M.iushrn(1);var x=b.cmp(M);if(x<0){var C=b;b=M,M=C}else if(x===0||M.cmpn(1)===0)break;b.isub(M)}while(!0);return M.iushln(B)},s.prototype.invm=function(v){return this.egcd(v).a.umod(v)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(v){return this.words[0]&v},s.prototype.bincn=function(v){n(typeof v=="number");var b=v%26,M=(v-b)/26,B=1<>>26,w&=67108863,this.words[C]=w}return x!==0&&(this.words[C]=x,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var b=v<0;if(this.negative!==0&&!b)return-1;if(this.negative===0&&b)return 1;this._strip();var M;if(this.length>1)M=1;else{b&&(v=-v),n(v<=67108863,"Number is too big");var B=this.words[0]|0;M=B===v?0:Bv.length)return 1;if(this.length=0;M--){var B=this.words[M]|0,x=v.words[M]|0;if(B!==x){Bx&&(b=1);break}}return b},s.prototype.gtn=function(v){return this.cmpn(v)===1},s.prototype.gt=function(v){return this.cmp(v)===1},s.prototype.gten=function(v){return this.cmpn(v)>=0},s.prototype.gte=function(v){return this.cmp(v)>=0},s.prototype.ltn=function(v){return this.cmpn(v)===-1},s.prototype.lt=function(v){return this.cmp(v)===-1},s.prototype.lten=function(v){return this.cmpn(v)<=0},s.prototype.lte=function(v){return this.cmp(v)<=0},s.prototype.eqn=function(v){return this.cmpn(v)===0},s.prototype.eq=function(v){return this.cmp(v)===0},s.red=function(v){return new K(v)},s.prototype.toRed=function(v){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(v){return this.red=v,this},s.prototype.forceRed=function(v){return n(!this.red,"Already a number in reduction context"),this._forceRed(v)},s.prototype.redAdd=function(v){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},s.prototype.redIAdd=function(v){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},s.prototype.redSub=function(v){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},s.prototype.redISub=function(v){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},s.prototype.redShl=function(v){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},s.prototype.redMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},s.prototype.redIMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(v){return n(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var L={k256:null,p224:null,p192:null,p25519:null};function V(D,v){this.name=D,this.p=new s(v,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}V.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},V.prototype.ireduce=function(v){var b=v,M;do this.split(b,this.tmp),b=this.imulK(b),b=b.iadd(this.tmp),M=b.bitLength();while(M>this.n);var B=M0?b.isub(this.p):b.strip!==void 0?b.strip():b._strip(),b},V.prototype.split=function(v,b){v.iushrn(this.n,0,b)},V.prototype.imulK=function(v){return v.imul(this.k)};function I(){V.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(I,V),I.prototype.split=function(v,b){for(var M=4194303,B=Math.min(v.length,9),x=0;x>>22,C=w}C>>>=22,v.words[x-10]=C,C===0&&v.length>10?v.length-=10:v.length-=9},I.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var b=0,M=0;M>>=26,v.words[M]=x,b=B}return b!==0&&(v.words[v.length++]=b),v},s._prime=function(v){if(L[v])return L[v];var b;if(v==="k256")b=new I;else if(v==="p224")b=new U;else if(v==="p192")b=new ie;else if(v==="p25519")b=new ae;else throw new Error("Unknown prime "+v);return L[v]=b,b};function K(D){if(typeof D=="string"){var v=s._prime(D);this.m=v.p,this.prime=v}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}K.prototype._verify1=function(v){n(v.negative===0,"red works only with positives"),n(v.red,"red works only with red numbers")},K.prototype._verify2=function(v,b){n((v.negative|b.negative)===0,"red works only with positives"),n(v.red&&v.red===b.red,"red works only with red numbers")},K.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(f(v,v.umod(this.m)._forceRed(this)),v)},K.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},K.prototype.add=function(v,b){this._verify2(v,b);var M=v.add(b);return M.cmp(this.m)>=0&&M.isub(this.m),M._forceRed(this)},K.prototype.iadd=function(v,b){this._verify2(v,b);var M=v.iadd(b);return M.cmp(this.m)>=0&&M.isub(this.m),M},K.prototype.sub=function(v,b){this._verify2(v,b);var M=v.sub(b);return M.cmpn(0)<0&&M.iadd(this.m),M._forceRed(this)},K.prototype.isub=function(v,b){this._verify2(v,b);var M=v.isub(b);return M.cmpn(0)<0&&M.iadd(this.m),M},K.prototype.shl=function(v,b){return this._verify1(v),this.imod(v.ushln(b))},K.prototype.imul=function(v,b){return this._verify2(v,b),this.imod(v.imul(b))},K.prototype.mul=function(v,b){return this._verify2(v,b),this.imod(v.mul(b))},K.prototype.isqr=function(v){return this.imul(v,v.clone())},K.prototype.sqr=function(v){return this.mul(v,v)},K.prototype.sqrt=function(v){if(v.isZero())return v.clone();var b=this.m.andln(3);if(n(b%2===1),b===3){var M=this.m.add(new s(1)).iushrn(2);return this.pow(v,M)}for(var B=this.m.subn(1),x=0;!B.isZero()&&B.andln(1)===0;)x++,B.iushrn(1);n(!B.isZero());var C=new s(1).toRed(this),w=C.redNeg(),k=this.m.subn(1).iushrn(1),O=this.m.bitLength();for(O=new s(2*O*O).toRed(this);this.pow(O,k).cmp(w)!==0;)O.redIAdd(w);for(var G=this.pow(O,B),oe=this.pow(v,B.addn(1).iushrn(1)),$=this.pow(v,B),X=x;$.cmp(C)!==0;){for(var W=$,Z=0;W.cmp(C)!==0;Z++)W=W.redSqr();n(Z=0;x--){for(var G=b.words[x],oe=O-1;oe>=0;oe--){var $=G>>oe&1;if(C!==B[0]&&(C=this.sqr(C)),$===0&&w===0){k=0;continue}w<<=1,w|=$,k++,!(k!==M&&(x!==0||oe!==0))&&(C=this.mul(C,B[w]),k=0,w=0)}O=26}return C},K.prototype.convertTo=function(v){var b=v.umod(this.m);return b===v?b.clone():b},K.prototype.convertFrom=function(v){var b=v.clone();return b.red=null,b},s.mont=function(v){return new R(v)};function R(D){K.call(this,D),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(R,K),R.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},R.prototype.convertFrom=function(v){var b=this.imod(v.mul(this.rinv));return b.red=null,b},R.prototype.imul=function(v,b){if(v.isZero()||b.isZero())return v.words[0]=0,v.length=1,v;var M=v.imul(b),B=M.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=M.isub(B).iushrn(this.shift),C=x;return x.cmp(this.m)>=0?C=x.isub(this.m):x.cmpn(0)<0&&(C=x.iadd(this.m)),C._forceRed(this)},R.prototype.mul=function(v,b){if(v.isZero()||b.isZero())return new s(0)._forceRed(this);var M=v.mul(b),B=M.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=M.isub(B).iushrn(this.shift),C=x;return x.cmp(this.m)>=0?C=x.isub(this.m):x.cmpn(0)<0&&(C=x.iadd(this.m)),C._forceRed(this)},R.prototype.invm=function(v){var b=this.imod(v._invmp(this.m).mul(this.r2));return b._forceRed(this)}})(t,xi)})(lO);var Yke=lO.exports;const ar=$u(Yke);var Qke=ar.BN;function Jke(t){return new Qke(t,36).toString(16)}const Zke="strings/5.7.0",Xke=new Cn(Zke);var K4;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(K4||(K4={}));var N$;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(N$||(N$={}));function GS(t,e=K4.current){e!=K4.current&&(Xke.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return ui(r)}const eRe=`Ethereum Signed Message: -`;function Are(t){return typeof t=="string"&&(t=GS(t)),cO(zke([GS(eRe),GS(String(t.length)),t]))}const tRe="address/5.7.0",Vb=new Cn(tRe);function B$(t){Wl(t,20)||Vb.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=ui(cO(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const rRe=9007199254740991;function nRe(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const fO={};for(let t=0;t<10;t++)fO[String(t)]=String(t);for(let t=0;t<26;t++)fO[String.fromCharCode(65+t)]=String(10+t);const L$=Math.floor(nRe(rRe));function iRe(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>fO[n]).join("");for(;e.length>=L$;){let n=e.substring(0,L$);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function sRe(t){let e=null;if(typeof t!="string"&&Vb.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=B$(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Vb.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==iRe(t)&&Vb.throwArgumentError("bad icap checksum","address",t),e=Jke(t.substring(4));e.length<40;)e="0"+e;e=B$("0x"+e)}else Vb.throwArgumentError("invalid address","address",t);return e}function hb(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var gx={},Mr={},Ep=Sre;function Sre(t,e){if(!t)throw new Error(e||"Assertion failed")}Sre.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var bT={exports:{}};typeof Object.create=="function"?bT.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:bT.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var aC=bT.exports,oRe=Ep,aRe=aC;Mr.inherits=aRe;function cRe(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function lRe(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):cRe(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Mr.htonl=_re;function uRe(t,e){for(var r="",n=0;n>>0}return s}Mr.join32=dRe;function hRe(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Mr.split32=hRe;function pRe(t,e){return t>>>e|t<<32-e}Mr.rotr32=pRe;function vRe(t,e){return t<>>32-e}Mr.rotl32=vRe;function gRe(t,e){return t+e>>>0}Mr.sum32=gRe;function yRe(t,e,r){return t+e+r>>>0}Mr.sum32_3=yRe;function mRe(t,e,r,n){return t+e+r+n>>>0}Mr.sum32_4=mRe;function bRe(t,e,r,n,i){return t+e+r+n+i>>>0}Mr.sum32_5=bRe;function wRe(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}Mr.sum64=wRe;function xRe(t,e,r,n){var i=e+n>>>0,s=(i>>0}Mr.sum64_hi=xRe;function ERe(t,e,r,n){var i=e+n;return i>>>0}Mr.sum64_lo=ERe;function CRe(t,e,r,n,i,s,o,a){var c=0,l=e;l=l+n>>>0,c+=l>>0,c+=l>>0,c+=l>>0}Mr.sum64_4_hi=CRe;function ARe(t,e,r,n,i,s,o,a){var c=e+n+s+a;return c>>>0}Mr.sum64_4_lo=ARe;function SRe(t,e,r,n,i,s,o,a,c,l){var f=0,u=e;u=u+n>>>0,f+=u>>0,f+=u>>0,f+=u>>0,f+=u>>0}Mr.sum64_5_hi=SRe;function _Re(t,e,r,n,i,s,o,a,c,l){var f=e+n+s+a+l;return f>>>0}Mr.sum64_5_lo=_Re;function IRe(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Mr.rotr64_hi=IRe;function TRe(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Mr.rotr64_lo=TRe;function PRe(t,e,r){return t>>>r}Mr.shr64_hi=PRe;function kRe(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Mr.shr64_lo=kRe;var vm={},F$=Mr,RRe=Ep;function cC(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}vm.BlockHash=cC;cC.prototype.update=function(e,r){if(e=F$.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=F$.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}hf.g0_256=BRe;function LRe(t){return Kl(t,17)^Kl(t,19)^t>>>10}hf.g1_256=LRe;var jy=Mr,FRe=vm,jRe=hf,WS=jy.rotl32,pb=jy.sum32,URe=jy.sum32_5,$Re=jRe.ft_1,Mre=FRe.BlockHash,qRe=[1518500249,1859775393,2400959708,3395469782];function sf(){if(!(this instanceof sf))return new sf;Mre.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}jy.inherits(sf,Mre);var VRe=sf;sf.blockSize=512;sf.outSize=160;sf.hmacStrength=80;sf.padLength=64;sf.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),kMe(e.length<=this.blockSize);for(var r=e.length;r>8,h=f&255;u?c.push(u,h):c.push(h)}return c}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",c=0;c(h>>1)-1?m=(h>>1)-S:m=S,g.isubn(m)):m=0,u[y]=m,g.iushrn(1)}return u}r.getNAF=n;function i(c,l){var f=[[],[]];c=c.clone(),l=l.clone();for(var u=0,h=0,g;c.cmpn(-u)>0||l.cmpn(-h)>0;){var y=c.andln(3)+u&3,m=l.andln(3)+h&3;y===3&&(y=-1),m===3&&(m=-1);var S;y&1?(g=c.andln(7)+u&7,(g===3||g===5)&&m===2?S=-y:S=y):S=0,f[0].push(S);var E;m&1?(g=l.andln(7)+h&7,(g===3||g===5)&&y===2?E=-m:E=m):E=0,f[1].push(E),2*u===S+1&&(u=1-u),2*h===E+1&&(h=1-h),c.iushrn(1),l.iushrn(1)}return f}r.getJSF=i;function s(c,l,f){var u="_"+l;c.prototype[l]=function(){return this[u]!==void 0?this[u]:this[u]=f.call(this)}}r.cachedProperty=s;function o(c){return typeof c=="string"?r.toArray(c,"hex"):c}r.parseBytes=o;function a(c){return new ar(c,"hex","le")}r.intFromLE=a}),Y4=xa.getNAF,OMe=xa.getJSF,Q4=xa.assert;function Zh(t,e){this.type=t,this.p=new ar(e.p,16),this.red=e.prime?ar.red(e.prime):ar.mont(this.p),this.zero=new ar(0).toRed(this.red),this.one=new ar(1).toRed(this.red),this.two=new ar(2).toRed(this.red),this.n=e.n&&new ar(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Cp=Zh;Zh.prototype.point=function(){throw new Error("Not implemented")};Zh.prototype.validate=function(){throw new Error("Not implemented")};Zh.prototype._fixedNafMul=function(e,r){Q4(e.precomputed);var n=e._getDoubles(),i=Y4(r,1,this._bitLength),s=(1<=a;l--)c=(c<<1)+i[l];o.push(c)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),h=s;h>0;h--){for(a=0;a=0;c--){for(var l=0;c>=0&&o[c]===0;c--)l++;if(c>=0&&l++,a=a.dblp(l),c<0)break;var f=o[c];Q4(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};Zh.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,c=this._wnafT3,l=0,f,u,h;for(f=0;f=1;f-=2){var y=f-1,m=f;if(o[y]!==1||o[m]!==1){c[y]=Y4(n[y],o[y],this._bitLength),c[m]=Y4(n[m],o[m],this._bitLength),l=Math.max(c[y].length,l),l=Math.max(c[m].length,l);continue}var S=[r[y],null,null,r[m]];r[y].y.cmp(r[m].y)===0?(S[1]=r[y].add(r[m]),S[2]=r[y].toJ().mixedAdd(r[m].neg())):r[y].y.cmp(r[m].y.redNeg())===0?(S[1]=r[y].toJ().mixedAdd(r[m]),S[2]=r[y].add(r[m].neg())):(S[1]=r[y].toJ().mixedAdd(r[m]),S[2]=r[y].toJ().mixedAdd(r[m].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],A=OMe(n[y],n[m]);for(l=Math.max(A[0].length,l),c[y]=new Array(l),c[m]=new Array(l),u=0;u=0;f--){for(var I=0;f>=0;){var U=!0;for(u=0;u=0&&I++,L=L.dblp(I),f<0)break;for(u=0;u0?h=a[u][ie-1>>1]:ie<0&&(h=a[u][-ie-1>>1].neg()),h.type==="affine"?L=L.mixedAdd(h):L=L.add(h))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};lc.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(g=l,y=f),u.negative&&(u=u.neg(),h=h.neg()),g.negative&&(g=g.neg(),y=y.neg()),[{a:u,b:h},{a:g,b:y}]};fc.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),c=o.mul(i.a),l=s.mul(n.b),f=o.mul(i.b),u=e.sub(a).sub(c),h=l.add(f).neg();return{k1:u,k2:h}};fc.prototype.pointFromX=function(e,r){e=new ar(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};fc.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};fc.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Vi.prototype.isInfinity=function(){return this.inf};Vi.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Vi.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Vi.prototype.getX=function(){return this.x.fromRed()};Vi.prototype.getY=function(){return this.y.fromRed()};Vi.prototype.mul=function(e){return e=new ar(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Vi.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Vi.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Vi.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Vi.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Vi.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function fs(t,e,r,n){Cp.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ar(0)):(this.x=new ar(e,16),this.y=new ar(r,16),this.z=new ar(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}dO(fs,Cp.BasePoint);fc.prototype.jpoint=function(e,r,n){return new fs(this,e,r,n)};fs.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};fs.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};fs.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),c=i.redSub(s),l=o.redSub(a);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),u=f.redMul(c),h=i.redMul(f),g=l.redSqr().redIAdd(u).redISub(h).redISub(h),y=l.redMul(h.redISub(g)).redISub(o.redMul(u)),m=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(g,y,m)};fs.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),c=s.redSub(o);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),f=l.redMul(a),u=n.redMul(l),h=c.redSqr().redIAdd(f).redISub(u).redISub(u),g=c.redMul(u.redISub(h)).redISub(s.redMul(f)),y=this.z.redMul(a);return this.curve.jpoint(h,g,y)};fs.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};fs.prototype.inspect=function(){return this.isInfinity()?"":""};fs.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var x5=mm(function(t,e){var r=e;r.base=Cp,r.short=NMe,r.mont=null,r.edwards=null}),E5=mm(function(t,e){var r=e,n=xa.assert;function i(a){a.type==="short"?this.curve=new x5.short(a):a.type==="edwards"?this.curve=new x5.edwards(a):this.curve=new x5.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,c){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(c);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Uf.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Uf.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Uf.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Uf.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Uf.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Uf.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Uf.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Uf.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Dh(t){if(!(this instanceof Dh))return new Dh(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Vc.toArray(t.entropy,t.entropyEnc||"hex"),r=Vc.toArray(t.nonce,t.nonceEnc||"hex"),n=Vc.toArray(t.pers,t.persEnc||"hex");uO(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var zre=Dh;Dh.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};Dh.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Vc.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var BMe=xa.assert;function lC(t,e){if(t instanceof lC)return t;this._importDER(t,e)||(BMe(t.r&&t.s,"Signature without r or s"),this.r=new ar(t.r,16),this.s=new ar(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var fC=lC;function LMe(){this.place=0}function QS(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function q$(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}lC.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=q$(r),n=q$(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];JS(i,r.length),i=i.concat(r),i.push(2),JS(i,n.length);var s=i.concat(n),o=[48];return JS(o,s.length),o=o.concat(s),xa.encode(o,e)};var FMe=function(){throw new Error("unsupported")},Hre=xa.assert;function ac(t){if(!(this instanceof ac))return new ac(t);typeof t=="string"&&(Hre(Object.prototype.hasOwnProperty.call(E5,t),"Unknown curve "+t),t=E5[t]),t instanceof E5.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var jMe=ac;ac.prototype.keyPair=function(e){return new hO(this,e)};ac.prototype.keyFromPrivate=function(e,r){return hO.fromPrivate(this,e,r)};ac.prototype.keyFromPublic=function(e,r){return hO.fromPublic(this,e,r)};ac.prototype.genKeyPair=function(e){e||(e={});for(var r=new zre({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||FMe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ar(2));;){var s=new ar(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};ac.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};ac.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ar(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),c=new zre({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new ar(1)),f=0;;f++){var u=i.k?i.k(f):new ar(c.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(l)>=0)){var h=this.g.mul(u);if(!h.isInfinity()){var g=h.getX(),y=g.umod(this.n);if(y.cmpn(0)!==0){var m=u.invm(this.n).mul(y.mul(r.getPrivate()).iadd(e));if(m=m.umod(this.n),m.cmpn(0)!==0){var S=(h.getY().isOdd()?1:0)|(g.cmp(y)!==0?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),S^=1),new fC({r:y,s:m,recoveryParam:S})}}}}}};ac.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ar(e,16)),n=this.keyFromPublic(n,i),r=new fC(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),c=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(c,n.getPublic(),l),f.isInfinity()?!1:f.eqXToP(s)):(f=this.g.mulAdd(c,n.getPublic(),l),f.isInfinity()?!1:f.getX().umod(this.n).cmp(s)===0)};ac.prototype.recoverPubKey=function(t,e,r,n){Hre((3&r)===r,"The recovery param is more than two bits"),e=new fC(e,n);var i=this.n,s=new ar(t),o=e.r,a=e.s,c=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),c):o=this.curve.pointFromX(o,c);var f=e.r.invm(i),u=i.sub(s).mul(f).umod(i),h=a.mul(f).umod(i);return this.g.mulAdd(u,o,h)};ac.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new fC(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var UMe=mm(function(t,e){var r=e;r.version="6.5.4",r.utils=xa,r.rand=function(){throw new Error("unsupported")},r.curve=x5,r.curves=E5,r.ec=jMe,r.eddsa=null}),$Me=UMe.ec;const qMe="signing-key/5.7.0",CT=new Cn(qMe);let ZS=null;function _d(){return ZS||(ZS=new $Me("secp256k1")),ZS}class VMe{constructor(e){hb(this,"curve","secp256k1"),hb(this,"privateKey",ra(e)),Gke(this.privateKey)!==32&&CT.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=_d().keyFromPrivate(ui(this.privateKey));hb(this,"publicKey","0x"+r.getPublic(!1,"hex")),hb(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),hb(this,"_isSigningKey",!0)}_addPoint(e){const r=_d().keyFromPublic(ui(this.publicKey)),n=_d().keyFromPublic(ui(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=_d().keyFromPrivate(ui(this.privateKey)),n=ui(e);n.length!==32&&CT.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Cre({recoveryParam:i.recoveryParam,r:wg("0x"+i.r.toString(16),32),s:wg("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=_d().keyFromPrivate(ui(this.privateKey)),n=_d().keyFromPublic(ui(Gre(e)));return wg("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function zMe(t,e){const r=Cre(e),n={r:ui(r.r),s:ui(r.s)};return"0x"+_d().recoverPubKey(ui(t),n,r.recoveryParam).encode("hex",!1)}function Gre(t,e){const r=ui(t);return r.length===32?new VMe(r).publicKey:r.length===33?"0x"+_d().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?ra(r):CT.throwArgumentError("invalid public or private key","key","[REDACTED]")}var V$;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(V$||(V$={}));function HMe(t){const e=Gre(t);return sRe(D$(cO(D$(e,1)),12))}function GMe(t,e){return HMe(zMe(ui(t),e))}var pO={},uC={},ur={},Wre={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,c){var l=a>>>16&65535,f=a&65535,u=c>>>16&65535,h=c&65535;return f*h+(l*h+f*u<<16>>>0)|0}t.mul=Math.imul||e;function r(a,c){return a+c|0}t.add=r;function n(a,c){return a-c|0}t.sub=n;function i(a,c){return a<>>32-c}t.rotl=i;function s(a,c){return a<<32-c|a>>>c}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Wre);Object.defineProperty(ur,"__esModule",{value:!0});var Kre=Wre;function WMe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}ur.readInt16BE=WMe;function KMe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}ur.readUint16BE=KMe;function YMe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}ur.readInt16LE=YMe;function QMe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}ur.readUint16LE=QMe;function Yre(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}ur.writeUint16BE=Yre;ur.writeInt16BE=Yre;function Qre(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}ur.writeUint16LE=Qre;ur.writeInt16LE=Qre;function AT(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}ur.readInt32BE=AT;function ST(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}ur.readUint32BE=ST;function _T(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}ur.readInt32LE=_T;function IT(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}ur.readUint32LE=IT;function J4(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}ur.writeUint32BE=J4;ur.writeInt32BE=J4;function Z4(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}ur.writeUint32LE=Z4;ur.writeInt32LE=Z4;function JMe(t,e){e===void 0&&(e=0);var r=AT(t,e),n=AT(t,e+4);return r*4294967296+n-(n>>31)*4294967296}ur.readInt64BE=JMe;function ZMe(t,e){e===void 0&&(e=0);var r=ST(t,e),n=ST(t,e+4);return r*4294967296+n}ur.readUint64BE=ZMe;function XMe(t,e){e===void 0&&(e=0);var r=_T(t,e),n=_T(t,e+4);return n*4294967296+r-(r>>31)*4294967296}ur.readInt64LE=XMe;function eOe(t,e){e===void 0&&(e=0);var r=IT(t,e),n=IT(t,e+4);return n*4294967296+r}ur.readUint64LE=eOe;function Jre(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),J4(t/4294967296>>>0,e,r),J4(t>>>0,e,r+4),e}ur.writeUint64BE=Jre;ur.writeInt64BE=Jre;function Zre(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Z4(t>>>0,e,r),Z4(t/4294967296>>>0,e,r+4),e}ur.writeUint64LE=Zre;ur.writeInt64LE=Zre;function tOe(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}ur.readUintBE=tOe;function rOe(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}ur.writeUintBE=nOe;function iOe(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Kre.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s>>16|b<<16,K=K+b|0,I^=K,I=I>>>20|I<<12,N=N+U|0,M^=N,M=M>>>16|M<<16,R=R+M|0,U^=R,U=U>>>20|U<<12,L=L+ie|0,B^=L,B=B>>>16|B<<16,D=D+B|0,ie^=D,ie=ie>>>20|ie<<12,V=V+ae|0,x^=V,x=x>>>16|x<<16,v=v+x|0,ae^=v,ae=ae>>>20|ae<<12,L=L+ie|0,B^=L,B=B>>>24|B<<8,D=D+B|0,ie^=D,ie=ie>>>25|ie<<7,V=V+ae|0,x^=V,x=x>>>24|x<<8,v=v+x|0,ae^=v,ae=ae>>>25|ae<<7,N=N+U|0,M^=N,M=M>>>24|M<<8,R=R+M|0,U^=R,U=U>>>25|U<<7,P=P+I|0,b^=P,b=b>>>24|b<<8,K=K+b|0,I^=K,I=I>>>25|I<<7,P=P+U|0,x^=P,x=x>>>16|x<<16,D=D+x|0,U^=D,U=U>>>20|U<<12,N=N+ie|0,b^=N,b=b>>>16|b<<16,v=v+b|0,ie^=v,ie=ie>>>20|ie<<12,L=L+ae|0,M^=L,M=M>>>16|M<<16,K=K+M|0,ae^=K,ae=ae>>>20|ae<<12,V=V+I|0,B^=V,B=B>>>16|B<<16,R=R+B|0,I^=R,I=I>>>20|I<<12,L=L+ae|0,M^=L,M=M>>>24|M<<8,K=K+M|0,ae^=K,ae=ae>>>25|ae<<7,V=V+I|0,B^=V,B=B>>>24|B<<8,R=R+B|0,I^=R,I=I>>>25|I<<7,N=N+ie|0,b^=N,b=b>>>24|b<<8,v=v+b|0,ie^=v,ie=ie>>>25|ie<<7,P=P+U|0,x^=P,x=x>>>24|x<<8,D=D+x|0,U^=D,U=U>>>25|U<<7;Cs.writeUint32LE(P+n|0,t,0),Cs.writeUint32LE(N+i|0,t,4),Cs.writeUint32LE(L+s|0,t,8),Cs.writeUint32LE(V+o|0,t,12),Cs.writeUint32LE(I+a|0,t,16),Cs.writeUint32LE(U+c|0,t,20),Cs.writeUint32LE(ie+l|0,t,24),Cs.writeUint32LE(ae+f|0,t,28),Cs.writeUint32LE(K+u|0,t,32),Cs.writeUint32LE(R+h|0,t,36),Cs.writeUint32LE(D+g|0,t,40),Cs.writeUint32LE(v+y|0,t,44),Cs.writeUint32LE(b+m|0,t,48),Cs.writeUint32LE(M+S|0,t,52),Cs.writeUint32LE(B+E|0,t,56),Cs.writeUint32LE(x+A|0,t,60)}function Xre(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var ene={},Xh={};Object.defineProperty(Xh,"__esModule",{value:!0});function mOe(t,e,r){return~(t-1)&e|t-1&r}Xh.select=mOe;function bOe(t,e){return(t|0)-(e|0)-1>>>31&1}Xh.lessOrEqual=bOe;function tne(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Xh.compare=tne;function wOe(t,e){return t.length===0||e.length===0?!1:tne(t,e)!==0}Xh.equal=wOe;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Xh,r=Ea;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=a[0]|a[1]<<8;this._r[0]=c&8191;var l=a[2]|a[3]<<8;this._r[1]=(c>>>13|l<<3)&8191;var f=a[4]|a[5]<<8;this._r[2]=(l>>>10|f<<6)&7939;var u=a[6]|a[7]<<8;this._r[3]=(f>>>7|u<<9)&8191;var h=a[8]|a[9]<<8;this._r[4]=(u>>>4|h<<12)&255,this._r[5]=h>>>1&8190;var g=a[10]|a[11]<<8;this._r[6]=(h>>>14|g<<2)&8191;var y=a[12]|a[13]<<8;this._r[7]=(g>>>11|y<<5)&8065;var m=a[14]|a[15]<<8;this._r[8]=(y>>>8|m<<8)&8191,this._r[9]=m>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,c,l){for(var f=this._fin?0:2048,u=this._h[0],h=this._h[1],g=this._h[2],y=this._h[3],m=this._h[4],S=this._h[5],E=this._h[6],A=this._h[7],P=this._h[8],N=this._h[9],L=this._r[0],V=this._r[1],I=this._r[2],U=this._r[3],ie=this._r[4],ae=this._r[5],K=this._r[6],R=this._r[7],D=this._r[8],v=this._r[9];l>=16;){var b=a[c+0]|a[c+1]<<8;u+=b&8191;var M=a[c+2]|a[c+3]<<8;h+=(b>>>13|M<<3)&8191;var B=a[c+4]|a[c+5]<<8;g+=(M>>>10|B<<6)&8191;var x=a[c+6]|a[c+7]<<8;y+=(B>>>7|x<<9)&8191;var C=a[c+8]|a[c+9]<<8;m+=(x>>>4|C<<12)&8191,S+=C>>>1&8191;var w=a[c+10]|a[c+11]<<8;E+=(C>>>14|w<<2)&8191;var k=a[c+12]|a[c+13]<<8;A+=(w>>>11|k<<5)&8191;var O=a[c+14]|a[c+15]<<8;P+=(k>>>8|O<<8)&8191,N+=O>>>5|f;var G=0,oe=G;oe+=u*L,oe+=h*(5*v),oe+=g*(5*D),oe+=y*(5*R),oe+=m*(5*K),G=oe>>>13,oe&=8191,oe+=S*(5*ae),oe+=E*(5*ie),oe+=A*(5*U),oe+=P*(5*I),oe+=N*(5*V),G+=oe>>>13,oe&=8191;var $=G;$+=u*V,$+=h*L,$+=g*(5*v),$+=y*(5*D),$+=m*(5*R),G=$>>>13,$&=8191,$+=S*(5*K),$+=E*(5*ae),$+=A*(5*ie),$+=P*(5*U),$+=N*(5*I),G+=$>>>13,$&=8191;var X=G;X+=u*I,X+=h*V,X+=g*L,X+=y*(5*v),X+=m*(5*D),G=X>>>13,X&=8191,X+=S*(5*R),X+=E*(5*K),X+=A*(5*ae),X+=P*(5*ie),X+=N*(5*U),G+=X>>>13,X&=8191;var W=G;W+=u*U,W+=h*I,W+=g*V,W+=y*L,W+=m*(5*v),G=W>>>13,W&=8191,W+=S*(5*D),W+=E*(5*R),W+=A*(5*K),W+=P*(5*ae),W+=N*(5*ie),G+=W>>>13,W&=8191;var Z=G;Z+=u*ie,Z+=h*U,Z+=g*I,Z+=y*V,Z+=m*L,G=Z>>>13,Z&=8191,Z+=S*(5*v),Z+=E*(5*D),Z+=A*(5*R),Z+=P*(5*K),Z+=N*(5*ae),G+=Z>>>13,Z&=8191;var te=G;te+=u*ae,te+=h*ie,te+=g*U,te+=y*I,te+=m*V,G=te>>>13,te&=8191,te+=S*L,te+=E*(5*v),te+=A*(5*D),te+=P*(5*R),te+=N*(5*K),G+=te>>>13,te&=8191;var F=G;F+=u*K,F+=h*ae,F+=g*ie,F+=y*U,F+=m*I,G=F>>>13,F&=8191,F+=S*V,F+=E*L,F+=A*(5*v),F+=P*(5*D),F+=N*(5*R),G+=F>>>13,F&=8191;var ee=G;ee+=u*R,ee+=h*K,ee+=g*ae,ee+=y*ie,ee+=m*U,G=ee>>>13,ee&=8191,ee+=S*I,ee+=E*V,ee+=A*L,ee+=P*(5*v),ee+=N*(5*D),G+=ee>>>13,ee&=8191;var fe=G;fe+=u*D,fe+=h*R,fe+=g*K,fe+=y*ae,fe+=m*ie,G=fe>>>13,fe&=8191,fe+=S*U,fe+=E*I,fe+=A*V,fe+=P*L,fe+=N*(5*v),G+=fe>>>13,fe&=8191;var xe=G;xe+=u*v,xe+=h*D,xe+=g*R,xe+=y*K,xe+=m*ae,G=xe>>>13,xe&=8191,xe+=S*ie,xe+=E*U,xe+=A*I,xe+=P*V,xe+=N*L,G+=xe>>>13,xe&=8191,G=(G<<2)+G|0,G=G+oe|0,oe=G&8191,G=G>>>13,$+=G,u=oe,h=$,g=X,y=W,m=Z,S=te,E=F,A=ee,P=fe,N=xe,c+=16,l-=16}this._h[0]=u,this._h[1]=h,this._h[2]=g,this._h[3]=y,this._h[4]=m,this._h[5]=S,this._h[6]=E,this._h[7]=A,this._h[8]=P,this._h[9]=N},o.prototype.finish=function(a,c){c===void 0&&(c=0);var l=new Uint16Array(10),f,u,h,g;if(this._leftover){for(g=this._leftover,this._buffer[g++]=1;g<16;g++)this._buffer[g]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(f=this._h[1]>>>13,this._h[1]&=8191,g=2;g<10;g++)this._h[g]+=f,f=this._h[g]>>>13,this._h[g]&=8191;for(this._h[0]+=f*5,f=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=f,f=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=f,l[0]=this._h[0]+5,f=l[0]>>>13,l[0]&=8191,g=1;g<10;g++)l[g]=this._h[g]+f,f=l[g]>>>13,l[g]&=8191;for(l[9]-=8192,u=(f^1)-1,g=0;g<10;g++)l[g]&=u;for(u=~u,g=0;g<10;g++)this._h[g]=this._h[g]&u|l[g];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,h=this._h[0]+this._pad[0],this._h[0]=h&65535,g=1;g<8;g++)h=(this._h[g]+this._pad[g]|0)+(h>>>16)|0,this._h[g]=h&65535;return a[c+0]=this._h[0]>>>0,a[c+1]=this._h[0]>>>8,a[c+2]=this._h[1]>>>0,a[c+3]=this._h[1]>>>8,a[c+4]=this._h[2]>>>0,a[c+5]=this._h[2]>>>8,a[c+6]=this._h[3]>>>0,a[c+7]=this._h[3]>>>8,a[c+8]=this._h[4]>>>0,a[c+9]=this._h[4]>>>8,a[c+10]=this._h[5]>>>0,a[c+11]=this._h[5]>>>8,a[c+12]=this._h[6]>>>0,a[c+13]=this._h[6]>>>8,a[c+14]=this._h[7]>>>0,a[c+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var c=0,l=a.length,f;if(this._leftover){f=16-this._leftover,f>l&&(f=l);for(var u=0;u=16&&(f=l-l%16,this._blocks(a,c,f),c+=f,l-=f),l){for(var u=0;u16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var g=new Uint8Array(16);g.set(l,g.length-l.length);var y=new Uint8Array(32);e.stream(this._key,g,y,4);var m=f.length+this.tagLength,S;if(h){if(h.length!==m)throw new Error("ChaCha20Poly1305: incorrect destination length");S=h}else S=new Uint8Array(m);return e.streamXOR(this._key,g,f,S,4),this._authenticate(S.subarray(S.length-this.tagLength,S.length),y,S.subarray(0,S.length-this.tagLength),u),n.wipe(g),S},c.prototype.open=function(l,f,u,h){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(f.length0&&g.update(o.subarray(h.length%16))),g.update(u),u.length%16>0&&g.update(o.subarray(u.length%16));var y=new Uint8Array(8);h&&i.writeUint64LE(h.length,y),g.update(y),i.writeUint64LE(u.length,y),g.update(y);for(var m=g.digest(),S=0;Sthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n256)throw new Error("randomString charset is too long");let h="";const g=f.length,y=256-256%g;for(;l>0;){const m=i(Math.ceil(l*256/y),u);for(let S=0;S0;S++){const E=m[S];E0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=c[f++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(f=s(this._temp,this._state,c,f,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=c[f++],l--;return this},a.prototype.finish=function(c){if(!this._finished){var l=this._bytesHashed,f=this._bufferLength,u=l/536870912|0,h=l<<3,g=l%64<56?64:128;this._buffer[f]=128;for(var y=f+1;y0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(c){r.wipe(c.state),c.buffer&&r.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([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]);function s(a,c,l,f,u){for(;u>=64;){for(var h=c[0],g=c[1],y=c[2],m=c[3],S=c[4],E=c[5],A=c[6],P=c[7],N=0;N<16;N++){var L=f+N*4;a[N]=e.readUint32BE(l,L)}for(var N=16;N<64;N++){var V=a[N-2],I=(V>>>17|V<<15)^(V>>>19|V<<13)^V>>>10;V=a[N-15];var U=(V>>>7|V<<25)^(V>>>18|V<<14)^V>>>3;a[N]=(I+a[N-7]|0)+(U+a[N-16]|0)}for(var N=0;N<64;N++){var I=(((S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7))+(S&E^~S&A)|0)+(P+(i[N]+a[N]|0)|0)|0,U=((h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10))+(h&g^h&y^g&y)|0;P=A,A=E,E=S,S=m+I|0,m=y,y=g,g=h,h=I+U|0}c[0]+=h,c[1]+=g,c[2]+=y,c[3]+=m,c[4]+=S,c[5]+=E,c[6]+=A,c[7]+=P,f+=64,u-=64}return f}function o(a){var c=new n;c.update(a);var l=c.digest();return c.clean(),l}t.hash=o})(mx);var gO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=e0,r=Ea;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(N){const L=new Float64Array(16);if(N)for(let V=0;V>16&1),V[ae-1]&=65535;V[15]=I[15]-32767-(V[14]>>16&1);const ie=V[15]>>16&1;V[14]&=65535,a(I,V,1-ie)}for(let U=0;U<16;U++)N[2*U]=I[U]&255,N[2*U+1]=I[U]>>8}function l(N,L){for(let V=0;V<16;V++)N[V]=L[2*V]+(L[2*V+1]<<8);N[15]&=32767}function f(N,L,V){for(let I=0;I<16;I++)N[I]=L[I]+V[I]}function u(N,L,V){for(let I=0;I<16;I++)N[I]=L[I]-V[I]}function h(N,L,V){let I,U,ie=0,ae=0,K=0,R=0,D=0,v=0,b=0,M=0,B=0,x=0,C=0,w=0,k=0,O=0,G=0,oe=0,$=0,X=0,W=0,Z=0,te=0,F=0,ee=0,fe=0,xe=0,_e=0,Me=0,Ke=0,ze=0,Je=0,Xe=0,lt=V[0],Re=V[1],$e=V[2],st=V[3],Qe=V[4],ct=V[5],tt=V[6],He=V[7],at=V[8],pt=V[9],Ge=V[10],vt=V[11],bt=V[12],Ze=V[13],_t=V[14],Ct=V[15];I=L[0],ie+=I*lt,ae+=I*Re,K+=I*$e,R+=I*st,D+=I*Qe,v+=I*ct,b+=I*tt,M+=I*He,B+=I*at,x+=I*pt,C+=I*Ge,w+=I*vt,k+=I*bt,O+=I*Ze,G+=I*_t,oe+=I*Ct,I=L[1],ae+=I*lt,K+=I*Re,R+=I*$e,D+=I*st,v+=I*Qe,b+=I*ct,M+=I*tt,B+=I*He,x+=I*at,C+=I*pt,w+=I*Ge,k+=I*vt,O+=I*bt,G+=I*Ze,oe+=I*_t,$+=I*Ct,I=L[2],K+=I*lt,R+=I*Re,D+=I*$e,v+=I*st,b+=I*Qe,M+=I*ct,B+=I*tt,x+=I*He,C+=I*at,w+=I*pt,k+=I*Ge,O+=I*vt,G+=I*bt,oe+=I*Ze,$+=I*_t,X+=I*Ct,I=L[3],R+=I*lt,D+=I*Re,v+=I*$e,b+=I*st,M+=I*Qe,B+=I*ct,x+=I*tt,C+=I*He,w+=I*at,k+=I*pt,O+=I*Ge,G+=I*vt,oe+=I*bt,$+=I*Ze,X+=I*_t,W+=I*Ct,I=L[4],D+=I*lt,v+=I*Re,b+=I*$e,M+=I*st,B+=I*Qe,x+=I*ct,C+=I*tt,w+=I*He,k+=I*at,O+=I*pt,G+=I*Ge,oe+=I*vt,$+=I*bt,X+=I*Ze,W+=I*_t,Z+=I*Ct,I=L[5],v+=I*lt,b+=I*Re,M+=I*$e,B+=I*st,x+=I*Qe,C+=I*ct,w+=I*tt,k+=I*He,O+=I*at,G+=I*pt,oe+=I*Ge,$+=I*vt,X+=I*bt,W+=I*Ze,Z+=I*_t,te+=I*Ct,I=L[6],b+=I*lt,M+=I*Re,B+=I*$e,x+=I*st,C+=I*Qe,w+=I*ct,k+=I*tt,O+=I*He,G+=I*at,oe+=I*pt,$+=I*Ge,X+=I*vt,W+=I*bt,Z+=I*Ze,te+=I*_t,F+=I*Ct,I=L[7],M+=I*lt,B+=I*Re,x+=I*$e,C+=I*st,w+=I*Qe,k+=I*ct,O+=I*tt,G+=I*He,oe+=I*at,$+=I*pt,X+=I*Ge,W+=I*vt,Z+=I*bt,te+=I*Ze,F+=I*_t,ee+=I*Ct,I=L[8],B+=I*lt,x+=I*Re,C+=I*$e,w+=I*st,k+=I*Qe,O+=I*ct,G+=I*tt,oe+=I*He,$+=I*at,X+=I*pt,W+=I*Ge,Z+=I*vt,te+=I*bt,F+=I*Ze,ee+=I*_t,fe+=I*Ct,I=L[9],x+=I*lt,C+=I*Re,w+=I*$e,k+=I*st,O+=I*Qe,G+=I*ct,oe+=I*tt,$+=I*He,X+=I*at,W+=I*pt,Z+=I*Ge,te+=I*vt,F+=I*bt,ee+=I*Ze,fe+=I*_t,xe+=I*Ct,I=L[10],C+=I*lt,w+=I*Re,k+=I*$e,O+=I*st,G+=I*Qe,oe+=I*ct,$+=I*tt,X+=I*He,W+=I*at,Z+=I*pt,te+=I*Ge,F+=I*vt,ee+=I*bt,fe+=I*Ze,xe+=I*_t,_e+=I*Ct,I=L[11],w+=I*lt,k+=I*Re,O+=I*$e,G+=I*st,oe+=I*Qe,$+=I*ct,X+=I*tt,W+=I*He,Z+=I*at,te+=I*pt,F+=I*Ge,ee+=I*vt,fe+=I*bt,xe+=I*Ze,_e+=I*_t,Me+=I*Ct,I=L[12],k+=I*lt,O+=I*Re,G+=I*$e,oe+=I*st,$+=I*Qe,X+=I*ct,W+=I*tt,Z+=I*He,te+=I*at,F+=I*pt,ee+=I*Ge,fe+=I*vt,xe+=I*bt,_e+=I*Ze,Me+=I*_t,Ke+=I*Ct,I=L[13],O+=I*lt,G+=I*Re,oe+=I*$e,$+=I*st,X+=I*Qe,W+=I*ct,Z+=I*tt,te+=I*He,F+=I*at,ee+=I*pt,fe+=I*Ge,xe+=I*vt,_e+=I*bt,Me+=I*Ze,Ke+=I*_t,ze+=I*Ct,I=L[14],G+=I*lt,oe+=I*Re,$+=I*$e,X+=I*st,W+=I*Qe,Z+=I*ct,te+=I*tt,F+=I*He,ee+=I*at,fe+=I*pt,xe+=I*Ge,_e+=I*vt,Me+=I*bt,Ke+=I*Ze,ze+=I*_t,Je+=I*Ct,I=L[15],oe+=I*lt,$+=I*Re,X+=I*$e,W+=I*st,Z+=I*Qe,te+=I*ct,F+=I*tt,ee+=I*He,fe+=I*at,xe+=I*pt,_e+=I*Ge,Me+=I*vt,Ke+=I*bt,ze+=I*Ze,Je+=I*_t,Xe+=I*Ct,ie+=38*$,ae+=38*X,K+=38*W,R+=38*Z,D+=38*te,v+=38*F,b+=38*ee,M+=38*fe,B+=38*xe,x+=38*_e,C+=38*Me,w+=38*Ke,k+=38*ze,O+=38*Je,G+=38*Xe,U=1,I=ie+U+65535,U=Math.floor(I/65536),ie=I-U*65536,I=ae+U+65535,U=Math.floor(I/65536),ae=I-U*65536,I=K+U+65535,U=Math.floor(I/65536),K=I-U*65536,I=R+U+65535,U=Math.floor(I/65536),R=I-U*65536,I=D+U+65535,U=Math.floor(I/65536),D=I-U*65536,I=v+U+65535,U=Math.floor(I/65536),v=I-U*65536,I=b+U+65535,U=Math.floor(I/65536),b=I-U*65536,I=M+U+65535,U=Math.floor(I/65536),M=I-U*65536,I=B+U+65535,U=Math.floor(I/65536),B=I-U*65536,I=x+U+65535,U=Math.floor(I/65536),x=I-U*65536,I=C+U+65535,U=Math.floor(I/65536),C=I-U*65536,I=w+U+65535,U=Math.floor(I/65536),w=I-U*65536,I=k+U+65535,U=Math.floor(I/65536),k=I-U*65536,I=O+U+65535,U=Math.floor(I/65536),O=I-U*65536,I=G+U+65535,U=Math.floor(I/65536),G=I-U*65536,I=oe+U+65535,U=Math.floor(I/65536),oe=I-U*65536,ie+=U-1+37*(U-1),U=1,I=ie+U+65535,U=Math.floor(I/65536),ie=I-U*65536,I=ae+U+65535,U=Math.floor(I/65536),ae=I-U*65536,I=K+U+65535,U=Math.floor(I/65536),K=I-U*65536,I=R+U+65535,U=Math.floor(I/65536),R=I-U*65536,I=D+U+65535,U=Math.floor(I/65536),D=I-U*65536,I=v+U+65535,U=Math.floor(I/65536),v=I-U*65536,I=b+U+65535,U=Math.floor(I/65536),b=I-U*65536,I=M+U+65535,U=Math.floor(I/65536),M=I-U*65536,I=B+U+65535,U=Math.floor(I/65536),B=I-U*65536,I=x+U+65535,U=Math.floor(I/65536),x=I-U*65536,I=C+U+65535,U=Math.floor(I/65536),C=I-U*65536,I=w+U+65535,U=Math.floor(I/65536),w=I-U*65536,I=k+U+65535,U=Math.floor(I/65536),k=I-U*65536,I=O+U+65535,U=Math.floor(I/65536),O=I-U*65536,I=G+U+65535,U=Math.floor(I/65536),G=I-U*65536,I=oe+U+65535,U=Math.floor(I/65536),oe=I-U*65536,ie+=U-1+37*(U-1),N[0]=ie,N[1]=ae,N[2]=K,N[3]=R,N[4]=D,N[5]=v,N[6]=b,N[7]=M,N[8]=B,N[9]=x,N[10]=C,N[11]=w,N[12]=k,N[13]=O,N[14]=G,N[15]=oe}function g(N,L){h(N,L,L)}function y(N,L){const V=n();for(let I=0;I<16;I++)V[I]=L[I];for(let I=253;I>=0;I--)g(V,V),I!==2&&I!==4&&h(V,V,L);for(let I=0;I<16;I++)N[I]=V[I]}function m(N,L){const V=new Uint8Array(32),I=new Float64Array(80),U=n(),ie=n(),ae=n(),K=n(),R=n(),D=n();for(let B=0;B<31;B++)V[B]=N[B];V[31]=N[31]&127|64,V[0]&=248,l(I,L);for(let B=0;B<16;B++)ie[B]=I[B];U[0]=K[0]=1;for(let B=254;B>=0;--B){const x=V[B>>>3]>>>(B&7)&1;a(U,ie,x),a(ae,K,x),f(R,U,ae),u(U,U,ae),f(ae,ie,K),u(ie,ie,K),g(K,R),g(D,U),h(U,ae,U),h(ae,ie,R),f(R,U,ae),u(U,U,ae),g(ie,U),u(ae,K,D),h(U,ae,s),f(U,U,K),h(ae,ae,U),h(U,K,D),h(K,ie,I),g(ie,R),a(U,ie,x),a(ae,K,x)}for(let B=0;B<16;B++)I[B+16]=U[B],I[B+32]=ae[B],I[B+48]=ie[B],I[B+64]=K[B];const v=I.subarray(32),b=I.subarray(16);y(v,v),h(b,b,v);const M=new Uint8Array(32);return c(M,b),M}t.scalarMult=m;function S(N){return m(N,i)}t.scalarMultBase=S;function E(N){if(N.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const L=new Uint8Array(N);return{publicKey:S(L),secretKey:L}}t.generateKeyPairFromSeed=E;function A(N){const L=(0,e.randomBytes)(32,N),V=E(L);return(0,r.wipe)(L),V}t.generateKeyPair=A;function P(N,L,V=!1){if(N.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(L.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const I=m(N,L);if(V){let U=0;for(let ie=0;iei+s.length,0));const r=ine(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function DOe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,N=new Uint8Array(P);E!==A;){for(var L=y[E],V=0,I=P-1;(L!==0||V>>0,N[I]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");S=V,E++}for(var U=P-S;U!==P&&N[U]===0;)U++;for(var ie=c.repeat(m);U>>0,P=new Uint8Array(A);y[m];){var N=r[y.charCodeAt(m)];if(N===255)return;for(var L=0,V=A-1;(N!==0||L>>0,P[V]=N%256>>>0,N=N/256>>>0;if(N!==0)throw new Error("Non-zero carry");E=L,m++}if(y[m]!==" "){for(var I=A-E;I!==A&&P[I]===0;)I++;for(var U=new Uint8Array(S+(A-I)),ie=S;I!==A;)U[ie++]=P[I++];return U}}}function g(y){var m=h(y);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:h,decode:g}}var NOe=DOe,BOe=NOe;const LOe=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FOe=t=>new TextEncoder().encode(t),jOe=t=>new TextDecoder().decode(t);class UOe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class $Oe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return sne(this,e)}}class qOe{constructor(e){this.decoders=e}or(e){return sne(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const sne=(t,e)=>new qOe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class VOe{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UOe(e,r,n),this.decoder=new $Oe(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const vC=({name:t,prefix:e,encode:r,decode:n})=>new VOe(t,e,r,n),bx=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BOe(r,e);return vC({prefix:t,name:e,encode:n,decode:s=>LOe(i(s))})},zOe=(t,e,r,n)=>{const i={};for(let f=0;f=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},HOe=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<vC({prefix:e,name:t,encode(i){return HOe(i,n,r)},decode(i){return zOe(i,n,r,t)}}),GOe=vC({prefix:"\0",name:"identity",encode:t=>jOe(t),decode:t=>FOe(t)}),WOe=Object.freeze(Object.defineProperty({__proto__:null,identity:GOe},Symbol.toStringTag,{value:"Module"})),KOe=us({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),YOe=Object.freeze(Object.defineProperty({__proto__:null,base2:KOe},Symbol.toStringTag,{value:"Module"})),QOe=us({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),JOe=Object.freeze(Object.defineProperty({__proto__:null,base8:QOe},Symbol.toStringTag,{value:"Module"})),ZOe=bx({prefix:"9",name:"base10",alphabet:"0123456789"}),XOe=Object.freeze(Object.defineProperty({__proto__:null,base10:ZOe},Symbol.toStringTag,{value:"Module"})),eDe=us({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),tDe=us({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),rDe=Object.freeze(Object.defineProperty({__proto__:null,base16:eDe,base16upper:tDe},Symbol.toStringTag,{value:"Module"})),nDe=us({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),iDe=us({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sDe=us({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),oDe=us({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),aDe=us({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cDe=us({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),lDe=us({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fDe=us({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uDe=us({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dDe=Object.freeze(Object.defineProperty({__proto__:null,base32:nDe,base32hex:aDe,base32hexpad:lDe,base32hexpadupper:fDe,base32hexupper:cDe,base32pad:sDe,base32padupper:oDe,base32upper:iDe,base32z:uDe},Symbol.toStringTag,{value:"Module"})),hDe=bx({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pDe=bx({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),vDe=Object.freeze(Object.defineProperty({__proto__:null,base36:hDe,base36upper:pDe},Symbol.toStringTag,{value:"Module"})),gDe=bx({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),yDe=bx({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),mDe=Object.freeze(Object.defineProperty({__proto__:null,base58btc:gDe,base58flickr:yDe},Symbol.toStringTag,{value:"Module"})),bDe=us({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wDe=us({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xDe=us({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EDe=us({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),CDe=Object.freeze(Object.defineProperty({__proto__:null,base64:bDe,base64pad:wDe,base64url:xDe,base64urlpad:EDe},Symbol.toStringTag,{value:"Module"})),one=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),ADe=one.reduce((t,e,r)=>(t[r]=e,t),[]),SDe=one.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function _De(t){return t.reduce((e,r)=>(e+=ADe[r],e),"")}function IDe(t){const e=[];for(const r of t){const n=SDe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const TDe=vC({prefix:"🚀",name:"base256emoji",encode:_De,decode:IDe}),PDe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:TDe},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const W$={...WOe,...YOe,...JOe,...XOe,...rDe,...dDe,...vDe,...mDe,...CDe,...PDe};function ane(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const K$=ane("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),XS=ane("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=ine(t.length);for(let r=0;r",jDe="MIT",UDe={url:"https://github.com/indutny/elliptic/issues"},$De="https://github.com/indutny/elliptic",qDe={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},VDe={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},zDe={name:kDe,version:RDe,description:MDe,main:ODe,files:DDe,scripts:NDe,repository:BDe,keywords:LDe,author:FDe,license:jDe,bugs:UDe,homepage:$De,devDependencies:qDe,dependencies:VDe};var Ca={},yO={exports:{}};yO.exports;(function(t){(function(e,r){function n(K,R){if(!K)throw new Error(R||"Assertion failed")}function i(K,R){K.super_=R;var D=function(){};D.prototype=R.prototype,K.prototype=new D,K.prototype.constructor=K}function s(K,R,D){if(s.isBN(K))return K;this.negative=0,this.words=null,this.length=0,this.red=null,K!==null&&((R==="le"||R==="be")&&(D=R,R=10),this._init(K||0,R||10,D||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=oC.Buffer}catch{}s.isBN=function(R){return R instanceof s?!0:R!==null&&typeof R=="object"&&R.constructor.wordSize===s.wordSize&&Array.isArray(R.words)},s.max=function(R,D){return R.cmp(D)>0?R:D},s.min=function(R,D){return R.cmp(D)<0?R:D},s.prototype._init=function(R,D,v){if(typeof R=="number")return this._initNumber(R,D,v);if(typeof R=="object")return this._initArray(R,D,v);D==="hex"&&(D=16),n(D===(D|0)&&D>=2&&D<=36),R=R.toString().replace(/\s+/g,"");var b=0;R[0]==="-"&&(b++,this.negative=1),b=0;b-=3)B=R[b]|R[b-1]<<8|R[b-2]<<16,this.words[M]|=B<>>26-x&67108863,x+=24,x>=26&&(x-=26,M++);else if(v==="le")for(b=0,M=0;b>>26-x&67108863,x+=24,x>=26&&(x-=26,M++);return this.strip()};function a(K,R){var D=K.charCodeAt(R);return D>=65&&D<=70?D-55:D>=97&&D<=102?D-87:D-48&15}function c(K,R,D){var v=a(K,D);return D-1>=R&&(v|=a(K,D-1)<<4),v}s.prototype._parseHex=function(R,D,v){this.length=Math.ceil((R.length-D)/6),this.words=new Array(this.length);for(var b=0;b=D;b-=2)x=c(R,D,b)<=18?(M-=18,B+=1,this.words[B]|=x>>>26):M+=8;else{var C=R.length-D;for(b=C%2===0?D+1:D;b=18?(M-=18,B+=1,this.words[B]|=x>>>26):M+=8}this.strip()};function l(K,R,D,v){for(var b=0,M=Math.min(K.length,D),B=R;B=49?b+=x-49+10:x>=17?b+=x-17+10:b+=x}return b}s.prototype._parseBase=function(R,D,v){this.words=[0],this.length=1;for(var b=0,M=1;M<=67108863;M*=D)b++;b--,M=M/D|0;for(var B=R.length-v,x=B%b,C=Math.min(B,B-x)+v,w=0,k=v;k1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(R,D){R=R||10,D=D|0||1;var v;if(R===16||R==="hex"){v="";for(var b=0,M=0,B=0;B>>24-b&16777215,b+=2,b>=26&&(b-=26,B--),M!==0||B!==this.length-1?v=f[6-C.length]+C+v:v=C+v}for(M!==0&&(v=M.toString(16)+v);v.length%D!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(R===(R|0)&&R>=2&&R<=36){var w=u[R],k=h[R];v="";var O=this.clone();for(O.negative=0;!O.isZero();){var G=O.modn(k).toString(R);O=O.idivn(k),O.isZero()?v=G+v:v=f[w-G.length]+G+v}for(this.isZero()&&(v="0"+v);v.length%D!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var R=this.words[0];return this.length===2?R+=this.words[1]*67108864:this.length===3&&this.words[2]===1?R+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-R:R},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(R,D){return n(typeof o<"u"),this.toArrayLike(o,R,D)},s.prototype.toArray=function(R,D){return this.toArrayLike(Array,R,D)},s.prototype.toArrayLike=function(R,D,v){var b=this.byteLength(),M=v||Math.max(1,b);n(b<=M,"byte array longer than desired length"),n(M>0,"Requested array length <= 0"),this.strip();var B=D==="le",x=new R(M),C,w,k=this.clone();if(B){for(w=0;!k.isZero();w++)C=k.andln(255),k.iushrn(8),x[w]=C;for(;w=4096&&(v+=13,D>>>=13),D>=64&&(v+=7,D>>>=7),D>=8&&(v+=4,D>>>=4),D>=2&&(v+=2,D>>>=2),v+D},s.prototype._zeroBits=function(R){if(R===0)return 26;var D=R,v=0;return D&8191||(v+=13,D>>>=13),D&127||(v+=7,D>>>=7),D&15||(v+=4,D>>>=4),D&3||(v+=2,D>>>=2),D&1||v++,v},s.prototype.bitLength=function(){var R=this.words[this.length-1],D=this._countBits(R);return(this.length-1)*26+D};function g(K){for(var R=new Array(K.bitLength()),D=0;D>>b}return R}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var R=0,D=0;DR.length?this.clone().ior(R):R.clone().ior(this)},s.prototype.uor=function(R){return this.length>R.length?this.clone().iuor(R):R.clone().iuor(this)},s.prototype.iuand=function(R){var D;this.length>R.length?D=R:D=this;for(var v=0;vR.length?this.clone().iand(R):R.clone().iand(this)},s.prototype.uand=function(R){return this.length>R.length?this.clone().iuand(R):R.clone().iuand(this)},s.prototype.iuxor=function(R){var D,v;this.length>R.length?(D=this,v=R):(D=R,v=this);for(var b=0;bR.length?this.clone().ixor(R):R.clone().ixor(this)},s.prototype.uxor=function(R){return this.length>R.length?this.clone().iuxor(R):R.clone().iuxor(this)},s.prototype.inotn=function(R){n(typeof R=="number"&&R>=0);var D=Math.ceil(R/26)|0,v=R%26;this._expand(D),v>0&&D--;for(var b=0;b0&&(this.words[b]=~this.words[b]&67108863>>26-v),this.strip()},s.prototype.notn=function(R){return this.clone().inotn(R)},s.prototype.setn=function(R,D){n(typeof R=="number"&&R>=0);var v=R/26|0,b=R%26;return this._expand(v+1),D?this.words[v]=this.words[v]|1<R.length?(v=this,b=R):(v=R,b=this);for(var M=0,B=0;B>>26;for(;M!==0&&B>>26;if(this.length=v.length,M!==0)this.words[this.length]=M,this.length++;else if(v!==this)for(;BR.length?this.clone().iadd(R):R.clone().iadd(this)},s.prototype.isub=function(R){if(R.negative!==0){R.negative=0;var D=this.iadd(R);return R.negative=1,D._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(R),this.negative=1,this._normSign();var v=this.cmp(R);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var b,M;v>0?(b=this,M=R):(b=R,M=this);for(var B=0,x=0;x>26,this.words[x]=D&67108863;for(;B!==0&&x>26,this.words[x]=D&67108863;if(B===0&&x>>26,O=C&67108863,G=Math.min(w,R.length-1),oe=Math.max(0,w-K.length+1);oe<=G;oe++){var $=w-oe|0;b=K.words[$]|0,M=R.words[oe]|0,B=b*M+O,k+=B/67108864|0,O=B&67108863}D.words[w]=O|0,C=k|0}return C!==0?D.words[w]=C|0:D.length--,D.strip()}var m=function(R,D,v){var b=R.words,M=D.words,B=v.words,x=0,C,w,k,O=b[0]|0,G=O&8191,oe=O>>>13,$=b[1]|0,X=$&8191,W=$>>>13,Z=b[2]|0,te=Z&8191,F=Z>>>13,ee=b[3]|0,fe=ee&8191,xe=ee>>>13,_e=b[4]|0,Me=_e&8191,Ke=_e>>>13,ze=b[5]|0,Je=ze&8191,Xe=ze>>>13,lt=b[6]|0,Re=lt&8191,$e=lt>>>13,st=b[7]|0,Qe=st&8191,ct=st>>>13,tt=b[8]|0,He=tt&8191,at=tt>>>13,pt=b[9]|0,Ge=pt&8191,vt=pt>>>13,bt=M[0]|0,Ze=bt&8191,_t=bt>>>13,Ct=M[1]|0,It=Ct&8191,er=Ct>>>13,dr=M[2]|0,wt=dr&8191,lr=dr>>>13,ir=M[3]|0,Pt=ir&8191,Dt=ir>>>13,Nt=M[4]|0,dt=Nt&8191,Lt=Nt>>>13,kt=M[5]|0,ut=kt&8191,Vt=kt>>>13,zt=M[6]|0,ht=zt&8191,xt=zt>>>13,Bt=M[7]|0,Ve=Bt&8191,$t=Bt>>>13,Et=M[8]|0,ot=Et&8191,Ht=Et>>>13,Nr=M[9]|0,Ut=Nr&8191,Pr=Nr>>>13;v.negative=R.negative^D.negative,v.length=19,C=Math.imul(G,Ze),w=Math.imul(G,_t),w=w+Math.imul(oe,Ze)|0,k=Math.imul(oe,_t);var tr=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(tr>>>26)|0,tr&=67108863,C=Math.imul(X,Ze),w=Math.imul(X,_t),w=w+Math.imul(W,Ze)|0,k=Math.imul(W,_t),C=C+Math.imul(G,It)|0,w=w+Math.imul(G,er)|0,w=w+Math.imul(oe,It)|0,k=k+Math.imul(oe,er)|0;var Or=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(Or>>>26)|0,Or&=67108863,C=Math.imul(te,Ze),w=Math.imul(te,_t),w=w+Math.imul(F,Ze)|0,k=Math.imul(F,_t),C=C+Math.imul(X,It)|0,w=w+Math.imul(X,er)|0,w=w+Math.imul(W,It)|0,k=k+Math.imul(W,er)|0,C=C+Math.imul(G,wt)|0,w=w+Math.imul(G,lr)|0,w=w+Math.imul(oe,wt)|0,k=k+Math.imul(oe,lr)|0;var pi=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(pi>>>26)|0,pi&=67108863,C=Math.imul(fe,Ze),w=Math.imul(fe,_t),w=w+Math.imul(xe,Ze)|0,k=Math.imul(xe,_t),C=C+Math.imul(te,It)|0,w=w+Math.imul(te,er)|0,w=w+Math.imul(F,It)|0,k=k+Math.imul(F,er)|0,C=C+Math.imul(X,wt)|0,w=w+Math.imul(X,lr)|0,w=w+Math.imul(W,wt)|0,k=k+Math.imul(W,lr)|0,C=C+Math.imul(G,Pt)|0,w=w+Math.imul(G,Dt)|0,w=w+Math.imul(oe,Pt)|0,k=k+Math.imul(oe,Dt)|0;var vi=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(vi>>>26)|0,vi&=67108863,C=Math.imul(Me,Ze),w=Math.imul(Me,_t),w=w+Math.imul(Ke,Ze)|0,k=Math.imul(Ke,_t),C=C+Math.imul(fe,It)|0,w=w+Math.imul(fe,er)|0,w=w+Math.imul(xe,It)|0,k=k+Math.imul(xe,er)|0,C=C+Math.imul(te,wt)|0,w=w+Math.imul(te,lr)|0,w=w+Math.imul(F,wt)|0,k=k+Math.imul(F,lr)|0,C=C+Math.imul(X,Pt)|0,w=w+Math.imul(X,Dt)|0,w=w+Math.imul(W,Pt)|0,k=k+Math.imul(W,Dt)|0,C=C+Math.imul(G,dt)|0,w=w+Math.imul(G,Lt)|0,w=w+Math.imul(oe,dt)|0,k=k+Math.imul(oe,Lt)|0;var gi=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(gi>>>26)|0,gi&=67108863,C=Math.imul(Je,Ze),w=Math.imul(Je,_t),w=w+Math.imul(Xe,Ze)|0,k=Math.imul(Xe,_t),C=C+Math.imul(Me,It)|0,w=w+Math.imul(Me,er)|0,w=w+Math.imul(Ke,It)|0,k=k+Math.imul(Ke,er)|0,C=C+Math.imul(fe,wt)|0,w=w+Math.imul(fe,lr)|0,w=w+Math.imul(xe,wt)|0,k=k+Math.imul(xe,lr)|0,C=C+Math.imul(te,Pt)|0,w=w+Math.imul(te,Dt)|0,w=w+Math.imul(F,Pt)|0,k=k+Math.imul(F,Dt)|0,C=C+Math.imul(X,dt)|0,w=w+Math.imul(X,Lt)|0,w=w+Math.imul(W,dt)|0,k=k+Math.imul(W,Lt)|0,C=C+Math.imul(G,ut)|0,w=w+Math.imul(G,Vt)|0,w=w+Math.imul(oe,ut)|0,k=k+Math.imul(oe,Vt)|0;var _i=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(_i>>>26)|0,_i&=67108863,C=Math.imul(Re,Ze),w=Math.imul(Re,_t),w=w+Math.imul($e,Ze)|0,k=Math.imul($e,_t),C=C+Math.imul(Je,It)|0,w=w+Math.imul(Je,er)|0,w=w+Math.imul(Xe,It)|0,k=k+Math.imul(Xe,er)|0,C=C+Math.imul(Me,wt)|0,w=w+Math.imul(Me,lr)|0,w=w+Math.imul(Ke,wt)|0,k=k+Math.imul(Ke,lr)|0,C=C+Math.imul(fe,Pt)|0,w=w+Math.imul(fe,Dt)|0,w=w+Math.imul(xe,Pt)|0,k=k+Math.imul(xe,Dt)|0,C=C+Math.imul(te,dt)|0,w=w+Math.imul(te,Lt)|0,w=w+Math.imul(F,dt)|0,k=k+Math.imul(F,Lt)|0,C=C+Math.imul(X,ut)|0,w=w+Math.imul(X,Vt)|0,w=w+Math.imul(W,ut)|0,k=k+Math.imul(W,Vt)|0,C=C+Math.imul(G,ht)|0,w=w+Math.imul(G,xt)|0,w=w+Math.imul(oe,ht)|0,k=k+Math.imul(oe,xt)|0;var Tn=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,C=Math.imul(Qe,Ze),w=Math.imul(Qe,_t),w=w+Math.imul(ct,Ze)|0,k=Math.imul(ct,_t),C=C+Math.imul(Re,It)|0,w=w+Math.imul(Re,er)|0,w=w+Math.imul($e,It)|0,k=k+Math.imul($e,er)|0,C=C+Math.imul(Je,wt)|0,w=w+Math.imul(Je,lr)|0,w=w+Math.imul(Xe,wt)|0,k=k+Math.imul(Xe,lr)|0,C=C+Math.imul(Me,Pt)|0,w=w+Math.imul(Me,Dt)|0,w=w+Math.imul(Ke,Pt)|0,k=k+Math.imul(Ke,Dt)|0,C=C+Math.imul(fe,dt)|0,w=w+Math.imul(fe,Lt)|0,w=w+Math.imul(xe,dt)|0,k=k+Math.imul(xe,Lt)|0,C=C+Math.imul(te,ut)|0,w=w+Math.imul(te,Vt)|0,w=w+Math.imul(F,ut)|0,k=k+Math.imul(F,Vt)|0,C=C+Math.imul(X,ht)|0,w=w+Math.imul(X,xt)|0,w=w+Math.imul(W,ht)|0,k=k+Math.imul(W,xt)|0,C=C+Math.imul(G,Ve)|0,w=w+Math.imul(G,$t)|0,w=w+Math.imul(oe,Ve)|0,k=k+Math.imul(oe,$t)|0;var ps=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(ps>>>26)|0,ps&=67108863,C=Math.imul(He,Ze),w=Math.imul(He,_t),w=w+Math.imul(at,Ze)|0,k=Math.imul(at,_t),C=C+Math.imul(Qe,It)|0,w=w+Math.imul(Qe,er)|0,w=w+Math.imul(ct,It)|0,k=k+Math.imul(ct,er)|0,C=C+Math.imul(Re,wt)|0,w=w+Math.imul(Re,lr)|0,w=w+Math.imul($e,wt)|0,k=k+Math.imul($e,lr)|0,C=C+Math.imul(Je,Pt)|0,w=w+Math.imul(Je,Dt)|0,w=w+Math.imul(Xe,Pt)|0,k=k+Math.imul(Xe,Dt)|0,C=C+Math.imul(Me,dt)|0,w=w+Math.imul(Me,Lt)|0,w=w+Math.imul(Ke,dt)|0,k=k+Math.imul(Ke,Lt)|0,C=C+Math.imul(fe,ut)|0,w=w+Math.imul(fe,Vt)|0,w=w+Math.imul(xe,ut)|0,k=k+Math.imul(xe,Vt)|0,C=C+Math.imul(te,ht)|0,w=w+Math.imul(te,xt)|0,w=w+Math.imul(F,ht)|0,k=k+Math.imul(F,xt)|0,C=C+Math.imul(X,Ve)|0,w=w+Math.imul(X,$t)|0,w=w+Math.imul(W,Ve)|0,k=k+Math.imul(W,$t)|0,C=C+Math.imul(G,ot)|0,w=w+Math.imul(G,Ht)|0,w=w+Math.imul(oe,ot)|0,k=k+Math.imul(oe,Ht)|0;var vs=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(vs>>>26)|0,vs&=67108863,C=Math.imul(Ge,Ze),w=Math.imul(Ge,_t),w=w+Math.imul(vt,Ze)|0,k=Math.imul(vt,_t),C=C+Math.imul(He,It)|0,w=w+Math.imul(He,er)|0,w=w+Math.imul(at,It)|0,k=k+Math.imul(at,er)|0,C=C+Math.imul(Qe,wt)|0,w=w+Math.imul(Qe,lr)|0,w=w+Math.imul(ct,wt)|0,k=k+Math.imul(ct,lr)|0,C=C+Math.imul(Re,Pt)|0,w=w+Math.imul(Re,Dt)|0,w=w+Math.imul($e,Pt)|0,k=k+Math.imul($e,Dt)|0,C=C+Math.imul(Je,dt)|0,w=w+Math.imul(Je,Lt)|0,w=w+Math.imul(Xe,dt)|0,k=k+Math.imul(Xe,Lt)|0,C=C+Math.imul(Me,ut)|0,w=w+Math.imul(Me,Vt)|0,w=w+Math.imul(Ke,ut)|0,k=k+Math.imul(Ke,Vt)|0,C=C+Math.imul(fe,ht)|0,w=w+Math.imul(fe,xt)|0,w=w+Math.imul(xe,ht)|0,k=k+Math.imul(xe,xt)|0,C=C+Math.imul(te,Ve)|0,w=w+Math.imul(te,$t)|0,w=w+Math.imul(F,Ve)|0,k=k+Math.imul(F,$t)|0,C=C+Math.imul(X,ot)|0,w=w+Math.imul(X,Ht)|0,w=w+Math.imul(W,ot)|0,k=k+Math.imul(W,Ht)|0,C=C+Math.imul(G,Ut)|0,w=w+Math.imul(G,Pr)|0,w=w+Math.imul(oe,Ut)|0,k=k+Math.imul(oe,Pr)|0;var gs=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(gs>>>26)|0,gs&=67108863,C=Math.imul(Ge,It),w=Math.imul(Ge,er),w=w+Math.imul(vt,It)|0,k=Math.imul(vt,er),C=C+Math.imul(He,wt)|0,w=w+Math.imul(He,lr)|0,w=w+Math.imul(at,wt)|0,k=k+Math.imul(at,lr)|0,C=C+Math.imul(Qe,Pt)|0,w=w+Math.imul(Qe,Dt)|0,w=w+Math.imul(ct,Pt)|0,k=k+Math.imul(ct,Dt)|0,C=C+Math.imul(Re,dt)|0,w=w+Math.imul(Re,Lt)|0,w=w+Math.imul($e,dt)|0,k=k+Math.imul($e,Lt)|0,C=C+Math.imul(Je,ut)|0,w=w+Math.imul(Je,Vt)|0,w=w+Math.imul(Xe,ut)|0,k=k+Math.imul(Xe,Vt)|0,C=C+Math.imul(Me,ht)|0,w=w+Math.imul(Me,xt)|0,w=w+Math.imul(Ke,ht)|0,k=k+Math.imul(Ke,xt)|0,C=C+Math.imul(fe,Ve)|0,w=w+Math.imul(fe,$t)|0,w=w+Math.imul(xe,Ve)|0,k=k+Math.imul(xe,$t)|0,C=C+Math.imul(te,ot)|0,w=w+Math.imul(te,Ht)|0,w=w+Math.imul(F,ot)|0,k=k+Math.imul(F,Ht)|0,C=C+Math.imul(X,Ut)|0,w=w+Math.imul(X,Pr)|0,w=w+Math.imul(W,Ut)|0,k=k+Math.imul(W,Pr)|0;var Hi=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,C=Math.imul(Ge,wt),w=Math.imul(Ge,lr),w=w+Math.imul(vt,wt)|0,k=Math.imul(vt,lr),C=C+Math.imul(He,Pt)|0,w=w+Math.imul(He,Dt)|0,w=w+Math.imul(at,Pt)|0,k=k+Math.imul(at,Dt)|0,C=C+Math.imul(Qe,dt)|0,w=w+Math.imul(Qe,Lt)|0,w=w+Math.imul(ct,dt)|0,k=k+Math.imul(ct,Lt)|0,C=C+Math.imul(Re,ut)|0,w=w+Math.imul(Re,Vt)|0,w=w+Math.imul($e,ut)|0,k=k+Math.imul($e,Vt)|0,C=C+Math.imul(Je,ht)|0,w=w+Math.imul(Je,xt)|0,w=w+Math.imul(Xe,ht)|0,k=k+Math.imul(Xe,xt)|0,C=C+Math.imul(Me,Ve)|0,w=w+Math.imul(Me,$t)|0,w=w+Math.imul(Ke,Ve)|0,k=k+Math.imul(Ke,$t)|0,C=C+Math.imul(fe,ot)|0,w=w+Math.imul(fe,Ht)|0,w=w+Math.imul(xe,ot)|0,k=k+Math.imul(xe,Ht)|0,C=C+Math.imul(te,Ut)|0,w=w+Math.imul(te,Pr)|0,w=w+Math.imul(F,Ut)|0,k=k+Math.imul(F,Pr)|0;var ys=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(ys>>>26)|0,ys&=67108863,C=Math.imul(Ge,Pt),w=Math.imul(Ge,Dt),w=w+Math.imul(vt,Pt)|0,k=Math.imul(vt,Dt),C=C+Math.imul(He,dt)|0,w=w+Math.imul(He,Lt)|0,w=w+Math.imul(at,dt)|0,k=k+Math.imul(at,Lt)|0,C=C+Math.imul(Qe,ut)|0,w=w+Math.imul(Qe,Vt)|0,w=w+Math.imul(ct,ut)|0,k=k+Math.imul(ct,Vt)|0,C=C+Math.imul(Re,ht)|0,w=w+Math.imul(Re,xt)|0,w=w+Math.imul($e,ht)|0,k=k+Math.imul($e,xt)|0,C=C+Math.imul(Je,Ve)|0,w=w+Math.imul(Je,$t)|0,w=w+Math.imul(Xe,Ve)|0,k=k+Math.imul(Xe,$t)|0,C=C+Math.imul(Me,ot)|0,w=w+Math.imul(Me,Ht)|0,w=w+Math.imul(Ke,ot)|0,k=k+Math.imul(Ke,Ht)|0,C=C+Math.imul(fe,Ut)|0,w=w+Math.imul(fe,Pr)|0,w=w+Math.imul(xe,Ut)|0,k=k+Math.imul(xe,Pr)|0;var ms=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(ms>>>26)|0,ms&=67108863,C=Math.imul(Ge,dt),w=Math.imul(Ge,Lt),w=w+Math.imul(vt,dt)|0,k=Math.imul(vt,Lt),C=C+Math.imul(He,ut)|0,w=w+Math.imul(He,Vt)|0,w=w+Math.imul(at,ut)|0,k=k+Math.imul(at,Vt)|0,C=C+Math.imul(Qe,ht)|0,w=w+Math.imul(Qe,xt)|0,w=w+Math.imul(ct,ht)|0,k=k+Math.imul(ct,xt)|0,C=C+Math.imul(Re,Ve)|0,w=w+Math.imul(Re,$t)|0,w=w+Math.imul($e,Ve)|0,k=k+Math.imul($e,$t)|0,C=C+Math.imul(Je,ot)|0,w=w+Math.imul(Je,Ht)|0,w=w+Math.imul(Xe,ot)|0,k=k+Math.imul(Xe,Ht)|0,C=C+Math.imul(Me,Ut)|0,w=w+Math.imul(Me,Pr)|0,w=w+Math.imul(Ke,Ut)|0,k=k+Math.imul(Ke,Pr)|0;var qs=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(qs>>>26)|0,qs&=67108863,C=Math.imul(Ge,ut),w=Math.imul(Ge,Vt),w=w+Math.imul(vt,ut)|0,k=Math.imul(vt,Vt),C=C+Math.imul(He,ht)|0,w=w+Math.imul(He,xt)|0,w=w+Math.imul(at,ht)|0,k=k+Math.imul(at,xt)|0,C=C+Math.imul(Qe,Ve)|0,w=w+Math.imul(Qe,$t)|0,w=w+Math.imul(ct,Ve)|0,k=k+Math.imul(ct,$t)|0,C=C+Math.imul(Re,ot)|0,w=w+Math.imul(Re,Ht)|0,w=w+Math.imul($e,ot)|0,k=k+Math.imul($e,Ht)|0,C=C+Math.imul(Je,Ut)|0,w=w+Math.imul(Je,Pr)|0,w=w+Math.imul(Xe,Ut)|0,k=k+Math.imul(Xe,Pr)|0;var ho=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(ho>>>26)|0,ho&=67108863,C=Math.imul(Ge,ht),w=Math.imul(Ge,xt),w=w+Math.imul(vt,ht)|0,k=Math.imul(vt,xt),C=C+Math.imul(He,Ve)|0,w=w+Math.imul(He,$t)|0,w=w+Math.imul(at,Ve)|0,k=k+Math.imul(at,$t)|0,C=C+Math.imul(Qe,ot)|0,w=w+Math.imul(Qe,Ht)|0,w=w+Math.imul(ct,ot)|0,k=k+Math.imul(ct,Ht)|0,C=C+Math.imul(Re,Ut)|0,w=w+Math.imul(Re,Pr)|0,w=w+Math.imul($e,Ut)|0,k=k+Math.imul($e,Pr)|0;var Pn=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,C=Math.imul(Ge,Ve),w=Math.imul(Ge,$t),w=w+Math.imul(vt,Ve)|0,k=Math.imul(vt,$t),C=C+Math.imul(He,ot)|0,w=w+Math.imul(He,Ht)|0,w=w+Math.imul(at,ot)|0,k=k+Math.imul(at,Ht)|0,C=C+Math.imul(Qe,Ut)|0,w=w+Math.imul(Qe,Pr)|0,w=w+Math.imul(ct,Ut)|0,k=k+Math.imul(ct,Pr)|0;var Gi=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,C=Math.imul(Ge,ot),w=Math.imul(Ge,Ht),w=w+Math.imul(vt,ot)|0,k=Math.imul(vt,Ht),C=C+Math.imul(He,Ut)|0,w=w+Math.imul(He,Pr)|0,w=w+Math.imul(at,Ut)|0,k=k+Math.imul(at,Pr)|0;var po=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(po>>>26)|0,po&=67108863,C=Math.imul(Ge,Ut),w=Math.imul(Ge,Pr),w=w+Math.imul(vt,Ut)|0,k=Math.imul(vt,Pr);var Vs=(x+C|0)+((w&8191)<<13)|0;return x=(k+(w>>>13)|0)+(Vs>>>26)|0,Vs&=67108863,B[0]=tr,B[1]=Or,B[2]=pi,B[3]=vi,B[4]=gi,B[5]=_i,B[6]=Tn,B[7]=ps,B[8]=vs,B[9]=gs,B[10]=Hi,B[11]=ys,B[12]=ms,B[13]=qs,B[14]=ho,B[15]=Pn,B[16]=Gi,B[17]=po,B[18]=Vs,x!==0&&(B[19]=x,v.length++),v};Math.imul||(m=y);function S(K,R,D){D.negative=R.negative^K.negative,D.length=K.length+R.length;for(var v=0,b=0,M=0;M>>26)|0,b+=B>>>26,B&=67108863}D.words[M]=x,v=B,B=b}return v!==0?D.words[M]=v:D.length--,D.strip()}function E(K,R,D){var v=new A;return v.mulp(K,R,D)}s.prototype.mulTo=function(R,D){var v,b=this.length+R.length;return this.length===10&&R.length===10?v=m(this,R,D):b<63?v=y(this,R,D):b<1024?v=S(this,R,D):v=E(this,R,D),v};function A(K,R){this.x=K,this.y=R}A.prototype.makeRBT=function(R){for(var D=new Array(R),v=s.prototype._countBits(R)-1,b=0;b>=1;return b},A.prototype.permute=function(R,D,v,b,M,B){for(var x=0;x>>1)M++;return 1<>>13,v[2*B+1]=M&8191,M=M>>>13;for(B=2*D;B>=26,D+=b/67108864|0,D+=M>>>26,this.words[v]=M&67108863}return D!==0&&(this.words[v]=D,this.length++),this},s.prototype.muln=function(R){return this.clone().imuln(R)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(R){var D=g(R);if(D.length===0)return new s(1);for(var v=this,b=0;b=0);var D=R%26,v=(R-D)/26,b=67108863>>>26-D<<26-D,M;if(D!==0){var B=0;for(M=0;M>>26-D}B&&(this.words[M]=B,this.length++)}if(v!==0){for(M=this.length-1;M>=0;M--)this.words[M+v]=this.words[M];for(M=0;M=0);var b;D?b=(D-D%26)/26:b=0;var M=R%26,B=Math.min((R-M)/26,this.length),x=67108863^67108863>>>M<B)for(this.length-=B,w=0;w=0&&(k!==0||w>=b);w--){var O=this.words[w]|0;this.words[w]=k<<26-M|O>>>M,k=O&x}return C&&k!==0&&(C.words[C.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(R,D,v){return n(this.negative===0),this.iushrn(R,D,v)},s.prototype.shln=function(R){return this.clone().ishln(R)},s.prototype.ushln=function(R){return this.clone().iushln(R)},s.prototype.shrn=function(R){return this.clone().ishrn(R)},s.prototype.ushrn=function(R){return this.clone().iushrn(R)},s.prototype.testn=function(R){n(typeof R=="number"&&R>=0);var D=R%26,v=(R-D)/26,b=1<=0);var D=R%26,v=(R-D)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(D!==0&&v++,this.length=Math.min(v,this.length),D!==0){var b=67108863^67108863>>>D<=67108864;D++)this.words[D]-=67108864,D===this.length-1?this.words[D+1]=1:this.words[D+1]++;return this.length=Math.max(this.length,D+1),this},s.prototype.isubn=function(R){if(n(typeof R=="number"),n(R<67108864),R<0)return this.iaddn(-R);if(this.negative!==0)return this.negative=0,this.iaddn(R),this.negative=1,this;if(this.words[0]-=R,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var D=0;D>26)-(C/67108864|0),this.words[M+v]=B&67108863}for(;M>26,this.words[M+v]=B&67108863;if(x===0)return this.strip();for(n(x===-1),x=0,M=0;M>26,this.words[M]=B&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(R,D){var v=this.length-R.length,b=this.clone(),M=R,B=M.words[M.length-1]|0,x=this._countBits(B);v=26-x,v!==0&&(M=M.ushln(v),b.iushln(v),B=M.words[M.length-1]|0);var C=b.length-M.length,w;if(D!=="mod"){w=new s(null),w.length=C+1,w.words=new Array(w.length);for(var k=0;k=0;G--){var oe=(b.words[M.length+G]|0)*67108864+(b.words[M.length+G-1]|0);for(oe=Math.min(oe/B|0,67108863),b._ishlnsubmul(M,oe,G);b.negative!==0;)oe--,b.negative=0,b._ishlnsubmul(M,1,G),b.isZero()||(b.negative^=1);w&&(w.words[G]=oe)}return w&&w.strip(),b.strip(),D!=="div"&&v!==0&&b.iushrn(v),{div:w||null,mod:b}},s.prototype.divmod=function(R,D,v){if(n(!R.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var b,M,B;return this.negative!==0&&R.negative===0?(B=this.neg().divmod(R,D),D!=="mod"&&(b=B.div.neg()),D!=="div"&&(M=B.mod.neg(),v&&M.negative!==0&&M.iadd(R)),{div:b,mod:M}):this.negative===0&&R.negative!==0?(B=this.divmod(R.neg(),D),D!=="mod"&&(b=B.div.neg()),{div:b,mod:B.mod}):this.negative&R.negative?(B=this.neg().divmod(R.neg(),D),D!=="div"&&(M=B.mod.neg(),v&&M.negative!==0&&M.isub(R)),{div:B.div,mod:M}):R.length>this.length||this.cmp(R)<0?{div:new s(0),mod:this}:R.length===1?D==="div"?{div:this.divn(R.words[0]),mod:null}:D==="mod"?{div:null,mod:new s(this.modn(R.words[0]))}:{div:this.divn(R.words[0]),mod:new s(this.modn(R.words[0]))}:this._wordDiv(R,D)},s.prototype.div=function(R){return this.divmod(R,"div",!1).div},s.prototype.mod=function(R){return this.divmod(R,"mod",!1).mod},s.prototype.umod=function(R){return this.divmod(R,"mod",!0).mod},s.prototype.divRound=function(R){var D=this.divmod(R);if(D.mod.isZero())return D.div;var v=D.div.negative!==0?D.mod.isub(R):D.mod,b=R.ushrn(1),M=R.andln(1),B=v.cmp(b);return B<0||M===1&&B===0?D.div:D.div.negative!==0?D.div.isubn(1):D.div.iaddn(1)},s.prototype.modn=function(R){n(R<=67108863);for(var D=(1<<26)%R,v=0,b=this.length-1;b>=0;b--)v=(D*v+(this.words[b]|0))%R;return v},s.prototype.idivn=function(R){n(R<=67108863);for(var D=0,v=this.length-1;v>=0;v--){var b=(this.words[v]|0)+D*67108864;this.words[v]=b/R|0,D=b%R}return this.strip()},s.prototype.divn=function(R){return this.clone().idivn(R)},s.prototype.egcd=function(R){n(R.negative===0),n(!R.isZero());var D=this,v=R.clone();D.negative!==0?D=D.umod(R):D=D.clone();for(var b=new s(1),M=new s(0),B=new s(0),x=new s(1),C=0;D.isEven()&&v.isEven();)D.iushrn(1),v.iushrn(1),++C;for(var w=v.clone(),k=D.clone();!D.isZero();){for(var O=0,G=1;!(D.words[0]&G)&&O<26;++O,G<<=1);if(O>0)for(D.iushrn(O);O-- >0;)(b.isOdd()||M.isOdd())&&(b.iadd(w),M.isub(k)),b.iushrn(1),M.iushrn(1);for(var oe=0,$=1;!(v.words[0]&$)&&oe<26;++oe,$<<=1);if(oe>0)for(v.iushrn(oe);oe-- >0;)(B.isOdd()||x.isOdd())&&(B.iadd(w),x.isub(k)),B.iushrn(1),x.iushrn(1);D.cmp(v)>=0?(D.isub(v),b.isub(B),M.isub(x)):(v.isub(D),B.isub(b),x.isub(M))}return{a:B,b:x,gcd:v.iushln(C)}},s.prototype._invmp=function(R){n(R.negative===0),n(!R.isZero());var D=this,v=R.clone();D.negative!==0?D=D.umod(R):D=D.clone();for(var b=new s(1),M=new s(0),B=v.clone();D.cmpn(1)>0&&v.cmpn(1)>0;){for(var x=0,C=1;!(D.words[0]&C)&&x<26;++x,C<<=1);if(x>0)for(D.iushrn(x);x-- >0;)b.isOdd()&&b.iadd(B),b.iushrn(1);for(var w=0,k=1;!(v.words[0]&k)&&w<26;++w,k<<=1);if(w>0)for(v.iushrn(w);w-- >0;)M.isOdd()&&M.iadd(B),M.iushrn(1);D.cmp(v)>=0?(D.isub(v),b.isub(M)):(v.isub(D),M.isub(b))}var O;return D.cmpn(1)===0?O=b:O=M,O.cmpn(0)<0&&O.iadd(R),O},s.prototype.gcd=function(R){if(this.isZero())return R.abs();if(R.isZero())return this.abs();var D=this.clone(),v=R.clone();D.negative=0,v.negative=0;for(var b=0;D.isEven()&&v.isEven();b++)D.iushrn(1),v.iushrn(1);do{for(;D.isEven();)D.iushrn(1);for(;v.isEven();)v.iushrn(1);var M=D.cmp(v);if(M<0){var B=D;D=v,v=B}else if(M===0||v.cmpn(1)===0)break;D.isub(v)}while(!0);return v.iushln(b)},s.prototype.invm=function(R){return this.egcd(R).a.umod(R)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(R){return this.words[0]&R},s.prototype.bincn=function(R){n(typeof R=="number");var D=R%26,v=(R-D)/26,b=1<>>26,x&=67108863,this.words[B]=x}return M!==0&&(this.words[B]=M,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(R){var D=R<0;if(this.negative!==0&&!D)return-1;if(this.negative===0&&D)return 1;this.strip();var v;if(this.length>1)v=1;else{D&&(R=-R),n(R<=67108863,"Number is too big");var b=this.words[0]|0;v=b===R?0:bR.length)return 1;if(this.length=0;v--){var b=this.words[v]|0,M=R.words[v]|0;if(b!==M){bM&&(D=1);break}}return D},s.prototype.gtn=function(R){return this.cmpn(R)===1},s.prototype.gt=function(R){return this.cmp(R)===1},s.prototype.gten=function(R){return this.cmpn(R)>=0},s.prototype.gte=function(R){return this.cmp(R)>=0},s.prototype.ltn=function(R){return this.cmpn(R)===-1},s.prototype.lt=function(R){return this.cmp(R)===-1},s.prototype.lten=function(R){return this.cmpn(R)<=0},s.prototype.lte=function(R){return this.cmp(R)<=0},s.prototype.eqn=function(R){return this.cmpn(R)===0},s.prototype.eq=function(R){return this.cmp(R)===0},s.red=function(R){return new ie(R)},s.prototype.toRed=function(R){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),R.convertTo(this)._forceRed(R)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(R){return this.red=R,this},s.prototype.forceRed=function(R){return n(!this.red,"Already a number in reduction context"),this._forceRed(R)},s.prototype.redAdd=function(R){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,R)},s.prototype.redIAdd=function(R){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,R)},s.prototype.redSub=function(R){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,R)},s.prototype.redISub=function(R){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,R)},s.prototype.redShl=function(R){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,R)},s.prototype.redMul=function(R){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,R),this.red.mul(this,R)},s.prototype.redIMul=function(R){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,R),this.red.imul(this,R)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(R){return n(this.red&&!R.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,R)};var P={k256:null,p224:null,p192:null,p25519:null};function N(K,R){this.name=K,this.p=new s(R,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}N.prototype._tmp=function(){var R=new s(null);return R.words=new Array(Math.ceil(this.n/13)),R},N.prototype.ireduce=function(R){var D=R,v;do this.split(D,this.tmp),D=this.imulK(D),D=D.iadd(this.tmp),v=D.bitLength();while(v>this.n);var b=v0?D.isub(this.p):D.strip!==void 0?D.strip():D._strip(),D},N.prototype.split=function(R,D){R.iushrn(this.n,0,D)},N.prototype.imulK=function(R){return R.imul(this.k)};function L(){N.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(L,N),L.prototype.split=function(R,D){for(var v=4194303,b=Math.min(R.length,9),M=0;M>>22,B=x}B>>>=22,R.words[M-10]=B,B===0&&R.length>10?R.length-=10:R.length-=9},L.prototype.imulK=function(R){R.words[R.length]=0,R.words[R.length+1]=0,R.length+=2;for(var D=0,v=0;v>>=26,R.words[v]=M,D=b}return D!==0&&(R.words[R.length++]=D),R},s._prime=function(R){if(P[R])return P[R];var D;if(R==="k256")D=new L;else if(R==="p224")D=new V;else if(R==="p192")D=new I;else if(R==="p25519")D=new U;else throw new Error("Unknown prime "+R);return P[R]=D,D};function ie(K){if(typeof K=="string"){var R=s._prime(K);this.m=R.p,this.prime=R}else n(K.gtn(1),"modulus must be greater than 1"),this.m=K,this.prime=null}ie.prototype._verify1=function(R){n(R.negative===0,"red works only with positives"),n(R.red,"red works only with red numbers")},ie.prototype._verify2=function(R,D){n((R.negative|D.negative)===0,"red works only with positives"),n(R.red&&R.red===D.red,"red works only with red numbers")},ie.prototype.imod=function(R){return this.prime?this.prime.ireduce(R)._forceRed(this):R.umod(this.m)._forceRed(this)},ie.prototype.neg=function(R){return R.isZero()?R.clone():this.m.sub(R)._forceRed(this)},ie.prototype.add=function(R,D){this._verify2(R,D);var v=R.add(D);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},ie.prototype.iadd=function(R,D){this._verify2(R,D);var v=R.iadd(D);return v.cmp(this.m)>=0&&v.isub(this.m),v},ie.prototype.sub=function(R,D){this._verify2(R,D);var v=R.sub(D);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},ie.prototype.isub=function(R,D){this._verify2(R,D);var v=R.isub(D);return v.cmpn(0)<0&&v.iadd(this.m),v},ie.prototype.shl=function(R,D){return this._verify1(R),this.imod(R.ushln(D))},ie.prototype.imul=function(R,D){return this._verify2(R,D),this.imod(R.imul(D))},ie.prototype.mul=function(R,D){return this._verify2(R,D),this.imod(R.mul(D))},ie.prototype.isqr=function(R){return this.imul(R,R.clone())},ie.prototype.sqr=function(R){return this.mul(R,R)},ie.prototype.sqrt=function(R){if(R.isZero())return R.clone();var D=this.m.andln(3);if(n(D%2===1),D===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(R,v)}for(var b=this.m.subn(1),M=0;!b.isZero()&&b.andln(1)===0;)M++,b.iushrn(1);n(!b.isZero());var B=new s(1).toRed(this),x=B.redNeg(),C=this.m.subn(1).iushrn(1),w=this.m.bitLength();for(w=new s(2*w*w).toRed(this);this.pow(w,C).cmp(x)!==0;)w.redIAdd(x);for(var k=this.pow(w,b),O=this.pow(R,b.addn(1).iushrn(1)),G=this.pow(R,b),oe=M;G.cmp(B)!==0;){for(var $=G,X=0;$.cmp(B)!==0;X++)$=$.redSqr();n(X=0;M--){for(var k=D.words[M],O=w-1;O>=0;O--){var G=k>>O&1;if(B!==b[0]&&(B=this.sqr(B)),G===0&&x===0){C=0;continue}x<<=1,x|=G,C++,!(C!==v&&(M!==0||O!==0))&&(B=this.mul(B,b[x]),C=0,x=0)}w=26}return B},ie.prototype.convertTo=function(R){var D=R.umod(this.m);return D===R?D.clone():D},ie.prototype.convertFrom=function(R){var D=R.clone();return D.red=null,D},s.mont=function(R){return new ae(R)};function ae(K){ie.call(this,K),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ae,ie),ae.prototype.convertTo=function(R){return this.imod(R.ushln(this.shift))},ae.prototype.convertFrom=function(R){var D=this.imod(R.mul(this.rinv));return D.red=null,D},ae.prototype.imul=function(R,D){if(R.isZero()||D.isZero())return R.words[0]=0,R.length=1,R;var v=R.imul(D),b=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=v.isub(b).iushrn(this.shift),B=M;return M.cmp(this.m)>=0?B=M.isub(this.m):M.cmpn(0)<0&&(B=M.iadd(this.m)),B._forceRed(this)},ae.prototype.mul=function(R,D){if(R.isZero()||D.isZero())return new s(0)._forceRed(this);var v=R.mul(D),b=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=v.isub(b).iushrn(this.shift),B=M;return M.cmp(this.m)>=0?B=M.isub(this.m):M.cmpn(0)<0&&(B=M.iadd(this.m)),B._forceRed(this)},ae.prototype.invm=function(R){var D=this.imod(R._invmp(this.m).mul(this.r2));return D._forceRed(this)}})(t,xi)})(yO);var Yu=yO.exports,mO={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var c=0;c>8,u=l&255;f?a.push(f,u):a.push(u)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(m>>1)-1?E=(m>>1)-A:E=A,S.isubn(E)):E=0,g[y]=E,S.iushrn(1)}return g}e.getNAF=s;function o(f,u){var h=[[],[]];f=f.clone(),u=u.clone();for(var g=0,y=0,m;f.cmpn(-g)>0||u.cmpn(-y)>0;){var S=f.andln(3)+g&3,E=u.andln(3)+y&3;S===3&&(S=-1),E===3&&(E=-1);var A;S&1?(m=f.andln(7)+g&7,(m===3||m===5)&&E===2?A=-S:A=S):A=0,h[0].push(A);var P;E&1?(m=u.andln(7)+y&7,(m===3||m===5)&&S===2?P=-E:P=E):P=0,h[1].push(P),2*g===A+1&&(g=1-g),2*y===P+1&&(y=1-y),f.iushrn(1),u.iushrn(1)}return h}e.getJSF=o;function a(f,u,h){var g="_"+u;f.prototype[u]=function(){return this[g]!==void 0?this[g]:this[g]=h.call(this)}}e.cachedProperty=a;function c(f){return typeof f=="string"?e.toArray(f,"hex"):f}e.parseBytes=c;function l(f){return new r(f,"hex","le")}e.intFromLE=l})(Ca);var bO={exports:{}},e7;bO.exports=function(e){return e7||(e7=new eh(null)),e7.generate(e)};function eh(t){this.rand=t}bO.exports.Rand=eh;eh.prototype.generate=function(e){return this._rand(e)};eh.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var gC=t0;t0.prototype.point=function(){throw new Error("Not implemented")};t0.prototype.validate=function(){throw new Error("Not implemented")};t0.prototype._fixedNafMul=function(e,r){e8(e.precomputed);var n=e._getDoubles(),i=X4(r,1,this._bitLength),s=(1<=a;l--)c=(c<<1)+i[l];o.push(c)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),h=s;h>0;h--){for(a=0;a=0;c--){for(var l=0;c>=0&&o[c]===0;c--)l++;if(c>=0&&l++,a=a.dblp(l),c<0)break;var f=o[c];e8(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};t0.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,c=this._wnafT3,l=0,f,u,h;for(f=0;f=1;f-=2){var y=f-1,m=f;if(o[y]!==1||o[m]!==1){c[y]=X4(n[y],o[y],this._bitLength),c[m]=X4(n[m],o[m],this._bitLength),l=Math.max(c[y].length,l),l=Math.max(c[m].length,l);continue}var S=[r[y],null,null,r[m]];r[y].y.cmp(r[m].y)===0?(S[1]=r[y].add(r[m]),S[2]=r[y].toJ().mixedAdd(r[m].neg())):r[y].y.cmp(r[m].y.redNeg())===0?(S[1]=r[y].toJ().mixedAdd(r[m]),S[2]=r[y].add(r[m].neg())):(S[1]=r[y].toJ().mixedAdd(r[m]),S[2]=r[y].toJ().mixedAdd(r[m].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],A=HDe(n[y],n[m]);for(l=Math.max(A[0].length,l),c[y]=new Array(l),c[m]=new Array(l),u=0;u=0;f--){for(var I=0;f>=0;){var U=!0;for(u=0;u=0&&I++,L=L.dblp(I),f<0)break;for(u=0;u0?h=a[u][ie-1>>1]:ie<0&&(h=a[u][-ie-1>>1].neg()),h.type==="affine"?L=L.mixedAdd(h):L=L.add(h))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};uc.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(g=l,y=f),u.negative&&(u=u.neg(),h=h.neg()),g.negative&&(g=g.neg(),y=y.neg()),[{a:u,b:h},{a:g,b:y}]};dc.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),c=o.mul(i.a),l=s.mul(n.b),f=o.mul(i.b),u=e.sub(a).sub(c),h=l.add(f).neg();return{k1:u,k2:h}};dc.prototype.pointFromX=function(e,r){e=new Wn(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};dc.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};dc.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};zi.prototype.isInfinity=function(){return this.inf};zi.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};zi.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};zi.prototype.getX=function(){return this.x.fromRed()};zi.prototype.getY=function(){return this.y.fromRed()};zi.prototype.mul=function(e){return e=new Wn(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};zi.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};zi.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};zi.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};zi.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};zi.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function ds(t,e,r,n){bm.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Wn(0)):(this.x=new Wn(e,16),this.y=new Wn(r,16),this.z=new Wn(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}xO(ds,bm.BasePoint);dc.prototype.jpoint=function(e,r,n){return new ds(this,e,r,n)};ds.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};ds.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};ds.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),c=i.redSub(s),l=o.redSub(a);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),u=f.redMul(c),h=i.redMul(f),g=l.redSqr().redIAdd(u).redISub(h).redISub(h),y=l.redMul(h.redISub(g)).redISub(o.redMul(u)),m=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(g,y,m)};ds.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),c=s.redSub(o);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),f=l.redMul(a),u=n.redMul(l),h=c.redSqr().redIAdd(f).redISub(u).redISub(u),g=c.redMul(u.redISub(h)).redISub(s.redMul(f)),y=this.z.redMul(a);return this.curve.jpoint(h,g,y)};ds.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};ds.prototype.inspect=function(){return this.isInfinity()?"":""};ds.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Wv=Yu,une=aC,yC=gC,YDe=Ca;function wm(t){yC.call(this,"mont",t),this.a=new Wv(t.a,16).toRed(this.red),this.b=new Wv(t.b,16).toRed(this.red),this.i4=new Wv(4).toRed(this.red).redInvm(),this.two=new Wv(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}une(wm,yC);var QDe=wm;wm.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function $i(t,e,r){yC.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Wv(e,16),this.z=new Wv(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}une($i,yC.BasePoint);wm.prototype.decodePoint=function(e,r){return this.point(YDe.toArray(e,r),1)};wm.prototype.point=function(e,r){return new $i(this,e,r)};wm.prototype.pointFromJSON=function(e){return $i.fromJSON(this,e)};$i.prototype.precompute=function(){};$i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};$i.fromJSON=function(e,r){return new $i(e,r[0],r[1]||e.one)};$i.prototype.inspect=function(){return this.isInfinity()?"":""};$i.prototype.isInfinity=function(){return this.z.cmpn(0)===0};$i.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)};$i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};$i.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),c=s.redMul(i),l=r.z.redMul(a.redAdd(c).redSqr()),f=r.x.redMul(a.redISub(c).redSqr());return this.curve.point(l,f)};$i.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i};$i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};$i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};$i.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};$i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};$i.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var JDe=Ca,pu=Yu,dne=aC,mC=gC,ZDe=JDe.assert;function pf(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,mC.call(this,"edwards",t),this.a=new pu(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new pu(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new pu(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),ZDe(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}dne(pf,mC);var XDe=pf;pf.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};pf.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};pf.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};pf.prototype.pointFromX=function(e,r){e=new pu(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var c=a.fromRed().isOdd();return(r&&!c||!r&&c)&&(a=a.redNeg()),this.point(e,a)};pf.prototype.pointFromY=function(e,r){e=new pu(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)};pf.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function wn(t,e,r,n,i){mC.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new pu(e,16),this.y=new pu(r,16),this.z=n?new pu(n,16):this.curve.one,this.t=i&&new pu(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}dne(wn,mC.BasePoint);pf.prototype.pointFromJSON=function(e){return wn.fromJSON(this,e)};pf.prototype.point=function(e,r,n,i){return new wn(this,e,r,n,i)};wn.fromJSON=function(e,r){return new wn(e,r[0],r[1],r[2])};wn.prototype.inspect=function(){return this.isInfinity()?"":""};wn.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};wn.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),c=i.redSub(r),l=s.redMul(a),f=o.redMul(c),u=s.redMul(c),h=a.redMul(o);return this.curve.point(l,f,h,u)};wn.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,c,l;if(this.curve.twisted){a=this.curve._mulA(r);var f=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(f.redSub(this.curve.two)),s=f.redMul(a.redSub(n)),o=f.redSqr().redSub(f).redSub(f)):(c=this.z.redSqr(),l=f.redSub(c).redISub(c),i=e.redSub(r).redISub(n).redMul(l),s=f.redMul(a.redSub(n)),o=f.redMul(l))}else a=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),l=a.redSub(c).redSub(c),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)};wn.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};wn.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),c=s.redAdd(i),l=n.redAdd(r),f=o.redMul(a),u=c.redMul(l),h=o.redMul(l),g=a.redMul(c);return this.curve.point(f,u,g,h)};wn.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),c=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),f=r.redMul(a).redMul(l),u,h;return this.curve.twisted?(u=r.redMul(c).redMul(s.redSub(this.curve._mulA(i))),h=a.redMul(c)):(u=r.redMul(c).redMul(s.redSub(i)),h=this.curve._mulC(a).redMul(c)),this.curve.point(f,u,h)};wn.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};wn.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};wn.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};wn.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};wn.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};wn.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};wn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};wn.prototype.getY=function(){return this.normalize(),this.y.fromRed()};wn.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};wn.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};wn.prototype.toP=wn.prototype.normalize;wn.prototype.mixedAdd=wn.prototype.add;(function(t){var e=t;e.base=gC,e.short=KDe,e.mont=QDe,e.edwards=XDe})(wO);var bC={},t7,Q$;function eNe(){return Q$||(Q$=1,t7={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),t7}(function(t){var e=t,r=gx,n=wO,i=Ca,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,f){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var u=new o(f);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:u}),u}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=eNe()}catch{c=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})})(bC);var tNe=gx,U1=mO,hne=Ep;function Nh(t){if(!(this instanceof Nh))return new Nh(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=U1.toArray(t.entropy,t.entropyEnc||"hex"),r=U1.toArray(t.nonce,t.nonceEnc||"hex"),n=U1.toArray(t.pers,t.persEnc||"hex");hne(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var rNe=Nh;Nh.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};Nh.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=U1.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var t8=Yu,EO=Ca,oNe=EO.assert;function wC(t,e){if(t instanceof wC)return t;this._importDER(t,e)||(oNe(t.r&&t.s,"Signature without r or s"),this.r=new t8(t.r,16),this.s=new t8(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var aNe=wC;function cNe(){this.place=0}function r7(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function J$(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}wC.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=J$(r),n=J$(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];n7(i,r.length),i=i.concat(r),i.push(2),n7(i,n.length);var s=i.concat(n),o=[48];return n7(o,s.length),o=o.concat(s),EO.encode(o,e)};var vu=Yu,pne=rNe,lNe=Ca,i7=bC,fNe=fne,vne=lNe.assert,CO=sNe,xC=aNe;function cc(t){if(!(this instanceof cc))return new cc(t);typeof t=="string"&&(vne(Object.prototype.hasOwnProperty.call(i7,t),"Unknown curve "+t),t=i7[t]),t instanceof i7.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var uNe=cc;cc.prototype.keyPair=function(e){return new CO(this,e)};cc.prototype.keyFromPrivate=function(e,r){return CO.fromPrivate(this,e,r)};cc.prototype.keyFromPublic=function(e,r){return CO.fromPublic(this,e,r)};cc.prototype.genKeyPair=function(e){e||(e={});for(var r=new pne({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||fNe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new vu(2));;){var s=new vu(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};cc.prototype._truncateToN=function(e,r,n){var i;if(vu.isBN(e)||typeof e=="number")e=new vu(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new vu(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new vu(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};cc.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),c=new pne({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new vu(1)),f=0;;f++){var u=i.k?i.k(f):new vu(c.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(l)>=0)){var h=this.g.mul(u);if(!h.isInfinity()){var g=h.getX(),y=g.umod(this.n);if(y.cmpn(0)!==0){var m=u.invm(this.n).mul(y.mul(r.getPrivate()).iadd(e));if(m=m.umod(this.n),m.cmpn(0)!==0){var S=(h.getY().isOdd()?1:0)|(g.cmp(y)!==0?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),S^=1),new xC({r:y,s:m,recoveryParam:S})}}}}}};cc.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new xC(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),l=c.mul(e).umod(this.n),f=c.mul(o).umod(this.n),u;return this.curve._maxwellTrick?(u=this.g.jmulAdd(l,n.getPublic(),f),u.isInfinity()?!1:u.eqXToP(o)):(u=this.g.mulAdd(l,n.getPublic(),f),u.isInfinity()?!1:u.getX().umod(this.n).cmp(o)===0)};cc.prototype.recoverPubKey=function(t,e,r,n){vne((3&r)===r,"The recovery param is more than two bits"),e=new xC(e,n);var i=this.n,s=new vu(t),o=e.r,a=e.s,c=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),c):o=this.curve.pointFromX(o,c);var f=e.r.invm(i),u=i.sub(s).mul(f).umod(i),h=a.mul(f).umod(i);return this.g.mulAdd(u,o,h)};cc.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new xC(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var xx=Ca,gne=xx.assert,Z$=xx.parseBytes,xm=xx.cachedProperty;function Ui(t,e){this.eddsa=t,this._secret=Z$(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Z$(e.pub)}Ui.fromPublic=function(e,r){return r instanceof Ui?r:new Ui(e,{pub:r})};Ui.fromSecret=function(e,r){return r instanceof Ui?r:new Ui(e,{secret:r})};Ui.prototype.secret=function(){return this._secret};xm(Ui,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});xm(Ui,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});xm(Ui,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});xm(Ui,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});xm(Ui,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});xm(Ui,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Ui.prototype.sign=function(e){return gne(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Ui.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Ui.prototype.getSecret=function(e){return gne(this._secret,"KeyPair is public only"),xx.encode(this.secret(),e)};Ui.prototype.getPublic=function(e){return xx.encode(this.pubBytes(),e)};var dNe=Ui,hNe=Yu,EC=Ca,X$=EC.assert,CC=EC.cachedProperty,pNe=EC.parseBytes;function Ap(t,e){this.eddsa=t,typeof e!="object"&&(e=pNe(e)),Array.isArray(e)&&(X$(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),X$(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof hNe&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}CC(Ap,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});CC(Ap,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});CC(Ap,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});CC(Ap,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Ap.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Ap.prototype.toHex=function(){return EC.encode(this.toBytes(),"hex").toUpperCase()};var vNe=Ap,gNe=gx,yNe=bC,qy=Ca,mNe=qy.assert,yne=qy.parseBytes,mne=dNe,eq=vNe;function jo(t){if(mNe(t==="ed25519","only tested with ed25519 so far"),!(this instanceof jo))return new jo(t);t=yNe[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=gNe.sha512}var bNe=jo;jo.prototype.sign=function(e,r){e=yne(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:c,Rencoded:o})};jo.prototype.verify=function(e,r,n){if(e=yne(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)};jo.prototype.hashInt=function(){for(var e=this.hash(),r=0;r0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=c[f++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(f=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,c,f,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=c[f++],l--;return this},a.prototype.finish=function(c){if(!this._finished){var l=this._bytesHashed,f=this._bufferLength,u=l/536870912|0,h=l<<3,g=l%128<112?128:256;this._buffer[f]=128;for(var y=f+1;y0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(c){return this._stateHi.set(c.stateHi),this._stateLo.set(c.stateLo),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(c){r.wipe(c.stateHi),r.wipe(c.stateLo),c.buffer&&r.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,c,l,f,u,h,g){for(var y=l[0],m=l[1],S=l[2],E=l[3],A=l[4],P=l[5],N=l[6],L=l[7],V=f[0],I=f[1],U=f[2],ie=f[3],ae=f[4],K=f[5],R=f[6],D=f[7],v,b,M,B,x,C,w,k;g>=128;){for(var O=0;O<16;O++){var G=8*O+h;a[O]=e.readUint32BE(u,G),c[O]=e.readUint32BE(u,G+4)}for(var O=0;O<80;O++){var oe=y,$=m,X=S,W=E,Z=A,te=P,F=N,ee=L,fe=V,xe=I,_e=U,Me=ie,Ke=ae,ze=K,Je=R,Xe=D;if(v=L,b=D,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=(A>>>14|ae<<18)^(A>>>18|ae<<14)^(ae>>>9|A<<23),b=(ae>>>14|A<<18)^(ae>>>18|A<<14)^(A>>>9|ae<<23),x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,v=A&P^~A&N,b=ae&K^~ae&R,x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,v=i[O*2],b=i[O*2+1],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,v=a[O%16],b=c[O%16],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,M=w&65535|k<<16,B=x&65535|C<<16,v=M,b=B,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=(y>>>28|V<<4)^(V>>>2|y<<30)^(V>>>7|y<<25),b=(V>>>28|y<<4)^(y>>>2|V<<30)^(y>>>7|V<<25),x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,v=y&m^y&S^m&S,b=V&I^V&U^I&U,x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,ee=w&65535|k<<16,Xe=x&65535|C<<16,v=W,b=Me,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=M,b=B,x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,W=w&65535|k<<16,Me=x&65535|C<<16,m=oe,S=$,E=X,A=W,P=Z,N=te,L=F,y=ee,I=fe,U=xe,ie=_e,ae=Me,K=Ke,R=ze,D=Je,V=Xe,O%16===15)for(var G=0;G<16;G++)v=a[G],b=c[G],x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=a[(G+9)%16],b=c[(G+9)%16],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,M=a[(G+1)%16],B=c[(G+1)%16],v=(M>>>1|B<<31)^(M>>>8|B<<24)^M>>>7,b=(B>>>1|M<<31)^(B>>>8|M<<24)^(B>>>7|M<<25),x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,M=a[(G+14)%16],B=c[(G+14)%16],v=(M>>>19|B<<13)^(B>>>29|M<<3)^M>>>6,b=(B>>>19|M<<13)^(M>>>29|B<<3)^(B>>>6|M<<26),x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,a[G]=w&65535|k<<16,c[G]=x&65535|C<<16}v=y,b=V,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[0],b=f[0],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[0]=y=w&65535|k<<16,f[0]=V=x&65535|C<<16,v=m,b=I,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[1],b=f[1],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[1]=m=w&65535|k<<16,f[1]=I=x&65535|C<<16,v=S,b=U,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[2],b=f[2],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[2]=S=w&65535|k<<16,f[2]=U=x&65535|C<<16,v=E,b=ie,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[3],b=f[3],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[3]=E=w&65535|k<<16,f[3]=ie=x&65535|C<<16,v=A,b=ae,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[4],b=f[4],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[4]=A=w&65535|k<<16,f[4]=ae=x&65535|C<<16,v=P,b=K,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[5],b=f[5],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[5]=P=w&65535|k<<16,f[5]=K=x&65535|C<<16,v=N,b=R,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[6],b=f[6],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[6]=N=w&65535|k<<16,f[6]=R=x&65535|C<<16,v=L,b=D,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[7],b=f[7],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[7]=L=w&65535|k<<16,f[7]=D=x&65535|C<<16,h+=128,g-=128}return h}function o(a){var c=new n;c.update(a);var l=c.digest();return c.clean(),l}t.hash=o})(bne);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=e0,r=bne,n=Ea;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(W){const Z=new Float64Array(16);if(W)for(let te=0;te>16&1),te[xe-1]&=65535;te[15]=F[15]-32767-(te[14]>>16&1);const fe=te[15]>>16&1;te[14]&=65535,m(F,te,1-fe)}for(let ee=0;ee<16;ee++)W[2*ee]=F[ee]&255,W[2*ee+1]=F[ee]>>8}function E(W,Z){let te=0;for(let F=0;F<32;F++)te|=W[F]^Z[F];return(1&te-1>>>8)-1}function A(W,Z){const te=new Uint8Array(32),F=new Uint8Array(32);return S(te,W),S(F,Z),E(te,F)}function P(W){const Z=new Uint8Array(32);return S(Z,W),Z[0]&1}function N(W,Z){for(let te=0;te<16;te++)W[te]=Z[2*te]+(Z[2*te+1]<<8);W[15]&=32767}function L(W,Z,te){for(let F=0;F<16;F++)W[F]=Z[F]+te[F]}function V(W,Z,te){for(let F=0;F<16;F++)W[F]=Z[F]-te[F]}function I(W,Z,te){let F,ee,fe=0,xe=0,_e=0,Me=0,Ke=0,ze=0,Je=0,Xe=0,lt=0,Re=0,$e=0,st=0,Qe=0,ct=0,tt=0,He=0,at=0,pt=0,Ge=0,vt=0,bt=0,Ze=0,_t=0,Ct=0,It=0,er=0,dr=0,wt=0,lr=0,ir=0,Pt=0,Dt=te[0],Nt=te[1],dt=te[2],Lt=te[3],kt=te[4],ut=te[5],Vt=te[6],zt=te[7],ht=te[8],xt=te[9],Bt=te[10],Ve=te[11],$t=te[12],Et=te[13],ot=te[14],Ht=te[15];F=Z[0],fe+=F*Dt,xe+=F*Nt,_e+=F*dt,Me+=F*Lt,Ke+=F*kt,ze+=F*ut,Je+=F*Vt,Xe+=F*zt,lt+=F*ht,Re+=F*xt,$e+=F*Bt,st+=F*Ve,Qe+=F*$t,ct+=F*Et,tt+=F*ot,He+=F*Ht,F=Z[1],xe+=F*Dt,_e+=F*Nt,Me+=F*dt,Ke+=F*Lt,ze+=F*kt,Je+=F*ut,Xe+=F*Vt,lt+=F*zt,Re+=F*ht,$e+=F*xt,st+=F*Bt,Qe+=F*Ve,ct+=F*$t,tt+=F*Et,He+=F*ot,at+=F*Ht,F=Z[2],_e+=F*Dt,Me+=F*Nt,Ke+=F*dt,ze+=F*Lt,Je+=F*kt,Xe+=F*ut,lt+=F*Vt,Re+=F*zt,$e+=F*ht,st+=F*xt,Qe+=F*Bt,ct+=F*Ve,tt+=F*$t,He+=F*Et,at+=F*ot,pt+=F*Ht,F=Z[3],Me+=F*Dt,Ke+=F*Nt,ze+=F*dt,Je+=F*Lt,Xe+=F*kt,lt+=F*ut,Re+=F*Vt,$e+=F*zt,st+=F*ht,Qe+=F*xt,ct+=F*Bt,tt+=F*Ve,He+=F*$t,at+=F*Et,pt+=F*ot,Ge+=F*Ht,F=Z[4],Ke+=F*Dt,ze+=F*Nt,Je+=F*dt,Xe+=F*Lt,lt+=F*kt,Re+=F*ut,$e+=F*Vt,st+=F*zt,Qe+=F*ht,ct+=F*xt,tt+=F*Bt,He+=F*Ve,at+=F*$t,pt+=F*Et,Ge+=F*ot,vt+=F*Ht,F=Z[5],ze+=F*Dt,Je+=F*Nt,Xe+=F*dt,lt+=F*Lt,Re+=F*kt,$e+=F*ut,st+=F*Vt,Qe+=F*zt,ct+=F*ht,tt+=F*xt,He+=F*Bt,at+=F*Ve,pt+=F*$t,Ge+=F*Et,vt+=F*ot,bt+=F*Ht,F=Z[6],Je+=F*Dt,Xe+=F*Nt,lt+=F*dt,Re+=F*Lt,$e+=F*kt,st+=F*ut,Qe+=F*Vt,ct+=F*zt,tt+=F*ht,He+=F*xt,at+=F*Bt,pt+=F*Ve,Ge+=F*$t,vt+=F*Et,bt+=F*ot,Ze+=F*Ht,F=Z[7],Xe+=F*Dt,lt+=F*Nt,Re+=F*dt,$e+=F*Lt,st+=F*kt,Qe+=F*ut,ct+=F*Vt,tt+=F*zt,He+=F*ht,at+=F*xt,pt+=F*Bt,Ge+=F*Ve,vt+=F*$t,bt+=F*Et,Ze+=F*ot,_t+=F*Ht,F=Z[8],lt+=F*Dt,Re+=F*Nt,$e+=F*dt,st+=F*Lt,Qe+=F*kt,ct+=F*ut,tt+=F*Vt,He+=F*zt,at+=F*ht,pt+=F*xt,Ge+=F*Bt,vt+=F*Ve,bt+=F*$t,Ze+=F*Et,_t+=F*ot,Ct+=F*Ht,F=Z[9],Re+=F*Dt,$e+=F*Nt,st+=F*dt,Qe+=F*Lt,ct+=F*kt,tt+=F*ut,He+=F*Vt,at+=F*zt,pt+=F*ht,Ge+=F*xt,vt+=F*Bt,bt+=F*Ve,Ze+=F*$t,_t+=F*Et,Ct+=F*ot,It+=F*Ht,F=Z[10],$e+=F*Dt,st+=F*Nt,Qe+=F*dt,ct+=F*Lt,tt+=F*kt,He+=F*ut,at+=F*Vt,pt+=F*zt,Ge+=F*ht,vt+=F*xt,bt+=F*Bt,Ze+=F*Ve,_t+=F*$t,Ct+=F*Et,It+=F*ot,er+=F*Ht,F=Z[11],st+=F*Dt,Qe+=F*Nt,ct+=F*dt,tt+=F*Lt,He+=F*kt,at+=F*ut,pt+=F*Vt,Ge+=F*zt,vt+=F*ht,bt+=F*xt,Ze+=F*Bt,_t+=F*Ve,Ct+=F*$t,It+=F*Et,er+=F*ot,dr+=F*Ht,F=Z[12],Qe+=F*Dt,ct+=F*Nt,tt+=F*dt,He+=F*Lt,at+=F*kt,pt+=F*ut,Ge+=F*Vt,vt+=F*zt,bt+=F*ht,Ze+=F*xt,_t+=F*Bt,Ct+=F*Ve,It+=F*$t,er+=F*Et,dr+=F*ot,wt+=F*Ht,F=Z[13],ct+=F*Dt,tt+=F*Nt,He+=F*dt,at+=F*Lt,pt+=F*kt,Ge+=F*ut,vt+=F*Vt,bt+=F*zt,Ze+=F*ht,_t+=F*xt,Ct+=F*Bt,It+=F*Ve,er+=F*$t,dr+=F*Et,wt+=F*ot,lr+=F*Ht,F=Z[14],tt+=F*Dt,He+=F*Nt,at+=F*dt,pt+=F*Lt,Ge+=F*kt,vt+=F*ut,bt+=F*Vt,Ze+=F*zt,_t+=F*ht,Ct+=F*xt,It+=F*Bt,er+=F*Ve,dr+=F*$t,wt+=F*Et,lr+=F*ot,ir+=F*Ht,F=Z[15],He+=F*Dt,at+=F*Nt,pt+=F*dt,Ge+=F*Lt,vt+=F*kt,bt+=F*ut,Ze+=F*Vt,_t+=F*zt,Ct+=F*ht,It+=F*xt,er+=F*Bt,dr+=F*Ve,wt+=F*$t,lr+=F*Et,ir+=F*ot,Pt+=F*Ht,fe+=38*at,xe+=38*pt,_e+=38*Ge,Me+=38*vt,Ke+=38*bt,ze+=38*Ze,Je+=38*_t,Xe+=38*Ct,lt+=38*It,Re+=38*er,$e+=38*dr,st+=38*wt,Qe+=38*lr,ct+=38*ir,tt+=38*Pt,ee=1,F=fe+ee+65535,ee=Math.floor(F/65536),fe=F-ee*65536,F=xe+ee+65535,ee=Math.floor(F/65536),xe=F-ee*65536,F=_e+ee+65535,ee=Math.floor(F/65536),_e=F-ee*65536,F=Me+ee+65535,ee=Math.floor(F/65536),Me=F-ee*65536,F=Ke+ee+65535,ee=Math.floor(F/65536),Ke=F-ee*65536,F=ze+ee+65535,ee=Math.floor(F/65536),ze=F-ee*65536,F=Je+ee+65535,ee=Math.floor(F/65536),Je=F-ee*65536,F=Xe+ee+65535,ee=Math.floor(F/65536),Xe=F-ee*65536,F=lt+ee+65535,ee=Math.floor(F/65536),lt=F-ee*65536,F=Re+ee+65535,ee=Math.floor(F/65536),Re=F-ee*65536,F=$e+ee+65535,ee=Math.floor(F/65536),$e=F-ee*65536,F=st+ee+65535,ee=Math.floor(F/65536),st=F-ee*65536,F=Qe+ee+65535,ee=Math.floor(F/65536),Qe=F-ee*65536,F=ct+ee+65535,ee=Math.floor(F/65536),ct=F-ee*65536,F=tt+ee+65535,ee=Math.floor(F/65536),tt=F-ee*65536,F=He+ee+65535,ee=Math.floor(F/65536),He=F-ee*65536,fe+=ee-1+37*(ee-1),ee=1,F=fe+ee+65535,ee=Math.floor(F/65536),fe=F-ee*65536,F=xe+ee+65535,ee=Math.floor(F/65536),xe=F-ee*65536,F=_e+ee+65535,ee=Math.floor(F/65536),_e=F-ee*65536,F=Me+ee+65535,ee=Math.floor(F/65536),Me=F-ee*65536,F=Ke+ee+65535,ee=Math.floor(F/65536),Ke=F-ee*65536,F=ze+ee+65535,ee=Math.floor(F/65536),ze=F-ee*65536,F=Je+ee+65535,ee=Math.floor(F/65536),Je=F-ee*65536,F=Xe+ee+65535,ee=Math.floor(F/65536),Xe=F-ee*65536,F=lt+ee+65535,ee=Math.floor(F/65536),lt=F-ee*65536,F=Re+ee+65535,ee=Math.floor(F/65536),Re=F-ee*65536,F=$e+ee+65535,ee=Math.floor(F/65536),$e=F-ee*65536,F=st+ee+65535,ee=Math.floor(F/65536),st=F-ee*65536,F=Qe+ee+65535,ee=Math.floor(F/65536),Qe=F-ee*65536,F=ct+ee+65535,ee=Math.floor(F/65536),ct=F-ee*65536,F=tt+ee+65535,ee=Math.floor(F/65536),tt=F-ee*65536,F=He+ee+65535,ee=Math.floor(F/65536),He=F-ee*65536,fe+=ee-1+37*(ee-1),W[0]=fe,W[1]=xe,W[2]=_e,W[3]=Me,W[4]=Ke,W[5]=ze,W[6]=Je,W[7]=Xe,W[8]=lt,W[9]=Re,W[10]=$e,W[11]=st,W[12]=Qe,W[13]=ct,W[14]=tt,W[15]=He}function U(W,Z){I(W,Z,Z)}function ie(W,Z){const te=i();let F;for(F=0;F<16;F++)te[F]=Z[F];for(F=253;F>=0;F--)U(te,te),F!==2&&F!==4&&I(te,te,Z);for(F=0;F<16;F++)W[F]=te[F]}function ae(W,Z){const te=i();let F;for(F=0;F<16;F++)te[F]=Z[F];for(F=250;F>=0;F--)U(te,te),F!==1&&I(te,te,Z);for(F=0;F<16;F++)W[F]=te[F]}function K(W,Z){const te=i(),F=i(),ee=i(),fe=i(),xe=i(),_e=i(),Me=i(),Ke=i(),ze=i();V(te,W[1],W[0]),V(ze,Z[1],Z[0]),I(te,te,ze),L(F,W[0],W[1]),L(ze,Z[0],Z[1]),I(F,F,ze),I(ee,W[3],Z[3]),I(ee,ee,l),I(fe,W[2],Z[2]),L(fe,fe,fe),V(xe,F,te),V(_e,fe,ee),L(Me,fe,ee),L(Ke,F,te),I(W[0],xe,_e),I(W[1],Ke,Me),I(W[2],Me,_e),I(W[3],xe,Ke)}function R(W,Z,te){for(let F=0;F<4;F++)m(W[F],Z[F],te)}function D(W,Z){const te=i(),F=i(),ee=i();ie(ee,Z[2]),I(te,Z[0],ee),I(F,Z[1],ee),S(W,F),W[31]^=P(te)<<7}function v(W,Z,te){g(W[0],o),g(W[1],a),g(W[2],a),g(W[3],o);for(let F=255;F>=0;--F){const ee=te[F/8|0]>>(F&7)&1;R(W,Z,ee),K(Z,W),K(W,W),R(W,Z,ee)}}function b(W,Z){const te=[i(),i(),i(),i()];g(te[0],f),g(te[1],u),g(te[2],a),I(te[3],f,u),v(W,te,Z)}function M(W){if(W.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const Z=(0,r.hash)(W);Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(32),F=[i(),i(),i(),i()];b(F,Z),D(te,F);const ee=new Uint8Array(64);return ee.set(W),ee.set(te,32),{publicKey:te,secretKey:ee}}t.generateKeyPairFromSeed=M;function B(W){const Z=(0,e.randomBytes)(32,W),te=M(Z);return(0,n.wipe)(Z),te}t.generateKeyPair=B;function x(W){if(W.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(W.subarray(32))}t.extractPublicKeyFromSecretKey=x;const C=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function w(W,Z){let te,F,ee,fe;for(F=63;F>=32;--F){for(te=0,ee=F-32,fe=F-12;ee>4)*C[ee],te=Z[ee]>>8,Z[ee]&=255;for(ee=0;ee<32;ee++)Z[ee]-=te*C[ee];for(F=0;F<32;F++)Z[F+1]+=Z[F]>>8,W[F]=Z[F]&255}function k(W){const Z=new Float64Array(64);for(let te=0;te<64;te++)Z[te]=W[te];for(let te=0;te<64;te++)W[te]=0;w(W,Z)}function O(W,Z){const te=new Float64Array(64),F=[i(),i(),i(),i()],ee=(0,r.hash)(W.subarray(0,32));ee[0]&=248,ee[31]&=127,ee[31]|=64;const fe=new Uint8Array(64);fe.set(ee.subarray(32),32);const xe=new r.SHA512;xe.update(fe.subarray(32)),xe.update(Z);const _e=xe.digest();xe.clean(),k(_e),b(F,_e),D(fe,F),xe.reset(),xe.update(fe.subarray(0,32)),xe.update(W.subarray(32)),xe.update(Z);const Me=xe.digest();k(Me);for(let Ke=0;Ke<32;Ke++)te[Ke]=_e[Ke];for(let Ke=0;Ke<32;Ke++)for(let ze=0;ze<32;ze++)te[Ke+ze]+=Me[Ke]*ee[ze];return w(fe.subarray(32),te),fe}t.sign=O;function G(W,Z){const te=i(),F=i(),ee=i(),fe=i(),xe=i(),_e=i(),Me=i();return g(W[2],a),N(W[1],Z),U(ee,W[1]),I(fe,ee,c),V(ee,ee,W[2]),L(fe,W[2],fe),U(xe,fe),U(_e,xe),I(Me,_e,xe),I(te,Me,ee),I(te,te,fe),ae(te,te),I(te,te,ee),I(te,te,fe),I(te,te,fe),I(W[0],te,fe),U(F,W[0]),I(F,F,fe),A(F,ee)&&I(W[0],W[0],h),U(F,W[0]),I(F,F,fe),A(F,ee)?-1:(P(W[0])===Z[31]>>7&&V(W[0],o,W[0]),I(W[3],W[0],W[1]),0)}function oe(W,Z,te){const F=new Uint8Array(32),ee=[i(),i(),i(),i()],fe=[i(),i(),i(),i()];if(te.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(G(fe,W))return!1;const xe=new r.SHA512;xe.update(te.subarray(0,32)),xe.update(W),xe.update(Z);const _e=xe.digest();return k(_e),v(ee,fe,_e),b(fe,te.subarray(32)),K(ee,fe),D(F,ee),!E(te,F)}t.verify=oe;function $(W){let Z=[i(),i(),i(),i()];if(G(Z,W))throw new Error("Ed25519: invalid public key");let te=i(),F=i(),ee=Z[1];L(te,a,ee),V(F,a,ee),ie(F,F),I(te,te,F);let fe=new Uint8Array(32);return S(fe,te),fe}t.convertPublicKeyToX25519=$;function X(W){const Z=(0,r.hash)(W.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(Z.subarray(0,32));return(0,n.wipe)(Z),te}t.convertSecretKeyToX25519=X})(AO);const wNe="EdDSA",xNe="JWT",r8=".",AC="base64url",wne="utf8",xne="utf8",ENe=":",CNe="did",ANe="key",tq="base58btc",SNe="z",_Ne="K36",INe=32,TNe=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),PNe=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function cp(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return PNe(t)}catch{return t}}function Uu(t){return typeof t=="string"?t:TNe(t)||""}function rq(t){return cp(ji(Ni(t,AC),wne))}function n8(t){return ji(Ni(Uu(t),wne),AC)}function Ene(t){const e=Ni(_Ne,tq),r=SNe+ji(C5([e,t]),tq);return[CNe,ANe,r].join(ENe)}function kNe(t){return ji(t,AC)}function RNe(t){return Ni(t,AC)}function MNe(t){return Ni([n8(t.header),n8(t.payload)].join(r8),xne)}function ONe(t){return[n8(t.header),n8(t.payload),kNe(t.signature)].join(r8)}function kT(t){const e=t.split(r8),r=rq(e[0]),n=rq(e[1]),i=RNe(e[2]),s=Ni(e.slice(0,2).join(r8),xne);return{header:r,payload:n,signature:i,data:s}}function nq(t=e0.randomBytes(INe)){return AO.generateKeyPairFromSeed(t)}async function DNe(t,e,r,n,i=it.fromMiliseconds(Date.now())){const s={alg:wNe,typ:xNe},o=Ene(n.publicKey),a=i+r,c={iss:o,sub:t,aud:e,iat:i,exp:a},l=MNe({header:s,payload:c}),f=AO.sign(n.secretKey,l);return ONe({header:s,payload:c,signature:f})}const NNe={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var BNe={};const LNe=":";function xg(t){const[e,r]=t.split(LNe);return{namespace:e,reference:r}}function iq(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.accounts)}),r}function Cne(t,e){return t.includes(":")?[t]:e.chains||[]}var FNe=Object.defineProperty,sq=Object.getOwnPropertySymbols,jNe=Object.prototype.hasOwnProperty,UNe=Object.prototype.propertyIsEnumerable,oq=(t,e,r)=>e in t?FNe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,aq=(t,e)=>{for(var r in e||(e={}))jNe.call(e,r)&&oq(t,r,e[r]);if(sq)for(var r of sq(e))UNe.call(e,r)&&oq(t,r,e[r]);return t};const $Ne="ReactNative",la={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},qNe="js";function i8(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Em(){return!vx()&&!!sO()&&navigator.product===$Ne}function Ex(){return!i8()&&!!sO()&&!!vx()}function Cx(){return Em()?la.reactNative:i8()?la.node:Ex()?la.browser:la.unknown}function VNe(){var t;try{return Em()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function zNe(t,e){let r=uw.parse(t);return r=aq(aq({},r),e),t=uw.stringify(r),t}function Ane(){return bre()||{name:"",description:"",url:"",icons:[""]}}function HNe(){if(Cx()===la.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=$Pe();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function GNe(){var t;const e=Cx();return e===la.browser?[e,((t=mre())==null?void 0:t.host)||"unknown"].join(":"):e}function Sne(t,e,r){const n=HNe(),i=GNe();return[[t,e].join("-"),[qNe,r].join("-"),n,i].join("/")}function WNe({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const c=r.split("?"),l=Sne(t,e,n),f={auth:i,ua:l,projectId:s,useOnCloseEvent:o||void 0,origin:a||void 0},u=zNe(c[1]||"",f);return c[0]+"?"+u}function n1(t,e){return t.filter(r=>e.includes(r)).length===t.length}function _ne(t){return Object.fromEntries(t.entries())}function Ine(t){return new Map(Object.entries(t))}function j0(t=it.FIVE_MINUTES,e){const r=it.toMiliseconds(t||it.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Eg(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Tne(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.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: ${t}`)}function KNe(t){return Tne("topic",t)}function YNe(t){return Tne("id",t)}function Pne(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function mi(t,e){return it.fromMiliseconds(Date.now()+it.toMiliseconds(t))}function Id(t){return Date.now()>=it.toMiliseconds(t)}function Sr(t,e){return`${t}${e?`:${e}`:""}`}function A5(t=[],e=[]){return[...new Set([...t,...e])]}async function QNe({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=JNe(s,t,e),a=Cx();if(a===la.browser){if(!((n=vx())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,XNe()?"_blank":"_self","noreferrer noopener")}else a===la.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function JNe(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${eBe(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function ZNe(t,e){let r="";try{if(Ex()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function cq(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function lq(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function SO(){return typeof process<"u"&&BNe.IS_VITEST==="true"}function XNe(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function eBe(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function kne(t){return Buffer.from(t,"base64").toString("utf-8")}const tBe="https://rpc.walletconnect.org/v1";async function rBe(t,e,r,n,i,s){switch(r.t){case"eip191":return nBe(t,e,r.s);case"eip1271":return await iBe(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function nBe(t,e,r){return GMe(Are(e),r).toLowerCase()===t.toLowerCase()}async function iBe(t,e,r,n,i,s){const o=xg(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",f=r.substring(2),u=Are(e).substring(2),h=a+u+c+l+f,g=await fetch(`${s||tBe}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:sBe(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:h},"latest"]})}),{result:y}=await g.json();return y?y.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function sBe(){return Date.now()+Math.floor(Math.random()*1e3)}var oBe=Object.defineProperty,aBe=Object.defineProperties,cBe=Object.getOwnPropertyDescriptors,fq=Object.getOwnPropertySymbols,lBe=Object.prototype.hasOwnProperty,fBe=Object.prototype.propertyIsEnumerable,uq=(t,e,r)=>e in t?oBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uBe=(t,e)=>{for(var r in e||(e={}))lBe.call(e,r)&&uq(t,r,e[r]);if(fq)for(var r of fq(e))fBe.call(e,r)&&uq(t,r,e[r]);return t},dBe=(t,e)=>aBe(t,cBe(e));const hBe="did:pkh:",_O=t=>t==null?void 0:t.split(":"),pBe=t=>{const e=t&&_O(t);if(e)return t.includes(hBe)?e[3]:e[1]},RT=t=>{const e=t&&_O(t);if(e)return e[2]+":"+e[3]},s8=t=>{const e=t&&_O(t);if(e)return e.pop()};async function dq(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=Rne(i,i.iss),o=s8(i.iss);return await rBe(o,s,n,RT(i.iss),r)}const Rne=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=s8(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${pBe(e)}`,c=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.exp?`Expiration Time: ${t.exp}`:void 0,u=t.nbf?`Not Before: ${t.nbf}`:void 0,h=t.requestId?`Request ID: ${t.requestId}`:void 0,g=t.resources?`Resources:${t.resources.map(m=>` + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=xi:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,c=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),f=[31,7936,2031616,520093696],u=[4,1024,262144,67108864],h=[1,256,65536,16777216],g=[6,1536,393216,100663296],y=[0,8,16,24],m=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],S=[224,256,384,512],E=[128,256],A=["hex","buffer","arrayBuffer","array","digest"],P={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function($){return Object.prototype.toString.call($)==="[object Array]"}),c&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function($){return typeof $=="object"&&$.buffer&&$.buffer.constructor===ArrayBuffer});for(var N=function($,X,W){return function(Z){return new O($,X,$).update(Z)[W]()}},L=function($,X,W){return function(Z,te){return new O($,X,te).update(Z)[W]()}},V=function($,X,W){return function(Z,te,F,ee){return v["cshake"+$].update(Z,te,F,ee)[W]()}},I=function($,X,W){return function(Z,te,F,ee){return v["kmac"+$].update(Z,te,F,ee)[W]()}},U=function($,X,W,Z){for(var te=0;te>5,this.byteCount=this.blockCount<<2,this.outputBlocks=W>>5,this.extraBytes=(W&31)>>3;for(var Z=0;Z<50;++Z)this.s[Z]=0}O.prototype.update=function($){if(this.finalized)throw new Error(r);var X,W=typeof $;if(W!=="string"){if(W==="object"){if($===null)throw new Error(e);if(c&&$.constructor===ArrayBuffer)$=new Uint8Array($);else if(!Array.isArray($)&&(!c||!ArrayBuffer.isView($)))throw new Error(e)}else throw new Error(e);X=!0}for(var Z=this.blocks,te=this.byteCount,F=$.length,ee=this.blockCount,fe=0,xe=this.s,_e,Me;fe>2]|=$[fe]<>2]|=Me<>2]|=(192|Me>>6)<>2]|=(128|Me&63)<=57344?(Z[_e>>2]|=(224|Me>>12)<>2]|=(128|Me>>6&63)<>2]|=(128|Me&63)<>2]|=(240|Me>>18)<>2]|=(128|Me>>12&63)<>2]|=(128|Me>>6&63)<>2]|=(128|Me&63)<=te){for(this.start=_e-te,this.block=Z[ee],_e=0;_e>8,W=$&255;W>0;)te.unshift(W),$=$>>8,W=$&255,++Z;return X?te.push(Z):te.unshift(Z),this.update(te),te.length},O.prototype.encodeString=function($){var X,W=typeof $;if(W!=="string"){if(W==="object"){if($===null)throw new Error(e);if(c&&$.constructor===ArrayBuffer)$=new Uint8Array($);else if(!Array.isArray($)&&(!c||!ArrayBuffer.isView($)))throw new Error(e)}else throw new Error(e);X=!0}var Z=0,te=$.length;if(X)Z=te;else for(var F=0;F<$.length;++F){var ee=$.charCodeAt(F);ee<128?Z+=1:ee<2048?Z+=2:ee<55296||ee>=57344?Z+=3:(ee=65536+((ee&1023)<<10|$.charCodeAt(++F)&1023),Z+=4)}return Z+=this.encode(Z*8),this.update($),Z},O.prototype.bytepad=function($,X){for(var W=this.encode(X),Z=0;Z<$.length;++Z)W+=this.encodeString($[Z]);var te=X-W%X,F=[];return F.length=te,this.update(F),this},O.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var $=this.blocks,X=this.lastByteIndex,W=this.blockCount,Z=this.s;if($[X>>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for($[0]=$[W],X=1;X>4&15]+l[fe&15]+l[fe>>12&15]+l[fe>>8&15]+l[fe>>20&15]+l[fe>>16&15]+l[fe>>28&15]+l[fe>>24&15];F%$===0&&(oe(X),te=0)}return Z&&(fe=X[te],ee+=l[fe>>4&15]+l[fe&15],Z>1&&(ee+=l[fe>>12&15]+l[fe>>8&15]),Z>2&&(ee+=l[fe>>20&15]+l[fe>>16&15])),ee},O.prototype.arrayBuffer=function(){this.finalize();var $=this.blockCount,X=this.s,W=this.outputBlocks,Z=this.extraBytes,te=0,F=0,ee=this.outputBits>>3,fe;Z?fe=new ArrayBuffer(W+1<<2):fe=new ArrayBuffer(ee);for(var xe=new Uint32Array(fe);F>8&255,ee[fe+2]=xe>>16&255,ee[fe+3]=xe>>24&255;F%$===0&&oe(X)}return Z&&(fe=F<<2,xe=X[te],ee[fe]=xe&255,Z>1&&(ee[fe+1]=xe>>8&255),Z>2&&(ee[fe+2]=xe>>16&255)),ee};function G($,X,W){O.call(this,$,X,W)}G.prototype=new O,G.prototype.finalize=function(){return this.encode(this.outputBits,!0),O.prototype.finalize.call(this)};var oe=function($){var X,W,Z,te,F,ee,fe,xe,_e,Me,Ke,ze,Je,Xe,lt,Re,$e,st,Qe,ct,tt,He,at,pt,Ge,vt,bt,Ze,_t,Ct,It,er,dr,wt,lr,ir,Pt,Dt,Nt,dt,Lt,kt,ut,zt,Ht,ht,xt,Bt,Ve,$t,Et,ot,Gt,Nr,Ut,Pr,tr,Or,pi,vi,gi,_i,Tn;for(Z=0;Z<48;Z+=2)te=$[0]^$[10]^$[20]^$[30]^$[40],F=$[1]^$[11]^$[21]^$[31]^$[41],ee=$[2]^$[12]^$[22]^$[32]^$[42],fe=$[3]^$[13]^$[23]^$[33]^$[43],xe=$[4]^$[14]^$[24]^$[34]^$[44],_e=$[5]^$[15]^$[25]^$[35]^$[45],Me=$[6]^$[16]^$[26]^$[36]^$[46],Ke=$[7]^$[17]^$[27]^$[37]^$[47],ze=$[8]^$[18]^$[28]^$[38]^$[48],Je=$[9]^$[19]^$[29]^$[39]^$[49],X=ze^(ee<<1|fe>>>31),W=Je^(fe<<1|ee>>>31),$[0]^=X,$[1]^=W,$[10]^=X,$[11]^=W,$[20]^=X,$[21]^=W,$[30]^=X,$[31]^=W,$[40]^=X,$[41]^=W,X=te^(xe<<1|_e>>>31),W=F^(_e<<1|xe>>>31),$[2]^=X,$[3]^=W,$[12]^=X,$[13]^=W,$[22]^=X,$[23]^=W,$[32]^=X,$[33]^=W,$[42]^=X,$[43]^=W,X=ee^(Me<<1|Ke>>>31),W=fe^(Ke<<1|Me>>>31),$[4]^=X,$[5]^=W,$[14]^=X,$[15]^=W,$[24]^=X,$[25]^=W,$[34]^=X,$[35]^=W,$[44]^=X,$[45]^=W,X=xe^(ze<<1|Je>>>31),W=_e^(Je<<1|ze>>>31),$[6]^=X,$[7]^=W,$[16]^=X,$[17]^=W,$[26]^=X,$[27]^=W,$[36]^=X,$[37]^=W,$[46]^=X,$[47]^=W,X=Me^(te<<1|F>>>31),W=Ke^(F<<1|te>>>31),$[8]^=X,$[9]^=W,$[18]^=X,$[19]^=W,$[28]^=X,$[29]^=W,$[38]^=X,$[39]^=W,$[48]^=X,$[49]^=W,Xe=$[0],lt=$[1],ht=$[11]<<4|$[10]>>>28,xt=$[10]<<4|$[11]>>>28,Ze=$[20]<<3|$[21]>>>29,_t=$[21]<<3|$[20]>>>29,vi=$[31]<<9|$[30]>>>23,gi=$[30]<<9|$[31]>>>23,kt=$[40]<<18|$[41]>>>14,ut=$[41]<<18|$[40]>>>14,wt=$[2]<<1|$[3]>>>31,lr=$[3]<<1|$[2]>>>31,Re=$[13]<<12|$[12]>>>20,$e=$[12]<<12|$[13]>>>20,Bt=$[22]<<10|$[23]>>>22,Ve=$[23]<<10|$[22]>>>22,Ct=$[33]<<13|$[32]>>>19,It=$[32]<<13|$[33]>>>19,_i=$[42]<<2|$[43]>>>30,Tn=$[43]<<2|$[42]>>>30,Nr=$[5]<<30|$[4]>>>2,Ut=$[4]<<30|$[5]>>>2,ir=$[14]<<6|$[15]>>>26,Pt=$[15]<<6|$[14]>>>26,st=$[25]<<11|$[24]>>>21,Qe=$[24]<<11|$[25]>>>21,$t=$[34]<<15|$[35]>>>17,Et=$[35]<<15|$[34]>>>17,er=$[45]<<29|$[44]>>>3,dr=$[44]<<29|$[45]>>>3,pt=$[6]<<28|$[7]>>>4,Ge=$[7]<<28|$[6]>>>4,Pr=$[17]<<23|$[16]>>>9,tr=$[16]<<23|$[17]>>>9,Dt=$[26]<<25|$[27]>>>7,Nt=$[27]<<25|$[26]>>>7,ct=$[36]<<21|$[37]>>>11,tt=$[37]<<21|$[36]>>>11,ot=$[47]<<24|$[46]>>>8,Gt=$[46]<<24|$[47]>>>8,zt=$[8]<<27|$[9]>>>5,Ht=$[9]<<27|$[8]>>>5,vt=$[18]<<20|$[19]>>>12,bt=$[19]<<20|$[18]>>>12,Or=$[29]<<7|$[28]>>>25,pi=$[28]<<7|$[29]>>>25,dt=$[38]<<8|$[39]>>>24,Lt=$[39]<<8|$[38]>>>24,He=$[48]<<14|$[49]>>>18,at=$[49]<<14|$[48]>>>18,$[0]=Xe^~Re&st,$[1]=lt^~$e&Qe,$[10]=pt^~vt&Ze,$[11]=Ge^~bt&_t,$[20]=wt^~ir&Dt,$[21]=lr^~Pt&Nt,$[30]=zt^~ht&Bt,$[31]=Ht^~xt&Ve,$[40]=Nr^~Pr&Or,$[41]=Ut^~tr&pi,$[2]=Re^~st&ct,$[3]=$e^~Qe&tt,$[12]=vt^~Ze&Ct,$[13]=bt^~_t&It,$[22]=ir^~Dt&dt,$[23]=Pt^~Nt&Lt,$[32]=ht^~Bt&$t,$[33]=xt^~Ve&Et,$[42]=Pr^~Or&vi,$[43]=tr^~pi&gi,$[4]=st^~ct&He,$[5]=Qe^~tt&at,$[14]=Ze^~Ct&er,$[15]=_t^~It&dr,$[24]=Dt^~dt&kt,$[25]=Nt^~Lt&ut,$[34]=Bt^~$t&ot,$[35]=Ve^~Et&Gt,$[44]=Or^~vi&_i,$[45]=pi^~gi&Tn,$[6]=ct^~He&Xe,$[7]=tt^~at<,$[16]=Ct^~er&pt,$[17]=It^~dr&Ge,$[26]=dt^~kt&wt,$[27]=Lt^~ut&lr,$[36]=$t^~ot&zt,$[37]=Et^~Gt&Ht,$[46]=vi^~_i&Nr,$[47]=gi^~Tn&Ut,$[8]=He^~Xe&Re,$[9]=at^~lt&$e,$[18]=er^~pt&vt,$[19]=dr^~Ge&bt,$[28]=kt^~wt&ir,$[29]=ut^~lr&Pt,$[38]=ot^~zt&ht,$[39]=Gt^~Ht&xt,$[48]=_i^~Nr&Pr,$[49]=Tn^~Ut&tr,$[0]^=m[Z],$[1]^=m[Z+1]};if(a)t.exports=v;else for(M=0;M{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const R$=$ke();var mT;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(mT||(mT={}));var Mc;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Mc||(Mc={}));const M$="0123456789abcdef";class Cn{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();w5[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(k$>w5[n])&&console.log.apply(console,r)}debug(...e){this._log(Cn.levels.DEBUG,e)}info(...e){this._log(Cn.levels.INFO,e)}warn(...e){this._log(Cn.levels.WARNING,e)}makeError(e,r,n){if(P$)return this.makeError("censored error",r,{});r||(r=Cn.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(c=>{const l=n[c];try{if(l instanceof Uint8Array){let f="";for(let u=0;u>4],f+=M$[l[u]&15];i.push(c+"=Uint8Array(0x"+f+")")}else i.push(c+"="+JSON.stringify(l))}catch{i.push(c+"="+JSON.stringify(n[c].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case Mc.NUMERIC_FAULT:{o="NUMERIC_FAULT";const c=e;switch(c){case"overflow":case"underflow":case"division-by-zero":o+="-"+c;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Mc.CALL_EXCEPTION:case Mc.INSUFFICIENT_FUNDS:case Mc.MISSING_NEW:case Mc.NONCE_EXPIRED:case Mc.REPLACEMENT_UNDERPRICED:case Mc.TRANSACTION_REPLACED:case Mc.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(c){a[c]=n[c]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,Cn.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){R$&&this.throwError("platform missing String.prototype.normalize",Cn.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:R$})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,Cn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,Cn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,Cn.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",Cn.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Cn.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Cn.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return zS||(zS=new Cn(Uke)),zS}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Cn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),T$){if(!e)return;this.globalLogger().throwError("error censorship permanent",Cn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}P$=!!e,T$=!!r}static setLogLevel(e){const r=w5[e.toLowerCase()];if(r==null){Cn.globalLogger().warn("invalid log level - "+e);return}k$=r}static from(e){return new Cn(e)}}Cn.errors=Mc;Cn.levels=mT;const qke="bytes/5.7.0",Xn=new Cn(qke);function Ere(t){return!!t.toHexString}function bg(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return bg(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Vke(t){return Wl(t)&&!(t.length%2)||aO(t)}function O$(t){return typeof t=="number"&&t==t&&t%1===0}function aO(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!O$(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function ui(t,e){if(e||(e={}),typeof t=="number"){Xn.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),bg(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Ere(t)&&(t=t.toHexString()),Wl(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":Xn.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;iui(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),bg(n)}function Hke(t,e){t=ui(t),t.length>e&&Xn.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),bg(r)}function Wl(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const HS="0123456789abcdef";function ra(t,e){if(e||(e={}),typeof t=="number"){Xn.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=HS[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Ere(t))return t.toHexString();if(Wl(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Xn.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(aO(t)){let r="0x";for(let n=0;n>4]+HS[i&15]}return r}return Xn.throwArgumentError("invalid hexlify value","value",t)}function Gke(t){if(typeof t!="string")t=ra(t);else if(!Wl(t)||t.length%2)return null;return(t.length-2)/2}function D$(t,e,r){return typeof t!="string"?t=ra(t):(!Wl(t)||t.length%2)&&Xn.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function wg(t,e){for(typeof t!="string"?t=ra(t):Wl(t)||Xn.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Xn.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Cre(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Vke(t)){let r=ui(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=ra(r.slice(0,32)),e.s=ra(r.slice(32,64))):r.length===65?(e.r=ra(r.slice(0,32)),e.s=ra(r.slice(32,64)),e.v=r[64]):Xn.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:Xn.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=ra(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=Hke(ui(e._vs),32);e._vs=ra(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Xn.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=ra(i);e.s==null?e.s=o:e.s!==o&&Xn.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?Xn.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Xn.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Wl(e.r)?Xn.throwArgumentError("signature missing or invalid r","signature",t):e.r=wg(e.r,32),e.s==null||!Wl(e.s)?Xn.throwArgumentError("signature missing or invalid s","signature",t):e.s=wg(e.s,32);const r=ui(e.s);r[0]>=128&&Xn.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=ra(r);e._vs&&(Wl(e._vs)||Xn.throwArgumentError("signature invalid _vs","signature",t),e._vs=wg(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&Xn.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function cO(t){return"0x"+jke.keccak_256(ui(t))}var lO={exports:{}};const Wke={},Kke=Object.freeze(Object.defineProperty({__proto__:null,default:Wke},Symbol.toStringTag,{value:"Module"})),oC=JV(Kke);lO.exports;(function(t){(function(e,r){function n(D,v){if(!D)throw new Error(v||"Assertion failed")}function i(D,v){D.super_=v;var b=function(){};b.prototype=v.prototype,D.prototype=new b,D.prototype.constructor=D}function s(D,v,b){if(s.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((v==="le"||v==="be")&&(b=v,v=10),this._init(D||0,v||10,b||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=oC.Buffer}catch{}s.isBN=function(v){return v instanceof s?!0:v!==null&&typeof v=="object"&&v.constructor.wordSize===s.wordSize&&Array.isArray(v.words)},s.max=function(v,b){return v.cmp(b)>0?v:b},s.min=function(v,b){return v.cmp(b)<0?v:b},s.prototype._init=function(v,b,M){if(typeof v=="number")return this._initNumber(v,b,M);if(typeof v=="object")return this._initArray(v,b,M);b==="hex"&&(b=16),n(b===(b|0)&&b>=2&&b<=36),v=v.toString().replace(/\s+/g,"");var B=0;v[0]==="-"&&(B++,this.negative=1),B=0;B-=3)C=v[B]|v[B-1]<<8|v[B-2]<<16,this.words[x]|=C<>>26-w&67108863,w+=24,w>=26&&(w-=26,x++);else if(M==="le")for(B=0,x=0;B>>26-w&67108863,w+=24,w>=26&&(w-=26,x++);return this._strip()};function a(D,v){var b=D.charCodeAt(v);if(b>=48&&b<=57)return b-48;if(b>=65&&b<=70)return b-55;if(b>=97&&b<=102)return b-87;n(!1,"Invalid character in "+D)}function c(D,v,b){var M=a(D,b);return b-1>=v&&(M|=a(D,b-1)<<4),M}s.prototype._parseHex=function(v,b,M){this.length=Math.ceil((v.length-b)/6),this.words=new Array(this.length);for(var B=0;B=b;B-=2)w=c(v,b,B)<=18?(x-=18,C+=1,this.words[C]|=w>>>26):x+=8;else{var k=v.length-b;for(B=k%2===0?b+1:b;B=18?(x-=18,C+=1,this.words[C]|=w>>>26):x+=8}this._strip()};function l(D,v,b,M){for(var B=0,x=0,C=Math.min(D.length,b),w=v;w=49?x=k-49+10:k>=17?x=k-17+10:x=k,n(k>=0&&x1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?""}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],g=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(v,b){v=v||10,b=b|0||1;var M;if(v===16||v==="hex"){M="";for(var B=0,x=0,C=0;C>>24-B&16777215,B+=2,B>=26&&(B-=26,C--),x!==0||C!==this.length-1?M=h[6-k.length]+k+M:M=k+M}for(x!==0&&(M=x.toString(16)+M);M.length%b!==0;)M="0"+M;return this.negative!==0&&(M="-"+M),M}if(v===(v|0)&&v>=2&&v<=36){var O=g[v],G=y[v];M="";var oe=this.clone();for(oe.negative=0;!oe.isZero();){var $=oe.modrn(G).toString(v);oe=oe.idivn(G),oe.isZero()?M=$+M:M=h[O-$.length]+$+M}for(this.isZero()&&(M="0"+M);M.length%b!==0;)M="0"+M;return this.negative!==0&&(M="-"+M),M}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(v,b){return this.toArrayLike(o,v,b)}),s.prototype.toArray=function(v,b){return this.toArrayLike(Array,v,b)};var m=function(v,b){return v.allocUnsafe?v.allocUnsafe(b):new v(b)};s.prototype.toArrayLike=function(v,b,M){this._strip();var B=this.byteLength(),x=M||Math.max(1,B);n(B<=x,"byte array longer than desired length"),n(x>0,"Requested array length <= 0");var C=m(v,x),w=b==="le"?"LE":"BE";return this["_toArrayLike"+w](C,B),C},s.prototype._toArrayLikeLE=function(v,b){for(var M=0,B=0,x=0,C=0;x>8&255),M>16&255),C===6?(M>24&255),B=0,C=0):(B=w>>>24,C+=2)}if(M=0&&(v[M--]=w>>8&255),M>=0&&(v[M--]=w>>16&255),C===6?(M>=0&&(v[M--]=w>>24&255),B=0,C=0):(B=w>>>24,C+=2)}if(M>=0)for(v[M--]=B;M>=0;)v[M--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var b=v,M=0;return b>=4096&&(M+=13,b>>>=13),b>=64&&(M+=7,b>>>=7),b>=8&&(M+=4,b>>>=4),b>=2&&(M+=2,b>>>=2),M+b},s.prototype._zeroBits=function(v){if(v===0)return 26;var b=v,M=0;return b&8191||(M+=13,b>>>=13),b&127||(M+=7,b>>>=7),b&15||(M+=4,b>>>=4),b&3||(M+=2,b>>>=2),b&1||M++,M},s.prototype.bitLength=function(){var v=this.words[this.length-1],b=this._countBits(v);return(this.length-1)*26+b};function S(D){for(var v=new Array(D.bitLength()),b=0;b>>B&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,b=0;bv.length?this.clone().ior(v):v.clone().ior(this)},s.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},s.prototype.iuand=function(v){var b;this.length>v.length?b=v:b=this;for(var M=0;Mv.length?this.clone().iand(v):v.clone().iand(this)},s.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},s.prototype.iuxor=function(v){var b,M;this.length>v.length?(b=this,M=v):(b=v,M=this);for(var B=0;Bv.length?this.clone().ixor(v):v.clone().ixor(this)},s.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},s.prototype.inotn=function(v){n(typeof v=="number"&&v>=0);var b=Math.ceil(v/26)|0,M=v%26;this._expand(b),M>0&&b--;for(var B=0;B0&&(this.words[B]=~this.words[B]&67108863>>26-M),this._strip()},s.prototype.notn=function(v){return this.clone().inotn(v)},s.prototype.setn=function(v,b){n(typeof v=="number"&&v>=0);var M=v/26|0,B=v%26;return this._expand(M+1),b?this.words[M]=this.words[M]|1<v.length?(M=this,B=v):(M=v,B=this);for(var x=0,C=0;C>>26;for(;x!==0&&C>>26;if(this.length=M.length,x!==0)this.words[this.length]=x,this.length++;else if(M!==this)for(;Cv.length?this.clone().iadd(v):v.clone().iadd(this)},s.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var b=this.iadd(v);return v.negative=1,b._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var M=this.cmp(v);if(M===0)return this.negative=0,this.length=1,this.words[0]=0,this;var B,x;M>0?(B=this,x=v):(B=v,x=this);for(var C=0,w=0;w>26,this.words[w]=b&67108863;for(;C!==0&&w>26,this.words[w]=b&67108863;if(C===0&&w>>26,oe=k&67108863,$=Math.min(O,v.length-1),X=Math.max(0,O-D.length+1);X<=$;X++){var W=O-X|0;B=D.words[W]|0,x=v.words[X]|0,C=B*x+oe,G+=C/67108864|0,oe=C&67108863}b.words[O]=oe|0,k=G|0}return k!==0?b.words[O]=k|0:b.length--,b._strip()}var A=function(v,b,M){var B=v.words,x=b.words,C=M.words,w=0,k,O,G,oe=B[0]|0,$=oe&8191,X=oe>>>13,W=B[1]|0,Z=W&8191,te=W>>>13,F=B[2]|0,ee=F&8191,fe=F>>>13,xe=B[3]|0,_e=xe&8191,Me=xe>>>13,Ke=B[4]|0,ze=Ke&8191,Je=Ke>>>13,Xe=B[5]|0,lt=Xe&8191,Re=Xe>>>13,$e=B[6]|0,st=$e&8191,Qe=$e>>>13,ct=B[7]|0,tt=ct&8191,He=ct>>>13,at=B[8]|0,pt=at&8191,Ge=at>>>13,vt=B[9]|0,bt=vt&8191,Ze=vt>>>13,_t=x[0]|0,Ct=_t&8191,It=_t>>>13,er=x[1]|0,dr=er&8191,wt=er>>>13,lr=x[2]|0,ir=lr&8191,Pt=lr>>>13,Dt=x[3]|0,Nt=Dt&8191,dt=Dt>>>13,Lt=x[4]|0,kt=Lt&8191,ut=Lt>>>13,zt=x[5]|0,Ht=zt&8191,ht=zt>>>13,xt=x[6]|0,Bt=xt&8191,Ve=xt>>>13,$t=x[7]|0,Et=$t&8191,ot=$t>>>13,Gt=x[8]|0,Nr=Gt&8191,Ut=Gt>>>13,Pr=x[9]|0,tr=Pr&8191,Or=Pr>>>13;M.negative=v.negative^b.negative,M.length=19,k=Math.imul($,Ct),O=Math.imul($,It),O=O+Math.imul(X,Ct)|0,G=Math.imul(X,It);var pi=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(pi>>>26)|0,pi&=67108863,k=Math.imul(Z,Ct),O=Math.imul(Z,It),O=O+Math.imul(te,Ct)|0,G=Math.imul(te,It),k=k+Math.imul($,dr)|0,O=O+Math.imul($,wt)|0,O=O+Math.imul(X,dr)|0,G=G+Math.imul(X,wt)|0;var vi=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(vi>>>26)|0,vi&=67108863,k=Math.imul(ee,Ct),O=Math.imul(ee,It),O=O+Math.imul(fe,Ct)|0,G=Math.imul(fe,It),k=k+Math.imul(Z,dr)|0,O=O+Math.imul(Z,wt)|0,O=O+Math.imul(te,dr)|0,G=G+Math.imul(te,wt)|0,k=k+Math.imul($,ir)|0,O=O+Math.imul($,Pt)|0,O=O+Math.imul(X,ir)|0,G=G+Math.imul(X,Pt)|0;var gi=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(gi>>>26)|0,gi&=67108863,k=Math.imul(_e,Ct),O=Math.imul(_e,It),O=O+Math.imul(Me,Ct)|0,G=Math.imul(Me,It),k=k+Math.imul(ee,dr)|0,O=O+Math.imul(ee,wt)|0,O=O+Math.imul(fe,dr)|0,G=G+Math.imul(fe,wt)|0,k=k+Math.imul(Z,ir)|0,O=O+Math.imul(Z,Pt)|0,O=O+Math.imul(te,ir)|0,G=G+Math.imul(te,Pt)|0,k=k+Math.imul($,Nt)|0,O=O+Math.imul($,dt)|0,O=O+Math.imul(X,Nt)|0,G=G+Math.imul(X,dt)|0;var _i=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(_i>>>26)|0,_i&=67108863,k=Math.imul(ze,Ct),O=Math.imul(ze,It),O=O+Math.imul(Je,Ct)|0,G=Math.imul(Je,It),k=k+Math.imul(_e,dr)|0,O=O+Math.imul(_e,wt)|0,O=O+Math.imul(Me,dr)|0,G=G+Math.imul(Me,wt)|0,k=k+Math.imul(ee,ir)|0,O=O+Math.imul(ee,Pt)|0,O=O+Math.imul(fe,ir)|0,G=G+Math.imul(fe,Pt)|0,k=k+Math.imul(Z,Nt)|0,O=O+Math.imul(Z,dt)|0,O=O+Math.imul(te,Nt)|0,G=G+Math.imul(te,dt)|0,k=k+Math.imul($,kt)|0,O=O+Math.imul($,ut)|0,O=O+Math.imul(X,kt)|0,G=G+Math.imul(X,ut)|0;var Tn=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,k=Math.imul(lt,Ct),O=Math.imul(lt,It),O=O+Math.imul(Re,Ct)|0,G=Math.imul(Re,It),k=k+Math.imul(ze,dr)|0,O=O+Math.imul(ze,wt)|0,O=O+Math.imul(Je,dr)|0,G=G+Math.imul(Je,wt)|0,k=k+Math.imul(_e,ir)|0,O=O+Math.imul(_e,Pt)|0,O=O+Math.imul(Me,ir)|0,G=G+Math.imul(Me,Pt)|0,k=k+Math.imul(ee,Nt)|0,O=O+Math.imul(ee,dt)|0,O=O+Math.imul(fe,Nt)|0,G=G+Math.imul(fe,dt)|0,k=k+Math.imul(Z,kt)|0,O=O+Math.imul(Z,ut)|0,O=O+Math.imul(te,kt)|0,G=G+Math.imul(te,ut)|0,k=k+Math.imul($,Ht)|0,O=O+Math.imul($,ht)|0,O=O+Math.imul(X,Ht)|0,G=G+Math.imul(X,ht)|0;var ps=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(ps>>>26)|0,ps&=67108863,k=Math.imul(st,Ct),O=Math.imul(st,It),O=O+Math.imul(Qe,Ct)|0,G=Math.imul(Qe,It),k=k+Math.imul(lt,dr)|0,O=O+Math.imul(lt,wt)|0,O=O+Math.imul(Re,dr)|0,G=G+Math.imul(Re,wt)|0,k=k+Math.imul(ze,ir)|0,O=O+Math.imul(ze,Pt)|0,O=O+Math.imul(Je,ir)|0,G=G+Math.imul(Je,Pt)|0,k=k+Math.imul(_e,Nt)|0,O=O+Math.imul(_e,dt)|0,O=O+Math.imul(Me,Nt)|0,G=G+Math.imul(Me,dt)|0,k=k+Math.imul(ee,kt)|0,O=O+Math.imul(ee,ut)|0,O=O+Math.imul(fe,kt)|0,G=G+Math.imul(fe,ut)|0,k=k+Math.imul(Z,Ht)|0,O=O+Math.imul(Z,ht)|0,O=O+Math.imul(te,Ht)|0,G=G+Math.imul(te,ht)|0,k=k+Math.imul($,Bt)|0,O=O+Math.imul($,Ve)|0,O=O+Math.imul(X,Bt)|0,G=G+Math.imul(X,Ve)|0;var vs=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(vs>>>26)|0,vs&=67108863,k=Math.imul(tt,Ct),O=Math.imul(tt,It),O=O+Math.imul(He,Ct)|0,G=Math.imul(He,It),k=k+Math.imul(st,dr)|0,O=O+Math.imul(st,wt)|0,O=O+Math.imul(Qe,dr)|0,G=G+Math.imul(Qe,wt)|0,k=k+Math.imul(lt,ir)|0,O=O+Math.imul(lt,Pt)|0,O=O+Math.imul(Re,ir)|0,G=G+Math.imul(Re,Pt)|0,k=k+Math.imul(ze,Nt)|0,O=O+Math.imul(ze,dt)|0,O=O+Math.imul(Je,Nt)|0,G=G+Math.imul(Je,dt)|0,k=k+Math.imul(_e,kt)|0,O=O+Math.imul(_e,ut)|0,O=O+Math.imul(Me,kt)|0,G=G+Math.imul(Me,ut)|0,k=k+Math.imul(ee,Ht)|0,O=O+Math.imul(ee,ht)|0,O=O+Math.imul(fe,Ht)|0,G=G+Math.imul(fe,ht)|0,k=k+Math.imul(Z,Bt)|0,O=O+Math.imul(Z,Ve)|0,O=O+Math.imul(te,Bt)|0,G=G+Math.imul(te,Ve)|0,k=k+Math.imul($,Et)|0,O=O+Math.imul($,ot)|0,O=O+Math.imul(X,Et)|0,G=G+Math.imul(X,ot)|0;var gs=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(gs>>>26)|0,gs&=67108863,k=Math.imul(pt,Ct),O=Math.imul(pt,It),O=O+Math.imul(Ge,Ct)|0,G=Math.imul(Ge,It),k=k+Math.imul(tt,dr)|0,O=O+Math.imul(tt,wt)|0,O=O+Math.imul(He,dr)|0,G=G+Math.imul(He,wt)|0,k=k+Math.imul(st,ir)|0,O=O+Math.imul(st,Pt)|0,O=O+Math.imul(Qe,ir)|0,G=G+Math.imul(Qe,Pt)|0,k=k+Math.imul(lt,Nt)|0,O=O+Math.imul(lt,dt)|0,O=O+Math.imul(Re,Nt)|0,G=G+Math.imul(Re,dt)|0,k=k+Math.imul(ze,kt)|0,O=O+Math.imul(ze,ut)|0,O=O+Math.imul(Je,kt)|0,G=G+Math.imul(Je,ut)|0,k=k+Math.imul(_e,Ht)|0,O=O+Math.imul(_e,ht)|0,O=O+Math.imul(Me,Ht)|0,G=G+Math.imul(Me,ht)|0,k=k+Math.imul(ee,Bt)|0,O=O+Math.imul(ee,Ve)|0,O=O+Math.imul(fe,Bt)|0,G=G+Math.imul(fe,Ve)|0,k=k+Math.imul(Z,Et)|0,O=O+Math.imul(Z,ot)|0,O=O+Math.imul(te,Et)|0,G=G+Math.imul(te,ot)|0,k=k+Math.imul($,Nr)|0,O=O+Math.imul($,Ut)|0,O=O+Math.imul(X,Nr)|0,G=G+Math.imul(X,Ut)|0;var Hi=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,k=Math.imul(bt,Ct),O=Math.imul(bt,It),O=O+Math.imul(Ze,Ct)|0,G=Math.imul(Ze,It),k=k+Math.imul(pt,dr)|0,O=O+Math.imul(pt,wt)|0,O=O+Math.imul(Ge,dr)|0,G=G+Math.imul(Ge,wt)|0,k=k+Math.imul(tt,ir)|0,O=O+Math.imul(tt,Pt)|0,O=O+Math.imul(He,ir)|0,G=G+Math.imul(He,Pt)|0,k=k+Math.imul(st,Nt)|0,O=O+Math.imul(st,dt)|0,O=O+Math.imul(Qe,Nt)|0,G=G+Math.imul(Qe,dt)|0,k=k+Math.imul(lt,kt)|0,O=O+Math.imul(lt,ut)|0,O=O+Math.imul(Re,kt)|0,G=G+Math.imul(Re,ut)|0,k=k+Math.imul(ze,Ht)|0,O=O+Math.imul(ze,ht)|0,O=O+Math.imul(Je,Ht)|0,G=G+Math.imul(Je,ht)|0,k=k+Math.imul(_e,Bt)|0,O=O+Math.imul(_e,Ve)|0,O=O+Math.imul(Me,Bt)|0,G=G+Math.imul(Me,Ve)|0,k=k+Math.imul(ee,Et)|0,O=O+Math.imul(ee,ot)|0,O=O+Math.imul(fe,Et)|0,G=G+Math.imul(fe,ot)|0,k=k+Math.imul(Z,Nr)|0,O=O+Math.imul(Z,Ut)|0,O=O+Math.imul(te,Nr)|0,G=G+Math.imul(te,Ut)|0,k=k+Math.imul($,tr)|0,O=O+Math.imul($,Or)|0,O=O+Math.imul(X,tr)|0,G=G+Math.imul(X,Or)|0;var ys=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(ys>>>26)|0,ys&=67108863,k=Math.imul(bt,dr),O=Math.imul(bt,wt),O=O+Math.imul(Ze,dr)|0,G=Math.imul(Ze,wt),k=k+Math.imul(pt,ir)|0,O=O+Math.imul(pt,Pt)|0,O=O+Math.imul(Ge,ir)|0,G=G+Math.imul(Ge,Pt)|0,k=k+Math.imul(tt,Nt)|0,O=O+Math.imul(tt,dt)|0,O=O+Math.imul(He,Nt)|0,G=G+Math.imul(He,dt)|0,k=k+Math.imul(st,kt)|0,O=O+Math.imul(st,ut)|0,O=O+Math.imul(Qe,kt)|0,G=G+Math.imul(Qe,ut)|0,k=k+Math.imul(lt,Ht)|0,O=O+Math.imul(lt,ht)|0,O=O+Math.imul(Re,Ht)|0,G=G+Math.imul(Re,ht)|0,k=k+Math.imul(ze,Bt)|0,O=O+Math.imul(ze,Ve)|0,O=O+Math.imul(Je,Bt)|0,G=G+Math.imul(Je,Ve)|0,k=k+Math.imul(_e,Et)|0,O=O+Math.imul(_e,ot)|0,O=O+Math.imul(Me,Et)|0,G=G+Math.imul(Me,ot)|0,k=k+Math.imul(ee,Nr)|0,O=O+Math.imul(ee,Ut)|0,O=O+Math.imul(fe,Nr)|0,G=G+Math.imul(fe,Ut)|0,k=k+Math.imul(Z,tr)|0,O=O+Math.imul(Z,Or)|0,O=O+Math.imul(te,tr)|0,G=G+Math.imul(te,Or)|0;var ms=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(ms>>>26)|0,ms&=67108863,k=Math.imul(bt,ir),O=Math.imul(bt,Pt),O=O+Math.imul(Ze,ir)|0,G=Math.imul(Ze,Pt),k=k+Math.imul(pt,Nt)|0,O=O+Math.imul(pt,dt)|0,O=O+Math.imul(Ge,Nt)|0,G=G+Math.imul(Ge,dt)|0,k=k+Math.imul(tt,kt)|0,O=O+Math.imul(tt,ut)|0,O=O+Math.imul(He,kt)|0,G=G+Math.imul(He,ut)|0,k=k+Math.imul(st,Ht)|0,O=O+Math.imul(st,ht)|0,O=O+Math.imul(Qe,Ht)|0,G=G+Math.imul(Qe,ht)|0,k=k+Math.imul(lt,Bt)|0,O=O+Math.imul(lt,Ve)|0,O=O+Math.imul(Re,Bt)|0,G=G+Math.imul(Re,Ve)|0,k=k+Math.imul(ze,Et)|0,O=O+Math.imul(ze,ot)|0,O=O+Math.imul(Je,Et)|0,G=G+Math.imul(Je,ot)|0,k=k+Math.imul(_e,Nr)|0,O=O+Math.imul(_e,Ut)|0,O=O+Math.imul(Me,Nr)|0,G=G+Math.imul(Me,Ut)|0,k=k+Math.imul(ee,tr)|0,O=O+Math.imul(ee,Or)|0,O=O+Math.imul(fe,tr)|0,G=G+Math.imul(fe,Or)|0;var qs=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(qs>>>26)|0,qs&=67108863,k=Math.imul(bt,Nt),O=Math.imul(bt,dt),O=O+Math.imul(Ze,Nt)|0,G=Math.imul(Ze,dt),k=k+Math.imul(pt,kt)|0,O=O+Math.imul(pt,ut)|0,O=O+Math.imul(Ge,kt)|0,G=G+Math.imul(Ge,ut)|0,k=k+Math.imul(tt,Ht)|0,O=O+Math.imul(tt,ht)|0,O=O+Math.imul(He,Ht)|0,G=G+Math.imul(He,ht)|0,k=k+Math.imul(st,Bt)|0,O=O+Math.imul(st,Ve)|0,O=O+Math.imul(Qe,Bt)|0,G=G+Math.imul(Qe,Ve)|0,k=k+Math.imul(lt,Et)|0,O=O+Math.imul(lt,ot)|0,O=O+Math.imul(Re,Et)|0,G=G+Math.imul(Re,ot)|0,k=k+Math.imul(ze,Nr)|0,O=O+Math.imul(ze,Ut)|0,O=O+Math.imul(Je,Nr)|0,G=G+Math.imul(Je,Ut)|0,k=k+Math.imul(_e,tr)|0,O=O+Math.imul(_e,Or)|0,O=O+Math.imul(Me,tr)|0,G=G+Math.imul(Me,Or)|0;var ho=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(ho>>>26)|0,ho&=67108863,k=Math.imul(bt,kt),O=Math.imul(bt,ut),O=O+Math.imul(Ze,kt)|0,G=Math.imul(Ze,ut),k=k+Math.imul(pt,Ht)|0,O=O+Math.imul(pt,ht)|0,O=O+Math.imul(Ge,Ht)|0,G=G+Math.imul(Ge,ht)|0,k=k+Math.imul(tt,Bt)|0,O=O+Math.imul(tt,Ve)|0,O=O+Math.imul(He,Bt)|0,G=G+Math.imul(He,Ve)|0,k=k+Math.imul(st,Et)|0,O=O+Math.imul(st,ot)|0,O=O+Math.imul(Qe,Et)|0,G=G+Math.imul(Qe,ot)|0,k=k+Math.imul(lt,Nr)|0,O=O+Math.imul(lt,Ut)|0,O=O+Math.imul(Re,Nr)|0,G=G+Math.imul(Re,Ut)|0,k=k+Math.imul(ze,tr)|0,O=O+Math.imul(ze,Or)|0,O=O+Math.imul(Je,tr)|0,G=G+Math.imul(Je,Or)|0;var Pn=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,k=Math.imul(bt,Ht),O=Math.imul(bt,ht),O=O+Math.imul(Ze,Ht)|0,G=Math.imul(Ze,ht),k=k+Math.imul(pt,Bt)|0,O=O+Math.imul(pt,Ve)|0,O=O+Math.imul(Ge,Bt)|0,G=G+Math.imul(Ge,Ve)|0,k=k+Math.imul(tt,Et)|0,O=O+Math.imul(tt,ot)|0,O=O+Math.imul(He,Et)|0,G=G+Math.imul(He,ot)|0,k=k+Math.imul(st,Nr)|0,O=O+Math.imul(st,Ut)|0,O=O+Math.imul(Qe,Nr)|0,G=G+Math.imul(Qe,Ut)|0,k=k+Math.imul(lt,tr)|0,O=O+Math.imul(lt,Or)|0,O=O+Math.imul(Re,tr)|0,G=G+Math.imul(Re,Or)|0;var Gi=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,k=Math.imul(bt,Bt),O=Math.imul(bt,Ve),O=O+Math.imul(Ze,Bt)|0,G=Math.imul(Ze,Ve),k=k+Math.imul(pt,Et)|0,O=O+Math.imul(pt,ot)|0,O=O+Math.imul(Ge,Et)|0,G=G+Math.imul(Ge,ot)|0,k=k+Math.imul(tt,Nr)|0,O=O+Math.imul(tt,Ut)|0,O=O+Math.imul(He,Nr)|0,G=G+Math.imul(He,Ut)|0,k=k+Math.imul(st,tr)|0,O=O+Math.imul(st,Or)|0,O=O+Math.imul(Qe,tr)|0,G=G+Math.imul(Qe,Or)|0;var po=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(po>>>26)|0,po&=67108863,k=Math.imul(bt,Et),O=Math.imul(bt,ot),O=O+Math.imul(Ze,Et)|0,G=Math.imul(Ze,ot),k=k+Math.imul(pt,Nr)|0,O=O+Math.imul(pt,Ut)|0,O=O+Math.imul(Ge,Nr)|0,G=G+Math.imul(Ge,Ut)|0,k=k+Math.imul(tt,tr)|0,O=O+Math.imul(tt,Or)|0,O=O+Math.imul(He,tr)|0,G=G+Math.imul(He,Or)|0;var Vs=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(Vs>>>26)|0,Vs&=67108863,k=Math.imul(bt,Nr),O=Math.imul(bt,Ut),O=O+Math.imul(Ze,Nr)|0,G=Math.imul(Ze,Ut),k=k+Math.imul(pt,tr)|0,O=O+Math.imul(pt,Or)|0,O=O+Math.imul(Ge,tr)|0,G=G+Math.imul(Ge,Or)|0;var gf=(w+k|0)+((O&8191)<<13)|0;w=(G+(O>>>13)|0)+(gf>>>26)|0,gf&=67108863,k=Math.imul(bt,tr),O=Math.imul(bt,Or),O=O+Math.imul(Ze,tr)|0,G=Math.imul(Ze,Or);var nl=(w+k|0)+((O&8191)<<13)|0;return w=(G+(O>>>13)|0)+(nl>>>26)|0,nl&=67108863,C[0]=pi,C[1]=vi,C[2]=gi,C[3]=_i,C[4]=Tn,C[5]=ps,C[6]=vs,C[7]=gs,C[8]=Hi,C[9]=ys,C[10]=ms,C[11]=qs,C[12]=ho,C[13]=Pn,C[14]=Gi,C[15]=po,C[16]=Vs,C[17]=gf,C[18]=nl,w!==0&&(C[19]=w,M.length++),M};Math.imul||(A=E);function P(D,v,b){b.negative=v.negative^D.negative,b.length=D.length+v.length;for(var M=0,B=0,x=0;x>>26)|0,B+=C>>>26,C&=67108863}b.words[x]=w,M=C,C=B}return M!==0?b.words[x]=M:b.length--,b._strip()}function N(D,v,b){return P(D,v,b)}s.prototype.mulTo=function(v,b){var M,B=this.length+v.length;return this.length===10&&v.length===10?M=A(this,v,b):B<63?M=E(this,v,b):B<1024?M=P(this,v,b):M=N(this,v,b),M},s.prototype.mul=function(v){var b=new s(null);return b.words=new Array(this.length+v.length),this.mulTo(v,b)},s.prototype.mulf=function(v){var b=new s(null);return b.words=new Array(this.length+v.length),N(this,v,b)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var b=v<0;b&&(v=-v),n(typeof v=="number"),n(v<67108864);for(var M=0,B=0;B>=26,M+=x/67108864|0,M+=C>>>26,this.words[B]=C&67108863}return M!==0&&(this.words[B]=M,this.length++),b?this.ineg():this},s.prototype.muln=function(v){return this.clone().imuln(v)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(v){var b=S(v);if(b.length===0)return new s(1);for(var M=this,B=0;B=0);var b=v%26,M=(v-b)/26,B=67108863>>>26-b<<26-b,x;if(b!==0){var C=0;for(x=0;x>>26-b}C&&(this.words[x]=C,this.length++)}if(M!==0){for(x=this.length-1;x>=0;x--)this.words[x+M]=this.words[x];for(x=0;x=0);var B;b?B=(b-b%26)/26:B=0;var x=v%26,C=Math.min((v-x)/26,this.length),w=67108863^67108863>>>x<C)for(this.length-=C,O=0;O=0&&(G!==0||O>=B);O--){var oe=this.words[O]|0;this.words[O]=G<<26-x|oe>>>x,G=oe&w}return k&&G!==0&&(k.words[k.length++]=G),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,b,M){return n(this.negative===0),this.iushrn(v,b,M)},s.prototype.shln=function(v){return this.clone().ishln(v)},s.prototype.ushln=function(v){return this.clone().iushln(v)},s.prototype.shrn=function(v){return this.clone().ishrn(v)},s.prototype.ushrn=function(v){return this.clone().iushrn(v)},s.prototype.testn=function(v){n(typeof v=="number"&&v>=0);var b=v%26,M=(v-b)/26,B=1<=0);var b=v%26,M=(v-b)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=M)return this;if(b!==0&&M++,this.length=Math.min(M,this.length),b!==0){var B=67108863^67108863>>>b<=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},s.prototype.isubn=function(v){if(n(typeof v=="number"),n(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b>26)-(k/67108864|0),this.words[x+M]=C&67108863}for(;x>26,this.words[x+M]=C&67108863;if(w===0)return this._strip();for(n(w===-1),w=0,x=0;x>26,this.words[x]=C&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,b){var M=this.length-v.length,B=this.clone(),x=v,C=x.words[x.length-1]|0,w=this._countBits(C);M=26-w,M!==0&&(x=x.ushln(M),B.iushln(M),C=x.words[x.length-1]|0);var k=B.length-x.length,O;if(b!=="mod"){O=new s(null),O.length=k+1,O.words=new Array(O.length);for(var G=0;G=0;$--){var X=(B.words[x.length+$]|0)*67108864+(B.words[x.length+$-1]|0);for(X=Math.min(X/C|0,67108863),B._ishlnsubmul(x,X,$);B.negative!==0;)X--,B.negative=0,B._ishlnsubmul(x,1,$),B.isZero()||(B.negative^=1);O&&(O.words[$]=X)}return O&&O._strip(),B._strip(),b!=="div"&&M!==0&&B.iushrn(M),{div:O||null,mod:B}},s.prototype.divmod=function(v,b,M){if(n(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var B,x,C;return this.negative!==0&&v.negative===0?(C=this.neg().divmod(v,b),b!=="mod"&&(B=C.div.neg()),b!=="div"&&(x=C.mod.neg(),M&&x.negative!==0&&x.iadd(v)),{div:B,mod:x}):this.negative===0&&v.negative!==0?(C=this.divmod(v.neg(),b),b!=="mod"&&(B=C.div.neg()),{div:B,mod:C.mod}):this.negative&v.negative?(C=this.neg().divmod(v.neg(),b),b!=="div"&&(x=C.mod.neg(),M&&x.negative!==0&&x.isub(v)),{div:C.div,mod:x}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?b==="div"?{div:this.divn(v.words[0]),mod:null}:b==="mod"?{div:null,mod:new s(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new s(this.modrn(v.words[0]))}:this._wordDiv(v,b)},s.prototype.div=function(v){return this.divmod(v,"div",!1).div},s.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},s.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},s.prototype.divRound=function(v){var b=this.divmod(v);if(b.mod.isZero())return b.div;var M=b.div.negative!==0?b.mod.isub(v):b.mod,B=v.ushrn(1),x=v.andln(1),C=M.cmp(B);return C<0||x===1&&C===0?b.div:b.div.negative!==0?b.div.isubn(1):b.div.iaddn(1)},s.prototype.modrn=function(v){var b=v<0;b&&(v=-v),n(v<=67108863);for(var M=(1<<26)%v,B=0,x=this.length-1;x>=0;x--)B=(M*B+(this.words[x]|0))%v;return b?-B:B},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var b=v<0;b&&(v=-v),n(v<=67108863);for(var M=0,B=this.length-1;B>=0;B--){var x=(this.words[B]|0)+M*67108864;this.words[B]=x/v|0,M=x%v}return this._strip(),b?this.ineg():this},s.prototype.divn=function(v){return this.clone().idivn(v)},s.prototype.egcd=function(v){n(v.negative===0),n(!v.isZero());var b=this,M=v.clone();b.negative!==0?b=b.umod(v):b=b.clone();for(var B=new s(1),x=new s(0),C=new s(0),w=new s(1),k=0;b.isEven()&&M.isEven();)b.iushrn(1),M.iushrn(1),++k;for(var O=M.clone(),G=b.clone();!b.isZero();){for(var oe=0,$=1;!(b.words[0]&$)&&oe<26;++oe,$<<=1);if(oe>0)for(b.iushrn(oe);oe-- >0;)(B.isOdd()||x.isOdd())&&(B.iadd(O),x.isub(G)),B.iushrn(1),x.iushrn(1);for(var X=0,W=1;!(M.words[0]&W)&&X<26;++X,W<<=1);if(X>0)for(M.iushrn(X);X-- >0;)(C.isOdd()||w.isOdd())&&(C.iadd(O),w.isub(G)),C.iushrn(1),w.iushrn(1);b.cmp(M)>=0?(b.isub(M),B.isub(C),x.isub(w)):(M.isub(b),C.isub(B),w.isub(x))}return{a:C,b:w,gcd:M.iushln(k)}},s.prototype._invmp=function(v){n(v.negative===0),n(!v.isZero());var b=this,M=v.clone();b.negative!==0?b=b.umod(v):b=b.clone();for(var B=new s(1),x=new s(0),C=M.clone();b.cmpn(1)>0&&M.cmpn(1)>0;){for(var w=0,k=1;!(b.words[0]&k)&&w<26;++w,k<<=1);if(w>0)for(b.iushrn(w);w-- >0;)B.isOdd()&&B.iadd(C),B.iushrn(1);for(var O=0,G=1;!(M.words[0]&G)&&O<26;++O,G<<=1);if(O>0)for(M.iushrn(O);O-- >0;)x.isOdd()&&x.iadd(C),x.iushrn(1);b.cmp(M)>=0?(b.isub(M),B.isub(x)):(M.isub(b),x.isub(B))}var oe;return b.cmpn(1)===0?oe=B:oe=x,oe.cmpn(0)<0&&oe.iadd(v),oe},s.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var b=this.clone(),M=v.clone();b.negative=0,M.negative=0;for(var B=0;b.isEven()&&M.isEven();B++)b.iushrn(1),M.iushrn(1);do{for(;b.isEven();)b.iushrn(1);for(;M.isEven();)M.iushrn(1);var x=b.cmp(M);if(x<0){var C=b;b=M,M=C}else if(x===0||M.cmpn(1)===0)break;b.isub(M)}while(!0);return M.iushln(B)},s.prototype.invm=function(v){return this.egcd(v).a.umod(v)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(v){return this.words[0]&v},s.prototype.bincn=function(v){n(typeof v=="number");var b=v%26,M=(v-b)/26,B=1<>>26,w&=67108863,this.words[C]=w}return x!==0&&(this.words[C]=x,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var b=v<0;if(this.negative!==0&&!b)return-1;if(this.negative===0&&b)return 1;this._strip();var M;if(this.length>1)M=1;else{b&&(v=-v),n(v<=67108863,"Number is too big");var B=this.words[0]|0;M=B===v?0:Bv.length)return 1;if(this.length=0;M--){var B=this.words[M]|0,x=v.words[M]|0;if(B!==x){Bx&&(b=1);break}}return b},s.prototype.gtn=function(v){return this.cmpn(v)===1},s.prototype.gt=function(v){return this.cmp(v)===1},s.prototype.gten=function(v){return this.cmpn(v)>=0},s.prototype.gte=function(v){return this.cmp(v)>=0},s.prototype.ltn=function(v){return this.cmpn(v)===-1},s.prototype.lt=function(v){return this.cmp(v)===-1},s.prototype.lten=function(v){return this.cmpn(v)<=0},s.prototype.lte=function(v){return this.cmp(v)<=0},s.prototype.eqn=function(v){return this.cmpn(v)===0},s.prototype.eq=function(v){return this.cmp(v)===0},s.red=function(v){return new K(v)},s.prototype.toRed=function(v){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(v){return this.red=v,this},s.prototype.forceRed=function(v){return n(!this.red,"Already a number in reduction context"),this._forceRed(v)},s.prototype.redAdd=function(v){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},s.prototype.redIAdd=function(v){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},s.prototype.redSub=function(v){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},s.prototype.redISub=function(v){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},s.prototype.redShl=function(v){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},s.prototype.redMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},s.prototype.redIMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(v){return n(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var L={k256:null,p224:null,p192:null,p25519:null};function V(D,v){this.name=D,this.p=new s(v,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}V.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},V.prototype.ireduce=function(v){var b=v,M;do this.split(b,this.tmp),b=this.imulK(b),b=b.iadd(this.tmp),M=b.bitLength();while(M>this.n);var B=M0?b.isub(this.p):b.strip!==void 0?b.strip():b._strip(),b},V.prototype.split=function(v,b){v.iushrn(this.n,0,b)},V.prototype.imulK=function(v){return v.imul(this.k)};function I(){V.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(I,V),I.prototype.split=function(v,b){for(var M=4194303,B=Math.min(v.length,9),x=0;x>>22,C=w}C>>>=22,v.words[x-10]=C,C===0&&v.length>10?v.length-=10:v.length-=9},I.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var b=0,M=0;M>>=26,v.words[M]=x,b=B}return b!==0&&(v.words[v.length++]=b),v},s._prime=function(v){if(L[v])return L[v];var b;if(v==="k256")b=new I;else if(v==="p224")b=new U;else if(v==="p192")b=new ie;else if(v==="p25519")b=new ae;else throw new Error("Unknown prime "+v);return L[v]=b,b};function K(D){if(typeof D=="string"){var v=s._prime(D);this.m=v.p,this.prime=v}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}K.prototype._verify1=function(v){n(v.negative===0,"red works only with positives"),n(v.red,"red works only with red numbers")},K.prototype._verify2=function(v,b){n((v.negative|b.negative)===0,"red works only with positives"),n(v.red&&v.red===b.red,"red works only with red numbers")},K.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(f(v,v.umod(this.m)._forceRed(this)),v)},K.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},K.prototype.add=function(v,b){this._verify2(v,b);var M=v.add(b);return M.cmp(this.m)>=0&&M.isub(this.m),M._forceRed(this)},K.prototype.iadd=function(v,b){this._verify2(v,b);var M=v.iadd(b);return M.cmp(this.m)>=0&&M.isub(this.m),M},K.prototype.sub=function(v,b){this._verify2(v,b);var M=v.sub(b);return M.cmpn(0)<0&&M.iadd(this.m),M._forceRed(this)},K.prototype.isub=function(v,b){this._verify2(v,b);var M=v.isub(b);return M.cmpn(0)<0&&M.iadd(this.m),M},K.prototype.shl=function(v,b){return this._verify1(v),this.imod(v.ushln(b))},K.prototype.imul=function(v,b){return this._verify2(v,b),this.imod(v.imul(b))},K.prototype.mul=function(v,b){return this._verify2(v,b),this.imod(v.mul(b))},K.prototype.isqr=function(v){return this.imul(v,v.clone())},K.prototype.sqr=function(v){return this.mul(v,v)},K.prototype.sqrt=function(v){if(v.isZero())return v.clone();var b=this.m.andln(3);if(n(b%2===1),b===3){var M=this.m.add(new s(1)).iushrn(2);return this.pow(v,M)}for(var B=this.m.subn(1),x=0;!B.isZero()&&B.andln(1)===0;)x++,B.iushrn(1);n(!B.isZero());var C=new s(1).toRed(this),w=C.redNeg(),k=this.m.subn(1).iushrn(1),O=this.m.bitLength();for(O=new s(2*O*O).toRed(this);this.pow(O,k).cmp(w)!==0;)O.redIAdd(w);for(var G=this.pow(O,B),oe=this.pow(v,B.addn(1).iushrn(1)),$=this.pow(v,B),X=x;$.cmp(C)!==0;){for(var W=$,Z=0;W.cmp(C)!==0;Z++)W=W.redSqr();n(Z=0;x--){for(var G=b.words[x],oe=O-1;oe>=0;oe--){var $=G>>oe&1;if(C!==B[0]&&(C=this.sqr(C)),$===0&&w===0){k=0;continue}w<<=1,w|=$,k++,!(k!==M&&(x!==0||oe!==0))&&(C=this.mul(C,B[w]),k=0,w=0)}O=26}return C},K.prototype.convertTo=function(v){var b=v.umod(this.m);return b===v?b.clone():b},K.prototype.convertFrom=function(v){var b=v.clone();return b.red=null,b},s.mont=function(v){return new R(v)};function R(D){K.call(this,D),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(R,K),R.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},R.prototype.convertFrom=function(v){var b=this.imod(v.mul(this.rinv));return b.red=null,b},R.prototype.imul=function(v,b){if(v.isZero()||b.isZero())return v.words[0]=0,v.length=1,v;var M=v.imul(b),B=M.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=M.isub(B).iushrn(this.shift),C=x;return x.cmp(this.m)>=0?C=x.isub(this.m):x.cmpn(0)<0&&(C=x.iadd(this.m)),C._forceRed(this)},R.prototype.mul=function(v,b){if(v.isZero()||b.isZero())return new s(0)._forceRed(this);var M=v.mul(b),B=M.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=M.isub(B).iushrn(this.shift),C=x;return x.cmp(this.m)>=0?C=x.isub(this.m):x.cmpn(0)<0&&(C=x.iadd(this.m)),C._forceRed(this)},R.prototype.invm=function(v){var b=this.imod(v._invmp(this.m).mul(this.r2));return b._forceRed(this)}})(t,xi)})(lO);var Yke=lO.exports;const ar=$u(Yke);var Qke=ar.BN;function Jke(t){return new Qke(t,36).toString(16)}const Zke="strings/5.7.0",Xke=new Cn(Zke);var K4;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(K4||(K4={}));var N$;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(N$||(N$={}));function GS(t,e=K4.current){e!=K4.current&&(Xke.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return ui(r)}const eRe=`Ethereum Signed Message: +`;function Are(t){return typeof t=="string"&&(t=GS(t)),cO(zke([GS(eRe),GS(String(t.length)),t]))}const tRe="address/5.7.0",Vb=new Cn(tRe);function B$(t){Wl(t,20)||Vb.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=ui(cO(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const rRe=9007199254740991;function nRe(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const fO={};for(let t=0;t<10;t++)fO[String(t)]=String(t);for(let t=0;t<26;t++)fO[String.fromCharCode(65+t)]=String(10+t);const L$=Math.floor(nRe(rRe));function iRe(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>fO[n]).join("");for(;e.length>=L$;){let n=e.substring(0,L$);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function sRe(t){let e=null;if(typeof t!="string"&&Vb.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=B$(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Vb.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==iRe(t)&&Vb.throwArgumentError("bad icap checksum","address",t),e=Jke(t.substring(4));e.length<40;)e="0"+e;e=B$("0x"+e)}else Vb.throwArgumentError("invalid address","address",t);return e}function hb(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var gx={},Mr={},Ep=Sre;function Sre(t,e){if(!t)throw new Error(e||"Assertion failed")}Sre.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var bT={exports:{}};typeof Object.create=="function"?bT.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:bT.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var aC=bT.exports,oRe=Ep,aRe=aC;Mr.inherits=aRe;function cRe(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function lRe(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):cRe(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Mr.htonl=_re;function uRe(t,e){for(var r="",n=0;n>>0}return s}Mr.join32=dRe;function hRe(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Mr.split32=hRe;function pRe(t,e){return t>>>e|t<<32-e}Mr.rotr32=pRe;function vRe(t,e){return t<>>32-e}Mr.rotl32=vRe;function gRe(t,e){return t+e>>>0}Mr.sum32=gRe;function yRe(t,e,r){return t+e+r>>>0}Mr.sum32_3=yRe;function mRe(t,e,r,n){return t+e+r+n>>>0}Mr.sum32_4=mRe;function bRe(t,e,r,n,i){return t+e+r+n+i>>>0}Mr.sum32_5=bRe;function wRe(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}Mr.sum64=wRe;function xRe(t,e,r,n){var i=e+n>>>0,s=(i>>0}Mr.sum64_hi=xRe;function ERe(t,e,r,n){var i=e+n;return i>>>0}Mr.sum64_lo=ERe;function CRe(t,e,r,n,i,s,o,a){var c=0,l=e;l=l+n>>>0,c+=l>>0,c+=l>>0,c+=l>>0}Mr.sum64_4_hi=CRe;function ARe(t,e,r,n,i,s,o,a){var c=e+n+s+a;return c>>>0}Mr.sum64_4_lo=ARe;function SRe(t,e,r,n,i,s,o,a,c,l){var f=0,u=e;u=u+n>>>0,f+=u>>0,f+=u>>0,f+=u>>0,f+=u>>0}Mr.sum64_5_hi=SRe;function _Re(t,e,r,n,i,s,o,a,c,l){var f=e+n+s+a+l;return f>>>0}Mr.sum64_5_lo=_Re;function IRe(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Mr.rotr64_hi=IRe;function TRe(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Mr.rotr64_lo=TRe;function PRe(t,e,r){return t>>>r}Mr.shr64_hi=PRe;function kRe(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Mr.shr64_lo=kRe;var vm={},F$=Mr,RRe=Ep;function cC(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}vm.BlockHash=cC;cC.prototype.update=function(e,r){if(e=F$.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=F$.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}hf.g0_256=BRe;function LRe(t){return Kl(t,17)^Kl(t,19)^t>>>10}hf.g1_256=LRe;var jy=Mr,FRe=vm,jRe=hf,WS=jy.rotl32,pb=jy.sum32,URe=jy.sum32_5,$Re=jRe.ft_1,Mre=FRe.BlockHash,qRe=[1518500249,1859775393,2400959708,3395469782];function sf(){if(!(this instanceof sf))return new sf;Mre.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}jy.inherits(sf,Mre);var VRe=sf;sf.blockSize=512;sf.outSize=160;sf.hmacStrength=80;sf.padLength=64;sf.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),kMe(e.length<=this.blockSize);for(var r=e.length;r>8,h=f&255;u?c.push(u,h):c.push(h)}return c}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",c=0;c(h>>1)-1?m=(h>>1)-S:m=S,g.isubn(m)):m=0,u[y]=m,g.iushrn(1)}return u}r.getNAF=n;function i(c,l){var f=[[],[]];c=c.clone(),l=l.clone();for(var u=0,h=0,g;c.cmpn(-u)>0||l.cmpn(-h)>0;){var y=c.andln(3)+u&3,m=l.andln(3)+h&3;y===3&&(y=-1),m===3&&(m=-1);var S;y&1?(g=c.andln(7)+u&7,(g===3||g===5)&&m===2?S=-y:S=y):S=0,f[0].push(S);var E;m&1?(g=l.andln(7)+h&7,(g===3||g===5)&&y===2?E=-m:E=m):E=0,f[1].push(E),2*u===S+1&&(u=1-u),2*h===E+1&&(h=1-h),c.iushrn(1),l.iushrn(1)}return f}r.getJSF=i;function s(c,l,f){var u="_"+l;c.prototype[l]=function(){return this[u]!==void 0?this[u]:this[u]=f.call(this)}}r.cachedProperty=s;function o(c){return typeof c=="string"?r.toArray(c,"hex"):c}r.parseBytes=o;function a(c){return new ar(c,"hex","le")}r.intFromLE=a}),Y4=xa.getNAF,OMe=xa.getJSF,Q4=xa.assert;function Zh(t,e){this.type=t,this.p=new ar(e.p,16),this.red=e.prime?ar.red(e.prime):ar.mont(this.p),this.zero=new ar(0).toRed(this.red),this.one=new ar(1).toRed(this.red),this.two=new ar(2).toRed(this.red),this.n=e.n&&new ar(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Cp=Zh;Zh.prototype.point=function(){throw new Error("Not implemented")};Zh.prototype.validate=function(){throw new Error("Not implemented")};Zh.prototype._fixedNafMul=function(e,r){Q4(e.precomputed);var n=e._getDoubles(),i=Y4(r,1,this._bitLength),s=(1<=a;l--)c=(c<<1)+i[l];o.push(c)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),h=s;h>0;h--){for(a=0;a=0;c--){for(var l=0;c>=0&&o[c]===0;c--)l++;if(c>=0&&l++,a=a.dblp(l),c<0)break;var f=o[c];Q4(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};Zh.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,c=this._wnafT3,l=0,f,u,h;for(f=0;f=1;f-=2){var y=f-1,m=f;if(o[y]!==1||o[m]!==1){c[y]=Y4(n[y],o[y],this._bitLength),c[m]=Y4(n[m],o[m],this._bitLength),l=Math.max(c[y].length,l),l=Math.max(c[m].length,l);continue}var S=[r[y],null,null,r[m]];r[y].y.cmp(r[m].y)===0?(S[1]=r[y].add(r[m]),S[2]=r[y].toJ().mixedAdd(r[m].neg())):r[y].y.cmp(r[m].y.redNeg())===0?(S[1]=r[y].toJ().mixedAdd(r[m]),S[2]=r[y].add(r[m].neg())):(S[1]=r[y].toJ().mixedAdd(r[m]),S[2]=r[y].toJ().mixedAdd(r[m].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],A=OMe(n[y],n[m]);for(l=Math.max(A[0].length,l),c[y]=new Array(l),c[m]=new Array(l),u=0;u=0;f--){for(var I=0;f>=0;){var U=!0;for(u=0;u=0&&I++,L=L.dblp(I),f<0)break;for(u=0;u0?h=a[u][ie-1>>1]:ie<0&&(h=a[u][-ie-1>>1].neg()),h.type==="affine"?L=L.mixedAdd(h):L=L.add(h))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};lc.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(g=l,y=f),u.negative&&(u=u.neg(),h=h.neg()),g.negative&&(g=g.neg(),y=y.neg()),[{a:u,b:h},{a:g,b:y}]};fc.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),c=o.mul(i.a),l=s.mul(n.b),f=o.mul(i.b),u=e.sub(a).sub(c),h=l.add(f).neg();return{k1:u,k2:h}};fc.prototype.pointFromX=function(e,r){e=new ar(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};fc.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};fc.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Vi.prototype.isInfinity=function(){return this.inf};Vi.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Vi.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Vi.prototype.getX=function(){return this.x.fromRed()};Vi.prototype.getY=function(){return this.y.fromRed()};Vi.prototype.mul=function(e){return e=new ar(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Vi.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Vi.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Vi.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Vi.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Vi.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function fs(t,e,r,n){Cp.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ar(0)):(this.x=new ar(e,16),this.y=new ar(r,16),this.z=new ar(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}dO(fs,Cp.BasePoint);fc.prototype.jpoint=function(e,r,n){return new fs(this,e,r,n)};fs.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};fs.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};fs.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),c=i.redSub(s),l=o.redSub(a);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),u=f.redMul(c),h=i.redMul(f),g=l.redSqr().redIAdd(u).redISub(h).redISub(h),y=l.redMul(h.redISub(g)).redISub(o.redMul(u)),m=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(g,y,m)};fs.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),c=s.redSub(o);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),f=l.redMul(a),u=n.redMul(l),h=c.redSqr().redIAdd(f).redISub(u).redISub(u),g=c.redMul(u.redISub(h)).redISub(s.redMul(f)),y=this.z.redMul(a);return this.curve.jpoint(h,g,y)};fs.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};fs.prototype.inspect=function(){return this.isInfinity()?"":""};fs.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var x5=mm(function(t,e){var r=e;r.base=Cp,r.short=NMe,r.mont=null,r.edwards=null}),E5=mm(function(t,e){var r=e,n=xa.assert;function i(a){a.type==="short"?this.curve=new x5.short(a):a.type==="edwards"?this.curve=new x5.edwards(a):this.curve=new x5.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,c){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(c);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Uf.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Uf.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Uf.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Uf.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Uf.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Uf.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Uf.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Uf.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Dh(t){if(!(this instanceof Dh))return new Dh(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Vc.toArray(t.entropy,t.entropyEnc||"hex"),r=Vc.toArray(t.nonce,t.nonceEnc||"hex"),n=Vc.toArray(t.pers,t.persEnc||"hex");uO(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var zre=Dh;Dh.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};Dh.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Vc.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var BMe=xa.assert;function lC(t,e){if(t instanceof lC)return t;this._importDER(t,e)||(BMe(t.r&&t.s,"Signature without r or s"),this.r=new ar(t.r,16),this.s=new ar(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var fC=lC;function LMe(){this.place=0}function QS(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function q$(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}lC.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=q$(r),n=q$(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];JS(i,r.length),i=i.concat(r),i.push(2),JS(i,n.length);var s=i.concat(n),o=[48];return JS(o,s.length),o=o.concat(s),xa.encode(o,e)};var FMe=function(){throw new Error("unsupported")},Hre=xa.assert;function ac(t){if(!(this instanceof ac))return new ac(t);typeof t=="string"&&(Hre(Object.prototype.hasOwnProperty.call(E5,t),"Unknown curve "+t),t=E5[t]),t instanceof E5.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var jMe=ac;ac.prototype.keyPair=function(e){return new hO(this,e)};ac.prototype.keyFromPrivate=function(e,r){return hO.fromPrivate(this,e,r)};ac.prototype.keyFromPublic=function(e,r){return hO.fromPublic(this,e,r)};ac.prototype.genKeyPair=function(e){e||(e={});for(var r=new zre({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||FMe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ar(2));;){var s=new ar(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};ac.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};ac.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ar(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),c=new zre({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new ar(1)),f=0;;f++){var u=i.k?i.k(f):new ar(c.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(l)>=0)){var h=this.g.mul(u);if(!h.isInfinity()){var g=h.getX(),y=g.umod(this.n);if(y.cmpn(0)!==0){var m=u.invm(this.n).mul(y.mul(r.getPrivate()).iadd(e));if(m=m.umod(this.n),m.cmpn(0)!==0){var S=(h.getY().isOdd()?1:0)|(g.cmp(y)!==0?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),S^=1),new fC({r:y,s:m,recoveryParam:S})}}}}}};ac.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ar(e,16)),n=this.keyFromPublic(n,i),r=new fC(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),c=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(c,n.getPublic(),l),f.isInfinity()?!1:f.eqXToP(s)):(f=this.g.mulAdd(c,n.getPublic(),l),f.isInfinity()?!1:f.getX().umod(this.n).cmp(s)===0)};ac.prototype.recoverPubKey=function(t,e,r,n){Hre((3&r)===r,"The recovery param is more than two bits"),e=new fC(e,n);var i=this.n,s=new ar(t),o=e.r,a=e.s,c=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),c):o=this.curve.pointFromX(o,c);var f=e.r.invm(i),u=i.sub(s).mul(f).umod(i),h=a.mul(f).umod(i);return this.g.mulAdd(u,o,h)};ac.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new fC(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var UMe=mm(function(t,e){var r=e;r.version="6.5.4",r.utils=xa,r.rand=function(){throw new Error("unsupported")},r.curve=x5,r.curves=E5,r.ec=jMe,r.eddsa=null}),$Me=UMe.ec;const qMe="signing-key/5.7.0",CT=new Cn(qMe);let ZS=null;function _d(){return ZS||(ZS=new $Me("secp256k1")),ZS}class VMe{constructor(e){hb(this,"curve","secp256k1"),hb(this,"privateKey",ra(e)),Gke(this.privateKey)!==32&&CT.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=_d().keyFromPrivate(ui(this.privateKey));hb(this,"publicKey","0x"+r.getPublic(!1,"hex")),hb(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),hb(this,"_isSigningKey",!0)}_addPoint(e){const r=_d().keyFromPublic(ui(this.publicKey)),n=_d().keyFromPublic(ui(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=_d().keyFromPrivate(ui(this.privateKey)),n=ui(e);n.length!==32&&CT.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Cre({recoveryParam:i.recoveryParam,r:wg("0x"+i.r.toString(16),32),s:wg("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=_d().keyFromPrivate(ui(this.privateKey)),n=_d().keyFromPublic(ui(Gre(e)));return wg("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function zMe(t,e){const r=Cre(e),n={r:ui(r.r),s:ui(r.s)};return"0x"+_d().recoverPubKey(ui(t),n,r.recoveryParam).encode("hex",!1)}function Gre(t,e){const r=ui(t);return r.length===32?new VMe(r).publicKey:r.length===33?"0x"+_d().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?ra(r):CT.throwArgumentError("invalid public or private key","key","[REDACTED]")}var V$;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(V$||(V$={}));function HMe(t){const e=Gre(t);return sRe(D$(cO(D$(e,1)),12))}function GMe(t,e){return HMe(zMe(ui(t),e))}var pO={},uC={},ur={},Wre={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,c){var l=a>>>16&65535,f=a&65535,u=c>>>16&65535,h=c&65535;return f*h+(l*h+f*u<<16>>>0)|0}t.mul=Math.imul||e;function r(a,c){return a+c|0}t.add=r;function n(a,c){return a-c|0}t.sub=n;function i(a,c){return a<>>32-c}t.rotl=i;function s(a,c){return a<<32-c|a>>>c}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Wre);Object.defineProperty(ur,"__esModule",{value:!0});var Kre=Wre;function WMe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}ur.readInt16BE=WMe;function KMe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}ur.readUint16BE=KMe;function YMe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}ur.readInt16LE=YMe;function QMe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}ur.readUint16LE=QMe;function Yre(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}ur.writeUint16BE=Yre;ur.writeInt16BE=Yre;function Qre(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}ur.writeUint16LE=Qre;ur.writeInt16LE=Qre;function AT(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}ur.readInt32BE=AT;function ST(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}ur.readUint32BE=ST;function _T(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}ur.readInt32LE=_T;function IT(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}ur.readUint32LE=IT;function J4(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}ur.writeUint32BE=J4;ur.writeInt32BE=J4;function Z4(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}ur.writeUint32LE=Z4;ur.writeInt32LE=Z4;function JMe(t,e){e===void 0&&(e=0);var r=AT(t,e),n=AT(t,e+4);return r*4294967296+n-(n>>31)*4294967296}ur.readInt64BE=JMe;function ZMe(t,e){e===void 0&&(e=0);var r=ST(t,e),n=ST(t,e+4);return r*4294967296+n}ur.readUint64BE=ZMe;function XMe(t,e){e===void 0&&(e=0);var r=_T(t,e),n=_T(t,e+4);return n*4294967296+r-(r>>31)*4294967296}ur.readInt64LE=XMe;function eOe(t,e){e===void 0&&(e=0);var r=IT(t,e),n=IT(t,e+4);return n*4294967296+r}ur.readUint64LE=eOe;function Jre(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),J4(t/4294967296>>>0,e,r),J4(t>>>0,e,r+4),e}ur.writeUint64BE=Jre;ur.writeInt64BE=Jre;function Zre(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Z4(t>>>0,e,r),Z4(t/4294967296>>>0,e,r+4),e}ur.writeUint64LE=Zre;ur.writeInt64LE=Zre;function tOe(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}ur.readUintBE=tOe;function rOe(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}ur.writeUintBE=nOe;function iOe(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Kre.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s>>16|b<<16,K=K+b|0,I^=K,I=I>>>20|I<<12,N=N+U|0,M^=N,M=M>>>16|M<<16,R=R+M|0,U^=R,U=U>>>20|U<<12,L=L+ie|0,B^=L,B=B>>>16|B<<16,D=D+B|0,ie^=D,ie=ie>>>20|ie<<12,V=V+ae|0,x^=V,x=x>>>16|x<<16,v=v+x|0,ae^=v,ae=ae>>>20|ae<<12,L=L+ie|0,B^=L,B=B>>>24|B<<8,D=D+B|0,ie^=D,ie=ie>>>25|ie<<7,V=V+ae|0,x^=V,x=x>>>24|x<<8,v=v+x|0,ae^=v,ae=ae>>>25|ae<<7,N=N+U|0,M^=N,M=M>>>24|M<<8,R=R+M|0,U^=R,U=U>>>25|U<<7,P=P+I|0,b^=P,b=b>>>24|b<<8,K=K+b|0,I^=K,I=I>>>25|I<<7,P=P+U|0,x^=P,x=x>>>16|x<<16,D=D+x|0,U^=D,U=U>>>20|U<<12,N=N+ie|0,b^=N,b=b>>>16|b<<16,v=v+b|0,ie^=v,ie=ie>>>20|ie<<12,L=L+ae|0,M^=L,M=M>>>16|M<<16,K=K+M|0,ae^=K,ae=ae>>>20|ae<<12,V=V+I|0,B^=V,B=B>>>16|B<<16,R=R+B|0,I^=R,I=I>>>20|I<<12,L=L+ae|0,M^=L,M=M>>>24|M<<8,K=K+M|0,ae^=K,ae=ae>>>25|ae<<7,V=V+I|0,B^=V,B=B>>>24|B<<8,R=R+B|0,I^=R,I=I>>>25|I<<7,N=N+ie|0,b^=N,b=b>>>24|b<<8,v=v+b|0,ie^=v,ie=ie>>>25|ie<<7,P=P+U|0,x^=P,x=x>>>24|x<<8,D=D+x|0,U^=D,U=U>>>25|U<<7;Cs.writeUint32LE(P+n|0,t,0),Cs.writeUint32LE(N+i|0,t,4),Cs.writeUint32LE(L+s|0,t,8),Cs.writeUint32LE(V+o|0,t,12),Cs.writeUint32LE(I+a|0,t,16),Cs.writeUint32LE(U+c|0,t,20),Cs.writeUint32LE(ie+l|0,t,24),Cs.writeUint32LE(ae+f|0,t,28),Cs.writeUint32LE(K+u|0,t,32),Cs.writeUint32LE(R+h|0,t,36),Cs.writeUint32LE(D+g|0,t,40),Cs.writeUint32LE(v+y|0,t,44),Cs.writeUint32LE(b+m|0,t,48),Cs.writeUint32LE(M+S|0,t,52),Cs.writeUint32LE(B+E|0,t,56),Cs.writeUint32LE(x+A|0,t,60)}function Xre(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var ene={},Xh={};Object.defineProperty(Xh,"__esModule",{value:!0});function mOe(t,e,r){return~(t-1)&e|t-1&r}Xh.select=mOe;function bOe(t,e){return(t|0)-(e|0)-1>>>31&1}Xh.lessOrEqual=bOe;function tne(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Xh.compare=tne;function wOe(t,e){return t.length===0||e.length===0?!1:tne(t,e)!==0}Xh.equal=wOe;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Xh,r=Ea;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=a[0]|a[1]<<8;this._r[0]=c&8191;var l=a[2]|a[3]<<8;this._r[1]=(c>>>13|l<<3)&8191;var f=a[4]|a[5]<<8;this._r[2]=(l>>>10|f<<6)&7939;var u=a[6]|a[7]<<8;this._r[3]=(f>>>7|u<<9)&8191;var h=a[8]|a[9]<<8;this._r[4]=(u>>>4|h<<12)&255,this._r[5]=h>>>1&8190;var g=a[10]|a[11]<<8;this._r[6]=(h>>>14|g<<2)&8191;var y=a[12]|a[13]<<8;this._r[7]=(g>>>11|y<<5)&8065;var m=a[14]|a[15]<<8;this._r[8]=(y>>>8|m<<8)&8191,this._r[9]=m>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,c,l){for(var f=this._fin?0:2048,u=this._h[0],h=this._h[1],g=this._h[2],y=this._h[3],m=this._h[4],S=this._h[5],E=this._h[6],A=this._h[7],P=this._h[8],N=this._h[9],L=this._r[0],V=this._r[1],I=this._r[2],U=this._r[3],ie=this._r[4],ae=this._r[5],K=this._r[6],R=this._r[7],D=this._r[8],v=this._r[9];l>=16;){var b=a[c+0]|a[c+1]<<8;u+=b&8191;var M=a[c+2]|a[c+3]<<8;h+=(b>>>13|M<<3)&8191;var B=a[c+4]|a[c+5]<<8;g+=(M>>>10|B<<6)&8191;var x=a[c+6]|a[c+7]<<8;y+=(B>>>7|x<<9)&8191;var C=a[c+8]|a[c+9]<<8;m+=(x>>>4|C<<12)&8191,S+=C>>>1&8191;var w=a[c+10]|a[c+11]<<8;E+=(C>>>14|w<<2)&8191;var k=a[c+12]|a[c+13]<<8;A+=(w>>>11|k<<5)&8191;var O=a[c+14]|a[c+15]<<8;P+=(k>>>8|O<<8)&8191,N+=O>>>5|f;var G=0,oe=G;oe+=u*L,oe+=h*(5*v),oe+=g*(5*D),oe+=y*(5*R),oe+=m*(5*K),G=oe>>>13,oe&=8191,oe+=S*(5*ae),oe+=E*(5*ie),oe+=A*(5*U),oe+=P*(5*I),oe+=N*(5*V),G+=oe>>>13,oe&=8191;var $=G;$+=u*V,$+=h*L,$+=g*(5*v),$+=y*(5*D),$+=m*(5*R),G=$>>>13,$&=8191,$+=S*(5*K),$+=E*(5*ae),$+=A*(5*ie),$+=P*(5*U),$+=N*(5*I),G+=$>>>13,$&=8191;var X=G;X+=u*I,X+=h*V,X+=g*L,X+=y*(5*v),X+=m*(5*D),G=X>>>13,X&=8191,X+=S*(5*R),X+=E*(5*K),X+=A*(5*ae),X+=P*(5*ie),X+=N*(5*U),G+=X>>>13,X&=8191;var W=G;W+=u*U,W+=h*I,W+=g*V,W+=y*L,W+=m*(5*v),G=W>>>13,W&=8191,W+=S*(5*D),W+=E*(5*R),W+=A*(5*K),W+=P*(5*ae),W+=N*(5*ie),G+=W>>>13,W&=8191;var Z=G;Z+=u*ie,Z+=h*U,Z+=g*I,Z+=y*V,Z+=m*L,G=Z>>>13,Z&=8191,Z+=S*(5*v),Z+=E*(5*D),Z+=A*(5*R),Z+=P*(5*K),Z+=N*(5*ae),G+=Z>>>13,Z&=8191;var te=G;te+=u*ae,te+=h*ie,te+=g*U,te+=y*I,te+=m*V,G=te>>>13,te&=8191,te+=S*L,te+=E*(5*v),te+=A*(5*D),te+=P*(5*R),te+=N*(5*K),G+=te>>>13,te&=8191;var F=G;F+=u*K,F+=h*ae,F+=g*ie,F+=y*U,F+=m*I,G=F>>>13,F&=8191,F+=S*V,F+=E*L,F+=A*(5*v),F+=P*(5*D),F+=N*(5*R),G+=F>>>13,F&=8191;var ee=G;ee+=u*R,ee+=h*K,ee+=g*ae,ee+=y*ie,ee+=m*U,G=ee>>>13,ee&=8191,ee+=S*I,ee+=E*V,ee+=A*L,ee+=P*(5*v),ee+=N*(5*D),G+=ee>>>13,ee&=8191;var fe=G;fe+=u*D,fe+=h*R,fe+=g*K,fe+=y*ae,fe+=m*ie,G=fe>>>13,fe&=8191,fe+=S*U,fe+=E*I,fe+=A*V,fe+=P*L,fe+=N*(5*v),G+=fe>>>13,fe&=8191;var xe=G;xe+=u*v,xe+=h*D,xe+=g*R,xe+=y*K,xe+=m*ae,G=xe>>>13,xe&=8191,xe+=S*ie,xe+=E*U,xe+=A*I,xe+=P*V,xe+=N*L,G+=xe>>>13,xe&=8191,G=(G<<2)+G|0,G=G+oe|0,oe=G&8191,G=G>>>13,$+=G,u=oe,h=$,g=X,y=W,m=Z,S=te,E=F,A=ee,P=fe,N=xe,c+=16,l-=16}this._h[0]=u,this._h[1]=h,this._h[2]=g,this._h[3]=y,this._h[4]=m,this._h[5]=S,this._h[6]=E,this._h[7]=A,this._h[8]=P,this._h[9]=N},o.prototype.finish=function(a,c){c===void 0&&(c=0);var l=new Uint16Array(10),f,u,h,g;if(this._leftover){for(g=this._leftover,this._buffer[g++]=1;g<16;g++)this._buffer[g]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(f=this._h[1]>>>13,this._h[1]&=8191,g=2;g<10;g++)this._h[g]+=f,f=this._h[g]>>>13,this._h[g]&=8191;for(this._h[0]+=f*5,f=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=f,f=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=f,l[0]=this._h[0]+5,f=l[0]>>>13,l[0]&=8191,g=1;g<10;g++)l[g]=this._h[g]+f,f=l[g]>>>13,l[g]&=8191;for(l[9]-=8192,u=(f^1)-1,g=0;g<10;g++)l[g]&=u;for(u=~u,g=0;g<10;g++)this._h[g]=this._h[g]&u|l[g];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,h=this._h[0]+this._pad[0],this._h[0]=h&65535,g=1;g<8;g++)h=(this._h[g]+this._pad[g]|0)+(h>>>16)|0,this._h[g]=h&65535;return a[c+0]=this._h[0]>>>0,a[c+1]=this._h[0]>>>8,a[c+2]=this._h[1]>>>0,a[c+3]=this._h[1]>>>8,a[c+4]=this._h[2]>>>0,a[c+5]=this._h[2]>>>8,a[c+6]=this._h[3]>>>0,a[c+7]=this._h[3]>>>8,a[c+8]=this._h[4]>>>0,a[c+9]=this._h[4]>>>8,a[c+10]=this._h[5]>>>0,a[c+11]=this._h[5]>>>8,a[c+12]=this._h[6]>>>0,a[c+13]=this._h[6]>>>8,a[c+14]=this._h[7]>>>0,a[c+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var c=0,l=a.length,f;if(this._leftover){f=16-this._leftover,f>l&&(f=l);for(var u=0;u=16&&(f=l-l%16,this._blocks(a,c,f),c+=f,l-=f),l){for(var u=0;u16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var g=new Uint8Array(16);g.set(l,g.length-l.length);var y=new Uint8Array(32);e.stream(this._key,g,y,4);var m=f.length+this.tagLength,S;if(h){if(h.length!==m)throw new Error("ChaCha20Poly1305: incorrect destination length");S=h}else S=new Uint8Array(m);return e.streamXOR(this._key,g,f,S,4),this._authenticate(S.subarray(S.length-this.tagLength,S.length),y,S.subarray(0,S.length-this.tagLength),u),n.wipe(g),S},c.prototype.open=function(l,f,u,h){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(f.length0&&g.update(o.subarray(h.length%16))),g.update(u),u.length%16>0&&g.update(o.subarray(u.length%16));var y=new Uint8Array(8);h&&i.writeUint64LE(h.length,y),g.update(y),i.writeUint64LE(u.length,y),g.update(y);for(var m=g.digest(),S=0;Sthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n256)throw new Error("randomString charset is too long");let h="";const g=f.length,y=256-256%g;for(;l>0;){const m=i(Math.ceil(l*256/y),u);for(let S=0;S0;S++){const E=m[S];E0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=c[f++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(f=s(this._temp,this._state,c,f,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=c[f++],l--;return this},a.prototype.finish=function(c){if(!this._finished){var l=this._bytesHashed,f=this._bufferLength,u=l/536870912|0,h=l<<3,g=l%64<56?64:128;this._buffer[f]=128;for(var y=f+1;y0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(c){r.wipe(c.state),c.buffer&&r.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([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]);function s(a,c,l,f,u){for(;u>=64;){for(var h=c[0],g=c[1],y=c[2],m=c[3],S=c[4],E=c[5],A=c[6],P=c[7],N=0;N<16;N++){var L=f+N*4;a[N]=e.readUint32BE(l,L)}for(var N=16;N<64;N++){var V=a[N-2],I=(V>>>17|V<<15)^(V>>>19|V<<13)^V>>>10;V=a[N-15];var U=(V>>>7|V<<25)^(V>>>18|V<<14)^V>>>3;a[N]=(I+a[N-7]|0)+(U+a[N-16]|0)}for(var N=0;N<64;N++){var I=(((S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7))+(S&E^~S&A)|0)+(P+(i[N]+a[N]|0)|0)|0,U=((h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10))+(h&g^h&y^g&y)|0;P=A,A=E,E=S,S=m+I|0,m=y,y=g,g=h,h=I+U|0}c[0]+=h,c[1]+=g,c[2]+=y,c[3]+=m,c[4]+=S,c[5]+=E,c[6]+=A,c[7]+=P,f+=64,u-=64}return f}function o(a){var c=new n;c.update(a);var l=c.digest();return c.clean(),l}t.hash=o})(mx);var gO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=e0,r=Ea;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(N){const L=new Float64Array(16);if(N)for(let V=0;V>16&1),V[ae-1]&=65535;V[15]=I[15]-32767-(V[14]>>16&1);const ie=V[15]>>16&1;V[14]&=65535,a(I,V,1-ie)}for(let U=0;U<16;U++)N[2*U]=I[U]&255,N[2*U+1]=I[U]>>8}function l(N,L){for(let V=0;V<16;V++)N[V]=L[2*V]+(L[2*V+1]<<8);N[15]&=32767}function f(N,L,V){for(let I=0;I<16;I++)N[I]=L[I]+V[I]}function u(N,L,V){for(let I=0;I<16;I++)N[I]=L[I]-V[I]}function h(N,L,V){let I,U,ie=0,ae=0,K=0,R=0,D=0,v=0,b=0,M=0,B=0,x=0,C=0,w=0,k=0,O=0,G=0,oe=0,$=0,X=0,W=0,Z=0,te=0,F=0,ee=0,fe=0,xe=0,_e=0,Me=0,Ke=0,ze=0,Je=0,Xe=0,lt=V[0],Re=V[1],$e=V[2],st=V[3],Qe=V[4],ct=V[5],tt=V[6],He=V[7],at=V[8],pt=V[9],Ge=V[10],vt=V[11],bt=V[12],Ze=V[13],_t=V[14],Ct=V[15];I=L[0],ie+=I*lt,ae+=I*Re,K+=I*$e,R+=I*st,D+=I*Qe,v+=I*ct,b+=I*tt,M+=I*He,B+=I*at,x+=I*pt,C+=I*Ge,w+=I*vt,k+=I*bt,O+=I*Ze,G+=I*_t,oe+=I*Ct,I=L[1],ae+=I*lt,K+=I*Re,R+=I*$e,D+=I*st,v+=I*Qe,b+=I*ct,M+=I*tt,B+=I*He,x+=I*at,C+=I*pt,w+=I*Ge,k+=I*vt,O+=I*bt,G+=I*Ze,oe+=I*_t,$+=I*Ct,I=L[2],K+=I*lt,R+=I*Re,D+=I*$e,v+=I*st,b+=I*Qe,M+=I*ct,B+=I*tt,x+=I*He,C+=I*at,w+=I*pt,k+=I*Ge,O+=I*vt,G+=I*bt,oe+=I*Ze,$+=I*_t,X+=I*Ct,I=L[3],R+=I*lt,D+=I*Re,v+=I*$e,b+=I*st,M+=I*Qe,B+=I*ct,x+=I*tt,C+=I*He,w+=I*at,k+=I*pt,O+=I*Ge,G+=I*vt,oe+=I*bt,$+=I*Ze,X+=I*_t,W+=I*Ct,I=L[4],D+=I*lt,v+=I*Re,b+=I*$e,M+=I*st,B+=I*Qe,x+=I*ct,C+=I*tt,w+=I*He,k+=I*at,O+=I*pt,G+=I*Ge,oe+=I*vt,$+=I*bt,X+=I*Ze,W+=I*_t,Z+=I*Ct,I=L[5],v+=I*lt,b+=I*Re,M+=I*$e,B+=I*st,x+=I*Qe,C+=I*ct,w+=I*tt,k+=I*He,O+=I*at,G+=I*pt,oe+=I*Ge,$+=I*vt,X+=I*bt,W+=I*Ze,Z+=I*_t,te+=I*Ct,I=L[6],b+=I*lt,M+=I*Re,B+=I*$e,x+=I*st,C+=I*Qe,w+=I*ct,k+=I*tt,O+=I*He,G+=I*at,oe+=I*pt,$+=I*Ge,X+=I*vt,W+=I*bt,Z+=I*Ze,te+=I*_t,F+=I*Ct,I=L[7],M+=I*lt,B+=I*Re,x+=I*$e,C+=I*st,w+=I*Qe,k+=I*ct,O+=I*tt,G+=I*He,oe+=I*at,$+=I*pt,X+=I*Ge,W+=I*vt,Z+=I*bt,te+=I*Ze,F+=I*_t,ee+=I*Ct,I=L[8],B+=I*lt,x+=I*Re,C+=I*$e,w+=I*st,k+=I*Qe,O+=I*ct,G+=I*tt,oe+=I*He,$+=I*at,X+=I*pt,W+=I*Ge,Z+=I*vt,te+=I*bt,F+=I*Ze,ee+=I*_t,fe+=I*Ct,I=L[9],x+=I*lt,C+=I*Re,w+=I*$e,k+=I*st,O+=I*Qe,G+=I*ct,oe+=I*tt,$+=I*He,X+=I*at,W+=I*pt,Z+=I*Ge,te+=I*vt,F+=I*bt,ee+=I*Ze,fe+=I*_t,xe+=I*Ct,I=L[10],C+=I*lt,w+=I*Re,k+=I*$e,O+=I*st,G+=I*Qe,oe+=I*ct,$+=I*tt,X+=I*He,W+=I*at,Z+=I*pt,te+=I*Ge,F+=I*vt,ee+=I*bt,fe+=I*Ze,xe+=I*_t,_e+=I*Ct,I=L[11],w+=I*lt,k+=I*Re,O+=I*$e,G+=I*st,oe+=I*Qe,$+=I*ct,X+=I*tt,W+=I*He,Z+=I*at,te+=I*pt,F+=I*Ge,ee+=I*vt,fe+=I*bt,xe+=I*Ze,_e+=I*_t,Me+=I*Ct,I=L[12],k+=I*lt,O+=I*Re,G+=I*$e,oe+=I*st,$+=I*Qe,X+=I*ct,W+=I*tt,Z+=I*He,te+=I*at,F+=I*pt,ee+=I*Ge,fe+=I*vt,xe+=I*bt,_e+=I*Ze,Me+=I*_t,Ke+=I*Ct,I=L[13],O+=I*lt,G+=I*Re,oe+=I*$e,$+=I*st,X+=I*Qe,W+=I*ct,Z+=I*tt,te+=I*He,F+=I*at,ee+=I*pt,fe+=I*Ge,xe+=I*vt,_e+=I*bt,Me+=I*Ze,Ke+=I*_t,ze+=I*Ct,I=L[14],G+=I*lt,oe+=I*Re,$+=I*$e,X+=I*st,W+=I*Qe,Z+=I*ct,te+=I*tt,F+=I*He,ee+=I*at,fe+=I*pt,xe+=I*Ge,_e+=I*vt,Me+=I*bt,Ke+=I*Ze,ze+=I*_t,Je+=I*Ct,I=L[15],oe+=I*lt,$+=I*Re,X+=I*$e,W+=I*st,Z+=I*Qe,te+=I*ct,F+=I*tt,ee+=I*He,fe+=I*at,xe+=I*pt,_e+=I*Ge,Me+=I*vt,Ke+=I*bt,ze+=I*Ze,Je+=I*_t,Xe+=I*Ct,ie+=38*$,ae+=38*X,K+=38*W,R+=38*Z,D+=38*te,v+=38*F,b+=38*ee,M+=38*fe,B+=38*xe,x+=38*_e,C+=38*Me,w+=38*Ke,k+=38*ze,O+=38*Je,G+=38*Xe,U=1,I=ie+U+65535,U=Math.floor(I/65536),ie=I-U*65536,I=ae+U+65535,U=Math.floor(I/65536),ae=I-U*65536,I=K+U+65535,U=Math.floor(I/65536),K=I-U*65536,I=R+U+65535,U=Math.floor(I/65536),R=I-U*65536,I=D+U+65535,U=Math.floor(I/65536),D=I-U*65536,I=v+U+65535,U=Math.floor(I/65536),v=I-U*65536,I=b+U+65535,U=Math.floor(I/65536),b=I-U*65536,I=M+U+65535,U=Math.floor(I/65536),M=I-U*65536,I=B+U+65535,U=Math.floor(I/65536),B=I-U*65536,I=x+U+65535,U=Math.floor(I/65536),x=I-U*65536,I=C+U+65535,U=Math.floor(I/65536),C=I-U*65536,I=w+U+65535,U=Math.floor(I/65536),w=I-U*65536,I=k+U+65535,U=Math.floor(I/65536),k=I-U*65536,I=O+U+65535,U=Math.floor(I/65536),O=I-U*65536,I=G+U+65535,U=Math.floor(I/65536),G=I-U*65536,I=oe+U+65535,U=Math.floor(I/65536),oe=I-U*65536,ie+=U-1+37*(U-1),U=1,I=ie+U+65535,U=Math.floor(I/65536),ie=I-U*65536,I=ae+U+65535,U=Math.floor(I/65536),ae=I-U*65536,I=K+U+65535,U=Math.floor(I/65536),K=I-U*65536,I=R+U+65535,U=Math.floor(I/65536),R=I-U*65536,I=D+U+65535,U=Math.floor(I/65536),D=I-U*65536,I=v+U+65535,U=Math.floor(I/65536),v=I-U*65536,I=b+U+65535,U=Math.floor(I/65536),b=I-U*65536,I=M+U+65535,U=Math.floor(I/65536),M=I-U*65536,I=B+U+65535,U=Math.floor(I/65536),B=I-U*65536,I=x+U+65535,U=Math.floor(I/65536),x=I-U*65536,I=C+U+65535,U=Math.floor(I/65536),C=I-U*65536,I=w+U+65535,U=Math.floor(I/65536),w=I-U*65536,I=k+U+65535,U=Math.floor(I/65536),k=I-U*65536,I=O+U+65535,U=Math.floor(I/65536),O=I-U*65536,I=G+U+65535,U=Math.floor(I/65536),G=I-U*65536,I=oe+U+65535,U=Math.floor(I/65536),oe=I-U*65536,ie+=U-1+37*(U-1),N[0]=ie,N[1]=ae,N[2]=K,N[3]=R,N[4]=D,N[5]=v,N[6]=b,N[7]=M,N[8]=B,N[9]=x,N[10]=C,N[11]=w,N[12]=k,N[13]=O,N[14]=G,N[15]=oe}function g(N,L){h(N,L,L)}function y(N,L){const V=n();for(let I=0;I<16;I++)V[I]=L[I];for(let I=253;I>=0;I--)g(V,V),I!==2&&I!==4&&h(V,V,L);for(let I=0;I<16;I++)N[I]=V[I]}function m(N,L){const V=new Uint8Array(32),I=new Float64Array(80),U=n(),ie=n(),ae=n(),K=n(),R=n(),D=n();for(let B=0;B<31;B++)V[B]=N[B];V[31]=N[31]&127|64,V[0]&=248,l(I,L);for(let B=0;B<16;B++)ie[B]=I[B];U[0]=K[0]=1;for(let B=254;B>=0;--B){const x=V[B>>>3]>>>(B&7)&1;a(U,ie,x),a(ae,K,x),f(R,U,ae),u(U,U,ae),f(ae,ie,K),u(ie,ie,K),g(K,R),g(D,U),h(U,ae,U),h(ae,ie,R),f(R,U,ae),u(U,U,ae),g(ie,U),u(ae,K,D),h(U,ae,s),f(U,U,K),h(ae,ae,U),h(U,K,D),h(K,ie,I),g(ie,R),a(U,ie,x),a(ae,K,x)}for(let B=0;B<16;B++)I[B+16]=U[B],I[B+32]=ae[B],I[B+48]=ie[B],I[B+64]=K[B];const v=I.subarray(32),b=I.subarray(16);y(v,v),h(b,b,v);const M=new Uint8Array(32);return c(M,b),M}t.scalarMult=m;function S(N){return m(N,i)}t.scalarMultBase=S;function E(N){if(N.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const L=new Uint8Array(N);return{publicKey:S(L),secretKey:L}}t.generateKeyPairFromSeed=E;function A(N){const L=(0,e.randomBytes)(32,N),V=E(L);return(0,r.wipe)(L),V}t.generateKeyPair=A;function P(N,L,V=!1){if(N.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(L.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const I=m(N,L);if(V){let U=0;for(let ie=0;iei+s.length,0));const r=ine(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function DOe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,N=new Uint8Array(P);E!==A;){for(var L=y[E],V=0,I=P-1;(L!==0||V>>0,N[I]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");S=V,E++}for(var U=P-S;U!==P&&N[U]===0;)U++;for(var ie=c.repeat(m);U>>0,P=new Uint8Array(A);y[m];){var N=r[y.charCodeAt(m)];if(N===255)return;for(var L=0,V=A-1;(N!==0||L>>0,P[V]=N%256>>>0,N=N/256>>>0;if(N!==0)throw new Error("Non-zero carry");E=L,m++}if(y[m]!==" "){for(var I=A-E;I!==A&&P[I]===0;)I++;for(var U=new Uint8Array(S+(A-I)),ie=S;I!==A;)U[ie++]=P[I++];return U}}}function g(y){var m=h(y);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:h,decode:g}}var NOe=DOe,BOe=NOe;const LOe=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},FOe=t=>new TextEncoder().encode(t),jOe=t=>new TextDecoder().decode(t);class UOe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class $Oe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return sne(this,e)}}class qOe{constructor(e){this.decoders=e}or(e){return sne(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const sne=(t,e)=>new qOe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class VOe{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new UOe(e,r,n),this.decoder=new $Oe(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const vC=({name:t,prefix:e,encode:r,decode:n})=>new VOe(t,e,r,n),bx=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=BOe(r,e);return vC({prefix:t,name:e,encode:n,decode:s=>LOe(i(s))})},zOe=(t,e,r,n)=>{const i={};for(let f=0;f=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},HOe=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<vC({prefix:e,name:t,encode(i){return HOe(i,n,r)},decode(i){return zOe(i,n,r,t)}}),GOe=vC({prefix:"\0",name:"identity",encode:t=>jOe(t),decode:t=>FOe(t)}),WOe=Object.freeze(Object.defineProperty({__proto__:null,identity:GOe},Symbol.toStringTag,{value:"Module"})),KOe=us({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),YOe=Object.freeze(Object.defineProperty({__proto__:null,base2:KOe},Symbol.toStringTag,{value:"Module"})),QOe=us({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),JOe=Object.freeze(Object.defineProperty({__proto__:null,base8:QOe},Symbol.toStringTag,{value:"Module"})),ZOe=bx({prefix:"9",name:"base10",alphabet:"0123456789"}),XOe=Object.freeze(Object.defineProperty({__proto__:null,base10:ZOe},Symbol.toStringTag,{value:"Module"})),eDe=us({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),tDe=us({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),rDe=Object.freeze(Object.defineProperty({__proto__:null,base16:eDe,base16upper:tDe},Symbol.toStringTag,{value:"Module"})),nDe=us({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),iDe=us({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sDe=us({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),oDe=us({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),aDe=us({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cDe=us({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),lDe=us({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fDe=us({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uDe=us({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),dDe=Object.freeze(Object.defineProperty({__proto__:null,base32:nDe,base32hex:aDe,base32hexpad:lDe,base32hexpadupper:fDe,base32hexupper:cDe,base32pad:sDe,base32padupper:oDe,base32upper:iDe,base32z:uDe},Symbol.toStringTag,{value:"Module"})),hDe=bx({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pDe=bx({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),vDe=Object.freeze(Object.defineProperty({__proto__:null,base36:hDe,base36upper:pDe},Symbol.toStringTag,{value:"Module"})),gDe=bx({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),yDe=bx({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),mDe=Object.freeze(Object.defineProperty({__proto__:null,base58btc:gDe,base58flickr:yDe},Symbol.toStringTag,{value:"Module"})),bDe=us({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wDe=us({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xDe=us({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),EDe=us({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),CDe=Object.freeze(Object.defineProperty({__proto__:null,base64:bDe,base64pad:wDe,base64url:xDe,base64urlpad:EDe},Symbol.toStringTag,{value:"Module"})),one=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),ADe=one.reduce((t,e,r)=>(t[r]=e,t),[]),SDe=one.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function _De(t){return t.reduce((e,r)=>(e+=ADe[r],e),"")}function IDe(t){const e=[];for(const r of t){const n=SDe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const TDe=vC({prefix:"🚀",name:"base256emoji",encode:_De,decode:IDe}),PDe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:TDe},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const W$={...WOe,...YOe,...JOe,...XOe,...rDe,...dDe,...vDe,...mDe,...CDe,...PDe};function ane(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const K$=ane("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),XS=ane("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=ine(t.length);for(let r=0;r",jDe="MIT",UDe={url:"https://github.com/indutny/elliptic/issues"},$De="https://github.com/indutny/elliptic",qDe={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},VDe={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},zDe={name:kDe,version:RDe,description:MDe,main:ODe,files:DDe,scripts:NDe,repository:BDe,keywords:LDe,author:FDe,license:jDe,bugs:UDe,homepage:$De,devDependencies:qDe,dependencies:VDe};var Ca={},yO={exports:{}};yO.exports;(function(t){(function(e,r){function n(K,R){if(!K)throw new Error(R||"Assertion failed")}function i(K,R){K.super_=R;var D=function(){};D.prototype=R.prototype,K.prototype=new D,K.prototype.constructor=K}function s(K,R,D){if(s.isBN(K))return K;this.negative=0,this.words=null,this.length=0,this.red=null,K!==null&&((R==="le"||R==="be")&&(D=R,R=10),this._init(K||0,R||10,D||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=oC.Buffer}catch{}s.isBN=function(R){return R instanceof s?!0:R!==null&&typeof R=="object"&&R.constructor.wordSize===s.wordSize&&Array.isArray(R.words)},s.max=function(R,D){return R.cmp(D)>0?R:D},s.min=function(R,D){return R.cmp(D)<0?R:D},s.prototype._init=function(R,D,v){if(typeof R=="number")return this._initNumber(R,D,v);if(typeof R=="object")return this._initArray(R,D,v);D==="hex"&&(D=16),n(D===(D|0)&&D>=2&&D<=36),R=R.toString().replace(/\s+/g,"");var b=0;R[0]==="-"&&(b++,this.negative=1),b=0;b-=3)B=R[b]|R[b-1]<<8|R[b-2]<<16,this.words[M]|=B<>>26-x&67108863,x+=24,x>=26&&(x-=26,M++);else if(v==="le")for(b=0,M=0;b>>26-x&67108863,x+=24,x>=26&&(x-=26,M++);return this.strip()};function a(K,R){var D=K.charCodeAt(R);return D>=65&&D<=70?D-55:D>=97&&D<=102?D-87:D-48&15}function c(K,R,D){var v=a(K,D);return D-1>=R&&(v|=a(K,D-1)<<4),v}s.prototype._parseHex=function(R,D,v){this.length=Math.ceil((R.length-D)/6),this.words=new Array(this.length);for(var b=0;b=D;b-=2)x=c(R,D,b)<=18?(M-=18,B+=1,this.words[B]|=x>>>26):M+=8;else{var C=R.length-D;for(b=C%2===0?D+1:D;b=18?(M-=18,B+=1,this.words[B]|=x>>>26):M+=8}this.strip()};function l(K,R,D,v){for(var b=0,M=Math.min(K.length,D),B=R;B=49?b+=x-49+10:x>=17?b+=x-17+10:b+=x}return b}s.prototype._parseBase=function(R,D,v){this.words=[0],this.length=1;for(var b=0,M=1;M<=67108863;M*=D)b++;b--,M=M/D|0;for(var B=R.length-v,x=B%b,C=Math.min(B,B-x)+v,w=0,k=v;k1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(R,D){R=R||10,D=D|0||1;var v;if(R===16||R==="hex"){v="";for(var b=0,M=0,B=0;B>>24-b&16777215,b+=2,b>=26&&(b-=26,B--),M!==0||B!==this.length-1?v=f[6-C.length]+C+v:v=C+v}for(M!==0&&(v=M.toString(16)+v);v.length%D!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(R===(R|0)&&R>=2&&R<=36){var w=u[R],k=h[R];v="";var O=this.clone();for(O.negative=0;!O.isZero();){var G=O.modn(k).toString(R);O=O.idivn(k),O.isZero()?v=G+v:v=f[w-G.length]+G+v}for(this.isZero()&&(v="0"+v);v.length%D!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var R=this.words[0];return this.length===2?R+=this.words[1]*67108864:this.length===3&&this.words[2]===1?R+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-R:R},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(R,D){return n(typeof o<"u"),this.toArrayLike(o,R,D)},s.prototype.toArray=function(R,D){return this.toArrayLike(Array,R,D)},s.prototype.toArrayLike=function(R,D,v){var b=this.byteLength(),M=v||Math.max(1,b);n(b<=M,"byte array longer than desired length"),n(M>0,"Requested array length <= 0"),this.strip();var B=D==="le",x=new R(M),C,w,k=this.clone();if(B){for(w=0;!k.isZero();w++)C=k.andln(255),k.iushrn(8),x[w]=C;for(;w=4096&&(v+=13,D>>>=13),D>=64&&(v+=7,D>>>=7),D>=8&&(v+=4,D>>>=4),D>=2&&(v+=2,D>>>=2),v+D},s.prototype._zeroBits=function(R){if(R===0)return 26;var D=R,v=0;return D&8191||(v+=13,D>>>=13),D&127||(v+=7,D>>>=7),D&15||(v+=4,D>>>=4),D&3||(v+=2,D>>>=2),D&1||v++,v},s.prototype.bitLength=function(){var R=this.words[this.length-1],D=this._countBits(R);return(this.length-1)*26+D};function g(K){for(var R=new Array(K.bitLength()),D=0;D>>b}return R}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var R=0,D=0;DR.length?this.clone().ior(R):R.clone().ior(this)},s.prototype.uor=function(R){return this.length>R.length?this.clone().iuor(R):R.clone().iuor(this)},s.prototype.iuand=function(R){var D;this.length>R.length?D=R:D=this;for(var v=0;vR.length?this.clone().iand(R):R.clone().iand(this)},s.prototype.uand=function(R){return this.length>R.length?this.clone().iuand(R):R.clone().iuand(this)},s.prototype.iuxor=function(R){var D,v;this.length>R.length?(D=this,v=R):(D=R,v=this);for(var b=0;bR.length?this.clone().ixor(R):R.clone().ixor(this)},s.prototype.uxor=function(R){return this.length>R.length?this.clone().iuxor(R):R.clone().iuxor(this)},s.prototype.inotn=function(R){n(typeof R=="number"&&R>=0);var D=Math.ceil(R/26)|0,v=R%26;this._expand(D),v>0&&D--;for(var b=0;b0&&(this.words[b]=~this.words[b]&67108863>>26-v),this.strip()},s.prototype.notn=function(R){return this.clone().inotn(R)},s.prototype.setn=function(R,D){n(typeof R=="number"&&R>=0);var v=R/26|0,b=R%26;return this._expand(v+1),D?this.words[v]=this.words[v]|1<R.length?(v=this,b=R):(v=R,b=this);for(var M=0,B=0;B>>26;for(;M!==0&&B>>26;if(this.length=v.length,M!==0)this.words[this.length]=M,this.length++;else if(v!==this)for(;BR.length?this.clone().iadd(R):R.clone().iadd(this)},s.prototype.isub=function(R){if(R.negative!==0){R.negative=0;var D=this.iadd(R);return R.negative=1,D._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(R),this.negative=1,this._normSign();var v=this.cmp(R);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var b,M;v>0?(b=this,M=R):(b=R,M=this);for(var B=0,x=0;x>26,this.words[x]=D&67108863;for(;B!==0&&x>26,this.words[x]=D&67108863;if(B===0&&x>>26,O=C&67108863,G=Math.min(w,R.length-1),oe=Math.max(0,w-K.length+1);oe<=G;oe++){var $=w-oe|0;b=K.words[$]|0,M=R.words[oe]|0,B=b*M+O,k+=B/67108864|0,O=B&67108863}D.words[w]=O|0,C=k|0}return C!==0?D.words[w]=C|0:D.length--,D.strip()}var m=function(R,D,v){var b=R.words,M=D.words,B=v.words,x=0,C,w,k,O=b[0]|0,G=O&8191,oe=O>>>13,$=b[1]|0,X=$&8191,W=$>>>13,Z=b[2]|0,te=Z&8191,F=Z>>>13,ee=b[3]|0,fe=ee&8191,xe=ee>>>13,_e=b[4]|0,Me=_e&8191,Ke=_e>>>13,ze=b[5]|0,Je=ze&8191,Xe=ze>>>13,lt=b[6]|0,Re=lt&8191,$e=lt>>>13,st=b[7]|0,Qe=st&8191,ct=st>>>13,tt=b[8]|0,He=tt&8191,at=tt>>>13,pt=b[9]|0,Ge=pt&8191,vt=pt>>>13,bt=M[0]|0,Ze=bt&8191,_t=bt>>>13,Ct=M[1]|0,It=Ct&8191,er=Ct>>>13,dr=M[2]|0,wt=dr&8191,lr=dr>>>13,ir=M[3]|0,Pt=ir&8191,Dt=ir>>>13,Nt=M[4]|0,dt=Nt&8191,Lt=Nt>>>13,kt=M[5]|0,ut=kt&8191,zt=kt>>>13,Ht=M[6]|0,ht=Ht&8191,xt=Ht>>>13,Bt=M[7]|0,Ve=Bt&8191,$t=Bt>>>13,Et=M[8]|0,ot=Et&8191,Gt=Et>>>13,Nr=M[9]|0,Ut=Nr&8191,Pr=Nr>>>13;v.negative=R.negative^D.negative,v.length=19,C=Math.imul(G,Ze),w=Math.imul(G,_t),w=w+Math.imul(oe,Ze)|0,k=Math.imul(oe,_t);var tr=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(tr>>>26)|0,tr&=67108863,C=Math.imul(X,Ze),w=Math.imul(X,_t),w=w+Math.imul(W,Ze)|0,k=Math.imul(W,_t),C=C+Math.imul(G,It)|0,w=w+Math.imul(G,er)|0,w=w+Math.imul(oe,It)|0,k=k+Math.imul(oe,er)|0;var Or=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(Or>>>26)|0,Or&=67108863,C=Math.imul(te,Ze),w=Math.imul(te,_t),w=w+Math.imul(F,Ze)|0,k=Math.imul(F,_t),C=C+Math.imul(X,It)|0,w=w+Math.imul(X,er)|0,w=w+Math.imul(W,It)|0,k=k+Math.imul(W,er)|0,C=C+Math.imul(G,wt)|0,w=w+Math.imul(G,lr)|0,w=w+Math.imul(oe,wt)|0,k=k+Math.imul(oe,lr)|0;var pi=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(pi>>>26)|0,pi&=67108863,C=Math.imul(fe,Ze),w=Math.imul(fe,_t),w=w+Math.imul(xe,Ze)|0,k=Math.imul(xe,_t),C=C+Math.imul(te,It)|0,w=w+Math.imul(te,er)|0,w=w+Math.imul(F,It)|0,k=k+Math.imul(F,er)|0,C=C+Math.imul(X,wt)|0,w=w+Math.imul(X,lr)|0,w=w+Math.imul(W,wt)|0,k=k+Math.imul(W,lr)|0,C=C+Math.imul(G,Pt)|0,w=w+Math.imul(G,Dt)|0,w=w+Math.imul(oe,Pt)|0,k=k+Math.imul(oe,Dt)|0;var vi=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(vi>>>26)|0,vi&=67108863,C=Math.imul(Me,Ze),w=Math.imul(Me,_t),w=w+Math.imul(Ke,Ze)|0,k=Math.imul(Ke,_t),C=C+Math.imul(fe,It)|0,w=w+Math.imul(fe,er)|0,w=w+Math.imul(xe,It)|0,k=k+Math.imul(xe,er)|0,C=C+Math.imul(te,wt)|0,w=w+Math.imul(te,lr)|0,w=w+Math.imul(F,wt)|0,k=k+Math.imul(F,lr)|0,C=C+Math.imul(X,Pt)|0,w=w+Math.imul(X,Dt)|0,w=w+Math.imul(W,Pt)|0,k=k+Math.imul(W,Dt)|0,C=C+Math.imul(G,dt)|0,w=w+Math.imul(G,Lt)|0,w=w+Math.imul(oe,dt)|0,k=k+Math.imul(oe,Lt)|0;var gi=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(gi>>>26)|0,gi&=67108863,C=Math.imul(Je,Ze),w=Math.imul(Je,_t),w=w+Math.imul(Xe,Ze)|0,k=Math.imul(Xe,_t),C=C+Math.imul(Me,It)|0,w=w+Math.imul(Me,er)|0,w=w+Math.imul(Ke,It)|0,k=k+Math.imul(Ke,er)|0,C=C+Math.imul(fe,wt)|0,w=w+Math.imul(fe,lr)|0,w=w+Math.imul(xe,wt)|0,k=k+Math.imul(xe,lr)|0,C=C+Math.imul(te,Pt)|0,w=w+Math.imul(te,Dt)|0,w=w+Math.imul(F,Pt)|0,k=k+Math.imul(F,Dt)|0,C=C+Math.imul(X,dt)|0,w=w+Math.imul(X,Lt)|0,w=w+Math.imul(W,dt)|0,k=k+Math.imul(W,Lt)|0,C=C+Math.imul(G,ut)|0,w=w+Math.imul(G,zt)|0,w=w+Math.imul(oe,ut)|0,k=k+Math.imul(oe,zt)|0;var _i=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(_i>>>26)|0,_i&=67108863,C=Math.imul(Re,Ze),w=Math.imul(Re,_t),w=w+Math.imul($e,Ze)|0,k=Math.imul($e,_t),C=C+Math.imul(Je,It)|0,w=w+Math.imul(Je,er)|0,w=w+Math.imul(Xe,It)|0,k=k+Math.imul(Xe,er)|0,C=C+Math.imul(Me,wt)|0,w=w+Math.imul(Me,lr)|0,w=w+Math.imul(Ke,wt)|0,k=k+Math.imul(Ke,lr)|0,C=C+Math.imul(fe,Pt)|0,w=w+Math.imul(fe,Dt)|0,w=w+Math.imul(xe,Pt)|0,k=k+Math.imul(xe,Dt)|0,C=C+Math.imul(te,dt)|0,w=w+Math.imul(te,Lt)|0,w=w+Math.imul(F,dt)|0,k=k+Math.imul(F,Lt)|0,C=C+Math.imul(X,ut)|0,w=w+Math.imul(X,zt)|0,w=w+Math.imul(W,ut)|0,k=k+Math.imul(W,zt)|0,C=C+Math.imul(G,ht)|0,w=w+Math.imul(G,xt)|0,w=w+Math.imul(oe,ht)|0,k=k+Math.imul(oe,xt)|0;var Tn=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,C=Math.imul(Qe,Ze),w=Math.imul(Qe,_t),w=w+Math.imul(ct,Ze)|0,k=Math.imul(ct,_t),C=C+Math.imul(Re,It)|0,w=w+Math.imul(Re,er)|0,w=w+Math.imul($e,It)|0,k=k+Math.imul($e,er)|0,C=C+Math.imul(Je,wt)|0,w=w+Math.imul(Je,lr)|0,w=w+Math.imul(Xe,wt)|0,k=k+Math.imul(Xe,lr)|0,C=C+Math.imul(Me,Pt)|0,w=w+Math.imul(Me,Dt)|0,w=w+Math.imul(Ke,Pt)|0,k=k+Math.imul(Ke,Dt)|0,C=C+Math.imul(fe,dt)|0,w=w+Math.imul(fe,Lt)|0,w=w+Math.imul(xe,dt)|0,k=k+Math.imul(xe,Lt)|0,C=C+Math.imul(te,ut)|0,w=w+Math.imul(te,zt)|0,w=w+Math.imul(F,ut)|0,k=k+Math.imul(F,zt)|0,C=C+Math.imul(X,ht)|0,w=w+Math.imul(X,xt)|0,w=w+Math.imul(W,ht)|0,k=k+Math.imul(W,xt)|0,C=C+Math.imul(G,Ve)|0,w=w+Math.imul(G,$t)|0,w=w+Math.imul(oe,Ve)|0,k=k+Math.imul(oe,$t)|0;var ps=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(ps>>>26)|0,ps&=67108863,C=Math.imul(He,Ze),w=Math.imul(He,_t),w=w+Math.imul(at,Ze)|0,k=Math.imul(at,_t),C=C+Math.imul(Qe,It)|0,w=w+Math.imul(Qe,er)|0,w=w+Math.imul(ct,It)|0,k=k+Math.imul(ct,er)|0,C=C+Math.imul(Re,wt)|0,w=w+Math.imul(Re,lr)|0,w=w+Math.imul($e,wt)|0,k=k+Math.imul($e,lr)|0,C=C+Math.imul(Je,Pt)|0,w=w+Math.imul(Je,Dt)|0,w=w+Math.imul(Xe,Pt)|0,k=k+Math.imul(Xe,Dt)|0,C=C+Math.imul(Me,dt)|0,w=w+Math.imul(Me,Lt)|0,w=w+Math.imul(Ke,dt)|0,k=k+Math.imul(Ke,Lt)|0,C=C+Math.imul(fe,ut)|0,w=w+Math.imul(fe,zt)|0,w=w+Math.imul(xe,ut)|0,k=k+Math.imul(xe,zt)|0,C=C+Math.imul(te,ht)|0,w=w+Math.imul(te,xt)|0,w=w+Math.imul(F,ht)|0,k=k+Math.imul(F,xt)|0,C=C+Math.imul(X,Ve)|0,w=w+Math.imul(X,$t)|0,w=w+Math.imul(W,Ve)|0,k=k+Math.imul(W,$t)|0,C=C+Math.imul(G,ot)|0,w=w+Math.imul(G,Gt)|0,w=w+Math.imul(oe,ot)|0,k=k+Math.imul(oe,Gt)|0;var vs=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(vs>>>26)|0,vs&=67108863,C=Math.imul(Ge,Ze),w=Math.imul(Ge,_t),w=w+Math.imul(vt,Ze)|0,k=Math.imul(vt,_t),C=C+Math.imul(He,It)|0,w=w+Math.imul(He,er)|0,w=w+Math.imul(at,It)|0,k=k+Math.imul(at,er)|0,C=C+Math.imul(Qe,wt)|0,w=w+Math.imul(Qe,lr)|0,w=w+Math.imul(ct,wt)|0,k=k+Math.imul(ct,lr)|0,C=C+Math.imul(Re,Pt)|0,w=w+Math.imul(Re,Dt)|0,w=w+Math.imul($e,Pt)|0,k=k+Math.imul($e,Dt)|0,C=C+Math.imul(Je,dt)|0,w=w+Math.imul(Je,Lt)|0,w=w+Math.imul(Xe,dt)|0,k=k+Math.imul(Xe,Lt)|0,C=C+Math.imul(Me,ut)|0,w=w+Math.imul(Me,zt)|0,w=w+Math.imul(Ke,ut)|0,k=k+Math.imul(Ke,zt)|0,C=C+Math.imul(fe,ht)|0,w=w+Math.imul(fe,xt)|0,w=w+Math.imul(xe,ht)|0,k=k+Math.imul(xe,xt)|0,C=C+Math.imul(te,Ve)|0,w=w+Math.imul(te,$t)|0,w=w+Math.imul(F,Ve)|0,k=k+Math.imul(F,$t)|0,C=C+Math.imul(X,ot)|0,w=w+Math.imul(X,Gt)|0,w=w+Math.imul(W,ot)|0,k=k+Math.imul(W,Gt)|0,C=C+Math.imul(G,Ut)|0,w=w+Math.imul(G,Pr)|0,w=w+Math.imul(oe,Ut)|0,k=k+Math.imul(oe,Pr)|0;var gs=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(gs>>>26)|0,gs&=67108863,C=Math.imul(Ge,It),w=Math.imul(Ge,er),w=w+Math.imul(vt,It)|0,k=Math.imul(vt,er),C=C+Math.imul(He,wt)|0,w=w+Math.imul(He,lr)|0,w=w+Math.imul(at,wt)|0,k=k+Math.imul(at,lr)|0,C=C+Math.imul(Qe,Pt)|0,w=w+Math.imul(Qe,Dt)|0,w=w+Math.imul(ct,Pt)|0,k=k+Math.imul(ct,Dt)|0,C=C+Math.imul(Re,dt)|0,w=w+Math.imul(Re,Lt)|0,w=w+Math.imul($e,dt)|0,k=k+Math.imul($e,Lt)|0,C=C+Math.imul(Je,ut)|0,w=w+Math.imul(Je,zt)|0,w=w+Math.imul(Xe,ut)|0,k=k+Math.imul(Xe,zt)|0,C=C+Math.imul(Me,ht)|0,w=w+Math.imul(Me,xt)|0,w=w+Math.imul(Ke,ht)|0,k=k+Math.imul(Ke,xt)|0,C=C+Math.imul(fe,Ve)|0,w=w+Math.imul(fe,$t)|0,w=w+Math.imul(xe,Ve)|0,k=k+Math.imul(xe,$t)|0,C=C+Math.imul(te,ot)|0,w=w+Math.imul(te,Gt)|0,w=w+Math.imul(F,ot)|0,k=k+Math.imul(F,Gt)|0,C=C+Math.imul(X,Ut)|0,w=w+Math.imul(X,Pr)|0,w=w+Math.imul(W,Ut)|0,k=k+Math.imul(W,Pr)|0;var Hi=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,C=Math.imul(Ge,wt),w=Math.imul(Ge,lr),w=w+Math.imul(vt,wt)|0,k=Math.imul(vt,lr),C=C+Math.imul(He,Pt)|0,w=w+Math.imul(He,Dt)|0,w=w+Math.imul(at,Pt)|0,k=k+Math.imul(at,Dt)|0,C=C+Math.imul(Qe,dt)|0,w=w+Math.imul(Qe,Lt)|0,w=w+Math.imul(ct,dt)|0,k=k+Math.imul(ct,Lt)|0,C=C+Math.imul(Re,ut)|0,w=w+Math.imul(Re,zt)|0,w=w+Math.imul($e,ut)|0,k=k+Math.imul($e,zt)|0,C=C+Math.imul(Je,ht)|0,w=w+Math.imul(Je,xt)|0,w=w+Math.imul(Xe,ht)|0,k=k+Math.imul(Xe,xt)|0,C=C+Math.imul(Me,Ve)|0,w=w+Math.imul(Me,$t)|0,w=w+Math.imul(Ke,Ve)|0,k=k+Math.imul(Ke,$t)|0,C=C+Math.imul(fe,ot)|0,w=w+Math.imul(fe,Gt)|0,w=w+Math.imul(xe,ot)|0,k=k+Math.imul(xe,Gt)|0,C=C+Math.imul(te,Ut)|0,w=w+Math.imul(te,Pr)|0,w=w+Math.imul(F,Ut)|0,k=k+Math.imul(F,Pr)|0;var ys=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(ys>>>26)|0,ys&=67108863,C=Math.imul(Ge,Pt),w=Math.imul(Ge,Dt),w=w+Math.imul(vt,Pt)|0,k=Math.imul(vt,Dt),C=C+Math.imul(He,dt)|0,w=w+Math.imul(He,Lt)|0,w=w+Math.imul(at,dt)|0,k=k+Math.imul(at,Lt)|0,C=C+Math.imul(Qe,ut)|0,w=w+Math.imul(Qe,zt)|0,w=w+Math.imul(ct,ut)|0,k=k+Math.imul(ct,zt)|0,C=C+Math.imul(Re,ht)|0,w=w+Math.imul(Re,xt)|0,w=w+Math.imul($e,ht)|0,k=k+Math.imul($e,xt)|0,C=C+Math.imul(Je,Ve)|0,w=w+Math.imul(Je,$t)|0,w=w+Math.imul(Xe,Ve)|0,k=k+Math.imul(Xe,$t)|0,C=C+Math.imul(Me,ot)|0,w=w+Math.imul(Me,Gt)|0,w=w+Math.imul(Ke,ot)|0,k=k+Math.imul(Ke,Gt)|0,C=C+Math.imul(fe,Ut)|0,w=w+Math.imul(fe,Pr)|0,w=w+Math.imul(xe,Ut)|0,k=k+Math.imul(xe,Pr)|0;var ms=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(ms>>>26)|0,ms&=67108863,C=Math.imul(Ge,dt),w=Math.imul(Ge,Lt),w=w+Math.imul(vt,dt)|0,k=Math.imul(vt,Lt),C=C+Math.imul(He,ut)|0,w=w+Math.imul(He,zt)|0,w=w+Math.imul(at,ut)|0,k=k+Math.imul(at,zt)|0,C=C+Math.imul(Qe,ht)|0,w=w+Math.imul(Qe,xt)|0,w=w+Math.imul(ct,ht)|0,k=k+Math.imul(ct,xt)|0,C=C+Math.imul(Re,Ve)|0,w=w+Math.imul(Re,$t)|0,w=w+Math.imul($e,Ve)|0,k=k+Math.imul($e,$t)|0,C=C+Math.imul(Je,ot)|0,w=w+Math.imul(Je,Gt)|0,w=w+Math.imul(Xe,ot)|0,k=k+Math.imul(Xe,Gt)|0,C=C+Math.imul(Me,Ut)|0,w=w+Math.imul(Me,Pr)|0,w=w+Math.imul(Ke,Ut)|0,k=k+Math.imul(Ke,Pr)|0;var qs=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(qs>>>26)|0,qs&=67108863,C=Math.imul(Ge,ut),w=Math.imul(Ge,zt),w=w+Math.imul(vt,ut)|0,k=Math.imul(vt,zt),C=C+Math.imul(He,ht)|0,w=w+Math.imul(He,xt)|0,w=w+Math.imul(at,ht)|0,k=k+Math.imul(at,xt)|0,C=C+Math.imul(Qe,Ve)|0,w=w+Math.imul(Qe,$t)|0,w=w+Math.imul(ct,Ve)|0,k=k+Math.imul(ct,$t)|0,C=C+Math.imul(Re,ot)|0,w=w+Math.imul(Re,Gt)|0,w=w+Math.imul($e,ot)|0,k=k+Math.imul($e,Gt)|0,C=C+Math.imul(Je,Ut)|0,w=w+Math.imul(Je,Pr)|0,w=w+Math.imul(Xe,Ut)|0,k=k+Math.imul(Xe,Pr)|0;var ho=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(ho>>>26)|0,ho&=67108863,C=Math.imul(Ge,ht),w=Math.imul(Ge,xt),w=w+Math.imul(vt,ht)|0,k=Math.imul(vt,xt),C=C+Math.imul(He,Ve)|0,w=w+Math.imul(He,$t)|0,w=w+Math.imul(at,Ve)|0,k=k+Math.imul(at,$t)|0,C=C+Math.imul(Qe,ot)|0,w=w+Math.imul(Qe,Gt)|0,w=w+Math.imul(ct,ot)|0,k=k+Math.imul(ct,Gt)|0,C=C+Math.imul(Re,Ut)|0,w=w+Math.imul(Re,Pr)|0,w=w+Math.imul($e,Ut)|0,k=k+Math.imul($e,Pr)|0;var Pn=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,C=Math.imul(Ge,Ve),w=Math.imul(Ge,$t),w=w+Math.imul(vt,Ve)|0,k=Math.imul(vt,$t),C=C+Math.imul(He,ot)|0,w=w+Math.imul(He,Gt)|0,w=w+Math.imul(at,ot)|0,k=k+Math.imul(at,Gt)|0,C=C+Math.imul(Qe,Ut)|0,w=w+Math.imul(Qe,Pr)|0,w=w+Math.imul(ct,Ut)|0,k=k+Math.imul(ct,Pr)|0;var Gi=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,C=Math.imul(Ge,ot),w=Math.imul(Ge,Gt),w=w+Math.imul(vt,ot)|0,k=Math.imul(vt,Gt),C=C+Math.imul(He,Ut)|0,w=w+Math.imul(He,Pr)|0,w=w+Math.imul(at,Ut)|0,k=k+Math.imul(at,Pr)|0;var po=(x+C|0)+((w&8191)<<13)|0;x=(k+(w>>>13)|0)+(po>>>26)|0,po&=67108863,C=Math.imul(Ge,Ut),w=Math.imul(Ge,Pr),w=w+Math.imul(vt,Ut)|0,k=Math.imul(vt,Pr);var Vs=(x+C|0)+((w&8191)<<13)|0;return x=(k+(w>>>13)|0)+(Vs>>>26)|0,Vs&=67108863,B[0]=tr,B[1]=Or,B[2]=pi,B[3]=vi,B[4]=gi,B[5]=_i,B[6]=Tn,B[7]=ps,B[8]=vs,B[9]=gs,B[10]=Hi,B[11]=ys,B[12]=ms,B[13]=qs,B[14]=ho,B[15]=Pn,B[16]=Gi,B[17]=po,B[18]=Vs,x!==0&&(B[19]=x,v.length++),v};Math.imul||(m=y);function S(K,R,D){D.negative=R.negative^K.negative,D.length=K.length+R.length;for(var v=0,b=0,M=0;M>>26)|0,b+=B>>>26,B&=67108863}D.words[M]=x,v=B,B=b}return v!==0?D.words[M]=v:D.length--,D.strip()}function E(K,R,D){var v=new A;return v.mulp(K,R,D)}s.prototype.mulTo=function(R,D){var v,b=this.length+R.length;return this.length===10&&R.length===10?v=m(this,R,D):b<63?v=y(this,R,D):b<1024?v=S(this,R,D):v=E(this,R,D),v};function A(K,R){this.x=K,this.y=R}A.prototype.makeRBT=function(R){for(var D=new Array(R),v=s.prototype._countBits(R)-1,b=0;b>=1;return b},A.prototype.permute=function(R,D,v,b,M,B){for(var x=0;x>>1)M++;return 1<>>13,v[2*B+1]=M&8191,M=M>>>13;for(B=2*D;B>=26,D+=b/67108864|0,D+=M>>>26,this.words[v]=M&67108863}return D!==0&&(this.words[v]=D,this.length++),this},s.prototype.muln=function(R){return this.clone().imuln(R)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(R){var D=g(R);if(D.length===0)return new s(1);for(var v=this,b=0;b=0);var D=R%26,v=(R-D)/26,b=67108863>>>26-D<<26-D,M;if(D!==0){var B=0;for(M=0;M>>26-D}B&&(this.words[M]=B,this.length++)}if(v!==0){for(M=this.length-1;M>=0;M--)this.words[M+v]=this.words[M];for(M=0;M=0);var b;D?b=(D-D%26)/26:b=0;var M=R%26,B=Math.min((R-M)/26,this.length),x=67108863^67108863>>>M<B)for(this.length-=B,w=0;w=0&&(k!==0||w>=b);w--){var O=this.words[w]|0;this.words[w]=k<<26-M|O>>>M,k=O&x}return C&&k!==0&&(C.words[C.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(R,D,v){return n(this.negative===0),this.iushrn(R,D,v)},s.prototype.shln=function(R){return this.clone().ishln(R)},s.prototype.ushln=function(R){return this.clone().iushln(R)},s.prototype.shrn=function(R){return this.clone().ishrn(R)},s.prototype.ushrn=function(R){return this.clone().iushrn(R)},s.prototype.testn=function(R){n(typeof R=="number"&&R>=0);var D=R%26,v=(R-D)/26,b=1<=0);var D=R%26,v=(R-D)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(D!==0&&v++,this.length=Math.min(v,this.length),D!==0){var b=67108863^67108863>>>D<=67108864;D++)this.words[D]-=67108864,D===this.length-1?this.words[D+1]=1:this.words[D+1]++;return this.length=Math.max(this.length,D+1),this},s.prototype.isubn=function(R){if(n(typeof R=="number"),n(R<67108864),R<0)return this.iaddn(-R);if(this.negative!==0)return this.negative=0,this.iaddn(R),this.negative=1,this;if(this.words[0]-=R,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var D=0;D>26)-(C/67108864|0),this.words[M+v]=B&67108863}for(;M>26,this.words[M+v]=B&67108863;if(x===0)return this.strip();for(n(x===-1),x=0,M=0;M>26,this.words[M]=B&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(R,D){var v=this.length-R.length,b=this.clone(),M=R,B=M.words[M.length-1]|0,x=this._countBits(B);v=26-x,v!==0&&(M=M.ushln(v),b.iushln(v),B=M.words[M.length-1]|0);var C=b.length-M.length,w;if(D!=="mod"){w=new s(null),w.length=C+1,w.words=new Array(w.length);for(var k=0;k=0;G--){var oe=(b.words[M.length+G]|0)*67108864+(b.words[M.length+G-1]|0);for(oe=Math.min(oe/B|0,67108863),b._ishlnsubmul(M,oe,G);b.negative!==0;)oe--,b.negative=0,b._ishlnsubmul(M,1,G),b.isZero()||(b.negative^=1);w&&(w.words[G]=oe)}return w&&w.strip(),b.strip(),D!=="div"&&v!==0&&b.iushrn(v),{div:w||null,mod:b}},s.prototype.divmod=function(R,D,v){if(n(!R.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var b,M,B;return this.negative!==0&&R.negative===0?(B=this.neg().divmod(R,D),D!=="mod"&&(b=B.div.neg()),D!=="div"&&(M=B.mod.neg(),v&&M.negative!==0&&M.iadd(R)),{div:b,mod:M}):this.negative===0&&R.negative!==0?(B=this.divmod(R.neg(),D),D!=="mod"&&(b=B.div.neg()),{div:b,mod:B.mod}):this.negative&R.negative?(B=this.neg().divmod(R.neg(),D),D!=="div"&&(M=B.mod.neg(),v&&M.negative!==0&&M.isub(R)),{div:B.div,mod:M}):R.length>this.length||this.cmp(R)<0?{div:new s(0),mod:this}:R.length===1?D==="div"?{div:this.divn(R.words[0]),mod:null}:D==="mod"?{div:null,mod:new s(this.modn(R.words[0]))}:{div:this.divn(R.words[0]),mod:new s(this.modn(R.words[0]))}:this._wordDiv(R,D)},s.prototype.div=function(R){return this.divmod(R,"div",!1).div},s.prototype.mod=function(R){return this.divmod(R,"mod",!1).mod},s.prototype.umod=function(R){return this.divmod(R,"mod",!0).mod},s.prototype.divRound=function(R){var D=this.divmod(R);if(D.mod.isZero())return D.div;var v=D.div.negative!==0?D.mod.isub(R):D.mod,b=R.ushrn(1),M=R.andln(1),B=v.cmp(b);return B<0||M===1&&B===0?D.div:D.div.negative!==0?D.div.isubn(1):D.div.iaddn(1)},s.prototype.modn=function(R){n(R<=67108863);for(var D=(1<<26)%R,v=0,b=this.length-1;b>=0;b--)v=(D*v+(this.words[b]|0))%R;return v},s.prototype.idivn=function(R){n(R<=67108863);for(var D=0,v=this.length-1;v>=0;v--){var b=(this.words[v]|0)+D*67108864;this.words[v]=b/R|0,D=b%R}return this.strip()},s.prototype.divn=function(R){return this.clone().idivn(R)},s.prototype.egcd=function(R){n(R.negative===0),n(!R.isZero());var D=this,v=R.clone();D.negative!==0?D=D.umod(R):D=D.clone();for(var b=new s(1),M=new s(0),B=new s(0),x=new s(1),C=0;D.isEven()&&v.isEven();)D.iushrn(1),v.iushrn(1),++C;for(var w=v.clone(),k=D.clone();!D.isZero();){for(var O=0,G=1;!(D.words[0]&G)&&O<26;++O,G<<=1);if(O>0)for(D.iushrn(O);O-- >0;)(b.isOdd()||M.isOdd())&&(b.iadd(w),M.isub(k)),b.iushrn(1),M.iushrn(1);for(var oe=0,$=1;!(v.words[0]&$)&&oe<26;++oe,$<<=1);if(oe>0)for(v.iushrn(oe);oe-- >0;)(B.isOdd()||x.isOdd())&&(B.iadd(w),x.isub(k)),B.iushrn(1),x.iushrn(1);D.cmp(v)>=0?(D.isub(v),b.isub(B),M.isub(x)):(v.isub(D),B.isub(b),x.isub(M))}return{a:B,b:x,gcd:v.iushln(C)}},s.prototype._invmp=function(R){n(R.negative===0),n(!R.isZero());var D=this,v=R.clone();D.negative!==0?D=D.umod(R):D=D.clone();for(var b=new s(1),M=new s(0),B=v.clone();D.cmpn(1)>0&&v.cmpn(1)>0;){for(var x=0,C=1;!(D.words[0]&C)&&x<26;++x,C<<=1);if(x>0)for(D.iushrn(x);x-- >0;)b.isOdd()&&b.iadd(B),b.iushrn(1);for(var w=0,k=1;!(v.words[0]&k)&&w<26;++w,k<<=1);if(w>0)for(v.iushrn(w);w-- >0;)M.isOdd()&&M.iadd(B),M.iushrn(1);D.cmp(v)>=0?(D.isub(v),b.isub(M)):(v.isub(D),M.isub(b))}var O;return D.cmpn(1)===0?O=b:O=M,O.cmpn(0)<0&&O.iadd(R),O},s.prototype.gcd=function(R){if(this.isZero())return R.abs();if(R.isZero())return this.abs();var D=this.clone(),v=R.clone();D.negative=0,v.negative=0;for(var b=0;D.isEven()&&v.isEven();b++)D.iushrn(1),v.iushrn(1);do{for(;D.isEven();)D.iushrn(1);for(;v.isEven();)v.iushrn(1);var M=D.cmp(v);if(M<0){var B=D;D=v,v=B}else if(M===0||v.cmpn(1)===0)break;D.isub(v)}while(!0);return v.iushln(b)},s.prototype.invm=function(R){return this.egcd(R).a.umod(R)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(R){return this.words[0]&R},s.prototype.bincn=function(R){n(typeof R=="number");var D=R%26,v=(R-D)/26,b=1<>>26,x&=67108863,this.words[B]=x}return M!==0&&(this.words[B]=M,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(R){var D=R<0;if(this.negative!==0&&!D)return-1;if(this.negative===0&&D)return 1;this.strip();var v;if(this.length>1)v=1;else{D&&(R=-R),n(R<=67108863,"Number is too big");var b=this.words[0]|0;v=b===R?0:bR.length)return 1;if(this.length=0;v--){var b=this.words[v]|0,M=R.words[v]|0;if(b!==M){bM&&(D=1);break}}return D},s.prototype.gtn=function(R){return this.cmpn(R)===1},s.prototype.gt=function(R){return this.cmp(R)===1},s.prototype.gten=function(R){return this.cmpn(R)>=0},s.prototype.gte=function(R){return this.cmp(R)>=0},s.prototype.ltn=function(R){return this.cmpn(R)===-1},s.prototype.lt=function(R){return this.cmp(R)===-1},s.prototype.lten=function(R){return this.cmpn(R)<=0},s.prototype.lte=function(R){return this.cmp(R)<=0},s.prototype.eqn=function(R){return this.cmpn(R)===0},s.prototype.eq=function(R){return this.cmp(R)===0},s.red=function(R){return new ie(R)},s.prototype.toRed=function(R){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),R.convertTo(this)._forceRed(R)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(R){return this.red=R,this},s.prototype.forceRed=function(R){return n(!this.red,"Already a number in reduction context"),this._forceRed(R)},s.prototype.redAdd=function(R){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,R)},s.prototype.redIAdd=function(R){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,R)},s.prototype.redSub=function(R){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,R)},s.prototype.redISub=function(R){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,R)},s.prototype.redShl=function(R){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,R)},s.prototype.redMul=function(R){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,R),this.red.mul(this,R)},s.prototype.redIMul=function(R){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,R),this.red.imul(this,R)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(R){return n(this.red&&!R.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,R)};var P={k256:null,p224:null,p192:null,p25519:null};function N(K,R){this.name=K,this.p=new s(R,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}N.prototype._tmp=function(){var R=new s(null);return R.words=new Array(Math.ceil(this.n/13)),R},N.prototype.ireduce=function(R){var D=R,v;do this.split(D,this.tmp),D=this.imulK(D),D=D.iadd(this.tmp),v=D.bitLength();while(v>this.n);var b=v0?D.isub(this.p):D.strip!==void 0?D.strip():D._strip(),D},N.prototype.split=function(R,D){R.iushrn(this.n,0,D)},N.prototype.imulK=function(R){return R.imul(this.k)};function L(){N.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(L,N),L.prototype.split=function(R,D){for(var v=4194303,b=Math.min(R.length,9),M=0;M>>22,B=x}B>>>=22,R.words[M-10]=B,B===0&&R.length>10?R.length-=10:R.length-=9},L.prototype.imulK=function(R){R.words[R.length]=0,R.words[R.length+1]=0,R.length+=2;for(var D=0,v=0;v>>=26,R.words[v]=M,D=b}return D!==0&&(R.words[R.length++]=D),R},s._prime=function(R){if(P[R])return P[R];var D;if(R==="k256")D=new L;else if(R==="p224")D=new V;else if(R==="p192")D=new I;else if(R==="p25519")D=new U;else throw new Error("Unknown prime "+R);return P[R]=D,D};function ie(K){if(typeof K=="string"){var R=s._prime(K);this.m=R.p,this.prime=R}else n(K.gtn(1),"modulus must be greater than 1"),this.m=K,this.prime=null}ie.prototype._verify1=function(R){n(R.negative===0,"red works only with positives"),n(R.red,"red works only with red numbers")},ie.prototype._verify2=function(R,D){n((R.negative|D.negative)===0,"red works only with positives"),n(R.red&&R.red===D.red,"red works only with red numbers")},ie.prototype.imod=function(R){return this.prime?this.prime.ireduce(R)._forceRed(this):R.umod(this.m)._forceRed(this)},ie.prototype.neg=function(R){return R.isZero()?R.clone():this.m.sub(R)._forceRed(this)},ie.prototype.add=function(R,D){this._verify2(R,D);var v=R.add(D);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},ie.prototype.iadd=function(R,D){this._verify2(R,D);var v=R.iadd(D);return v.cmp(this.m)>=0&&v.isub(this.m),v},ie.prototype.sub=function(R,D){this._verify2(R,D);var v=R.sub(D);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},ie.prototype.isub=function(R,D){this._verify2(R,D);var v=R.isub(D);return v.cmpn(0)<0&&v.iadd(this.m),v},ie.prototype.shl=function(R,D){return this._verify1(R),this.imod(R.ushln(D))},ie.prototype.imul=function(R,D){return this._verify2(R,D),this.imod(R.imul(D))},ie.prototype.mul=function(R,D){return this._verify2(R,D),this.imod(R.mul(D))},ie.prototype.isqr=function(R){return this.imul(R,R.clone())},ie.prototype.sqr=function(R){return this.mul(R,R)},ie.prototype.sqrt=function(R){if(R.isZero())return R.clone();var D=this.m.andln(3);if(n(D%2===1),D===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(R,v)}for(var b=this.m.subn(1),M=0;!b.isZero()&&b.andln(1)===0;)M++,b.iushrn(1);n(!b.isZero());var B=new s(1).toRed(this),x=B.redNeg(),C=this.m.subn(1).iushrn(1),w=this.m.bitLength();for(w=new s(2*w*w).toRed(this);this.pow(w,C).cmp(x)!==0;)w.redIAdd(x);for(var k=this.pow(w,b),O=this.pow(R,b.addn(1).iushrn(1)),G=this.pow(R,b),oe=M;G.cmp(B)!==0;){for(var $=G,X=0;$.cmp(B)!==0;X++)$=$.redSqr();n(X=0;M--){for(var k=D.words[M],O=w-1;O>=0;O--){var G=k>>O&1;if(B!==b[0]&&(B=this.sqr(B)),G===0&&x===0){C=0;continue}x<<=1,x|=G,C++,!(C!==v&&(M!==0||O!==0))&&(B=this.mul(B,b[x]),C=0,x=0)}w=26}return B},ie.prototype.convertTo=function(R){var D=R.umod(this.m);return D===R?D.clone():D},ie.prototype.convertFrom=function(R){var D=R.clone();return D.red=null,D},s.mont=function(R){return new ae(R)};function ae(K){ie.call(this,K),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ae,ie),ae.prototype.convertTo=function(R){return this.imod(R.ushln(this.shift))},ae.prototype.convertFrom=function(R){var D=this.imod(R.mul(this.rinv));return D.red=null,D},ae.prototype.imul=function(R,D){if(R.isZero()||D.isZero())return R.words[0]=0,R.length=1,R;var v=R.imul(D),b=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=v.isub(b).iushrn(this.shift),B=M;return M.cmp(this.m)>=0?B=M.isub(this.m):M.cmpn(0)<0&&(B=M.iadd(this.m)),B._forceRed(this)},ae.prototype.mul=function(R,D){if(R.isZero()||D.isZero())return new s(0)._forceRed(this);var v=R.mul(D),b=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=v.isub(b).iushrn(this.shift),B=M;return M.cmp(this.m)>=0?B=M.isub(this.m):M.cmpn(0)<0&&(B=M.iadd(this.m)),B._forceRed(this)},ae.prototype.invm=function(R){var D=this.imod(R._invmp(this.m).mul(this.r2));return D._forceRed(this)}})(t,xi)})(yO);var Yu=yO.exports,mO={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var c=0;c>8,u=l&255;f?a.push(f,u):a.push(u)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(m>>1)-1?E=(m>>1)-A:E=A,S.isubn(E)):E=0,g[y]=E,S.iushrn(1)}return g}e.getNAF=s;function o(f,u){var h=[[],[]];f=f.clone(),u=u.clone();for(var g=0,y=0,m;f.cmpn(-g)>0||u.cmpn(-y)>0;){var S=f.andln(3)+g&3,E=u.andln(3)+y&3;S===3&&(S=-1),E===3&&(E=-1);var A;S&1?(m=f.andln(7)+g&7,(m===3||m===5)&&E===2?A=-S:A=S):A=0,h[0].push(A);var P;E&1?(m=u.andln(7)+y&7,(m===3||m===5)&&S===2?P=-E:P=E):P=0,h[1].push(P),2*g===A+1&&(g=1-g),2*y===P+1&&(y=1-y),f.iushrn(1),u.iushrn(1)}return h}e.getJSF=o;function a(f,u,h){var g="_"+u;f.prototype[u]=function(){return this[g]!==void 0?this[g]:this[g]=h.call(this)}}e.cachedProperty=a;function c(f){return typeof f=="string"?e.toArray(f,"hex"):f}e.parseBytes=c;function l(f){return new r(f,"hex","le")}e.intFromLE=l})(Ca);var bO={exports:{}},e7;bO.exports=function(e){return e7||(e7=new eh(null)),e7.generate(e)};function eh(t){this.rand=t}bO.exports.Rand=eh;eh.prototype.generate=function(e){return this._rand(e)};eh.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var gC=t0;t0.prototype.point=function(){throw new Error("Not implemented")};t0.prototype.validate=function(){throw new Error("Not implemented")};t0.prototype._fixedNafMul=function(e,r){e8(e.precomputed);var n=e._getDoubles(),i=X4(r,1,this._bitLength),s=(1<=a;l--)c=(c<<1)+i[l];o.push(c)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),h=s;h>0;h--){for(a=0;a=0;c--){for(var l=0;c>=0&&o[c]===0;c--)l++;if(c>=0&&l++,a=a.dblp(l),c<0)break;var f=o[c];e8(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};t0.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,c=this._wnafT3,l=0,f,u,h;for(f=0;f=1;f-=2){var y=f-1,m=f;if(o[y]!==1||o[m]!==1){c[y]=X4(n[y],o[y],this._bitLength),c[m]=X4(n[m],o[m],this._bitLength),l=Math.max(c[y].length,l),l=Math.max(c[m].length,l);continue}var S=[r[y],null,null,r[m]];r[y].y.cmp(r[m].y)===0?(S[1]=r[y].add(r[m]),S[2]=r[y].toJ().mixedAdd(r[m].neg())):r[y].y.cmp(r[m].y.redNeg())===0?(S[1]=r[y].toJ().mixedAdd(r[m]),S[2]=r[y].add(r[m].neg())):(S[1]=r[y].toJ().mixedAdd(r[m]),S[2]=r[y].toJ().mixedAdd(r[m].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],A=HDe(n[y],n[m]);for(l=Math.max(A[0].length,l),c[y]=new Array(l),c[m]=new Array(l),u=0;u=0;f--){for(var I=0;f>=0;){var U=!0;for(u=0;u=0&&I++,L=L.dblp(I),f<0)break;for(u=0;u0?h=a[u][ie-1>>1]:ie<0&&(h=a[u][-ie-1>>1].neg()),h.type==="affine"?L=L.mixedAdd(h):L=L.add(h))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};uc.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(g=l,y=f),u.negative&&(u=u.neg(),h=h.neg()),g.negative&&(g=g.neg(),y=y.neg()),[{a:u,b:h},{a:g,b:y}]};dc.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),c=o.mul(i.a),l=s.mul(n.b),f=o.mul(i.b),u=e.sub(a).sub(c),h=l.add(f).neg();return{k1:u,k2:h}};dc.prototype.pointFromX=function(e,r){e=new Wn(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};dc.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};dc.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};zi.prototype.isInfinity=function(){return this.inf};zi.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};zi.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};zi.prototype.getX=function(){return this.x.fromRed()};zi.prototype.getY=function(){return this.y.fromRed()};zi.prototype.mul=function(e){return e=new Wn(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};zi.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};zi.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};zi.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};zi.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};zi.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function ds(t,e,r,n){bm.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Wn(0)):(this.x=new Wn(e,16),this.y=new Wn(r,16),this.z=new Wn(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}xO(ds,bm.BasePoint);dc.prototype.jpoint=function(e,r,n){return new ds(this,e,r,n)};ds.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};ds.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};ds.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),c=i.redSub(s),l=o.redSub(a);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),u=f.redMul(c),h=i.redMul(f),g=l.redSqr().redIAdd(u).redISub(h).redISub(h),y=l.redMul(h.redISub(g)).redISub(o.redMul(u)),m=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(g,y,m)};ds.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),c=s.redSub(o);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),f=l.redMul(a),u=n.redMul(l),h=c.redSqr().redIAdd(f).redISub(u).redISub(u),g=c.redMul(u.redISub(h)).redISub(s.redMul(f)),y=this.z.redMul(a);return this.curve.jpoint(h,g,y)};ds.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};ds.prototype.inspect=function(){return this.isInfinity()?"":""};ds.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Wv=Yu,une=aC,yC=gC,YDe=Ca;function wm(t){yC.call(this,"mont",t),this.a=new Wv(t.a,16).toRed(this.red),this.b=new Wv(t.b,16).toRed(this.red),this.i4=new Wv(4).toRed(this.red).redInvm(),this.two=new Wv(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}une(wm,yC);var QDe=wm;wm.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function $i(t,e,r){yC.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Wv(e,16),this.z=new Wv(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}une($i,yC.BasePoint);wm.prototype.decodePoint=function(e,r){return this.point(YDe.toArray(e,r),1)};wm.prototype.point=function(e,r){return new $i(this,e,r)};wm.prototype.pointFromJSON=function(e){return $i.fromJSON(this,e)};$i.prototype.precompute=function(){};$i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};$i.fromJSON=function(e,r){return new $i(e,r[0],r[1]||e.one)};$i.prototype.inspect=function(){return this.isInfinity()?"":""};$i.prototype.isInfinity=function(){return this.z.cmpn(0)===0};$i.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)};$i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};$i.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),c=s.redMul(i),l=r.z.redMul(a.redAdd(c).redSqr()),f=r.x.redMul(a.redISub(c).redSqr());return this.curve.point(l,f)};$i.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i};$i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};$i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};$i.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};$i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};$i.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var JDe=Ca,pu=Yu,dne=aC,mC=gC,ZDe=JDe.assert;function pf(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,mC.call(this,"edwards",t),this.a=new pu(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new pu(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new pu(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),ZDe(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}dne(pf,mC);var XDe=pf;pf.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};pf.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};pf.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};pf.prototype.pointFromX=function(e,r){e=new pu(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var c=a.fromRed().isOdd();return(r&&!c||!r&&c)&&(a=a.redNeg()),this.point(e,a)};pf.prototype.pointFromY=function(e,r){e=new pu(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)};pf.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function wn(t,e,r,n,i){mC.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new pu(e,16),this.y=new pu(r,16),this.z=n?new pu(n,16):this.curve.one,this.t=i&&new pu(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}dne(wn,mC.BasePoint);pf.prototype.pointFromJSON=function(e){return wn.fromJSON(this,e)};pf.prototype.point=function(e,r,n,i){return new wn(this,e,r,n,i)};wn.fromJSON=function(e,r){return new wn(e,r[0],r[1],r[2])};wn.prototype.inspect=function(){return this.isInfinity()?"":""};wn.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};wn.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),c=i.redSub(r),l=s.redMul(a),f=o.redMul(c),u=s.redMul(c),h=a.redMul(o);return this.curve.point(l,f,h,u)};wn.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,c,l;if(this.curve.twisted){a=this.curve._mulA(r);var f=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(f.redSub(this.curve.two)),s=f.redMul(a.redSub(n)),o=f.redSqr().redSub(f).redSub(f)):(c=this.z.redSqr(),l=f.redSub(c).redISub(c),i=e.redSub(r).redISub(n).redMul(l),s=f.redMul(a.redSub(n)),o=f.redMul(l))}else a=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),l=a.redSub(c).redSub(c),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)};wn.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};wn.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),c=s.redAdd(i),l=n.redAdd(r),f=o.redMul(a),u=c.redMul(l),h=o.redMul(l),g=a.redMul(c);return this.curve.point(f,u,g,h)};wn.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),c=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),f=r.redMul(a).redMul(l),u,h;return this.curve.twisted?(u=r.redMul(c).redMul(s.redSub(this.curve._mulA(i))),h=a.redMul(c)):(u=r.redMul(c).redMul(s.redSub(i)),h=this.curve._mulC(a).redMul(c)),this.curve.point(f,u,h)};wn.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};wn.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};wn.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};wn.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};wn.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};wn.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};wn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};wn.prototype.getY=function(){return this.normalize(),this.y.fromRed()};wn.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};wn.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};wn.prototype.toP=wn.prototype.normalize;wn.prototype.mixedAdd=wn.prototype.add;(function(t){var e=t;e.base=gC,e.short=KDe,e.mont=QDe,e.edwards=XDe})(wO);var bC={},t7,Q$;function eNe(){return Q$||(Q$=1,t7={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),t7}(function(t){var e=t,r=gx,n=wO,i=Ca,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,f){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var u=new o(f);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:u}),u}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=eNe()}catch{c=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})})(bC);var tNe=gx,U1=mO,hne=Ep;function Nh(t){if(!(this instanceof Nh))return new Nh(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=U1.toArray(t.entropy,t.entropyEnc||"hex"),r=U1.toArray(t.nonce,t.nonceEnc||"hex"),n=U1.toArray(t.pers,t.persEnc||"hex");hne(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var rNe=Nh;Nh.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};Nh.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=U1.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var t8=Yu,EO=Ca,oNe=EO.assert;function wC(t,e){if(t instanceof wC)return t;this._importDER(t,e)||(oNe(t.r&&t.s,"Signature without r or s"),this.r=new t8(t.r,16),this.s=new t8(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var aNe=wC;function cNe(){this.place=0}function r7(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function J$(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}wC.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=J$(r),n=J$(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];n7(i,r.length),i=i.concat(r),i.push(2),n7(i,n.length);var s=i.concat(n),o=[48];return n7(o,s.length),o=o.concat(s),EO.encode(o,e)};var vu=Yu,pne=rNe,lNe=Ca,i7=bC,fNe=fne,vne=lNe.assert,CO=sNe,xC=aNe;function cc(t){if(!(this instanceof cc))return new cc(t);typeof t=="string"&&(vne(Object.prototype.hasOwnProperty.call(i7,t),"Unknown curve "+t),t=i7[t]),t instanceof i7.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var uNe=cc;cc.prototype.keyPair=function(e){return new CO(this,e)};cc.prototype.keyFromPrivate=function(e,r){return CO.fromPrivate(this,e,r)};cc.prototype.keyFromPublic=function(e,r){return CO.fromPublic(this,e,r)};cc.prototype.genKeyPair=function(e){e||(e={});for(var r=new pne({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||fNe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new vu(2));;){var s=new vu(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};cc.prototype._truncateToN=function(e,r,n){var i;if(vu.isBN(e)||typeof e=="number")e=new vu(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new vu(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new vu(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};cc.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),c=new pne({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new vu(1)),f=0;;f++){var u=i.k?i.k(f):new vu(c.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(l)>=0)){var h=this.g.mul(u);if(!h.isInfinity()){var g=h.getX(),y=g.umod(this.n);if(y.cmpn(0)!==0){var m=u.invm(this.n).mul(y.mul(r.getPrivate()).iadd(e));if(m=m.umod(this.n),m.cmpn(0)!==0){var S=(h.getY().isOdd()?1:0)|(g.cmp(y)!==0?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),S^=1),new xC({r:y,s:m,recoveryParam:S})}}}}}};cc.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new xC(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),l=c.mul(e).umod(this.n),f=c.mul(o).umod(this.n),u;return this.curve._maxwellTrick?(u=this.g.jmulAdd(l,n.getPublic(),f),u.isInfinity()?!1:u.eqXToP(o)):(u=this.g.mulAdd(l,n.getPublic(),f),u.isInfinity()?!1:u.getX().umod(this.n).cmp(o)===0)};cc.prototype.recoverPubKey=function(t,e,r,n){vne((3&r)===r,"The recovery param is more than two bits"),e=new xC(e,n);var i=this.n,s=new vu(t),o=e.r,a=e.s,c=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),c):o=this.curve.pointFromX(o,c);var f=e.r.invm(i),u=i.sub(s).mul(f).umod(i),h=a.mul(f).umod(i);return this.g.mulAdd(u,o,h)};cc.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new xC(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var xx=Ca,gne=xx.assert,Z$=xx.parseBytes,xm=xx.cachedProperty;function Ui(t,e){this.eddsa=t,this._secret=Z$(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Z$(e.pub)}Ui.fromPublic=function(e,r){return r instanceof Ui?r:new Ui(e,{pub:r})};Ui.fromSecret=function(e,r){return r instanceof Ui?r:new Ui(e,{secret:r})};Ui.prototype.secret=function(){return this._secret};xm(Ui,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});xm(Ui,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});xm(Ui,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});xm(Ui,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});xm(Ui,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});xm(Ui,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Ui.prototype.sign=function(e){return gne(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Ui.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Ui.prototype.getSecret=function(e){return gne(this._secret,"KeyPair is public only"),xx.encode(this.secret(),e)};Ui.prototype.getPublic=function(e){return xx.encode(this.pubBytes(),e)};var dNe=Ui,hNe=Yu,EC=Ca,X$=EC.assert,CC=EC.cachedProperty,pNe=EC.parseBytes;function Ap(t,e){this.eddsa=t,typeof e!="object"&&(e=pNe(e)),Array.isArray(e)&&(X$(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),X$(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof hNe&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}CC(Ap,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});CC(Ap,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});CC(Ap,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});CC(Ap,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Ap.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Ap.prototype.toHex=function(){return EC.encode(this.toBytes(),"hex").toUpperCase()};var vNe=Ap,gNe=gx,yNe=bC,qy=Ca,mNe=qy.assert,yne=qy.parseBytes,mne=dNe,eq=vNe;function jo(t){if(mNe(t==="ed25519","only tested with ed25519 so far"),!(this instanceof jo))return new jo(t);t=yNe[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=gNe.sha512}var bNe=jo;jo.prototype.sign=function(e,r){e=yne(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:c,Rencoded:o})};jo.prototype.verify=function(e,r,n){if(e=yne(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)};jo.prototype.hashInt=function(){for(var e=this.hash(),r=0;r0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=c[f++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(f=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,c,f,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=c[f++],l--;return this},a.prototype.finish=function(c){if(!this._finished){var l=this._bytesHashed,f=this._bufferLength,u=l/536870912|0,h=l<<3,g=l%128<112?128:256;this._buffer[f]=128;for(var y=f+1;y0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(c){return this._stateHi.set(c.stateHi),this._stateLo.set(c.stateLo),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(c){r.wipe(c.stateHi),r.wipe(c.stateLo),c.buffer&&r.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,c,l,f,u,h,g){for(var y=l[0],m=l[1],S=l[2],E=l[3],A=l[4],P=l[5],N=l[6],L=l[7],V=f[0],I=f[1],U=f[2],ie=f[3],ae=f[4],K=f[5],R=f[6],D=f[7],v,b,M,B,x,C,w,k;g>=128;){for(var O=0;O<16;O++){var G=8*O+h;a[O]=e.readUint32BE(u,G),c[O]=e.readUint32BE(u,G+4)}for(var O=0;O<80;O++){var oe=y,$=m,X=S,W=E,Z=A,te=P,F=N,ee=L,fe=V,xe=I,_e=U,Me=ie,Ke=ae,ze=K,Je=R,Xe=D;if(v=L,b=D,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=(A>>>14|ae<<18)^(A>>>18|ae<<14)^(ae>>>9|A<<23),b=(ae>>>14|A<<18)^(ae>>>18|A<<14)^(A>>>9|ae<<23),x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,v=A&P^~A&N,b=ae&K^~ae&R,x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,v=i[O*2],b=i[O*2+1],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,v=a[O%16],b=c[O%16],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,M=w&65535|k<<16,B=x&65535|C<<16,v=M,b=B,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=(y>>>28|V<<4)^(V>>>2|y<<30)^(V>>>7|y<<25),b=(V>>>28|y<<4)^(y>>>2|V<<30)^(y>>>7|V<<25),x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,v=y&m^y&S^m&S,b=V&I^V&U^I&U,x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,ee=w&65535|k<<16,Xe=x&65535|C<<16,v=W,b=Me,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=M,b=B,x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,W=w&65535|k<<16,Me=x&65535|C<<16,m=oe,S=$,E=X,A=W,P=Z,N=te,L=F,y=ee,I=fe,U=xe,ie=_e,ae=Me,K=Ke,R=ze,D=Je,V=Xe,O%16===15)for(var G=0;G<16;G++)v=a[G],b=c[G],x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=a[(G+9)%16],b=c[(G+9)%16],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,M=a[(G+1)%16],B=c[(G+1)%16],v=(M>>>1|B<<31)^(M>>>8|B<<24)^M>>>7,b=(B>>>1|M<<31)^(B>>>8|M<<24)^(B>>>7|M<<25),x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,M=a[(G+14)%16],B=c[(G+14)%16],v=(M>>>19|B<<13)^(B>>>29|M<<3)^M>>>6,b=(B>>>19|M<<13)^(M>>>29|B<<3)^(B>>>6|M<<26),x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,a[G]=w&65535|k<<16,c[G]=x&65535|C<<16}v=y,b=V,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[0],b=f[0],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[0]=y=w&65535|k<<16,f[0]=V=x&65535|C<<16,v=m,b=I,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[1],b=f[1],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[1]=m=w&65535|k<<16,f[1]=I=x&65535|C<<16,v=S,b=U,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[2],b=f[2],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[2]=S=w&65535|k<<16,f[2]=U=x&65535|C<<16,v=E,b=ie,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[3],b=f[3],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[3]=E=w&65535|k<<16,f[3]=ie=x&65535|C<<16,v=A,b=ae,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[4],b=f[4],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[4]=A=w&65535|k<<16,f[4]=ae=x&65535|C<<16,v=P,b=K,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[5],b=f[5],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[5]=P=w&65535|k<<16,f[5]=K=x&65535|C<<16,v=N,b=R,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[6],b=f[6],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[6]=N=w&65535|k<<16,f[6]=R=x&65535|C<<16,v=L,b=D,x=b&65535,C=b>>>16,w=v&65535,k=v>>>16,v=l[7],b=f[7],x+=b&65535,C+=b>>>16,w+=v&65535,k+=v>>>16,C+=x>>>16,w+=C>>>16,k+=w>>>16,l[7]=L=w&65535|k<<16,f[7]=D=x&65535|C<<16,h+=128,g-=128}return h}function o(a){var c=new n;c.update(a);var l=c.digest();return c.clean(),l}t.hash=o})(bne);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=e0,r=bne,n=Ea;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(W){const Z=new Float64Array(16);if(W)for(let te=0;te>16&1),te[xe-1]&=65535;te[15]=F[15]-32767-(te[14]>>16&1);const fe=te[15]>>16&1;te[14]&=65535,m(F,te,1-fe)}for(let ee=0;ee<16;ee++)W[2*ee]=F[ee]&255,W[2*ee+1]=F[ee]>>8}function E(W,Z){let te=0;for(let F=0;F<32;F++)te|=W[F]^Z[F];return(1&te-1>>>8)-1}function A(W,Z){const te=new Uint8Array(32),F=new Uint8Array(32);return S(te,W),S(F,Z),E(te,F)}function P(W){const Z=new Uint8Array(32);return S(Z,W),Z[0]&1}function N(W,Z){for(let te=0;te<16;te++)W[te]=Z[2*te]+(Z[2*te+1]<<8);W[15]&=32767}function L(W,Z,te){for(let F=0;F<16;F++)W[F]=Z[F]+te[F]}function V(W,Z,te){for(let F=0;F<16;F++)W[F]=Z[F]-te[F]}function I(W,Z,te){let F,ee,fe=0,xe=0,_e=0,Me=0,Ke=0,ze=0,Je=0,Xe=0,lt=0,Re=0,$e=0,st=0,Qe=0,ct=0,tt=0,He=0,at=0,pt=0,Ge=0,vt=0,bt=0,Ze=0,_t=0,Ct=0,It=0,er=0,dr=0,wt=0,lr=0,ir=0,Pt=0,Dt=te[0],Nt=te[1],dt=te[2],Lt=te[3],kt=te[4],ut=te[5],zt=te[6],Ht=te[7],ht=te[8],xt=te[9],Bt=te[10],Ve=te[11],$t=te[12],Et=te[13],ot=te[14],Gt=te[15];F=Z[0],fe+=F*Dt,xe+=F*Nt,_e+=F*dt,Me+=F*Lt,Ke+=F*kt,ze+=F*ut,Je+=F*zt,Xe+=F*Ht,lt+=F*ht,Re+=F*xt,$e+=F*Bt,st+=F*Ve,Qe+=F*$t,ct+=F*Et,tt+=F*ot,He+=F*Gt,F=Z[1],xe+=F*Dt,_e+=F*Nt,Me+=F*dt,Ke+=F*Lt,ze+=F*kt,Je+=F*ut,Xe+=F*zt,lt+=F*Ht,Re+=F*ht,$e+=F*xt,st+=F*Bt,Qe+=F*Ve,ct+=F*$t,tt+=F*Et,He+=F*ot,at+=F*Gt,F=Z[2],_e+=F*Dt,Me+=F*Nt,Ke+=F*dt,ze+=F*Lt,Je+=F*kt,Xe+=F*ut,lt+=F*zt,Re+=F*Ht,$e+=F*ht,st+=F*xt,Qe+=F*Bt,ct+=F*Ve,tt+=F*$t,He+=F*Et,at+=F*ot,pt+=F*Gt,F=Z[3],Me+=F*Dt,Ke+=F*Nt,ze+=F*dt,Je+=F*Lt,Xe+=F*kt,lt+=F*ut,Re+=F*zt,$e+=F*Ht,st+=F*ht,Qe+=F*xt,ct+=F*Bt,tt+=F*Ve,He+=F*$t,at+=F*Et,pt+=F*ot,Ge+=F*Gt,F=Z[4],Ke+=F*Dt,ze+=F*Nt,Je+=F*dt,Xe+=F*Lt,lt+=F*kt,Re+=F*ut,$e+=F*zt,st+=F*Ht,Qe+=F*ht,ct+=F*xt,tt+=F*Bt,He+=F*Ve,at+=F*$t,pt+=F*Et,Ge+=F*ot,vt+=F*Gt,F=Z[5],ze+=F*Dt,Je+=F*Nt,Xe+=F*dt,lt+=F*Lt,Re+=F*kt,$e+=F*ut,st+=F*zt,Qe+=F*Ht,ct+=F*ht,tt+=F*xt,He+=F*Bt,at+=F*Ve,pt+=F*$t,Ge+=F*Et,vt+=F*ot,bt+=F*Gt,F=Z[6],Je+=F*Dt,Xe+=F*Nt,lt+=F*dt,Re+=F*Lt,$e+=F*kt,st+=F*ut,Qe+=F*zt,ct+=F*Ht,tt+=F*ht,He+=F*xt,at+=F*Bt,pt+=F*Ve,Ge+=F*$t,vt+=F*Et,bt+=F*ot,Ze+=F*Gt,F=Z[7],Xe+=F*Dt,lt+=F*Nt,Re+=F*dt,$e+=F*Lt,st+=F*kt,Qe+=F*ut,ct+=F*zt,tt+=F*Ht,He+=F*ht,at+=F*xt,pt+=F*Bt,Ge+=F*Ve,vt+=F*$t,bt+=F*Et,Ze+=F*ot,_t+=F*Gt,F=Z[8],lt+=F*Dt,Re+=F*Nt,$e+=F*dt,st+=F*Lt,Qe+=F*kt,ct+=F*ut,tt+=F*zt,He+=F*Ht,at+=F*ht,pt+=F*xt,Ge+=F*Bt,vt+=F*Ve,bt+=F*$t,Ze+=F*Et,_t+=F*ot,Ct+=F*Gt,F=Z[9],Re+=F*Dt,$e+=F*Nt,st+=F*dt,Qe+=F*Lt,ct+=F*kt,tt+=F*ut,He+=F*zt,at+=F*Ht,pt+=F*ht,Ge+=F*xt,vt+=F*Bt,bt+=F*Ve,Ze+=F*$t,_t+=F*Et,Ct+=F*ot,It+=F*Gt,F=Z[10],$e+=F*Dt,st+=F*Nt,Qe+=F*dt,ct+=F*Lt,tt+=F*kt,He+=F*ut,at+=F*zt,pt+=F*Ht,Ge+=F*ht,vt+=F*xt,bt+=F*Bt,Ze+=F*Ve,_t+=F*$t,Ct+=F*Et,It+=F*ot,er+=F*Gt,F=Z[11],st+=F*Dt,Qe+=F*Nt,ct+=F*dt,tt+=F*Lt,He+=F*kt,at+=F*ut,pt+=F*zt,Ge+=F*Ht,vt+=F*ht,bt+=F*xt,Ze+=F*Bt,_t+=F*Ve,Ct+=F*$t,It+=F*Et,er+=F*ot,dr+=F*Gt,F=Z[12],Qe+=F*Dt,ct+=F*Nt,tt+=F*dt,He+=F*Lt,at+=F*kt,pt+=F*ut,Ge+=F*zt,vt+=F*Ht,bt+=F*ht,Ze+=F*xt,_t+=F*Bt,Ct+=F*Ve,It+=F*$t,er+=F*Et,dr+=F*ot,wt+=F*Gt,F=Z[13],ct+=F*Dt,tt+=F*Nt,He+=F*dt,at+=F*Lt,pt+=F*kt,Ge+=F*ut,vt+=F*zt,bt+=F*Ht,Ze+=F*ht,_t+=F*xt,Ct+=F*Bt,It+=F*Ve,er+=F*$t,dr+=F*Et,wt+=F*ot,lr+=F*Gt,F=Z[14],tt+=F*Dt,He+=F*Nt,at+=F*dt,pt+=F*Lt,Ge+=F*kt,vt+=F*ut,bt+=F*zt,Ze+=F*Ht,_t+=F*ht,Ct+=F*xt,It+=F*Bt,er+=F*Ve,dr+=F*$t,wt+=F*Et,lr+=F*ot,ir+=F*Gt,F=Z[15],He+=F*Dt,at+=F*Nt,pt+=F*dt,Ge+=F*Lt,vt+=F*kt,bt+=F*ut,Ze+=F*zt,_t+=F*Ht,Ct+=F*ht,It+=F*xt,er+=F*Bt,dr+=F*Ve,wt+=F*$t,lr+=F*Et,ir+=F*ot,Pt+=F*Gt,fe+=38*at,xe+=38*pt,_e+=38*Ge,Me+=38*vt,Ke+=38*bt,ze+=38*Ze,Je+=38*_t,Xe+=38*Ct,lt+=38*It,Re+=38*er,$e+=38*dr,st+=38*wt,Qe+=38*lr,ct+=38*ir,tt+=38*Pt,ee=1,F=fe+ee+65535,ee=Math.floor(F/65536),fe=F-ee*65536,F=xe+ee+65535,ee=Math.floor(F/65536),xe=F-ee*65536,F=_e+ee+65535,ee=Math.floor(F/65536),_e=F-ee*65536,F=Me+ee+65535,ee=Math.floor(F/65536),Me=F-ee*65536,F=Ke+ee+65535,ee=Math.floor(F/65536),Ke=F-ee*65536,F=ze+ee+65535,ee=Math.floor(F/65536),ze=F-ee*65536,F=Je+ee+65535,ee=Math.floor(F/65536),Je=F-ee*65536,F=Xe+ee+65535,ee=Math.floor(F/65536),Xe=F-ee*65536,F=lt+ee+65535,ee=Math.floor(F/65536),lt=F-ee*65536,F=Re+ee+65535,ee=Math.floor(F/65536),Re=F-ee*65536,F=$e+ee+65535,ee=Math.floor(F/65536),$e=F-ee*65536,F=st+ee+65535,ee=Math.floor(F/65536),st=F-ee*65536,F=Qe+ee+65535,ee=Math.floor(F/65536),Qe=F-ee*65536,F=ct+ee+65535,ee=Math.floor(F/65536),ct=F-ee*65536,F=tt+ee+65535,ee=Math.floor(F/65536),tt=F-ee*65536,F=He+ee+65535,ee=Math.floor(F/65536),He=F-ee*65536,fe+=ee-1+37*(ee-1),ee=1,F=fe+ee+65535,ee=Math.floor(F/65536),fe=F-ee*65536,F=xe+ee+65535,ee=Math.floor(F/65536),xe=F-ee*65536,F=_e+ee+65535,ee=Math.floor(F/65536),_e=F-ee*65536,F=Me+ee+65535,ee=Math.floor(F/65536),Me=F-ee*65536,F=Ke+ee+65535,ee=Math.floor(F/65536),Ke=F-ee*65536,F=ze+ee+65535,ee=Math.floor(F/65536),ze=F-ee*65536,F=Je+ee+65535,ee=Math.floor(F/65536),Je=F-ee*65536,F=Xe+ee+65535,ee=Math.floor(F/65536),Xe=F-ee*65536,F=lt+ee+65535,ee=Math.floor(F/65536),lt=F-ee*65536,F=Re+ee+65535,ee=Math.floor(F/65536),Re=F-ee*65536,F=$e+ee+65535,ee=Math.floor(F/65536),$e=F-ee*65536,F=st+ee+65535,ee=Math.floor(F/65536),st=F-ee*65536,F=Qe+ee+65535,ee=Math.floor(F/65536),Qe=F-ee*65536,F=ct+ee+65535,ee=Math.floor(F/65536),ct=F-ee*65536,F=tt+ee+65535,ee=Math.floor(F/65536),tt=F-ee*65536,F=He+ee+65535,ee=Math.floor(F/65536),He=F-ee*65536,fe+=ee-1+37*(ee-1),W[0]=fe,W[1]=xe,W[2]=_e,W[3]=Me,W[4]=Ke,W[5]=ze,W[6]=Je,W[7]=Xe,W[8]=lt,W[9]=Re,W[10]=$e,W[11]=st,W[12]=Qe,W[13]=ct,W[14]=tt,W[15]=He}function U(W,Z){I(W,Z,Z)}function ie(W,Z){const te=i();let F;for(F=0;F<16;F++)te[F]=Z[F];for(F=253;F>=0;F--)U(te,te),F!==2&&F!==4&&I(te,te,Z);for(F=0;F<16;F++)W[F]=te[F]}function ae(W,Z){const te=i();let F;for(F=0;F<16;F++)te[F]=Z[F];for(F=250;F>=0;F--)U(te,te),F!==1&&I(te,te,Z);for(F=0;F<16;F++)W[F]=te[F]}function K(W,Z){const te=i(),F=i(),ee=i(),fe=i(),xe=i(),_e=i(),Me=i(),Ke=i(),ze=i();V(te,W[1],W[0]),V(ze,Z[1],Z[0]),I(te,te,ze),L(F,W[0],W[1]),L(ze,Z[0],Z[1]),I(F,F,ze),I(ee,W[3],Z[3]),I(ee,ee,l),I(fe,W[2],Z[2]),L(fe,fe,fe),V(xe,F,te),V(_e,fe,ee),L(Me,fe,ee),L(Ke,F,te),I(W[0],xe,_e),I(W[1],Ke,Me),I(W[2],Me,_e),I(W[3],xe,Ke)}function R(W,Z,te){for(let F=0;F<4;F++)m(W[F],Z[F],te)}function D(W,Z){const te=i(),F=i(),ee=i();ie(ee,Z[2]),I(te,Z[0],ee),I(F,Z[1],ee),S(W,F),W[31]^=P(te)<<7}function v(W,Z,te){g(W[0],o),g(W[1],a),g(W[2],a),g(W[3],o);for(let F=255;F>=0;--F){const ee=te[F/8|0]>>(F&7)&1;R(W,Z,ee),K(Z,W),K(W,W),R(W,Z,ee)}}function b(W,Z){const te=[i(),i(),i(),i()];g(te[0],f),g(te[1],u),g(te[2],a),I(te[3],f,u),v(W,te,Z)}function M(W){if(W.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const Z=(0,r.hash)(W);Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(32),F=[i(),i(),i(),i()];b(F,Z),D(te,F);const ee=new Uint8Array(64);return ee.set(W),ee.set(te,32),{publicKey:te,secretKey:ee}}t.generateKeyPairFromSeed=M;function B(W){const Z=(0,e.randomBytes)(32,W),te=M(Z);return(0,n.wipe)(Z),te}t.generateKeyPair=B;function x(W){if(W.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(W.subarray(32))}t.extractPublicKeyFromSecretKey=x;const C=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function w(W,Z){let te,F,ee,fe;for(F=63;F>=32;--F){for(te=0,ee=F-32,fe=F-12;ee>4)*C[ee],te=Z[ee]>>8,Z[ee]&=255;for(ee=0;ee<32;ee++)Z[ee]-=te*C[ee];for(F=0;F<32;F++)Z[F+1]+=Z[F]>>8,W[F]=Z[F]&255}function k(W){const Z=new Float64Array(64);for(let te=0;te<64;te++)Z[te]=W[te];for(let te=0;te<64;te++)W[te]=0;w(W,Z)}function O(W,Z){const te=new Float64Array(64),F=[i(),i(),i(),i()],ee=(0,r.hash)(W.subarray(0,32));ee[0]&=248,ee[31]&=127,ee[31]|=64;const fe=new Uint8Array(64);fe.set(ee.subarray(32),32);const xe=new r.SHA512;xe.update(fe.subarray(32)),xe.update(Z);const _e=xe.digest();xe.clean(),k(_e),b(F,_e),D(fe,F),xe.reset(),xe.update(fe.subarray(0,32)),xe.update(W.subarray(32)),xe.update(Z);const Me=xe.digest();k(Me);for(let Ke=0;Ke<32;Ke++)te[Ke]=_e[Ke];for(let Ke=0;Ke<32;Ke++)for(let ze=0;ze<32;ze++)te[Ke+ze]+=Me[Ke]*ee[ze];return w(fe.subarray(32),te),fe}t.sign=O;function G(W,Z){const te=i(),F=i(),ee=i(),fe=i(),xe=i(),_e=i(),Me=i();return g(W[2],a),N(W[1],Z),U(ee,W[1]),I(fe,ee,c),V(ee,ee,W[2]),L(fe,W[2],fe),U(xe,fe),U(_e,xe),I(Me,_e,xe),I(te,Me,ee),I(te,te,fe),ae(te,te),I(te,te,ee),I(te,te,fe),I(te,te,fe),I(W[0],te,fe),U(F,W[0]),I(F,F,fe),A(F,ee)&&I(W[0],W[0],h),U(F,W[0]),I(F,F,fe),A(F,ee)?-1:(P(W[0])===Z[31]>>7&&V(W[0],o,W[0]),I(W[3],W[0],W[1]),0)}function oe(W,Z,te){const F=new Uint8Array(32),ee=[i(),i(),i(),i()],fe=[i(),i(),i(),i()];if(te.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(G(fe,W))return!1;const xe=new r.SHA512;xe.update(te.subarray(0,32)),xe.update(W),xe.update(Z);const _e=xe.digest();return k(_e),v(ee,fe,_e),b(fe,te.subarray(32)),K(ee,fe),D(F,ee),!E(te,F)}t.verify=oe;function $(W){let Z=[i(),i(),i(),i()];if(G(Z,W))throw new Error("Ed25519: invalid public key");let te=i(),F=i(),ee=Z[1];L(te,a,ee),V(F,a,ee),ie(F,F),I(te,te,F);let fe=new Uint8Array(32);return S(fe,te),fe}t.convertPublicKeyToX25519=$;function X(W){const Z=(0,r.hash)(W.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const te=new Uint8Array(Z.subarray(0,32));return(0,n.wipe)(Z),te}t.convertSecretKeyToX25519=X})(AO);const wNe="EdDSA",xNe="JWT",r8=".",AC="base64url",wne="utf8",xne="utf8",ENe=":",CNe="did",ANe="key",tq="base58btc",SNe="z",_Ne="K36",INe=32,TNe=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),PNe=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function cp(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return PNe(t)}catch{return t}}function Uu(t){return typeof t=="string"?t:TNe(t)||""}function rq(t){return cp(ji(Ni(t,AC),wne))}function n8(t){return ji(Ni(Uu(t),wne),AC)}function Ene(t){const e=Ni(_Ne,tq),r=SNe+ji(C5([e,t]),tq);return[CNe,ANe,r].join(ENe)}function kNe(t){return ji(t,AC)}function RNe(t){return Ni(t,AC)}function MNe(t){return Ni([n8(t.header),n8(t.payload)].join(r8),xne)}function ONe(t){return[n8(t.header),n8(t.payload),kNe(t.signature)].join(r8)}function kT(t){const e=t.split(r8),r=rq(e[0]),n=rq(e[1]),i=RNe(e[2]),s=Ni(e.slice(0,2).join(r8),xne);return{header:r,payload:n,signature:i,data:s}}function nq(t=e0.randomBytes(INe)){return AO.generateKeyPairFromSeed(t)}async function DNe(t,e,r,n,i=it.fromMiliseconds(Date.now())){const s={alg:wNe,typ:xNe},o=Ene(n.publicKey),a=i+r,c={iss:o,sub:t,aud:e,iat:i,exp:a},l=MNe({header:s,payload:c}),f=AO.sign(n.secretKey,l);return ONe({header:s,payload:c,signature:f})}const NNe={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var BNe={};const LNe=":";function xg(t){const[e,r]=t.split(LNe);return{namespace:e,reference:r}}function iq(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.accounts)}),r}function Cne(t,e){return t.includes(":")?[t]:e.chains||[]}var FNe=Object.defineProperty,sq=Object.getOwnPropertySymbols,jNe=Object.prototype.hasOwnProperty,UNe=Object.prototype.propertyIsEnumerable,oq=(t,e,r)=>e in t?FNe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,aq=(t,e)=>{for(var r in e||(e={}))jNe.call(e,r)&&oq(t,r,e[r]);if(sq)for(var r of sq(e))UNe.call(e,r)&&oq(t,r,e[r]);return t};const $Ne="ReactNative",la={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},qNe="js";function i8(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Em(){return!vx()&&!!sO()&&navigator.product===$Ne}function Ex(){return!i8()&&!!sO()&&!!vx()}function Cx(){return Em()?la.reactNative:i8()?la.node:Ex()?la.browser:la.unknown}function VNe(){var t;try{return Em()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function zNe(t,e){let r=uw.parse(t);return r=aq(aq({},r),e),t=uw.stringify(r),t}function Ane(){return bre()||{name:"",description:"",url:"",icons:[""]}}function HNe(){if(Cx()===la.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=$Pe();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function GNe(){var t;const e=Cx();return e===la.browser?[e,((t=mre())==null?void 0:t.host)||"unknown"].join(":"):e}function Sne(t,e,r){const n=HNe(),i=GNe();return[[t,e].join("-"),[qNe,r].join("-"),n,i].join("/")}function WNe({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const c=r.split("?"),l=Sne(t,e,n),f={auth:i,ua:l,projectId:s,useOnCloseEvent:o||void 0,origin:a||void 0},u=zNe(c[1]||"",f);return c[0]+"?"+u}function n1(t,e){return t.filter(r=>e.includes(r)).length===t.length}function _ne(t){return Object.fromEntries(t.entries())}function Ine(t){return new Map(Object.entries(t))}function j0(t=it.FIVE_MINUTES,e){const r=it.toMiliseconds(t||it.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function Eg(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Tne(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.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: ${t}`)}function KNe(t){return Tne("topic",t)}function YNe(t){return Tne("id",t)}function Pne(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function mi(t,e){return it.fromMiliseconds(Date.now()+it.toMiliseconds(t))}function Id(t){return Date.now()>=it.toMiliseconds(t)}function Sr(t,e){return`${t}${e?`:${e}`:""}`}function A5(t=[],e=[]){return[...new Set([...t,...e])]}async function QNe({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=JNe(s,t,e),a=Cx();if(a===la.browser){if(!((n=vx())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,XNe()?"_blank":"_self","noreferrer noopener")}else a===la.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function JNe(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${eBe(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function ZNe(t,e){let r="";try{if(Ex()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function cq(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function lq(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function SO(){return typeof process<"u"&&BNe.IS_VITEST==="true"}function XNe(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function eBe(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function kne(t){return Buffer.from(t,"base64").toString("utf-8")}const tBe="https://rpc.walletconnect.org/v1";async function rBe(t,e,r,n,i,s){switch(r.t){case"eip191":return nBe(t,e,r.s);case"eip1271":return await iBe(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function nBe(t,e,r){return GMe(Are(e),r).toLowerCase()===t.toLowerCase()}async function iBe(t,e,r,n,i,s){const o=xg(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",f=r.substring(2),u=Are(e).substring(2),h=a+u+c+l+f,g=await fetch(`${s||tBe}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:sBe(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:h},"latest"]})}),{result:y}=await g.json();return y?y.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function sBe(){return Date.now()+Math.floor(Math.random()*1e3)}var oBe=Object.defineProperty,aBe=Object.defineProperties,cBe=Object.getOwnPropertyDescriptors,fq=Object.getOwnPropertySymbols,lBe=Object.prototype.hasOwnProperty,fBe=Object.prototype.propertyIsEnumerable,uq=(t,e,r)=>e in t?oBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uBe=(t,e)=>{for(var r in e||(e={}))lBe.call(e,r)&&uq(t,r,e[r]);if(fq)for(var r of fq(e))fBe.call(e,r)&&uq(t,r,e[r]);return t},dBe=(t,e)=>aBe(t,cBe(e));const hBe="did:pkh:",_O=t=>t==null?void 0:t.split(":"),pBe=t=>{const e=t&&_O(t);if(e)return t.includes(hBe)?e[3]:e[1]},RT=t=>{const e=t&&_O(t);if(e)return e[2]+":"+e[3]},s8=t=>{const e=t&&_O(t);if(e)return e.pop()};async function dq(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=Rne(i,i.iss),o=s8(i.iss);return await rBe(o,s,n,RT(i.iss),r)}const Rne=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=s8(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${pBe(e)}`,c=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.exp?`Expiration Time: ${t.exp}`:void 0,u=t.nbf?`Not Before: ${t.nbf}`:void 0,h=t.requestId?`Request ID: ${t.requestId}`:void 0,g=t.resources?`Resources:${t.resources.map(m=>` - ${m}`).join("")}`:void 0,y=S5(t.resources);if(y){const m=dw(y);i=CBe(i,m)}return[r,n,"",i,"",s,o,a,c,l,f,u,h,g].filter(m=>m!=null).join(` `)};function vBe(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function gBe(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function lp(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function yBe(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:mBe(e,r,n)}}}function mBe(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function Mne(t){return lp(t),`urn:recap:${vBe(t).replace(/=/g,"")}`}function dw(t){const e=gBe(t.replace("urn:recap:",""));return lp(e),e}function bBe(t,e,r){const n=yBe(t,e,r);return Mne(n)}function wBe(t){return t&&t.includes("urn:recap:")}function xBe(t,e){const r=dw(t),n=dw(e),i=EBe(r,n);return Mne(i)}function EBe(t,e){lp(t),lp(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,l;n.att[i]=dBe(uBe({},n.att[i]),{[a]:((c=t.att[i])==null?void 0:c[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function CBe(t="",e){lp(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const c=Object.keys(e.att[a]).map(u=>({ability:u.split("/")[0],action:u.split("/")[1]}));c.sort((u,h)=>u.action.localeCompare(h.action));const l={};c.forEach(u=>{l[u.ability]||(l[u.ability]=[]),l[u.ability].push(u.action)});const f=Object.keys(l).map(u=>(i++,`(${i}) '${u}': '${l[u].join("', '")}' for '${a}'.`));n.push(f.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function hq(t){var e;const r=dw(t);lp(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function pq(t){const e=dw(t);lp(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function S5(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return wBe(e)?e:void 0}const One="base10",oo="base16",th="base64pad",gb="base64url",Ax="utf8",Dne=0,Cu=1,Sx=2,ABe=0,vq=1,m2=12,IO=32;function SBe(){const t=gO.generateKeyPair();return{privateKey:ji(t.secretKey,oo),publicKey:ji(t.publicKey,oo)}}function MT(){const t=e0.randomBytes(IO);return ji(t,oo)}function _Be(t,e){const r=gO.sharedKey(Ni(t,oo),Ni(e,oo),!0),n=new _Oe(mx.SHA256,r).expand(IO);return ji(n,oo)}function _5(t){const e=mx.hash(Ni(t,oo));return ji(e,oo)}function Yf(t){const e=mx.hash(Ni(t,Ax));return ji(e,oo)}function Nne(t){return Ni(`${t}`,One)}function fp(t){return Number(ji(t,One))}function IBe(t){const e=Nne(typeof t.type<"u"?t.type:Dne);if(fp(e)===Cu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Ni(t.senderPublicKey,oo):void 0,n=typeof t.iv<"u"?Ni(t.iv,oo):e0.randomBytes(m2),i=new pO.ChaCha20Poly1305(Ni(t.symKey,oo)).seal(n,Ni(t.message,Ax));return Bne({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function TBe(t,e){const r=Nne(Sx),n=e0.randomBytes(m2),i=Ni(t,Ax);return Bne({type:r,sealed:i,iv:n,encoding:e})}function PBe(t){const e=new pO.ChaCha20Poly1305(Ni(t.symKey,oo)),{sealed:r,iv:n}=hw({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ji(i,Ax)}function kBe(t,e){const{sealed:r}=hw({encoded:t,encoding:e});return ji(r,Ax)}function Bne(t){const{encoding:e=th}=t;if(fp(t.type)===Sx)return ji(C5([t.type,t.sealed]),e);if(fp(t.type)===Cu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ji(C5([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return ji(C5([t.type,t.iv,t.sealed]),e)}function hw(t){const{encoded:e,encoding:r=th}=t,n=Ni(e,r),i=n.slice(ABe,vq),s=vq;if(fp(i)===Cu){const l=s+IO,f=l+m2,u=n.slice(s,l),h=n.slice(l,f),g=n.slice(f);return{type:i,sealed:g,iv:h,senderPublicKey:u}}if(fp(i)===Sx){const l=n.slice(s),f=e0.randomBytes(m2);return{type:i,sealed:l,iv:f}}const o=s+m2,a=n.slice(s,o),c=n.slice(o);return{type:i,sealed:c,iv:a}}function RBe(t,e){const r=hw({encoded:t,encoding:e==null?void 0:e.encoding});return Lne({type:fp(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ji(r.senderPublicKey,oo):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function Lne(t){const e=(t==null?void 0:t.type)||Dne;if(e===Cu){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function gq(t){return t.type===Cu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function yq(t){return t.type===Sx}function MBe(t){return new lne.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function OBe(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function DBe(t){return Buffer.from(OBe(t),"base64")}function NBe(t,e){const[r,n,i]=t.split("."),s=DBe(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),c=`${r}.${n}`,l=new mx.SHA256().update(Buffer.from(c)).digest(),f=MBe(e),u=Buffer.from(l).toString("hex");if(!f.verify(u,{r:o,s:a}))throw new Error("Invalid signature");return kT(t).payload}const BBe="irn";function OT(t){return(t==null?void 0:t.relay)||{protocol:BBe}}function zb(t){const e=NNe[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var LBe=Object.defineProperty,FBe=Object.defineProperties,jBe=Object.getOwnPropertyDescriptors,mq=Object.getOwnPropertySymbols,UBe=Object.prototype.hasOwnProperty,$Be=Object.prototype.propertyIsEnumerable,bq=(t,e,r)=>e in t?LBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wq=(t,e)=>{for(var r in e||(e={}))UBe.call(e,r)&&bq(t,r,e[r]);if(mq)for(var r of mq(e))$Be.call(e,r)&&bq(t,r,e[r]);return t},qBe=(t,e)=>FBe(t,jBe(e));function VBe(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function xq(t){if(!t.includes("wc:")){const c=kne(t);c!=null&&c.includes("wc:")&&(t=c)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=uw.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:zBe(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:VBe(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function zBe(t){return t.startsWith("//")?t.substring(2):t}function HBe(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function Eq(t){return`${t.protocol}:${t.topic}@${t.version}?`+uw.stringify(wq(qBe(wq({symKey:t.symKey},HBe(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function m6(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Cm(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function GBe(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Cm(r.accounts))}),e}function WBe(t,e){const r=[];return Object.values(t).forEach(n=>{Cm(n.accounts).includes(e)&&r.push(...n.methods)}),r}function KBe(t,e){const r=[];return Object.values(t).forEach(n=>{Cm(n.accounts).includes(e)&&r.push(...n.events)}),r}function TO(t){return t.includes(":")}function Hb(t){return TO(t)?t.split(":")[0]:t}function YBe(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function Cq(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=YBe(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=A5(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const QBe={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}},JBe={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 et(t,e){const{message:r,code:n}=JBe[t];return{message:e?`${r} ${e}`:r,code:n}}function sn(t,e){const{message:r,code:n}=QBe[t];return{message:e?`${r} ${e}`:r,code:n}}function cf(t,e){return!!Array.isArray(t)}function pw(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Ro(t){return typeof t>"u"}function ti(t,e){return e&&Ro(t)?!0:typeof t=="string"&&!!t.trim().length}function PO(t,e){return typeof t=="number"&&!isNaN(t)}function ZBe(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return n1(i,n)?(n.forEach(o=>{const{accounts:a,methods:c,events:l}=t.namespaces[o],f=Cm(a),u=r[o];(!n1(Cne(o,u),f)||!n1(u.methods,c)||!n1(u.events,l))&&(s=!1)}),s):!1}function o8(t){return ti(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function XBe(t){if(ti(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&o8(r)}}return!1}function eLe(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(ti(t,!1)){if(e(t))return!0;const r=kne(t);return e(r)}}catch{}return!1}function tLe(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function rLe(t){return t==null?void 0:t.topic}function nLe(t,e){let r=null;return ti(t==null?void 0:t.publicKey,!1)||(r=et("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Aq(t){let e=!0;return cf(t)?t.length&&(e=t.every(r=>ti(r,!1))):e=!1,e}function iLe(t,e,r){let n=null;return cf(e)&&e.length?e.forEach(i=>{n||o8(i)||(n=sn("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):o8(t)||(n=sn("UNSUPPORTED_CHAINS",`${r}, 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"] }`)),n}function sLe(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=iLe(i,Cne(i,s),`${e} ${r}`);o&&(n=o)}),n}function oLe(t,e){let r=null;return cf(t)?t.forEach(n=>{r||XBe(n)||(r=sn("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=sn("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function aLe(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=oLe(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function cLe(t,e){let r=null;return Aq(t==null?void 0:t.methods)?Aq(t==null?void 0:t.events)||(r=sn("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=sn("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Fne(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=cLe(n,`${e}, namespace`);i&&(r=i)}),r}function lLe(t,e,r){let n=null;if(t&&pw(t)){const i=Fne(t,e);i&&(n=i);const s=sLe(t,e,r);s&&(n=s)}else n=et("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function s7(t,e){let r=null;if(t&&pw(t)){const n=Fne(t,e);n&&(r=n);const i=aLe(t,e);i&&(r=i)}else r=et("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function jne(t){return ti(t.protocol,!0)}function fLe(t,e){let r=!1;return t?t&&cf(t)&&t.length&&t.forEach(n=>{r=jne(n)}):r=!0,r}function uLe(t){return typeof t=="number"}function Ao(t){return typeof t<"u"&&typeof t!==null}function dLe(t){return!(!t||typeof t!="object"||!t.code||!PO(t.code)||!t.message||!ti(t.message,!1))}function hLe(t){return!(Ro(t)||!ti(t.method,!1))}function pLe(t){return!(Ro(t)||Ro(t.result)&&Ro(t.error)||!PO(t.id)||!ti(t.jsonrpc,!1))}function vLe(t){return!(Ro(t)||!ti(t.name,!1))}function Sq(t,e){return!(!o8(e)||!GBe(t).includes(e))}function gLe(t,e,r){return ti(r,!1)?WBe(t,e).includes(r):!1}function yLe(t,e,r){return ti(r,!1)?KBe(t,e).includes(r):!1}function _q(t,e,r){let n=null;const i=mLe(t),s=bLe(e),o=Object.keys(i),a=Object.keys(s),c=Iq(Object.keys(t)),l=Iq(Object.keys(e)),f=c.filter(u=>!l.includes(u));return f.length&&(n=et("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} @@ -994,16 +994,16 @@ PERFORMANCE OF THIS SOFTWARE. Required: ${o.toString()} Approved: ${a.toString()}`)),Object.keys(e).forEach(u=>{if(!u.includes(":")||n)return;const h=Cm(e[u].accounts);h.includes(u)||(n=et("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${u} Required: ${u} - Approved: ${h.toString()}`))}),o.forEach(u=>{n||(n1(i[u].methods,s[u].methods)?n1(i[u].events,s[u].events)||(n=et("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${u}`)):n=et("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${u}`))}),n}function mLe(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function Iq(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function bLe(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Cm(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function wLe(t,e){return PO(t)&&t<=e.max&&t>=e.min}function Tq(){const t=Cx();return new Promise(e=>{switch(t){case la.browser:e(xLe());break;case la.reactNative:e(ELe());break;case la.node:e(CLe());break;default:e(!0)}})}function xLe(){return Ex()&&(navigator==null?void 0:navigator.onLine)}async function ELe(){if(Em()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function CLe(){return!0}function ALe(t){switch(Cx()){case la.browser:SLe(t);break;case la.reactNative:_Le(t);break}}function SLe(t){!Em()&&Ex()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function _Le(t){Em()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const o7={};let yb=class{static get(e){return o7[e]}static set(e,r){o7[e]=r}static delete(e){delete o7[e]}};class Sp{}let ILe=class extends Sp{constructor(e){super()}};const Pq=it.FIVE_SECONDS,Am={pulse:"heartbeat_pulse"};let TLe=class Une extends ILe{constructor(e){super(e),this.events=new wa.EventEmitter,this.interval=Pq,this.interval=(e==null?void 0:e.interval)||Pq}static async init(e){const r=new Une(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),it.toMiliseconds(this.interval))}pulse(){this.events.emit(Am.pulse)}};const PLe=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kLe=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,RLe=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function MLe(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){OLe(t);return}return e}function OLe(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function b6(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!RLe.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(PLe.test(t)||kLe.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,MLe)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function DLe(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Pi(t,...e){try{return DLe(t(...e))}catch(r){return Promise.reject(r)}}function NLe(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function BLe(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function I5(t){if(NLe(t))return String(t);if(BLe(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return I5(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function $ne(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const DT="base64:";function LLe(t){if(typeof t=="string")return t;$ne();const e=Buffer.from(t).toString("base64");return DT+e}function FLe(t){return typeof t!="string"||!t.startsWith(DT)?t:($ne(),Buffer.from(t.slice(DT.length),"base64"))}function Co(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function jLe(...t){return Co(t.join(":"))}function w6(t){return t=Co(t),t?t+":":""}const ULe="memory",$Le=()=>{const t=new Map;return{name:ULe,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function qLe(t={}){const e={mounts:{"":t.driver||$Le()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const f of e.mountpoints)if(l.startsWith(f))return{base:f,relativeKey:l.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,f)=>e.mountpoints.filter(u=>u.startsWith(l)||f&&l.startsWith(u)).map(u=>({relativeBase:l.length>u.length?l.slice(u.length):void 0,mountpoint:u,driver:e.mounts[u]})),i=(l,f)=>{if(e.watching){f=Co(f);for(const u of e.watchListeners)u(l,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await kq(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,f,u)=>{const h=new Map,g=y=>{let m=h.get(y.base);return m||(m={driver:y.driver,base:y.base,items:[]},h.set(y.base,m)),m};for(const y of l){const m=typeof y=="string",S=Co(m?y:y.key),E=m?void 0:y.value,A=m||!y.options?f:{...f,...y.options},P=r(S);g(P).items.push({key:S,value:E,relativeKey:P.relativeKey,options:A})}return Promise.all([...h.values()].map(y=>u(y))).then(y=>y.flat())},c={hasItem(l,f={}){l=Co(l);const{relativeKey:u,driver:h}=r(l);return Pi(h.hasItem,u,f)},getItem(l,f={}){l=Co(l);const{relativeKey:u,driver:h}=r(l);return Pi(h.getItem,u,f).then(g=>b6(g))},getItems(l,f){return a(l,f,u=>u.driver.getItems?Pi(u.driver.getItems,u.items.map(h=>({key:h.relativeKey,options:h.options})),f).then(h=>h.map(g=>({key:jLe(u.base,g.key),value:b6(g.value)}))):Promise.all(u.items.map(h=>Pi(u.driver.getItem,h.relativeKey,h.options).then(g=>({key:h.key,value:b6(g)})))))},getItemRaw(l,f={}){l=Co(l);const{relativeKey:u,driver:h}=r(l);return h.getItemRaw?Pi(h.getItemRaw,u,f):Pi(h.getItem,u,f).then(g=>FLe(g))},async setItem(l,f,u={}){if(f===void 0)return c.removeItem(l);l=Co(l);const{relativeKey:h,driver:g}=r(l);g.setItem&&(await Pi(g.setItem,h,I5(f),u),g.watch||i("update",l))},async setItems(l,f){await a(l,f,async u=>{if(u.driver.setItems)return Pi(u.driver.setItems,u.items.map(h=>({key:h.relativeKey,value:I5(h.value),options:h.options})),f);u.driver.setItem&&await Promise.all(u.items.map(h=>Pi(u.driver.setItem,h.relativeKey,I5(h.value),h.options)))})},async setItemRaw(l,f,u={}){if(f===void 0)return c.removeItem(l,u);l=Co(l);const{relativeKey:h,driver:g}=r(l);if(g.setItemRaw)await Pi(g.setItemRaw,h,f,u);else if(g.setItem)await Pi(g.setItem,h,LLe(f),u);else return;g.watch||i("update",l)},async removeItem(l,f={}){typeof f=="boolean"&&(f={removeMeta:f}),l=Co(l);const{relativeKey:u,driver:h}=r(l);h.removeItem&&(await Pi(h.removeItem,u,f),(f.removeMeta||f.removeMata)&&await Pi(h.removeItem,u+"$",f),h.watch||i("remove",l))},async getMeta(l,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),l=Co(l);const{relativeKey:u,driver:h}=r(l),g=Object.create(null);if(h.getMeta&&Object.assign(g,await Pi(h.getMeta,u,f)),!f.nativeOnly){const y=await Pi(h.getItem,u+"$",f).then(m=>b6(m));y&&typeof y=="object"&&(typeof y.atime=="string"&&(y.atime=new Date(y.atime)),typeof y.mtime=="string"&&(y.mtime=new Date(y.mtime)),Object.assign(g,y))}return g},setMeta(l,f,u={}){return this.setItem(l+"$",f,u)},removeMeta(l,f={}){return this.removeItem(l+"$",f)},async getKeys(l,f={}){l=w6(l);const u=n(l,!0);let h=[];const g=[];for(const y of u){const m=await Pi(y.driver.getKeys,y.relativeBase,f);for(const S of m){const E=y.mountpoint+Co(S);h.some(A=>E.startsWith(A))||g.push(E)}h=[y.mountpoint,...h.filter(S=>!S.startsWith(y.mountpoint))]}return l?g.filter(y=>y.startsWith(l)&&y[y.length-1]!=="$"):g.filter(y=>y[y.length-1]!=="$")},async clear(l,f={}){l=w6(l),await Promise.all(n(l,!1).map(async u=>{if(u.driver.clear)return Pi(u.driver.clear,u.relativeBase,f);if(u.driver.removeItem){const h=await u.driver.getKeys(u.relativeBase||"",f);return Promise.all(h.map(g=>u.driver.removeItem(g,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>Rq(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,f){if(l=w6(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((u,h)=>h.length-u.length)),e.mounts[l]=f,e.watching&&Promise.resolve(kq(f,i,l)).then(u=>{e.unwatch[l]=u}).catch(console.error),c},async unmount(l,f=!0){l=w6(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),f&&await Rq(e.mounts[l]),e.mountpoints=e.mountpoints.filter(u=>u!==l),delete e.mounts[l])},getMount(l=""){l=Co(l)+":";const f=r(l);return{driver:f.driver,base:f.base}},getMounts(l="",f={}){return l=Co(l),n(l,f.parents).map(h=>({driver:h.driver,base:h.mountpoint}))},keys:(l,f={})=>c.getKeys(l,f),get:(l,f={})=>c.getItem(l,f),set:(l,f,u={})=>c.setItem(l,f,u),has:(l,f={})=>c.hasItem(l,f),del:(l,f={})=>c.removeItem(l,f),remove:(l,f={})=>c.removeItem(l,f)};return c}function kq(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function Rq(t){typeof t.dispose=="function"&&await Pi(t.dispose)}function _p(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function qne(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=_p(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let a7;function _x(){return a7||(a7=qne("keyval-store","keyval")),a7}function Mq(t,e=_x()){return e("readonly",r=>_p(r.get(t)))}function VLe(t,e,r=_x()){return r("readwrite",n=>(n.put(e,t),_p(n.transaction)))}function zLe(t,e=_x()){return e("readwrite",r=>(r.delete(t),_p(r.transaction)))}function HLe(t=_x()){return t("readwrite",e=>(e.clear(),_p(e.transaction)))}function GLe(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},_p(t.transaction)}function WLe(t=_x()){return t("readonly",e=>{if(e.getAllKeys)return _p(e.getAllKeys());const r=[];return GLe(e,n=>r.push(n.key)).then(()=>r)})}const KLe="idb-keyval";var YLe=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=qne(t.dbName,t.storeName)),{name:KLe,options:t,async hasItem(i){return!(typeof await Mq(r(i),n)>"u")},async getItem(i){return await Mq(r(i),n)??null},setItem(i,s){return VLe(r(i),s,n)},removeItem(i){return zLe(r(i),n)},getKeys(){return WLe(n)},clear(){return HLe(n)}}};const QLe="WALLET_CONNECT_V2_INDEXED_DB",JLe="keyvaluestorage";let ZLe=class{constructor(){this.indexedDb=qLe({driver:YLe({dbName:QLe,storeName:JLe})})}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){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Uu(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var c7=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},T5={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof c7<"u"&&c7.localStorage?T5.exports=c7.localStorage:typeof window<"u"&&window.localStorage?T5.exports=window.localStorage:T5.exports=new e})();function XLe(t){var e;return[t[0],cp((e=t[1])!=null?e:"")]}let eFe=class{constructor(){this.localStorage=T5.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(XLe)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return cp(r)}async setItem(e,r){this.localStorage.setItem(e,Uu(r))}async removeItem(e){this.localStorage.removeItem(e)}};const tFe="wc_storage_version",Oq=1,rFe=async(t,e,r)=>{const n=tFe,i=await e.getItem(n);if(i&&i>=Oq){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,Oq),r(e),nFe(t,o)},nFe=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let iFe=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new eFe;this.storage=e;try{const r=new ZLe;rFe(e,r,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,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function sFe(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var oFe=aFe;function aFe(t,e,r){var n=r&&r.stringify||sFe,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?u:0,t.charCodeAt(g+1)){case 100:case 102:if(f>=c||e[f]==null)break;u=c||e[f]==null)break;u=c||e[f]===void 0)break;u",u=g+2,g++;break}l+=n(e[f]),u=g+2,g++;break;case 115:if(f>=c)break;u-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",c=Object.create(r);c.log||(c.log=gw),Object.defineProperty(c,"levelVal",{get:f}),Object.defineProperty(c,"level",{get:u,set:h});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:pFe(t)};c.levels=Jl.levels,c.level=a,c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=gw,c.serializers=n,c._serialize=i,c._stdErrSerialize=s,c.child=g,e&&(c._logEvent=NT());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function u(){return this._level}function h(y){if(y!=="silent"&&!this.levels.values[y])throw Error("unknown level "+y);this._level=y,gv(l,c,"error","log"),gv(l,c,"fatal","error"),gv(l,c,"warn","error"),gv(l,c,"info","log"),gv(l,c,"debug","log"),gv(l,c,"trace","log")}function g(y,m){if(!y)throw new Error("missing bindings for child Pino");m=m||{},i&&y.serializers&&(m.serializers=y.serializers);const S=m.serializers;if(i&&S){var E=Object.assign({},n,S),A=t.browser.serialize===!0?Object.keys(E):i;delete y.serializers,SC([y],A,E,this._stdErrSerialize)}function P(N){this._childLevel=(N._childLevel|0)+1,this.error=yv(N,y,"error"),this.fatal=yv(N,y,"fatal"),this.warn=yv(N,y,"warn"),this.info=yv(N,y,"info"),this.debug=yv(N,y,"debug"),this.trace=yv(N,y,"trace"),E&&(this.serializers=E,this._serialize=A),e&&(this._logEvent=NT([].concat(N._logEvent.bindings,y)))}return P.prototype=this,new P(this)}return c}Jl.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Jl.stdSerializers=cFe;Jl.stdTimeFunctions=Object.assign({},{nullTime:Vne,epochTime:zne,unixTime:vFe,isoTime:gFe});function gv(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?gw:i[r]?i[r]:vw[r]||vw[n]||gw,fFe(t,e,r)}function fFe(t,e,r){!t.transmit&&e[r]===gw||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===vw?vw:this;for(var c=0;c-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function yv(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Hne=class{constructor(e,r=kO){this.level=e??"error",this.levelValue=Cv.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Nq(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===Cv.levels.values.error?console.error(e):r===Cv.levels.values.warn?console.warn(e):r===Cv.levels.values.debug?console.debug(e):r===Cv.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Uu({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Nq(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Uu({extraMetadata:e})),new Blob(r,{type:"application/json"})}},wFe=class{constructor(e,r=kO){this.baseChunkLogger=new Hne(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},xFe=class{constructor(e,r=kO){this.baseChunkLogger=new Hne(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var EFe=Object.defineProperty,CFe=Object.defineProperties,AFe=Object.getOwnPropertyDescriptors,Bq=Object.getOwnPropertySymbols,SFe=Object.prototype.hasOwnProperty,_Fe=Object.prototype.propertyIsEnumerable,Lq=(t,e,r)=>e in t?EFe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,a8=(t,e)=>{for(var r in e||(e={}))SFe.call(e,r)&&Lq(t,r,e[r]);if(Bq)for(var r of Bq(e))_Fe.call(e,r)&&Lq(t,r,e[r]);return t},c8=(t,e)=>CFe(t,AFe(e));function _C(t){return c8(a8({},t),{level:(t==null?void 0:t.level)||mFe.level})}function IFe(t,e=Tx){return t[e]||""}function TFe(t,e,r=Tx){return t[r]=e,t}function Uo(t,e=Tx){let r="";return typeof t.bindings>"u"?r=IFe(t,e):r=t.bindings().context||"",r}function PFe(t,e,r=Tx){const n=Uo(t,r);return n.trim()?`${n}/${e}`:e}function uo(t,e,r=Tx){const n=PFe(t,e,r),i=t.child({context:n});return TFe(i,n,r)}function kFe(t){var e,r;const n=new wFe((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Ix(c8(a8({},t.opts),{level:"trace",browser:c8(a8({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function RFe(t){var e;const r=new xFe((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Ix(c8(a8({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function MFe(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?kFe(t):RFe(t)}let OFe=class extends Sp{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},DFe=class extends Sp{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},NFe=class{constructor(e,r){this.logger=e,this.core=r}},BFe=class extends Sp{constructor(e,r){super(),this.relayer=e,this.logger=r}},LFe=class extends Sp{constructor(e){super()}},FFe=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},jFe=class extends Sp{constructor(e,r){super(),this.relayer=e,this.logger=r}},UFe=class extends Sp{constructor(e,r){super(),this.core=e,this.logger=r}},$Fe=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},qFe=class{constructor(e,r){this.projectId=e,this.logger=r}},VFe=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},zFe=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},HFe=class{constructor(e){this.client=e}};const GFe="PARSE_ERROR",WFe="INVALID_REQUEST",KFe="METHOD_NOT_FOUND",YFe="INVALID_PARAMS",Gne="INTERNAL_ERROR",RO="SERVER_ERROR",QFe=[-32700,-32600,-32601,-32602,-32603],b2={[GFe]:{code:-32700,message:"Parse error"},[WFe]:{code:-32600,message:"Invalid Request"},[KFe]:{code:-32601,message:"Method not found"},[YFe]:{code:-32602,message:"Invalid params"},[Gne]:{code:-32603,message:"Internal error"},[RO]:{code:-32e3,message:"Server error"}},Wne=RO;function JFe(t){return QFe.includes(t)}function Fq(t){return Object.keys(b2).includes(t)?b2[t]:b2[Wne]}function ZFe(t){const e=Object.values(b2).find(r=>r.code===t);return e||b2[Wne]}function Kne(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Yne={},Bf={},jq;function XFe(){if(jq)return Bf;jq=1,Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.isBrowserCryptoAvailable=Bf.getSubtleCrypto=Bf.getBrowerCrypto=void 0;function t(){return(xi==null?void 0:xi.crypto)||(xi==null?void 0:xi.msCrypto)||{}}Bf.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Bf.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Bf.isBrowserCryptoAvailable=r,Bf}var Lf={},Uq;function eje(){if(Uq)return Lf;Uq=1,Object.defineProperty(Lf,"__esModule",{value:!0}),Lf.isBrowser=Lf.isNode=Lf.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Lf.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Lf.isNode=e;function r(){return!t()&&!e()}return Lf.isBrowser=r,Lf}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=px;e.__exportStar(XFe(),t),e.__exportStar(eje(),t)})(Yne);function Td(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function i1(t=6){return BigInt(Td(t))}function rh(t,e,r){return{id:r||Td(),jsonrpc:"2.0",method:t,params:e}}function IC(t,e){return{id:t,jsonrpc:"2.0",result:e}}function TC(t,e,r){return{id:t,jsonrpc:"2.0",error:tje(e)}}function tje(t,e){return typeof t>"u"?Fq(Gne):(typeof t=="string"&&(t=Object.assign(Object.assign({},Fq(RO)),{message:t})),JFe(t.code)&&(t=ZFe(t.code)),t)}class rje{}class nje extends rje{constructor(){super()}}class ije extends nje{constructor(e){super()}}const sje="^https?:",oje="^wss?:";function aje(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Qne(t,e){const r=aje(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function $q(t){return Qne(t,sje)}function qq(t){return Qne(t,oje)}function cje(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Jne(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function MO(t){return Jne(t)&&"method"in t}function PC(t){return Jne(t)&&(xl(t)||Ka(t))}function xl(t){return"result"in t}function Ka(t){return"error"in t}let hc=class extends ije{constructor(e){super(e),this.events=new wa.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(rh(e.method,e.params||[],e.id||i1().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Ka(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),PC(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const lje=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),fje=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Vq=t=>t.split("?")[0],zq=10,uje=lje();let dje=class{constructor(e){if(this.url=e,this.events=new wa.EventEmitter,this.registering=!1,!qq(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Uu(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!qq(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=Yne.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!cje(e)},o=new uje(e,[],s);fje()?o.onerror=a=>{const c=a;n(this.emitError(c.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?cp(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=TC(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return Kne(e,Vq(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>zq&&this.events.setMaxListeners(zq)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${Vq(this.url)}`));return this.events.emit("register_error",r),r}};var l8={exports:{}};l8.exports;(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",f="[object Boolean]",u="[object Date]",h="[object Error]",g="[object Function]",y="[object GeneratorFunction]",m="[object Map]",S="[object Number]",E="[object Null]",A="[object Object]",P="[object Promise]",N="[object Proxy]",L="[object RegExp]",V="[object Set]",I="[object String]",U="[object Symbol]",ie="[object Undefined]",ae="[object WeakMap]",K="[object ArrayBuffer]",R="[object DataView]",D="[object Float32Array]",v="[object Float64Array]",b="[object Int8Array]",M="[object Int16Array]",B="[object Int32Array]",x="[object Uint8Array]",C="[object Uint8ClampedArray]",w="[object Uint16Array]",k="[object Uint32Array]",O=/[\\^$.*+?()[\]{}|]/g,G=/^\[object .+?Constructor\]$/,oe=/^(?:0|[1-9]\d*)$/,$={};$[D]=$[v]=$[b]=$[M]=$[B]=$[x]=$[C]=$[w]=$[k]=!0,$[a]=$[c]=$[K]=$[f]=$[R]=$[u]=$[h]=$[g]=$[m]=$[S]=$[A]=$[L]=$[V]=$[I]=$[ae]=!1;var X=typeof xi=="object"&&xi&&xi.Object===Object&&xi,W=typeof self=="object"&&self&&self.Object===Object&&self,Z=X||W||Function("return this")(),te=e&&!e.nodeType&&e,F=te&&!0&&t&&!t.nodeType&&t,ee=F&&F.exports===te,fe=ee&&X.process,xe=function(){try{return fe&&fe.binding&&fe.binding("util")}catch{}}(),_e=xe&&xe.isTypedArray;function Me(le,Ee){for(var Ue=-1,gt=le==null?0:le.length,tn=0,rr=[];++Ue-1}function _i(le,Ee){var Ue=this.__data__,gt=yf(Ue,le);return gt<0?(++this.size,Ue.push([le,Ee])):Ue[gt][1]=Ee,this}tr.prototype.clear=Or,tr.prototype.delete=pi,tr.prototype.get=vi,tr.prototype.has=gi,tr.prototype.set=_i;function Tn(le){var Ee=-1,Ue=le==null?0:le.length;for(this.clear();++EeUn))return!1;var rn=rr.get(le);if(rn&&rr.get(Ee))return rn==Ee;var pn=-1,bs=!0,Rn=Ue&s?new ms:void 0;for(rr.set(le,Ee),rr.set(Ee,le);++pn-1&&le%1==0&&le-1&&le%1==0&&le<=o}function a0(le){var Ee=typeof le;return le!=null&&(Ee=="object"||Ee=="function")}function Cf(le){return le!=null&&typeof le=="object"}var Lp=_e?Xe(_e):n0;function _m(le){return Vo(le)?Pp(le):Rp(le)}function Hr(){return[]}function Yr(){return!1}t.exports=Sm})(l8,l8.exports);var hje=l8.exports;const pje=$u(hje),Zne="wc",Xne=2,OO="core",lf=`${Zne}@2:${OO}:`,vje={name:OO,logger:"error"},gje={database:":memory:"},yje="crypto",Hq="client_ed25519_seed",mje=it.ONE_DAY,bje="keychain",wje="0.3",xje="messages",Eje="0.3",Cje=it.SIX_HOURS,Aje="publisher",eie="irn",Sje="error",tie="wss://relay.walletconnect.org",_je="relayer",to={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Ije="_subscription",Ba={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Tje=.1,BT="2.17.2",gn={link_mode:"link_mode",relay:"relay"},Pje="0.3",kje="WALLETCONNECT_CLIENT_ID",Gq="WALLETCONNECT_LINK_MODE_APPS",El={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},Rje="subscription",Mje="0.3",Oje=it.FIVE_SECONDS*1e3,Dje="pairing",Nje="0.3",mb={wc_pairingDelete:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:it.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:it.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:it.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:it.ONE_DAY,prompt:!1,tag:0},res:{ttl:it.ONE_DAY,prompt:!1,tag:0}}},V0={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Ac={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Bje="history",Lje="0.3",Fje="expirer",Ua={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},jje="0.3",Uje="verify-api",$je="https://verify.walletconnect.com",rie="https://verify.walletconnect.org",w2=rie,qje=`${w2}/v3`,Vje=[$je,rie],zje="echo",Hje="https://echo.walletconnect.com",bl={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},$f={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Sc={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},P0={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},k0={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},bb={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Gje=.1,Wje="event-client",Kje=86400,Yje="https://pulse.walletconnect.org/batch";function Qje(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,N=new Uint8Array(P);E!==A;){for(var L=y[E],V=0,I=P-1;(L!==0||V>>0,N[I]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");S=V,E++}for(var U=P-S;U!==P&&N[U]===0;)U++;for(var ie=c.repeat(m);U>>0,P=new Uint8Array(A);y[m];){var N=r[y.charCodeAt(m)];if(N===255)return;for(var L=0,V=A-1;(N!==0||L>>0,P[V]=N%256>>>0,N=N/256>>>0;if(N!==0)throw new Error("Non-zero carry");E=L,m++}if(y[m]!==" "){for(var I=A-E;I!==A&&P[I]===0;)I++;for(var U=new Uint8Array(S+(A-I)),ie=S;I!==A;)U[ie++]=P[I++];return U}}}function g(y){var m=h(y);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:h,decode:g}}var Jje=Qje,Zje=Jje;const nie=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Xje=t=>new TextEncoder().encode(t),eUe=t=>new TextDecoder().decode(t);class tUe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class rUe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return iie(this,e)}}class nUe{constructor(e){this.decoders=e}or(e){return iie(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const iie=(t,e)=>new nUe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class iUe{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new tUe(e,r,n),this.decoder=new rUe(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const kC=({name:t,prefix:e,encode:r,decode:n})=>new iUe(t,e,r,n),Px=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Zje(r,e);return kC({prefix:t,name:e,encode:n,decode:s=>nie(i(s))})},sUe=(t,e,r,n)=>{const i={};for(let f=0;f=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},oUe=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<kC({prefix:e,name:t,encode(i){return oUe(i,n,r)},decode(i){return sUe(i,n,r,t)}}),aUe=kC({prefix:"\0",name:"identity",encode:t=>eUe(t),decode:t=>Xje(t)});var cUe=Object.freeze({__proto__:null,identity:aUe});const lUe=hs({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var fUe=Object.freeze({__proto__:null,base2:lUe});const uUe=hs({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var dUe=Object.freeze({__proto__:null,base8:uUe});const hUe=Px({prefix:"9",name:"base10",alphabet:"0123456789"});var pUe=Object.freeze({__proto__:null,base10:hUe});const vUe=hs({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),gUe=hs({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var yUe=Object.freeze({__proto__:null,base16:vUe,base16upper:gUe});const mUe=hs({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),bUe=hs({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),wUe=hs({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),xUe=hs({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),EUe=hs({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),CUe=hs({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),AUe=hs({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),SUe=hs({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_Ue=hs({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var IUe=Object.freeze({__proto__:null,base32:mUe,base32upper:bUe,base32pad:wUe,base32padupper:xUe,base32hex:EUe,base32hexupper:CUe,base32hexpad:AUe,base32hexpadupper:SUe,base32z:_Ue});const TUe=Px({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),PUe=Px({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var kUe=Object.freeze({__proto__:null,base36:TUe,base36upper:PUe});const RUe=Px({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),MUe=Px({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var OUe=Object.freeze({__proto__:null,base58btc:RUe,base58flickr:MUe});const DUe=hs({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),NUe=hs({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),BUe=hs({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),LUe=hs({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var FUe=Object.freeze({__proto__:null,base64:DUe,base64pad:NUe,base64url:BUe,base64urlpad:LUe});const sie=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),jUe=sie.reduce((t,e,r)=>(t[r]=e,t),[]),UUe=sie.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function $Ue(t){return t.reduce((e,r)=>(e+=jUe[r],e),"")}function qUe(t){const e=[];for(const r of t){const n=UUe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const VUe=kC({prefix:"🚀",name:"base256emoji",encode:$Ue,decode:qUe});var zUe=Object.freeze({__proto__:null,base256emoji:VUe}),HUe=oie,Wq=128,GUe=127,WUe=~GUe,KUe=Math.pow(2,31);function oie(t,e,r){e=e||[],r=r||0;for(var n=r;t>=KUe;)e[r++]=t&255|Wq,t/=128;for(;t&WUe;)e[r++]=t&255|Wq,t>>>=7;return e[r]=t|0,oie.bytes=r-n+1,e}var YUe=LT,QUe=128,Kq=127;function LT(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw LT.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&Kq)<=QUe);return LT.bytes=s-n,r}var JUe=Math.pow(2,7),ZUe=Math.pow(2,14),XUe=Math.pow(2,21),e$e=Math.pow(2,28),t$e=Math.pow(2,35),r$e=Math.pow(2,42),n$e=Math.pow(2,49),i$e=Math.pow(2,56),s$e=Math.pow(2,63),o$e=function(t){return t(aie.encode(t,e,r),e),Qq=t=>aie.encodingLength(t),FT=(t,e)=>{const r=e.byteLength,n=Qq(t),i=n+Qq(r),s=new Uint8Array(i+r);return Yq(t,s,0),Yq(r,s,n),s.set(e,i),new c$e(t,r,e,s)};class c$e{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const cie=({name:t,code:e,encode:r})=>new l$e(t,e,r);let l$e=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?FT(this.code,r):r.then(n=>FT(this.code,n))}else throw Error("Unknown type, must be binary type")}};const lie=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),f$e=cie({name:"sha2-256",code:18,encode:lie("SHA-256")}),u$e=cie({name:"sha2-512",code:19,encode:lie("SHA-512")});var d$e=Object.freeze({__proto__:null,sha256:f$e,sha512:u$e});const fie=0,h$e="identity",uie=nie,p$e=t=>FT(fie,uie(t)),v$e={code:fie,name:h$e,encode:uie,digest:p$e};var g$e=Object.freeze({__proto__:null,identity:v$e});new TextEncoder,new TextDecoder;const Jq={...cUe,...fUe,...dUe,...pUe,...yUe,...IUe,...kUe,...OUe,...FUe,...zUe};({...d$e,...g$e});function y$e(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function die(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Zq=die("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),f7=die("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=y$e(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=et("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=uo(r,this.name)}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,_ne(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Ine(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}let x$e=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=yje,this.randomSessionIdentifier=MT(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=nq(i);return Ene(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=SBe();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=nq(s),a=this.randomSessionIdentifier;return await DNe(a,i,mje,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),c=_Be(a,s);return this.setSymKey(c,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||_5(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=Lne(o),c=Uu(s);if(yq(a))return TBe(c,o==null?void 0:o.encoding);if(gq(a)){const h=a.senderPublicKey,g=a.receiverPublicKey;i=await this.generateSharedKey(h,g)}const l=this.getSymKey(i),{type:f,senderPublicKey:u}=a;return IBe({type:f,symKey:l,message:c,senderPublicKey:u,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=RBe(s,o);if(yq(a)){const c=kBe(s,o==null?void 0:o.encoding);return cp(c)}if(gq(a)){const c=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(c,l)}try{const c=this.getSymKey(i),l=PBe({symKey:c,encoded:s,encoding:o==null?void 0:o.encoding});return cp(l)}catch(c){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}},this.getPayloadType=(i,s=th)=>{const o=hw({encoded:i,encoding:s});return fp(o.type)},this.getPayloadSenderPublicKey=(i,s=th)=>{const o=hw({encoded:i,encoding:s});return o.senderPublicKey?ji(o.senderPublicKey,oo):void 0},this.core=e,this.logger=uo(r,this.name),this.keychain=n||new w$e(this.core,this.logger)}get context(){return Uo(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Hq)}catch{e=MT(),await this.keychain.set(Hq,e)}return b$e(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}};class E$e extends NFe{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=xje,this.version=Eje,this.initialized=!1,this.storagePrefix=lf,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Yf(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Yf(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=uo(e,this.name),this.core=r}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,_ne(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Ine(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}let C$e=class extends BFe{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new wa.EventEmitter,this.name=Aje,this.queue=new Map,this.publishTimeout=it.toMiliseconds(it.ONE_MINUTE),this.failedPublishTimeout=it.toMiliseconds(it.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||Cje,c=OT(s),l=(s==null?void 0:s.prompt)||!1,f=(s==null?void 0:s.tag)||0,u=(s==null?void 0:s.id)||i1().toString(),h={topic:n,message:i,opts:{ttl:a,relay:c,prompt:l,tag:f,id:u,attestation:s==null?void 0:s.attestation}},g=`Failed to publish payload, please try again. id:${u} tag:${f}`,y=Date.now();let m,S=1;try{for(;m===void 0;){if(Date.now()-y>this.publishTimeout)throw new Error(g);this.logger.trace({id:u,attempts:S},`publisher.publish - attempt ${S}`),m=await await Eg(this.rpcPublish(n,i,a,c,l,f,u,s==null?void 0:s.attestation).catch(E=>this.logger.warn(E)),this.publishTimeout,g),S++,m||await new Promise(E=>setTimeout(E,this.failedPublishTimeout))}this.relayer.events.emit(to.publish,h),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:u,topic:n,message:i,opts:s}})}catch(E){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(E),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw E;this.queue.set(u,h)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=uo(r,this.name),this.registerEventListeners()}get context(){return Uo(this.logger)}rpcPublish(e,r,n,i,s,o,a,c){var l,f,u,h;const g={method:zb(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:c},id:a};return Ro((l=g.params)==null?void 0:l.prompt)&&((f=g.params)==null||delete f.prompt),Ro((u=g.params)==null?void 0:u.tag)&&((h=g.params)==null||delete h.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Am.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(to.connection_stalled);return}this.checkQueue()}),this.relayer.on(to.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}};class A$e{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var S$e=Object.defineProperty,_$e=Object.defineProperties,I$e=Object.getOwnPropertyDescriptors,Xq=Object.getOwnPropertySymbols,T$e=Object.prototype.hasOwnProperty,P$e=Object.prototype.propertyIsEnumerable,eV=(t,e,r)=>e in t?S$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wb=(t,e)=>{for(var r in e||(e={}))T$e.call(e,r)&&eV(t,r,e[r]);if(Xq)for(var r of Xq(e))P$e.call(e,r)&&eV(t,r,e[r]);return t},u7=(t,e)=>_$e(t,I$e(e));class k$e extends jFe{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new A$e,this.events=new wa.EventEmitter,this.name=Rje,this.version=Mje,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=lf,this.subscribeTimeout=it.toMiliseconds(it.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=OT(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new it.Watch;a.start(i);const c=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(c),a.stop(i),s(!0)),a.elapsed(i)>=Oje&&(clearInterval(c),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=uo(r,this.name),this.clientId=""}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=OT(n);await this.rpcUnsubscribe(e,r,i);const s=sn("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===gn.relay&&await this.restartToComplete();const s={method:zb(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Yf(e+this.clientId);if((n==null?void 0:n.transportType)===gn.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},it.toMiliseconds(it.ONE_SECOND)),a;const c=await Eg(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!c&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return c?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(to.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:zb(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Eg(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(to.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:zb(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Eg(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(to.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:zb(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,u7(wb({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,wb({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,wb({},r)),this.topicMap.set(r.topic,e),this.events.emit(El.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(El.deleted,u7(wb({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(El.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);cf(r)&&this.onBatchSubscribe(r.map((n,i)=>u7(wb({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(Am.pulse,async()=>{await this.checkPending()}),this.events.on(El.created,async e=>{const r=El.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(El.deleted,async e=>{const r=El.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var R$e=Object.defineProperty,tV=Object.getOwnPropertySymbols,M$e=Object.prototype.hasOwnProperty,O$e=Object.prototype.propertyIsEnumerable,rV=(t,e,r)=>e in t?R$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nV=(t,e)=>{for(var r in e||(e={}))M$e.call(e,r)&&rV(t,r,e[r]);if(tV)for(var r of tV(e))O$e.call(e,r)&&rV(t,r,e[r]);return t};class D$e extends LFe{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new wa.EventEmitter,this.name=_je,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=it.toMiliseconds(it.THIRTY_SECONDS+it.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||i1().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(c,l)=>{const f=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Ba.disconnect,f);const u=await o;this.provider.off(Ba.disconnect,f),c(u)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(i8())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(to.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(to.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Ba.payload,this.onPayloadHandler),this.provider.on(Ba.connect,this.onConnectHandler),this.provider.on(Ba.disconnect,this.onDisconnectHandler),this.provider.on(Ba.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?uo(e.logger,this.name):Ix(_C({level:e.logger||Sje})),this.messages=new E$e(this.logger,e.core),this.subscriber=new k$e(this,this.logger),this.publisher=new C$e(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||tie,this.projectId=e.projectId,this.bundleId=VNe(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return Uo(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:gn.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",c;const l=f=>{f.topic===e&&(this.subscriber.off(El.created,l),c())};return await Promise.all([new Promise(f=>{c=f,this.subscriber.on(El.created,l)}),new Promise(async(f,u)=>{a=await this.subscriber.subscribe(e,nV({internal:{throwOnFailedPublish:o}},r)).catch(h=>{o&&u(h)})||a,f()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Eg(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Ba.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Ba.disconnect,i),await Eg(this.provider.connect(),it.toMiliseconds(it.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Tq())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=mi(it.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(to.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(i8())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new hc(new dje(WNe({sdkVersion:BT,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),MO(e)){if(!e.method.endsWith(Ije))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:gn.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(nV({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else PC(e)&&this.events.emit(to.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(to.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=IC(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Ba.payload,this.onPayloadHandler),this.provider.off(Ba.connect,this.onConnectHandler),this.provider.off(Ba.disconnect,this.onDisconnectHandler),this.provider.off(Ba.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Tq();ALe(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(to.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},it.toMiliseconds(Tje))))}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var N$e=Object.defineProperty,iV=Object.getOwnPropertySymbols,B$e=Object.prototype.hasOwnProperty,L$e=Object.prototype.propertyIsEnumerable,sV=(t,e,r)=>e in t?N$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oV=(t,e)=>{for(var r in e||(e={}))B$e.call(e,r)&&sV(t,r,e[r]);if(iV)for(var r of iV(e))L$e.call(e,r)&&sV(t,r,e[r]);return t};class Ip extends FFe{constructor(e,r,n,i=lf,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=Pje,this.cached=[],this.initialized=!1,this.storagePrefix=lf,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Ro(o)?this.map.set(this.getKey(o),o):tLe(o)?this.map.set(o.id,o):rLe(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>pje(a[c],o[c]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=oV(oV({},this.getData(o)),a);this.map.set(o,c),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=uo(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=et("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}class F$e{constructor(e,r){this.core=e,this.logger=r,this.name=Dje,this.version=Nje,this.events=new iO,this.initialized=!1,this.storagePrefix=lf,this.ignoredPayloadTypes=[Cu],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=MT(),s=await this.core.crypto.setSymKey(i),o=mi(it.FIVE_MINUTES),a={protocol:eie},c={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=Eq({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(V0.create,c),this.core.expirer.set(s,o),await this.pairings.set(s,c),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[bl.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:c,methods:l}=xq(n.uri);i.props.properties.topic=s,i.addTrace(bl.pairing_uri_validation_success),i.addTrace(bl.pairing_uri_not_expired);let f;if(this.pairings.keys.includes(s)){if(f=this.pairings.get(s),i.addTrace(bl.existing_pairing),f.active)throw i.setError($f.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(bl.pairing_not_expired)}const u=c||mi(it.FIVE_MINUTES),h={topic:s,relay:a,expiry:u,active:!1,methods:l};this.core.expirer.set(s,u),await this.pairings.set(s,h),i.addTrace(bl.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(V0.create,h),i.addTrace(bl.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(bl.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError($f.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(g){throw i.setError($f.subscribe_pairing_topic_failure),g}return i.addTrace(bl.subscribe_pairing_topic_success),h},this.activate=async({topic:n})=>{this.isInitialized();const i=mi(it.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=j0();this.events.once(Sr("pairing_ping",s),({error:l})=>{l?c(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",sn("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,c=this.core.crypto.keychain.get(i);return Eq({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:c,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=rh(i,s),a=await this.core.crypto.encode(n,o),c=mb[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,c),o.id},this.sendResult=async(n,i,s)=>{const o=IC(n,s),a=await this.core.crypto.encode(i,o),c=await this.core.history.get(i,n),l=mb[c.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=TC(n,s),a=await this.core.crypto.encode(i,o),c=await this.core.history.get(i,n),l=mb[c.request.method]?mb[c.request.method].res:mb.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,sn("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>Id(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(V0.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{xl(i)?this.events.emit(Sr("pairing_ping",s),{}):Ka(i)&&this.events.emit(Sr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(V0.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=sn("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(sn("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!Ao(n)){const{message:a}=et("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError($f.malformed_pairing_uri),new Error(a)}if(!eLe(n.uri)){const{message:a}=et("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError($f.malformed_pairing_uri),new Error(a)}const o=xq(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=et("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError($f.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=et("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError($f.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&it.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!Ao(n)){const{message:s}=et("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!Ao(n)){const{message:s}=et("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ti(n,!1)){const{message:i}=et("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=et("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(Id(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=et("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=uo(r,this.name),this.pairings=new Ip(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Uo(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(to.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===gn.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{MO(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):PC(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Ua.expired,async e=>{const{topic:r}=Pne(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(V0.expire,{topic:r}))})}}class j$e extends DFe{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new wa.EventEmitter,this.name=Bje,this.version=Lje,this.cached=[],this.initialized=!1,this.storagePrefix=lf,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:mi(it.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Ac.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Ka(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(Ac.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Ac.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=uo(r,this.name)}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:rh(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Ac.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Ac.created,e=>{const r=Ac.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Ac.updated,e=>{const r=Ac.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Ac.deleted,e=>{const r=Ac.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(Am.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{it.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Ac.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}class U$e extends UFe{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new wa.EventEmitter,this.name=Fje,this.version=jje,this.cached=[],this.initialized=!1,this.storagePrefix=lf,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Ua.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Ua.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=uo(r,this.name)}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return KNe(e);if(typeof e=="number")return YNe(e);const{message:r}=et("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ua.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;it.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Ua.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Am.pulse,()=>this.checkExpirations()),this.events.on(Ua.created,e=>{const r=Ua.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Ua.expired,e=>{const r=Ua.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Ua.deleted,e=>{const r=Ua.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}class $$e extends $Fe{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=Uje,this.verifyUrlV3=qje,this.storagePrefix=lf,this.version=Xne,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&it.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!Ex()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=vx(),f=this.startAbortTimer(it.ONE_SECOND*5),u=await new Promise((h,g)=>{const y=()=>{window.removeEventListener("message",S),l.body.removeChild(m),g("attestation aborted")};this.abortController.signal.addEventListener("abort",y);const m=l.createElement("iframe");m.src=c,m.style.display="none",m.addEventListener("error",y,{signal:this.abortController.signal});const S=E=>{if(E.data&&typeof E.data=="string")try{const A=JSON.parse(E.data);if(A.type==="verify_attestation"){if(kT(A.attestation).payload.id!==o)return;clearInterval(f),l.body.removeChild(m),this.abortController.signal.removeEventListener("abort",y),window.removeEventListener("message",S),h(A.attestation===null?"":A.attestation)}}catch(A){this.logger.warn(A)}};l.body.appendChild(m),window.addEventListener("message",S,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",u),u}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(kT(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const c=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,c)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(it.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||w2;return Vje.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${w2}`),s=w2),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(it.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=NBe(i,s.publicKey),a={hasExpired:it.toMiliseconds(o.exp)this.abortController.abort(),it.toMiliseconds(e))}}class q$e extends qFe{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=zje,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,c=`${Hje}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=uo(r,this.context)}}var V$e=Object.defineProperty,aV=Object.getOwnPropertySymbols,z$e=Object.prototype.hasOwnProperty,H$e=Object.prototype.propertyIsEnumerable,cV=(t,e,r)=>e in t?V$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xb=(t,e)=>{for(var r in e||(e={}))z$e.call(e,r)&&cV(t,r,e[r]);if(aV)for(var r of aV(e))H$e.call(e,r)&&cV(t,r,e[r]);return t};class G$e extends VFe{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=Wje,this.storagePrefix=lf,this.storageVersion=Gje,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!SO())try{const i={eventId:lq(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Sne(this.core.relayer.protocol,this.core.relayer.version,BT)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:c}}=i,l=lq(),f=this.core.projectId||"",u=Date.now(),h=xb({eventId:l,timestamp:u,props:{event:s,type:o,properties:{topic:a,trace:c}},bundleId:f,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,h),this.shouldPersist=!0),h},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return xb(xb({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Am.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{it.fromMiliseconds(Date.now())-it.fromMiliseconds(i.timestamp)>Kje&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,xb(xb({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Yje}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${BT}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>Ane().url,this.logger=uo(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var W$e=Object.defineProperty,lV=Object.getOwnPropertySymbols,K$e=Object.prototype.hasOwnProperty,Y$e=Object.prototype.propertyIsEnumerable,fV=(t,e,r)=>e in t?W$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uV=(t,e)=>{for(var r in e||(e={}))K$e.call(e,r)&&fV(t,r,e[r]);if(lV)for(var r of lV(e))Y$e.call(e,r)&&fV(t,r,e[r]);return t};let Q$e=class hie extends OFe{constructor(e){var r;super(e),this.protocol=Zne,this.version=Xne,this.name=OO,this.events=new wa.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:c})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:gn.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:c})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||tie,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=_C({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:vje.logger}),{logger:i,chunkLoggerController:s}=MFe({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=uo(i,this.name),this.heartbeat=new TLe,this.crypto=new x$e(this,this.logger,e==null?void 0:e.keychain),this.history=new j$e(this,this.logger),this.expirer=new U$e(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new iFe(uV(uV({},gje),e==null?void 0:e.storageOptions)),this.relayer=new D$e({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new F$e(this,this.logger),this.verify=new $$e(this,this.logger,this.storage),this.echoClient=new q$e(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new G$e(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new hie(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(kje,n),r}get context(){return Uo(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Gq,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(Gq)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}};const J$e=Q$e,pie="wc",vie=2,gie="client",DO=`${pie}@${vie}:${gie}:`,d7={name:gie,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},dV="WALLETCONNECT_DEEPLINK_CHOICE",Z$e="proposal",yie="Proposal expired",X$e="session",mv=it.SEVEN_DAYS,eqe="engine",Ti={wc_sessionPropose:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1104},res:{ttl:it.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1106},res:{ttl:it.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1112},res:{ttl:it.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1114},res:{ttl:it.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:it.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:it.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1119}}},h7={min:it.FIVE_MINUTES,max:it.SEVEN_DAYS},vl={idle:"IDLE",active:"ACTIVE"},tqe="request",rqe=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],nqe="wc",iqe="auth",sqe="authKeys",oqe="pairingTopics",aqe="requests",RC=`${nqe}@${1.5}:${iqe}:`,P5=`${RC}:PUB_KEY`;var cqe=Object.defineProperty,lqe=Object.defineProperties,fqe=Object.getOwnPropertyDescriptors,hV=Object.getOwnPropertySymbols,uqe=Object.prototype.hasOwnProperty,dqe=Object.prototype.propertyIsEnumerable,pV=(t,e,r)=>e in t?cqe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vn=(t,e)=>{for(var r in e||(e={}))uqe.call(e,r)&&pV(t,r,e[r]);if(hV)for(var r of hV(e))dqe.call(e,r)&&pV(t,r,e[r]);return t},_c=(t,e)=>lqe(t,fqe(e));class hqe extends HFe{constructor(e){super(e),this.name=eqe,this.events=new iO,this.initialized=!1,this.requestQueue={state:vl.idle,queue:[]},this.sessionRequestQueue={state:vl.idle,queue:[]},this.requestQueueDelay=it.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Ti)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},it.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=_c(Vn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:c}=n;let l=i,f,u=!1;try{l&&(u=this.client.core.pairing.pairings.get(l).active)}catch(N){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),N}if(!l||!u){const{topic:N,uri:L}=await this.client.core.pairing.create();l=N,f=L}if(!l){const{message:N}=et("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(N)}const h=await this.client.core.crypto.generateKeyPair(),g=Ti.wc_sessionPropose.req.ttl||it.FIVE_MINUTES,y=mi(g),m=Vn({requiredNamespaces:s,optionalNamespaces:o,relays:c??[{protocol:eie}],proposer:{publicKey:h,metadata:this.client.metadata},expiryTimestamp:y,pairingTopic:l},a&&{sessionProperties:a}),{reject:S,resolve:E,done:A}=j0(g,yie);this.events.once(Sr("session_connect"),async({error:N,session:L})=>{if(N)S(N);else if(L){L.self.publicKey=h;const V=_c(Vn({},L),{pairingTopic:m.pairingTopic,requiredNamespaces:m.requiredNamespaces,optionalNamespaces:m.optionalNamespaces,transportType:gn.relay});await this.client.session.set(L.topic,V),await this.setExpiry(L.topic,L.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:L.peer.metadata}),this.cleanupDuplicatePairings(V),E(V)}});const P=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:m,throwOnFailedPublish:!0});return await this.setProposal(P,Vn({id:P},m)),{uri:f,approval:A}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[Sc.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(U){throw o.setError(P0.no_internet_connection),U}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(U){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(P0.proposal_not_found),U}try{await this.isValidApprove(r)}catch(U){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(P0.session_approve_namespace_validation_failure),U}const{id:a,relayProtocol:c,namespaces:l,sessionProperties:f,sessionConfig:u}=r,h=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:g,proposer:y,requiredNamespaces:m,optionalNamespaces:S}=h;let E=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:g});E||(E=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Sc.session_approve_started,properties:{topic:g,trace:[Sc.session_approve_started,Sc.session_namespaces_validation_success]}}));const A=await this.client.core.crypto.generateKeyPair(),P=y.publicKey,N=await this.client.core.crypto.generateSharedKey(A,P),L=Vn(Vn({relay:{protocol:c??"irn"},namespaces:l,controller:{publicKey:A,metadata:this.client.metadata},expiry:mi(mv)},f&&{sessionProperties:f}),u&&{sessionConfig:u}),V=gn.relay;E.addTrace(Sc.subscribing_session_topic);try{await this.client.core.relayer.subscribe(N,{transportType:V})}catch(U){throw E.setError(P0.subscribe_session_topic_failure),U}E.addTrace(Sc.subscribe_session_topic_success);const I=_c(Vn({},L),{topic:N,requiredNamespaces:m,optionalNamespaces:S,pairingTopic:g,acknowledged:!1,self:L.controller,peer:{publicKey:y.publicKey,metadata:y.metadata},controller:A,transportType:gn.relay});await this.client.session.set(N,I),E.addTrace(Sc.store_session);try{E.addTrace(Sc.publishing_session_settle),await this.sendRequest({topic:N,method:"wc_sessionSettle",params:L,throwOnFailedPublish:!0}).catch(U=>{throw E==null||E.setError(P0.session_settle_publish_failure),U}),E.addTrace(Sc.session_settle_publish_success),E.addTrace(Sc.publishing_session_approve),await this.sendResult({id:a,topic:g,result:{relay:{protocol:c??"irn"},responderPublicKey:A},throwOnFailedPublish:!0}).catch(U=>{throw E==null||E.setError(P0.session_approve_publish_failure),U}),E.addTrace(Sc.session_approve_publish_success)}catch(U){throw this.client.logger.error(U),this.client.session.delete(N,sn("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(N),U}return this.client.core.eventClient.deleteEvent({eventId:E.eventId}),await this.client.core.pairing.updateMetadata({topic:g,metadata:y.metadata}),await this.client.proposal.delete(a,sn("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:g}),await this.setExpiry(N,mi(mv)),{topic:N,acknowledged:()=>Promise.resolve(this.client.session.get(N))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Ti.wc_sessionPropose.reject}),await this.client.proposal.delete(n,sn("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(u){throw this.client.logger.error("update() -> isValidUpdate() failed"),u}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=j0(),c=Td(),l=i1().toString(),f=this.client.session.get(n).namespaces;return this.events.once(Sr("session_update",c),({error:u})=>{u?a(u):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:l}).catch(u=>{this.client.logger.error(u),this.client.session.update(n,{namespaces:f}),a(u)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:n}=r,i=Td(),{done:s,resolve:o,reject:a}=j0();return this.events.once(Sr("session_extend",i),({error:c})=>{c?a(c):o()}),await this.setExpiry(n,mi(mv)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:i,topic:s,expiry:o=Ti.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===gn.relay&&await this.confirmOnlineStateOrThrow();const c=Td(),l=i1().toString(),{done:f,resolve:u,reject:h}=j0(o,"Request expired. Please try again.");this.events.once(Sr("session_request",c),({error:y,result:m})=>{y?h(y):u(m)});const g=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return g?(await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:_c(Vn({},i),{expiryTimestamp:mi(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:g}).catch(y=>h(y)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),await f()):await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:_c(Vn({},i),{expiryTimestamp:mi(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(m=>h(m)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),y()}),new Promise(async y=>{var m;if(!((m=a.sessionConfig)!=null&&m.disableDeepLink)){const S=await ZNe(this.client.core.storage,dV);await QNe({id:c,topic:s,wcDeepLink:S})}y()}),f()]).then(y=>y[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===gn.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);xl(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Ka(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=Td(),s=i1().toString(),{done:o,resolve:a,reject:c}=j0();this.events.once(Sr("session_ping",i),({error:l})=>{l?c(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=i1().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:sn("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=et("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>ZBe(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?gn.link_mode:gn.relay;o===gn.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:l,domain:f,nonce:u,type:h,exp:g,nbf:y,methods:m=[],expiry:S}=r,E=[...r.resources||[]],{topic:A,uri:P}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:A,uri:P}});const N=await this.client.core.crypto.generateKeyPair(),L=_5(N);if(await Promise.all([this.client.auth.authKeys.set(P5,{responseTopic:L,publicKey:N}),this.client.auth.pairingTopics.set(L,{topic:L,pairingTopic:A})]),await this.client.core.relayer.subscribe(L,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${A}`),m.length>0){const{namespace:x}=xg(a[0]);let C=bBe(x,"request",m);S5(E)&&(C=xBe(C,E.pop())),E.push(C)}const V=S&&S>Ti.wc_sessionAuthenticate.req.ttl?S:Ti.wc_sessionAuthenticate.req.ttl,I={authPayload:{type:h??"caip122",chains:a,statement:c,aud:l,domain:f,version:"1",nonce:u,iat:new Date().toISOString(),exp:g,nbf:y,resources:E},requester:{publicKey:N,metadata:this.client.metadata},expiryTimestamp:mi(V)},U={eip155:{chains:a,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},ie={requiredNamespaces:{},optionalNamespaces:U,relays:[{protocol:"irn"}],pairingTopic:A,proposer:{publicKey:N,metadata:this.client.metadata},expiryTimestamp:mi(Ti.wc_sessionPropose.req.ttl)},{done:ae,resolve:K,reject:R}=j0(V,"Request expired"),D=async({error:x,session:C})=>{if(this.events.off(Sr("session_request",b),v),x)R(x);else if(C){C.self.publicKey=N,await this.client.session.set(C.topic,C),await this.setExpiry(C.topic,C.expiry),A&&await this.client.core.pairing.updateMetadata({topic:A,metadata:C.peer.metadata});const w=this.client.session.get(C.topic);await this.deleteProposal(M),K({session:w})}},v=async x=>{var C,w,k;if(await this.deletePendingAuthRequest(b,{message:"fulfilled",code:0}),x.error){const Z=sn("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return x.error.code===Z.code?void 0:(this.events.off(Sr("session_connect"),D),R(x.error.message))}await this.deleteProposal(M),this.events.off(Sr("session_connect"),D);const{cacaos:O,responder:G}=x.result,oe=[],$=[];for(const Z of O){await dq({cacao:Z,projectId:this.client.core.projectId})||(this.client.logger.error(Z,"Signature verification failed"),R(sn("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:te}=Z,F=S5(te.resources),ee=[RT(te.iss)],fe=s8(te.iss);if(F){const xe=hq(F),_e=pq(F);oe.push(...xe),ee.push(..._e)}for(const xe of ee)$.push(`${xe}:${fe}`)}const X=await this.client.core.crypto.generateSharedKey(N,G.publicKey);let W;oe.length>0&&(W={topic:X,acknowledged:!0,self:{publicKey:N,metadata:this.client.metadata},peer:G,controller:G.publicKey,expiry:mi(mv),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:A,namespaces:Cq([...new Set(oe)],[...new Set($)]),transportType:o},await this.client.core.relayer.subscribe(X,{transportType:o}),await this.client.session.set(X,W),A&&await this.client.core.pairing.updateMetadata({topic:A,metadata:G.metadata}),W=this.client.session.get(X)),(C=this.client.metadata.redirect)!=null&&C.linkMode&&(w=G.metadata.redirect)!=null&&w.linkMode&&(k=G.metadata.redirect)!=null&&k.universal&&n&&(this.client.core.addLinkModeSupportedApp(G.metadata.redirect.universal),this.client.session.update(X,{transportType:gn.link_mode})),K({auths:O,session:W})},b=Td(),M=Td();this.events.once(Sr("session_connect"),D),this.events.once(Sr("session_request",b),v);let B;try{if(s){const x=rh("wc_sessionAuthenticate",I,b);this.client.core.history.set(A,x);const C=await this.client.core.crypto.encode("",x,{type:Sx,encoding:gb});B=m6(n,A,C)}else await Promise.all([this.sendRequest({topic:A,method:"wc_sessionAuthenticate",params:I,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:b}),this.sendRequest({topic:A,method:"wc_sessionPropose",params:ie,expiry:Ti.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:M})])}catch(x){throw this.events.off(Sr("session_connect"),D),this.events.off(Sr("session_request",b),v),x}return await this.setProposal(M,Vn({id:M},ie)),await this.setAuthRequest(b,{request:_c(Vn({},I),{verifyContext:{}}),pairingTopic:A,transportType:o}),{uri:B??P,response:ae}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[k0.authenticated_session_approve_started]}});try{this.isInitialized()}catch(S){throw s.setError(bb.no_internet_connection),S}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(bb.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||gn.relay;a===gn.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),f=_5(c),u={type:Cu,receiverPublicKey:c,senderPublicKey:l},h=[],g=[];for(const S of i){if(!await dq({cacao:S,projectId:this.client.core.projectId})){s.setError(bb.invalid_cacao);const L=sn("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:f,error:L,encodeOpts:u}),new Error(L.message)}s.addTrace(k0.cacaos_verified);const{p:E}=S,A=S5(E.resources),P=[RT(E.iss)],N=s8(E.iss);if(A){const L=hq(A),V=pq(A);h.push(...L),P.push(...V)}for(const L of P)g.push(`${L}:${N}`)}const y=await this.client.core.crypto.generateSharedKey(l,c);s.addTrace(k0.create_authenticated_session_topic);let m;if((h==null?void 0:h.length)>0){m={topic:y,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:mi(mv),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Cq([...new Set(h)],[...new Set(g)]),transportType:a},s.addTrace(k0.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(y,{transportType:a})}catch(S){throw s.setError(bb.subscribe_authenticated_session_topic_failure),S}s.addTrace(k0.subscribe_authenticated_session_topic_success),await this.client.session.set(y,m),s.addTrace(k0.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(k0.publishing_authenticated_session_approve);try{await this.sendResult({topic:f,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(S){throw s.setError(bb.authenticated_session_approve_publish_failure),S}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:m}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===gn.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=_5(o),l={type:Cu,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:c,error:i,encodeOpts:l,rpcOpts:Ti.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,sn("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return Rne(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:c}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,sn("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(dV).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,sn("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=vl.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(P0.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,sn("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=vl.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,mi(Ti.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=gn.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||mi(Ti.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:l,appLink:f}=r,u=rh(i,s,c);let h;const g=!!f;try{const S=g?gb:th;h=await this.client.core.crypto.encode(n,u,{encoding:S})}catch(S){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),S}let y;if(rqe.includes(i)){const S=Yf(JSON.stringify(u)),E=Yf(h);y=await this.client.core.verify.register({id:E,decryptedId:S})}const m=Ti[i].req;if(m.attestation=y,o&&(m.ttl=o),a&&(m.id=a),this.client.core.history.set(n,u),g){const S=m6(f,n,h);await global.Linking.openURL(S,this.client.name)}else{const S=Ti[i].req;o&&(S.ttl=o),a&&(S.id=a),l?(S.internal=_c(Vn({},S.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,h,S)):this.client.core.relayer.publish(n,h,S).catch(E=>this.client.logger.error(E))}return u.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=r,l=IC(n,s);let f;const u=c&&typeof(global==null?void 0:global.Linking)<"u";try{const g=u?gb:th;f=await this.client.core.crypto.encode(i,l,_c(Vn({},a||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),g}let h;try{h=await this.client.core.history.get(i,n)}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),g}if(u){const g=m6(c,i,f);await global.Linking.openURL(g,this.client.name)}else{const g=Ti[h.request.method].res;o?(g.internal=_c(Vn({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,f,g)):this.client.core.relayer.publish(i,f,g).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:c}=r,l=TC(n,s);let f;const u=c&&typeof(global==null?void 0:global.Linking)<"u";try{const g=u?gb:th;f=await this.client.core.crypto.encode(i,l,_c(Vn({},o||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),g}let h;try{h=await this.client.core.history.get(i,n)}catch(g){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),g}if(u){const g=m6(c,i,f);await global.Linking.openURL(g,this.client.name)}else{const g=a||Ti[h.request.method].res;this.client.core.relayer.publish(i,f,g)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;Id(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Id(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===vl.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=vl.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=vl.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,c=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=et("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:c}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(Vn({},i.params));const f=a.expiryTimestamp||mi(Ti.wc_sessionPropose.req.ttl),u=Vn({id:c,pairingTopic:n,expiryTimestamp:f},a);await this.setProposal(c,u);const h=await this.getVerifyContext({attestationId:s,hash:Yf(JSON.stringify(i)),encryptedId:o,metadata:u.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError($f.proposal_listener_not_found)),l==null||l.addTrace(bl.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:u,verifyContext:h})}catch(l){await this.sendError({id:c,topic:n,error:l,rpcOpts:Ti.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(xl(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const f=await this.client.core.crypto.generateSharedKey(c,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:f});const u=await this.client.core.relayer.subscribe(f,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:r})}else if(Ka(n)){await this.client.proposal.delete(s,sn("USER_DISCONNECTED"));const o=Sr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(Sr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:c,namespaces:l,sessionProperties:f,sessionConfig:u}=n.params,h=_c(Vn(Vn({topic:r,relay:o,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},f&&{sessionProperties:f}),u&&{sessionConfig:u}),{transportType:gn.relay}),g=Sr("session_connect");if(this.events.listenerCount(g)===0)throw new Error(`emitting ${g} without any listeners 997`);this.events.emit(Sr("session_connect"),{session:h}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;xl(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Sr("session_approve",i),{})):Ka(n)&&(await this.client.session.delete(r,sn("USER_DISCONNECTED")),this.events.emit(Sr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=yb.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:sn("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Vn({topic:r},i));try{yb.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(c){throw yb.delete(o),c}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=Sr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Sr("session_update",i),{}):Ka(n)&&this.events.emit(Sr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,mi(mv)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=Sr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Sr("session_extend",i),{}):Ka(n)&&this.events.emit(Sr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=Sr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{xl(n)?this.events.emit(Sr("session_ping",i),{}):Ka(n)&&this.events.emit(Sr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(to.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:sn("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:c,encryptedId:l,transportType:f}=r,{id:u,params:h}=a;try{await this.isValidRequest(Vn({topic:o},h));const g=this.client.session.get(o),y=await this.getVerifyContext({attestationId:c,hash:Yf(JSON.stringify(rh("wc_sessionRequest",h,u))),encryptedId:l,metadata:g.peer.metadata,transportType:f}),m={id:u,topic:o,params:h,verifyContext:y};await this.setPendingSessionRequest(m),f===gn.link_mode&&(n=g.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=g.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(g){await this.sendError({id:u,topic:o,error:g}),this.client.logger.error(g)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=Sr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Sr("session_request",i),{result:n.result}):Ka(n)&&this.events.emit(Sr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=yb.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Vn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),yb.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),xl(n)?this.events.emit(Sr("session_request",i),{result:n.result}):Ka(n)&&this.events.emit(Sr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:c}=r;try{const{requester:l,authPayload:f,expiryTimestamp:u}=s.params,h=await this.getVerifyContext({attestationId:o,hash:Yf(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:c}),g={requester:l,pairingTopic:i,id:s.id,authPayload:f,verifyContext:h,expiryTimestamp:u};await this.setAuthRequest(s.id,{request:g,pairingTopic:i,transportType:c}),c===gn.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:h})}catch(l){this.client.logger.error(l);const f=s.params.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=this.getAppLinkIfEnabled(s.params.requester.metadata,c),g={type:Cu,receiverPublicKey:f,senderPublicKey:u};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:g,rpcOpts:Ti.wc_sessionAuthenticate.autoReject,appLink:h})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=vl.idle,this.processSessionRequestQueue()},it.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=Sr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(Sr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===vl.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=vl.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:rh("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!Ao(r)){const{message:c}=et("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(c)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(Ro(n)||await this.isValidPairingTopic(n),!fLe(a)){const{message:c}=et("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(c)}!Ro(i)&&pw(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!Ro(s)&&pw(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),Ro(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=lLe(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!Ao(r))throw new Error(et("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),c=s7(i,"approve()");if(c)throw new Error(c.message);const l=_q(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!ti(s,!0)){const{message:f}=et("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}Ro(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!Ao(r)){const{message:s}=et("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!dLe(i)){const{message:s}=et("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!Ao(r)){const{message:l}=et("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!jne(n)){const{message:l}=et("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=nLe(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=s7(s,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(Id(o)){const{message:l}=et("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!Ao(r)){const{message:c}=et("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(c)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=s7(i,"update()");if(o)throw new Error(o.message);const a=_q(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!Ao(r)){const{message:i}=et("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!Ao(r)){const{message:c}=et("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(c)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!Sq(a,s)){const{message:c}=et("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(c)}if(!hLe(i)){const{message:c}=et("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(c)}if(!gLe(a,s,i.method)){const{message:c}=et("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(c)}if(o&&!wLe(o,h7)){const{message:c}=et("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${h7.min} and ${h7.max}`);throw new Error(c)}},this.isValidRespond=async r=>{var n;if(!Ao(r)){const{message:o}=et("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!pLe(s)){const{message:o}=et("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!Ao(r)){const{message:i}=et("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!Ao(r)){const{message:a}=et("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!Sq(o,s)){const{message:a}=et("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!vLe(i)){const{message:a}=et("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!yLe(o,s,i.name)){const{message:a}=et("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!Ao(r)){const{message:i}=et("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!ti(i,!1))throw new Error("uri is required parameter");if(!ti(s,!1))throw new Error("domain is required parameter");if(!ti(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(c=>xg(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=xg(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,c={verified:{verifyUrl:o.verifyUrl||w2,validation:"UNKNOWN",origin:o.url||""}};try{if(a===gn.link_mode){const f=this.getAppLinkIfEnabled(o,a);return c.verified.validation=f&&new URL(f).origin===new URL(o.url).origin?"VALID":"INVALID",c}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(c.verified.origin=l.origin,c.verified.isScam=l.isScam,c.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!ti(i,!1)){const{message:s}=et("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=et("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,c,l,f,u,h;return!r||n!==gn.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:l.universal)!==""&&((f=r==null?void 0:r.redirect)==null?void 0:f.universal)!==void 0&&((u=r==null?void 0:r.redirect)==null?void 0:u.universal)!==""&&((h=r==null?void 0:r.redirect)==null?void 0:h.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=cq(r,"topic")||"",i=decodeURIComponent(cq(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:gn.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(SO()||Em()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(to.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(P5)?this.client.auth.authKeys.get(P5):{responseTopic:void 0,publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===gn.link_mode?gb:th});try{MO(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Yf(n)})):PC(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Ua.expired,async e=>{const{topic:r,id:n}=Pne(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,et("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,et("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(V0.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(V0.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!ti(e,!1)){const{message:r}=et("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=et("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Id(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=et("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!ti(e,!1)){const{message:r}=et("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=et("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Id(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=et("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=et("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(ti(e,!1)){const{message:r}=et("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=et("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!uLe(e)){const{message:r}=et("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=et("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Id(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=et("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class pqe extends Ip{constructor(e,r){super(e,r,Z$e,DO),this.core=e,this.logger=r}}let vqe=class extends Ip{constructor(e,r){super(e,r,X$e,DO),this.core=e,this.logger=r}};class gqe extends Ip{constructor(e,r){super(e,r,tqe,DO,n=>n.id),this.core=e,this.logger=r}}class yqe extends Ip{constructor(e,r){super(e,r,sqe,RC,()=>P5),this.core=e,this.logger=r}}class mqe extends Ip{constructor(e,r){super(e,r,oqe,RC),this.core=e,this.logger=r}}class bqe extends Ip{constructor(e,r){super(e,r,aqe,RC,n=>n.id),this.core=e,this.logger=r}}class wqe{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new yqe(this.core,this.logger),this.pairingTopics=new mqe(this.core,this.logger),this.requests=new bqe(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class MC extends zFe{constructor(e){super(e),this.protocol=pie,this.version=vie,this.name=d7.name,this.events=new wa.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||d7.name,this.metadata=(e==null?void 0:e.metadata)||Ane(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Ix(_C({level:(e==null?void 0:e.logger)||d7.logger}));this.core=(e==null?void 0:e.core)||new J$e(e),this.logger=uo(r,this.name),this.session=new vqe(this.core,this.logger),this.proposal=new pqe(this.core,this.logger),this.pendingRequest=new gqe(this.core,this.logger),this.engine=new hqe(this),this.auth=new wqe(this.core,this.logger)}static async init(e){const r=new MC(e);return await r.initialize(),r}get context(){return Uo(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var f8={exports:{}};/** + Approved: ${h.toString()}`))}),o.forEach(u=>{n||(n1(i[u].methods,s[u].methods)?n1(i[u].events,s[u].events)||(n=et("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${u}`)):n=et("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${u}`))}),n}function mLe(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function Iq(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function bLe(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Cm(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function wLe(t,e){return PO(t)&&t<=e.max&&t>=e.min}function Tq(){const t=Cx();return new Promise(e=>{switch(t){case la.browser:e(xLe());break;case la.reactNative:e(ELe());break;case la.node:e(CLe());break;default:e(!0)}})}function xLe(){return Ex()&&(navigator==null?void 0:navigator.onLine)}async function ELe(){if(Em()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function CLe(){return!0}function ALe(t){switch(Cx()){case la.browser:SLe(t);break;case la.reactNative:_Le(t);break}}function SLe(t){!Em()&&Ex()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function _Le(t){Em()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const o7={};let yb=class{static get(e){return o7[e]}static set(e,r){o7[e]=r}static delete(e){delete o7[e]}};class Sp{}let ILe=class extends Sp{constructor(e){super()}};const Pq=it.FIVE_SECONDS,Am={pulse:"heartbeat_pulse"};let TLe=class Une extends ILe{constructor(e){super(e),this.events=new wa.EventEmitter,this.interval=Pq,this.interval=(e==null?void 0:e.interval)||Pq}static async init(e){const r=new Une(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),it.toMiliseconds(this.interval))}pulse(){this.events.emit(Am.pulse)}};const PLe=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,kLe=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,RLe=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function MLe(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){OLe(t);return}return e}function OLe(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function b6(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!RLe.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(PLe.test(t)||kLe.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,MLe)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function DLe(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Pi(t,...e){try{return DLe(t(...e))}catch(r){return Promise.reject(r)}}function NLe(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function BLe(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function I5(t){if(NLe(t))return String(t);if(BLe(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return I5(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function $ne(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const DT="base64:";function LLe(t){if(typeof t=="string")return t;$ne();const e=Buffer.from(t).toString("base64");return DT+e}function FLe(t){return typeof t!="string"||!t.startsWith(DT)?t:($ne(),Buffer.from(t.slice(DT.length),"base64"))}function Co(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function jLe(...t){return Co(t.join(":"))}function w6(t){return t=Co(t),t?t+":":""}const ULe="memory",$Le=()=>{const t=new Map;return{name:ULe,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function qLe(t={}){const e={mounts:{"":t.driver||$Le()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const f of e.mountpoints)if(l.startsWith(f))return{base:f,relativeKey:l.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,f)=>e.mountpoints.filter(u=>u.startsWith(l)||f&&l.startsWith(u)).map(u=>({relativeBase:l.length>u.length?l.slice(u.length):void 0,mountpoint:u,driver:e.mounts[u]})),i=(l,f)=>{if(e.watching){f=Co(f);for(const u of e.watchListeners)u(l,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await kq(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,f,u)=>{const h=new Map,g=y=>{let m=h.get(y.base);return m||(m={driver:y.driver,base:y.base,items:[]},h.set(y.base,m)),m};for(const y of l){const m=typeof y=="string",S=Co(m?y:y.key),E=m?void 0:y.value,A=m||!y.options?f:{...f,...y.options},P=r(S);g(P).items.push({key:S,value:E,relativeKey:P.relativeKey,options:A})}return Promise.all([...h.values()].map(y=>u(y))).then(y=>y.flat())},c={hasItem(l,f={}){l=Co(l);const{relativeKey:u,driver:h}=r(l);return Pi(h.hasItem,u,f)},getItem(l,f={}){l=Co(l);const{relativeKey:u,driver:h}=r(l);return Pi(h.getItem,u,f).then(g=>b6(g))},getItems(l,f){return a(l,f,u=>u.driver.getItems?Pi(u.driver.getItems,u.items.map(h=>({key:h.relativeKey,options:h.options})),f).then(h=>h.map(g=>({key:jLe(u.base,g.key),value:b6(g.value)}))):Promise.all(u.items.map(h=>Pi(u.driver.getItem,h.relativeKey,h.options).then(g=>({key:h.key,value:b6(g)})))))},getItemRaw(l,f={}){l=Co(l);const{relativeKey:u,driver:h}=r(l);return h.getItemRaw?Pi(h.getItemRaw,u,f):Pi(h.getItem,u,f).then(g=>FLe(g))},async setItem(l,f,u={}){if(f===void 0)return c.removeItem(l);l=Co(l);const{relativeKey:h,driver:g}=r(l);g.setItem&&(await Pi(g.setItem,h,I5(f),u),g.watch||i("update",l))},async setItems(l,f){await a(l,f,async u=>{if(u.driver.setItems)return Pi(u.driver.setItems,u.items.map(h=>({key:h.relativeKey,value:I5(h.value),options:h.options})),f);u.driver.setItem&&await Promise.all(u.items.map(h=>Pi(u.driver.setItem,h.relativeKey,I5(h.value),h.options)))})},async setItemRaw(l,f,u={}){if(f===void 0)return c.removeItem(l,u);l=Co(l);const{relativeKey:h,driver:g}=r(l);if(g.setItemRaw)await Pi(g.setItemRaw,h,f,u);else if(g.setItem)await Pi(g.setItem,h,LLe(f),u);else return;g.watch||i("update",l)},async removeItem(l,f={}){typeof f=="boolean"&&(f={removeMeta:f}),l=Co(l);const{relativeKey:u,driver:h}=r(l);h.removeItem&&(await Pi(h.removeItem,u,f),(f.removeMeta||f.removeMata)&&await Pi(h.removeItem,u+"$",f),h.watch||i("remove",l))},async getMeta(l,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),l=Co(l);const{relativeKey:u,driver:h}=r(l),g=Object.create(null);if(h.getMeta&&Object.assign(g,await Pi(h.getMeta,u,f)),!f.nativeOnly){const y=await Pi(h.getItem,u+"$",f).then(m=>b6(m));y&&typeof y=="object"&&(typeof y.atime=="string"&&(y.atime=new Date(y.atime)),typeof y.mtime=="string"&&(y.mtime=new Date(y.mtime)),Object.assign(g,y))}return g},setMeta(l,f,u={}){return this.setItem(l+"$",f,u)},removeMeta(l,f={}){return this.removeItem(l+"$",f)},async getKeys(l,f={}){l=w6(l);const u=n(l,!0);let h=[];const g=[];for(const y of u){const m=await Pi(y.driver.getKeys,y.relativeBase,f);for(const S of m){const E=y.mountpoint+Co(S);h.some(A=>E.startsWith(A))||g.push(E)}h=[y.mountpoint,...h.filter(S=>!S.startsWith(y.mountpoint))]}return l?g.filter(y=>y.startsWith(l)&&y[y.length-1]!=="$"):g.filter(y=>y[y.length-1]!=="$")},async clear(l,f={}){l=w6(l),await Promise.all(n(l,!1).map(async u=>{if(u.driver.clear)return Pi(u.driver.clear,u.relativeBase,f);if(u.driver.removeItem){const h=await u.driver.getKeys(u.relativeBase||"",f);return Promise.all(h.map(g=>u.driver.removeItem(g,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>Rq(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,f){if(l=w6(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((u,h)=>h.length-u.length)),e.mounts[l]=f,e.watching&&Promise.resolve(kq(f,i,l)).then(u=>{e.unwatch[l]=u}).catch(console.error),c},async unmount(l,f=!0){l=w6(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),f&&await Rq(e.mounts[l]),e.mountpoints=e.mountpoints.filter(u=>u!==l),delete e.mounts[l])},getMount(l=""){l=Co(l)+":";const f=r(l);return{driver:f.driver,base:f.base}},getMounts(l="",f={}){return l=Co(l),n(l,f.parents).map(h=>({driver:h.driver,base:h.mountpoint}))},keys:(l,f={})=>c.getKeys(l,f),get:(l,f={})=>c.getItem(l,f),set:(l,f,u={})=>c.setItem(l,f,u),has:(l,f={})=>c.hasItem(l,f),del:(l,f={})=>c.removeItem(l,f),remove:(l,f={})=>c.removeItem(l,f)};return c}function kq(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function Rq(t){typeof t.dispose=="function"&&await Pi(t.dispose)}function _p(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function qne(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=_p(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let a7;function _x(){return a7||(a7=qne("keyval-store","keyval")),a7}function Mq(t,e=_x()){return e("readonly",r=>_p(r.get(t)))}function VLe(t,e,r=_x()){return r("readwrite",n=>(n.put(e,t),_p(n.transaction)))}function zLe(t,e=_x()){return e("readwrite",r=>(r.delete(t),_p(r.transaction)))}function HLe(t=_x()){return t("readwrite",e=>(e.clear(),_p(e.transaction)))}function GLe(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},_p(t.transaction)}function WLe(t=_x()){return t("readonly",e=>{if(e.getAllKeys)return _p(e.getAllKeys());const r=[];return GLe(e,n=>r.push(n.key)).then(()=>r)})}const KLe="idb-keyval";var YLe=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=qne(t.dbName,t.storeName)),{name:KLe,options:t,async hasItem(i){return!(typeof await Mq(r(i),n)>"u")},async getItem(i){return await Mq(r(i),n)??null},setItem(i,s){return VLe(r(i),s,n)},removeItem(i){return zLe(r(i),n)},getKeys(){return WLe(n)},clear(){return HLe(n)}}};const QLe="WALLET_CONNECT_V2_INDEXED_DB",JLe="keyvaluestorage";let ZLe=class{constructor(){this.indexedDb=qLe({driver:YLe({dbName:QLe,storeName:JLe})})}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){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Uu(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var c7=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},T5={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof c7<"u"&&c7.localStorage?T5.exports=c7.localStorage:typeof window<"u"&&window.localStorage?T5.exports=window.localStorage:T5.exports=new e})();function XLe(t){var e;return[t[0],cp((e=t[1])!=null?e:"")]}let eFe=class{constructor(){this.localStorage=T5.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(XLe)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return cp(r)}async setItem(e,r){this.localStorage.setItem(e,Uu(r))}async removeItem(e){this.localStorage.removeItem(e)}};const tFe="wc_storage_version",Oq=1,rFe=async(t,e,r)=>{const n=tFe,i=await e.getItem(n);if(i&&i>=Oq){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,Oq),r(e),nFe(t,o)},nFe=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let iFe=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new eFe;this.storage=e;try{const r=new ZLe;rFe(e,r,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,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function sFe(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var oFe=aFe;function aFe(t,e,r){var n=r&&r.stringify||sFe,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?u:0,t.charCodeAt(g+1)){case 100:case 102:if(f>=c||e[f]==null)break;u=c||e[f]==null)break;u=c||e[f]===void 0)break;u",u=g+2,g++;break}l+=n(e[f]),u=g+2,g++;break;case 115:if(f>=c)break;u-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",c=Object.create(r);c.log||(c.log=gw),Object.defineProperty(c,"levelVal",{get:f}),Object.defineProperty(c,"level",{get:u,set:h});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:pFe(t)};c.levels=Jl.levels,c.level=a,c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=gw,c.serializers=n,c._serialize=i,c._stdErrSerialize=s,c.child=g,e&&(c._logEvent=NT());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function u(){return this._level}function h(y){if(y!=="silent"&&!this.levels.values[y])throw Error("unknown level "+y);this._level=y,gv(l,c,"error","log"),gv(l,c,"fatal","error"),gv(l,c,"warn","error"),gv(l,c,"info","log"),gv(l,c,"debug","log"),gv(l,c,"trace","log")}function g(y,m){if(!y)throw new Error("missing bindings for child Pino");m=m||{},i&&y.serializers&&(m.serializers=y.serializers);const S=m.serializers;if(i&&S){var E=Object.assign({},n,S),A=t.browser.serialize===!0?Object.keys(E):i;delete y.serializers,SC([y],A,E,this._stdErrSerialize)}function P(N){this._childLevel=(N._childLevel|0)+1,this.error=yv(N,y,"error"),this.fatal=yv(N,y,"fatal"),this.warn=yv(N,y,"warn"),this.info=yv(N,y,"info"),this.debug=yv(N,y,"debug"),this.trace=yv(N,y,"trace"),E&&(this.serializers=E,this._serialize=A),e&&(this._logEvent=NT([].concat(N._logEvent.bindings,y)))}return P.prototype=this,new P(this)}return c}Jl.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Jl.stdSerializers=cFe;Jl.stdTimeFunctions=Object.assign({},{nullTime:Vne,epochTime:zne,unixTime:vFe,isoTime:gFe});function gv(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?gw:i[r]?i[r]:vw[r]||vw[n]||gw,fFe(t,e,r)}function fFe(t,e,r){!t.transmit&&e[r]===gw||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===vw?vw:this;for(var c=0;c-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function yv(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Hne=class{constructor(e,r=kO){this.level=e??"error",this.levelValue=Cv.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Nq(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===Cv.levels.values.error?console.error(e):r===Cv.levels.values.warn?console.warn(e):r===Cv.levels.values.debug?console.debug(e):r===Cv.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Uu({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Nq(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Uu({extraMetadata:e})),new Blob(r,{type:"application/json"})}},wFe=class{constructor(e,r=kO){this.baseChunkLogger=new Hne(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},xFe=class{constructor(e,r=kO){this.baseChunkLogger=new Hne(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var EFe=Object.defineProperty,CFe=Object.defineProperties,AFe=Object.getOwnPropertyDescriptors,Bq=Object.getOwnPropertySymbols,SFe=Object.prototype.hasOwnProperty,_Fe=Object.prototype.propertyIsEnumerable,Lq=(t,e,r)=>e in t?EFe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,a8=(t,e)=>{for(var r in e||(e={}))SFe.call(e,r)&&Lq(t,r,e[r]);if(Bq)for(var r of Bq(e))_Fe.call(e,r)&&Lq(t,r,e[r]);return t},c8=(t,e)=>CFe(t,AFe(e));function _C(t){return c8(a8({},t),{level:(t==null?void 0:t.level)||mFe.level})}function IFe(t,e=Tx){return t[e]||""}function TFe(t,e,r=Tx){return t[r]=e,t}function Uo(t,e=Tx){let r="";return typeof t.bindings>"u"?r=IFe(t,e):r=t.bindings().context||"",r}function PFe(t,e,r=Tx){const n=Uo(t,r);return n.trim()?`${n}/${e}`:e}function uo(t,e,r=Tx){const n=PFe(t,e,r),i=t.child({context:n});return TFe(i,n,r)}function kFe(t){var e,r;const n=new wFe((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Ix(c8(a8({},t.opts),{level:"trace",browser:c8(a8({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function RFe(t){var e;const r=new xFe((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Ix(c8(a8({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function MFe(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?kFe(t):RFe(t)}let OFe=class extends Sp{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},DFe=class extends Sp{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},NFe=class{constructor(e,r){this.logger=e,this.core=r}},BFe=class extends Sp{constructor(e,r){super(),this.relayer=e,this.logger=r}},LFe=class extends Sp{constructor(e){super()}},FFe=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},jFe=class extends Sp{constructor(e,r){super(),this.relayer=e,this.logger=r}},UFe=class extends Sp{constructor(e,r){super(),this.core=e,this.logger=r}},$Fe=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},qFe=class{constructor(e,r){this.projectId=e,this.logger=r}},VFe=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},zFe=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},HFe=class{constructor(e){this.client=e}};const GFe="PARSE_ERROR",WFe="INVALID_REQUEST",KFe="METHOD_NOT_FOUND",YFe="INVALID_PARAMS",Gne="INTERNAL_ERROR",RO="SERVER_ERROR",QFe=[-32700,-32600,-32601,-32602,-32603],b2={[GFe]:{code:-32700,message:"Parse error"},[WFe]:{code:-32600,message:"Invalid Request"},[KFe]:{code:-32601,message:"Method not found"},[YFe]:{code:-32602,message:"Invalid params"},[Gne]:{code:-32603,message:"Internal error"},[RO]:{code:-32e3,message:"Server error"}},Wne=RO;function JFe(t){return QFe.includes(t)}function Fq(t){return Object.keys(b2).includes(t)?b2[t]:b2[Wne]}function ZFe(t){const e=Object.values(b2).find(r=>r.code===t);return e||b2[Wne]}function Kne(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Yne={},Bf={},jq;function XFe(){if(jq)return Bf;jq=1,Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.isBrowserCryptoAvailable=Bf.getSubtleCrypto=Bf.getBrowerCrypto=void 0;function t(){return(xi==null?void 0:xi.crypto)||(xi==null?void 0:xi.msCrypto)||{}}Bf.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Bf.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Bf.isBrowserCryptoAvailable=r,Bf}var Lf={},Uq;function eje(){if(Uq)return Lf;Uq=1,Object.defineProperty(Lf,"__esModule",{value:!0}),Lf.isBrowser=Lf.isNode=Lf.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Lf.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Lf.isNode=e;function r(){return!t()&&!e()}return Lf.isBrowser=r,Lf}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=px;e.__exportStar(XFe(),t),e.__exportStar(eje(),t)})(Yne);function Td(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function i1(t=6){return BigInt(Td(t))}function rh(t,e,r){return{id:r||Td(),jsonrpc:"2.0",method:t,params:e}}function IC(t,e){return{id:t,jsonrpc:"2.0",result:e}}function TC(t,e,r){return{id:t,jsonrpc:"2.0",error:tje(e)}}function tje(t,e){return typeof t>"u"?Fq(Gne):(typeof t=="string"&&(t=Object.assign(Object.assign({},Fq(RO)),{message:t})),JFe(t.code)&&(t=ZFe(t.code)),t)}class rje{}class nje extends rje{constructor(){super()}}class ije extends nje{constructor(e){super()}}const sje="^https?:",oje="^wss?:";function aje(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Qne(t,e){const r=aje(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function $q(t){return Qne(t,sje)}function qq(t){return Qne(t,oje)}function cje(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Jne(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function MO(t){return Jne(t)&&"method"in t}function PC(t){return Jne(t)&&(xl(t)||Ka(t))}function xl(t){return"result"in t}function Ka(t){return"error"in t}let hc=class extends ije{constructor(e){super(e),this.events=new wa.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(rh(e.method,e.params||[],e.id||i1().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Ka(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),PC(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const lje=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),fje=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Vq=t=>t.split("?")[0],zq=10,uje=lje();let dje=class{constructor(e){if(this.url=e,this.events=new wa.EventEmitter,this.registering=!1,!qq(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Uu(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!qq(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=Yne.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!cje(e)},o=new uje(e,[],s);fje()?o.onerror=a=>{const c=a;n(this.emitError(c.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?cp(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=TC(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return Kne(e,Vq(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>zq&&this.events.setMaxListeners(zq)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${Vq(this.url)}`));return this.events.emit("register_error",r),r}};var l8={exports:{}};l8.exports;(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",f="[object Boolean]",u="[object Date]",h="[object Error]",g="[object Function]",y="[object GeneratorFunction]",m="[object Map]",S="[object Number]",E="[object Null]",A="[object Object]",P="[object Promise]",N="[object Proxy]",L="[object RegExp]",V="[object Set]",I="[object String]",U="[object Symbol]",ie="[object Undefined]",ae="[object WeakMap]",K="[object ArrayBuffer]",R="[object DataView]",D="[object Float32Array]",v="[object Float64Array]",b="[object Int8Array]",M="[object Int16Array]",B="[object Int32Array]",x="[object Uint8Array]",C="[object Uint8ClampedArray]",w="[object Uint16Array]",k="[object Uint32Array]",O=/[\\^$.*+?()[\]{}|]/g,G=/^\[object .+?Constructor\]$/,oe=/^(?:0|[1-9]\d*)$/,$={};$[D]=$[v]=$[b]=$[M]=$[B]=$[x]=$[C]=$[w]=$[k]=!0,$[a]=$[c]=$[K]=$[f]=$[R]=$[u]=$[h]=$[g]=$[m]=$[S]=$[A]=$[L]=$[V]=$[I]=$[ae]=!1;var X=typeof xi=="object"&&xi&&xi.Object===Object&&xi,W=typeof self=="object"&&self&&self.Object===Object&&self,Z=X||W||Function("return this")(),te=e&&!e.nodeType&&e,F=te&&!0&&t&&!t.nodeType&&t,ee=F&&F.exports===te,fe=ee&&X.process,xe=function(){try{return fe&&fe.binding&&fe.binding("util")}catch{}}(),_e=xe&&xe.isTypedArray;function Me(le,Ee){for(var Ue=-1,gt=le==null?0:le.length,tn=0,rr=[];++Ue-1}function _i(le,Ee){var Ue=this.__data__,gt=yf(Ue,le);return gt<0?(++this.size,Ue.push([le,Ee])):Ue[gt][1]=Ee,this}tr.prototype.clear=Or,tr.prototype.delete=pi,tr.prototype.get=vi,tr.prototype.has=gi,tr.prototype.set=_i;function Tn(le){var Ee=-1,Ue=le==null?0:le.length;for(this.clear();++EeUn))return!1;var rn=rr.get(le);if(rn&&rr.get(Ee))return rn==Ee;var pn=-1,bs=!0,Rn=Ue&s?new ms:void 0;for(rr.set(le,Ee),rr.set(Ee,le);++pn-1&&le%1==0&&le-1&&le%1==0&&le<=o}function a0(le){var Ee=typeof le;return le!=null&&(Ee=="object"||Ee=="function")}function Cf(le){return le!=null&&typeof le=="object"}var Lp=_e?Xe(_e):n0;function _m(le){return Vo(le)?Pp(le):Rp(le)}function Hr(){return[]}function Yr(){return!1}t.exports=Sm})(l8,l8.exports);var hje=l8.exports;const pje=$u(hje),Zne="wc",Xne=2,OO="core",lf=`${Zne}@2:${OO}:`,vje={name:OO,logger:"error"},gje={database:":memory:"},yje="crypto",Hq="client_ed25519_seed",mje=it.ONE_DAY,bje="keychain",wje="0.3",xje="messages",Eje="0.3",Cje=it.SIX_HOURS,Aje="publisher",eie="irn",Sje="error",tie="wss://relay.walletconnect.org",_je="relayer",to={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Ije="_subscription",Ba={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Tje=.1,BT="2.17.2",gn={link_mode:"link_mode",relay:"relay"},Pje="0.3",kje="WALLETCONNECT_CLIENT_ID",Gq="WALLETCONNECT_LINK_MODE_APPS",El={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},Rje="subscription",Mje="0.3",Oje=it.FIVE_SECONDS*1e3,Dje="pairing",Nje="0.3",mb={wc_pairingDelete:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:it.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:it.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:it.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:it.ONE_DAY,prompt:!1,tag:0},res:{ttl:it.ONE_DAY,prompt:!1,tag:0}}},V0={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Ac={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Bje="history",Lje="0.3",Fje="expirer",Ua={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},jje="0.3",Uje="verify-api",$je="https://verify.walletconnect.com",rie="https://verify.walletconnect.org",w2=rie,qje=`${w2}/v3`,Vje=[$je,rie],zje="echo",Hje="https://echo.walletconnect.com",bl={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},$f={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Sc={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},P0={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},k0={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},bb={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Gje=.1,Wje="event-client",Kje=86400,Yje="https://pulse.walletconnect.org/batch";function Qje(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,N=new Uint8Array(P);E!==A;){for(var L=y[E],V=0,I=P-1;(L!==0||V>>0,N[I]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");S=V,E++}for(var U=P-S;U!==P&&N[U]===0;)U++;for(var ie=c.repeat(m);U>>0,P=new Uint8Array(A);y[m];){var N=r[y.charCodeAt(m)];if(N===255)return;for(var L=0,V=A-1;(N!==0||L>>0,P[V]=N%256>>>0,N=N/256>>>0;if(N!==0)throw new Error("Non-zero carry");E=L,m++}if(y[m]!==" "){for(var I=A-E;I!==A&&P[I]===0;)I++;for(var U=new Uint8Array(S+(A-I)),ie=S;I!==A;)U[ie++]=P[I++];return U}}}function g(y){var m=h(y);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:h,decode:g}}var Jje=Qje,Zje=Jje;const nie=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Xje=t=>new TextEncoder().encode(t),eUe=t=>new TextDecoder().decode(t);class tUe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class rUe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return iie(this,e)}}class nUe{constructor(e){this.decoders=e}or(e){return iie(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const iie=(t,e)=>new nUe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class iUe{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new tUe(e,r,n),this.decoder=new rUe(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const kC=({name:t,prefix:e,encode:r,decode:n})=>new iUe(t,e,r,n),Px=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Zje(r,e);return kC({prefix:t,name:e,encode:n,decode:s=>nie(i(s))})},sUe=(t,e,r,n)=>{const i={};for(let f=0;f=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},oUe=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<kC({prefix:e,name:t,encode(i){return oUe(i,n,r)},decode(i){return sUe(i,n,r,t)}}),aUe=kC({prefix:"\0",name:"identity",encode:t=>eUe(t),decode:t=>Xje(t)});var cUe=Object.freeze({__proto__:null,identity:aUe});const lUe=hs({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var fUe=Object.freeze({__proto__:null,base2:lUe});const uUe=hs({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var dUe=Object.freeze({__proto__:null,base8:uUe});const hUe=Px({prefix:"9",name:"base10",alphabet:"0123456789"});var pUe=Object.freeze({__proto__:null,base10:hUe});const vUe=hs({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),gUe=hs({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var yUe=Object.freeze({__proto__:null,base16:vUe,base16upper:gUe});const mUe=hs({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),bUe=hs({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),wUe=hs({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),xUe=hs({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),EUe=hs({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),CUe=hs({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),AUe=hs({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),SUe=hs({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_Ue=hs({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var IUe=Object.freeze({__proto__:null,base32:mUe,base32upper:bUe,base32pad:wUe,base32padupper:xUe,base32hex:EUe,base32hexupper:CUe,base32hexpad:AUe,base32hexpadupper:SUe,base32z:_Ue});const TUe=Px({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),PUe=Px({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var kUe=Object.freeze({__proto__:null,base36:TUe,base36upper:PUe});const RUe=Px({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),MUe=Px({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var OUe=Object.freeze({__proto__:null,base58btc:RUe,base58flickr:MUe});const DUe=hs({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),NUe=hs({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),BUe=hs({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),LUe=hs({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var FUe=Object.freeze({__proto__:null,base64:DUe,base64pad:NUe,base64url:BUe,base64urlpad:LUe});const sie=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),jUe=sie.reduce((t,e,r)=>(t[r]=e,t),[]),UUe=sie.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function $Ue(t){return t.reduce((e,r)=>(e+=jUe[r],e),"")}function qUe(t){const e=[];for(const r of t){const n=UUe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const VUe=kC({prefix:"🚀",name:"base256emoji",encode:$Ue,decode:qUe});var zUe=Object.freeze({__proto__:null,base256emoji:VUe}),HUe=oie,Wq=128,GUe=127,WUe=~GUe,KUe=Math.pow(2,31);function oie(t,e,r){e=e||[],r=r||0;for(var n=r;t>=KUe;)e[r++]=t&255|Wq,t/=128;for(;t&WUe;)e[r++]=t&255|Wq,t>>>=7;return e[r]=t|0,oie.bytes=r-n+1,e}var YUe=LT,QUe=128,Kq=127;function LT(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw LT.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&Kq)<=QUe);return LT.bytes=s-n,r}var JUe=Math.pow(2,7),ZUe=Math.pow(2,14),XUe=Math.pow(2,21),e$e=Math.pow(2,28),t$e=Math.pow(2,35),r$e=Math.pow(2,42),n$e=Math.pow(2,49),i$e=Math.pow(2,56),s$e=Math.pow(2,63),o$e=function(t){return t(aie.encode(t,e,r),e),Qq=t=>aie.encodingLength(t),FT=(t,e)=>{const r=e.byteLength,n=Qq(t),i=n+Qq(r),s=new Uint8Array(i+r);return Yq(t,s,0),Yq(r,s,n),s.set(e,i),new c$e(t,r,e,s)};class c$e{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const cie=({name:t,code:e,encode:r})=>new l$e(t,e,r);let l$e=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?FT(this.code,r):r.then(n=>FT(this.code,n))}else throw Error("Unknown type, must be binary type")}};const lie=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),f$e=cie({name:"sha2-256",code:18,encode:lie("SHA-256")}),u$e=cie({name:"sha2-512",code:19,encode:lie("SHA-512")});var d$e=Object.freeze({__proto__:null,sha256:f$e,sha512:u$e});const fie=0,h$e="identity",uie=nie,p$e=t=>FT(fie,uie(t)),v$e={code:fie,name:h$e,encode:uie,digest:p$e};var g$e=Object.freeze({__proto__:null,identity:v$e});new TextEncoder,new TextDecoder;const Jq={...cUe,...fUe,...dUe,...pUe,...yUe,...IUe,...kUe,...OUe,...FUe,...zUe};({...d$e,...g$e});function y$e(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function die(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Zq=die("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),f7=die("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=y$e(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=et("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=uo(r,this.name)}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,_ne(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Ine(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}let x$e=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=yje,this.randomSessionIdentifier=MT(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=nq(i);return Ene(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=SBe();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=nq(s),a=this.randomSessionIdentifier;return await DNe(a,i,mje,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),c=_Be(a,s);return this.setSymKey(c,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||_5(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=Lne(o),c=Uu(s);if(yq(a))return TBe(c,o==null?void 0:o.encoding);if(gq(a)){const h=a.senderPublicKey,g=a.receiverPublicKey;i=await this.generateSharedKey(h,g)}const l=this.getSymKey(i),{type:f,senderPublicKey:u}=a;return IBe({type:f,symKey:l,message:c,senderPublicKey:u,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=RBe(s,o);if(yq(a)){const c=kBe(s,o==null?void 0:o.encoding);return cp(c)}if(gq(a)){const c=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(c,l)}try{const c=this.getSymKey(i),l=PBe({symKey:c,encoded:s,encoding:o==null?void 0:o.encoding});return cp(l)}catch(c){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}},this.getPayloadType=(i,s=th)=>{const o=hw({encoded:i,encoding:s});return fp(o.type)},this.getPayloadSenderPublicKey=(i,s=th)=>{const o=hw({encoded:i,encoding:s});return o.senderPublicKey?ji(o.senderPublicKey,oo):void 0},this.core=e,this.logger=uo(r,this.name),this.keychain=n||new w$e(this.core,this.logger)}get context(){return Uo(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Hq)}catch{e=MT(),await this.keychain.set(Hq,e)}return b$e(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}};class E$e extends NFe{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=xje,this.version=Eje,this.initialized=!1,this.storagePrefix=lf,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Yf(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Yf(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=uo(e,this.name),this.core=r}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,_ne(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Ine(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}let C$e=class extends BFe{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new wa.EventEmitter,this.name=Aje,this.queue=new Map,this.publishTimeout=it.toMiliseconds(it.ONE_MINUTE),this.failedPublishTimeout=it.toMiliseconds(it.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||Cje,c=OT(s),l=(s==null?void 0:s.prompt)||!1,f=(s==null?void 0:s.tag)||0,u=(s==null?void 0:s.id)||i1().toString(),h={topic:n,message:i,opts:{ttl:a,relay:c,prompt:l,tag:f,id:u,attestation:s==null?void 0:s.attestation}},g=`Failed to publish payload, please try again. id:${u} tag:${f}`,y=Date.now();let m,S=1;try{for(;m===void 0;){if(Date.now()-y>this.publishTimeout)throw new Error(g);this.logger.trace({id:u,attempts:S},`publisher.publish - attempt ${S}`),m=await await Eg(this.rpcPublish(n,i,a,c,l,f,u,s==null?void 0:s.attestation).catch(E=>this.logger.warn(E)),this.publishTimeout,g),S++,m||await new Promise(E=>setTimeout(E,this.failedPublishTimeout))}this.relayer.events.emit(to.publish,h),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:u,topic:n,message:i,opts:s}})}catch(E){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(E),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw E;this.queue.set(u,h)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=uo(r,this.name),this.registerEventListeners()}get context(){return Uo(this.logger)}rpcPublish(e,r,n,i,s,o,a,c){var l,f,u,h;const g={method:zb(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:c},id:a};return Ro((l=g.params)==null?void 0:l.prompt)&&((f=g.params)==null||delete f.prompt),Ro((u=g.params)==null?void 0:u.tag)&&((h=g.params)==null||delete h.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Am.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(to.connection_stalled);return}this.checkQueue()}),this.relayer.on(to.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}};class A$e{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var S$e=Object.defineProperty,_$e=Object.defineProperties,I$e=Object.getOwnPropertyDescriptors,Xq=Object.getOwnPropertySymbols,T$e=Object.prototype.hasOwnProperty,P$e=Object.prototype.propertyIsEnumerable,eV=(t,e,r)=>e in t?S$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wb=(t,e)=>{for(var r in e||(e={}))T$e.call(e,r)&&eV(t,r,e[r]);if(Xq)for(var r of Xq(e))P$e.call(e,r)&&eV(t,r,e[r]);return t},u7=(t,e)=>_$e(t,I$e(e));class k$e extends jFe{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new A$e,this.events=new wa.EventEmitter,this.name=Rje,this.version=Mje,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=lf,this.subscribeTimeout=it.toMiliseconds(it.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=OT(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new it.Watch;a.start(i);const c=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(c),a.stop(i),s(!0)),a.elapsed(i)>=Oje&&(clearInterval(c),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=uo(r,this.name),this.clientId=""}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=OT(n);await this.rpcUnsubscribe(e,r,i);const s=sn("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===gn.relay&&await this.restartToComplete();const s={method:zb(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Yf(e+this.clientId);if((n==null?void 0:n.transportType)===gn.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},it.toMiliseconds(it.ONE_SECOND)),a;const c=await Eg(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!c&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return c?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(to.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:zb(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Eg(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(to.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:zb(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await Eg(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(to.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:zb(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,u7(wb({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,wb({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,wb({},r)),this.topicMap.set(r.topic,e),this.events.emit(El.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(El.deleted,u7(wb({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(El.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);cf(r)&&this.onBatchSubscribe(r.map((n,i)=>u7(wb({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(Am.pulse,async()=>{await this.checkPending()}),this.events.on(El.created,async e=>{const r=El.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(El.deleted,async e=>{const r=El.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var R$e=Object.defineProperty,tV=Object.getOwnPropertySymbols,M$e=Object.prototype.hasOwnProperty,O$e=Object.prototype.propertyIsEnumerable,rV=(t,e,r)=>e in t?R$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nV=(t,e)=>{for(var r in e||(e={}))M$e.call(e,r)&&rV(t,r,e[r]);if(tV)for(var r of tV(e))O$e.call(e,r)&&rV(t,r,e[r]);return t};class D$e extends LFe{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new wa.EventEmitter,this.name=_je,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=it.toMiliseconds(it.THIRTY_SECONDS+it.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||i1().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(c,l)=>{const f=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Ba.disconnect,f);const u=await o;this.provider.off(Ba.disconnect,f),c(u)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(i8())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(to.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(to.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Ba.payload,this.onPayloadHandler),this.provider.on(Ba.connect,this.onConnectHandler),this.provider.on(Ba.disconnect,this.onDisconnectHandler),this.provider.on(Ba.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?uo(e.logger,this.name):Ix(_C({level:e.logger||Sje})),this.messages=new E$e(this.logger,e.core),this.subscriber=new k$e(this,this.logger),this.publisher=new C$e(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||tie,this.projectId=e.projectId,this.bundleId=VNe(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return Uo(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:gn.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",c;const l=f=>{f.topic===e&&(this.subscriber.off(El.created,l),c())};return await Promise.all([new Promise(f=>{c=f,this.subscriber.on(El.created,l)}),new Promise(async(f,u)=>{a=await this.subscriber.subscribe(e,nV({internal:{throwOnFailedPublish:o}},r)).catch(h=>{o&&u(h)})||a,f()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Eg(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Ba.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Ba.disconnect,i),await Eg(this.provider.connect(),it.toMiliseconds(it.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Tq())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=mi(it.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(to.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(i8())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new hc(new dje(WNe({sdkVersion:BT,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),MO(e)){if(!e.method.endsWith(Ije))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:gn.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(nV({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else PC(e)&&this.events.emit(to.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(to.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=IC(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Ba.payload,this.onPayloadHandler),this.provider.off(Ba.connect,this.onConnectHandler),this.provider.off(Ba.disconnect,this.onDisconnectHandler),this.provider.off(Ba.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Tq();ALe(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(to.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},it.toMiliseconds(Tje))))}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var N$e=Object.defineProperty,iV=Object.getOwnPropertySymbols,B$e=Object.prototype.hasOwnProperty,L$e=Object.prototype.propertyIsEnumerable,sV=(t,e,r)=>e in t?N$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oV=(t,e)=>{for(var r in e||(e={}))B$e.call(e,r)&&sV(t,r,e[r]);if(iV)for(var r of iV(e))L$e.call(e,r)&&sV(t,r,e[r]);return t};class Ip extends FFe{constructor(e,r,n,i=lf,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=Pje,this.cached=[],this.initialized=!1,this.storagePrefix=lf,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Ro(o)?this.map.set(this.getKey(o),o):tLe(o)?this.map.set(o.id,o):rLe(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>pje(a[c],o[c]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=oV(oV({},this.getData(o)),a);this.map.set(o,c),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=uo(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=et("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}class F$e{constructor(e,r){this.core=e,this.logger=r,this.name=Dje,this.version=Nje,this.events=new iO,this.initialized=!1,this.storagePrefix=lf,this.ignoredPayloadTypes=[Cu],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=MT(),s=await this.core.crypto.setSymKey(i),o=mi(it.FIVE_MINUTES),a={protocol:eie},c={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=Eq({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(V0.create,c),this.core.expirer.set(s,o),await this.pairings.set(s,c),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[bl.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:c,methods:l}=xq(n.uri);i.props.properties.topic=s,i.addTrace(bl.pairing_uri_validation_success),i.addTrace(bl.pairing_uri_not_expired);let f;if(this.pairings.keys.includes(s)){if(f=this.pairings.get(s),i.addTrace(bl.existing_pairing),f.active)throw i.setError($f.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(bl.pairing_not_expired)}const u=c||mi(it.FIVE_MINUTES),h={topic:s,relay:a,expiry:u,active:!1,methods:l};this.core.expirer.set(s,u),await this.pairings.set(s,h),i.addTrace(bl.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(V0.create,h),i.addTrace(bl.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(bl.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError($f.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(g){throw i.setError($f.subscribe_pairing_topic_failure),g}return i.addTrace(bl.subscribe_pairing_topic_success),h},this.activate=async({topic:n})=>{this.isInitialized();const i=mi(it.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=j0();this.events.once(Sr("pairing_ping",s),({error:l})=>{l?c(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",sn("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,c=this.core.crypto.keychain.get(i);return Eq({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:c,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=rh(i,s),a=await this.core.crypto.encode(n,o),c=mb[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,c),o.id},this.sendResult=async(n,i,s)=>{const o=IC(n,s),a=await this.core.crypto.encode(i,o),c=await this.core.history.get(i,n),l=mb[c.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=TC(n,s),a=await this.core.crypto.encode(i,o),c=await this.core.history.get(i,n),l=mb[c.request.method]?mb[c.request.method].res:mb.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,sn("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>Id(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(V0.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{xl(i)?this.events.emit(Sr("pairing_ping",s),{}):Ka(i)&&this.events.emit(Sr("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(V0.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=sn("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(sn("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!Ao(n)){const{message:a}=et("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError($f.malformed_pairing_uri),new Error(a)}if(!eLe(n.uri)){const{message:a}=et("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError($f.malformed_pairing_uri),new Error(a)}const o=xq(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=et("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError($f.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=et("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError($f.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&it.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!Ao(n)){const{message:s}=et("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!Ao(n)){const{message:s}=et("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ti(n,!1)){const{message:i}=et("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=et("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(Id(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=et("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=uo(r,this.name),this.pairings=new Ip(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Uo(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(to.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===gn.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{MO(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):PC(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Ua.expired,async e=>{const{topic:r}=Pne(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(V0.expire,{topic:r}))})}}class j$e extends DFe{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new wa.EventEmitter,this.name=Bje,this.version=Lje,this.cached=[],this.initialized=!1,this.storagePrefix=lf,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:mi(it.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Ac.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Ka(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(Ac.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Ac.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=uo(r,this.name)}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:rh(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Ac.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Ac.created,e=>{const r=Ac.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Ac.updated,e=>{const r=Ac.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Ac.deleted,e=>{const r=Ac.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(Am.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{it.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Ac.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}class U$e extends UFe{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new wa.EventEmitter,this.name=Fje,this.version=jje,this.cached=[],this.initialized=!1,this.storagePrefix=lf,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Ua.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Ua.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=uo(r,this.name)}get context(){return Uo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return KNe(e);if(typeof e=="number")return YNe(e);const{message:r}=et("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ua.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;it.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Ua.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Am.pulse,()=>this.checkExpirations()),this.events.on(Ua.created,e=>{const r=Ua.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Ua.expired,e=>{const r=Ua.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Ua.deleted,e=>{const r=Ua.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}class $$e extends $Fe{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=Uje,this.verifyUrlV3=qje,this.storagePrefix=lf,this.version=Xne,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&it.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!Ex()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=vx(),f=this.startAbortTimer(it.ONE_SECOND*5),u=await new Promise((h,g)=>{const y=()=>{window.removeEventListener("message",S),l.body.removeChild(m),g("attestation aborted")};this.abortController.signal.addEventListener("abort",y);const m=l.createElement("iframe");m.src=c,m.style.display="none",m.addEventListener("error",y,{signal:this.abortController.signal});const S=E=>{if(E.data&&typeof E.data=="string")try{const A=JSON.parse(E.data);if(A.type==="verify_attestation"){if(kT(A.attestation).payload.id!==o)return;clearInterval(f),l.body.removeChild(m),this.abortController.signal.removeEventListener("abort",y),window.removeEventListener("message",S),h(A.attestation===null?"":A.attestation)}}catch(A){this.logger.warn(A)}};l.body.appendChild(m),window.addEventListener("message",S,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",u),u}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(kT(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const c=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,c)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(it.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||w2;return Vje.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${w2}`),s=w2),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(it.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=NBe(i,s.publicKey),a={hasExpired:it.toMiliseconds(o.exp)this.abortController.abort(),it.toMiliseconds(e))}}class q$e extends qFe{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=zje,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,c=`${Hje}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=uo(r,this.context)}}var V$e=Object.defineProperty,aV=Object.getOwnPropertySymbols,z$e=Object.prototype.hasOwnProperty,H$e=Object.prototype.propertyIsEnumerable,cV=(t,e,r)=>e in t?V$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xb=(t,e)=>{for(var r in e||(e={}))z$e.call(e,r)&&cV(t,r,e[r]);if(aV)for(var r of aV(e))H$e.call(e,r)&&cV(t,r,e[r]);return t};class G$e extends VFe{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=Wje,this.storagePrefix=lf,this.storageVersion=Gje,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!SO())try{const i={eventId:lq(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Sne(this.core.relayer.protocol,this.core.relayer.version,BT)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:c}}=i,l=lq(),f=this.core.projectId||"",u=Date.now(),h=xb({eventId:l,timestamp:u,props:{event:s,type:o,properties:{topic:a,trace:c}},bundleId:f,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,h),this.shouldPersist=!0),h},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return xb(xb({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Am.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{it.fromMiliseconds(Date.now())-it.fromMiliseconds(i.timestamp)>Kje&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,xb(xb({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Yje}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${BT}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>Ane().url,this.logger=uo(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var W$e=Object.defineProperty,lV=Object.getOwnPropertySymbols,K$e=Object.prototype.hasOwnProperty,Y$e=Object.prototype.propertyIsEnumerable,fV=(t,e,r)=>e in t?W$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uV=(t,e)=>{for(var r in e||(e={}))K$e.call(e,r)&&fV(t,r,e[r]);if(lV)for(var r of lV(e))Y$e.call(e,r)&&fV(t,r,e[r]);return t};let Q$e=class hie extends OFe{constructor(e){var r;super(e),this.protocol=Zne,this.version=Xne,this.name=OO,this.events=new wa.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:c})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:gn.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:c})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||tie,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=_C({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:vje.logger}),{logger:i,chunkLoggerController:s}=MFe({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=uo(i,this.name),this.heartbeat=new TLe,this.crypto=new x$e(this,this.logger,e==null?void 0:e.keychain),this.history=new j$e(this,this.logger),this.expirer=new U$e(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new iFe(uV(uV({},gje),e==null?void 0:e.storageOptions)),this.relayer=new D$e({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new F$e(this,this.logger),this.verify=new $$e(this,this.logger,this.storage),this.echoClient=new q$e(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new G$e(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new hie(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(kje,n),r}get context(){return Uo(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Gq,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(Gq)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}};const J$e=Q$e,pie="wc",vie=2,gie="client",DO=`${pie}@${vie}:${gie}:`,d7={name:gie,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},dV="WALLETCONNECT_DEEPLINK_CHOICE",Z$e="proposal",yie="Proposal expired",X$e="session",mv=it.SEVEN_DAYS,eqe="engine",Ti={wc_sessionPropose:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1104},res:{ttl:it.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1106},res:{ttl:it.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:it.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1112},res:{ttl:it.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:it.ONE_DAY,prompt:!1,tag:1114},res:{ttl:it.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:it.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:it.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:it.FIVE_MINUTES,prompt:!1,tag:1119}}},h7={min:it.FIVE_MINUTES,max:it.SEVEN_DAYS},vl={idle:"IDLE",active:"ACTIVE"},tqe="request",rqe=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],nqe="wc",iqe="auth",sqe="authKeys",oqe="pairingTopics",aqe="requests",RC=`${nqe}@${1.5}:${iqe}:`,P5=`${RC}:PUB_KEY`;var cqe=Object.defineProperty,lqe=Object.defineProperties,fqe=Object.getOwnPropertyDescriptors,hV=Object.getOwnPropertySymbols,uqe=Object.prototype.hasOwnProperty,dqe=Object.prototype.propertyIsEnumerable,pV=(t,e,r)=>e in t?cqe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vn=(t,e)=>{for(var r in e||(e={}))uqe.call(e,r)&&pV(t,r,e[r]);if(hV)for(var r of hV(e))dqe.call(e,r)&&pV(t,r,e[r]);return t},_c=(t,e)=>lqe(t,fqe(e));class hqe extends HFe{constructor(e){super(e),this.name=eqe,this.events=new iO,this.initialized=!1,this.requestQueue={state:vl.idle,queue:[]},this.sessionRequestQueue={state:vl.idle,queue:[]},this.requestQueueDelay=it.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Ti)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},it.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=_c(Vn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:c}=n;let l=i,f,u=!1;try{l&&(u=this.client.core.pairing.pairings.get(l).active)}catch(N){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),N}if(!l||!u){const{topic:N,uri:L}=await this.client.core.pairing.create();l=N,f=L}if(!l){const{message:N}=et("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(N)}const h=await this.client.core.crypto.generateKeyPair(),g=Ti.wc_sessionPropose.req.ttl||it.FIVE_MINUTES,y=mi(g),m=Vn({requiredNamespaces:s,optionalNamespaces:o,relays:c??[{protocol:eie}],proposer:{publicKey:h,metadata:this.client.metadata},expiryTimestamp:y,pairingTopic:l},a&&{sessionProperties:a}),{reject:S,resolve:E,done:A}=j0(g,yie);this.events.once(Sr("session_connect"),async({error:N,session:L})=>{if(N)S(N);else if(L){L.self.publicKey=h;const V=_c(Vn({},L),{pairingTopic:m.pairingTopic,requiredNamespaces:m.requiredNamespaces,optionalNamespaces:m.optionalNamespaces,transportType:gn.relay});await this.client.session.set(L.topic,V),await this.setExpiry(L.topic,L.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:L.peer.metadata}),this.cleanupDuplicatePairings(V),E(V)}});const P=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:m,throwOnFailedPublish:!0});return await this.setProposal(P,Vn({id:P},m)),{uri:f,approval:A}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[Sc.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(U){throw o.setError(P0.no_internet_connection),U}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(U){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(P0.proposal_not_found),U}try{await this.isValidApprove(r)}catch(U){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(P0.session_approve_namespace_validation_failure),U}const{id:a,relayProtocol:c,namespaces:l,sessionProperties:f,sessionConfig:u}=r,h=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:g,proposer:y,requiredNamespaces:m,optionalNamespaces:S}=h;let E=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:g});E||(E=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Sc.session_approve_started,properties:{topic:g,trace:[Sc.session_approve_started,Sc.session_namespaces_validation_success]}}));const A=await this.client.core.crypto.generateKeyPair(),P=y.publicKey,N=await this.client.core.crypto.generateSharedKey(A,P),L=Vn(Vn({relay:{protocol:c??"irn"},namespaces:l,controller:{publicKey:A,metadata:this.client.metadata},expiry:mi(mv)},f&&{sessionProperties:f}),u&&{sessionConfig:u}),V=gn.relay;E.addTrace(Sc.subscribing_session_topic);try{await this.client.core.relayer.subscribe(N,{transportType:V})}catch(U){throw E.setError(P0.subscribe_session_topic_failure),U}E.addTrace(Sc.subscribe_session_topic_success);const I=_c(Vn({},L),{topic:N,requiredNamespaces:m,optionalNamespaces:S,pairingTopic:g,acknowledged:!1,self:L.controller,peer:{publicKey:y.publicKey,metadata:y.metadata},controller:A,transportType:gn.relay});await this.client.session.set(N,I),E.addTrace(Sc.store_session);try{E.addTrace(Sc.publishing_session_settle),await this.sendRequest({topic:N,method:"wc_sessionSettle",params:L,throwOnFailedPublish:!0}).catch(U=>{throw E==null||E.setError(P0.session_settle_publish_failure),U}),E.addTrace(Sc.session_settle_publish_success),E.addTrace(Sc.publishing_session_approve),await this.sendResult({id:a,topic:g,result:{relay:{protocol:c??"irn"},responderPublicKey:A},throwOnFailedPublish:!0}).catch(U=>{throw E==null||E.setError(P0.session_approve_publish_failure),U}),E.addTrace(Sc.session_approve_publish_success)}catch(U){throw this.client.logger.error(U),this.client.session.delete(N,sn("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(N),U}return this.client.core.eventClient.deleteEvent({eventId:E.eventId}),await this.client.core.pairing.updateMetadata({topic:g,metadata:y.metadata}),await this.client.proposal.delete(a,sn("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:g}),await this.setExpiry(N,mi(mv)),{topic:N,acknowledged:()=>Promise.resolve(this.client.session.get(N))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:Ti.wc_sessionPropose.reject}),await this.client.proposal.delete(n,sn("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(u){throw this.client.logger.error("update() -> isValidUpdate() failed"),u}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=j0(),c=Td(),l=i1().toString(),f=this.client.session.get(n).namespaces;return this.events.once(Sr("session_update",c),({error:u})=>{u?a(u):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:l}).catch(u=>{this.client.logger.error(u),this.client.session.update(n,{namespaces:f}),a(u)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:n}=r,i=Td(),{done:s,resolve:o,reject:a}=j0();return this.events.once(Sr("session_extend",i),({error:c})=>{c?a(c):o()}),await this.setExpiry(n,mi(mv)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:i,topic:s,expiry:o=Ti.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===gn.relay&&await this.confirmOnlineStateOrThrow();const c=Td(),l=i1().toString(),{done:f,resolve:u,reject:h}=j0(o,"Request expired. Please try again.");this.events.once(Sr("session_request",c),({error:y,result:m})=>{y?h(y):u(m)});const g=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return g?(await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:_c(Vn({},i),{expiryTimestamp:mi(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:g}).catch(y=>h(y)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),await f()):await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:_c(Vn({},i),{expiryTimestamp:mi(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(m=>h(m)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),y()}),new Promise(async y=>{var m;if(!((m=a.sessionConfig)!=null&&m.disableDeepLink)){const S=await ZNe(this.client.core.storage,dV);await QNe({id:c,topic:s,wcDeepLink:S})}y()}),f()]).then(y=>y[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===gn.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);xl(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Ka(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=Td(),s=i1().toString(),{done:o,resolve:a,reject:c}=j0();this.events.once(Sr("session_ping",i),({error:l})=>{l?c(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=i1().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:sn("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=et("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>ZBe(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?gn.link_mode:gn.relay;o===gn.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:l,domain:f,nonce:u,type:h,exp:g,nbf:y,methods:m=[],expiry:S}=r,E=[...r.resources||[]],{topic:A,uri:P}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:A,uri:P}});const N=await this.client.core.crypto.generateKeyPair(),L=_5(N);if(await Promise.all([this.client.auth.authKeys.set(P5,{responseTopic:L,publicKey:N}),this.client.auth.pairingTopics.set(L,{topic:L,pairingTopic:A})]),await this.client.core.relayer.subscribe(L,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${A}`),m.length>0){const{namespace:x}=xg(a[0]);let C=bBe(x,"request",m);S5(E)&&(C=xBe(C,E.pop())),E.push(C)}const V=S&&S>Ti.wc_sessionAuthenticate.req.ttl?S:Ti.wc_sessionAuthenticate.req.ttl,I={authPayload:{type:h??"caip122",chains:a,statement:c,aud:l,domain:f,version:"1",nonce:u,iat:new Date().toISOString(),exp:g,nbf:y,resources:E},requester:{publicKey:N,metadata:this.client.metadata},expiryTimestamp:mi(V)},U={eip155:{chains:a,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},ie={requiredNamespaces:{},optionalNamespaces:U,relays:[{protocol:"irn"}],pairingTopic:A,proposer:{publicKey:N,metadata:this.client.metadata},expiryTimestamp:mi(Ti.wc_sessionPropose.req.ttl)},{done:ae,resolve:K,reject:R}=j0(V,"Request expired"),D=async({error:x,session:C})=>{if(this.events.off(Sr("session_request",b),v),x)R(x);else if(C){C.self.publicKey=N,await this.client.session.set(C.topic,C),await this.setExpiry(C.topic,C.expiry),A&&await this.client.core.pairing.updateMetadata({topic:A,metadata:C.peer.metadata});const w=this.client.session.get(C.topic);await this.deleteProposal(M),K({session:w})}},v=async x=>{var C,w,k;if(await this.deletePendingAuthRequest(b,{message:"fulfilled",code:0}),x.error){const Z=sn("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return x.error.code===Z.code?void 0:(this.events.off(Sr("session_connect"),D),R(x.error.message))}await this.deleteProposal(M),this.events.off(Sr("session_connect"),D);const{cacaos:O,responder:G}=x.result,oe=[],$=[];for(const Z of O){await dq({cacao:Z,projectId:this.client.core.projectId})||(this.client.logger.error(Z,"Signature verification failed"),R(sn("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:te}=Z,F=S5(te.resources),ee=[RT(te.iss)],fe=s8(te.iss);if(F){const xe=hq(F),_e=pq(F);oe.push(...xe),ee.push(..._e)}for(const xe of ee)$.push(`${xe}:${fe}`)}const X=await this.client.core.crypto.generateSharedKey(N,G.publicKey);let W;oe.length>0&&(W={topic:X,acknowledged:!0,self:{publicKey:N,metadata:this.client.metadata},peer:G,controller:G.publicKey,expiry:mi(mv),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:A,namespaces:Cq([...new Set(oe)],[...new Set($)]),transportType:o},await this.client.core.relayer.subscribe(X,{transportType:o}),await this.client.session.set(X,W),A&&await this.client.core.pairing.updateMetadata({topic:A,metadata:G.metadata}),W=this.client.session.get(X)),(C=this.client.metadata.redirect)!=null&&C.linkMode&&(w=G.metadata.redirect)!=null&&w.linkMode&&(k=G.metadata.redirect)!=null&&k.universal&&n&&(this.client.core.addLinkModeSupportedApp(G.metadata.redirect.universal),this.client.session.update(X,{transportType:gn.link_mode})),K({auths:O,session:W})},b=Td(),M=Td();this.events.once(Sr("session_connect"),D),this.events.once(Sr("session_request",b),v);let B;try{if(s){const x=rh("wc_sessionAuthenticate",I,b);this.client.core.history.set(A,x);const C=await this.client.core.crypto.encode("",x,{type:Sx,encoding:gb});B=m6(n,A,C)}else await Promise.all([this.sendRequest({topic:A,method:"wc_sessionAuthenticate",params:I,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:b}),this.sendRequest({topic:A,method:"wc_sessionPropose",params:ie,expiry:Ti.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:M})])}catch(x){throw this.events.off(Sr("session_connect"),D),this.events.off(Sr("session_request",b),v),x}return await this.setProposal(M,Vn({id:M},ie)),await this.setAuthRequest(b,{request:_c(Vn({},I),{verifyContext:{}}),pairingTopic:A,transportType:o}),{uri:B??P,response:ae}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[k0.authenticated_session_approve_started]}});try{this.isInitialized()}catch(S){throw s.setError(bb.no_internet_connection),S}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(bb.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||gn.relay;a===gn.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),f=_5(c),u={type:Cu,receiverPublicKey:c,senderPublicKey:l},h=[],g=[];for(const S of i){if(!await dq({cacao:S,projectId:this.client.core.projectId})){s.setError(bb.invalid_cacao);const L=sn("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:f,error:L,encodeOpts:u}),new Error(L.message)}s.addTrace(k0.cacaos_verified);const{p:E}=S,A=S5(E.resources),P=[RT(E.iss)],N=s8(E.iss);if(A){const L=hq(A),V=pq(A);h.push(...L),P.push(...V)}for(const L of P)g.push(`${L}:${N}`)}const y=await this.client.core.crypto.generateSharedKey(l,c);s.addTrace(k0.create_authenticated_session_topic);let m;if((h==null?void 0:h.length)>0){m={topic:y,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:mi(mv),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Cq([...new Set(h)],[...new Set(g)]),transportType:a},s.addTrace(k0.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(y,{transportType:a})}catch(S){throw s.setError(bb.subscribe_authenticated_session_topic_failure),S}s.addTrace(k0.subscribe_authenticated_session_topic_success),await this.client.session.set(y,m),s.addTrace(k0.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(k0.publishing_authenticated_session_approve);try{await this.sendResult({topic:f,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(S){throw s.setError(bb.authenticated_session_approve_publish_failure),S}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:m}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===gn.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=_5(o),l={type:Cu,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:c,error:i,encodeOpts:l,rpcOpts:Ti.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,sn("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return Rne(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:c}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,sn("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(dV).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,sn("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=vl.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(P0.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,sn("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=vl.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,mi(Ti.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=gn.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||mi(Ti.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:l,appLink:f}=r,u=rh(i,s,c);let h;const g=!!f;try{const S=g?gb:th;h=await this.client.core.crypto.encode(n,u,{encoding:S})}catch(S){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),S}let y;if(rqe.includes(i)){const S=Yf(JSON.stringify(u)),E=Yf(h);y=await this.client.core.verify.register({id:E,decryptedId:S})}const m=Ti[i].req;if(m.attestation=y,o&&(m.ttl=o),a&&(m.id=a),this.client.core.history.set(n,u),g){const S=m6(f,n,h);await global.Linking.openURL(S,this.client.name)}else{const S=Ti[i].req;o&&(S.ttl=o),a&&(S.id=a),l?(S.internal=_c(Vn({},S.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,h,S)):this.client.core.relayer.publish(n,h,S).catch(E=>this.client.logger.error(E))}return u.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=r,l=IC(n,s);let f;const u=c&&typeof(global==null?void 0:global.Linking)<"u";try{const g=u?gb:th;f=await this.client.core.crypto.encode(i,l,_c(Vn({},a||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),g}let h;try{h=await this.client.core.history.get(i,n)}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),g}if(u){const g=m6(c,i,f);await global.Linking.openURL(g,this.client.name)}else{const g=Ti[h.request.method].res;o?(g.internal=_c(Vn({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,f,g)):this.client.core.relayer.publish(i,f,g).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:c}=r,l=TC(n,s);let f;const u=c&&typeof(global==null?void 0:global.Linking)<"u";try{const g=u?gb:th;f=await this.client.core.crypto.encode(i,l,_c(Vn({},o||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),g}let h;try{h=await this.client.core.history.get(i,n)}catch(g){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),g}if(u){const g=m6(c,i,f);await global.Linking.openURL(g,this.client.name)}else{const g=a||Ti[h.request.method].res;this.client.core.relayer.publish(i,f,g)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;Id(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Id(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===vl.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=vl.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=vl.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,c=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=et("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:c}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(Vn({},i.params));const f=a.expiryTimestamp||mi(Ti.wc_sessionPropose.req.ttl),u=Vn({id:c,pairingTopic:n,expiryTimestamp:f},a);await this.setProposal(c,u);const h=await this.getVerifyContext({attestationId:s,hash:Yf(JSON.stringify(i)),encryptedId:o,metadata:u.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError($f.proposal_listener_not_found)),l==null||l.addTrace(bl.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:u,verifyContext:h})}catch(l){await this.sendError({id:c,topic:n,error:l,rpcOpts:Ti.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(xl(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const f=await this.client.core.crypto.generateSharedKey(c,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:f});const u=await this.client.core.relayer.subscribe(f,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:r})}else if(Ka(n)){await this.client.proposal.delete(s,sn("USER_DISCONNECTED"));const o=Sr("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(Sr("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:c,namespaces:l,sessionProperties:f,sessionConfig:u}=n.params,h=_c(Vn(Vn({topic:r,relay:o,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},f&&{sessionProperties:f}),u&&{sessionConfig:u}),{transportType:gn.relay}),g=Sr("session_connect");if(this.events.listenerCount(g)===0)throw new Error(`emitting ${g} without any listeners 997`);this.events.emit(Sr("session_connect"),{session:h}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;xl(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Sr("session_approve",i),{})):Ka(n)&&(await this.client.session.delete(r,sn("USER_DISCONNECTED")),this.events.emit(Sr("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=yb.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:sn("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Vn({topic:r},i));try{yb.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(c){throw yb.delete(o),c}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=Sr("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Sr("session_update",i),{}):Ka(n)&&this.events.emit(Sr("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,mi(mv)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=Sr("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Sr("session_extend",i),{}):Ka(n)&&this.events.emit(Sr("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=Sr("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{xl(n)?this.events.emit(Sr("session_ping",i),{}):Ka(n)&&this.events.emit(Sr("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(to.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:sn("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:c,encryptedId:l,transportType:f}=r,{id:u,params:h}=a;try{await this.isValidRequest(Vn({topic:o},h));const g=this.client.session.get(o),y=await this.getVerifyContext({attestationId:c,hash:Yf(JSON.stringify(rh("wc_sessionRequest",h,u))),encryptedId:l,metadata:g.peer.metadata,transportType:f}),m={id:u,topic:o,params:h,verifyContext:y};await this.setPendingSessionRequest(m),f===gn.link_mode&&(n=g.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=g.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(g){await this.sendError({id:u,topic:o,error:g}),this.client.logger.error(g)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=Sr("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Sr("session_request",i),{result:n.result}):Ka(n)&&this.events.emit(Sr("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=yb.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Vn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),yb.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),xl(n)?this.events.emit(Sr("session_request",i),{result:n.result}):Ka(n)&&this.events.emit(Sr("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:c}=r;try{const{requester:l,authPayload:f,expiryTimestamp:u}=s.params,h=await this.getVerifyContext({attestationId:o,hash:Yf(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:c}),g={requester:l,pairingTopic:i,id:s.id,authPayload:f,verifyContext:h,expiryTimestamp:u};await this.setAuthRequest(s.id,{request:g,pairingTopic:i,transportType:c}),c===gn.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:h})}catch(l){this.client.logger.error(l);const f=s.params.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=this.getAppLinkIfEnabled(s.params.requester.metadata,c),g={type:Cu,receiverPublicKey:f,senderPublicKey:u};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:g,rpcOpts:Ti.wc_sessionAuthenticate.autoReject,appLink:h})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=vl.idle,this.processSessionRequestQueue()},it.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=Sr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(Sr("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===vl.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=vl.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:rh("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!Ao(r)){const{message:c}=et("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(c)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(Ro(n)||await this.isValidPairingTopic(n),!fLe(a)){const{message:c}=et("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(c)}!Ro(i)&&pw(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!Ro(s)&&pw(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),Ro(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=lLe(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!Ao(r))throw new Error(et("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),c=s7(i,"approve()");if(c)throw new Error(c.message);const l=_q(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!ti(s,!0)){const{message:f}=et("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}Ro(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!Ao(r)){const{message:s}=et("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!dLe(i)){const{message:s}=et("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!Ao(r)){const{message:l}=et("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!jne(n)){const{message:l}=et("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=nLe(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=s7(s,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(Id(o)){const{message:l}=et("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!Ao(r)){const{message:c}=et("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(c)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=s7(i,"update()");if(o)throw new Error(o.message);const a=_q(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!Ao(r)){const{message:i}=et("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!Ao(r)){const{message:c}=et("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(c)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!Sq(a,s)){const{message:c}=et("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(c)}if(!hLe(i)){const{message:c}=et("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(c)}if(!gLe(a,s,i.method)){const{message:c}=et("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(c)}if(o&&!wLe(o,h7)){const{message:c}=et("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${h7.min} and ${h7.max}`);throw new Error(c)}},this.isValidRespond=async r=>{var n;if(!Ao(r)){const{message:o}=et("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!pLe(s)){const{message:o}=et("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!Ao(r)){const{message:i}=et("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!Ao(r)){const{message:a}=et("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!Sq(o,s)){const{message:a}=et("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!vLe(i)){const{message:a}=et("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!yLe(o,s,i.name)){const{message:a}=et("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!Ao(r)){const{message:i}=et("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!ti(i,!1))throw new Error("uri is required parameter");if(!ti(s,!1))throw new Error("domain is required parameter");if(!ti(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(c=>xg(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=xg(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,c={verified:{verifyUrl:o.verifyUrl||w2,validation:"UNKNOWN",origin:o.url||""}};try{if(a===gn.link_mode){const f=this.getAppLinkIfEnabled(o,a);return c.verified.validation=f&&new URL(f).origin===new URL(o.url).origin?"VALID":"INVALID",c}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(c.verified.origin=l.origin,c.verified.isScam=l.isScam,c.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!ti(i,!1)){const{message:s}=et("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=et("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,c,l,f,u,h;return!r||n!==gn.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:l.universal)!==""&&((f=r==null?void 0:r.redirect)==null?void 0:f.universal)!==void 0&&((u=r==null?void 0:r.redirect)==null?void 0:u.universal)!==""&&((h=r==null?void 0:r.redirect)==null?void 0:h.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=cq(r,"topic")||"",i=decodeURIComponent(cq(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:gn.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(SO()||Em()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(to.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(P5)?this.client.auth.authKeys.get(P5):{responseTopic:void 0,publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===gn.link_mode?gb:th});try{MO(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Yf(n)})):PC(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Ua.expired,async e=>{const{topic:r,id:n}=Pne(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,et("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,et("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(V0.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(V0.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!ti(e,!1)){const{message:r}=et("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=et("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Id(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=et("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!ti(e,!1)){const{message:r}=et("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=et("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Id(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=et("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=et("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(ti(e,!1)){const{message:r}=et("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=et("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!uLe(e)){const{message:r}=et("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=et("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Id(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=et("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class pqe extends Ip{constructor(e,r){super(e,r,Z$e,DO),this.core=e,this.logger=r}}let vqe=class extends Ip{constructor(e,r){super(e,r,X$e,DO),this.core=e,this.logger=r}};class gqe extends Ip{constructor(e,r){super(e,r,tqe,DO,n=>n.id),this.core=e,this.logger=r}}class yqe extends Ip{constructor(e,r){super(e,r,sqe,RC,()=>P5),this.core=e,this.logger=r}}class mqe extends Ip{constructor(e,r){super(e,r,oqe,RC),this.core=e,this.logger=r}}class bqe extends Ip{constructor(e,r){super(e,r,aqe,RC,n=>n.id),this.core=e,this.logger=r}}class wqe{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new yqe(this.core,this.logger),this.pairingTopics=new mqe(this.core,this.logger),this.requests=new bqe(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class MC extends zFe{constructor(e){super(e),this.protocol=pie,this.version=vie,this.name=d7.name,this.events=new wa.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||d7.name,this.metadata=(e==null?void 0:e.metadata)||Ane(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Ix(_C({level:(e==null?void 0:e.logger)||d7.logger}));this.core=(e==null?void 0:e.core)||new J$e(e),this.logger=uo(r,this.name),this.session=new vqe(this.core,this.logger),this.proposal=new pqe(this.core,this.logger),this.pendingRequest=new gqe(this.core,this.logger),this.engine=new hqe(this),this.auth=new wqe(this.core,this.logger)}static async init(e){const r=new MC(e);return await r.initialize(),r}get context(){return Uo(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var f8={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */f8.exports;(function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",l=500,f="__lodash_placeholder__",u=1,h=2,g=4,y=1,m=2,S=1,E=2,A=4,P=8,N=16,L=32,V=64,I=128,U=256,ie=512,ae=30,K="...",R=800,D=16,v=1,b=2,M=3,B=1/0,x=9007199254740991,C=17976931348623157e292,w=NaN,k=4294967295,O=k-1,G=k>>>1,oe=[["ary",I],["bind",S],["bindKey",E],["curry",P],["curryRight",N],["flip",ie],["partial",L],["partialRight",V],["rearg",U]],$="[object Arguments]",X="[object Array]",W="[object AsyncFunction]",Z="[object Boolean]",te="[object Date]",F="[object DOMException]",ee="[object Error]",fe="[object Function]",xe="[object GeneratorFunction]",_e="[object Map]",Me="[object Number]",Ke="[object Null]",ze="[object Object]",Je="[object Promise]",Xe="[object Proxy]",lt="[object RegExp]",Re="[object Set]",$e="[object String]",st="[object Symbol]",Qe="[object Undefined]",ct="[object WeakMap]",tt="[object WeakSet]",He="[object ArrayBuffer]",at="[object DataView]",pt="[object Float32Array]",Ge="[object Float64Array]",vt="[object Int8Array]",bt="[object Int16Array]",Ze="[object Int32Array]",_t="[object Uint8Array]",Ct="[object Uint8ClampedArray]",It="[object Uint16Array]",er="[object Uint32Array]",dr=/\b__p \+= '';/g,wt=/\b(__p \+=) '' \+/g,lr=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ir=/&(?:amp|lt|gt|quot|#39);/g,Pt=/[&<>"']/g,Dt=RegExp(ir.source),Nt=RegExp(Pt.source),dt=/<%-([\s\S]+?)%>/g,Lt=/<%([\s\S]+?)%>/g,kt=/<%=([\s\S]+?)%>/g,ut=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vt=/^\w*$/,zt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ht=/[\\^$.*+?()[\]{}|]/g,xt=RegExp(ht.source),Bt=/^\s+/,Ve=/\s/,$t=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Et=/\{\n\/\* \[wrapped with (.+)\] \*/,ot=/,? & /,Ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Nr=/[()=,{}\[\]\/\s]/,Ut=/\\(\\)?/g,Pr=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,tr=/\w*$/,Or=/^[-+]0x[0-9a-f]+$/i,pi=/^0b[01]+$/i,vi=/^\[object .+?Constructor\]$/,gi=/^0o[0-7]+$/i,_i=/^(?:0|[1-9]\d*)$/,Tn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ps=/($^)/,vs=/['\n\r\u2028\u2029\\]/g,gs="\\ud800-\\udfff",Hi="\\u0300-\\u036f",ys="\\ufe20-\\ufe2f",ms="\\u20d0-\\u20ff",qs=Hi+ys+ms,ho="\\u2700-\\u27bf",Pn="a-z\\xdf-\\xf6\\xf8-\\xff",Gi="\\xac\\xb1\\xd7\\xf7",po="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Vs="\\u2000-\\u206f",gf=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",nl="A-Z\\xc0-\\xd6\\xd8-\\xde",Pp="\\ufe0e\\ufe0f",yf=Gi+po+Vs+gf,mf="['’]",bf="["+gs+"]",r0="["+yf+"]",wf="["+qs+"]",kp="\\d+",Qu="["+ho+"]",n0="["+Pn+"]",Rp="[^"+gs+yf+kp+ho+Pn+nl+"]",vc="\\ud83c[\\udffb-\\udfff]",Mp="(?:"+wf+"|"+vc+")",mr="[^"+gs+"]",Ju="(?:\\ud83c[\\udde6-\\uddff]){2}",il="[\\ud800-\\udbff][\\udc00-\\udfff]",xn="["+nl+"]",Op="\\u200d",i0="(?:"+n0+"|"+Rp+")",qo="(?:"+xn+"|"+Rp+")",xf="(?:"+mf+"(?:d|ll|m|re|s|t|ve))?",Dp="(?:"+mf+"(?:D|LL|M|RE|S|T|VE))?",Zu=Mp+"?",Np="["+Pp+"]?",s0="(?:"+Op+"(?:"+[mr,Ju,il].join("|")+")"+Np+Zu+")*",gc="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",o0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Bp=Np+Zu+s0,sl="(?:"+[Qu,Ju,il].join("|")+")"+Bp,Vo="(?:"+[mr+wf+"?",wf,Ju,il,bf].join("|")+")",Ef=RegExp(mf,"g"),Sm=RegExp(wf,"g"),Xu=RegExp(vc+"(?="+vc+")|"+Vo+Bp,"g"),vo=RegExp([xn+"?"+n0+"+"+xf+"(?="+[r0,xn,"$"].join("|")+")",qo+"+"+Dp+"(?="+[r0,xn+i0,"$"].join("|")+")",xn+"?"+i0+"+"+xf,xn+"+"+Dp,o0,gc,kp,sl].join("|"),"g"),a0=RegExp("["+Op+gs+qs+Pp+"]"),Cf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Lp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],_m=-1,Hr={};Hr[pt]=Hr[Ge]=Hr[vt]=Hr[bt]=Hr[Ze]=Hr[_t]=Hr[Ct]=Hr[It]=Hr[er]=!0,Hr[$]=Hr[X]=Hr[He]=Hr[Z]=Hr[at]=Hr[te]=Hr[ee]=Hr[fe]=Hr[_e]=Hr[Me]=Hr[ze]=Hr[lt]=Hr[Re]=Hr[$e]=Hr[ct]=!1;var Yr={};Yr[$]=Yr[X]=Yr[He]=Yr[at]=Yr[Z]=Yr[te]=Yr[pt]=Yr[Ge]=Yr[vt]=Yr[bt]=Yr[Ze]=Yr[_e]=Yr[Me]=Yr[ze]=Yr[lt]=Yr[Re]=Yr[$e]=Yr[st]=Yr[_t]=Yr[Ct]=Yr[It]=Yr[er]=!0,Yr[ee]=Yr[fe]=Yr[ct]=!1;var le={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Ee={"&":"&","<":"<",">":">",'"':""","'":"'"},Ue={"&":"&","<":"<",">":">",""":'"',"'":"'"},gt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},tn=parseFloat,rr=parseInt,hn=typeof xi=="object"&&xi&&xi.Object===Object&&xi,Un=typeof self=="object"&&self&&self.Object===Object&&self,Cr=hn||Un||Function("return this")(),rn=e&&!e.nodeType&&e,pn=rn&&!0&&t&&!t.nodeType&&t,bs=pn&&pn.exports===rn,Rn=bs&&hn.process,cn=function(){try{var we=pn&&pn.require&&pn.require("util").types;return we||Rn&&Rn.binding&&Rn.binding("util")}catch{}}(),Wi=cn&&cn.isArrayBuffer,zo=cn&&cn.isDate,zs=cn&&cn.isMap,Aa=cn&&cn.isRegExp,c0=cn&&cn.isSet,Af=cn&&cn.isTypedArray;function li(we,Oe,Pe){switch(Pe.length){case 0:return we.call(Oe);case 1:return we.call(Oe,Pe[0]);case 2:return we.call(Oe,Pe[0],Pe[1]);case 3:return we.call(Oe,Pe[0],Pe[1],Pe[2])}return we.apply(Oe,Pe)}function NC(we,Oe,Pe,mt){for(var Xt=-1,Lr=we==null?0:we.length;++Xt-1}function Im(we,Oe,Pe){for(var mt=-1,Xt=we==null?0:we.length;++mt-1;);return Pe}function Lx(we,Oe){for(var Pe=we.length;Pe--&&ed(Oe,we[Pe],0)>-1;);return Pe}function zC(we,Oe){for(var Pe=we.length,mt=0;Pe--;)we[Pe]===Oe&&++mt;return mt}var HC=km(le),GC=km(Ee);function WC(we){return"\\"+gt[we]}function KC(we,Oe){return we==null?r:we[Oe]}function Qr(we){return a0.test(we)}function Fx(we){return Cf.test(we)}function yc(we){for(var Oe,Pe=[];!(Oe=we.next()).done;)Pe.push(Oe.value);return Pe}function u0(we){var Oe=-1,Pe=Array(we.size);return we.forEach(function(mt,Xt){Pe[++Oe]=[Xt,mt]}),Pe}function Om(we,Oe){return function(Pe){return we(Oe(Pe))}}function nr(we,Oe){for(var Pe=-1,mt=we.length,Xt=0,Lr=[];++Pe-1}function Sse(d,p){var _=this.__data__,q=Yx(_,d);return q<0?(++this.size,_.push([d,p])):_[q][1]=p,this}If.prototype.clear=xse,If.prototype.delete=Ese,If.prototype.get=Cse,If.prototype.has=Ase,If.prototype.set=Sse;function Tf(d){var p=-1,_=d==null?0:d.length;for(this.clear();++p<_;){var q=d[p];this.set(q[0],q[1])}}function _se(){this.size=0,this.__data__={hash:new g0,map:new(Gs||If),string:new g0}}function Ise(d){var p=a3(this,d).delete(d);return this.size-=p?1:0,p}function Tse(d){return a3(this,d).get(d)}function Pse(d){return a3(this,d).has(d)}function kse(d,p){var _=a3(this,d),q=_.size;return _.set(d,p),this.size+=_.size==q?0:1,this}Tf.prototype.clear=_se,Tf.prototype.delete=Ise,Tf.prototype.get=Tse,Tf.prototype.has=Pse,Tf.prototype.set=kse;function y0(d){var p=-1,_=d==null?0:d.length;for(this.__data__=new Tf;++p<_;)this.add(d[p])}function Rse(d){return this.__data__.set(d,c),this}function Mse(d){return this.__data__.has(d)}y0.prototype.add=y0.prototype.push=Rse,y0.prototype.has=Mse;function bc(d){var p=this.__data__=new If(d);this.size=p.size}function Ose(){this.__data__=new If,this.size=0}function Dse(d){var p=this.__data__,_=p.delete(d);return this.size=p.size,_}function Nse(d){return this.__data__.get(d)}function Bse(d){return this.__data__.has(d)}function Lse(d,p){var _=this.__data__;if(_ instanceof If){var q=_.__data__;if(!Gs||q.length=p?d:p)),d}function _a(d,p,_,q,J,se){var he,me=p&u,Ce=p&h,Be=p&g;if(_&&(he=J?_(d,q,J,se):_(d)),he!==r)return he;if(!On(d))return d;var Le=sr(d);if(Le){if(he=Poe(d),!me)return bo(d,he)}else{var qe=ws(d),ft=qe==fe||qe==xe;if(dd(d))return yD(d,me);if(qe==ze||qe==$||ft&&!J){if(he=Ce||ft?{}:BD(d),!me)return Ce?moe(d,$se(he,d)):yoe(d,WO(he,d))}else{if(!Yr[qe])return J?d:{};he=koe(d,qe,me)}}se||(se=new bc);var Rt=se.get(d);if(Rt)return Rt;se.set(d,he),uN(d)?d.forEach(function(Qt){he.add(_a(Qt,p,_,Qt,d,se))}):lN(d)&&d.forEach(function(Qt,Ar){he.set(Ar,_a(Qt,p,_,Ar,d,se))});var Yt=Be?Ce?_A:SA:Ce?xo:Ii,gr=Le?r:Yt(d);return go(gr||d,function(Qt,Ar){gr&&(Ar=Qt,Qt=d[Ar]),Fm(he,Ar,_a(Qt,p,_,Ar,d,se))}),he}function qse(d){var p=Ii(d);return function(_){return KO(_,d,p)}}function KO(d,p,_){var q=_.length;if(d==null)return!q;for(d=nn(d);q--;){var J=_[q],se=p[J],he=d[J];if(he===r&&!(J in d)||!se(he))return!1}return!0}function YO(d,p,_){if(typeof d!="function")throw new mo(o);return Hm(function(){d.apply(r,_)},p)}function jm(d,p,_,q){var J=-1,se=Fp,he=!0,me=d.length,Ce=[],Be=p.length;if(!me)return Ce;_&&(p=ln(p,Hs(_))),q?(se=Im,he=!1):p.length>=i&&(se=f0,he=!1,p=new y0(p));e:for(;++JJ?0:J+_),q=q===r||q>J?J:pr(q),q<0&&(q+=J),q=_>q?0:hN(q);_0&&_(me)?p>1?Ki(me,p-1,_,q,J):al(J,me):q||(J[J.length]=me)}return J}var aA=CD(),ZO=CD(!0);function ll(d,p){return d&&aA(d,p,Ii)}function cA(d,p){return d&&ZO(d,p,Ii)}function Jx(d,p){return ol(p,function(_){return Of(d[_])})}function b0(d,p){p=fd(p,d);for(var _=0,q=p.length;d!=null&&_p}function Hse(d,p){return d!=null&&Gr.call(d,p)}function Gse(d,p){return d!=null&&p in nn(d)}function Wse(d,p,_){return d>=hr(p,_)&&d=120&&Le.length>=120)?new y0(he&&Le):r}Le=d[0];var qe=-1,ft=me[0];e:for(;++qe-1;)me!==d&&p0.call(me,Ce,1),p0.call(d,Ce,1);return d}function lD(d,p){for(var _=d?p.length:0,q=_-1;_--;){var J=p[_];if(_==q||J!==se){var se=J;Mf(J)?p0.call(d,J,1):mA(d,J)}}return d}function vA(d,p){return d+Ae(Mn()*(p-d+1))}function ooe(d,p,_,q){for(var J=-1,se=Gt(Se((p-d)/(_||1)),0),he=Pe(se);se--;)he[q?se:++J]=d,d+=_;return he}function gA(d,p){var _="";if(!d||p<1||p>x)return _;do p%2&&(_+=d),p=Ae(p/2),p&&(d+=d);while(p);return _}function br(d,p){return OA(jD(d,p,Eo),d+"")}function aoe(d){return GO(ev(d))}function coe(d,p){var _=ev(d);return c3(_,m0(p,0,_.length))}function qm(d,p,_,q){if(!On(d))return d;p=fd(p,d);for(var J=-1,se=p.length,he=se-1,me=d;me!=null&&++JJ?0:J+p),_=_>J?J:_,_<0&&(_+=J),J=p>_?0:_-p>>>0,p>>>=0;for(var se=Pe(J);++q>>1,he=d[se];he!==null&&!Go(he)&&(_?he<=p:he=i){var Be=p?null:Eoe(d);if(Be)return d0(Be);he=!1,J=f0,Ce=new y0}else Ce=p?[]:me;e:for(;++q=q?d:Ia(d,p,_)}var gD=ce||function(d){return Cr.clearTimeout(d)};function yD(d,p){if(p)return d.slice();var _=d.length,q=zx?zx(_):new d.constructor(_);return d.copy(q),q}function EA(d){var p=new d.constructor(d.byteLength);return new Gp(p).set(new Gp(d)),p}function hoe(d,p){var _=p?EA(d.buffer):d.buffer;return new d.constructor(_,d.byteOffset,d.byteLength)}function poe(d){var p=new d.constructor(d.source,tr.exec(d));return p.lastIndex=d.lastIndex,p}function voe(d){return Lm?nn(Lm.call(d)):{}}function mD(d,p){var _=p?EA(d.buffer):d.buffer;return new d.constructor(_,d.byteOffset,d.length)}function bD(d,p){if(d!==p){var _=d!==r,q=d===null,J=d===d,se=Go(d),he=p!==r,me=p===null,Ce=p===p,Be=Go(p);if(!me&&!Be&&!se&&d>p||se&&he&&Ce&&!me&&!Be||q&&he&&Ce||!_&&Ce||!J)return 1;if(!q&&!se&&!Be&&d=me)return Ce;var Be=_[q];return Ce*(Be=="desc"?-1:1)}}return d.index-p.index}function wD(d,p,_,q){for(var J=-1,se=d.length,he=_.length,me=-1,Ce=p.length,Be=Gt(se-he,0),Le=Pe(Ce+Be),qe=!q;++me1?_[J-1]:r,he=J>2?_[2]:r;for(se=d.length>3&&typeof se=="function"?(J--,se):r,he&&Ks(_[0],_[1],he)&&(se=J<3?r:se,J=1),p=nn(p);++q-1?J[se?p[he]:he]:r}}function _D(d){return Rf(function(p){var _=p.length,q=_,J=Sa.prototype.thru;for(d&&p.reverse();q--;){var se=p[q];if(typeof se!="function")throw new mo(o);if(J&&!he&&o3(se)=="wrapper")var he=new Sa([],!0)}for(q=he?q:_;++q<_;){se=p[q];var me=o3(se),Ce=me=="wrapper"?IA(se):r;Ce&&RA(Ce[0])&&Ce[1]==(I|P|L|U)&&!Ce[4].length&&Ce[9]==1?he=he[o3(Ce[0])].apply(he,Ce[3]):he=se.length==1&&RA(se)?he[me]():he.thru(se)}return function(){var Be=arguments,Le=Be[0];if(he&&Be.length==1&&sr(Le))return he.plant(Le).value();for(var qe=0,ft=_?p[qe].apply(this,Be):Le;++qe<_;)ft=p[qe].call(this,ft);return ft}})}function r3(d,p,_,q,J,se,he,me,Ce,Be){var Le=p&I,qe=p&S,ft=p&E,Rt=p&(P|N),Yt=p&ie,gr=ft?r:Vm(d);function Qt(){for(var Ar=arguments.length,Dr=Pe(Ar),Wo=Ar;Wo--;)Dr[Wo]=arguments[Wo];if(Rt)var Ys=Zp(Qt),Ko=zC(Dr,Ys);if(q&&(Dr=wD(Dr,q,J,Rt)),se&&(Dr=xD(Dr,se,he,Rt)),Ar-=Ko,Rt&&Ar1&&Dr.reverse(),Le&&Ceme))return!1;var Be=se.get(d),Le=se.get(p);if(Be&&Le)return Be==p&&Le==d;var qe=-1,ft=!0,Rt=_&m?new y0:r;for(se.set(d,p),se.set(p,d);++qe1?"& ":"")+p[q],p=p.join(_>2?", ":" "),d.replace($t,`{ + */f8.exports;(function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",l=500,f="__lodash_placeholder__",u=1,h=2,g=4,y=1,m=2,S=1,E=2,A=4,P=8,N=16,L=32,V=64,I=128,U=256,ie=512,ae=30,K="...",R=800,D=16,v=1,b=2,M=3,B=1/0,x=9007199254740991,C=17976931348623157e292,w=NaN,k=4294967295,O=k-1,G=k>>>1,oe=[["ary",I],["bind",S],["bindKey",E],["curry",P],["curryRight",N],["flip",ie],["partial",L],["partialRight",V],["rearg",U]],$="[object Arguments]",X="[object Array]",W="[object AsyncFunction]",Z="[object Boolean]",te="[object Date]",F="[object DOMException]",ee="[object Error]",fe="[object Function]",xe="[object GeneratorFunction]",_e="[object Map]",Me="[object Number]",Ke="[object Null]",ze="[object Object]",Je="[object Promise]",Xe="[object Proxy]",lt="[object RegExp]",Re="[object Set]",$e="[object String]",st="[object Symbol]",Qe="[object Undefined]",ct="[object WeakMap]",tt="[object WeakSet]",He="[object ArrayBuffer]",at="[object DataView]",pt="[object Float32Array]",Ge="[object Float64Array]",vt="[object Int8Array]",bt="[object Int16Array]",Ze="[object Int32Array]",_t="[object Uint8Array]",Ct="[object Uint8ClampedArray]",It="[object Uint16Array]",er="[object Uint32Array]",dr=/\b__p \+= '';/g,wt=/\b(__p \+=) '' \+/g,lr=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ir=/&(?:amp|lt|gt|quot|#39);/g,Pt=/[&<>"']/g,Dt=RegExp(ir.source),Nt=RegExp(Pt.source),dt=/<%-([\s\S]+?)%>/g,Lt=/<%([\s\S]+?)%>/g,kt=/<%=([\s\S]+?)%>/g,ut=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zt=/^\w*$/,Ht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ht=/[\\^$.*+?()[\]{}|]/g,xt=RegExp(ht.source),Bt=/^\s+/,Ve=/\s/,$t=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Et=/\{\n\/\* \[wrapped with (.+)\] \*/,ot=/,? & /,Gt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Nr=/[()=,{}\[\]\/\s]/,Ut=/\\(\\)?/g,Pr=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,tr=/\w*$/,Or=/^[-+]0x[0-9a-f]+$/i,pi=/^0b[01]+$/i,vi=/^\[object .+?Constructor\]$/,gi=/^0o[0-7]+$/i,_i=/^(?:0|[1-9]\d*)$/,Tn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ps=/($^)/,vs=/['\n\r\u2028\u2029\\]/g,gs="\\ud800-\\udfff",Hi="\\u0300-\\u036f",ys="\\ufe20-\\ufe2f",ms="\\u20d0-\\u20ff",qs=Hi+ys+ms,ho="\\u2700-\\u27bf",Pn="a-z\\xdf-\\xf6\\xf8-\\xff",Gi="\\xac\\xb1\\xd7\\xf7",po="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Vs="\\u2000-\\u206f",gf=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",nl="A-Z\\xc0-\\xd6\\xd8-\\xde",Pp="\\ufe0e\\ufe0f",yf=Gi+po+Vs+gf,mf="['’]",bf="["+gs+"]",r0="["+yf+"]",wf="["+qs+"]",kp="\\d+",Qu="["+ho+"]",n0="["+Pn+"]",Rp="[^"+gs+yf+kp+ho+Pn+nl+"]",vc="\\ud83c[\\udffb-\\udfff]",Mp="(?:"+wf+"|"+vc+")",mr="[^"+gs+"]",Ju="(?:\\ud83c[\\udde6-\\uddff]){2}",il="[\\ud800-\\udbff][\\udc00-\\udfff]",xn="["+nl+"]",Op="\\u200d",i0="(?:"+n0+"|"+Rp+")",qo="(?:"+xn+"|"+Rp+")",xf="(?:"+mf+"(?:d|ll|m|re|s|t|ve))?",Dp="(?:"+mf+"(?:D|LL|M|RE|S|T|VE))?",Zu=Mp+"?",Np="["+Pp+"]?",s0="(?:"+Op+"(?:"+[mr,Ju,il].join("|")+")"+Np+Zu+")*",gc="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",o0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Bp=Np+Zu+s0,sl="(?:"+[Qu,Ju,il].join("|")+")"+Bp,Vo="(?:"+[mr+wf+"?",wf,Ju,il,bf].join("|")+")",Ef=RegExp(mf,"g"),Sm=RegExp(wf,"g"),Xu=RegExp(vc+"(?="+vc+")|"+Vo+Bp,"g"),vo=RegExp([xn+"?"+n0+"+"+xf+"(?="+[r0,xn,"$"].join("|")+")",qo+"+"+Dp+"(?="+[r0,xn+i0,"$"].join("|")+")",xn+"?"+i0+"+"+xf,xn+"+"+Dp,o0,gc,kp,sl].join("|"),"g"),a0=RegExp("["+Op+gs+qs+Pp+"]"),Cf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Lp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],_m=-1,Hr={};Hr[pt]=Hr[Ge]=Hr[vt]=Hr[bt]=Hr[Ze]=Hr[_t]=Hr[Ct]=Hr[It]=Hr[er]=!0,Hr[$]=Hr[X]=Hr[He]=Hr[Z]=Hr[at]=Hr[te]=Hr[ee]=Hr[fe]=Hr[_e]=Hr[Me]=Hr[ze]=Hr[lt]=Hr[Re]=Hr[$e]=Hr[ct]=!1;var Yr={};Yr[$]=Yr[X]=Yr[He]=Yr[at]=Yr[Z]=Yr[te]=Yr[pt]=Yr[Ge]=Yr[vt]=Yr[bt]=Yr[Ze]=Yr[_e]=Yr[Me]=Yr[ze]=Yr[lt]=Yr[Re]=Yr[$e]=Yr[st]=Yr[_t]=Yr[Ct]=Yr[It]=Yr[er]=!0,Yr[ee]=Yr[fe]=Yr[ct]=!1;var le={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Ee={"&":"&","<":"<",">":">",'"':""","'":"'"},Ue={"&":"&","<":"<",">":">",""":'"',"'":"'"},gt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},tn=parseFloat,rr=parseInt,hn=typeof xi=="object"&&xi&&xi.Object===Object&&xi,Un=typeof self=="object"&&self&&self.Object===Object&&self,Cr=hn||Un||Function("return this")(),rn=e&&!e.nodeType&&e,pn=rn&&!0&&t&&!t.nodeType&&t,bs=pn&&pn.exports===rn,Rn=bs&&hn.process,cn=function(){try{var we=pn&&pn.require&&pn.require("util").types;return we||Rn&&Rn.binding&&Rn.binding("util")}catch{}}(),Wi=cn&&cn.isArrayBuffer,zo=cn&&cn.isDate,zs=cn&&cn.isMap,Aa=cn&&cn.isRegExp,c0=cn&&cn.isSet,Af=cn&&cn.isTypedArray;function li(we,Oe,Pe){switch(Pe.length){case 0:return we.call(Oe);case 1:return we.call(Oe,Pe[0]);case 2:return we.call(Oe,Pe[0],Pe[1]);case 3:return we.call(Oe,Pe[0],Pe[1],Pe[2])}return we.apply(Oe,Pe)}function NC(we,Oe,Pe,mt){for(var Xt=-1,Lr=we==null?0:we.length;++Xt-1}function Im(we,Oe,Pe){for(var mt=-1,Xt=we==null?0:we.length;++mt-1;);return Pe}function Lx(we,Oe){for(var Pe=we.length;Pe--&&ed(Oe,we[Pe],0)>-1;);return Pe}function zC(we,Oe){for(var Pe=we.length,mt=0;Pe--;)we[Pe]===Oe&&++mt;return mt}var HC=km(le),GC=km(Ee);function WC(we){return"\\"+gt[we]}function KC(we,Oe){return we==null?r:we[Oe]}function Qr(we){return a0.test(we)}function Fx(we){return Cf.test(we)}function yc(we){for(var Oe,Pe=[];!(Oe=we.next()).done;)Pe.push(Oe.value);return Pe}function u0(we){var Oe=-1,Pe=Array(we.size);return we.forEach(function(mt,Xt){Pe[++Oe]=[Xt,mt]}),Pe}function Om(we,Oe){return function(Pe){return we(Oe(Pe))}}function nr(we,Oe){for(var Pe=-1,mt=we.length,Xt=0,Lr=[];++Pe-1}function Sse(d,p){var _=this.__data__,q=Yx(_,d);return q<0?(++this.size,_.push([d,p])):_[q][1]=p,this}If.prototype.clear=xse,If.prototype.delete=Ese,If.prototype.get=Cse,If.prototype.has=Ase,If.prototype.set=Sse;function Tf(d){var p=-1,_=d==null?0:d.length;for(this.clear();++p<_;){var q=d[p];this.set(q[0],q[1])}}function _se(){this.size=0,this.__data__={hash:new g0,map:new(Gs||If),string:new g0}}function Ise(d){var p=a3(this,d).delete(d);return this.size-=p?1:0,p}function Tse(d){return a3(this,d).get(d)}function Pse(d){return a3(this,d).has(d)}function kse(d,p){var _=a3(this,d),q=_.size;return _.set(d,p),this.size+=_.size==q?0:1,this}Tf.prototype.clear=_se,Tf.prototype.delete=Ise,Tf.prototype.get=Tse,Tf.prototype.has=Pse,Tf.prototype.set=kse;function y0(d){var p=-1,_=d==null?0:d.length;for(this.__data__=new Tf;++p<_;)this.add(d[p])}function Rse(d){return this.__data__.set(d,c),this}function Mse(d){return this.__data__.has(d)}y0.prototype.add=y0.prototype.push=Rse,y0.prototype.has=Mse;function bc(d){var p=this.__data__=new If(d);this.size=p.size}function Ose(){this.__data__=new If,this.size=0}function Dse(d){var p=this.__data__,_=p.delete(d);return this.size=p.size,_}function Nse(d){return this.__data__.get(d)}function Bse(d){return this.__data__.has(d)}function Lse(d,p){var _=this.__data__;if(_ instanceof If){var q=_.__data__;if(!Gs||q.length=p?d:p)),d}function _a(d,p,_,q,J,se){var he,me=p&u,Ce=p&h,Be=p&g;if(_&&(he=J?_(d,q,J,se):_(d)),he!==r)return he;if(!On(d))return d;var Le=sr(d);if(Le){if(he=Poe(d),!me)return bo(d,he)}else{var qe=ws(d),ft=qe==fe||qe==xe;if(dd(d))return yD(d,me);if(qe==ze||qe==$||ft&&!J){if(he=Ce||ft?{}:BD(d),!me)return Ce?moe(d,$se(he,d)):yoe(d,WO(he,d))}else{if(!Yr[qe])return J?d:{};he=koe(d,qe,me)}}se||(se=new bc);var Rt=se.get(d);if(Rt)return Rt;se.set(d,he),uN(d)?d.forEach(function(Qt){he.add(_a(Qt,p,_,Qt,d,se))}):lN(d)&&d.forEach(function(Qt,Ar){he.set(Ar,_a(Qt,p,_,Ar,d,se))});var Yt=Be?Ce?_A:SA:Ce?xo:Ii,gr=Le?r:Yt(d);return go(gr||d,function(Qt,Ar){gr&&(Ar=Qt,Qt=d[Ar]),Fm(he,Ar,_a(Qt,p,_,Ar,d,se))}),he}function qse(d){var p=Ii(d);return function(_){return KO(_,d,p)}}function KO(d,p,_){var q=_.length;if(d==null)return!q;for(d=nn(d);q--;){var J=_[q],se=p[J],he=d[J];if(he===r&&!(J in d)||!se(he))return!1}return!0}function YO(d,p,_){if(typeof d!="function")throw new mo(o);return Hm(function(){d.apply(r,_)},p)}function jm(d,p,_,q){var J=-1,se=Fp,he=!0,me=d.length,Ce=[],Be=p.length;if(!me)return Ce;_&&(p=ln(p,Hs(_))),q?(se=Im,he=!1):p.length>=i&&(se=f0,he=!1,p=new y0(p));e:for(;++JJ?0:J+_),q=q===r||q>J?J:pr(q),q<0&&(q+=J),q=_>q?0:hN(q);_0&&_(me)?p>1?Ki(me,p-1,_,q,J):al(J,me):q||(J[J.length]=me)}return J}var aA=CD(),ZO=CD(!0);function ll(d,p){return d&&aA(d,p,Ii)}function cA(d,p){return d&&ZO(d,p,Ii)}function Jx(d,p){return ol(p,function(_){return Of(d[_])})}function b0(d,p){p=fd(p,d);for(var _=0,q=p.length;d!=null&&_p}function Hse(d,p){return d!=null&&Gr.call(d,p)}function Gse(d,p){return d!=null&&p in nn(d)}function Wse(d,p,_){return d>=hr(p,_)&&d=120&&Le.length>=120)?new y0(he&&Le):r}Le=d[0];var qe=-1,ft=me[0];e:for(;++qe-1;)me!==d&&p0.call(me,Ce,1),p0.call(d,Ce,1);return d}function lD(d,p){for(var _=d?p.length:0,q=_-1;_--;){var J=p[_];if(_==q||J!==se){var se=J;Mf(J)?p0.call(d,J,1):mA(d,J)}}return d}function vA(d,p){return d+Ae(Mn()*(p-d+1))}function ooe(d,p,_,q){for(var J=-1,se=Wt(Se((p-d)/(_||1)),0),he=Pe(se);se--;)he[q?se:++J]=d,d+=_;return he}function gA(d,p){var _="";if(!d||p<1||p>x)return _;do p%2&&(_+=d),p=Ae(p/2),p&&(d+=d);while(p);return _}function br(d,p){return OA(jD(d,p,Eo),d+"")}function aoe(d){return GO(ev(d))}function coe(d,p){var _=ev(d);return c3(_,m0(p,0,_.length))}function qm(d,p,_,q){if(!On(d))return d;p=fd(p,d);for(var J=-1,se=p.length,he=se-1,me=d;me!=null&&++JJ?0:J+p),_=_>J?J:_,_<0&&(_+=J),J=p>_?0:_-p>>>0,p>>>=0;for(var se=Pe(J);++q>>1,he=d[se];he!==null&&!Go(he)&&(_?he<=p:he=i){var Be=p?null:Eoe(d);if(Be)return d0(Be);he=!1,J=f0,Ce=new y0}else Ce=p?[]:me;e:for(;++q=q?d:Ia(d,p,_)}var gD=ce||function(d){return Cr.clearTimeout(d)};function yD(d,p){if(p)return d.slice();var _=d.length,q=zx?zx(_):new d.constructor(_);return d.copy(q),q}function EA(d){var p=new d.constructor(d.byteLength);return new Gp(p).set(new Gp(d)),p}function hoe(d,p){var _=p?EA(d.buffer):d.buffer;return new d.constructor(_,d.byteOffset,d.byteLength)}function poe(d){var p=new d.constructor(d.source,tr.exec(d));return p.lastIndex=d.lastIndex,p}function voe(d){return Lm?nn(Lm.call(d)):{}}function mD(d,p){var _=p?EA(d.buffer):d.buffer;return new d.constructor(_,d.byteOffset,d.length)}function bD(d,p){if(d!==p){var _=d!==r,q=d===null,J=d===d,se=Go(d),he=p!==r,me=p===null,Ce=p===p,Be=Go(p);if(!me&&!Be&&!se&&d>p||se&&he&&Ce&&!me&&!Be||q&&he&&Ce||!_&&Ce||!J)return 1;if(!q&&!se&&!Be&&d=me)return Ce;var Be=_[q];return Ce*(Be=="desc"?-1:1)}}return d.index-p.index}function wD(d,p,_,q){for(var J=-1,se=d.length,he=_.length,me=-1,Ce=p.length,Be=Wt(se-he,0),Le=Pe(Ce+Be),qe=!q;++me1?_[J-1]:r,he=J>2?_[2]:r;for(se=d.length>3&&typeof se=="function"?(J--,se):r,he&&Ks(_[0],_[1],he)&&(se=J<3?r:se,J=1),p=nn(p);++q-1?J[se?p[he]:he]:r}}function _D(d){return Rf(function(p){var _=p.length,q=_,J=Sa.prototype.thru;for(d&&p.reverse();q--;){var se=p[q];if(typeof se!="function")throw new mo(o);if(J&&!he&&o3(se)=="wrapper")var he=new Sa([],!0)}for(q=he?q:_;++q<_;){se=p[q];var me=o3(se),Ce=me=="wrapper"?IA(se):r;Ce&&RA(Ce[0])&&Ce[1]==(I|P|L|U)&&!Ce[4].length&&Ce[9]==1?he=he[o3(Ce[0])].apply(he,Ce[3]):he=se.length==1&&RA(se)?he[me]():he.thru(se)}return function(){var Be=arguments,Le=Be[0];if(he&&Be.length==1&&sr(Le))return he.plant(Le).value();for(var qe=0,ft=_?p[qe].apply(this,Be):Le;++qe<_;)ft=p[qe].call(this,ft);return ft}})}function r3(d,p,_,q,J,se,he,me,Ce,Be){var Le=p&I,qe=p&S,ft=p&E,Rt=p&(P|N),Yt=p&ie,gr=ft?r:Vm(d);function Qt(){for(var Ar=arguments.length,Dr=Pe(Ar),Wo=Ar;Wo--;)Dr[Wo]=arguments[Wo];if(Rt)var Ys=Zp(Qt),Ko=zC(Dr,Ys);if(q&&(Dr=wD(Dr,q,J,Rt)),se&&(Dr=xD(Dr,se,he,Rt)),Ar-=Ko,Rt&&Ar1&&Dr.reverse(),Le&&Ceme))return!1;var Be=se.get(d),Le=se.get(p);if(Be&&Le)return Be==p&&Le==d;var qe=-1,ft=!0,Rt=_&m?new y0:r;for(se.set(d,p),se.set(p,d);++qe1?"& ":"")+p[q],p=p.join(_>2?", ":" "),d.replace($t,`{ /* [wrapped with `+p+`] */ -`)}function Moe(d){return sr(d)||E0(d)||!!(Bm&&d&&d[Bm])}function Mf(d,p){var _=typeof d;return p=p??x,!!p&&(_=="number"||_!="symbol"&&_i.test(d))&&d>-1&&d%1==0&&d0){if(++p>=R)return arguments[0]}else p=0;return d.apply(r,arguments)}}function c3(d,p){var _=-1,q=d.length,J=q-1;for(p=p===r?q:p;++_1?d[p-1]:r;return _=typeof _=="function"?(d.pop(),_):r,JD(d,_)});function ZD(d){var p=ne(d);return p.__chain__=!0,p}function Vae(d,p){return p(d),d}function l3(d,p){return p(d)}var zae=Rf(function(d){var p=d.length,_=p?d[0]:0,q=this.__wrapped__,J=function(se){return oA(se,d)};return p>1||this.__actions__.length||!(q instanceof kr)||!Mf(_)?this.thru(J):(q=q.slice(_,+_+(p?1:0)),q.__actions__.push({func:l3,args:[J],thisArg:r}),new Sa(q,this.__chain__).thru(function(se){return p&&!se.length&&se.push(r),se}))});function Hae(){return ZD(this)}function Gae(){return new Sa(this.value(),this.__chain__)}function Wae(){this.__values__===r&&(this.__values__=dN(this.value()));var d=this.__index__>=this.__values__.length,p=d?r:this.__values__[this.__index__++];return{done:d,value:p}}function Kae(){return this}function Yae(d){for(var p,_=this;_ instanceof Kx;){var q=HD(_);q.__index__=0,q.__values__=r,p?J.__wrapped__=q:p=q;var J=q;_=_.__wrapped__}return J.__wrapped__=d,p}function Qae(){var d=this.__wrapped__;if(d instanceof kr){var p=d;return this.__actions__.length&&(p=new kr(this)),p=p.reverse(),p.__actions__.push({func:l3,args:[DA],thisArg:r}),new Sa(p,this.__chain__)}return this.thru(DA)}function Jae(){return pD(this.__wrapped__,this.__actions__)}var Zae=t3(function(d,p,_){Gr.call(d,_)?++d[_]:Pf(d,_,1)});function Xae(d,p,_){var q=sr(d)?Rx:Vse;return _&&Ks(d,p,_)&&(p=r),q(d,Wt(p,3))}function ece(d,p){var _=sr(d)?ol:JO;return _(d,Wt(p,3))}var tce=SD(GD),rce=SD(WD);function nce(d,p){return Ki(f3(d,p),1)}function ice(d,p){return Ki(f3(d,p),B)}function sce(d,p,_){return _=_===r?1:pr(_),Ki(f3(d,p),_)}function XD(d,p){var _=sr(d)?go:cd;return _(d,Wt(p,3))}function eN(d,p){var _=sr(d)?BC:QO;return _(d,Wt(p,3))}var oce=t3(function(d,p,_){Gr.call(d,_)?d[_].push(p):Pf(d,_,[p])});function ace(d,p,_,q){d=wo(d)?d:ev(d),_=_&&!q?pr(_):0;var J=d.length;return _<0&&(_=Gt(J+_,0)),v3(d)?_<=J&&d.indexOf(p,_)>-1:!!J&&ed(d,p,_)>-1}var cce=br(function(d,p,_){var q=-1,J=typeof p=="function",se=wo(d)?Pe(d.length):[];return cd(d,function(he){se[++q]=J?li(p,he,_):Um(he,p,_)}),se}),lce=t3(function(d,p,_){Pf(d,_,p)});function f3(d,p){var _=sr(d)?ln:nD;return _(d,Wt(p,3))}function fce(d,p,_,q){return d==null?[]:(sr(p)||(p=p==null?[]:[p]),_=q?r:_,sr(_)||(_=_==null?[]:[_]),aD(d,p,_))}var uce=t3(function(d,p,_){d[_?0:1].push(p)},function(){return[[],[]]});function dce(d,p,_){var q=sr(d)?Tm:Nx,J=arguments.length<3;return q(d,Wt(p,4),_,J,cd)}function hce(d,p,_){var q=sr(d)?LC:Nx,J=arguments.length<3;return q(d,Wt(p,4),_,J,QO)}function pce(d,p){var _=sr(d)?ol:JO;return _(d,h3(Wt(p,3)))}function vce(d){var p=sr(d)?GO:aoe;return p(d)}function gce(d,p,_){(_?Ks(d,p,_):p===r)?p=1:p=pr(p);var q=sr(d)?Fse:coe;return q(d,p)}function yce(d){var p=sr(d)?jse:foe;return p(d)}function mce(d){if(d==null)return 0;if(wo(d))return v3(d)?Sf(d):d.length;var p=ws(d);return p==_e||p==Re?d.size:dA(d).length}function bce(d,p,_){var q=sr(d)?jp:uoe;return _&&Ks(d,p,_)&&(p=r),q(d,Wt(p,3))}var wce=br(function(d,p){if(d==null)return[];var _=p.length;return _>1&&Ks(d,p[0],p[1])?p=[]:_>2&&Ks(p[0],p[1],p[2])&&(p=[p[0]]),aD(d,Ki(p,1),[])}),u3=ve||function(){return Cr.Date.now()};function xce(d,p){if(typeof p!="function")throw new mo(o);return d=pr(d),function(){if(--d<1)return p.apply(this,arguments)}}function tN(d,p,_){return p=_?r:p,p=d&&p==null?d.length:p,kf(d,I,r,r,r,r,p)}function rN(d,p){var _;if(typeof p!="function")throw new mo(o);return d=pr(d),function(){return--d>0&&(_=p.apply(this,arguments)),d<=1&&(p=r),_}}var BA=br(function(d,p,_){var q=S;if(_.length){var J=nr(_,Zp(BA));q|=L}return kf(d,q,p,_,J)}),nN=br(function(d,p,_){var q=S|E;if(_.length){var J=nr(_,Zp(nN));q|=L}return kf(p,q,d,_,J)});function iN(d,p,_){p=_?r:p;var q=kf(d,P,r,r,r,r,r,p);return q.placeholder=iN.placeholder,q}function sN(d,p,_){p=_?r:p;var q=kf(d,N,r,r,r,r,r,p);return q.placeholder=sN.placeholder,q}function oN(d,p,_){var q,J,se,he,me,Ce,Be=0,Le=!1,qe=!1,ft=!0;if(typeof d!="function")throw new mo(o);p=Pa(p)||0,On(_)&&(Le=!!_.leading,qe="maxWait"in _,se=qe?Gt(Pa(_.maxWait)||0,p):se,ft="trailing"in _?!!_.trailing:ft);function Rt(Jn){var xc=q,Nf=J;return q=J=r,Be=Jn,he=d.apply(Nf,xc),he}function Yt(Jn){return Be=Jn,me=Hm(Ar,p),Le?Rt(Jn):he}function gr(Jn){var xc=Jn-Ce,Nf=Jn-Be,SN=p-xc;return qe?hr(SN,se-Nf):SN}function Qt(Jn){var xc=Jn-Ce,Nf=Jn-Be;return Ce===r||xc>=p||xc<0||qe&&Nf>=se}function Ar(){var Jn=u3();if(Qt(Jn))return Dr(Jn);me=Hm(Ar,gr(Jn))}function Dr(Jn){return me=r,ft&&q?Rt(Jn):(q=J=r,he)}function Wo(){me!==r&&gD(me),Be=0,q=Ce=J=me=r}function Ys(){return me===r?he:Dr(u3())}function Ko(){var Jn=u3(),xc=Qt(Jn);if(q=arguments,J=this,Ce=Jn,xc){if(me===r)return Yt(Ce);if(qe)return gD(me),me=Hm(Ar,p),Rt(Ce)}return me===r&&(me=Hm(Ar,p)),he}return Ko.cancel=Wo,Ko.flush=Ys,Ko}var Ece=br(function(d,p){return YO(d,1,p)}),Cce=br(function(d,p,_){return YO(d,Pa(p)||0,_)});function Ace(d){return kf(d,ie)}function d3(d,p){if(typeof d!="function"||p!=null&&typeof p!="function")throw new mo(o);var _=function(){var q=arguments,J=p?p.apply(this,q):q[0],se=_.cache;if(se.has(J))return se.get(J);var he=d.apply(this,q);return _.cache=se.set(J,he)||se,he};return _.cache=new(d3.Cache||Tf),_}d3.Cache=Tf;function h3(d){if(typeof d!="function")throw new mo(o);return function(){var p=arguments;switch(p.length){case 0:return!d.call(this);case 1:return!d.call(this,p[0]);case 2:return!d.call(this,p[0],p[1]);case 3:return!d.call(this,p[0],p[1],p[2])}return!d.apply(this,p)}}function Sce(d){return rN(2,d)}var _ce=doe(function(d,p){p=p.length==1&&sr(p[0])?ln(p[0],Hs(Wt())):ln(Ki(p,1),Hs(Wt()));var _=p.length;return br(function(q){for(var J=-1,se=hr(q.length,_);++J=p}),E0=eD(function(){return arguments}())?eD:function(d){return qn(d)&&Gr.call(d,"callee")&&!h0.call(d,"callee")},sr=Pe.isArray,$ce=Wi?Hs(Wi):Yse;function wo(d){return d!=null&&p3(d.length)&&!Of(d)}function Qn(d){return qn(d)&&wo(d)}function qce(d){return d===!0||d===!1||qn(d)&&Ws(d)==Z}var dd=We||KA,Vce=zo?Hs(zo):Qse;function zce(d){return qn(d)&&d.nodeType===1&&!Gm(d)}function Hce(d){if(d==null)return!0;if(wo(d)&&(sr(d)||typeof d=="string"||typeof d.splice=="function"||dd(d)||Xp(d)||E0(d)))return!d.length;var p=ws(d);if(p==_e||p==Re)return!d.size;if(zm(d))return!dA(d).length;for(var _ in d)if(Gr.call(d,_))return!1;return!0}function Gce(d,p){return $m(d,p)}function Wce(d,p,_){_=typeof _=="function"?_:r;var q=_?_(d,p):r;return q===r?$m(d,p,r,_):!!q}function FA(d){if(!qn(d))return!1;var p=Ws(d);return p==ee||p==F||typeof d.message=="string"&&typeof d.name=="string"&&!Gm(d)}function Kce(d){return typeof d=="number"&&rt(d)}function Of(d){if(!On(d))return!1;var p=Ws(d);return p==fe||p==xe||p==W||p==Xe}function cN(d){return typeof d=="number"&&d==pr(d)}function p3(d){return typeof d=="number"&&d>-1&&d%1==0&&d<=x}function On(d){var p=typeof d;return d!=null&&(p=="object"||p=="function")}function qn(d){return d!=null&&typeof d=="object"}var lN=zs?Hs(zs):Zse;function Yce(d,p){return d===p||uA(d,p,TA(p))}function Qce(d,p,_){return _=typeof _=="function"?_:r,uA(d,p,TA(p),_)}function Jce(d){return fN(d)&&d!=+d}function Zce(d){if(Noe(d))throw new Xt(s);return tD(d)}function Xce(d){return d===null}function ele(d){return d==null}function fN(d){return typeof d=="number"||qn(d)&&Ws(d)==Me}function Gm(d){if(!qn(d)||Ws(d)!=ze)return!1;var p=Wp(d);if(p===null)return!0;var _=Gr.call(p,"constructor")&&p.constructor;return typeof _=="function"&&_ instanceof _&&Vp.call(_)==rA}var jA=Aa?Hs(Aa):Xse;function tle(d){return cN(d)&&d>=-x&&d<=x}var uN=c0?Hs(c0):eoe;function v3(d){return typeof d=="string"||!sr(d)&&qn(d)&&Ws(d)==$e}function Go(d){return typeof d=="symbol"||qn(d)&&Ws(d)==st}var Xp=Af?Hs(Af):toe;function rle(d){return d===r}function nle(d){return qn(d)&&ws(d)==ct}function ile(d){return qn(d)&&Ws(d)==tt}var sle=s3(hA),ole=s3(function(d,p){return d<=p});function dN(d){if(!d)return[];if(wo(d))return v3(d)?yo(d):bo(d);if(z&&d[z])return yc(d[z]());var p=ws(d),_=p==_e?u0:p==Re?d0:ev;return _(d)}function Df(d){if(!d)return d===0?d:0;if(d=Pa(d),d===B||d===-B){var p=d<0?-1:1;return p*C}return d===d?d:0}function pr(d){var p=Df(d),_=p%1;return p===p?_?p-_:p:0}function hN(d){return d?m0(pr(d),0,k):0}function Pa(d){if(typeof d=="number")return d;if(Go(d))return w;if(On(d)){var p=typeof d.valueOf=="function"?d.valueOf():d;d=On(p)?p+"":p}if(typeof d!="string")return d===0?d:+d;d=td(d);var _=pi.test(d);return _||gi.test(d)?rr(d.slice(2),_?2:8):Or.test(d)?w:+d}function pN(d){return fl(d,xo(d))}function ale(d){return d?m0(pr(d),-x,x):d===0?d:0}function Jr(d){return d==null?"":Ho(d)}var cle=Qp(function(d,p){if(zm(p)||wo(p)){fl(p,Ii(p),d);return}for(var _ in p)Gr.call(p,_)&&Fm(d,_,p[_])}),vN=Qp(function(d,p){fl(p,xo(p),d)}),g3=Qp(function(d,p,_,q){fl(p,xo(p),d,q)}),lle=Qp(function(d,p,_,q){fl(p,Ii(p),d,q)}),fle=Rf(oA);function ule(d,p){var _=Yp(d);return p==null?_:WO(_,p)}var dle=br(function(d,p){d=nn(d);var _=-1,q=p.length,J=q>2?p[2]:r;for(J&&Ks(p[0],p[1],J)&&(q=1);++_1),se}),fl(d,_A(d),_),q&&(_=_a(_,u|h|g,Coe));for(var J=p.length;J--;)mA(_,p[J]);return _});function kle(d,p){return yN(d,h3(Wt(p)))}var Rle=Rf(function(d,p){return d==null?{}:ioe(d,p)});function yN(d,p){if(d==null)return{};var _=ln(_A(d),function(q){return[q]});return p=Wt(p),cD(d,_,function(q,J){return p(q,J[0])})}function Mle(d,p,_){p=fd(p,d);var q=-1,J=p.length;for(J||(J=1,d=r);++qp){var q=d;d=p,p=q}if(_||d%1||p%1){var J=Mn();return hr(d+J*(p-d+tn("1e-"+((J+"").length-1))),p)}return vA(d,p)}var Vle=Jp(function(d,p,_){return p=p.toLowerCase(),d+(_?wN(p):p)});function wN(d){return qA(Jr(d).toLowerCase())}function xN(d){return d=Jr(d),d&&d.replace(Tn,HC).replace(Sm,"")}function zle(d,p,_){d=Jr(d),p=Ho(p);var q=d.length;_=_===r?q:m0(pr(_),0,q);var J=_;return _-=p.length,_>=0&&d.slice(_,J)==p}function Hle(d){return d=Jr(d),d&&Nt.test(d)?d.replace(Pt,GC):d}function Gle(d){return d=Jr(d),d&&xt.test(d)?d.replace(ht,"\\$&"):d}var Wle=Jp(function(d,p,_){return d+(_?"-":"")+p.toLowerCase()}),Kle=Jp(function(d,p,_){return d+(_?" ":"")+p.toLowerCase()}),Yle=AD("toLowerCase");function Qle(d,p,_){d=Jr(d),p=pr(p);var q=p?Sf(d):0;if(!p||q>=p)return d;var J=(p-q)/2;return i3(Ae(J),_)+d+i3(Se(J),_)}function Jle(d,p,_){d=Jr(d),p=pr(p);var q=p?Sf(d):0;return p&&q>>0,_?(d=Jr(d),d&&(typeof p=="string"||p!=null&&!jA(p))&&(p=Ho(p),!p&&Qr(d))?ud(yo(d),0,_):d.split(p,_)):[]}var ife=Jp(function(d,p,_){return d+(_?" ":"")+qA(p)});function sfe(d,p,_){return d=Jr(d),_=_==null?0:m0(pr(_),0,d.length),p=Ho(p),d.slice(_,_+p.length)==p}function ofe(d,p,_){var q=ne.templateSettings;_&&Ks(d,p,_)&&(p=r),d=Jr(d),p=g3({},p,q,RD);var J=g3({},p.imports,q.imports,RD),se=Ii(J),he=Mm(J,se),me,Ce,Be=0,Le=p.interpolate||ps,qe="__p += '",ft=Nm((p.escape||ps).source+"|"+Le.source+"|"+(Le===kt?Pr:ps).source+"|"+(p.evaluate||ps).source+"|$","g"),Rt="//# sourceURL="+(Gr.call(p,"sourceURL")?(p.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++_m+"]")+` +`)}function Moe(d){return sr(d)||E0(d)||!!(Bm&&d&&d[Bm])}function Mf(d,p){var _=typeof d;return p=p??x,!!p&&(_=="number"||_!="symbol"&&_i.test(d))&&d>-1&&d%1==0&&d0){if(++p>=R)return arguments[0]}else p=0;return d.apply(r,arguments)}}function c3(d,p){var _=-1,q=d.length,J=q-1;for(p=p===r?q:p;++_1?d[p-1]:r;return _=typeof _=="function"?(d.pop(),_):r,JD(d,_)});function ZD(d){var p=ne(d);return p.__chain__=!0,p}function Vae(d,p){return p(d),d}function l3(d,p){return p(d)}var zae=Rf(function(d){var p=d.length,_=p?d[0]:0,q=this.__wrapped__,J=function(se){return oA(se,d)};return p>1||this.__actions__.length||!(q instanceof kr)||!Mf(_)?this.thru(J):(q=q.slice(_,+_+(p?1:0)),q.__actions__.push({func:l3,args:[J],thisArg:r}),new Sa(q,this.__chain__).thru(function(se){return p&&!se.length&&se.push(r),se}))});function Hae(){return ZD(this)}function Gae(){return new Sa(this.value(),this.__chain__)}function Wae(){this.__values__===r&&(this.__values__=dN(this.value()));var d=this.__index__>=this.__values__.length,p=d?r:this.__values__[this.__index__++];return{done:d,value:p}}function Kae(){return this}function Yae(d){for(var p,_=this;_ instanceof Kx;){var q=HD(_);q.__index__=0,q.__values__=r,p?J.__wrapped__=q:p=q;var J=q;_=_.__wrapped__}return J.__wrapped__=d,p}function Qae(){var d=this.__wrapped__;if(d instanceof kr){var p=d;return this.__actions__.length&&(p=new kr(this)),p=p.reverse(),p.__actions__.push({func:l3,args:[DA],thisArg:r}),new Sa(p,this.__chain__)}return this.thru(DA)}function Jae(){return pD(this.__wrapped__,this.__actions__)}var Zae=t3(function(d,p,_){Gr.call(d,_)?++d[_]:Pf(d,_,1)});function Xae(d,p,_){var q=sr(d)?Rx:Vse;return _&&Ks(d,p,_)&&(p=r),q(d,Kt(p,3))}function ece(d,p){var _=sr(d)?ol:JO;return _(d,Kt(p,3))}var tce=SD(GD),rce=SD(WD);function nce(d,p){return Ki(f3(d,p),1)}function ice(d,p){return Ki(f3(d,p),B)}function sce(d,p,_){return _=_===r?1:pr(_),Ki(f3(d,p),_)}function XD(d,p){var _=sr(d)?go:cd;return _(d,Kt(p,3))}function eN(d,p){var _=sr(d)?BC:QO;return _(d,Kt(p,3))}var oce=t3(function(d,p,_){Gr.call(d,_)?d[_].push(p):Pf(d,_,[p])});function ace(d,p,_,q){d=wo(d)?d:ev(d),_=_&&!q?pr(_):0;var J=d.length;return _<0&&(_=Wt(J+_,0)),v3(d)?_<=J&&d.indexOf(p,_)>-1:!!J&&ed(d,p,_)>-1}var cce=br(function(d,p,_){var q=-1,J=typeof p=="function",se=wo(d)?Pe(d.length):[];return cd(d,function(he){se[++q]=J?li(p,he,_):Um(he,p,_)}),se}),lce=t3(function(d,p,_){Pf(d,_,p)});function f3(d,p){var _=sr(d)?ln:nD;return _(d,Kt(p,3))}function fce(d,p,_,q){return d==null?[]:(sr(p)||(p=p==null?[]:[p]),_=q?r:_,sr(_)||(_=_==null?[]:[_]),aD(d,p,_))}var uce=t3(function(d,p,_){d[_?0:1].push(p)},function(){return[[],[]]});function dce(d,p,_){var q=sr(d)?Tm:Nx,J=arguments.length<3;return q(d,Kt(p,4),_,J,cd)}function hce(d,p,_){var q=sr(d)?LC:Nx,J=arguments.length<3;return q(d,Kt(p,4),_,J,QO)}function pce(d,p){var _=sr(d)?ol:JO;return _(d,h3(Kt(p,3)))}function vce(d){var p=sr(d)?GO:aoe;return p(d)}function gce(d,p,_){(_?Ks(d,p,_):p===r)?p=1:p=pr(p);var q=sr(d)?Fse:coe;return q(d,p)}function yce(d){var p=sr(d)?jse:foe;return p(d)}function mce(d){if(d==null)return 0;if(wo(d))return v3(d)?Sf(d):d.length;var p=ws(d);return p==_e||p==Re?d.size:dA(d).length}function bce(d,p,_){var q=sr(d)?jp:uoe;return _&&Ks(d,p,_)&&(p=r),q(d,Kt(p,3))}var wce=br(function(d,p){if(d==null)return[];var _=p.length;return _>1&&Ks(d,p[0],p[1])?p=[]:_>2&&Ks(p[0],p[1],p[2])&&(p=[p[0]]),aD(d,Ki(p,1),[])}),u3=ve||function(){return Cr.Date.now()};function xce(d,p){if(typeof p!="function")throw new mo(o);return d=pr(d),function(){if(--d<1)return p.apply(this,arguments)}}function tN(d,p,_){return p=_?r:p,p=d&&p==null?d.length:p,kf(d,I,r,r,r,r,p)}function rN(d,p){var _;if(typeof p!="function")throw new mo(o);return d=pr(d),function(){return--d>0&&(_=p.apply(this,arguments)),d<=1&&(p=r),_}}var BA=br(function(d,p,_){var q=S;if(_.length){var J=nr(_,Zp(BA));q|=L}return kf(d,q,p,_,J)}),nN=br(function(d,p,_){var q=S|E;if(_.length){var J=nr(_,Zp(nN));q|=L}return kf(p,q,d,_,J)});function iN(d,p,_){p=_?r:p;var q=kf(d,P,r,r,r,r,r,p);return q.placeholder=iN.placeholder,q}function sN(d,p,_){p=_?r:p;var q=kf(d,N,r,r,r,r,r,p);return q.placeholder=sN.placeholder,q}function oN(d,p,_){var q,J,se,he,me,Ce,Be=0,Le=!1,qe=!1,ft=!0;if(typeof d!="function")throw new mo(o);p=Pa(p)||0,On(_)&&(Le=!!_.leading,qe="maxWait"in _,se=qe?Wt(Pa(_.maxWait)||0,p):se,ft="trailing"in _?!!_.trailing:ft);function Rt(Jn){var xc=q,Nf=J;return q=J=r,Be=Jn,he=d.apply(Nf,xc),he}function Yt(Jn){return Be=Jn,me=Hm(Ar,p),Le?Rt(Jn):he}function gr(Jn){var xc=Jn-Ce,Nf=Jn-Be,SN=p-xc;return qe?hr(SN,se-Nf):SN}function Qt(Jn){var xc=Jn-Ce,Nf=Jn-Be;return Ce===r||xc>=p||xc<0||qe&&Nf>=se}function Ar(){var Jn=u3();if(Qt(Jn))return Dr(Jn);me=Hm(Ar,gr(Jn))}function Dr(Jn){return me=r,ft&&q?Rt(Jn):(q=J=r,he)}function Wo(){me!==r&&gD(me),Be=0,q=Ce=J=me=r}function Ys(){return me===r?he:Dr(u3())}function Ko(){var Jn=u3(),xc=Qt(Jn);if(q=arguments,J=this,Ce=Jn,xc){if(me===r)return Yt(Ce);if(qe)return gD(me),me=Hm(Ar,p),Rt(Ce)}return me===r&&(me=Hm(Ar,p)),he}return Ko.cancel=Wo,Ko.flush=Ys,Ko}var Ece=br(function(d,p){return YO(d,1,p)}),Cce=br(function(d,p,_){return YO(d,Pa(p)||0,_)});function Ace(d){return kf(d,ie)}function d3(d,p){if(typeof d!="function"||p!=null&&typeof p!="function")throw new mo(o);var _=function(){var q=arguments,J=p?p.apply(this,q):q[0],se=_.cache;if(se.has(J))return se.get(J);var he=d.apply(this,q);return _.cache=se.set(J,he)||se,he};return _.cache=new(d3.Cache||Tf),_}d3.Cache=Tf;function h3(d){if(typeof d!="function")throw new mo(o);return function(){var p=arguments;switch(p.length){case 0:return!d.call(this);case 1:return!d.call(this,p[0]);case 2:return!d.call(this,p[0],p[1]);case 3:return!d.call(this,p[0],p[1],p[2])}return!d.apply(this,p)}}function Sce(d){return rN(2,d)}var _ce=doe(function(d,p){p=p.length==1&&sr(p[0])?ln(p[0],Hs(Kt())):ln(Ki(p,1),Hs(Kt()));var _=p.length;return br(function(q){for(var J=-1,se=hr(q.length,_);++J=p}),E0=eD(function(){return arguments}())?eD:function(d){return qn(d)&&Gr.call(d,"callee")&&!h0.call(d,"callee")},sr=Pe.isArray,$ce=Wi?Hs(Wi):Yse;function wo(d){return d!=null&&p3(d.length)&&!Of(d)}function Qn(d){return qn(d)&&wo(d)}function qce(d){return d===!0||d===!1||qn(d)&&Ws(d)==Z}var dd=We||KA,Vce=zo?Hs(zo):Qse;function zce(d){return qn(d)&&d.nodeType===1&&!Gm(d)}function Hce(d){if(d==null)return!0;if(wo(d)&&(sr(d)||typeof d=="string"||typeof d.splice=="function"||dd(d)||Xp(d)||E0(d)))return!d.length;var p=ws(d);if(p==_e||p==Re)return!d.size;if(zm(d))return!dA(d).length;for(var _ in d)if(Gr.call(d,_))return!1;return!0}function Gce(d,p){return $m(d,p)}function Wce(d,p,_){_=typeof _=="function"?_:r;var q=_?_(d,p):r;return q===r?$m(d,p,r,_):!!q}function FA(d){if(!qn(d))return!1;var p=Ws(d);return p==ee||p==F||typeof d.message=="string"&&typeof d.name=="string"&&!Gm(d)}function Kce(d){return typeof d=="number"&&rt(d)}function Of(d){if(!On(d))return!1;var p=Ws(d);return p==fe||p==xe||p==W||p==Xe}function cN(d){return typeof d=="number"&&d==pr(d)}function p3(d){return typeof d=="number"&&d>-1&&d%1==0&&d<=x}function On(d){var p=typeof d;return d!=null&&(p=="object"||p=="function")}function qn(d){return d!=null&&typeof d=="object"}var lN=zs?Hs(zs):Zse;function Yce(d,p){return d===p||uA(d,p,TA(p))}function Qce(d,p,_){return _=typeof _=="function"?_:r,uA(d,p,TA(p),_)}function Jce(d){return fN(d)&&d!=+d}function Zce(d){if(Noe(d))throw new Xt(s);return tD(d)}function Xce(d){return d===null}function ele(d){return d==null}function fN(d){return typeof d=="number"||qn(d)&&Ws(d)==Me}function Gm(d){if(!qn(d)||Ws(d)!=ze)return!1;var p=Wp(d);if(p===null)return!0;var _=Gr.call(p,"constructor")&&p.constructor;return typeof _=="function"&&_ instanceof _&&Vp.call(_)==rA}var jA=Aa?Hs(Aa):Xse;function tle(d){return cN(d)&&d>=-x&&d<=x}var uN=c0?Hs(c0):eoe;function v3(d){return typeof d=="string"||!sr(d)&&qn(d)&&Ws(d)==$e}function Go(d){return typeof d=="symbol"||qn(d)&&Ws(d)==st}var Xp=Af?Hs(Af):toe;function rle(d){return d===r}function nle(d){return qn(d)&&ws(d)==ct}function ile(d){return qn(d)&&Ws(d)==tt}var sle=s3(hA),ole=s3(function(d,p){return d<=p});function dN(d){if(!d)return[];if(wo(d))return v3(d)?yo(d):bo(d);if(z&&d[z])return yc(d[z]());var p=ws(d),_=p==_e?u0:p==Re?d0:ev;return _(d)}function Df(d){if(!d)return d===0?d:0;if(d=Pa(d),d===B||d===-B){var p=d<0?-1:1;return p*C}return d===d?d:0}function pr(d){var p=Df(d),_=p%1;return p===p?_?p-_:p:0}function hN(d){return d?m0(pr(d),0,k):0}function Pa(d){if(typeof d=="number")return d;if(Go(d))return w;if(On(d)){var p=typeof d.valueOf=="function"?d.valueOf():d;d=On(p)?p+"":p}if(typeof d!="string")return d===0?d:+d;d=td(d);var _=pi.test(d);return _||gi.test(d)?rr(d.slice(2),_?2:8):Or.test(d)?w:+d}function pN(d){return fl(d,xo(d))}function ale(d){return d?m0(pr(d),-x,x):d===0?d:0}function Jr(d){return d==null?"":Ho(d)}var cle=Qp(function(d,p){if(zm(p)||wo(p)){fl(p,Ii(p),d);return}for(var _ in p)Gr.call(p,_)&&Fm(d,_,p[_])}),vN=Qp(function(d,p){fl(p,xo(p),d)}),g3=Qp(function(d,p,_,q){fl(p,xo(p),d,q)}),lle=Qp(function(d,p,_,q){fl(p,Ii(p),d,q)}),fle=Rf(oA);function ule(d,p){var _=Yp(d);return p==null?_:WO(_,p)}var dle=br(function(d,p){d=nn(d);var _=-1,q=p.length,J=q>2?p[2]:r;for(J&&Ks(p[0],p[1],J)&&(q=1);++_1),se}),fl(d,_A(d),_),q&&(_=_a(_,u|h|g,Coe));for(var J=p.length;J--;)mA(_,p[J]);return _});function kle(d,p){return yN(d,h3(Kt(p)))}var Rle=Rf(function(d,p){return d==null?{}:ioe(d,p)});function yN(d,p){if(d==null)return{};var _=ln(_A(d),function(q){return[q]});return p=Kt(p),cD(d,_,function(q,J){return p(q,J[0])})}function Mle(d,p,_){p=fd(p,d);var q=-1,J=p.length;for(J||(J=1,d=r);++qp){var q=d;d=p,p=q}if(_||d%1||p%1){var J=Mn();return hr(d+J*(p-d+tn("1e-"+((J+"").length-1))),p)}return vA(d,p)}var Vle=Jp(function(d,p,_){return p=p.toLowerCase(),d+(_?wN(p):p)});function wN(d){return qA(Jr(d).toLowerCase())}function xN(d){return d=Jr(d),d&&d.replace(Tn,HC).replace(Sm,"")}function zle(d,p,_){d=Jr(d),p=Ho(p);var q=d.length;_=_===r?q:m0(pr(_),0,q);var J=_;return _-=p.length,_>=0&&d.slice(_,J)==p}function Hle(d){return d=Jr(d),d&&Nt.test(d)?d.replace(Pt,GC):d}function Gle(d){return d=Jr(d),d&&xt.test(d)?d.replace(ht,"\\$&"):d}var Wle=Jp(function(d,p,_){return d+(_?"-":"")+p.toLowerCase()}),Kle=Jp(function(d,p,_){return d+(_?" ":"")+p.toLowerCase()}),Yle=AD("toLowerCase");function Qle(d,p,_){d=Jr(d),p=pr(p);var q=p?Sf(d):0;if(!p||q>=p)return d;var J=(p-q)/2;return i3(Ae(J),_)+d+i3(Se(J),_)}function Jle(d,p,_){d=Jr(d),p=pr(p);var q=p?Sf(d):0;return p&&q>>0,_?(d=Jr(d),d&&(typeof p=="string"||p!=null&&!jA(p))&&(p=Ho(p),!p&&Qr(d))?ud(yo(d),0,_):d.split(p,_)):[]}var ife=Jp(function(d,p,_){return d+(_?" ":"")+qA(p)});function sfe(d,p,_){return d=Jr(d),_=_==null?0:m0(pr(_),0,d.length),p=Ho(p),d.slice(_,_+p.length)==p}function ofe(d,p,_){var q=ne.templateSettings;_&&Ks(d,p,_)&&(p=r),d=Jr(d),p=g3({},p,q,RD);var J=g3({},p.imports,q.imports,RD),se=Ii(J),he=Mm(J,se),me,Ce,Be=0,Le=p.interpolate||ps,qe="__p += '",ft=Nm((p.escape||ps).source+"|"+Le.source+"|"+(Le===kt?Pr:ps).source+"|"+(p.evaluate||ps).source+"|$","g"),Rt="//# sourceURL="+(Gr.call(p,"sourceURL")?(p.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++_m+"]")+` `;d.replace(ft,function(Qt,Ar,Dr,Wo,Ys,Ko){return Dr||(Dr=Wo),qe+=d.slice(Be,Ko).replace(vs,WC),Ar&&(me=!0,qe+=`' + __e(`+Ar+`) + '`),Ys&&(Ce=!0,qe+=`'; @@ -1020,12 +1020,12 @@ __p += '`),Dr&&(qe+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+qe+`return __p -}`;var gr=CN(function(){return Lr(se,Rt+"return "+qe).apply(r,he)});if(gr.source=qe,FA(gr))throw gr;return gr}function afe(d){return Jr(d).toLowerCase()}function cfe(d){return Jr(d).toUpperCase()}function lfe(d,p,_){if(d=Jr(d),d&&(_||p===r))return td(d);if(!d||!(p=Ho(p)))return d;var q=yo(d),J=yo(p),se=Bx(q,J),he=Lx(q,J)+1;return ud(q,se,he).join("")}function ffe(d,p,_){if(d=Jr(d),d&&(_||p===r))return d.slice(0,Dm(d)+1);if(!d||!(p=Ho(p)))return d;var q=yo(d),J=Lx(q,yo(p))+1;return ud(q,0,J).join("")}function ufe(d,p,_){if(d=Jr(d),d&&(_||p===r))return d.replace(Bt,"");if(!d||!(p=Ho(p)))return d;var q=yo(d),J=Bx(q,yo(p));return ud(q,J).join("")}function dfe(d,p){var _=ae,q=K;if(On(p)){var J="separator"in p?p.separator:J;_="length"in p?pr(p.length):_,q="omission"in p?Ho(p.omission):q}d=Jr(d);var se=d.length;if(Qr(d)){var he=yo(d);se=he.length}if(_>=se)return d;var me=_-Sf(q);if(me<1)return q;var Ce=he?ud(he,0,me).join(""):d.slice(0,me);if(J===r)return Ce+q;if(he&&(me+=Ce.length-me),jA(J)){if(d.slice(me).search(J)){var Be,Le=Ce;for(J.global||(J=Nm(J.source,Jr(tr.exec(J))+"g")),J.lastIndex=0;Be=J.exec(Le);)var qe=Be.index;Ce=Ce.slice(0,qe===r?me:qe)}}else if(d.indexOf(Ho(J),me)!=me){var ft=Ce.lastIndexOf(J);ft>-1&&(Ce=Ce.slice(0,ft))}return Ce+q}function hfe(d){return d=Jr(d),d&&Dt.test(d)?d.replace(ir,qx):d}var pfe=Jp(function(d,p,_){return d+(_?" ":"")+p.toUpperCase()}),qA=AD("toUpperCase");function EN(d,p,_){return d=Jr(d),p=_?r:p,p===r?Fx(d)?JC(d):UC(d):d.match(p)||[]}var CN=br(function(d,p){try{return li(d,r,p)}catch(_){return FA(_)?_:new Xt(_)}}),vfe=Rf(function(d,p){return go(p,function(_){_=ul(_),Pf(d,_,BA(d[_],d))}),d});function gfe(d){var p=d==null?0:d.length,_=Wt();return d=p?ln(d,function(q){if(typeof q[1]!="function")throw new mo(o);return[_(q[0]),q[1]]}):[],br(function(q){for(var J=-1;++Jx)return[];var _=k,q=hr(d,k);p=Wt(p),d-=k;for(var J=l0(q,p);++_0||p<0)?new kr(_):(d<0?_=_.takeRight(-d):d&&(_=_.drop(d)),p!==r&&(p=pr(p),_=p<0?_.dropRight(-p):_.take(p-d)),_)},kr.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},kr.prototype.toArray=function(){return this.take(k)},ll(kr.prototype,function(d,p){var _=/^(?:filter|find|map|reject)|While$/.test(p),q=/^(?:head|last)$/.test(p),J=ne[q?"take"+(p=="last"?"Right":""):p],se=q||/^find/.test(p);J&&(ne.prototype[p]=function(){var he=this.__wrapped__,me=q?[1]:arguments,Ce=he instanceof kr,Be=me[0],Le=Ce||sr(he),qe=function(Ar){var Dr=J.apply(ne,al([Ar],me));return q&&ft?Dr[0]:Dr};Le&&_&&typeof Be=="function"&&Be.length!=1&&(Ce=Le=!1);var ft=this.__chain__,Rt=!!this.__actions__.length,Yt=se&&!ft,gr=Ce&&!Rt;if(!se&&Le){he=gr?he:new kr(this);var Qt=d.apply(he,me);return Qt.__actions__.push({func:l3,args:[qe],thisArg:r}),new Sa(Qt,ft)}return Yt&&gr?d.apply(this,me):(Qt=this.thru(qe),Yt?q?Qt.value()[0]:Qt.value():Qt)})}),go(["pop","push","shift","sort","splice","unshift"],function(d){var p=$p[d],_=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",q=/^(?:pop|shift)$/.test(d);ne.prototype[d]=function(){var J=arguments;if(q&&!this.__chain__){var se=this.value();return p.apply(sr(se)?se:[],J)}return this[_](function(he){return p.apply(sr(he)?he:[],J)})}}),ll(kr.prototype,function(d,p){var _=ne[p];if(_){var q=_.name+"";Gr.call(mc,q)||(mc[q]=[]),mc[q].push({name:p,func:_})}}),mc[r3(r,E).name]=[{name:"wrapper",func:r}],kr.prototype.clone=hse,kr.prototype.reverse=pse,kr.prototype.value=vse,ne.prototype.at=zae,ne.prototype.chain=Hae,ne.prototype.commit=Gae,ne.prototype.next=Wae,ne.prototype.plant=Yae,ne.prototype.reverse=Qae,ne.prototype.toJSON=ne.prototype.valueOf=ne.prototype.value=Jae,ne.prototype.first=ne.prototype.head,z&&(ne.prototype[z]=Kae),ne},rd=ZC();pn?((pn.exports=rd)._=rd,rn._=rd):Cr._=rd}).call(xi)})(f8,f8.exports);var xqe=f8.exports,jT={exports:{}};(function(t,e){var r=typeof self<"u"?self:xi,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function c(v){return v&&DataView.prototype.isPrototypeOf(v)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(v){return v&&l.indexOf(Object.prototype.toString.call(v))>-1};function u(v){if(typeof v!="string"&&(v=String(v)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(v))throw new TypeError("Invalid character in header field name");return v.toLowerCase()}function h(v){return typeof v!="string"&&(v=String(v)),v}function g(v){var b={next:function(){var M=v.shift();return{done:M===void 0,value:M}}};return a.iterable&&(b[Symbol.iterator]=function(){return b}),b}function y(v){this.map={},v instanceof y?v.forEach(function(b,M){this.append(M,b)},this):Array.isArray(v)?v.forEach(function(b){this.append(b[0],b[1])},this):v&&Object.getOwnPropertyNames(v).forEach(function(b){this.append(b,v[b])},this)}y.prototype.append=function(v,b){v=u(v),b=h(b);var M=this.map[v];this.map[v]=M?M+", "+b:b},y.prototype.delete=function(v){delete this.map[u(v)]},y.prototype.get=function(v){return v=u(v),this.has(v)?this.map[v]:null},y.prototype.has=function(v){return this.map.hasOwnProperty(u(v))},y.prototype.set=function(v,b){this.map[u(v)]=h(b)},y.prototype.forEach=function(v,b){for(var M in this.map)this.map.hasOwnProperty(M)&&v.call(b,this.map[M],M,this)},y.prototype.keys=function(){var v=[];return this.forEach(function(b,M){v.push(M)}),g(v)},y.prototype.values=function(){var v=[];return this.forEach(function(b){v.push(b)}),g(v)},y.prototype.entries=function(){var v=[];return this.forEach(function(b,M){v.push([M,b])}),g(v)},a.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function m(v){if(v.bodyUsed)return Promise.reject(new TypeError("Already read"));v.bodyUsed=!0}function S(v){return new Promise(function(b,M){v.onload=function(){b(v.result)},v.onerror=function(){M(v.error)}})}function E(v){var b=new FileReader,M=S(b);return b.readAsArrayBuffer(v),M}function A(v){var b=new FileReader,M=S(b);return b.readAsText(v),M}function P(v){for(var b=new Uint8Array(v),M=new Array(b.length),B=0;B-1?b:v}function U(v,b){b=b||{};var M=b.body;if(v instanceof U){if(v.bodyUsed)throw new TypeError("Already read");this.url=v.url,this.credentials=v.credentials,b.headers||(this.headers=new y(v.headers)),this.method=v.method,this.mode=v.mode,this.signal=v.signal,!M&&v._bodyInit!=null&&(M=v._bodyInit,v.bodyUsed=!0)}else this.url=String(v);if(this.credentials=b.credentials||this.credentials||"same-origin",(b.headers||!this.headers)&&(this.headers=new y(b.headers)),this.method=I(b.method||this.method||"GET"),this.mode=b.mode||this.mode||null,this.signal=b.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&M)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(M)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function ie(v){var b=new FormData;return v.trim().split("&").forEach(function(M){if(M){var B=M.split("="),x=B.shift().replace(/\+/g," "),C=B.join("=").replace(/\+/g," ");b.append(decodeURIComponent(x),decodeURIComponent(C))}}),b}function ae(v){var b=new y,M=v.replace(/\r?\n[\t ]+/g," ");return M.split(/\r?\n/).forEach(function(B){var x=B.split(":"),C=x.shift().trim();if(C){var w=x.join(":").trim();b.append(C,w)}}),b}L.call(U.prototype);function K(v,b){b||(b={}),this.type="default",this.status=b.status===void 0?200:b.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in b?b.statusText:"OK",this.headers=new y(b.headers),this.url=b.url||"",this._initBody(v)}L.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},K.error=function(){var v=new K(null,{status:0,statusText:""});return v.type="error",v};var R=[301,302,303,307,308];K.redirect=function(v,b){if(R.indexOf(b)===-1)throw new RangeError("Invalid status code");return new K(null,{status:b,headers:{location:v}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(b,M){this.message=b,this.name=M;var B=Error(b);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function D(v,b){return new Promise(function(M,B){var x=new U(v,b);if(x.signal&&x.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var C=new XMLHttpRequest;function w(){C.abort()}C.onload=function(){var k={status:C.status,statusText:C.statusText,headers:ae(C.getAllResponseHeaders()||"")};k.url="responseURL"in C?C.responseURL:k.headers.get("X-Request-URL");var O="response"in C?C.response:C.responseText;M(new K(O,k))},C.onerror=function(){B(new TypeError("Network request failed"))},C.ontimeout=function(){B(new TypeError("Network request failed"))},C.onabort=function(){B(new o.DOMException("Aborted","AbortError"))},C.open(x.method,x.url,!0),x.credentials==="include"?C.withCredentials=!0:x.credentials==="omit"&&(C.withCredentials=!1),"responseType"in C&&a.blob&&(C.responseType="blob"),x.headers.forEach(function(k,O){C.setRequestHeader(O,k)}),x.signal&&(x.signal.addEventListener("abort",w),C.onreadystatechange=function(){C.readyState===4&&x.signal.removeEventListener("abort",w)}),C.send(typeof x._bodyInit>"u"?null:x._bodyInit)})}return D.polyfill=!0,s.fetch||(s.fetch=D,s.Headers=y,s.Request=U,s.Response=K),o.Headers=y,o.Request=U,o.Response=K,o.fetch=D,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(jT,jT.exports);var Eqe=jT.exports;const vV=$u(Eqe);var Cqe=Object.defineProperty,Aqe=Object.defineProperties,Sqe=Object.getOwnPropertyDescriptors,gV=Object.getOwnPropertySymbols,_qe=Object.prototype.hasOwnProperty,Iqe=Object.prototype.propertyIsEnumerable,yV=(t,e,r)=>e in t?Cqe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mV=(t,e)=>{for(var r in e||(e={}))_qe.call(e,r)&&yV(t,r,e[r]);if(gV)for(var r of gV(e))Iqe.call(e,r)&&yV(t,r,e[r]);return t},bV=(t,e)=>Aqe(t,Sqe(e));const Tqe={Accept:"application/json","Content-Type":"application/json"},Pqe="POST",wV={headers:Tqe,method:Pqe},xV=10;let rl=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new wa.EventEmitter,this.isAvailable=!1,this.registering=!1,!$q(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=Uu(e),n=await(await vV(this.url,bV(mV({},wV),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!$q(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Uu({id:1,jsonrpc:"2.0",method:"test",params:[]});await vV(e,bV(mV({},wV),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?cp(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=TC(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return Kne(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>xV&&this.events.setMaxListeners(xV)}};const EV="error",kqe="wss://relay.walletconnect.org",Rqe="wc",Mqe="universal_provider",CV=`${Rqe}@2:${Mqe}:`,mie="https://rpc.walletconnect.org/v1/",Av="generic",Oqe=`${mie}bundler`,pc={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Dqe=Object.defineProperty,Nqe=Object.defineProperties,Bqe=Object.getOwnPropertyDescriptors,AV=Object.getOwnPropertySymbols,Lqe=Object.prototype.hasOwnProperty,Fqe=Object.prototype.propertyIsEnumerable,SV=(t,e,r)=>e in t?Dqe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E6=(t,e)=>{for(var r in e||(e={}))Lqe.call(e,r)&&SV(t,r,e[r]);if(AV)for(var r of AV(e))Fqe.call(e,r)&&SV(t,r,e[r]);return t},jqe=(t,e)=>Nqe(t,Bqe(e));function ga(t,e,r){var n;const i=xg(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${mie}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Tp(t){return t.includes(":")?t.split(":")[1]:t}function bie(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Uqe(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function p7(t={},e={}){const r=_V(t),n=_V(e);return xqe.merge(r,n)}function _V(t){var e,r,n,i;const s={};if(!pw(t))return s;for(const[o,a]of Object.entries(t)){const c=TO(o)?[o]:a.chains,l=a.methods||[],f=a.events||[],u=a.rpcMap||{},h=Hb(o);s[h]=jqe(E6(E6({},s[h]),a),{chains:A5(c,(e=s[h])==null?void 0:e.chains),methods:A5(l,(r=s[h])==null?void 0:r.methods),events:A5(f,(n=s[h])==null?void 0:n.events),rpcMap:E6(E6({},u),(i=s[h])==null?void 0:i.rpcMap)})}return s}function $qe(t){return t.includes(":")?t.split(":")[2]:t}function IV(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=TO(r)?[r]:n.chains?n.chains:bie(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function v7(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const wie={},zr=t=>wie[t],g7=(t,e)=>{wie[t]=e};class qqe{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Tp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}var Vqe=Object.defineProperty,zqe=Object.defineProperties,Hqe=Object.getOwnPropertyDescriptors,TV=Object.getOwnPropertySymbols,Gqe=Object.prototype.hasOwnProperty,Wqe=Object.prototype.propertyIsEnumerable,PV=(t,e,r)=>e in t?Vqe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kV=(t,e)=>{for(var r in e||(e={}))Gqe.call(e,r)&&PV(t,r,e[r]);if(TV)for(var r of TV(e))Wqe.call(e,r)&&PV(t,r,e[r]);return t},RV=(t,e)=>zqe(t,Hqe(e));class Kqe{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||ga(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(Tp(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const c=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:RV(kV({},o.sessionProperties||{}),{capabilities:RV(kV({},a||{}),{[s]:c})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return c}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(rh("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${Oqe}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class Yqe{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Tp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}class Qqe{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Tp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}class Jqe{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||ga(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new hc(new rl(n,zr("disableProviderPing")))}}class Zqe{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=Tp(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}class Xqe{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Tp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}class eVe{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Tp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}class tVe{constructor(e){this.name="near",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||ga(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace);return typeof n>"u"?void 0:new hc(new rl(n,zr("disableProviderPing")))}}class rVe{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||ga(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace);return typeof n>"u"?void 0:new hc(new rl(n))}}class nVe{constructor(e){this.name=Av,this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=xg(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}var iVe=Object.defineProperty,sVe=Object.defineProperties,oVe=Object.getOwnPropertyDescriptors,MV=Object.getOwnPropertySymbols,aVe=Object.prototype.hasOwnProperty,cVe=Object.prototype.propertyIsEnumerable,OV=(t,e,r)=>e in t?iVe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,C6=(t,e)=>{for(var r in e||(e={}))aVe.call(e,r)&&OV(t,r,e[r]);if(MV)for(var r of MV(e))cVe.call(e,r)&&OV(t,r,e[r]);return t},y7=(t,e)=>sVe(t,oVe(e));let lVe=class xie{constructor(e){this.events=new iO,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Ix(_C({level:(e==null?void 0:e.logger)||EV})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new xie(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:C6({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,IC(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:sn("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=IV(this.session.namespaces);this.namespaces=p7(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=IV(s.namespaces);this.namespaces=p7(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==yie)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Av?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(cf(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await MC.init({core:this.providerOpts.core,logger:this.providerOpts.logger||EV,relayUrl:this.providerOpts.relayUrl||kqe,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>Hb(r)))];g7("client",this.client),g7("events",this.events),g7("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Uqe(r,this.session),i=bie(n),s=p7(this.namespaces,this.optionalNamespaces),o=y7(C6({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Kqe({namespace:o});break;case"algorand":this.rpcProviders[r]=new Jqe({namespace:o});break;case"solana":this.rpcProviders[r]=new Yqe({namespace:o});break;case"cosmos":this.rpcProviders[r]=new Qqe({namespace:o});break;case"polkadot":this.rpcProviders[r]=new qqe({namespace:o});break;case"cip34":this.rpcProviders[r]=new Zqe({namespace:o});break;case"elrond":this.rpcProviders[r]=new Xqe({namespace:o});break;case"multiversx":this.rpcProviders[r]=new eVe({namespace:o});break;case"near":this.rpcProviders[r]=new tVe({namespace:o});break;case"tezos":this.rpcProviders[r]=new rVe({namespace:o});break;default:this.rpcProviders[Av]?this.rpcProviders[Av].updateNamespace(o):this.rpcProviders[Av]=new nVe({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&cf(i)&&this.events.emit("accountsChanged",i.map($qe))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=Hb(i),a=v7(i)!==v7(s)?`${o}:${v7(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=y7(C6({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",y7(C6({},sn("USER_DISCONNECTED")),{data:e.topic}))}),this.on(pc.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Av]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>Hb(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=Hb(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${CV}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${CV}/${e}`)}};const fVe=lVe,uVe="wc",dVe="ethereum_provider",hVe=`${uVe}@2:${dVe}:`,pVe="https://rpc.walletconnect.org/v1/",UT=["eth_sendTransaction","personal_sign"],vVe=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],$T=["chainChanged","accountsChanged"],gVe=["chainChanged","accountsChanged","message","disconnect","connect"];var yVe=Object.defineProperty,mVe=Object.defineProperties,bVe=Object.getOwnPropertyDescriptors,DV=Object.getOwnPropertySymbols,wVe=Object.prototype.hasOwnProperty,xVe=Object.prototype.propertyIsEnumerable,NV=(t,e,r)=>e in t?yVe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Sv=(t,e)=>{for(var r in e||(e={}))wVe.call(e,r)&&NV(t,r,e[r]);if(DV)for(var r of DV(e))xVe.call(e,r)&&NV(t,r,e[r]);return t},m7=(t,e)=>mVe(t,bVe(e));function u8(t){return Number(t[0].split(":")[1])}function A6(t){return`0x${t.toString(16)}`}function EVe(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:o,rpcMap:a}=t;if(!cf(e))throw new Error("Invalid chains");const c={chains:e,methods:n||UT,events:s||$T,rpcMap:Sv({},e.length?{[u8(e)]:a[u8(e)]}:{})},l=s==null?void 0:s.filter(g=>!$T.includes(g)),f=n==null?void 0:n.filter(g=>!UT.includes(g));if(!r&&!o&&!i&&!(l!=null&&l.length)&&!(f!=null&&f.length))return{required:e.length?c:void 0};const u=(l==null?void 0:l.length)&&(f==null?void 0:f.length)||!r,h={chains:[...new Set(u?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(i!=null&&i.length?i:vVe))],events:[...new Set(c.events.concat(o!=null&&o.length?o:gVe))],rpcMap:a};return{required:e.length?c:void 0,optional:r.length?h:void 0}}let CVe=class Eie{constructor(){this.events=new wa.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=hVe,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new Eie;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:r,optional:n}=EVe(this.rpc);try{const i=await new Promise(async(o,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(m7(Sv({namespaces:Sv({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(l=>{o(l)}).catch(l=>{a(new Error(l.message))})});if(!i)return;const s=iq(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:A6(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,r){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const n=await new Promise(async(s,o)=>{var a;this.rpc.showQrModal&&((a=this.modal)==null||a.subscribeModal(c=>{!c.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(m7(Sv({},e),{chains:this.rpc.chains}),r).then(c=>{s(c)}).catch(c=>{o(new Error(c.message))})}),i=n.session;if(i){const s=iq(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:A6(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:r}=e,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",A6(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",m7(Sv({},sn("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",A6(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e==null?void 0:e.chains)!=null?r:[],s=(n=e==null?void 0:e.optionalChains)!=null?n:[],o=i.concat(s);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const a=i.length?(e==null?void 0:e.methods)||UT:[],c=i.length?(e==null?void 0:e.events)||$T:[],l=(e==null?void 0:e.optionalMethods)||[],f=(e==null?void 0:e.optionalEvents)||[],u=(e==null?void 0:e.rpcMap)||this.buildRpcMap(o,e.projectId),h=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(g=>this.formatChainId(g)),optionalChains:s.map(g=>this.formatChainId(g)),methods:a,events:c,optionalMethods:l,optionalEvents:f,rpcMap:u,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:h,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?u8(this.rpc.chains):u8(this.rpc.optionalChains),this.signer=await fVe.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await _Pe(()=>import("./index-DBvK_T1-.js").then(i=>i.i),[]);r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(Sv({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&cf(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)})),n&&cf(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${pVe}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}};var Cie={exports:{}};/*! +}`;var gr=CN(function(){return Lr(se,Rt+"return "+qe).apply(r,he)});if(gr.source=qe,FA(gr))throw gr;return gr}function afe(d){return Jr(d).toLowerCase()}function cfe(d){return Jr(d).toUpperCase()}function lfe(d,p,_){if(d=Jr(d),d&&(_||p===r))return td(d);if(!d||!(p=Ho(p)))return d;var q=yo(d),J=yo(p),se=Bx(q,J),he=Lx(q,J)+1;return ud(q,se,he).join("")}function ffe(d,p,_){if(d=Jr(d),d&&(_||p===r))return d.slice(0,Dm(d)+1);if(!d||!(p=Ho(p)))return d;var q=yo(d),J=Lx(q,yo(p))+1;return ud(q,0,J).join("")}function ufe(d,p,_){if(d=Jr(d),d&&(_||p===r))return d.replace(Bt,"");if(!d||!(p=Ho(p)))return d;var q=yo(d),J=Bx(q,yo(p));return ud(q,J).join("")}function dfe(d,p){var _=ae,q=K;if(On(p)){var J="separator"in p?p.separator:J;_="length"in p?pr(p.length):_,q="omission"in p?Ho(p.omission):q}d=Jr(d);var se=d.length;if(Qr(d)){var he=yo(d);se=he.length}if(_>=se)return d;var me=_-Sf(q);if(me<1)return q;var Ce=he?ud(he,0,me).join(""):d.slice(0,me);if(J===r)return Ce+q;if(he&&(me+=Ce.length-me),jA(J)){if(d.slice(me).search(J)){var Be,Le=Ce;for(J.global||(J=Nm(J.source,Jr(tr.exec(J))+"g")),J.lastIndex=0;Be=J.exec(Le);)var qe=Be.index;Ce=Ce.slice(0,qe===r?me:qe)}}else if(d.indexOf(Ho(J),me)!=me){var ft=Ce.lastIndexOf(J);ft>-1&&(Ce=Ce.slice(0,ft))}return Ce+q}function hfe(d){return d=Jr(d),d&&Dt.test(d)?d.replace(ir,qx):d}var pfe=Jp(function(d,p,_){return d+(_?" ":"")+p.toUpperCase()}),qA=AD("toUpperCase");function EN(d,p,_){return d=Jr(d),p=_?r:p,p===r?Fx(d)?JC(d):UC(d):d.match(p)||[]}var CN=br(function(d,p){try{return li(d,r,p)}catch(_){return FA(_)?_:new Xt(_)}}),vfe=Rf(function(d,p){return go(p,function(_){_=ul(_),Pf(d,_,BA(d[_],d))}),d});function gfe(d){var p=d==null?0:d.length,_=Kt();return d=p?ln(d,function(q){if(typeof q[1]!="function")throw new mo(o);return[_(q[0]),q[1]]}):[],br(function(q){for(var J=-1;++Jx)return[];var _=k,q=hr(d,k);p=Kt(p),d-=k;for(var J=l0(q,p);++_0||p<0)?new kr(_):(d<0?_=_.takeRight(-d):d&&(_=_.drop(d)),p!==r&&(p=pr(p),_=p<0?_.dropRight(-p):_.take(p-d)),_)},kr.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},kr.prototype.toArray=function(){return this.take(k)},ll(kr.prototype,function(d,p){var _=/^(?:filter|find|map|reject)|While$/.test(p),q=/^(?:head|last)$/.test(p),J=ne[q?"take"+(p=="last"?"Right":""):p],se=q||/^find/.test(p);J&&(ne.prototype[p]=function(){var he=this.__wrapped__,me=q?[1]:arguments,Ce=he instanceof kr,Be=me[0],Le=Ce||sr(he),qe=function(Ar){var Dr=J.apply(ne,al([Ar],me));return q&&ft?Dr[0]:Dr};Le&&_&&typeof Be=="function"&&Be.length!=1&&(Ce=Le=!1);var ft=this.__chain__,Rt=!!this.__actions__.length,Yt=se&&!ft,gr=Ce&&!Rt;if(!se&&Le){he=gr?he:new kr(this);var Qt=d.apply(he,me);return Qt.__actions__.push({func:l3,args:[qe],thisArg:r}),new Sa(Qt,ft)}return Yt&&gr?d.apply(this,me):(Qt=this.thru(qe),Yt?q?Qt.value()[0]:Qt.value():Qt)})}),go(["pop","push","shift","sort","splice","unshift"],function(d){var p=$p[d],_=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",q=/^(?:pop|shift)$/.test(d);ne.prototype[d]=function(){var J=arguments;if(q&&!this.__chain__){var se=this.value();return p.apply(sr(se)?se:[],J)}return this[_](function(he){return p.apply(sr(he)?he:[],J)})}}),ll(kr.prototype,function(d,p){var _=ne[p];if(_){var q=_.name+"";Gr.call(mc,q)||(mc[q]=[]),mc[q].push({name:p,func:_})}}),mc[r3(r,E).name]=[{name:"wrapper",func:r}],kr.prototype.clone=hse,kr.prototype.reverse=pse,kr.prototype.value=vse,ne.prototype.at=zae,ne.prototype.chain=Hae,ne.prototype.commit=Gae,ne.prototype.next=Wae,ne.prototype.plant=Yae,ne.prototype.reverse=Qae,ne.prototype.toJSON=ne.prototype.valueOf=ne.prototype.value=Jae,ne.prototype.first=ne.prototype.head,z&&(ne.prototype[z]=Kae),ne},rd=ZC();pn?((pn.exports=rd)._=rd,rn._=rd):Cr._=rd}).call(xi)})(f8,f8.exports);var xqe=f8.exports,jT={exports:{}};(function(t,e){var r=typeof self<"u"?self:xi,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function c(v){return v&&DataView.prototype.isPrototypeOf(v)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(v){return v&&l.indexOf(Object.prototype.toString.call(v))>-1};function u(v){if(typeof v!="string"&&(v=String(v)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(v))throw new TypeError("Invalid character in header field name");return v.toLowerCase()}function h(v){return typeof v!="string"&&(v=String(v)),v}function g(v){var b={next:function(){var M=v.shift();return{done:M===void 0,value:M}}};return a.iterable&&(b[Symbol.iterator]=function(){return b}),b}function y(v){this.map={},v instanceof y?v.forEach(function(b,M){this.append(M,b)},this):Array.isArray(v)?v.forEach(function(b){this.append(b[0],b[1])},this):v&&Object.getOwnPropertyNames(v).forEach(function(b){this.append(b,v[b])},this)}y.prototype.append=function(v,b){v=u(v),b=h(b);var M=this.map[v];this.map[v]=M?M+", "+b:b},y.prototype.delete=function(v){delete this.map[u(v)]},y.prototype.get=function(v){return v=u(v),this.has(v)?this.map[v]:null},y.prototype.has=function(v){return this.map.hasOwnProperty(u(v))},y.prototype.set=function(v,b){this.map[u(v)]=h(b)},y.prototype.forEach=function(v,b){for(var M in this.map)this.map.hasOwnProperty(M)&&v.call(b,this.map[M],M,this)},y.prototype.keys=function(){var v=[];return this.forEach(function(b,M){v.push(M)}),g(v)},y.prototype.values=function(){var v=[];return this.forEach(function(b){v.push(b)}),g(v)},y.prototype.entries=function(){var v=[];return this.forEach(function(b,M){v.push([M,b])}),g(v)},a.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function m(v){if(v.bodyUsed)return Promise.reject(new TypeError("Already read"));v.bodyUsed=!0}function S(v){return new Promise(function(b,M){v.onload=function(){b(v.result)},v.onerror=function(){M(v.error)}})}function E(v){var b=new FileReader,M=S(b);return b.readAsArrayBuffer(v),M}function A(v){var b=new FileReader,M=S(b);return b.readAsText(v),M}function P(v){for(var b=new Uint8Array(v),M=new Array(b.length),B=0;B-1?b:v}function U(v,b){b=b||{};var M=b.body;if(v instanceof U){if(v.bodyUsed)throw new TypeError("Already read");this.url=v.url,this.credentials=v.credentials,b.headers||(this.headers=new y(v.headers)),this.method=v.method,this.mode=v.mode,this.signal=v.signal,!M&&v._bodyInit!=null&&(M=v._bodyInit,v.bodyUsed=!0)}else this.url=String(v);if(this.credentials=b.credentials||this.credentials||"same-origin",(b.headers||!this.headers)&&(this.headers=new y(b.headers)),this.method=I(b.method||this.method||"GET"),this.mode=b.mode||this.mode||null,this.signal=b.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&M)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(M)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function ie(v){var b=new FormData;return v.trim().split("&").forEach(function(M){if(M){var B=M.split("="),x=B.shift().replace(/\+/g," "),C=B.join("=").replace(/\+/g," ");b.append(decodeURIComponent(x),decodeURIComponent(C))}}),b}function ae(v){var b=new y,M=v.replace(/\r?\n[\t ]+/g," ");return M.split(/\r?\n/).forEach(function(B){var x=B.split(":"),C=x.shift().trim();if(C){var w=x.join(":").trim();b.append(C,w)}}),b}L.call(U.prototype);function K(v,b){b||(b={}),this.type="default",this.status=b.status===void 0?200:b.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in b?b.statusText:"OK",this.headers=new y(b.headers),this.url=b.url||"",this._initBody(v)}L.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},K.error=function(){var v=new K(null,{status:0,statusText:""});return v.type="error",v};var R=[301,302,303,307,308];K.redirect=function(v,b){if(R.indexOf(b)===-1)throw new RangeError("Invalid status code");return new K(null,{status:b,headers:{location:v}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(b,M){this.message=b,this.name=M;var B=Error(b);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function D(v,b){return new Promise(function(M,B){var x=new U(v,b);if(x.signal&&x.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var C=new XMLHttpRequest;function w(){C.abort()}C.onload=function(){var k={status:C.status,statusText:C.statusText,headers:ae(C.getAllResponseHeaders()||"")};k.url="responseURL"in C?C.responseURL:k.headers.get("X-Request-URL");var O="response"in C?C.response:C.responseText;M(new K(O,k))},C.onerror=function(){B(new TypeError("Network request failed"))},C.ontimeout=function(){B(new TypeError("Network request failed"))},C.onabort=function(){B(new o.DOMException("Aborted","AbortError"))},C.open(x.method,x.url,!0),x.credentials==="include"?C.withCredentials=!0:x.credentials==="omit"&&(C.withCredentials=!1),"responseType"in C&&a.blob&&(C.responseType="blob"),x.headers.forEach(function(k,O){C.setRequestHeader(O,k)}),x.signal&&(x.signal.addEventListener("abort",w),C.onreadystatechange=function(){C.readyState===4&&x.signal.removeEventListener("abort",w)}),C.send(typeof x._bodyInit>"u"?null:x._bodyInit)})}return D.polyfill=!0,s.fetch||(s.fetch=D,s.Headers=y,s.Request=U,s.Response=K),o.Headers=y,o.Request=U,o.Response=K,o.fetch=D,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(jT,jT.exports);var Eqe=jT.exports;const vV=$u(Eqe);var Cqe=Object.defineProperty,Aqe=Object.defineProperties,Sqe=Object.getOwnPropertyDescriptors,gV=Object.getOwnPropertySymbols,_qe=Object.prototype.hasOwnProperty,Iqe=Object.prototype.propertyIsEnumerable,yV=(t,e,r)=>e in t?Cqe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mV=(t,e)=>{for(var r in e||(e={}))_qe.call(e,r)&&yV(t,r,e[r]);if(gV)for(var r of gV(e))Iqe.call(e,r)&&yV(t,r,e[r]);return t},bV=(t,e)=>Aqe(t,Sqe(e));const Tqe={Accept:"application/json","Content-Type":"application/json"},Pqe="POST",wV={headers:Tqe,method:Pqe},xV=10;let rl=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new wa.EventEmitter,this.isAvailable=!1,this.registering=!1,!$q(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=Uu(e),n=await(await vV(this.url,bV(mV({},wV),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!$q(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Uu({id:1,jsonrpc:"2.0",method:"test",params:[]});await vV(e,bV(mV({},wV),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?cp(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=TC(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return Kne(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>xV&&this.events.setMaxListeners(xV)}};const EV="error",kqe="wss://relay.walletconnect.org",Rqe="wc",Mqe="universal_provider",CV=`${Rqe}@2:${Mqe}:`,mie="https://rpc.walletconnect.org/v1/",Av="generic",Oqe=`${mie}bundler`,pc={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Dqe=Object.defineProperty,Nqe=Object.defineProperties,Bqe=Object.getOwnPropertyDescriptors,AV=Object.getOwnPropertySymbols,Lqe=Object.prototype.hasOwnProperty,Fqe=Object.prototype.propertyIsEnumerable,SV=(t,e,r)=>e in t?Dqe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E6=(t,e)=>{for(var r in e||(e={}))Lqe.call(e,r)&&SV(t,r,e[r]);if(AV)for(var r of AV(e))Fqe.call(e,r)&&SV(t,r,e[r]);return t},jqe=(t,e)=>Nqe(t,Bqe(e));function ga(t,e,r){var n;const i=xg(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${mie}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Tp(t){return t.includes(":")?t.split(":")[1]:t}function bie(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Uqe(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function p7(t={},e={}){const r=_V(t),n=_V(e);return xqe.merge(r,n)}function _V(t){var e,r,n,i;const s={};if(!pw(t))return s;for(const[o,a]of Object.entries(t)){const c=TO(o)?[o]:a.chains,l=a.methods||[],f=a.events||[],u=a.rpcMap||{},h=Hb(o);s[h]=jqe(E6(E6({},s[h]),a),{chains:A5(c,(e=s[h])==null?void 0:e.chains),methods:A5(l,(r=s[h])==null?void 0:r.methods),events:A5(f,(n=s[h])==null?void 0:n.events),rpcMap:E6(E6({},u),(i=s[h])==null?void 0:i.rpcMap)})}return s}function $qe(t){return t.includes(":")?t.split(":")[2]:t}function IV(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=TO(r)?[r]:n.chains?n.chains:bie(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function v7(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const wie={},zr=t=>wie[t],g7=(t,e)=>{wie[t]=e};class qqe{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Tp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}var Vqe=Object.defineProperty,zqe=Object.defineProperties,Hqe=Object.getOwnPropertyDescriptors,TV=Object.getOwnPropertySymbols,Gqe=Object.prototype.hasOwnProperty,Wqe=Object.prototype.propertyIsEnumerable,PV=(t,e,r)=>e in t?Vqe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kV=(t,e)=>{for(var r in e||(e={}))Gqe.call(e,r)&&PV(t,r,e[r]);if(TV)for(var r of TV(e))Wqe.call(e,r)&&PV(t,r,e[r]);return t},RV=(t,e)=>zqe(t,Hqe(e));class Kqe{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||ga(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(Tp(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const c=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:RV(kV({},o.sessionProperties||{}),{capabilities:RV(kV({},a||{}),{[s]:c})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return c}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(rh("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${Oqe}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class Yqe{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Tp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}class Qqe{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Tp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}class Jqe{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||ga(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new hc(new rl(n,zr("disableProviderPing")))}}class Zqe{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=Tp(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}class Xqe{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Tp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}class eVe{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Tp(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}class tVe{constructor(e){this.name="near",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||ga(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace);return typeof n>"u"?void 0:new hc(new rl(n,zr("disableProviderPing")))}}class rVe{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||ga(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace);return typeof n>"u"?void 0:new hc(new rl(n))}}class nVe{constructor(e){this.name=Av,this.namespace=e.namespace,this.events=zr("events"),this.client=zr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(pc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=xg(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ga(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new hc(new rl(n,zr("disableProviderPing")))}}var iVe=Object.defineProperty,sVe=Object.defineProperties,oVe=Object.getOwnPropertyDescriptors,MV=Object.getOwnPropertySymbols,aVe=Object.prototype.hasOwnProperty,cVe=Object.prototype.propertyIsEnumerable,OV=(t,e,r)=>e in t?iVe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,C6=(t,e)=>{for(var r in e||(e={}))aVe.call(e,r)&&OV(t,r,e[r]);if(MV)for(var r of MV(e))cVe.call(e,r)&&OV(t,r,e[r]);return t},y7=(t,e)=>sVe(t,oVe(e));let lVe=class xie{constructor(e){this.events=new iO,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Ix(_C({level:(e==null?void 0:e.logger)||EV})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new xie(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:C6({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,IC(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:sn("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=IV(this.session.namespaces);this.namespaces=p7(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=IV(s.namespaces);this.namespaces=p7(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==yie)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Av?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(cf(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await MC.init({core:this.providerOpts.core,logger:this.providerOpts.logger||EV,relayUrl:this.providerOpts.relayUrl||kqe,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>Hb(r)))];g7("client",this.client),g7("events",this.events),g7("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Uqe(r,this.session),i=bie(n),s=p7(this.namespaces,this.optionalNamespaces),o=y7(C6({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new Kqe({namespace:o});break;case"algorand":this.rpcProviders[r]=new Jqe({namespace:o});break;case"solana":this.rpcProviders[r]=new Yqe({namespace:o});break;case"cosmos":this.rpcProviders[r]=new Qqe({namespace:o});break;case"polkadot":this.rpcProviders[r]=new qqe({namespace:o});break;case"cip34":this.rpcProviders[r]=new Zqe({namespace:o});break;case"elrond":this.rpcProviders[r]=new Xqe({namespace:o});break;case"multiversx":this.rpcProviders[r]=new eVe({namespace:o});break;case"near":this.rpcProviders[r]=new tVe({namespace:o});break;case"tezos":this.rpcProviders[r]=new rVe({namespace:o});break;default:this.rpcProviders[Av]?this.rpcProviders[Av].updateNamespace(o):this.rpcProviders[Av]=new nVe({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&cf(i)&&this.events.emit("accountsChanged",i.map($qe))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=Hb(i),a=v7(i)!==v7(s)?`${o}:${v7(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=y7(C6({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",y7(C6({},sn("USER_DISCONNECTED")),{data:e.topic}))}),this.on(pc.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Av]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>Hb(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=Hb(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${CV}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${CV}/${e}`)}};const fVe=lVe,uVe="wc",dVe="ethereum_provider",hVe=`${uVe}@2:${dVe}:`,pVe="https://rpc.walletconnect.org/v1/",UT=["eth_sendTransaction","personal_sign"],vVe=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],$T=["chainChanged","accountsChanged"],gVe=["chainChanged","accountsChanged","message","disconnect","connect"];var yVe=Object.defineProperty,mVe=Object.defineProperties,bVe=Object.getOwnPropertyDescriptors,DV=Object.getOwnPropertySymbols,wVe=Object.prototype.hasOwnProperty,xVe=Object.prototype.propertyIsEnumerable,NV=(t,e,r)=>e in t?yVe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Sv=(t,e)=>{for(var r in e||(e={}))wVe.call(e,r)&&NV(t,r,e[r]);if(DV)for(var r of DV(e))xVe.call(e,r)&&NV(t,r,e[r]);return t},m7=(t,e)=>mVe(t,bVe(e));function u8(t){return Number(t[0].split(":")[1])}function A6(t){return`0x${t.toString(16)}`}function EVe(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:o,rpcMap:a}=t;if(!cf(e))throw new Error("Invalid chains");const c={chains:e,methods:n||UT,events:s||$T,rpcMap:Sv({},e.length?{[u8(e)]:a[u8(e)]}:{})},l=s==null?void 0:s.filter(g=>!$T.includes(g)),f=n==null?void 0:n.filter(g=>!UT.includes(g));if(!r&&!o&&!i&&!(l!=null&&l.length)&&!(f!=null&&f.length))return{required:e.length?c:void 0};const u=(l==null?void 0:l.length)&&(f==null?void 0:f.length)||!r,h={chains:[...new Set(u?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(i!=null&&i.length?i:vVe))],events:[...new Set(c.events.concat(o!=null&&o.length?o:gVe))],rpcMap:a};return{required:e.length?c:void 0,optional:r.length?h:void 0}}let CVe=class Eie{constructor(){this.events=new wa.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=hVe,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new Eie;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:r,optional:n}=EVe(this.rpc);try{const i=await new Promise(async(o,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(m7(Sv({namespaces:Sv({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(l=>{o(l)}).catch(l=>{a(new Error(l.message))})});if(!i)return;const s=iq(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:A6(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,r){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const n=await new Promise(async(s,o)=>{var a;this.rpc.showQrModal&&((a=this.modal)==null||a.subscribeModal(c=>{!c.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(m7(Sv({},e),{chains:this.rpc.chains}),r).then(c=>{s(c)}).catch(c=>{o(new Error(c.message))})}),i=n.session;if(i){const s=iq(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:A6(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:r}=e,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",A6(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",m7(Sv({},sn("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",A6(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e==null?void 0:e.chains)!=null?r:[],s=(n=e==null?void 0:e.optionalChains)!=null?n:[],o=i.concat(s);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const a=i.length?(e==null?void 0:e.methods)||UT:[],c=i.length?(e==null?void 0:e.events)||$T:[],l=(e==null?void 0:e.optionalMethods)||[],f=(e==null?void 0:e.optionalEvents)||[],u=(e==null?void 0:e.rpcMap)||this.buildRpcMap(o,e.projectId),h=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(g=>this.formatChainId(g)),optionalChains:s.map(g=>this.formatChainId(g)),methods:a,events:c,optionalMethods:l,optionalEvents:f,rpcMap:u,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:h,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?u8(this.rpc.chains):u8(this.rpc.optionalChains),this.signer=await fVe.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await _Pe(()=>import("./index-BTRILIvE.js").then(i=>i.i),[]);r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(Sv({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&cf(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)})),n&&cf(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${pVe}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}};var Cie={exports:{}};/*! * EventEmitter2 * https://github.com/hij1nx/EventEmitter2 * * Copyright (c) 2013 hij1nx * Licensed under the MIT license. */(function(t,e){(function(r){var n=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(C){return Object.prototype.toString.call(C)==="[object Array]"},s=10,o=typeof process=="object"&&typeof process.nextTick=="function",a=typeof Symbol=="function",c=typeof Reflect=="object",l=typeof setImmediate=="function",f=l?setImmediate:setTimeout,u=a?c&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(x){var C=Object.getOwnPropertyNames(x);return C.push.apply(C,Object.getOwnPropertySymbols(x)),C}:Object.keys;function h(){this._events={},this._conf&&g.call(this,this._conf)}function g(x){x&&(this._conf=x,x.delimiter&&(this.delimiter=x.delimiter),x.maxListeners!==r&&(this._maxListeners=x.maxListeners),x.wildcard&&(this.wildcard=x.wildcard),x.newListener&&(this._newListener=x.newListener),x.removeListener&&(this._removeListener=x.removeListener),x.verboseMemoryLeak&&(this.verboseMemoryLeak=x.verboseMemoryLeak),x.ignoreErrors&&(this.ignoreErrors=x.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function y(x,C){var w="(node) warning: possible EventEmitter memory leak detected. "+x+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(w+=" Event name: "+C+"."),typeof process<"u"&&process.emitWarning){var k=new Error(w);k.name="MaxListenersExceededWarning",k.emitter=this,k.count=x,process.emitWarning(k)}else console.error(w),console.trace&&console.trace()}var m=function(x,C,w){var k=arguments.length;switch(k){case 0:return[];case 1:return[x];case 2:return[x,C];case 3:return[x,C,w];default:for(var O=new Array(k);k--;)O[k]=arguments[k];return O}};function S(x,C){for(var w={},k,O=x.length,G=0,oe=0;oe0;)x=G[X],oe.call($,x,w[x]);this._listeners={},this._listenersCount=0,W()}}});function A(x,C,w,k){var O=Object.assign({},C);if(!x)return O;if(typeof x!="object")throw TypeError("options must be an object");var G=Object.keys(x),oe=G.length,$,X,W;function Z(F){throw Error('Invalid "'+$+'" option value'+(F?". Reason: "+F:""))}for(var te=0;te0;)if($===x[X])return G;oe(C)}}var L=N(["function"]),V=N(["object","function"]);function I(x,C,w){var k,O,G=0,oe,$=new x(function(X,W,Z){w=A(w,{timeout:0,overload:!1},{timeout:function(fe,xe){return fe*=1,(typeof fe!="number"||fe<0||!Number.isFinite(fe))&&xe("timeout must be a positive number"),fe}}),k=!w.overload&&typeof x.prototype.cancel=="function"&&typeof Z=="function";function te(){O&&(O=null),G&&(clearTimeout(G),G=0)}var F=function(fe){te(),X(fe)},ee=function(fe){te(),W(fe)};k?C(F,ee,Z):(O=[function(fe){ee(fe||Error("canceled"))}],C(F,ee,function(fe){if(oe)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof fe!="function")throw TypeError("onCancel callback must be a function");O.push(fe)}),oe=!0),w.timeout>0&&(G=setTimeout(function(){var fe=Error("timeout");fe.code="ETIMEDOUT",G=0,$.cancel(fe),W(fe)},w.timeout))});return k||($.cancel=function(X){if(O){for(var W=O.length,Z=1;Z0;)ee=Je[$],ee!=="_listeners"&&(Xe=ie(x,C,w[ee],k+1,O),Xe&&(F?F.push.apply(F,Xe):F=Xe));return F}else if(Ke==="**"){for(Me=k+1===O||k+2===O&&ze==="*",Me&&w._listeners&&(F=ie(x,C,w,O,O)),Je=u(w),$=Je.length;$-- >0;)ee=Je[$],ee!=="_listeners"&&(ee==="*"||ee==="**"?(w[ee]._listeners&&!Me&&(Xe=ie(x,C,w[ee],O,O),Xe&&(F?F.push.apply(F,Xe):F=Xe)),Xe=ie(x,C,w[ee],k,O)):ee===ze?Xe=ie(x,C,w[ee],k+2,O):Xe=ie(x,C,w[ee],k,O),Xe&&(F?F.push.apply(F,Xe):F=Xe));return F}else w[Ke]&&(F=ie(x,C,w[Ke],k+1,O));if(fe=w["*"],fe&&ie(x,C,fe,k+1,O),xe=w["**"],xe)if(k0;)ee=Je[$],ee!=="_listeners"&&(ee===ze?ie(x,C,xe[ee],k+2,O):ee===Ke?ie(x,C,xe[ee],k+1,O):(_e={},_e[ee]=xe[ee],ie(x,C,{"**":_e},k+1,O)));else xe._listeners?ie(x,C,xe,O,O):xe["*"]&&xe["*"]._listeners&&ie(x,C,xe["*"],O,O);return F}function ae(x,C,w){var k=0,O=0,G,oe=this.delimiter,$=oe.length,X;if(typeof x=="string")if((G=x.indexOf(oe))!==-1){X=new Array(5);do X[k++]=x.slice(O,G),O=G+$;while((G=x.indexOf(oe,O))!==-1);X[k++]=x.slice(O)}else X=[x],k=1;else X=x,k=x.length;if(k>1){for(G=0;G+10&&W._listeners.length>this._maxListeners&&(W._listeners.warned=!0,y.call(this,W._listeners.length,Z))):W._listeners=C,!0;return!0}function K(x,C,w,k){for(var O=u(x),G=O.length,oe,$,X,W=x._listeners,Z;G-- >0;)$=O[G],oe=x[$],$==="_listeners"?X=w:X=w?w.concat($):[$],Z=k||typeof $=="symbol",W&&C.push(Z?X:X.join(this.delimiter)),typeof oe=="object"&&K.call(this,oe,C,X,Z);return C}function R(x){for(var C=u(x),w=C.length,k,O,G;w-- >0;)O=C[w],k=x[O],k&&(G=!0,O!=="_listeners"&&!R(k)&&delete x[O]);return G}function D(x,C,w){this.emitter=x,this.event=C,this.listener=w}D.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function v(x,C,w){if(w===!0)O=!0;else if(w===!1)k=!0;else{if(!w||typeof w!="object")throw TypeError("options should be an object or true");var k=w.async,O=w.promisify,G=w.nextTick,oe=w.objectify}if(k||G||O){var $=C,X=C._origin||C;if(G&&!o)throw Error("process.nextTick is not supported");O===r&&(O=C.constructor.name==="AsyncFunction"),C=function(){var W=arguments,Z=this,te=this.event;return O?G?Promise.resolve():new Promise(function(F){f(F)}).then(function(){return Z.event=te,$.apply(Z,W)}):(G?process.nextTick:f)(function(){Z.event=te,$.apply(Z,W)})},C._async=!0,C._origin=X}return[C,oe?new D(this,x,C):this]}function b(x){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,g.call(this,x)}b.EventEmitter2=b,b.prototype.listenTo=function(x,C,w){if(typeof x!="object")throw TypeError("target musts be an object");var k=this;w=A(w,{on:r,off:r,reducers:r},{on:L,off:L,reducers:V});function O(G){if(typeof G!="object")throw TypeError("events must be an object");var oe=w.reducers,$=U.call(k,x),X;$===-1?X=new E(k,x,w):X=k._observers[$];for(var W=u(G),Z=W.length,te,F=typeof oe=="function",ee=0;ee0;)O=w[k],(!x||O._target===x)&&(O.unsubscribe(C),G=!0);return G},b.prototype.delimiter=".",b.prototype.setMaxListeners=function(x){x!==r&&(this._maxListeners=x,this._conf||(this._conf={}),this._conf.maxListeners=x)},b.prototype.getMaxListeners=function(){return this._maxListeners},b.prototype.event="",b.prototype.once=function(x,C,w){return this._once(x,C,!1,w)},b.prototype.prependOnceListener=function(x,C,w){return this._once(x,C,!0,w)},b.prototype._once=function(x,C,w,k){return this._many(x,1,C,w,k)},b.prototype.many=function(x,C,w,k){return this._many(x,C,w,!1,k)},b.prototype.prependMany=function(x,C,w,k){return this._many(x,C,w,!0,k)},b.prototype._many=function(x,C,w,k,O){var G=this;if(typeof w!="function")throw new Error("many only accepts instances of Function");function oe(){return--C===0&&G.off(x,oe),w.apply(this,arguments)}return oe._origin=w,this._on(x,oe,k,O)},b.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var x=arguments[0],C,w=this.wildcard,k,O,G,oe,$;if(x==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(w&&(C=x,x!=="newListener"&&x!=="removeListener"&&typeof x=="object")){if(O=x.length,a){for(G=0;G3)for(k=new Array(X-1),oe=1;oe3)for(O=new Array(W-1),$=1;$0&&this._events[x].length>this._maxListeners&&(this._events[x].warned=!0,y.call(this,this._events[x].length,x))):this._events[x]=C,O)},b.prototype.off=function(x,C){if(typeof C!="function")throw new Error("removeListener only takes instances of Function");var w,k=[];if(this.wildcard){var O=typeof x=="string"?x.split(this.delimiter):x.slice();if(k=ie.call(this,null,O,this.listenerTree,0),!k)return this}else{if(!this._events[x])return this;w=this._events[x],k.push({_listeners:w})}for(var G=0;G0){for(k=this._all,C=0,w=k.length;C0;)k=C[w[G]],typeof k=="function"?O.push(k):O.push.apply(O,k);return O}else{if(this.wildcard){if(oe=this.listenerTree,!oe)return[];var $=[],X=typeof x=="string"?x.split(this.delimiter):x.slice();return ie.call(this,$,X,oe,0),$}return C?(k=C[x],k?typeof k=="function"?[k]:k:[]):[]}},b.prototype.eventNames=function(x){var C=this._events;return this.wildcard?K.call(this,this.listenerTree,[],null,x):C?u(C):[]},b.prototype.listenerCount=function(x){return this.listeners(x).length},b.prototype.hasListeners=function(x){if(this.wildcard){var C=[],w=typeof x=="string"?x.split(this.delimiter):x.slice();return ie.call(this,C,w,this.listenerTree,0),C.length>0}var k=this._events,O=this._all;return!!(O&&O.length||k&&(x===r?u(k).length:k[x]))},b.prototype.listenersAny=function(){return this._all?this._all:[]},b.prototype.waitFor=function(x,C){var w=this,k=typeof C;return k==="number"?C={timeout:C}:k==="function"&&(C={filter:C}),C=A(C,{timeout:0,filter:r,handleError:!1,Promise,overload:!1},{filter:L,Promise:P}),I(C.Promise,function(O,G,oe){function $(){var X=C.filter;if(!(X&&!X.apply(w,arguments)))if(w.off(x,$),C.handleError){var W=arguments[0];W?G(W):O(m.apply(null,arguments).slice(1))}else O(m.apply(null,arguments))}oe(function(){w.off(x,$)}),w._on(x,$,!1)},{timeout:C.timeout,overload:C.overload})};function M(x,C,w){w=A(w,{Promise,timeout:0,overload:!1},{Promise:P});var k=w.Promise;return I(k,function(O,G,oe){var $;if(typeof x.addEventListener=="function"){$=function(){O(m.apply(null,arguments))},oe(function(){x.removeEventListener(C,$)}),x.addEventListener(C,$,{once:!0});return}var X=function(){W&&x.removeListener("error",W),O(m.apply(null,arguments))},W;C!=="error"&&(W=function(Z){x.removeListener(C,X),G(Z)},x.once("error",W)),oe(function(){W&&x.removeListener("error",W),x.removeListener(C,X)}),x.once(C,X)},{timeout:w.timeout,overload:w.overload})}var B=b.prototype;Object.defineProperties(b,{defaultMaxListeners:{get:function(){return B._maxListeners},set:function(x){if(typeof x!="number"||x<0||Number.isNaN(x))throw TypeError("n must be a non-negative number");B._maxListeners=x},enumerable:!0},once:{value:M,writable:!0,configurable:!0}}),Object.defineProperties(B,{_maxListeners:{value:s,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=b})()})(Cie);var AVe=Cie.exports,qT=function(){return qT=Object.assign||function(e){for(var r,n=1,i=arguments.length;n0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]0&&(i.types.Claims.push({name:"app",type:"string"}),i.message.app=this.claims.app),this.claims.iat&&this.claims.iat>0&&(i.types.Claims.push({name:"iat",type:"int64"}),i.message.iat=this.claims.iat),this.claims.exp&&this.claims.exp>0&&(i.types.Claims.push({name:"exp",type:"int64"}),i.message.exp=this.claims.exp),this.claims.n&&this.claims.n>0&&(i.types.Claims.push({name:"n",type:"uint64"}),i.message.n=this.claims.n),this.claims.typ&&this.claims.typ.length>0&&(i.types.Claims.push({name:"typ",type:"string"}),i.message.typ=this.claims.typ),this.claims.ogn&&this.claims.ogn.length>0&&(i.types.Claims.push({name:"ogn",type:"string"}),i.message.ogn=this.claims.ogn),this.claims.v&&this.claims.v.length>0&&(i.types.Claims.push({name:"v",type:"string"}),i.message.v=this.claims.v),i},t}(),IVe=function(t){if(t.app==="")return{ok:!1,err:new Error("claims: app is empty")};var e=Math.round(new Date().getTime()/1e3),r=5*60,n=60*60*24*365+r;return t.v===""?{ok:!1,err:new Error("claims: ethauth version is empty")}:t.iat&&t.iat!==0&&(t.iat>e+r||t.iate+n?{ok:!1,err:new Error("claims: token has expired")}:{ok:!0}},TVe=function(t,e,r){return z0(void 0,void 0,void 0,function(){var n,i;return H0(this,function(s){return n=r.messageDigest(),i=gCe(n,r.signature),i.slice(0,2)==="0x"&&i.length===42&&i.toLowerCase()===r.address.toLowerCase()?[2,{isValid:!0,address:r.address}]:[2,{isValid:!1}]})})},PVe=function(t,e,r){return z0(void 0,void 0,void 0,function(){var n,i,s,o,a;return H0(this,function(c){switch(c.label){case 0:return!t||t===void 0?[2,{isValid:!1}]:(n=r.messageDigest(),[4,t.getCode(r.address)]);case 1:if(i=c.sent(),i==="0x"||i.length<=2)throw new Error("ValidateContractAccountProof failed. unable to fetch wallet contract code");return s=["function isValidSignature(bytes32, bytes) public view returns (bytes4)"],o=new Si(r.address,s,t),[4,o.isValidSignature(n,Fe(r.signature))];case 2:return a=c.sent(),a===kVe?[2,{isValid:!0,address:r.address}]:[2,{isValid:!1}]}})})},kVe="0x1626ba7e",RVe=function(){function t(){for(var e=[],r=0;r0&&(c+="."+i.extra),[2,c]}})})},this.decodeProof=function(i,s){return s===void 0&&(s=!1),z0(n,void 0,void 0,function(){var o,a,c,l,f,u,h,g,y,m;return H0(this,function(S){switch(S.label){case 0:if(o=i.split("."),o.length<4||o.length>5)throw new Error("ethauth: invalid proof string");if(a=o[0],c=o[1],l=o[2],f=o[3],u=o[4],a!==VT)throw new Error("ethauth: not an ethauth proof");return h=bU.decode(l),g=JSON.parse(h),y=new Sie({address:c,claims:g,signature:f,extra:u}),[4,this.validateProof(y,s)];case 1:if(m=S.sent(),!m)throw new Error("ethauth: proof is invalid");return[2,y]}})})},this.validateProof=function(i,s){return s===void 0&&(s=!1),z0(n,void 0,void 0,function(){var o,a;return H0(this,function(c){switch(c.label){case 0:if(o=this.validateProofClaims(i),o.err)throw new Error("ethauth: proof claims are invalid ".concat(o.err));return s===!0?[3,2]:[4,this.validateProofSignature(i)];case 1:if(a=c.sent(),a!==!0)throw new Error("ethauth: proof signature is invalid");c.label=2;case 2:return[2,!0]}})})},this.validateProofSignature=function(i){return z0(n,void 0,void 0,function(){var s,c,o,a,c;return H0(this,function(l){switch(l.label){case 0:s=[],c=0,l.label=1;case 1:if(!(c{const n=Zt(await t.getAddress());if(!n||n===""||n==="0x")throw DVe;const i=new Sie;if(i.address=n,!r||!r.app||r.app==="")throw new _ie("authorization options requires app to be set");i.claims.app=r.app,i.claims.ogn=r.origin,i.claims.n=r.nonce,i.setExpiryIn(r.expiry?Math.max(r.expiry,200):MVe);const s=i.messageTypedData(),o=NSe(e);i.signature=await(t instanceof fx?t.signTypedData(s.domain,s.types,s.message,o,"eip6492"):t.signTypedData(s.domain,s.types,s.message,o));const c=await new RVe().encodeProof(i,!0);return{typedData:s,proofString:c}};class _ie extends Error{constructor(e){super(e),this.name="AuthError"}}const DVe=new _ie("auth error: account address is empty");yt.context.defaultContexts,new VM.remote.RemoteConfigTracker("https://sessions.sequence.app");const NVe=new Map(["addHook(bytes4,address)","clearExtraImageHashes(bytes32[])","removeHook(bytes4)","setExtraImageHash(bytes32,uint256)","updateIPFSRoot(bytes32)","updateImageHash(bytes32)","updateImageHashAndIPFS(bytes32,bytes32)","updateImplementation(address)"].map(t=>[Bo(t).slice(0,10),t]));function zT(t,e){const r=yt.transaction.fromTransactionish(t,e);yt.transaction.unwind(t,r).forEach(i=>BVe(t,i))}function BVe(t,e){if(e.to.toLowerCase()===t.toLowerCase()&&e.data){const r=Fe(e.data);if(r.length>=4&&!LVe(r))throw new Error("self calls are forbidden")}if(e.delegateCall)throw new Error("delegate calls are forbidden");if(e.data){const n=ke(e.data).slice(0,10),i=NVe.get(n);if(i){const s=i.slice(0,i.indexOf("("));throw new Error(`${s} calls are forbidden`)}}}function LVe(t){const e=new ls(Os.mainModule.abi);try{return e.decodeFunctionData("createContract",t),!0}catch{return!1}}function jc(){return jc=Object.assign?Object.assign.bind():function(t){for(var e=1;ee.predicate(t))}const $Ve=[{name:"Decentraland Exception",predicate:VVe},{name:"0x v3 Exception",predicate:zVe}],qVe=/^Decentraland Login\nEphemeral address: 0x[a-fA-F0-9]{40}\nExpiration: (\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)((-(\d{2}):(\d{2})|Z)?)$/;function VVe(t){try{const e=J1(t);return qVe.test(e)}catch{return!1}}function zVe(t){const e=new ls(HVe);try{return e.decodeFunctionData("OrderWithHash",t),!0}catch{return!1}}const HVe=[{inputs:[{components:[{internalType:"address",name:"makerAddress",type:"address"},{internalType:"address",name:"takerAddress",type:"address"},{internalType:"address",name:"feeRecipientAddress",type:"address"},{internalType:"address",name:"senderAddress",type:"address"},{internalType:"uint256",name:"makerAssetAmount",type:"uint256"},{internalType:"uint256",name:"takerAssetAmount",type:"uint256"},{internalType:"uint256",name:"makerFee",type:"uint256"},{internalType:"uint256",name:"takerFee",type:"uint256"},{internalType:"uint256",name:"expirationTimeSeconds",type:"uint256"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes",name:"makerAssetData",type:"bytes"},{internalType:"bytes",name:"takerAssetData",type:"bytes"},{internalType:"bytes",name:"makerFeeAssetData",type:"bytes"},{internalType:"bytes",name:"takerFeeAssetData",type:"bytes"}],internalType:"struct IEIP1271Data.Order",name:"order",type:"tuple"},{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderWithHash",outputs:[],stateMutability:"pure",type:"function"}],k5=Ai(`Ethereum Signed Message: -`),GVe=t=>Ru(t)?Fe(t):Ai(t),Iie=t=>{const e=GVe(t);return UVe(e)?e:Fe(Vr([k5,Ai(String(e.length)),e]))},WVe=t=>{if(JSON.stringify(t.slice(0,k5.length))!==JSON.stringify(k5))return t;const e=t.slice(k5.length),r=String(e.length).length;let n,i;try{i=Number(J1(e.slice(0,r)))}catch{i=Number(ke(e.slice(0,r)))}return i>e.length||!Number.isInteger(i)?n=r-1:n=r,e.slice(n)},BV=async(t,e,r,n)=>new yt.reader.OnChainReader(n).isValidSignature(t,e,r);async function KVe(t){return Array.isArray(t)?Promise.all(t.map(e=>fi(e))):fi(t)}function YVe(t){return[t,...t.auxiliary||[]]}const QVe=1e4;class JVe{constructor(e,r,n){var i=this;this.account=void 0,this.signerReadyCallbacks=[],this.prompter=void 0,this.networks=void 0,this._openIntent=void 0,this._connectOptions=void 0,this.events=new AVe.EventEmitter2,this.onConnectOptionsChange=void 0,this.promptConnect=async function(s){if(!s&&!i._connectOptions)throw new Error("prompter connect options are empty");if(!i.prompter)return i.connect(s);const o=await i.prompter.promptConnect(s||i._connectOptions).catch(c=>({connected:!1})),a=o;return a.connected&&!a.session&&(a.session=await i.walletSession(s==null?void 0:s.networkId)),o},this.isSignedIn=async function(){return await i.signerReady(),!!i.account},this.getAccount=async function(){if(await i.signerReady(),i.account===void 0)throw new Error("signerReady failed resolve");return i.account},this.account=e,this.prompter=r,this.networks=n}defaultChainId(){var e,r;return(e=(r=this.prompter)==null?void 0:r.getDefaultChainId())!=null?e:this.networks[0].chainId}async signIn(e,r={}){this.setAccount(e);const{connect:n,defaultNetworkId:i}=r;if(n){const a=this._connectOptions;let c;if(this.prompter!==null){var s;c=await((s=this.prompter)==null?void 0:s.promptSignInConnect(a))}else c=await this.connect(a);this.notifyConnect(c),(!a||a.keepWalletOpened!==!0)&&this.notifyClose()}if(i&&this.defaultChainId()!==i){var o;await((o=this.prompter)==null?void 0:o.promptChangeNetwork(i))}}signOut(){this.account&&this.notifyDisconnect(),this.setAccount(null)}signerReset(){this.account=void 0}signerReady(e=QVe){return new Promise((r,n)=>{this.account!==void 0?r():(setTimeout(()=>{this.account===void 0&&(this.signerReadyCallbacks=[],n("signerReady timed out"))},e),this.signerReadyCallbacks.push(r))})}async connect(e){var r,n;if(!this.account)return{connected:!1,chainId:"0x0",error:"unable to connect without signed in account"};const i=(r=(n=e==null?void 0:e.networkId)!=null?n:this.defaultChainId())!=null?r:ge.MAINNET,s=DSe(i).chainId,o={connected:!0,chainId:qc(s)};if(e&&e.authorize){const a={app:e.app,origin:e.origin,expiry:e.expiry,nonce:e.authorizeNonce};try{o.proof=await OVe(this.account,s,a)}catch(c){return bi.warn(`connect, signAuthorization failed for options: ${JSON.stringify(e)}, due to: ${c.message}`),{connected:!1,chainId:"0x0",error:`signAuthorization failed: ${c.message}`}}}return o.session=this.walletSession(s),o}async sendMessageRequest(e){var r;const i=Number(((r=e.clientVersion)==null?void 0:r.split(".")[0])||"0")<2,s={id:e.data.id,jsonrpc:"2.0",result:null,error:void 0};try{const o=await this.request({method:e.data.method,params:e.data.params,chainId:e.chainId,origin:e.origin,projectAccessKey:e.projectAccessKey});return jc({},e,{data:i?jc({},s,{result:o}):o})}catch(o){return jc({},e,{data:i?jc({},s,{error:o}):{error:o}})}}async request(e){await this.getAccount();try{var r,n;if((!this.account||this.account===null)&&!ZVe.includes(e.method))throw jVe;const l=this.account;if(!l)throw new Error("WalletRequestHandler: wallet account is not configured");const f=(r=this.account)==null?void 0:r.providerFor((n=e.chainId)!=null?n:this.defaultChainId());if(!f)throw new Error(`WalletRequestHandler: wallet provider is not configured for chainId ${e.chainId}`);const u=XVe(f)?f:void 0;switch(e.method){case"net_version":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("net_version",[])}case"eth_chainId":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("eth_chainId",[])}case"eth_accounts":return[l.address];case"eth_getBalance":{const[h,g]=e.params,y=await f.getBalance(h,g);return hg(y)}case"sequence_sign":case"personal_sign":case"eth_sign":{let h;switch(e.method){case"sequence_sign":case"personal_sign":{const[S,E]=e.params;h=S;break}case"eth_sign":{const[S,E]=e.params;h=E;break}}let g="";const y=Iie(h),m=e.method==="sequence_sign";if(this.prompter===null){var i;g=await l.signMessage(y,(i=e.chainId)!=null?i:this.defaultChainId(),m?"eip6492":"ignore")}else g=await this.prompter.promptSignMessage({chainId:e.chainId,message:Fe(y),eip6492:m},e.origin,e.projectAccessKey);if(g&&g.length>0)return g;throw new Error("declined by user")}case"sequence_signTypedData_v4":case"eth_signTypedData":case"eth_signTypedData_v4":{const[h,g]=e.params;let y;if(typeof g=="string")try{y=JSON.parse(g)}catch(E){console.warn("walletRequestHandler: error parsing typedData",E)}else y=g;if(!y||!y.domain||!y.types||!y.message)throw new Error("invalid typedData object");let m="";const S=e.method==="sequence_signTypedData_v4";if(this.prompter===null){var s;m=await l.signTypedData(y.domain,y.types,y.message,(s=e.chainId)!=null?s:this.defaultChainId(),S?"eip6492":"ignore")}else m=await this.prompter.promptSignMessage({chainId:e.chainId,typedData:y,eip6492:S},e.origin,e.projectAccessKey);if(m&&m.length>0)return m;throw new Error("declined by user")}case"eth_sendTransaction":{const h=YVe(e.params[0]).map(y=>("gas"in y&&y.gasLimit===void 0&&(y.gasLimit=y.gas,delete y.gas),y));zT(l.address,h);let g="";if(this.prompter===null){var o,a;const y=await l.sendTransaction(h,(o=e.chainId)!=null?o:this.defaultChainId());g=(a=y==null?void 0:y.hash)!=null?a:""}else g=await this.prompter.promptSendTransaction(h,e.chainId,e.origin,e.projectAccessKey);if(g)return g;throw new Error("declined by user")}case"eth_signTransaction":{const[h]=e.params;if(Zt(h.from)!==l.address)throw new Error("sender address does not match wallet");if(zT(l.address,h),this.prompter===null){var c;return await l.signTransactions(h,(c=e.chainId)!=null?c:this.defaultChainId())}else return await this.prompter.promptSignTransaction(h,e.chainId,e.origin,e.projectAccessKey)}case"eth_sendRawTransaction":if(yt.transaction.isSignedTransactionBundle(e.params[0])){const h=Number(e.params[0].chainId);return(await l.relayer(h).relay(e.params[0])).hash}else return(await f.broadcastTransaction(e.params[0])).hash;case"eth_getTransactionCount":{const h=Zt(e.params[0]),g=e.params[1],y=await f.getTransactionCount(h,g);return hg(BigInt(y))}case"eth_blockNumber":return await f.getBlockNumber();case"eth_getBlockByNumber":return await f.getBlock(e.params[0]);case"eth_getBlockByHash":return await f.getBlock(e.params[0]);case"eth_getTransactionByHash":return await f.getTransaction(e.params[0]);case"eth_call":{const[h,g]=e.params;return await f.call(jc({},h,{blockTag:g}))}case"eth_getCode":{const[h,g]=e.params;return await f.getCode(h,g)}case"eth_estimateGas":{const[h]=e.params;return await f.estimateGas(h)}case"eth_gasPrice":{const h=await f.getFeeData();return h.gasPrice===null?null:hg(h.gasPrice)}case"wallet_switchEthereumChain":{const[h]=e.params;if(!h.chainId||h.chainId.length===0)throw new Error("invalid chainId");const g=BigInt(h.chainId);return this.setDefaultChainId(Number(g)),null}case"sequence_getWalletContext":return l.contexts;case"sequence_getWalletConfig":{const[h]=e.params;return h?[(await l.status(h)).onChain.config]:await Promise.all(l.networks.map(async function(g){return(await l.status(g.chainId)).onChain.config}))}case"sequence_getWalletState":{const[h]=e.params;return h?[LV(h,await l.status(h))]:await Promise.all(l.networks.map(async function(g){const y=await l.status(g.chainId);return LV(g.chainId,y)}))}case"sequence_getNetworks":return await this.getNetworks(!0);case"sequence_isSequence":return!0;case"sequence_updateConfig":throw new Error("sequence_updateConfig method is not allowed from a dapp");case"sequence_publishConfig":throw new Error("sequence_publishConfig method is not allowed from a dapp");case"sequence_gasRefundOptions":break;case"sequence_getNonce":break;case"sequence_relay":break;case"sequence_setDefaultNetwork":{const[h]=e.params;if(!h)throw new Error("invalid request, method argument defaultChainId cannot be empty");return this.setDefaultChainId(h),await this.getNetworks(!0)}default:{if(!u)throw new Error("Account provider doesn't support send method");return await u.send(e.method,e.params)}}}catch(l){throw bi.error(l),{message:typeof l=="string"?l:(l==null?void 0:l.message)||"unkown error",code:4001}}}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}async getAddress(){var e,r;return(e=(r=this.account)==null?void 0:r.address)!=null?e:""}get openIntent(){return this._openIntent}setOpenIntent(e){this._openIntent=e}get connectOptions(){return this._connectOptions}setConnectOptions(e){var r;this._connectOptions=e,(r=this.onConnectOptionsChange)==null||r.call(this,e)}async setDefaultChainId(e){var r;return await((r=this.prompter)==null?void 0:r.promptChangeNetwork(e)),this.defaultChainId()}async getNetworks(e){return this.account?e?this.account.networks.map(r=>{const n=jc({},r);return n.provider=void 0,n.relayer=void 0,n}):this.account.networks:(bi.warn("signer not set: getNetworks is returning an empty list"),[])}walletSession(e){if(!this.account)return;const r={walletContext:this.account.contexts,accountAddress:this.account.address,networks:this.account.networks.map(i=>jc({},i,{provider:void 0,relayer:void 0}))};if(e){const i=aw(r.networks,e);if(i){var n;(n=r.networks)==null||n.forEach(s=>delete s.isDefaultChain),i.isDefaultChain=!0}}return r}notifyConnect(e,r){var n;if(console.log("emit connect",e),this.events.emit("connect",e),(n=e.session)!=null&&n.accountAddress){var i;this.events.emit("accountsChanged",[(i=e.session)==null?void 0:i.accountAddress],r)}}notifyDisconnect(e){this.events.emit("accountsChanged",[],e),this.events.emit("disconnect",void 0,e)}notifyChainChanged(e,r){this.events.emit("chainChanged",qc(e),r)}async notifyNetworks(e){const r=e||await this.getNetworks(!0);if(this.events.emit("networks",r),r.length>0){const n=r.find(i=>i.chainId===this.defaultChainId());n&&this.events.emit("chainChanged",qc(n.chainId))}else this.events.emit("chainChanged","0x0")}async notifyWalletContext(){if(!this.account){bi.warn("signer not set: skipping to notify wallet context");return}const e=this.account.contexts;this.events.emit("walletContext",e)}notifyClose(e){this.events.emit("close",e)}setAccount(e){if(this.account=e,e!==void 0){for(let r=0;rl.canOnchainValidate||l.original.version===2&&n,a=await r.status(i);if(o(a))return!0;if(await e.promptConfirmWalletDeploy(i,s)){const l=await r.status(i);return o(l)?!0:(bi.error("WalletRequestHandler: result for promptConfirmWalletDeploy is not correct"),!1)}return!1}}function LV(t,e){return{context:e.original.context,config:e.onChain.config,address:yt.context.addressOf(e.original.context,e.original.imageHash),chainId:t,deployed:e.onChain.deployed,imageHash:e.imageHash,lastImageHash:e.onChain.imageHash,published:!0,status:e}}const ZVe=["net_version","eth_chainId","eth_getBalance","eth_getTransactionCount","eth_blockNumber","eth_getBlockByNumber","eth_getBlockByHash","eth_getTransactionByHash","eth_getCode","eth_estimateGas","eth_gasPrice","sequence_getWalletContext","sequence_getNetworks","sequence_setDefaultNetwork"];function XVe(t){return t&&typeof t=="object"&&typeof t.send=="function"&&typeof t.getNetwork=="function"}function eze(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}class OC{get utils(){return this.provider.utils}constructor(e,r){this.client=e,this.provider=r,this.singleNetworkSigners={},this._isSequenceSigner=!0}async getAddress(){return this.client.getAddress()}connect(e){if(!NO.is(e))throw new Error("SequenceSigner can only be connected to a SequenceProvider");return new OC(this.client,e)}getSigner(e){if(!e)return this;const r=this.provider.toChainId(e);return this.singleNetworkSigners[r]||(this.singleNetworkSigners[r]=new Tie(this.client,this.provider,r)),this.singleNetworkSigners[r]}useChainId(e){return this.provider.toChainId(e)||this.client.getChainId()}async signMessage(e,r){const{eip6492:n=!0}=r||{},i=this.useChainId(r==null?void 0:r.chainId);return this.client.signMessage(e,{eip6492:n,chainId:i})}async signTypedData(e,r,n,i){const{eip6492:s=!0}=i||{},o=this.useChainId(i==null?void 0:i.chainId);return this.client.signTypedData({domain:e,types:r,message:n},{eip6492:s,chainId:o})}getProvider(e){return this.provider.getProvider(e)}async sendTransaction(e,r){const n=this.useChainId(r==null?void 0:r.chainId),i=await KVe(e),s=await this.client.sendTransaction(i,{chainId:n}),o=this.getProvider(n);try{return await new Promise(c=>{(async function f(){const u=await o.getTransaction(s);if(u!==null)return c(u);await o.once("block",f)})()})}catch(a){throw a.transactionHash=s,a}}async getWalletConfig(e){const r=this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}getNetworks(){return this.client.getNetworks()}async getBalance(e,r){return this.getProvider(r==null?void 0:r.chainId).getBalance(this.getAddress(),e)}async estimateGas(e,r){return this.getProvider(r==null?void 0:r.chainId).estimateGas(e)}async call(e,r){return this.getProvider(r==null?void 0:r.chainId).call(e)}getChainId(){return Promise.resolve(this.client.getChainId())}async getFeeData(e){return this.getProvider(e==null?void 0:e.chainId).getFeeData()}async resolveName(e){const r=await this.provider.resolveName(e);if(r===null)throw new Error(`ENS name not found: ${e}`);return r}_checkProvider(e){}getNonce(e){throw new Error("SequenceSigner does not support getNonce")}populateCall(e){throw new Error("SequenceSigner does not support populateCall")}populateTransaction(e){throw new Error("SequenceSigner does not support populateTransaction")}checkTransaction(e){throw new Error("SequenceSigner does not support checkTransaction")}getTransactionCount(e){throw new Error("SequenceSigner does not support getTransactionCount")}signTransaction(e){throw new Error("SequenceWallet does not support signTransaction, use sendTransaction instead.")}static is(e){return e&&typeof e=="object"&&e._isSequenceSigner===!0}}class Tie extends OC{constructor(e,r,n){super(e,r.getProvider(n)),this.chainId=n,this._isSingleNetworkSequenceSigner=!0}_useChainId(e){const r=this.provider.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This signer only supports the network ${this.chainId}, but ${r} was requested.`);return r||this.provider.toChainId(this.chainId)}useChainId(e){return this._useChainId(e)}getChainId(){return Promise.resolve(this.provider.toChainId(this.chainId))}getProvider(e){return super.getProvider(this._useChainId(e))}getSigner(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceSigner===!0}}class tze{constructor(e){if(this.signer=e,Tie.is(e))throw new Error("WalletUtils does not support SingleNetworkSequenceSigner")}signMessage(e,r,n){return this.signer.signMessage(e,{chainId:r,eip6492:n})}signTypedData(e,r,n,i,s){return this.signer.signTypedData(e,r,n,{chainId:i,eip6492:s})}async isValidSignature(e,r,n,i){return BV(e,r,n,this.signer.getProvider(i))}async isValidMessageSignature(e,r,n,i){const s=this.signer.getProvider(i),o=Iie(r),a=S9e(o);return BV(e,a,n,s)}isValidTypedDataSignature(e,r,n,i){return this.isValidSignature(e,fM(r),n,i)}}const rze=["method"],FV=["connect","disconnect","chainChanged","accountsChanged"];class NO extends hX{constructor(e,r,n=TM,i){super(e.getChainId(),i),this.client=e,this.providerFor=r,this.networks=n,this.options=i,this.singleNetworkProviders={},this._isSequenceProvider=!0,this.utils=void 0,this.signer=void 0,this.eip1193EventListeners=new Map,e.onConnect(s=>{var o;(o=this.eip1193EventListeners.get("connect"))==null||o.forEach(a=>a(s))}),e.onDisconnect(s=>{var o;(o=this.eip1193EventListeners.get("disconnect"))==null||o.forEach(a=>a(s))}),e.onDefaultChainIdChanged(s=>{var o;(o=this.eip1193EventListeners.get("chainChanged"))==null||o.forEach(a=>a(s))}),e.onAccountsChanged(s=>{var o;(o=this.eip1193EventListeners.get("accountsChanged"))==null||o.forEach(a=>a(s))}),this.signer=new OC(this.client,this),this.utils=new tze(this.signer)}async on(e,r){if(FV.includes(e)){const n=this.eip1193EventListeners.get(e)||new Set;return n.add(r),this.eip1193EventListeners.set(e,n),this}return super.on(e,r)}async off(e,r){if(FV.includes(e)){const n=this.eip1193EventListeners.get(e);return n&&(r?n.delete(r):n.clear()),this}return super.off(e,r)}getSigner(e){return this.signer.getSigner(e)}connect(e){return this.client.connect(e)}disconnect(){return this.client.disconnect()}isConnected(){return this.client.isConnected()}getSession(){return this.client.getSession()}listAccounts(){return[this.client.getAddress()]}getAddress(){return this.client.getAddress()}getNetworks(){return this.client.getNetworks()}getChainId(){return this.client.getChainId()}setDefaultChainId(e){return this.client.setDefaultChainId(this.toChainId(e))}isOpened(){return this.client.isOpened()}closeWallet(){return this.client.closeWallet()}getWalletContext(){return this.client.getWalletContext()}async getWalletConfig(e){const r=await this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}authorize(e){return this.client.connect(jc({},e,{authorize:!0}))}async openWallet(e,r){return await this.client.openWallet(e,r),!0}toChainId(e){if(e===void 0)return;const r=aw(this.networks,e);if(!r)throw new Error(`Unsupported network ${e}`);return r.chainId}async useChainId(e){return this.toChainId(e)||this.client.getChainId()}getProvider(e){if(!e)return this;const r=this.toChainId(e);return this.singleNetworkProviders[r]||(this.singleNetworkProviders[r]=new nze(this.client,this.providerFor,r,this.options)),this.singleNetworkProviders[r]}async _getSubprovider(e){const r=await this.useChainId(e),n=this.providerFor(r);if(!n)throw new Error(`Unsupported network ${r}`);return n}async _perform(e){var r;const{method:n}=e,i=eze(e,rze),s=await this._getSubprovider(),o=(r=s.getRpcRequest(e))!=null?r:{method:n,args:Object.values(i)};if(!o)throw new Error(`Unsupported method ${e.method}`);return s.send(o.method,o.args)}async perform(e,r){if(e==="eth_chainId")return qc(await this.useChainId());if(e==="eth_accounts")return[this.client.getAddress()];if(e==="wallet_switchEthereumChain"){const n=r[0],i=Pie(n);return this.setDefaultChainId(i)}return e==="eth_sendTransaction"||e==="eth_sign"||e==="eth_signTypedData"||e==="eth_signTypedData_v4"||e==="personal_sign"||e==="sequence_sign"||e==="sequence_signTypedData_v4"?this.client.request({method:e,params:r,chainId:this.getChainId()}):this._perform(jc({method:e},r))}send(e,r){return this.perform(e,r)}request(e){return this.perform(e.method,e.params)}async _detectNetwork(){const e=this.client.getChainId(),r=aw(this.networks,e);if(!r)throw new Error(`Unknown network ${e}`);return new ca(r.name,r.chainId)}async detectNetwork(){return this._detectNetwork()}async waitForTransaction(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).waitForTransaction(e,r,n)}async getBlockNumber(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getBlockNumber()}async getFeeData(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getFeeData()}async getBalance(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBalance(e,r)}async getTransactionCount(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getTransactionCount(e,r)}async getCode(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getCode(e,r)}async getStorage(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).getStorage(e,r,n)}async call(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).call(e)}async estimateGas(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).estimateGas(e)}async getBlock(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBlock(e,r)}async getTransaction(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getTransaction(e)}async getLogs(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getLogs(e)}async supportsENS(){return(await this.getNetworks()).some(r=>r.chainId===1)}async getResolver(e){return await this.supportsENS()?(await this._getSubprovider(1)).getResolver(e):null}async resolveName(e){return lg(e)?e:await this.supportsENS()?(await this._getSubprovider(1)).resolveName(e):null}async lookupAddress(e){return await this.supportsENS()?(await this._getSubprovider(1)).lookupAddress(e):null}async getAvatar(e){return await this.supportsENS()?(await this._getSubprovider(1)).getAvatar(e):null}}NO.is=t=>t&&typeof t=="object"&&t._isSequenceProvider===!0;function Pie(t){return typeof t=="object"?Pie(t.chainId):Number(t)}class nze extends NO{constructor(e,r,n,i){super(e,r,void 0,i),this.chainId=n,this._isSingleNetworkSequenceProvider=!0}_useChainId(e){const r=this.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This provider only supports the network ${this.chainId}, but ${r} was requested.`);return r||super.toChainId(this.chainId)}useChainId(e){return Promise.resolve(this._useChainId(e))}getChainId(){return super.toChainId(this.chainId)}async getNetwork(){const e=await this.client.getNetworks(),r=aw(e,this.chainId);if(!r)throw new Error(`Unsupported network ${this.chainId}`);return new ca(r.name,r.chainId)}getProvider(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}getSigner(e){return super.getSigner(this._useChainId(e))}setDefaultChainId(e){throw new Error(`This provider only supports the network ${this.chainId}; use the parent provider to switch networks.`)}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceProvider===!0}}class Fr{constructor(e){ue(this,"toast",tm());ue(this,"networkStore",fr(In));ue(this,"authStore",fr(oi));ue(this,"accountAddress",this.authStore.accountAddress.get());ue(this,"availableExternalProviders",_r([]));ue(this,"selectedExternalProvider",_r(void 0));ue(this,"selectedExternalWalletAddress",_r(void 0));ue(this,"isSendingTokenTransaction",_r(void 0));ue(this,"isSendingCollectibleTransaction",_r(void 0));ue(this,"isSendingSignedTokenTransaction",_r(void 0));ue(this,"connectDetails",_r(void 0));ue(this,"connectOptions",_r(void 0));ue(this,"isSigningTxn",_r(!1));ue(this,"isSigningMsg",_r(!1));ue(this,"toSignPermission",_r(void 0));ue(this,"toSignResult",_r(void 0));ue(this,"toSignTxnDetails",_r(void 0));ue(this,"toSignMsgDetails",_r(void 0));ue(this,"isCheckingWalletDeployment",_r(!1));ue(this,"walletNotDeployed",_r(!1));ue(this,"walletRequestHandler");ue(this,"local",{lastConnectedExternalProviderInfo:new hu(Ul.LAST_CONNECTED_EXTERNAL_PROVIDER_INFO)});ue(this,"defaultNetwork",new hu(Ul.DEFAULT_NETWORK));ue(this,"getLastConnectedExternalProviderInfo",()=>this.local.lastConnectedExternalProviderInfo.get());ue(this,"sendToken",async(e,r,n)=>{var i,s;try{const o=this.store.get(oi).account,a=e.chainId;if(!o)throw new Error("No account found");const c=this.store.get(In).providerForChainId(a);this.isSendingTokenTransaction.set({tokenBalance:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let h;if(!n)return{hash:""};if(e.contractType===Ph.NATIVE?(console.info("Sending native token with address, on chainId: ",e.contractAddress,a),h={to:r,value:p4e(n)}):e.contractType===Ph.ERC20&&(console.info("Sending ERC20 token with address, on chainId: ",e.contractAddress,a),h=await new Si(e.contractAddress,v5,c).transfer.populateTransaction(r,sI(n,((s=e.contractInfo)==null?void 0:s.decimals)??18))),!h)throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,h,a)).hash}catch(y){throw this.isSendingTokenTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction")}});ue(this,"sendCollectible",async(e,r,n)=>{var i,s;try{const o=this.store.get(oi).account,a=e.collectibleInfoParams.chainId;if(!o)throw new Error("No account found");const c=this.store.get(In).providerForChainId(a);this.isSendingCollectibleTransaction.set({collectibleInfo:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let h;if(e.collectibleInfoParams.contractType==="ERC721")console.info("Sending ERC721 non-fungible token with address, on chainId: ",e.collectibleInfoParams.address,a),h=await new Si(e.collectibleInfoParams.address,fte,c).safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId);else if(e.collectibleInfoParams.contractType==="ERC1155"){console.info("Sending ERC1155 token with address, on chainId: ",e.collectibleInfoParams.address,a);const y=new Si(e.collectibleInfoParams.address,ute,c);if(!n)return{hash:""};h=await y.safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId,sI(n,((s=e==null?void 0:e.collectibleInfoResponse)==null?void 0:s.decimals)??18),"0x")}if(!h)throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,h,a)).hash}catch(y){throw this.isSendingCollectibleTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction")}});ue(this,"setExternalProvider",async(e,r)=>{if(!e){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0),this.local.lastConnectedExternalProviderInfo.set(void 0);return}const i=(await this.getExternalProviderAccounts(e.provider))[0];this.local.lastConnectedExternalProviderInfo.set(e.info),this.selectedExternalProvider.set(e),this.selectedExternalWalletAddress.set(i),r||this.toast({variant:"success",title:"External wallet added successfully",description:"You can now relay transactions."}),e.provider.on("accountsChanged",async s=>{if(s.length===0){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0);return}if(s[0]!==i){const a=(await this.getExternalProviderAccounts(e.provider))[0];this.selectedExternalWalletAddress.set(a)}})});ue(this,"resetSignObservables",()=>{this.isSigningTxn.set(!1),this.toSignTxnDetails.set(void 0),this.toSignMsgDetails.set(void 0),this.toSignPermission.set(void 0),this.toSignResult.set(void 0)});ue(this,"checkWalletDeployment",async e=>{const r=this.store.get(oi).account;if(!r)throw new Error("No account found");return(await r.status(e)).onChain.deployed});this.store=e,this.walletRequestHandler=new JVe(void 0,new ize(e),this.networkStore.networks.get()),this.walletRequestHandler.onConnectOptionsChange=n=>{this.connectOptions.set(n)},this.availableExternalProviders.subscribe(n=>{const i=this.local.lastConnectedExternalProviderInfo.get(),s=n.find(o=>(i==null?void 0:i.name)===o.info.name);s&&this.setExternalProvider(s,!0)});const r=this.store.get(oi).account;this.walletRequestHandler.signIn(r??null)}async sendTransaction(e,r,n,i,s){const o=await e.status(s),a=await e.predecorateTransactions(i,o,s),c=await e.signTransactions(a,s,void 0,{serial:!0}),l=await e.decorateTransactions(c,o);await this.switchToChain(r,s);const f=await r.request({method:"eth_estimateGas",params:[{from:n,to:l.entrypoint,data:yt.transaction.encodeBundleExecData(l)}]});return{hash:await r.request({method:"eth_sendTransaction",params:[{from:n,to:l.entrypoint,data:yt.transaction.encodeBundleExecData(l),gas:f}]})}}async getExternalProviderAccounts(e){return new Promise((r,n)=>{var i;(i=e.sendAsync)==null||i.call(e,{method:"eth_requestAccounts",params:[]},(s,o)=>{s&&n(s),o.result.length===0&&n(new Error("No accounts found")),r(o.result)})})}async getExternalProviderAddress(e){return(await this.getExternalProviderAccounts(e))[0]}async switchToChain(e,r){return new Promise((n,i)=>{var s;(s=e.sendAsync)==null||s.call(e,{method:"wallet_switchEthereumChain",params:[{chainId:qc(r)}]},(o,a)=>{o&&i(o),n(a)})})}}class ize{constructor(e){this.store=e}getDefaultChainId(){return this.store.get(Fr).defaultNetwork.get()??1}async promptChangeNetwork(e){return this.store.get(In).networks.get().some(n=>n.chainId===e)?(this.store.get(Fr).defaultNetwork.set(Number(e)),!0):!1}async promptConfirmWalletDeploy(e,r){if(console.log("prompt confirm wallet deploy:",e,r),!e)return Promise.resolve(!1);const n=await this.store.get(Fr).checkWalletDeployment(e);return new Promise((i,s)=>{i(!!n)})}async promptConnect(e){console.log("promptconnect",e);const r=this.store.get(oi).account;return await this.store.get(Fr).walletRequestHandler.signIn(r??null),e&&this.store.get(Fr).walletRequestHandler.setConnectOptions(e),new Promise((n,i)=>{const s=this.store.get(Fr).connectDetails.subscribe(o=>{s(),!o||!o.connected?i("connect cancelled by user"):n(o)})})}async promptSignInConnect(e){return console.log("prompt sign in connect:",e),{connected:!1}}async promptSignMessage(e,r){return console.log("prompt sign message:",e,r),e.chainId?e.eip6492!==!0&&!(await this.store.get(oi).account.status(e.chainId)).canOnchainValidate&&!await this.promptConfirmWalletDeploy(e.chainId,r)?(this.store.get(Fr).walletNotDeployed.set(!0),Promise.reject("User rejected wallet deploy request")):(this.store.get(Fr).isSigningMsg.set(!0),this.store.get(Fr).toSignMsgDetails.set({message:e,chainId:e.chainId,origin:r}),new Promise((n,i)=>{const s=this.store.get(Fr).toSignPermission.subscribe(()=>{s();const o=this.store.get(Fr).toSignPermission.get();if(this.store.get(Fr).toSignPermission.set(void 0),!o||o==="cancelled")i("request failed");else{const a=this.store.get(Fr).toSignResult.get();a&&n(a.hash)}})})):Promise.reject("No chainId found in message")}promptSignTransaction(e,r,n,i){console.log("prompt sign transaction:",e,r,n,i);let s;Array.isArray(e)?s=e:s=[e];const o=this.store.get(oi).accountAddress.get();if(!o)throw new Error("Unknown account address");const a=yt.transaction.fromTransactionish(o,s);return console.log("prompt sign txn:",a,r,n,i),zT(o,s),new Promise((c,l)=>{this.store.get(Fr).toSignTxnDetails.set({txn:s,chainId:Number(r),origin:n,projectAccessKey:i}),this.store.get(Fr).isSigningTxn.set(!0);const f=this.store.get(Fr).toSignPermission.subscribe(()=>{f();const u=this.store.get(Fr).toSignPermission.get();if(this.store.get(Fr).toSignPermission.set(void 0),!u||u==="cancelled")l("request failed");else{const h=this.store.get(Fr).toSignResult.get();h&&c(h.hash)}})})}promptSendTransaction(e,r,n,i){return this.promptSignTransaction(e,r,n,i)}}const kie=t=>({info:{walletId:"",uuid:"",name:"WalletConnect",icon:"https://avatars.githubusercontent.com/u/37784886"},provider:t});async function Rie(t){return await CVe.init({projectId:ste,showQrModal:t,optionalChains:[1],metadata:{name:"Sequence Recovery Wallet External Wallet",description:"",url:"https://recovery.sequence.app",icons:[]}})}function sze(){const[t,e]=T.useState(null),n=fr(Fr).getLastConnectedExternalProviderInfo();return T.useEffect(()=>{async function i(){const s=await Rie(!1);await s.enable(),e(s)}return(n==null?void 0:n.name)==="WalletConnect"&&i(),()=>{t&&t.disconnect()}},[]),t}const jV=async(t,e,r=15)=>{let n,i=0;do{if(i>5&&await new Promise(s=>setTimeout(s,100*i)),n=await t.getTransactionReceipt(e),i===r){console.warn(`Could not get receipt for transaction ${e} after ${i} tries`);return}if(n)return n;i++}while(!n&&i<=r)};let S6=[];const b7={value:()=>S6,subscribe:t=>{function e(r){S6.some(n=>n.info.uuid===r.detail.info.uuid)||(S6=[...S6,r.detail],t())}return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}},Mie=()=>T.useSyncExternalStore(b7.subscribe,b7.value,b7.value);class kx{constructor(e){ue(this,"authStore",fr(oi));ue(this,"accountAddress",this.authStore.accountAddress.get());ue(this,"isReady",_r(!1));ue(this,"signClient");ue(this,"currentRequestInfo");ue(this,"allSessions",_r([]));ue(this,"sessions",this.allSessions.readOnly());ue(this,"createSignClient",async()=>{this.signClient=await MC.init({projectId:ste,metadata:{name:"Sequence Recovery Wallet",description:"Sequence Recovery Wallet - Recover Your Wallet",url:"https://recovery.sequence.app",icons:["https://sequence.app/apple-touch-icon.png"]}}),this.signClient.on("session_proposal",this.onSessionProposal),this.signClient.on("session_request",this.onSessionRequest),this.signClient.on("session_ping",this.onSessionPing),this.signClient.on("session_event",this.onSessionEvent),this.signClient.on("session_update",this.onSessionUpdate),this.signClient.on("session_delete",this.onSessionDelete);const e=this.getSignClientSessions();e?this.allSessions.set(e):this.allSessions.set([]),this.isReady.set(!0)});ue(this,"getSignClientSessions",()=>this.signClient.session.getAll().filter(r=>r.self.metadata.name!=="Sequence Recovery Wallet External Wallet"));ue(this,"pair",async e=>{if(!this.signClient)throw new Error("WalletConnect signClient not initialized.");await this.signClient.core.pairing.pair({uri:e}),this.allSessions.set(this.getSignClientSessions())});ue(this,"rejectRequest",()=>{var e;this.currentRequestInfo&&((e=this.signClient)==null||e.respond({topic:this.currentRequestInfo.topic,response:{id:this.currentRequestInfo.id,jsonrpc:"2.0",error:{message:"User rejected.",code:4001}}}))});ue(this,"disconnectSession",async e=>{var n,i;const r=(n=this.signClient)==null?void 0:n.session.get(e);r&&(await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:r.topic,reason:{message:"User disconnected.",code:6e3}})),this.allSessions.set(this.getSignClientSessions()??[]))});ue(this,"disconnectAllSessions",async()=>{var r;(((r=this.signClient)==null?void 0:r.session.getAll())??[]).forEach(async n=>{var i;await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:n.topic,reason:{message:"User disconnected.",code:6e3}}))}),this.allSessions.set([])});ue(this,"onSessionProposal",async e=>{var l,f,u,h,g;console.log("onSessionProposal",e);const r=e.params.requiredNamespaces,n=e.params.optionalNamespaces,i=Object.keys(r).length===0?[]:r.eip155.chains??[],s=Object.keys(n).length===0?[]:n.eip155.chains??[],o=((l=i[0])==null?void 0:l.split(":").pop())??((f=s[0])==null?void 0:f.split(":").pop());if(!o)throw new Error("No chainId found in WalletConnect session proposal namespaces.");const a={app:e.params.proposer.metadata.name,origin:e.params.proposer.metadata.url,networkId:o,keepWalletOpened:!0},c=await this.store.get(Fr).walletRequestHandler.promptConnect(a);if(c&&c.connected){const m=this.store.get(In).networks.get(),S=i.map(I=>Number(I.split(":").pop())),E=s.map(I=>Number(I.split(":").pop())),N={eip155:{accounts:m.map(I=>I.chainId).filter(I=>[...S,...E].includes(I)).map(I=>"eip155:"+I+":"+this.accountAddress),methods:["eth_sendTransaction","eth_sign","personal_sign","eth_signTypedData","eth_signTypedData_v4","wallet_switchEthereumChain"],events:["chainChanged","accountsChanged","connect","disconnect"]}},L=await((u=this.signClient)==null?void 0:u.approve({id:e.id,namespaces:N})),V=await(L==null?void 0:L.acknowledged());console.log("session",V),this.allSessions.set(this.getSignClientSessions()??[]),(h=this.signClient)==null||h.core.pairing.getPairings().filter(I=>e.params.pairingTopic!==I.topic).forEach(async I=>{var U,ie;e.params.proposer.metadata.url===((U=I.peerMetadata)==null?void 0:U.url)&&await((ie=this.signClient)==null?void 0:ie.core.pairing.disconnect({topic:I.topic}))})}else(g=this.signClient)==null||g.reject({id:e.id,reason:{message:"User rejected.",code:5e3}})});ue(this,"onSessionRequest",async e=>{var o,a,c;console.log("onSessionRequest",e);const r=e.params.chainId.split(":").pop(),n={jsonrpc:"2.0",id:e.id,method:e.params.request.method,params:e.params.request.params,chainId:Number(r)};n.method==="eth_sendTransaction"&&Array.isArray(n.params)&&n.params.forEach(l=>{delete l.nonce});const i=(o=this.signClient)==null?void 0:o.session.get(e.topic),s={app:(i==null?void 0:i.peer.metadata.name)??"",origin:i==null?void 0:i.peer.metadata.url,networkId:r};this.store.get(Fr).walletRequestHandler.setConnectOptions(s),this.currentRequestInfo={topic:e.topic,id:e.id};try{const l=await this.store.get(Fr).walletRequestHandler.request(n);(a=this.signClient)==null||a.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",result:l}})}catch(l){(c=this.signClient)==null||c.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",error:{message:l.message,code:l.code??4001}}})}this.currentRequestInfo=void 0});ue(this,"onSessionPing",async e=>{console.log("onSessionPing",e)});ue(this,"onSessionEvent",async e=>{console.log("onSessionEvent",e)});ue(this,"onSessionUpdate",async e=>{console.log("onSessionUpdate",e)});ue(this,"onSessionDelete",async e=>{console.log("onSessionDelete",e),this.allSessions.set(this.getSignClientSessions()??[])});this.store=e,this.createSignClient()}}function oze({onClose:t}){var a;const e=fr(Fr),r=fr(oi),n=e.toSignMsgDetails.get(),i=r.accountAddress.get(),[s,o]=T.useState("");return T.useEffect(()=>{if(n!=null&&n.message.message){const c=WVe(n.message.message);try{o(J1(c))}catch{o(ke(c))}}else n!=null&&n.message.typedData&&o(JSON.stringify(n.message.typedData,void 0,4))},[n]),j.jsx(ye,{children:n&&j.jsxs(j.Fragment,{children:[j.jsxs(ye,{flexDirection:"column",gap:"6",padding:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Would you like to approve this transaction?"}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Origin"}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:(a=n==null?void 0:n.origin)==null?void 0:a.split("//")[1]}),j.jsx(mp,{size:"xs",icon:G8,onClick:()=>window.open(n==null?void 0:n.origin,"_blank"),style:{width:"24px",height:"24px"}})]})]}),j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Network"}),j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:um(Number(n.chainId))})]}),j.jsxs(vn,{flexDirection:"column",gap:"4",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Signee"}),j.jsx(vn,{children:j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",style:{fontFamily:"monospace"},children:`${i}`})})]}),j.jsx(tK,{label:"Message Content",children:j.jsx(vn,{children:j.jsx(Te,{variant:"code",color:"text80",style:{overflowWrap:"anywhere",whiteSpace:"pre-wrap"},children:s})})})]})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{alignItems:"center",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Kt,{label:"Cancel",size:"md",shape:"square",onClick:()=>{t()}}),j.jsx(Kt,{label:"Send",variant:"primary",size:"md",shape:"square",onClick:()=>t(n)})]})]})})}function aze({onClose:t,handleSignTxn:e}){var i;const n=fr(Fr).toSignTxnDetails.get();return T.useEffect(()=>{n&&e(n)},[n]),j.jsx(ye,{children:n&&j.jsxs(j.Fragment,{children:[j.jsxs(ye,{flexDirection:"column",gap:"6",padding:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Waiting for external wallet confirmation"}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Origin"}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:(i=n==null?void 0:n.origin)==null?void 0:i.split("//")[1]}),j.jsx(mp,{size:"xs",icon:G8,onClick:()=>window.open(n==null?void 0:n.origin,"_blank"),style:{width:"24px",height:"24px"}})]})]}),j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Network"}),j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:um(Number(n.chainId))})]}),j.jsx(tK,{label:"Transaction Data",children:j.jsx(ye,{flexDirection:"column",gap:"2",children:n.txn.map((s,o)=>j.jsx(vn,{children:j.jsx(Te,{variant:"code",color:"text80",style:{overflowWrap:"anywhere",whiteSpace:"pre-wrap"},children:JSON.stringify(s,null,4)||"Native token transfer"})},o))})})]})]}),j.jsx(hi,{marginY:"0"}),j.jsx(ye,{alignItems:"center",justifyContent:"flex-end",padding:"6",gap:"2",children:j.jsx(Kt,{label:"Ignore transaction",size:"md",shape:"square",onClick:()=>{t()}})})]})})}const up=({icon:t,onClick:e,disabled:r=!1})=>j.jsx(ye,{justifyContent:"center",alignItems:"center",background:"backgroundMuted",opacity:r?"50":"100",borderRadius:"sm",height:"9",width:"9",cursor:r?"default":"pointer",onClick:()=>{r||e()},children:t}),DC=({src:t,...e})=>j.jsx(ye,{justifyContent:"center",alignItems:"center",borderRadius:"sm",style:{height:"44px",width:"44px"},...e,children:j.jsx(Fi,{width:"10",height:"10",src:t,borderRadius:"xs"})});function cze({sessionList:t}){const e=fr(kx);return j.jsx(j.Fragment,{children:t.map((r,n)=>j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"2",children:[j.jsxs(ye,{alignItems:"center",gap:"4",children:[j.jsx(DC,{background:"text80",src:r.peer.metadata.icons[0]}),j.jsx(Te,{variant:"medium",color:"text100",children:r.peer.metadata.name?r.peer.metadata.name:r.peer.metadata.url})]}),j.jsxs(ye,{gap:"2",children:[r.peer.metadata.url&&j.jsx(up,{icon:j.jsx(G8,{color:"text100"}),onClick:()=>window.open(r.peer.metadata.url,"_blank")}),j.jsx(up,{icon:j.jsx(Tu,{color:"text100"}),onClick:()=>e.disconnectSession(r.topic)})]})]},n))})}const lze="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Link-Connection'%3e%3cg%20id='Vector'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5.65098%205.00098L5.65098%2012.5868C5.65098%2012.8986%206.02798%2013.0547%206.24846%2012.8343L12.8342%206.24846C13.8737%205.20902%2015.651%205.9452%2015.651%207.41519V15.001H14.351V7.41519C14.351%207.10337%2013.974%206.94722%2013.7535%207.1677L7.1677%2013.7535C6.12826%2014.7929%204.35098%2014.0568%204.35098%2012.5868L4.35098%205.00098H5.65098Z'%20fill='white'/%3e%3cpath%20d='M5.00065%202.03125C3.3607%202.03125%202.03125%203.3607%202.03125%205.00065C2.03125%206.64061%203.3607%207.97005%205.00065%207.97005C6.64061%207.97005%207.97005%206.64061%207.97005%205.00065C7.97005%203.3607%206.64061%202.03125%205.00065%202.03125Z'%20fill='white'/%3e%3cpath%20d='M14.9997%2012.0312C13.3597%2012.0312%2012.0303%2013.3607%2012.0303%2015.0007C12.0303%2016.6406%2013.3597%2017.9701%2014.9997%2017.9701C16.6396%2017.9701%2017.9691%2016.6406%2017.9691%2015.0007C17.9691%2013.3607%2016.6396%2012.0312%2014.9997%2012.0312Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Oie="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Warning'%3e%3cpath%20id='Subtract'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M18%2017.4267L9.99998%203.57031L2%2017.4267H18ZM10.6778%2013.0944V7.32511H9.21569V13.0944H10.6778ZM9.94669%2016.1808C10.5481%2016.1808%2011.0356%2015.6933%2011.0356%2015.0919C11.0356%2014.4905%2010.5481%2014.003%209.94669%2014.003C9.3453%2014.003%208.85777%2014.4905%208.85777%2015.0919C8.85777%2015.6933%209.3453%2016.1808%209.94669%2016.1808Z'%20fill='%236D6D6D'/%3e%3c/g%3e%3c/svg%3e";function fze({onClose:t}){var l;const e=rm("isMobile"),r=fr(Fr),n=Wr(r.connectOptions),i=tm(),[s,o]=T.useState(!1),a=async()=>{if(s)return;o(!0);const f=await r.walletRequestHandler.connect(n);r.connectDetails.set(f),o(!1),i({variant:"success",title:"Dapp connection added successfully",description:"You can now receive dapp action requests."}),t()},c=()=>{r.connectDetails.set({connected:!1}),t()};return j.jsxs(ye,{style:{minWidth:e?"100vw":"500px"},children:[j.jsxs(ye,{flexDirection:"column",gap:"6",padding:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Would you like to connect to this dapp?"}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Origin"}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:(l=n==null?void 0:n.origin)==null?void 0:l.split("//")[1]}),j.jsx(mp,{size:"xs",icon:G8,onClick:()=>window.open(n==null?void 0:n.origin,"_blank"),style:{width:"24px",height:"24px"}})]})]}),j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Network"}),j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:um(Number(n==null?void 0:n.networkId))})]})]})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{alignItems:"center",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Kt,{label:"Cancel",size:"md",shape:"square",onClick:()=>c()}),j.jsx(Kt,{label:s?"Authorizing…":"Connect",variant:"primary",size:"md",shape:"square",disabled:s,onClick:()=>a()})]})]})}var Die={},$o={};Object.defineProperty($o,"__esModule",{value:!0});$o.compactObject=Lie;$o.deprecated=bze;var uze=$o.detectBrowser=wze;$o.disableLog=gze;$o.disableWarnings=yze;$o.extractVersion=R5;$o.filterStats=xze;$o.log=mze;$o.walkStats=d8;$o.wrapPeerConnectionEvent=vze;function dze(t,e,r){return e=hze(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hze(t){var e=pze(t,"string");return Bh(e)=="symbol"?e:e+""}function pze(t,e){if(Bh(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Bh(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Bh(t){"@babel/helpers - typeof";return Bh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bh(t)}var Nie=!0,Bie=!0;function R5(t,e,r){var n=t.match(e);return n&&n.length>=r&&parseInt(n[r],10)}function vze(t,e,r){if(t.RTCPeerConnection){var n=t.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(o,a){if(o!==e)return i.apply(this,arguments);var c=function(f){var u=r(f);u&&(a.handleEvent?a.handleEvent(u):a(u))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,c),i.apply(this,[o,c])};var s=n.removeEventListener;n.removeEventListener=function(o,a){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(a))return s.apply(this,arguments);var c=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,c])},Object.defineProperty(n,"on"+e,{get:function(){return this["_on"+e]},set:function(a){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),a&&this.addEventListener(e,this["_on"+e]=a)},enumerable:!0,configurable:!0})}}function gze(t){return typeof t!="boolean"?new Error("Argument type: "+Bh(t)+". Please use a boolean."):(Nie=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function yze(t){return typeof t!="boolean"?new Error("Argument type: "+Bh(t)+". Please use a boolean."):(Bie=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function mze(){if((typeof window>"u"?"undefined":Bh(window))==="object"){if(Nie)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function bze(t,e){Bie&&console.warn(t+" is deprecated, please use "+e+" instead.")}function wze(t){var e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;var r=t.navigator;if(r.userAgentData&&r.userAgentData.brands){var n=r.userAgentData.brands.find(function(i){return i.brand==="Chromium"});if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(r.mozGetUserMedia)e.browser="firefox",e.version=R5(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=R5(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=R5(r.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function UV(t){return Object.prototype.toString.call(t)==="[object Object]"}function Lie(t){return UV(t)?Object.keys(t).reduce(function(e,r){var n=UV(t[r]),i=n?Lie(t[r]):t[r],s=n&&!Object.keys(i).length;return i===void 0||s?e:Object.assign(e,dze({},r,i))},{}):t}function d8(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(function(n){n.endsWith("Id")?d8(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(function(i){d8(t,t.get(i),r)})}))}function xze(t,e,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;var s=[];return t.forEach(function(o){o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(function(o){t.forEach(function(a){a.type===n&&a.trackId===o.id&&d8(t,a,i)})}),i}Object.defineProperty(Die,"__esModule",{value:!0});var Eze=Die.shimGetUserMedia=Sze,Cze=Aze($o);function Fie(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Fie=function(i){return i?r:e})(t)}function Aze(t,e){if(t&&t.__esModule)return t;if(t===null||Md(t)!="object"&&typeof t!="function")return{default:t};var r=Fie(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Md(t){"@babel/helpers - typeof";return Md=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Md(t)}var $V=Cze.log;function Sze(t,e){var r=t&&t.navigator;if(r.mediaDevices){var n=function(l){if(Md(l)!=="object"||l.mandatory||l.optional)return l;var f={};return Object.keys(l).forEach(function(u){if(!(u==="require"||u==="advanced"||u==="mediaSource")){var h=Md(l[u])==="object"?l[u]:{ideal:l[u]};h.exact!==void 0&&typeof h.exact=="number"&&(h.min=h.max=h.exact);var g=function(S,E){return S?S+E.charAt(0).toUpperCase()+E.slice(1):E==="deviceId"?"sourceId":E};if(h.ideal!==void 0){f.optional=f.optional||[];var y={};typeof h.ideal=="number"?(y[g("min",u)]=h.ideal,f.optional.push(y),y={},y[g("max",u)]=h.ideal,f.optional.push(y)):(y[g("",u)]=h.ideal,f.optional.push(y))}h.exact!==void 0&&typeof h.exact!="number"?(f.mandatory=f.mandatory||{},f.mandatory[g("",u)]=h.exact):["min","max"].forEach(function(m){h[m]!==void 0&&(f.mandatory=f.mandatory||{},f.mandatory[g(m,u)]=h[m])})}}),l.advanced&&(f.optional=(f.optional||[]).concat(l.advanced)),f},i=function(l,f){if(e.version>=61)return f(l);if(l=JSON.parse(JSON.stringify(l)),l&&Md(l.audio)==="object"){var u=function(S,E,A){E in S&&!(A in S)&&(S[A]=S[E],delete S[E])};l=JSON.parse(JSON.stringify(l)),u(l.audio,"autoGainControl","googAutoGainControl"),u(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=n(l.audio)}if(l&&Md(l.video)==="object"){var h=l.video.facingMode;h=h&&(Md(h)==="object"?h:{ideal:h});var g=e.version<66;if(h&&(h.exact==="user"||h.exact==="environment"||h.ideal==="user"||h.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!g)){delete l.video.facingMode;var y;if(h.exact==="environment"||h.ideal==="environment"?y=["back","rear"]:(h.exact==="user"||h.ideal==="user")&&(y=["front"]),y)return r.mediaDevices.enumerateDevices().then(function(m){m=m.filter(function(E){return E.kind==="videoinput"});var S=m.find(function(E){return y.some(function(A){return E.label.toLowerCase().includes(A)})});return!S&&m.length&&y.includes("back")&&(S=m[m.length-1]),S&&(l.video.deviceId=h.exact?{exact:S.deviceId}:{ideal:S.deviceId}),l.video=n(l.video),$V("chrome: "+JSON.stringify(l)),f(l)})}l.video=n(l.video)}return $V("chrome: "+JSON.stringify(l)),f(l)},s=function(l){return e.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},o=function(l,f,u){i(l,function(h){r.webkitGetUserMedia(h,f,function(g){u&&u(s(g))})})};if(r.getUserMedia=o.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(c){return i(c,function(l){return a(l).then(function(f){if(l.audio&&!f.getAudioTracks().length||l.video&&!f.getVideoTracks().length)throw f.getTracks().forEach(function(u){u.stop()}),new DOMException("","NotFoundError");return f},function(f){return Promise.reject(s(f))})})}}}}var jie={};Object.defineProperty(jie,"__esModule",{value:!0});var _ze=jie.shimGetUserMedia=Pze,Ize=Tze($o);function Uie(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Uie=function(i){return i?r:e})(t)}function Tze(t,e){if(t&&t.__esModule)return t;if(t===null||Cg(t)!="object"&&typeof t!="function")return{default:t};var r=Uie(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Cg(t){"@babel/helpers - typeof";return Cg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cg(t)}function Pze(t,e){var r=t&&t.navigator,n=t&&t.MediaStreamTrack;if(r.getUserMedia=function(c,l,f){Ize.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(c).then(l,f)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(l,f,u){f in l&&!(u in l)&&(l[u]=l[f],delete l[f])},s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(c){return Cg(c)==="object"&&Cg(c.audio)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c.audio,"autoGainControl","mozAutoGainControl"),i(c.audio,"noiseSuppression","mozNoiseSuppression")),s(c)},n&&n.prototype.getSettings){var o=n.prototype.getSettings;n.prototype.getSettings=function(){var c=o.apply(this,arguments);return i(c,"mozAutoGainControl","autoGainControl"),i(c,"mozNoiseSuppression","noiseSuppression"),c}}if(n&&n.prototype.applyConstraints){var a=n.prototype.applyConstraints;n.prototype.applyConstraints=function(c){return this.kind==="audio"&&Cg(c)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c,"autoGainControl","mozAutoGainControl"),i(c,"noiseSuppression","mozNoiseSuppression")),a.apply(this,[c])}}}}var vf={};Object.defineProperty(vf,"__esModule",{value:!0});vf.shimAudioContext=jze;vf.shimCallbacksAPI=Dze;vf.shimConstraints=Vie;vf.shimCreateOfferLegacy=Fze;var kze=vf.shimGetUserMedia=Nze;vf.shimLocalStreamsAPI=Mze;vf.shimRTCIceServerUrls=Bze;vf.shimRemoteStreamsAPI=Oze;vf.shimTrackEventTransceiver=Lze;var $ie=Rze($o);function qie(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(qie=function(i){return i?r:e})(t)}function Rze(t,e){if(t&&t.__esModule)return t;if(t===null||Lh(t)!="object"&&typeof t!="function")return{default:t};var r=qie(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Lh(t){"@babel/helpers - typeof";return Lh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lh(t)}function Mze(t){if(!(Lh(t)!=="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){var e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(function(s){return e.call(i,s,n)}),n.getVideoTracks().forEach(function(s){return e.call(i,s,n)})},t.RTCPeerConnection.prototype.addTrack=function(n){for(var i=this,s=arguments.length,o=new Array(s>1?s-1:0),a=1;a=0)){n._remoteStreams.push(s);var o=new Event("addstream");o.stream=s,n.dispatchEvent(o)}})}),e.apply(n,arguments)}}}function Dze(t){if(!(Lh(t)!=="object"||!t.RTCPeerConnection)){var e=t.RTCPeerConnection.prototype,r=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,s=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],h=r.apply(this,[u]);return f?(h.then(l,f),Promise.resolve()):h},e.createAnswer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],h=n.apply(this,[u]);return f?(h.then(l,f),Promise.resolve()):h};var a=function(l,f,u){var h=i.apply(this,[l]);return u?(h.then(f,u),Promise.resolve()):h};e.setLocalDescription=a,a=function(l,f,u){var h=s.apply(this,[l]);return u?(h.then(f,u),Promise.resolve()):h},e.setRemoteDescription=a,a=function(l,f,u){var h=o.apply(this,[l]);return u?(h.then(f,u),Promise.resolve()):h},e.addIceCandidate=a}}function Nze(t){var e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){var r=e.mediaDevices,n=r.getUserMedia.bind(r);e.mediaDevices.getUserMedia=function(i){return n(Vie(i))}}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(s,o,a){e.mediaDevices.getUserMedia(s).then(o,a)}).bind(e))}function Vie(t){return t&&t.video!==void 0?Object.assign({},t,{video:$ie.compactObject(t.video)}):t}function Bze(t){if(t.RTCPeerConnection){var e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,i){if(n&&n.iceServers){for(var s=[],o=0;o{throw TypeError(t)},Hie=(t,e,r)=>e.has(t)||zie("Cannot "+r),Uze=(t,e,r)=>(Hie(t,e,"read from private field"),r?r.call(t):e.get(t)),$ze=(t,e,r)=>e.has(t)?zie("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),qze=(t,e,r,n)=>(Hie(t,e,"write to private field"),e.set(t,r),r);const qV=["Aztec","Codabar","Code128","Code39","Code93","DataBar","DataBarExpanded","DataBarLimited","DataMatrix","DXFilmEdge","EAN-13","EAN-8","ITF","Linear-Codes","Matrix-Codes","MaxiCode","MicroQRCode","None","PDF417","QRCode","rMQRCode","UPC-A","UPC-E"];function Vze(t){return t.join("|")}function zze(t){const e=VV(t);let r=0,n=qV.length-1;for(;r<=n;){const i=Math.floor((r+n)/2),s=qV[i],o=VV(s);if(o===e)return s;o{const r=t.match(/_(.+?)\.wasm$/);return r?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.3.4/dist/${r[1]}/${t}`:e+t}};let zV=new WeakMap;function BO(t,e){var r;const n=zV.get(t);if(n!=null&&n.modulePromise&&e===void 0)return n.modulePromise;const i=(r=n==null?void 0:n.moduleOverrides)!=null?r:Jze,s=t({...i});return zV.set(t,{moduleOverrides:i,modulePromise:s}),s}async function Zze(t,e,r=Vy){const n={...Vy,...r},i=await BO(t),{size:s}=e,o=new Uint8Array(await e.arrayBuffer()),a=i._malloc(s);i.HEAPU8.set(o,a);const c=i.readBarcodesFromImage(a,s,Gie(i,n));i._free(a);const l=[];for(let f=0;f{var t,e=typeof document<"u"&&((t=document.currentScript)==null?void 0:t.tagName.toUpperCase())==="SCRIPT"?document.currentScript.src:void 0;return function(r={}){var n,i=r,s,o,a=new Promise((z,H)=>{s=z,o=H}),c=typeof window=="object",l=typeof Bun<"u",f=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var u=Object.assign({},i),h="./this.program",g="";function y(z){return i.locateFile?i.locateFile(z,g):g+z}var m,S;if(c||f||l){var E;f?g=self.location.href:typeof document<"u"&&((E=document.currentScript)===null||E===void 0?void 0:E.tagName.toUpperCase())==="SCRIPT"&&(g=document.currentScript.src),e&&(g=e),g.startsWith("blob:")?g="":g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1),f&&(S=z=>{var H=new XMLHttpRequest;return H.open("GET",z,!1),H.responseType="arraybuffer",H.send(null),new Uint8Array(H.response)}),m=z=>fetch(z,{credentials:"same-origin"}).then(H=>H.ok?H.arrayBuffer():Promise.reject(new Error(H.status+" : "+H.url)))}var A=i.print||console.log.bind(console),P=i.printErr||console.error.bind(console);Object.assign(i,u),u=null,i.arguments&&i.arguments,i.thisProgram&&(h=i.thisProgram);var N=i.wasmBinary,L,V=!1,I,U,ie,ae,K,R,D,v;function b(){var z=L.buffer;i.HEAP8=I=new Int8Array(z),i.HEAP16=ie=new Int16Array(z),i.HEAPU8=U=new Uint8Array(z),i.HEAPU16=ae=new Uint16Array(z),i.HEAP32=K=new Int32Array(z),i.HEAPU32=R=new Uint32Array(z),i.HEAPF32=D=new Float32Array(z),i.HEAPF64=v=new Float64Array(z)}var M=[],B=[],x=[];function C(){var z=i.preRun;z&&(typeof z=="function"&&(z=[z]),z.forEach(O)),lt(M)}function w(){lt(B)}function k(){var z=i.postRun;z&&(typeof z=="function"&&(z=[z]),z.forEach(oe)),lt(x)}function O(z){M.unshift(z)}function G(z){B.unshift(z)}function oe(z){x.unshift(z)}var $=0,X=null;function W(z){var H;$++,(H=i.monitorRunDependencies)===null||H===void 0||H.call(i,$)}function Z(z){var H;if($--,(H=i.monitorRunDependencies)===null||H===void 0||H.call(i,$),$==0&&X){var re=X;X=null,re()}}function te(z){var H;(H=i.onAbort)===null||H===void 0||H.call(i,z),z="Aborted("+z+")",P(z),V=!0,z+=". Build with -sASSERTIONS for more info.";var re=new WebAssembly.RuntimeError(z);throw o(re),re}var F="data:application/octet-stream;base64,",ee=z=>z.startsWith(F);function fe(){var z="zxing_reader.wasm";return ee(z)?z:y(z)}var xe;function _e(z){if(z==xe&&N)return new Uint8Array(N);if(S)return S(z);throw"both async and sync fetching of the wasm failed"}function Me(z){return N?Promise.resolve().then(()=>_e(z)):m(z).then(H=>new Uint8Array(H),()=>_e(z))}function Ke(z,H,re){return Me(z).then(ce=>WebAssembly.instantiate(ce,H)).then(re,ce=>{P(`failed to asynchronously prepare wasm: ${ce}`),te(ce)})}function ze(z,H,re,ce){return!z&&typeof WebAssembly.instantiateStreaming=="function"&&!ee(H)&&typeof fetch=="function"?fetch(H,{credentials:"same-origin"}).then(ve=>{var be=WebAssembly.instantiateStreaming(ve,re);return be.then(ce,function(Se){return P(`wasm streaming compile failed: ${Se}`),P("falling back to ArrayBuffer instantiation"),Ke(H,re,ce)})}):Ke(H,re,ce)}function Je(){return{a:KC}}function Xe(){var z,H=Je();function re(ve,be){return Qr=ve.exports,L=Qr.za,b(),Mp=Qr.Da,G(Qr.Aa),Z(),Qr}W();function ce(ve){re(ve.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(H,re)}catch(ve){P(`Module.instantiateWasm callback failed with error: ${ve}`),o(ve)}return(z=xe)!==null&&z!==void 0||(xe=fe()),ze(N,xe,H,ce).catch(o),{}}var lt=z=>{z.forEach(H=>H(i))};i.noExitRuntime;var Re=z=>jx(z),$e=()=>Ux(),st=[],Qe=0,ct=z=>{var H=new at(z);return H.get_caught()||(H.set_caught(!0),Qe--),H.set_rethrown(!1),st.push(H),Sf(z),Om(z)},tt=0,He=()=>{nr(0,0);var z=st.pop();$x(z.excPtr),tt=0};class at{constructor(H){this.excPtr=H,this.ptr=H-24}set_type(H){R[this.ptr+4>>2]=H}get_type(){return R[this.ptr+4>>2]}set_destructor(H){R[this.ptr+8>>2]=H}get_destructor(){return R[this.ptr+8>>2]}set_caught(H){H=H?1:0,I[this.ptr+12]=H}get_caught(){return I[this.ptr+12]!=0}set_rethrown(H){H=H?1:0,I[this.ptr+13]=H}get_rethrown(){return I[this.ptr+13]!=0}init(H,re){this.set_adjusted_ptr(0),this.set_type(H),this.set_destructor(re)}set_adjusted_ptr(H){R[this.ptr+16>>2]=H}get_adjusted_ptr(){return R[this.ptr+16>>2]}}var pt=z=>{throw tt||(tt=z),tt},Ge=z=>d0(z),vt=z=>{var H=tt;if(!H)return Ge(0),0;var re=new at(H);re.set_adjusted_ptr(H);var ce=re.get_type();if(!ce)return Ge(0),H;for(var ve of z){if(ve===0||ve===ce)break;var be=re.ptr+16;if(yo(ve,ce,be))return Ge(ve),H}return Ge(ce),H},bt=()=>vt([]),Ze=z=>vt([z]),_t=(z,H)=>vt([z,H]),Ct=()=>{var z=st.pop();z||te("no exception to throw");var H=z.excPtr;throw z.get_rethrown()||(st.push(z),z.set_rethrown(!0),z.set_caught(!1),Qe++),tt=H,tt},It=(z,H,re)=>{var ce=new at(z);throw ce.init(H,re),tt=z,Qe++,tt},er=()=>Qe,dr=()=>{te("")},wt={},lr=z=>{for(;z.length;){var H=z.pop(),re=z.pop();re(H)}};function ir(z){return this.fromWireType(R[z>>2])}var Pt={},Dt={},Nt={},dt,Lt=z=>{throw new dt(z)},kt=(z,H,re)=>{z.forEach(Ae=>Nt[Ae]=H);function ce(Ae){var De=re(Ae);De.length!==z.length&&Lt("Mismatched type converter count");for(var We=0;We{Dt.hasOwnProperty(Ae)?ve[De]=Dt[Ae]:(be.push(Ae),Pt.hasOwnProperty(Ae)||(Pt[Ae]=[]),Pt[Ae].push(()=>{ve[De]=Dt[Ae],++Se,Se===be.length&&ce(ve)}))}),be.length===0&&ce(ve)},ut=z=>{var H=wt[z];delete wt[z];var re=H.rawConstructor,ce=H.rawDestructor,ve=H.fields,be=ve.map(Se=>Se.getterReturnType).concat(ve.map(Se=>Se.setterArgumentType));kt([z],be,Se=>{var Ae={};return ve.forEach((De,We)=>{var rt=De.fieldName,Ft=Se[We],xr=De.getter,Gt=De.getterContext,hr=Se[We+ve.length],Yn=De.setter,$n=De.setterContext;Ae[rt]={read:Mn=>Ft.fromWireType(xr(Gt,Mn)),write:(Mn,_f)=>{var yi=[];Yn($n,Mn,hr.toWireType(yi,_f)),lr(yi)}}}),[{name:H.name,fromWireType:De=>{var We={};for(var rt in Ae)We[rt]=Ae[rt].read(De);return ce(De),We},toWireType:(De,We)=>{for(var rt in Ae)if(!(rt in We))throw new TypeError(`Missing field: "${rt}"`);var Ft=re();for(rt in Ae)Ae[rt].write(Ft,We[rt]);return De!==null&&De.push(ce,Ft),Ft},argPackAdvance:ot,readValueFromPointer:ir,destructorFunction:ce}]})},Vt=(z,H,re,ce,ve)=>{},zt=()=>{for(var z=new Array(256),H=0;H<256;++H)z[H]=String.fromCharCode(H);ht=z},ht,xt=z=>{for(var H="",re=z;U[re];)H+=ht[U[re++]];return H},Bt,Ve=z=>{throw new Bt(z)};function $t(z,H){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var ce=H.name;if(z||Ve(`type "${ce}" must have a positive integer typeid pointer`),Dt.hasOwnProperty(z)){if(re.ignoreDuplicateRegistrations)return;Ve(`Cannot register type '${ce}' twice`)}if(Dt[z]=H,delete Nt[z],Pt.hasOwnProperty(z)){var ve=Pt[z];delete Pt[z],ve.forEach(be=>be())}}function Et(z,H){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $t(z,H,re)}var ot=8,Ht=(z,H,re,ce)=>{H=xt(H),Et(z,{name:H,fromWireType:function(ve){return!!ve},toWireType:function(ve,be){return be?re:ce},argPackAdvance:ot,readValueFromPointer:function(ve){return this.fromWireType(U[ve])},destructorFunction:null})},Nr=z=>({count:z.count,deleteScheduled:z.deleteScheduled,preservePointerOnDelete:z.preservePointerOnDelete,ptr:z.ptr,ptrType:z.ptrType,smartPtr:z.smartPtr,smartPtrType:z.smartPtrType}),Ut=z=>{function H(re){return re.$$.ptrType.registeredClass.name}Ve(H(z)+" instance already deleted")},Pr=!1,tr=z=>{},Or=z=>{z.smartPtr?z.smartPtrType.rawDestructor(z.smartPtr):z.ptrType.registeredClass.rawDestructor(z.ptr)},pi=z=>{z.count.value-=1;var H=z.count.value===0;H&&Or(z)},vi=(z,H,re)=>{if(H===re)return z;if(re.baseClass===void 0)return null;var ce=vi(z,H,re.baseClass);return ce===null?null:re.downcast(ce)},gi={},_i={},Tn=(z,H)=>{for(H===void 0&&Ve("ptr should not be undefined");z.baseClass;)H=z.upcast(H),z=z.baseClass;return H},ps=(z,H)=>(H=Tn(z,H),_i[H]),vs=(z,H)=>{(!H.ptrType||!H.ptr)&&Lt("makeClassHandle requires ptr and ptrType");var re=!!H.smartPtrType,ce=!!H.smartPtr;return re!==ce&&Lt("Both smartPtrType and smartPtr must be specified"),H.count={value:1},Hi(Object.create(z,{$$:{value:H,writable:!0}}))};function gs(z){var H=this.getPointee(z);if(!H)return this.destructor(z),null;var re=ps(this.registeredClass,H);if(re!==void 0){if(re.$$.count.value===0)return re.$$.ptr=H,re.$$.smartPtr=z,re.clone();var ce=re.clone();return this.destructor(z),ce}function ve(){return this.isSmartPointer?vs(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:H,smartPtrType:this,smartPtr:z}):vs(this.registeredClass.instancePrototype,{ptrType:this,ptr:z})}var be=this.registeredClass.getActualType(H),Se=gi[be];if(!Se)return ve.call(this);var Ae;this.isConst?Ae=Se.constPointerType:Ae=Se.pointerType;var De=vi(H,this.registeredClass,Ae.registeredClass);return De===null?ve.call(this):this.isSmartPointer?vs(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:De,smartPtrType:this,smartPtr:z}):vs(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:De})}var Hi=z=>typeof FinalizationRegistry>"u"?(Hi=H=>H,z):(Pr=new FinalizationRegistry(H=>{pi(H.$$)}),Hi=H=>{var re=H.$$,ce=!!re.smartPtr;if(ce){var ve={$$:re};Pr.register(H,ve,H)}return H},tr=H=>Pr.unregister(H),Hi(z)),ys=[],ms=()=>{for(;ys.length;){var z=ys.pop();z.$$.deleteScheduled=!1,z.delete()}},qs,ho=()=>{Object.assign(Pn.prototype,{isAliasOf(z){if(!(this instanceof Pn)||!(z instanceof Pn))return!1;var H=this.$$.ptrType.registeredClass,re=this.$$.ptr;z.$$=z.$$;for(var ce=z.$$.ptrType.registeredClass,ve=z.$$.ptr;H.baseClass;)re=H.upcast(re),H=H.baseClass;for(;ce.baseClass;)ve=ce.upcast(ve),ce=ce.baseClass;return H===ce&&re===ve},clone(){if(this.$$.ptr||Ut(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var z=Hi(Object.create(Object.getPrototypeOf(this),{$$:{value:Nr(this.$$)}}));return z.$$.count.value+=1,z.$$.deleteScheduled=!1,z},delete(){this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ve("Object already scheduled for deletion"),tr(this),pi(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ve("Object already scheduled for deletion"),ys.push(this),ys.length===1&&qs&&qs(ms),this.$$.deleteScheduled=!0,this}})};function Pn(){}var Gi=(z,H)=>Object.defineProperty(H,"name",{value:z}),po=(z,H,re)=>{if(z[H].overloadTable===void 0){var ce=z[H];z[H]=function(){for(var ve=arguments.length,be=new Array(ve),Se=0;Se{i.hasOwnProperty(z)?((re===void 0||i[z].overloadTable!==void 0&&i[z].overloadTable[re]!==void 0)&&Ve(`Cannot register public name '${z}' twice`),po(i,z,z),i.hasOwnProperty(re)&&Ve(`Cannot register multiple overloads of a function with the same number of arguments (${re})!`),i[z].overloadTable[re]=H):(i[z]=H,re!==void 0&&(i[z].numArguments=re))},gf=48,nl=57,Pp=z=>{z=z.replace(/[^a-zA-Z0-9_]/g,"$");var H=z.charCodeAt(0);return H>=gf&&H<=nl?`_${z}`:z};function yf(z,H,re,ce,ve,be,Se,Ae){this.name=z,this.constructor=H,this.instancePrototype=re,this.rawDestructor=ce,this.baseClass=ve,this.getActualType=be,this.upcast=Se,this.downcast=Ae,this.pureVirtualFunctions=[]}var mf=(z,H,re)=>{for(;H!==re;)H.upcast||Ve(`Expected null or instance of ${re.name}, got an instance of ${H.name}`),z=H.upcast(z),H=H.baseClass;return z};function bf(z,H){if(H===null)return this.isReference&&Ve(`null is not a valid ${this.name}`),0;H.$$||Ve(`Cannot pass "${le(H)}" as a ${this.name}`),H.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`);var re=H.$$.ptrType.registeredClass,ce=mf(H.$$.ptr,re,this.registeredClass);return ce}function r0(z,H){var re;if(H===null)return this.isReference&&Ve(`null is not a valid ${this.name}`),this.isSmartPointer?(re=this.rawConstructor(),z!==null&&z.push(this.rawDestructor,re),re):0;(!H||!H.$$)&&Ve(`Cannot pass "${le(H)}" as a ${this.name}`),H.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&H.$$.ptrType.isConst&&Ve(`Cannot convert argument of type ${H.$$.smartPtrType?H.$$.smartPtrType.name:H.$$.ptrType.name} to parameter type ${this.name}`);var ce=H.$$.ptrType.registeredClass;if(re=mf(H.$$.ptr,ce,this.registeredClass),this.isSmartPointer)switch(H.$$.smartPtr===void 0&&Ve("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:H.$$.smartPtrType===this?re=H.$$.smartPtr:Ve(`Cannot convert argument of type ${H.$$.smartPtrType?H.$$.smartPtrType.name:H.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:re=H.$$.smartPtr;break;case 2:if(H.$$.smartPtrType===this)re=H.$$.smartPtr;else{var ve=H.clone();re=this.rawShare(re,vo.toHandle(()=>ve.delete())),z!==null&&z.push(this.rawDestructor,re)}break;default:Ve("Unsupporting sharing policy")}return re}function wf(z,H){if(H===null)return this.isReference&&Ve(`null is not a valid ${this.name}`),0;H.$$||Ve(`Cannot pass "${le(H)}" as a ${this.name}`),H.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`),H.$$.ptrType.isConst&&Ve(`Cannot convert argument of type ${H.$$.ptrType.name} to parameter type ${this.name}`);var re=H.$$.ptrType.registeredClass,ce=mf(H.$$.ptr,re,this.registeredClass);return ce}var kp=()=>{Object.assign(Qu.prototype,{getPointee(z){return this.rawGetPointee&&(z=this.rawGetPointee(z)),z},destructor(z){var H;(H=this.rawDestructor)===null||H===void 0||H.call(this,z)},argPackAdvance:ot,readValueFromPointer:ir,fromWireType:gs})};function Qu(z,H,re,ce,ve,be,Se,Ae,De,We,rt){this.name=z,this.registeredClass=H,this.isReference=re,this.isConst=ce,this.isSmartPointer=ve,this.pointeeType=be,this.sharingPolicy=Se,this.rawGetPointee=Ae,this.rawConstructor=De,this.rawShare=We,this.rawDestructor=rt,!ve&&H.baseClass===void 0?ce?(this.toWireType=bf,this.destructorFunction=null):(this.toWireType=wf,this.destructorFunction=null):this.toWireType=r0}var n0=(z,H,re)=>{i.hasOwnProperty(z)||Lt("Replacing nonexistent public symbol"),i[z].overloadTable!==void 0&&re!==void 0?i[z].overloadTable[re]=H:(i[z]=H,i[z].argCount=re)},Rp=(z,H,re)=>{z=z.replace(/p/g,"i");var ce=i["dynCall_"+z];return ce(H,...re)},vc=[],Mp,mr=z=>{var H=vc[z];return H||(z>=vc.length&&(vc.length=z+1),vc[z]=H=Mp.get(z)),H},Ju=function(z,H){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(z.includes("j"))return Rp(z,H,re);var ce=mr(H)(...re);return ce},il=(z,H)=>function(){for(var re=arguments.length,ce=new Array(re),ve=0;ve{z=xt(z);function re(){return z.includes("j")?il(z,H):mr(H)}var ce=re();return typeof ce!="function"&&Ve(`unknown function pointer with signature ${z}: ${H}`),ce},Op=(z,H)=>{var re=Gi(H,function(ce){this.name=H,this.message=ce;var ve=new Error(ce).stack;ve!==void 0&&(this.stack=this.toString()+` -`+ve.replace(/^Error(:[^\n]*)?\n/,""))});return re.prototype=Object.create(z.prototype),re.prototype.constructor=re,re.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},re},i0,qo=z=>{var H=Fx(z),re=xt(H);return yc(H),re},xf=(z,H)=>{var re=[],ce={};function ve(be){if(!ce[be]&&!Dt[be]){if(Nt[be]){Nt[be].forEach(ve);return}re.push(be),ce[be]=!0}}throw H.forEach(ve),new i0(`${z}: `+re.map(qo).join([", "]))},Dp=(z,H,re,ce,ve,be,Se,Ae,De,We,rt,Ft,xr)=>{rt=xt(rt),be=xn(ve,be),Ae&&(Ae=xn(Se,Ae)),We&&(We=xn(De,We)),xr=xn(Ft,xr);var Gt=Pp(rt);Vs(Gt,function(){xf(`Cannot construct ${rt} due to unbound types`,[ce])}),kt([z,H,re],ce?[ce]:[],hr=>{hr=hr[0];var Yn,$n;ce?(Yn=hr.registeredClass,$n=Yn.instancePrototype):$n=Pn.prototype;var Mn=Gi(rt,function(){if(Object.getPrototypeOf(this)!==_f)throw new Bt("Use 'new' to construct "+rt);if(yi.constructor_body===void 0)throw new Bt(rt+" has no accessible constructor");for(var v0=arguments.length,mc=new Array(v0),Kp=0;Kp{for(var re=[],ce=0;ce>2]);return re};function Np(z){for(var H=1;H{var Se=Zu(H,re);ve=xn(ce,ve),kt([],[z],Ae=>{Ae=Ae[0];var De=`constructor ${Ae.name}`;if(Ae.registeredClass.constructor_body===void 0&&(Ae.registeredClass.constructor_body=[]),Ae.registeredClass.constructor_body[H-1]!==void 0)throw new Bt(`Cannot register multiple constructors with identical number of parameters (${H-1}) for class '${Ae.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return Ae.registeredClass.constructor_body[H-1]=()=>{xf(`Cannot construct ${Ae.name} due to unbound types`,Se)},kt([],Se,We=>(We.splice(1,0,null),Ae.registeredClass.constructor_body[H-1]=s0(De,We,null,ve,be),[])),[]})},o0=z=>{z=z.trim();const H=z.indexOf("(");return H!==-1?z.substr(0,H):z},Bp=(z,H,re,ce,ve,be,Se,Ae,De,We)=>{var rt=Zu(re,ce);H=xt(H),H=o0(H),be=xn(ve,be),kt([],[z],Ft=>{Ft=Ft[0];var xr=`${Ft.name}.${H}`;H.startsWith("@@")&&(H=Symbol[H.substring(2)]),Ae&&Ft.registeredClass.pureVirtualFunctions.push(H);function Gt(){xf(`Cannot call ${xr} due to unbound types`,rt)}var hr=Ft.registeredClass.instancePrototype,Yn=hr[H];return Yn===void 0||Yn.overloadTable===void 0&&Yn.className!==Ft.name&&Yn.argCount===re-2?(Gt.argCount=re-2,Gt.className=Ft.name,hr[H]=Gt):(po(hr,H,xr),hr[H].overloadTable[re-2]=Gt),kt([],rt,$n=>{var Mn=s0(xr,$n,Ft,be,Se);return hr[H].overloadTable===void 0?(Mn.argCount=re-2,hr[H]=Mn):hr[H].overloadTable[re-2]=Mn,[]}),[]})},sl=[],Vo=[],Ef=z=>{z>9&&--Vo[z+1]===0&&(Vo[z]=void 0,sl.push(z))},Sm=()=>Vo.length/2-5-sl.length,Xu=()=>{Vo.push(0,1,void 0,1,null,1,!0,1,!1,1),i.count_emval_handles=Sm},vo={toValue:z=>(z||Ve("Cannot use deleted val. handle = "+z),Vo[z]),toHandle:z=>{switch(z){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const H=sl.pop()||Vo.length;return Vo[H]=z,Vo[H+1]=1,H}}}},a0={name:"emscripten::val",fromWireType:z=>{var H=vo.toValue(z);return Ef(z),H},toWireType:(z,H)=>vo.toHandle(H),argPackAdvance:ot,readValueFromPointer:ir,destructorFunction:null},Cf=z=>Et(z,a0),Lp=(z,H,re)=>{switch(H){case 1:return re?function(ce){return this.fromWireType(I[ce])}:function(ce){return this.fromWireType(U[ce])};case 2:return re?function(ce){return this.fromWireType(ie[ce>>1])}:function(ce){return this.fromWireType(ae[ce>>1])};case 4:return re?function(ce){return this.fromWireType(K[ce>>2])}:function(ce){return this.fromWireType(R[ce>>2])};default:throw new TypeError(`invalid integer width (${H}): ${z}`)}},_m=(z,H,re,ce)=>{H=xt(H);function ve(){}ve.values={},Et(z,{name:H,constructor:ve,fromWireType:function(be){return this.constructor.values[be]},toWireType:(be,Se)=>Se.value,argPackAdvance:ot,readValueFromPointer:Lp(H,re,ce),destructorFunction:null}),Vs(H,ve)},Hr=(z,H)=>{var re=Dt[z];return re===void 0&&Ve(`${H} has unknown type ${qo(z)}`),re},Yr=(z,H,re)=>{var ce=Hr(z,"enum");H=xt(H);var ve=ce.constructor,be=Object.create(ce.constructor.prototype,{value:{value:re},constructor:{value:Gi(`${ce.name}_${H}`,function(){})}});ve.values[re]=be,ve[H]=be},le=z=>{if(z===null)return"null";var H=typeof z;return H==="object"||H==="array"||H==="function"?z.toString():""+z},Ee=(z,H)=>{switch(H){case 4:return function(re){return this.fromWireType(D[re>>2])};case 8:return function(re){return this.fromWireType(v[re>>3])};default:throw new TypeError(`invalid float width (${H}): ${z}`)}},Ue=(z,H,re)=>{H=xt(H),Et(z,{name:H,fromWireType:ce=>ce,toWireType:(ce,ve)=>ve,argPackAdvance:ot,readValueFromPointer:Ee(H,re),destructorFunction:null})},gt=(z,H,re,ce,ve,be,Se,Ae)=>{var De=Zu(H,re);z=xt(z),z=o0(z),ve=xn(ce,ve),Vs(z,function(){xf(`Cannot call ${z} due to unbound types`,De)},H-1),kt([],De,We=>{var rt=[We[0],null].concat(We.slice(1));return n0(z,s0(z,rt,null,ve,be),H-1),[]})},tn=(z,H,re)=>{switch(H){case 1:return re?ce=>I[ce]:ce=>U[ce];case 2:return re?ce=>ie[ce>>1]:ce=>ae[ce>>1];case 4:return re?ce=>K[ce>>2]:ce=>R[ce>>2];default:throw new TypeError(`invalid integer width (${H}): ${z}`)}},rr=(z,H,re,ce,ve)=>{H=xt(H);var be=rt=>rt;if(ce===0){var Se=32-8*re;be=rt=>rt<>>Se}var Ae=H.includes("unsigned"),De=(rt,Ft)=>{},We;Ae?We=function(rt,Ft){return De(Ft,this.name),Ft>>>0}:We=function(rt,Ft){return De(Ft,this.name),Ft},Et(z,{name:H,fromWireType:be,toWireType:We,argPackAdvance:ot,readValueFromPointer:tn(H,re,ce!==0),destructorFunction:null})},hn=(z,H,re)=>{var ce=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ve=ce[H];function be(Se){var Ae=R[Se>>2],De=R[Se+4>>2];return new ve(I.buffer,De,Ae)}re=xt(re),Et(z,{name:re,fromWireType:be,argPackAdvance:ot,readValueFromPointer:be},{ignoreDuplicateRegistrations:!0})},Un=Object.assign({optional:!0},a0),Cr=(z,H)=>{Et(z,Un)},rn=(z,H,re,ce)=>{if(!(ce>0))return 0;for(var ve=re,be=re+ce-1,Se=0;Se=55296&&Ae<=57343){var De=z.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|De&1023}if(Ae<=127){if(re>=be)break;H[re++]=Ae}else if(Ae<=2047){if(re+1>=be)break;H[re++]=192|Ae>>6,H[re++]=128|Ae&63}else if(Ae<=65535){if(re+2>=be)break;H[re++]=224|Ae>>12,H[re++]=128|Ae>>6&63,H[re++]=128|Ae&63}else{if(re+3>=be)break;H[re++]=240|Ae>>18,H[re++]=128|Ae>>12&63,H[re++]=128|Ae>>6&63,H[re++]=128|Ae&63}}return H[re]=0,re-ve},pn=(z,H,re)=>rn(z,U,H,re),bs=z=>{for(var H=0,re=0;re=55296&&ce<=57343?(H+=4,++re):H+=3}return H},Rn=typeof TextDecoder<"u"?new TextDecoder:void 0,cn=function(z){let H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN;for(var ce=H+re,ve=H;z[ve]&&!(ve>=ce);)++ve;if(ve-H>16&&z.buffer&&Rn)return Rn.decode(z.subarray(H,ve));for(var be="";H>10,56320|We&1023)}}return be},Wi=(z,H)=>z?cn(U,z,H):"",zo=(z,H)=>{H=xt(H);var re=H==="std::string";Et(z,{name:H,fromWireType(ce){var ve=R[ce>>2],be=ce+4,Se;if(re)for(var Ae=be,De=0;De<=ve;++De){var We=be+De;if(De==ve||U[We]==0){var rt=We-Ae,Ft=Wi(Ae,rt);Se===void 0?Se=Ft:(Se+="\0",Se+=Ft),Ae=We+1}}else{for(var xr=new Array(ve),De=0;De>2]=be,re&&Se)pn(ve,De,be+1);else if(Se)for(var We=0;We255&&(yc(De),Ve("String has UTF-16 code units that do not fit in 8 bits")),U[De+We]=rt}else for(var We=0;We{for(var re=z,ce=re>>1,ve=ce+H/2;!(ce>=ve)&&ae[ce];)++ce;if(re=ce<<1,re-z>32&&zs)return zs.decode(U.subarray(z,re));for(var be="",Se=0;!(Se>=H/2);++Se){var Ae=ie[z+Se*2>>1];if(Ae==0)break;be+=String.fromCharCode(Ae)}return be},c0=(z,H,re)=>{var ce;if((ce=re)!==null&&ce!==void 0||(re=2147483647),re<2)return 0;re-=2;for(var ve=H,be=re>1]=Ae,H+=2}return ie[H>>1]=0,H-ve},Af=z=>z.length*2,li=(z,H)=>{for(var re=0,ce="";!(re>=H/4);){var ve=K[z+re*4>>2];if(ve==0)break;if(++re,ve>=65536){var be=ve-65536;ce+=String.fromCharCode(55296|be>>10,56320|be&1023)}else ce+=String.fromCharCode(ve)}return ce},NC=(z,H,re)=>{var ce;if((ce=re)!==null&&ce!==void 0||(re=2147483647),re<4)return 0;for(var ve=H,be=ve+re-4,Se=0;Se=55296&&Ae<=57343){var De=z.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|De&1023}if(K[H>>2]=Ae,H+=4,H+4>be)break}return K[H>>2]=0,H-ve},go=z=>{for(var H=0,re=0;re=55296&&ce<=57343&&++re,H+=4}return H},BC=(z,H,re)=>{re=xt(re);var ce,ve,be,Se;H===2?(ce=Aa,ve=c0,Se=Af,be=Ae=>ae[Ae>>1]):H===4&&(ce=li,ve=NC,Se=go,be=Ae=>R[Ae>>2]),Et(z,{name:re,fromWireType:Ae=>{for(var De=R[Ae>>2],We,rt=Ae+4,Ft=0;Ft<=De;++Ft){var xr=Ae+4+Ft*H;if(Ft==De||be(xr)==0){var Gt=xr-rt,hr=ce(rt,Gt);We===void 0?We=hr:(We+="\0",We+=hr),rt=xr+H}}return yc(Ae),We},toWireType:(Ae,De)=>{typeof De!="string"&&Ve(`Cannot pass non-string to C++ string type ${re}`);var We=Se(De),rt=u0(4+We+H);return R[rt>>2]=We/H,ve(De,rt+4,We+H),Ae!==null&&Ae.push(yc,rt),rt},argPackAdvance:ot,readValueFromPointer:ir,destructorFunction(Ae){yc(Ae)}})},Rx=(z,H,re,ce,ve,be)=>{wt[z]={name:xt(H),rawConstructor:xn(re,ce),rawDestructor:xn(ve,be),fields:[]}},ol=(z,H,re,ce,ve,be,Se,Ae,De,We)=>{wt[z].fields.push({fieldName:xt(H),getterReturnType:re,getter:xn(ce,ve),getterContext:be,setterArgumentType:Se,setter:xn(Ae,De),setterContext:We})},Fp=(z,H)=>{H=xt(H),Et(z,{isVoid:!0,name:H,argPackAdvance:0,fromWireType:()=>{},toWireType:(re,ce)=>{}})},Im=(z,H,re)=>U.copyWithin(z,H,H+re),ln=[],al=(z,H,re,ce)=>(z=ln[z],H=vo.toValue(H),z(null,H,re,ce)),Tm={},LC=z=>{var H=Tm[z];return H===void 0?xt(z):H},jp=()=>{if(typeof globalThis=="object")return globalThis;function z(H){H.$$$embind_global$$$=H;var re=typeof $$$embind_global$$$=="object"&&H.$$$embind_global$$$==H;return re||delete H.$$$embind_global$$$,re}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&z(global)?$$$embind_global$$$=global:typeof self=="object"&&z(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},FC=z=>z===0?vo.toHandle(jp()):(z=LC(z),vo.toHandle(jp()[z])),jC=z=>{var H=ln.length;return ln.push(z),H},UC=(z,H)=>{for(var re=new Array(z),ce=0;ce>2],"parameter "+ce);return re},Mx=Reflect.construct,Up=(z,H,re)=>{var ce=[],ve=z.toWireType(ce,re);return ce.length&&(R[H>>2]=vo.toHandle(ce)),ve},ed=(z,H,re)=>{var ce=UC(z,H),ve=ce.shift();z--;var be=new Array(z),Se=(De,We,rt,Ft)=>{for(var xr=0,Gt=0;GtDe.name).join(", ")}) => ${ve.name}>`;return jC(Gi(Ae,Se))},$C=z=>{z>9&&(Vo[z+1]+=1)},Ox=z=>{var H=vo.toValue(z);lr(H),Ef(z)},Dx=(z,H)=>{z=Hr(z,"_emval_take_value");var re=z.readValueFromPointer(H);return vo.toHandle(re)},Pm=(z,H,re,ce)=>{var ve=new Date().getFullYear(),be=new Date(ve,0,1),Se=new Date(ve,6,1),Ae=be.getTimezoneOffset(),De=Se.getTimezoneOffset(),We=Math.max(Ae,De);R[z>>2]=We*60,K[H>>2]=+(Ae!=De);var rt=Gt=>{var hr=Gt>=0?"-":"+",Yn=Math.abs(Gt),$n=String(Math.floor(Yn/60)).padStart(2,"0"),Mn=String(Yn%60).padStart(2,"0");return`UTC${hr}${$n}${Mn}`},Ft=rt(Ae),xr=rt(De);De2147483648,Nx=(z,H)=>Math.ceil(z/H)*H,qC=z=>{var H=L.buffer,re=(z-H.byteLength+65535)/65536|0;try{return L.grow(re),b(),1}catch{}},Rm=z=>{var H=U.length;z>>>=0;var re=km();if(z>re)return!1;for(var ce=1;ce<=4;ce*=2){var ve=H*(1+.2/ce);ve=Math.min(ve,z+100663296);var be=Math.min(re,Nx(Math.max(z,ve),65536)),Se=qC(be);if(Se)return!0}return!1},l0={},VC=()=>h||"./this.program",td=()=>{if(!td.strings){var z=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",H={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:z,_:VC()};for(var re in l0)l0[re]===void 0?delete H[re]:H[re]=l0[re];var ce=[];for(var re in H)ce.push(`${re}=${H[re]}`);td.strings=ce}return td.strings},Hs=(z,H)=>{for(var re=0;re{var re=0;return td().forEach((ce,ve)=>{var be=H+re;R[z+ve*4>>2]=be,Hs(ce,be),re+=ce.length+1}),0},f0=(z,H)=>{var re=td();R[z>>2]=re.length;var ce=0;return re.forEach(ve=>ce+=ve.length+1),R[H>>2]=ce,0},Bx=z=>52;function Lx(z,H,re,ce,ve){return 70}var zC=[null,[],[]],HC=(z,H)=>{var re=zC[z];H===0||H===10?((z===1?A:P)(cn(re)),re.length=0):re.push(H)},GC=(z,H,re,ce)=>{for(var ve=0,be=0;be>2],Ae=R[H+4>>2];H+=8;for(var De=0;De>2]=ve,0},WC=z=>z;dt=i.InternalError=class extends Error{constructor(z){super(z),this.name="InternalError"}},zt(),Bt=i.BindingError=class extends Error{constructor(z){super(z),this.name="BindingError"}},ho(),kp(),i0=i.UnboundTypeError=Op(Error,"UnboundTypeError"),Xu();var KC={t:ct,x:He,a:bt,j:Ze,k:_t,O:Ct,q:It,ga:er,d:pt,ca:dr,va:ut,ba:Vt,pa:Ht,ta:Dp,sa:gc,E:Bp,oa:Cf,F:_m,n:Yr,W:Ue,X:gt,y:rr,u:hn,ua:Cr,V:zo,P:BC,L:Rx,wa:ol,qa:Fp,ja:Im,T:al,xa:Ef,ya:FC,U:ed,Y:$C,Z:Ox,ra:Dx,da:Pm,ha:Rm,ea:Mm,fa:f0,ia:Bx,$:Lx,S:GC,J:Vp,C:tA,Q:rd,R:cl,r:$p,b:YC,D:qp,la:zp,c:Oe,ka:rA,h:ZC,i:Lr,s:Kn,N:nd,w:Nm,I:iA,K:eA,z:Vx,H:Gp,aa:Wp,_:Hx,l:Pe,f:we,e:JC,g:QC,M:Hp,m:Xt,ma:Gr,p:nn,v:XC,na:mo,B:nA,o:mt,G:zx,A:WC},Qr=Xe(),Fx=z=>(Fx=Qr.Ba)(z),yc=i._free=z=>(yc=i._free=Qr.Ca)(z),u0=i._malloc=z=>(u0=i._malloc=Qr.Ea)(z),Om=z=>(Om=Qr.Fa)(z),nr=(z,H)=>(nr=Qr.Ga)(z,H),d0=z=>(d0=Qr.Ha)(z),jx=z=>(jx=Qr.Ia)(z),Ux=()=>(Ux=Qr.Ja)(),$x=z=>($x=Qr.Ka)(z),Sf=z=>(Sf=Qr.La)(z),yo=(z,H,re)=>(yo=Qr.Ma)(z,H,re);i.dynCall_viijii=(z,H,re,ce,ve,be,Se)=>(i.dynCall_viijii=Qr.Na)(z,H,re,ce,ve,be,Se);var Dm=i.dynCall_jiii=(z,H,re,ce)=>(Dm=i.dynCall_jiii=Qr.Oa)(z,H,re,ce);i.dynCall_jiji=(z,H,re,ce,ve)=>(i.dynCall_jiji=Qr.Pa)(z,H,re,ce,ve);var qx=i.dynCall_jiiii=(z,H,re,ce,ve)=>(qx=i.dynCall_jiiii=Qr.Qa)(z,H,re,ce,ve);i.dynCall_iiiiij=(z,H,re,ce,ve,be,Se)=>(i.dynCall_iiiiij=Qr.Ra)(z,H,re,ce,ve,be,Se),i.dynCall_iiiiijj=(z,H,re,ce,ve,be,Se,Ae,De)=>(i.dynCall_iiiiijj=Qr.Sa)(z,H,re,ce,ve,be,Se,Ae,De),i.dynCall_iiiiiijj=(z,H,re,ce,ve,be,Se,Ae,De,We)=>(i.dynCall_iiiiiijj=Qr.Ta)(z,H,re,ce,ve,be,Se,Ae,De,We);function YC(z,H){var re=$e();try{return mr(z)(H)}catch(ce){if(Re(re),ce!==ce+0)throw ce;nr(1,0)}}function QC(z,H,re,ce){var ve=$e();try{mr(z)(H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function JC(z,H,re){var ce=$e();try{mr(z)(H,re)}catch(ve){if(Re(ce),ve!==ve+0)throw ve;nr(1,0)}}function ZC(z,H,re,ce){var ve=$e();try{return mr(z)(H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function rd(z,H,re,ce,ve){var be=$e();try{return mr(z)(H,re,ce,ve)}catch(Se){if(Re(be),Se!==Se+0)throw Se;nr(1,0)}}function we(z,H){var re=$e();try{mr(z)(H)}catch(ce){if(Re(re),ce!==ce+0)throw ce;nr(1,0)}}function Oe(z,H,re){var ce=$e();try{return mr(z)(H,re)}catch(ve){if(Re(ce),ve!==ve+0)throw ve;nr(1,0)}}function Pe(z){var H=$e();try{mr(z)()}catch(re){if(Re(H),re!==re+0)throw re;nr(1,0)}}function mt(z,H,re,ce,ve,be,Se,Ae,De,We,rt){var Ft=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae,De,We,rt)}catch(xr){if(Re(Ft),xr!==xr+0)throw xr;nr(1,0)}}function Xt(z,H,re,ce,ve){var be=$e();try{mr(z)(H,re,ce,ve)}catch(Se){if(Re(be),Se!==Se+0)throw Se;nr(1,0)}}function Lr(z,H,re,ce,ve){var be=$e();try{return mr(z)(H,re,ce,ve)}catch(Se){if(Re(be),Se!==Se+0)throw Se;nr(1,0)}}function Kn(z,H,re,ce,ve,be){var Se=$e();try{return mr(z)(H,re,ce,ve,be)}catch(Ae){if(Re(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function nn(z,H,re,ce,ve,be){var Se=$e();try{mr(z)(H,re,ce,ve,be)}catch(Ae){if(Re(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function Nm(z,H,re,ce,ve,be,Se){var Ae=$e();try{return mr(z)(H,re,ce,ve,be,Se)}catch(De){if(Re(Ae),De!==De+0)throw De;nr(1,0)}}function XC(z,H,re,ce,ve,be,Se,Ae){var De=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae)}catch(We){if(Re(De),We!==We+0)throw We;nr(1,0)}}function mo(z,H,re,ce,ve,be,Se,Ae,De){var We=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae,De)}catch(rt){if(Re(We),rt!==rt+0)throw rt;nr(1,0)}}function $p(z){var H=$e();try{return mr(z)()}catch(re){if(Re(H),re!==re+0)throw re;nr(1,0)}}function eA(z,H,re,ce,ve,be,Se,Ae,De){var We=$e();try{return mr(z)(H,re,ce,ve,be,Se,Ae,De)}catch(rt){if(Re(We),rt!==rt+0)throw rt;nr(1,0)}}function nd(z,H,re,ce,ve,be,Se){var Ae=$e();try{return mr(z)(H,re,ce,ve,be,Se)}catch(De){if(Re(Ae),De!==De+0)throw De;nr(1,0)}}function qp(z,H,re,ce){var ve=$e();try{return mr(z)(H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function Vp(z,H,re,ce){var ve=$e();try{return mr(z)(H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function Gr(z,H,re,ce,ve,be,Se,Ae){var De=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae)}catch(We){if(Re(De),We!==We+0)throw We;nr(1,0)}}function tA(z,H,re,ce,ve,be){var Se=$e();try{return mr(z)(H,re,ce,ve,be)}catch(Ae){if(Re(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function Vx(z,H,re,ce,ve,be,Se,Ae,De,We){var rt=$e();try{return mr(z)(H,re,ce,ve,be,Se,Ae,De,We)}catch(Ft){if(Re(rt),Ft!==Ft+0)throw Ft;nr(1,0)}}function zp(z,H,re){var ce=$e();try{return mr(z)(H,re)}catch(ve){if(Re(ce),ve!==ve+0)throw ve;nr(1,0)}}function rA(z,H,re,ce,ve){var be=$e();try{return mr(z)(H,re,ce,ve)}catch(Se){if(Re(be),Se!==Se+0)throw Se;nr(1,0)}}function nA(z,H,re,ce,ve,be,Se,Ae,De,We){var rt=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae,De,We)}catch(Ft){if(Re(rt),Ft!==Ft+0)throw Ft;nr(1,0)}}function iA(z,H,re,ce,ve,be,Se,Ae){var De=$e();try{return mr(z)(H,re,ce,ve,be,Se,Ae)}catch(We){if(Re(De),We!==We+0)throw We;nr(1,0)}}function Hp(z,H,re,ce,ve,be,Se){var Ae=$e();try{mr(z)(H,re,ce,ve,be,Se)}catch(De){if(Re(Ae),De!==De+0)throw De;nr(1,0)}}function cl(z,H,re,ce){var ve=$e();try{return mr(z)(H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function Gp(z,H,re,ce,ve,be,Se,Ae,De,We,rt,Ft){var xr=$e();try{return mr(z)(H,re,ce,ve,be,Se,Ae,De,We,rt,Ft)}catch(Gt){if(Re(xr),Gt!==Gt+0)throw Gt;nr(1,0)}}function zx(z,H,re,ce,ve,be,Se,Ae,De,We,rt,Ft,xr,Gt,hr,Yn){var $n=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae,De,We,rt,Ft,xr,Gt,hr,Yn)}catch(Mn){if(Re($n),Mn!==Mn+0)throw Mn;nr(1,0)}}function Wp(z,H,re,ce){var ve=$e();try{return Dm(z,H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function Hx(z,H,re,ce,ve){var be=$e();try{return qx(z,H,re,ce,ve)}catch(Se){if(Re(be),Se!==Se+0)throw Se;nr(1,0)}}var h0,p0;X=function z(){h0||Bm(),h0||(X=z)};function Bm(){if($>0||!p0&&(p0=1,C(),$>0))return;function z(){var H;h0||(h0=1,i.calledRun=1,!V&&(w(),s(i),(H=i.onRuntimeInitialized)===null||H===void 0||H.call(i),k()))}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),z()},1)):z()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Bm(),n=a,n}})();function eHe(t){return BO(LO,t)}async function tHe(t,e){return Zze(LO,t,e)}async function rHe(t,e){return Xze(LO,t,e)}const Kie=[["aztec","Aztec"],["code_128","Code128"],["code_39","Code39"],["code_93","Code93"],["codabar","Codabar"],["databar","DataBar"],["databar_expanded","DataBarExpanded"],["databar_limited","DataBarLimited"],["data_matrix","DataMatrix"],["dx_film_edge","DXFilmEdge"],["ean_13","EAN-13"],["ean_8","EAN-8"],["itf","ITF"],["maxi_code","MaxiCode"],["micro_qr_code","MicroQRCode"],["pdf417","PDF417"],["qr_code","QRCode"],["rm_qr_code","rMQRCode"],["upc_a","UPC-A"],["upc_e","UPC-E"],["linear_codes","Linear-Codes"],["matrix_codes","Matrix-Codes"]],nHe=[...Kie,["unknown"]].map(t=>t[0]),HT=new Map(Kie);function iHe(t){for(const[e,r]of HT)if(t===r)return e;return"unknown"}function sHe(t){if(Yie(t))return{width:t.naturalWidth,height:t.naturalHeight};if(Qie(t))return{width:t.width.baseVal.value,height:t.height.baseVal.value};if(Jie(t))return{width:t.videoWidth,height:t.videoHeight};if(Xie(t))return{width:t.width,height:t.height};if(tse(t))return{width:t.displayWidth,height:t.displayHeight};if(Zie(t))return{width:t.width,height:t.height};if(ese(t))return{width:t.width,height:t.height};throw new TypeError("The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'.")}function Yie(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLImageElement)}catch{return!1}}function Qie(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.SVGImageElement)}catch{return!1}}function Jie(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLVideoElement)}catch{return!1}}function Zie(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLCanvasElement)}catch{return!1}}function Xie(t){try{return t instanceof ImageBitmap||Object.prototype.toString.call(t)==="[object ImageBitmap]"}catch{return!1}}function ese(t){try{return t instanceof OffscreenCanvas||Object.prototype.toString.call(t)==="[object OffscreenCanvas]"}catch{return!1}}function tse(t){try{return t instanceof VideoFrame||Object.prototype.toString.call(t)==="[object VideoFrame]"}catch{return!1}}function rse(t){try{return t instanceof Blob||Object.prototype.toString.call(t)==="[object Blob]"}catch{return!1}}function oHe(t){try{return t instanceof ImageData||Object.prototype.toString.call(t)==="[object ImageData]"}catch{return!1}}function aHe(t,e){try{const r=new OffscreenCanvas(t,e);if(r.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return r;throw void 0}catch{const r=document.createElement("canvas");return r.width=t,r.height=e,r}}async function nse(t){if(Yie(t)&&!await uHe(t))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(Qie(t)&&!await dHe(t))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(tse(t)&&hHe(t))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(Jie(t)&&(t.readyState===0||t.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(Xie(t)&&vHe(t))throw new DOMException("The image source is detached.","InvalidStateError");const{width:e,height:r}=sHe(t);if(e===0||r===0)return null;const n=aHe(e,r).getContext("2d");n.drawImage(t,0,0);try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function cHe(t){let e;try{if(globalThis.createImageBitmap)e=await createImageBitmap(t);else if(globalThis.Image){e=new Image;let r="";try{r=URL.createObjectURL(t),e.src=r,await e.decode()}finally{URL.revokeObjectURL(r)}}else return t}catch{throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await nse(e)}function lHe(t){const{width:e,height:r}=t;if(e===0||r===0)return null;const n=t.getContext("2d");try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function fHe(t){if(rse(t))return await cHe(t);if(oHe(t)){if(pHe(t))throw new DOMException("The image data has been detached.","InvalidStateError");return t}return Zie(t)||ese(t)?lHe(t):await nse(t)}async function uHe(t){try{return await t.decode(),!0}catch{return!1}}async function dHe(t){var e;try{return await((e=t.decode)==null?void 0:e.call(t)),!0}catch{return!1}}function hHe(t){return t.format===null}function pHe(t){return t.data.buffer.byteLength===0}function vHe(t){return t.width===0&&t.height===0}function HV(t,e){return gHe(t)?new DOMException(`${e}: ${t.message}`,t.name):yHe(t)?new t.constructor(`${e}: ${t.message}`):new Error(`${e}: ${t}`)}function gHe(t){return t instanceof DOMException||Object.prototype.toString.call(t)==="[object DOMException]"}function yHe(t){return t instanceof Error||Object.prototype.toString.call(t)==="[object Error]"}var M5;class GT extends EventTarget{constructor(e={}){var r;super(),$ze(this,M5);try{const n=(r=e==null?void 0:e.formats)==null?void 0:r.filter(i=>i!=="unknown");if((n==null?void 0:n.length)===0)throw new TypeError("Hint option provided, but is empty.");for(const i of n??[])if(!HT.has(i))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${i}' is not a valid enum value of type BarcodeFormat.`);qze(this,M5,n??[]),eHe().then(i=>{this.dispatchEvent(new CustomEvent("load",{detail:i}))}).catch(i=>{this.dispatchEvent(new CustomEvent("error",{detail:i}))})}catch(n){throw HV(n,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return nHe.filter(e=>e!=="unknown")}async detect(e){try{const r=await fHe(e);if(r===null)return[];let n;const i={tryHarder:!0,returnCodabarStartEnd:!0,formats:Uze(this,M5).map(s=>HT.get(s))};try{rse(r)?n=await tHe(r,i):n=await rHe(r,i)}catch(s){throw console.error(s),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return n.map(s=>{const{topLeft:{x:o,y:a},topRight:{x:c,y:l},bottomLeft:{x:f,y:u},bottomRight:{x:h,y:g}}=s.position,y=Math.min(o,c,f,h),m=Math.min(a,l,u,g),S=Math.max(o,c,f,h),E=Math.max(a,l,u,g);return{boundingBox:new DOMRectReadOnly(y,m,S-y,E-m),rawValue:s.text,format:iHe(s.format),cornerPoints:[{x:o,y:a},{x:c,y:l},{x:h,y:g},{x:f,y:u}]}})}catch(r){throw HV(r,"Failed to execute 'detect' on 'BarcodeDetector'")}}}M5=new WeakMap;globalThis.BarcodeDetector!=null||(globalThis.BarcodeDetector=GT);function mHe(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M3 3L6.00007 6.00007M21 21L19.8455 19.8221M9.74194 4.06811C9.83646 4.04279 9.93334 4.02428 10.0319 4.01299C10.1453 4 10.2683 4 10.5141 4H13.5327C13.7786 4 13.9015 4 14.015 4.01299C14.6068 4.08078 15.1375 4.40882 15.4628 4.90782C15.5252 5.00345 15.5802 5.11345 15.6901 5.33333C15.7451 5.44329 15.7726 5.49827 15.8037 5.54609C15.9664 5.79559 16.2318 5.95961 16.5277 5.9935C16.5844 6 16.6459 6 16.7688 6H17.8234C18.9435 6 19.5036 6 19.9314 6.21799C20.3077 6.40973 20.6137 6.71569 20.8055 7.09202C21.0234 7.51984 21.0234 8.0799 21.0234 9.2V15.3496M19.8455 19.8221C19.4278 20 18.8702 20 17.8234 20H6.22344C5.10333 20 4.54328 20 4.11546 19.782C3.73913 19.5903 3.43317 19.2843 3.24142 18.908C3.02344 18.4802 3.02344 17.9201 3.02344 16.8V9.2C3.02344 8.0799 3.02344 7.51984 3.24142 7.09202C3.43317 6.71569 3.73913 6.40973 4.11546 6.21799C4.51385 6.015 5.0269 6.00103 6.00007 6.00007M19.8455 19.8221L14.5619 14.5619M14.5619 14.5619C14.0349 15.4243 13.0847 16 12 16C10.3431 16 9 14.6569 9 13C9 11.9153 9.57566 10.9651 10.4381 10.4381M14.5619 14.5619L10.4381 10.4381M10.4381 10.4381L6.00007 6.00007"}))}function bHe(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M12 16C13.6569 16 15 14.6569 15 13C15 11.3431 13.6569 10 12 10C10.3431 10 9 11.3431 9 13C9 14.6569 10.3431 16 12 16Z"}),qt.createElement("path",{d:"M3 16.8V9.2C3 8.0799 3 7.51984 3.21799 7.09202C3.40973 6.71569 3.71569 6.40973 4.09202 6.21799C4.51984 6 5.0799 6 6.2 6H7.25464C7.37758 6 7.43905 6 7.49576 5.9935C7.79166 5.95961 8.05705 5.79559 8.21969 5.54609C8.25086 5.49827 8.27836 5.44328 8.33333 5.33333C8.44329 5.11342 8.49827 5.00346 8.56062 4.90782C8.8859 4.40882 9.41668 4.08078 10.0085 4.01299C10.1219 4 10.2448 4 10.4907 4H13.5093C13.7552 4 13.8781 4 13.9915 4.01299C14.5833 4.08078 15.1141 4.40882 15.4394 4.90782C15.5017 5.00345 15.5567 5.11345 15.6667 5.33333C15.7216 5.44329 15.7491 5.49827 15.7803 5.54609C15.943 5.79559 16.2083 5.95961 16.5042 5.9935C16.561 6 16.6224 6 16.7454 6H17.8C18.9201 6 19.4802 6 19.908 6.21799C20.2843 6.40973 20.5903 6.71569 20.782 7.09202C21 7.51984 21 8.0799 21 9.2V16.8C21 17.9201 21 18.4802 20.782 18.908C20.5903 19.2843 20.2843 19.5903 19.908 19.782C19.4802 20 18.9201 20 17.8 20H6.2C5.0799 20 4.51984 20 4.09202 19.782C3.71569 19.5903 3.40973 19.2843 3.21799 18.908C3 18.4802 3 17.9201 3 16.8Z"}))}function wHe(t){const{scanning:e,startScanning:r,stopScanning:n}=t,[i,s]=T.useState(!1);function o(){s(!0),e?n():r(),setTimeout(()=>s(!1),1e3)}return qt.createElement("div",{style:{bottom:85,right:3,position:"absolute",zIndex:2,cursor:i?"default":"pointer"}},e?qt.createElement(mHe,{disabled:i,onClick:o}):qt.createElement(bHe,{disabled:i,onClick:o}))}function xHe(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M13.225 9l5.025-7h-7.972l-3.3 11h5.359l-2.452 8.648.75.364L20.374 9zm.438 3H8.322l2.7-9H16.3l-5.025 7h7.101l-6.7 8.953z"}))}function EHe(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M14.516 15.158l.714.714-4.595 6.14-.75-.364L12.337 13H6.978L8.22 8.861l.803.803L8.322 12h3.036l1.793 1.792-1.475 5.16zm5.984 4.05L4.793 3.5l.707-.707 3.492 3.492L10.278 2h7.972l-5.025 7h7.149l-3.71 4.957 4.543 4.543zM12.707 10l3.243 3.243L18.376 10zM9.795 7.088l2.079 2.079L16.3 3h-5.278z"}))}function CHe(t){const{status:e,scanning:r,torchToggle:n}=t;function i(s){n(s)}return r&&n?qt.createElement("div",{style:{bottom:35,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},e?qt.createElement(EHe,{onClick:()=>i(!1)}):qt.createElement(xHe,{onClick:()=>i(!0)})):null}function AHe(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-7.46,0.5l-1.5,0c-0.645,0 -0.643,-1 -0,-1l1.5,0l-0,-1.5c-0,-0.645 1,-0.643 1,0l-0,1.5l1.5,0c0.645,0 0.643,1 -0,1l-1.5,0l-0,1.5c-0,0.645 -1,0.643 -1,0l-0,-1.5Z"}))}function SHe(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-4.96,-0.5c0.645,0 0.643,1 -0,1l-4,0c-0.645,0 -0.643,-1 -0,-1l4,0Z"}))}function _He(t){const{scanning:e,capabilities:r,onZoom:n,value:i}=t;if(!e||!n)return null;const s=(r.max-r.min)/3;return qt.createElement(T.Fragment,null,qt.createElement("div",{style:{bottom:130,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(SHe,{disabled:i<=r.min,onClick:function(){n(Math.max(i-s,r.min))}})),qt.createElement("div",{style:{bottom:180,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(AHe,{disabled:i>=r.max,onClick:function(){n(Math.min(i+s,r.max))}})))}function IHe(t){const{scanning:e,loading:r,capabilities:n,border:i=35,onOff:s,torch:o,zoom:a,startScanning:c,stopScanning:l}=t,f="rgba(255, 0, 0, 0.5)";return qt.createElement("div",{style:{position:"relative"}},qt.createElement("svg",{viewBox:"0 0 100 100",style:{top:0,left:0,zIndex:1,boxSizing:"border-box",border:`${i>=35?i:35}px solid rgba(0, 0, 0, 0.2)`}},r&&qt.createElement("text",{x:"50",y:"50",textAnchor:"middle",fill:"black",fontSize:"8",fontFamily:"Arial",fontWeight:"bold"},"Loading ...",qt.createElement("animate",{attributeName:"opacity",values:"0;1;0",dur:"2s",repeatCount:"indefinite"})),qt.createElement("path",{fill:"none",d:"M23,0 L0,0 L0,23",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M0,77 L0,100 L23,100",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M77,100 L100,100 L100,77",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M100,23 L100,0 77,0",stroke:f,strokeWidth:3})),s&&qt.createElement(wHe,{scanning:e,startScanning:c,stopScanning:l}),o&&n.torch&&qt.createElement(CHe,{scanning:e,status:o.status,torchToggle:o.toggle}),a&&n.zoom&&qt.createElement(_He,{scanning:e,capabilities:n.zoom,value:a.value,onZoom:a.onChange}))}const THe={facingMode:"environment",width:{min:640,ideal:720,max:1920},height:{min:640,ideal:720,max:1080}},PHe={audio:!0,tracker:void 0,onOff:!1,finder:!0,torch:!0,zoom:!1},kHe={width:"100%",height:"100%",position:"relative"},RHe={top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden"};var MHe=function(t){let e,r=!1;return(...n)=>(r||(e=t(n),r=!0),e)}(()=>{const t=uze(window);switch(t.browser){case"chrome":Eze(window,t);break;case"firefox":_ze(window,t);break;case"safari":kze(window,t);break;default:throw new Error("Unsupported browser")}});const OHe="data:audio/mp3;base64,//PkZAAhghE0AKToAJra/n0FQygAAAGIkYJgmCYXBMAAGCTJz3zhCEM//z//1hz//8MMMMN08ssV6e5DDWIQreAgCvFKy8bXgIKMkUDDBgzJwIBtkRMQAocxIFdxghQGKDoEziAzQxOBOdH92i/iGi+zDCAEIX46a73HrSybZw1x3JZjXp7dSNy/P68rjcbt7p7fakMP5LVMyzCaj1pjvejYYAIDgDGzECjEAk1Jl3559HIon8hzlfPVTCvGJZzfcKSxXfyMWM88//9VKSxXdtnb9vomOuuRyiWVYbf+X8zp6fKGHIdycuWMMMMMMKSnp+6wsYc/9f/7z7rPPWHN556p6fP8MMMP///PPP/7+GHK9PT6p7f/unldP2np7YeHjweiYA4GLNAgAiI7u57n5//oc5/yfk6znOcPhwOBwggHCMpA4HA4KEyHOc5znO+hPIc5//+fqJh8XQPh90JU5xQinOf//87/zvP+ggAYuhCKHxdA+Hxd0EA4KKHA4ciB3kOXfXB/gmf8p/B96lAMKAgAADU+BujARHgwdisgHMfAUHAiceBg4ASBgZBiBIBH4ZaHOJsLhf8R+HYEciIgYSwj/+Bi7EqBh+AcBn5P6Bh4TuBmrAMBiZH7gaLEWgew//PkZFMlyek60MpYAShzqqZhm6gCUWeEUWAewEWYGN4X4GDEPwGE8S4GDoOIGAYKgIQOkz//gGARAUB+CwGxTwMAACAEgyAwdAlAxKhzAxXiZ///AxcEwAwJjDAziCAAwQgdAwRgdAsJQDAmAcGzYDwAhZIAKAcIQB4GT9TQMJ9/4Gi1Fv/AcAYUqKBAwGgNAwVBAAwGhwAwdBlAxFg1AwlgzAwNBuAkJQDBgEEDEqGECgChFgBgL//CIswYYH//+HKCpk4K0C9AaKKCAOBeMcR4X9C44BwABCgGAsGYCgTwHAcAwXAiAwSAQV///CJP9lwMBQAwAAAWGo5lVLCcaeneVhJAVGai3//ioaUEf//gaTAYGCj8BnEwfrIqDcsIQb/vmhU/8fAs0G8YGGwKST8Igj4GCATipksVzY8p//90FWJwh45AkX//4fCF9wMEgkL3uQc+gbGJ8t4MBAMBP/hEXf9FRuWBcAfIFjYzQdoLCBwh7IWVlxaX/w8oMCP/+EQT5poGB1Ir90DhiV6af/jFYBpT2BgoQyyt2M0ToBdEaZyzt8nTo3xdNDCTSd//o6F06CjooxRr4jVF/0bOKD6OMUNDRxiMUVFR0FFQPhGXRjDpr4MAEA4wIQUhYOIw//PkZE4nrg08sOx4ACQ0CopD2aAAlwTTBxQeMcwd8w8gZTAgABXwGABOkzpI0wAQAExnWfP4x8ZjKunWdZ1o1Qe6lFGKCNULORQCELAAPnRUf/GIx/0FHGfo3SdZ0qP2cukXKLlRtBKFgAQwCkwJgFRYBEEATmDsLSY2QiQYCEnEra+UZo6F1aKMRr6GhoaP/+j//ov+i+hjLqBgMkYoqChoo1GqCjoY06TpRqjjLOYzRRmMuizmgdKhdF8kjTAAAPMCwGswzglgwAJfzqxmioKH/////////////+ijLOAwFmN0f/////////Q///8ZjP/9DGYyFwIDBeB3MA4AlBWidKM5spykAUAQOCakK+udGqN8VDYjTRuN//0bVX//6Kio4xQFv//nf//kKOoAEIB6SY6hcxenp85///4/DEPf/84Xvl4vF4dwtxfEJgCYQHMSgKCROp4+fn////L4tQf0unz89OecLxeL0ul09y6enzp4dIhKAQFA5hKfLu1nU7/Wr71rRKJUBQSUVt////l08GUPVWgAAYAeNKsxbQNAAhQx3/oKGMM6dZ1Yy6sajMbfKio7lNcv0sScZ47lNcw32ekVFMP9fp/f+mklI6at6u/dBMQuW6y+C5BcgwAA//PkZEomGg1HYGe0riWsCqbEwiY0BJFJMxrCcxGgQ2VK8xxCF1wsABgQBBgQBAYAFCkYCgALkK4fJ00E5ctJN1Uxy5au3XoGcM4dSN0EYZwzhW0WCh1PZwzhnFFQxtnbO2d0Kt6CdXbruggkTEX5Rs4TEQUVsdVXaCcuWXIBQUGmwmgoAGcJiM4dSioHQdBnEY+hjcbov//jcb/43G43G/jCRibfxugdBnDqULO2duvQumztncbo4xGKKNxugooxGIxQULoOgFgUMTA/jbrxiMDmETL+eLhcPThzOeeOZfL5fIcBYuXD/OHv8t//LJFxjxQYHHKDGFkZMtlmKM0RgQfbVtxFIHbQBDRuzRguEI1c9XZ/rWmrZfVU3Oc/9utNNygRQkCoHlAYstNN6DJ1IINpoINppv+WG/+g2mmnUmmmpBAoJIJhnwB5xkymn606Df/t000xhU03UXC5Ol8uFyXy+Xy/l8v5w4cLk4XAvwAYUvl/QL5fTdlKZkEEEEGumaKaX00zIOemf6CH///ywI3LKpiQ2Ef4xYWMSDyI0XwzikpL0ajVHZ3j9DGIjeuXcNfjn96/S/TUz/X/vX////5K/r+v7Jn+LlAoGZOIQIwMKBQM/yppKYURmhGZkR2b//PkZE0mHg1HEG8wyiD7mlwAyDU8nJHi5htakZmZGNiRcpkJhBmUmZYQcM1VDEEBggNDV/ASEZRYKFZIhkXKLlKmk7IVTKmZNJ5KhiqVUqpX+k7+qlVKyV/ZIqZDFDWTJlFyi5TJpKhiXKBQyZzIS5JhBoayV/AQWVpGWkcYTV5O/rIVSv8/0nkr+v6/vyR/X9f1/ZN8kf5/n99/n+f5/lTKmf9/mRP8yFUqpWSv4yJUqpX9kj/MmZNJ5K/z/P9J5P/v6yFUz/CEoywgUMqZkz/FssECIsVq0aPRrRRatFFFykQZJ2Ukl///5KjmksOaA7ALROJLDnEsLbq3GTMVrwb/0dGzmM0DlfBlHQOmrdR0MYi92TX6b/cmDHLclyUVYO/4O8sFTKFTKFf8yhUyhUyhXzKlDKlCsr/+ZUoVlSsr/+ZQqZUoZUoceMfcoZUoZUoVlfOPGcmDHKcpynKg9yXJcr3JclyXJclyYO+DXJclyfgxFZVb3KcqD/g2MxzsY72L9LubPR0dCyf5K5NNd+Tv9GXRdV0XJclyfcl/n+k8kf6SX/iVynvXf///4Mg/1OkxguYzmM5jMcLHMxwwGhgNCwXMLAcwMXTLi1MD7w7tmTdBvMmE0xQFzCwHMDAd//PkZGMpigkmAGOUvCfTgcgAuC+ITswMFzC4oMLhYMByn0xvU+p9Tr0xUxf/0xv///1PBYDhgNTFTFTGTGTGTGTGTGTGTGC4GTFMDAcLAdMVMVMULAcMBpgYDhcDGFwsYXFBikLGFwMGA4MBxgcDKfTEMUoAx2BisD+mKp5Tv1OkxkxkxkxkxkxkxkxlO0xVPJi/6nv////U7CwHTFTFTGTGTGTGU+p71PpjJipihYDpipi/6n1Ov//C4GC4GTGTGTGTFU8WBSZdLhWB//yKlotyLZFiLf8tyyRUipFSKkVGRBZQMiWC3yx//wxUGKsSvDFQGHUAL3QMsHDFIYpCYy2Bmagy6BjLgy6Bh3od58DCLAizBgRb+EQiyEQiwGBFuDAi3/////20QqSBJf/qcumv/////wMZdGXAYMu1gYy6MuBEZdBgy4BjLgy6BjLgy6BjLgy6BjLQy6DBlz2cJDLgRGXAMZdGXAYMuhMZcCIy6sJGaoGMuppwNRl3WBjLgy63wiEWAwIt/+EQi0IhFsDCLAi0GBFkGBFgMJCqaqYAgAYIhBBvwf7kwcqRq7V3IctacvlN6NxqgooxRRuNRiijEZjMGRuMvz9FGozQ+1X2qe1T1S//+VhaWAtKwtML//PkZEIkbgcaAHc1xCJrjeAAtfuUAtLAWf///mWePH95ZFgsyssvM88+jzO6K+z7OM48sH+WDiweZx5YOK+zxWLGJWsa6xadAv02fTZLSpsFpvLSga0tMgWgUgWmwgUmyWl8tMgWWmLSoFJsoFlpSwsmyBg4HhEdgwHAYPBwGDgeBg8HwMHg4DB4PBgOAwcOwMHLwDn5lAwcDgiDgYDwMHA/4MB3//+EQeDAdwiDwYLPhEWQYLODBYERZBgt8Ii34GLBaB5pfAZ0FvEAQ/UfwxULlx+IXx+8f5CELH8fxKhAIDFoHBEDRc3////gwHgaRXgMHYMB2EU/gwZ/gYbw3gY3QbgYNgbgYiAbgwN3/+EQbBEG4MBuDAbAwG4RBtAwbg2////+B9B6F//////////hEdD//////////8DRahEQGCInMNg3LBElgNjDciCwG/lgNiwGxWG///mG4bf/+WA3Kw3KyIMNw2Kw3MNg3MNg3MNiIMiQ2OK0xMiA3KyJLAEZgRARmBEDEYFwBBgEgEeomowol5YAJKwCDAIAJ8sAE+gGBgCJYAQUZ/13LubMu5dyiYOAhKwEFGf9AOoz/g4CFAIol/lgAjysAgsAElYBP////lgJksBM//lgRUxF//PkZGApggsIAHt2wiNLoggAqCz8RFSwIqYioipkjEjHCCSN/+WJg5iYOYmPK5krmTmZk5mZ8sTJYmf8yJiNiIisi/ywRmRkZkZGZGRmRERkREZERGRERkREZERGxEf///hETIMEyBiZEyBiZEzwiJgDEwU4DV2gQGFOBgmP8GAiAwRAiBgIgYCIGAi/4MBHAwRgjAwRgjwMEQIgMcgY8DBGCMDBGCMDEyJn///+BiYQIBlObj4eYLIwsjAOBGFkYBoEQ84eULIw88LIA88PKHnw8sPKFkeHlANAiAaFUDAiMYPIHmDzBZBhZB///8GBOA1sH/Awni7AwnhPCITwYE/CKzBgt8Ig8GA4Ig6EQdww4Yb+F1sIgtwYCwGAsAwWAsBgLAYCwDBYCwDBaHUDF+VEDKgC2BgtBaDAWgYLQW////gYLAWQMFgLAMFoLcGAt////4RMABmBSj4NgwMOGHBsHhdcLrwbB4XXC6+F14YcLrww4Ng8MOGHBsHww4Ng8AUC4AoMQMC4fgw3wutV4QIsAgFYIBWCCVgHeVgHeWABCwAIVgH+YBwB5aRAstKgV6Ba1oMg9avtUVN/qdLWciD/cqD3Jg6DFPuTB/////lYAn//mC8C+YLwL5gvgvGC//PkZFEpLgMKYXt2xB5LogAArbdc+C8VgvlYL/mC8C+YLwL5YBfMNgNkwXixDWoHPMc4VUxVA2TBeDZPYXzXl815fK14sLxYXvK1//NeXzXl815fMtdDLSw3UsMtLCstMtLDLSwsFhWWlgt//8sFhW6f/////+WF7zXl8sL5ry+Vrxry+WF/wMLwX4MC+EQv/AwvBfAxsjYAyqpKA0lpLAwvBfBgXv///4RA2DANAYGgNgYGgNgYGwN+EQvf/BgXwYF//8DC+F4Dd6NgGBf4AgFwbB0MMF1wuuDYMBsGwusDYOBsHA2Dvg2DQuuDYOhdcMMF14YYDGYDEGwfhhgbB0MN///4RBaEQWgZByoYRWYMFvwiDsGwaF1gbB34GDwdC64XW/w1aKxDVgatir4YcLrQbBwNg7////////////+ESfgZPyff/////////4MFmBvvMAERZ8CC5adNj02E2S0qbCBSBZaYtN///oFlpU2QMXIFAYuQK9AtAo7IxLTpsIFJs/5aZRxQawaxGfIg9CsrI+PUqkWdOHp7ODsOl6cOHZ4dsulfLI9/8BAAgMBACsBLACVgBjoAWAE5OTM6WDAR0zodMdHCsJLASWAjzCQgsBJhASWAjysI8wkJMICU//PkZFkeqgcaYDd1th6DogAAqCuIxQwtDA5MdMULgyY6YqnXqdep5TpMdMVRNRL/UT9AN6jCiSjKAZRNRhAMomgFQDfCIJwYCQiCAiCMGAkGAgDBJUA3eVAMEgj////8SrDFIYqh5g8kPMHkDzB5OFkYeYPJ+HlDzB5+AYVQDibCyIPLLEZIsjIliWS0WywWyyWuWCyWJaLZbLJYDHgLAItFvy3///4eYPKBlQTh5QYEODBb//hhoNg7/C62DYPFUKwKsVgNWBq8VkVcVkVUVYrH//hGff/8Iz8GT7//////wiX4ML3gwvgwvf4ML3gZeqoHVGyBl4vgZfL2F1oNg4Lrg2DcLrg2DQw0Lrhh8Lr4YcMNBsGhdcGBcMOGGAFGAGMQsF1guuGG4XXV/4uQXOLmF1kL/8lCXkuSk4O8/FzHzuP0hIucf/CIFAMCgFPgYFAKAwCgGBQCgGHYO4GBVM4GgQI4RCMEQKQOtQjUI1CNcI14MqDKwDIAGQDzh5wsjDyw8uHmDzYeUPN+DEYRRhFEIowYgDQgIhWDApgwKAwKQYFAYFQMKkYDOxHAzsRgMKBUGBX/h5v+Hm4ecPNh5A8wBwjhZHhZAHlDzBZAFkAeQPKHnCyILIAsih5QsgDz//PkZLQgIgsMAFp1xCGLogAAA2rkB5w8oeYLIQ8kPMHkCyGHnAMKoGmAgFkUPMHmDYAtfHPHNkr/JYl8c8lCWHPHMkqSo5onMAkBDnfJX//8IgDBgBhEdAaxSQMHUGAEIgAV4risCcipBOMVRVBO////hEvAxsAwvf////8MPDDww4XWC64XXDDww4YcMPC6wYb/wYGgiGwMplMDYhTCIaCIaBga/////8GA+EQdgYPB4MB4GDwdhEH8Ig8Ig8GA6EQcEQf8DBxlBjoAweDuFwgCQXiL//iLiKCKCL4XCiKRFwEgoRT4iqpMQU1FMy4xMDCqqqqqqqr////xuDd8fv/DVwrArEIg6EQdhEHAYPBwMB+ERYBi0WAwWAZ0FoGLYOB+JfgZ0FoGdBaDBYbn+WHm9xW7/Nzzc83PLDzc8reWlA7S0oHamx//6BflpU2C0qbBaf/8yk/ysn+VkMhTKQrKVk8yE8rIVkKyYsAn/5WC+YICmCApWCGTkxtKMcVWlgFMEBTBAX////0C0C0C/////////LTFpvTZLTlpv/0Ci0xaYtOgWmymyWkAxcWmTZTYTY8tMmygUWmLTIFpsFpv9NnywLmLCx2RgWmQKTZ98UjnzZ1/++D4M6/////3//PkZOgjIg8IAFcbxCaTogAAoCuIzfJ8vfJ8Wcs5fBnD5//++L5f////////6nCKv//+o0o0FUYwqDNGCwgUMKC0VVGkVv//4Yf8LrxVCriqDVoasDVuKsNWw1bisBqwVkVkVX//gy/4YYMMGGhhgwwNg4LrhdcLrAYWGAA0zBsH4Ng3C6/////4MAoGBQIDAKBgUCAwCgYEAsDAoEAwKBAYBYMAoGBQIBgUCYGBQIBgUCwiBAYBYMAoRAgRAoGBBMBooCAYFAkIgTEUxFv/EWxFxFhFoi0LhQuFiLCL/EWqTEFNRTMuMTAwqqqq//////8TWJriV/hERAwRgYiEYGIhGBmIRgYiEYMEQMEcDMSiA1GYwMR+UDMTkA7KIgMRGIGGM0SIrRGjRlhEV4jxov8rR/5YRFhEdQSViCsR5iRJWIKxPlgQYgSViSsR5WJMQJLC78IiKERF4REeERGEREERHwMRGOBmIRhERhERAwRAYiEQGIhGBmIRAajkgG5TEEREDBHwYIwYI4REXCIV/4MCmDArgwKAYUO/gYVCkGBUGBTgYUCsGBUIhUDCoUCIVBgVBgVBgUhEKQMKhUDCoUBgVAwoFAYFcGBQDI6oA5+qQiFAMjBUGBXCyEPIFkOH//PkZPMj6gr6AFdVwifkBdwAoC2Ilh5/8PPh5Qsih5IeUA0TAZrE8PP////wMRiIIqID8piAxEIwMxCMDEQjCIj//BiIDRo8Iogii/4MKwYVhEoESkDEiIGJEgYlfBgmDBIMEAYgSBiBIREAwSERH/8I7wPfuCO4I7v/8GBvAw3Bv/////gwN34RBuBg2BuBg2BuBg2BuEQbhEG+EQbAwG4MBtwiDaDAbhEGwMBuDAbAwG4GDYG8DBsDcDBuNwDRWDcIg2AwbA34RBv///CINvCINgMRIN/////wiG4DDeG+TEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq/zB4OLAP8rBxWDisHlYOKxb5WLTFgsMWiw18LDOnjPxZoxadDOgsLAtLAbKymVhsrDZWG/LAb8w2GywGysNlgNFgNGFwuBQuWnTZLToFFpisLJsFp0Cy0voFAQLFZkMCAQwIBCsC/5WBCwBCwBCwBCsCeVgUwIBCwBDEwEMCAQrAhgUClgCFgTlgCGJgJ5gQTGJwKWAKYFApgQTGBQL5kY0HMjQYnAhWJvKwIWAIVgQrApYAhWBPBgECIEBgE/8IgXhECQiBAMCkcDEwEwMCAQGAQIhoIhsGBsIhvgwN//PkZN4irgr2AAOVqiUThegAnCtMgwNwiG/8IhuDA1hENhENgYbKYHb2IBhoNhENAwN////8IhsDKZS////8IhuBhspgc0KQRDWEQ3///CNf4GAIMDAwgAwAAwhAwAwYAIgwiHBgAMAYGAAGHv///CIBqBqESDEIgRYGoGHBiDEIgGoGgMAYgxgwgxCIETwYFYMCoMCuDApBgU8DCoU//gY3G//wYFOBhUKBEKQYFfBgV8IhSEQoBkYK8IhT/wMKhXBgUCIU4RCoRCvgYVCsDCp3A1SqAYFAiFP////gY3G1TEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVgwCAwCBEC///////8IgUIgWEQIBgUCAwTQMCAQDAoEhECAYFIwGaRMBotWAasdwH/KqBmhFgaKI4GRgKVpjCBTCBPMJHNMFMIFKwnlgJ5hUxhUwGWlpAMuMuWLTFpvQKQLQKLTIFJsoFIFFZb/8woQwoT///MIF8rC+WAphAphAppgpYClgsmwBC6bHoFFpUCi0wGXFguWCwFLgUsgX6BZaVNj0Ci03//+EQKEQKEQLCIFAxMBcDAgFAwIBQYBODAKBgUCAYEAuDAKBgUCAYFAgRAngwCgwCwiBIRAmE//PkZN4iogj2AFdVxiUrhewAhOkwQIBgQ0gbOI4GRhOBiYCgYEAv////CIFAyMBQYBf///CIF8IgUDAgFBgEAwIRwMCCcDEwFAwIBf///CIEQGMDGEXCKBpCIDCEQDCAsYInDFQMMAuYSoTQMVfBlf//+DKfBgAiGDAQMIMIgCIQYADAEGAgwP////8ItgNu2/8DAAAiABgHhECBgQGEQARA8GAeEQIMABECEQIMAwYBBgCDAARA4GAAgYACDAARAwiAgwDhED4RABEBCIGBgDoH2dgZwCBgAP//BhX/+DCiTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqF1ww////////hdeGGDDBhwjeF102E2fTYAowMLjE0zTDfyyMYjEDJTwMLSwFi0/gQLoFIFpsegWmyBQsWlQL9ApNgtIWn8tMgX6BaBX+WmQL9Nn02f9NktIgUgWmwWl9Avy06bCBSbJaUtImyWkQKLTIFgYWoFFpAKFwMLzZgwAwvLTIFlpU2fQLQK///4Yf4YaF1sLrg2DAuuDYNDDQw4NgwLrhh4XXC64Ng3C60MNwbB4XWC64YcMODYPCJYDlMQBlwRLg2DOF1v/////PkZM0eKgz0AE+UuCnLFfAAk3Fsg2DAYX/ww//4YaGGDDhdbDDACFwMuXA2DADlygusDYOBsGhhv//wNU/CKQusF1oXX+F1wuuGGC6wXWDDBdbC6wXXhHv//4AHIFgC0BZAA4Ba4FkADwFsC3AtQAOcC0BYAtgAcAA9+BYAsgW4FvgWOABwC1oq+it4RT0VVG0VFGkVywo1/RWU4U59TlFb1GvRX////QK9Nj/9AtNn02fTY9NhNlAr/QK//TYTZLSJsIFemx///oF/5aZNj02U2C0yBaBfoFAS6bKBfoFVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQiA8GAO/4RAf//////wYA4GAO+EQHAwB4GDoB4GA4HQRB0BhlDIBpEAcBgPDIBgPAeDAHIFAYuLTpspsJsFpi0haRApAtAstIYKClgF/ysF/ysE/ysF//LAJ6plTlYC1ZUypmqtWVK1VqyplSFgBaqqcwAAVIqcrEBAAKmMBERCQhwD5iICIQEyABMAABBVGXF4gIA4DLAAWAEQgLVSsBaq1ZUv+YKClgELAJ////5YBP//LAL5WC+Vgn+WAX/LT+gW//PkZMIhLgrsAFt1yiD7FiB6A9qwmwViybCbCbCBSBabCBSBabPpsegWmwWn9ApApApNgCGBmEwWlLSpsf////hEHgYOB3////4GDkiBxMHhEdgYOB4GDwcBg4HW23gooFYHd/+BnAz8O8Vv//FaBm4rBWh38es2zbAtD1m2PVBqBrBqBrAF7AF3/5el84MkuHTgyy+dL0dRnEajMIyOn8RsZ5HGG/kbIpHIkYUiD0y2WctlZaWSwrKx6FZbxnL54ul04eLhw9Ol84dl86cOHT3Ipb5Z8qKpVx6/j0EkLctVTEFNRTMuMTAwgWQLQAHgLf/////4Fn+EQESEcIgInCIRW9TkrCzH0YIjjWtI+YeCD0woLCBQwsKRWUaRVCBZFZRtRtFRTlTlThRtAr0C0C//02E2fTZQK/0Ck2f9TlFRTlTlFT/9TlFVFRFb/9ThThynIQbWkAREue5S11rKdlkDEVABh61ExYPU+tOD4MQgcn4iwigivxFRFoXDcRQLhoiwioXCeAkFBcNiL8RURQBIKEVEWiLBcKIqIpEXC4QReIoIpCIKAQMxFAFAsIuIr/4YYLr//ww4XWBgwC64XX/hhgw3hhwuv8MNhhguvhdcAUYgaYTAAoWDDg2DQbBg//PkZPYe6gzuADd1uDKsBhBAe89cYYdGjtDT2hDmlD2leaOv9oX0OX/0NNLplNf8ewakNWGrTfTRpphNJtfaeh7T1/tStdtTpqN532lpX/1/kmQ5eaf2hoaV9paGleJAvd0rer2pWu1ar2vk56vVrV5Hj1Nop+/lfv5Zpkem5kX/2vtata2rq783nbvtbW6VjW6a2rq13+rO6VysV58K7tbp0ru6Vrtqa1a67tr6sau1ulYrnfa2v927Vrt21NSuN5X927/D4diAQANh4gEIfxB+IQG/D/4gDw/iGIRD+HRATEFNRTMuMTAwqqqqqqqqqqqqqqqqqiIEK/ititFX///8VcVuK38VsVhXBOQTpq/qm8QCAcBmIxgdfFZCHECpxFBFAuFEUC4cLhsRTEVEUDVoDQD+KrFYirFX+KwKoVgVUVUVeKwGrhWRWBViqFYDV4rMViKyGroauBg/A0YThVgNAEVQqw1fisis4quKxxWYrAatxWIqoqg1dFYxVxWIrAavAaAArIrAqoqhWYrIqvxWMVYrARCADhcKoVYavDVgqhV4qorIrHFWKuKxFViscVUVYasAaAfFY/4YcMNhdfwuuGGC64YfDDA2DwusANygbBwAxhAECwNg8MOF1hD4//PkZOkc4g7yBjd1sDNkDhgqYwtcYoUyiQ0NCkxQ0NCQkSIbGKIyRGEo5mUaNEhGKEHMmaGhI0UokORvMmZmZSZSiMZQkRnKKZkzRoSNCQpQ0NEZoaNFJkhh3KOUJEhIcoSJCQkIzlDlEjMDMyMpQ0JCQzNCRGaNCRISEZoZihoaIwlEHKNGiMzFEjRmSIwlHMyZmcyiGyMxRyhIkIxRSZokSEYGBkiRojAPESNGjQxvKHMmMoSKTJCQkIwlFKLDYWGhoZhYWAAUGBsAwsMDYUAcK4XDPhQVwwLAH/DfgHC6TEFNRaqqBgjwYI//wYI/8GCL///+DBFhERgwRcIiPAzGYgMRKIDcskBgjAxEIwYI4GiRwNEjhFH4MRwYjA0aOEUf8Io/BiLgxGEUYRRQij/BiKDEYMR+DBGBiMRQiIgYIwiIwYIgiIgMRGIDUSjhEReEREBiIRAwR/wYI/8IiP4MEcGCIIiOERH8GCIIiMIiIIiODBHBgjBgjwiIoREcIiOEREDBFCKiAxHJcIiMGCMGCLwYI8IiPhERgwRAwRAYjEUIiIGCP/AxGIgiIsGCL//4REYMEXhERBERhExhExAzyAZiEWDBGERGeKsVsVRVFcVwTnFcVxVgnYqipFUV//PkZPkcfgzeAFaVxDgUBgAgatvIYrgnYqgnQJyK4riqK4rwTsVor4rQAjABAgnQritFSKoqQTsE5C1haxfF7F4XQtULSFqC1i4LwWkXIWkXRdF+LwqAnME4iqCdwToVuK+HAERWAkAlgJB0OB3Doc8OYc8VCsVgIB3DuHAERUAkAkHMOBwOAIisO4dwEAEAEg6AkAl4CeHA4AkKhXioBIOiv8OB3F+LgWkXxeF8XouxcF0XBeF8XBdF8XhdAdouC8AEsXYWsXOKsVBU/FaKmK/FTxXFbFUVPiv/8VfxXitVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVAXX/8MN/wwwYf//DDBh4Yf/+DYODDfCIFAwKBQiaANFgUDAgFAwIBcADwFuBY/At8C1wLfgAdAtwLGBawLcC3AsgWeBYwLX4XW8LrBhgiFgMlhYLrhh4XWhdb8MOGGhdcMP4YaF1gw8LrwuvhhoYYLrYXWDDBdcGwfC60MN/ww8GwZ4XXC64GZQsF1wbBnDD4XXg2DcLrBdaDYPhhgusF1uGGC64YfhhoNg0LrQwwYcMNC62F1/g2DYXW4XXC6+GH8DTIW4YeB/wR/wjwR+DP/y06bJaRAtAtAtAs//PkZNwY2grqBFW1xDhTRegABLBstL6BRaVAstN5aYtN/psIFf5aQtIgWgUWk8tImyWkQL9Avy0qbKbKbJaf02f/0CkCy05adAsC3K7+mx5aVAv0C/TZ8tOmymwB2pspsFpPLSlpy0qbCBSBXlpk2E2E2C0paUtP6Bfpslp0CkCy0ibJaZAosWQLLTJsemwgUmz6BZaYtOgUWmLTpsJsoFJslpPLT+mwmz//6Bfpsf6BSBSbCBXoFeWk9NhNhAr0Cy0/+WnTZ8tJ/oFf6bP+myWn//8tMmz/lpf//////8sPTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVBgJwiCYMBP//gwE//////wiCAMEgkIggIqIDKpUCIIgwE8IzA4j+EYhGAZMIyDJA5gGRhGcIyDIhEQiIGAgwIRDwiAGAAwYMHBghGAZMGRCMhGYRgGRA5gIyDIwZPBk/wZIRmEY/gyOBxIMgIzCMgcTgwRBgjwYJBgngwTwYJhEQBiBGERMIrwOouAxAgGCQYIhERhEQDBGDBAREgwTCIgGCQYJgwSDBHwiI4MEAwSBiRHCIkGCYGJEQiI/Bgn4REYREeBiBIH6XhERhETwogoy04mpZibFmJuWYmx8n//PkZN4ZrgrkAFZUyDcjofgAA9qc0HafZ8HwNrjaG3xtjaDtJwTo+D55Ow7fxNRNSyLPlqJsAr/lmA/FmWYm5acTQVgTkVQTnBOQTgVxVBOBVFWK4J3FUE7gBABOwToVQTsVhUFcVRXBOhUBORWiuKkVYrCqK+KoqgnQrAnEV+K8E7FQE5xWBOQToVQTsVRW8V4qRUFYVgTsVhXioKgrCqKwqAnYqCtBOhUioK+CcisK8VRUFSKnirFQVBVFcE6FcVoJwKoqCrFXFUE7gnAqiuCcQTsE7xU8VP8VYrgnYrCuTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqn3/l/J/8vHL5f/BhwCETgGpIDOATgEIOFoDcHzgEIDgC+pG7eve1S/6tat7rXupDXSStWoIpGS4TSMQNIySMwpIyAaRkkZ8GJGdBtbwYkZ63tCKRkoIpGWDEjLCKRmEkjOvsEUjJOsIpGa6bOrgxIzsEkjIGJGYUkZVKCKRmqoDkgEjMJJGSYMSMAikZJ3qhp0dq9ru3X1I36FujPbXuxwKbr//waABfg0AC6DUDUDXBqBoAmQawJiGrhqDUGoN//PkZL8USgKcAAblrroTgfQAbhtQAag1QawaYNIAuQa12Lv9si7F2NnXa2Vsi7i/DZl2tlL9l+vL8tlUTUTUTUYQDIBlGUAyifqJKJqJ+p5Mf/U7TETEU7CxkxVO1PKdqeU8u4vq2ddnrsbM2Zs/tl9s67V2NlbIu5sgaA1Q14ExAmAaA0BrDVDXhpgTPDQGuBMA0gTKGgCYgTHDQGrDUGgNcNQaw1hoAmcNIaRIAtALVEgC1gteI8FpBaBIAtcRwkAWgFpBaILVBaIkAWgRwjhIiPEeDXwa/4NUGr+DRwaKBgX/8IhP//wiF8GBMGBP/wYEhEKEQmEQuDAoGFTAwLgwLhG/4MvCM8GSDJCNwZQOXg2DwbB8MPDDhhuGGBsHhh8Lrf4MCQYFCIUGJgiE8GBQMIFhELDDhdaGHhdYGwaGGDDhhuDYMBsHg2D8MMGHBsH8GwYDYMhEKEQgMCeDAsIhAiFBgQIhAYFhEKDAkGBMIhYGEC4GFCBELgYUKDAuEQsGBQMKEwiEBgUGBcIhQYFwYFAwgWDAoRC8GBAYE4RCgwKEQvhEJgYUIBhQkIhAiECIUGBIMC4RCgwJCIUGBAiFgaYLwiEA5cGXCNhGBGwZAw4Ng0MPBkqNqcoqorlh//PkZP8cygrkAFI0wjo7lfAAjhq4SnPor//psoFemygWmwWm/0C0Ci05adApNn/TZQLU5RU9FRFVFdTn1OFG1Gywv/UbUa9Ff0VoFgCwBbAtQLUCzAtgAchHAN8ImAbgBvwDd4RwjQDeAN8I0ImEQEQAbwRgiQjBHhHAN0A3vgG6Ab/CIhEgG5AN6EQESAbmEYI4RABvYRoRABuYRgDehEQiAiIRABvcA3QiQDfwjwDfCICPCJCJCJ4RwiYRwjBEwDehEYRgDfCNCOEQEQEcI+BagAd4FrAscCxAswLfwLAFgC1wLNVMQU1FMy4xMDBVVVVVVVVVBlBkwO3wZAZMIz//////+DJwO0IwI0DsA7cGUI34Rn4RgMuEZgywZQjAZP/hGAcmDKEYDIB28GQGQGXhGgcgRoMgRoHYBywZAZYMmBygyQYFCIUDChQYE4MCgaYJ/gwKEQsGBAiEBgXAwgQLrhdcGwcGHBsGA2Dgw4YYGwZC6/hdYMMF14YcLrYYcMPDDhdYGweF1oYb4MCwYEwYEgwJBgTCIQGBIRC/BgQDCBcIhAMKFhEKDAsGBQYFAwgTgwKDAoMCQiEgwIBhAnCIUGBQiFwiEBicIhAiFhEIgIoBooGieDPA+4GeDPCP//PkZOobXgrkAEY0jjazieQgBKKIBGgyBGhGhGgyAdoMmEaDIB2gyhGwZYMsI0GSDIEaDKB2QOWEaDKB2hGgygcoHYBygdkDtgygcngyAyhG4MgMgRgRmDJCNBkA7QjAZIRoRoMuByhGgyAyAyhGwZYHKByAcgMgRoHIEbCNCNA7fCNA7AZAO0GSEYEaDLA7cDthGgyAyAyQjAOwGUIyDKEYEaEYEYEaEbA5AZQZAZAZIMgRkGXBlBkCMgyAyQZYMngcmEb8GUGQIyDIBywZAZOEZhGBGwO2EbwjcI3hGYMqTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqquDqz8GMDQIvBj///+DGDEGAMAifBj8IuEThFCIEQGPCLwiQYBFCKESDCETBhhGAZGEZ4MjgcSEY4GoRQigxCIEQGPCKBiBrgxwiBEwMIRAY4MQNMIkImDEGIRYMIRYRAYhFBjwYwNQYgwBgBh4GAMQiwYgxA0gahFBgBjgYBFhFhFCKEWBgEWEUGEIgMQYQMYRAMQigxhFBh4GkIgRIRYRAY4RIMQYgYhFA18IoMQYQihFhEgwhFCIDEGIRQieBiEUIoRQYhEwYDAFwGrBog0waAaQawacGsGiDQp9MZMVT3piJjJjK//PkZOYZBgjoaUJQ0DprofQgbhq0dep71PqeU69TpMdMVT6n1OlPKdJjpiKdFZkxlPKdJiJj+mKp/0xFPBoAmYaw0BpwJhDSBMQ1BqAmIEzDSGgNXDRDRhp+GsNMNAEyAmYagJkBMA1BpDXAmECZhoDXhqAmYawJjgTICZBrDSGsNAExDVDQGqGgNHDWBMIaQ0BrAmcCYgTHAmIEzDWGgNYaOBMw0BqDSBMYaA04aA1hqwJhw0ATKGqBM8NYEz4aQJkGoNMNIag1+GsCY+BMQJlDVw0cCYfDXw1ho4aQ0gTCTEFNRTMuMTAwqqoD37wjuhHf/////hGf////hHf/gycEZwRn4MnYMncIzsGTwOdOA507A507hGeEZ8GTuDJ4Rn4HPn4Mn4RnhGcDJwM3YM3gzdBm6DNwR3QjvA927Bm//Bm7Bm/Bm8GbgZvBm4GboR3gzeEd+DN8GbvBm6EZ+Bzp4Mn4HOnBGfA588IzsDnTgZPCM8Iz+EZ/CM4DnTgOdPBk8Iz4RJwGTidBi7AycTgiT4RJ8GE6ESdhEngZPJwGTieDCcESfwYToMJ3AycTwiTsDJ5OhEnwibwYb+ETdwibwibvCJuwYb/4RN/Btf/jYGyNv8bHLUtSzE0/LQBW//PkZPQcHgjQAFKVrjfDmgAge1eMLITcshNy1LX8si0LUTQtCyLQTUteWQmvLItSz4mgmnTJops0umEymDSPsnR9HwfB8k7Pvn0fAvwtcLXF/F+L4vQtQWuFoC0BaReF7AeBfwtcXBdF4XheFwXAtAui9C1haRdi6LwvirgnUE6FcVBVisKgrCvioK+KoqiqAhh3AQFXhwVYrFYCWHMOioVAI4dFWHPDgCAdDgdDmHcBIBEO+HRWAiKsBMO4dFQCAdATw6HBWHBWAgHBUHMOf/gICsOCoV4qw7+KxWHA6KhVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVC11Fz1+NP+/Xkqpr9OfuhQ6lZNWf+XsZc/si+KNoOj/Ntai9j7IISgZAklTqQhjToNTeQoreRdaSDODWvYAVFaWWkQmVuZPP8bRUzq896vc+XS6mm5gnnW7JLnV4z9N5XnW4k86x+uyHyxnWkmdborzraff2SvOtvljOtjd/5XRW8MivOsry/K3gUzrFPS1eFTOttTsul1+lLGdbV3c53h51mdbK7xPOr1SpnWlM63kedZnV4XPK86onnW7myrnWTmRTOqascoabXd/L+yuzS95dv1efjhl92ntYyTuIb6wuWRZFmWRa//PkZOcb/gqMACDf1LTLofggA9qc/gKRZiblqWYm3E24moSQnR9BJj6JwfBaFqWZZFoWvLUshNPxNuWn6bTZHgozRTSaNAY5oGjFQVgTkE6FUVorioK8VBXBO8VRUioAhxVioK4qAnIrYrCqKsVRVBORXBORVFcVcVwTgVBUBORUisK4rCoKwrxXFYE4FYVATjFcVhX4rcVBVFQV4rxVFSKwqCpFcV+K8VhXFYV4qivFUE4FaCdivBORUBOfBOgToE6FUVYqisKgqCtxWFbFQVxXisKgqRU4qioKuKwqCvxVBkH/4Mgf4Rg4RgfgxZBizhFYEVuDFvhFbBi3CKyEVsGLf/4MgAxaDFoGsWYMWgaxYBrFngxaDFnCKwIrAYswNas+DFgRWYGtWYMWBFZgxbgaxbgxZCKwGLIRWgxZCK2EVmDFmDFgMW4GtW8IrAYtBi3Bi0GLAYsCK0IrQit4MWeEVgRW+DFsI9cDW9AYtgxZhFaBrVgMWgxaDFvCKwIrIGtWhFaBrFuEVvBi3hFZA1i0IrYMWYMWAxaEVkGLAisCKzBizCK0DWrIRg+EYIRgQjABkHwODABkDhGDwODBgyAEYIRoRvww4YcKILYKILfhRg5htjY4OQbQ2hNAH8su//PkZP8cRgjWAFAUYjwDofQAi9pcJry1E1LUsuWvE2E0LQTcB+E2LMTctQFEEcWnFYVwTkAI4rRWFYE6BOhWwToBBAQgnIrisETANwIiAb/COEQEbgG+EcA38A3wjhGCMEeEaEeKoJwK4J2KoARBVBOIJ1FWKoJ0CcCuCdRWFcV4rioK4rAnYJ2K0V8VYr8E4xWFUVBVFQE6FXBORWFSKorxVFcVwToE5wTvBOoqwToVIJziuKwJxAQgnUVBUgnAqQCaCdxWirFaKwrRWFcE7FfFeK4rgnIrAnYrCoKoqgnAqCrip4qgnCr/////8Iu8BjvP4Ry5/8Izggc4Zw4RnD/hGcP8GThBk4eDJwgycIMnDwjOD4MnBA3eu9hF3kGO8gx3vBjvAN3jvMGO8CLvAY72DHeAbvXe+DHehF3kGO8gbvHeBF3oG713gG713vgx3oMd5BjvAi7wGO9A3eu8BjvMDd470Iu9wN3jvQY7wGO9wN3jvIRd4Bu9d6Bu9d6DHeAbvHewi7yEXecGO9BjvQN3rvIG7zykGO9A3eO9CLvYMd6EXegx3gG7x3kDd470Dd472DHewY7yDHeAKomwmhZFkAof8tCy4m5aCbcTUswFYsy0/LQTX9NBqBgJgYaY//PkZPcaTdCuAFgWlkI0DfQAe9r8Jxz6CShr8++JsArgjxNBNC0LQsyyLMsgRxallyyLIsi0LUTUtS0AVwFPia8si0LMTXiacsxNizLMTYTcsi1LMsy0E2LUsuJqJvxNyy/E1LMteWgm4mpZlkJuWRZFmWnLQTfgncVATkVcVQTsVIqQToVxWFeK4rwTmATCsCcAnQJyKoriqKwrxWiqKoqwToVRWBORWBOBVFSKgq4qAnAqAnArRVgnIJ3FYVQAgCriqK4qYqivBOsVoJwKgJ3FYVBWFfBOIqCoCcivipxUFSCd4qRV4rCvFaCc/BOhW8VxWFUVhX4r1eX/+DHgaYMOEX/CJgwwYQY8GODH/wYf4RAiQiAxCKBj4GAMYRQiwYcGEGMIoMfhECIBgEXAwCJhEA1BjhF+BhCIDEGARYGoRAYgxCLwYeESEUGMDEIoGAMAiAwBiBrCJ8GMGGEWEUGIRYMAYAxCKBiBgBqDDA1wiBEBiDAIsGIMANANMIoMAYhEBh4GMGMGARfAxBj8GAMANYRAYBFAwCIBhgYhEwNQMYGIRAMAiwNYRQi4RQYwYgahEBiBqBgESEUIqa6Z6bTBpGkmUwmkwaZpJlNCkifmkaaaBymgm0wmRPxSDTTa//PkZOYYTgboZUAQIkCEFgAAe898YTZpJtMJhNilphNdMJhMGgmemDSNJNmkaX6aNJN9MJhMc0E2mzSNJMpg0umU2mDS5oJlNJtNJnpg0DSTBoml0wmzTE8TRpGgm00mkzzRNNMJg0jQTSb/NFNdNGl02KTzRTfTPTSbTKZNLphNJpNmgmUymkwaaaTKZ/TSYTBoJr/ifptMpr9MJlNptMpg0kymumEwmf+mEwmOmkymTT5ppv80eaHTCYTHTSaNBNJtN80/0yaBoJo0k2aPTPNA0OaSaTJoplMJv9MgBAB4MBUGwbwVwUBkFAYDAU4NBoMBqhAELk//h/y1/vz6/6zMnEglwqnIsVSHBzAMMIqXiLgxS8ucoLCKl7VwipeupwYpeAxS8Z22hSl4U+qE1L2goKUva1GUJqXqwkpeAxS81IQpS8smBqXql6E1LyEVLxdEJqXoSUvAmpeJhFS8rpH3CKl6EVLxPWFKXgDUvVL1LCal4kuDFL2EVLxFlPClLyEVL2FKXhdwYpeswGpeqXkGKXqLAxS8wYpeqWk8KUvATUvQYpehJS9Bil6yoUpegipeZT2x1vN5NR2X3KrRuXjFmaS0AUCyE1BHflmWZacTYsvy05ZgAIs+WQCqJoWZ//PkZOwZ+gaYBgbm6EQMAfQAe9r8ZCbiaFkWv5ZibialoArlryyDtCSnyfR8hrE7PpNmiaIxDTGKafTJalqJoJoWQm4mnLUtSzE1LUsxNyy4mpZlqJpy14mgD8WpagKvLIEcJuWnLItBNhNhNxNgH8tSyLMTflmA/iaCaFqJqWf4mxZFmCdCvFWKwqivgnQJzFfwToAIwqgnOKgqCoK4J2KwqisKwJwKwqCqKgJwK4rYqirgnIJ2K8VhVwTmKorYrioK4JwKwrRWFQE5FUE6BOwTgV4qYqiuCdAnYqAnMVBVFUVATkVBVirioKoqCviuK8VwTjxWFfivFUVxXBOcVuKvFaKoqiuCdeEW3Bjb/gxvhFvCLYGN8GNwi3CLf8DbtuEW//CM7+DG+EW+DG8DbNgi3CLfA2zYItwY3gbZuDG8GT/Bk+DJ+DJ/hGdCM+EZwMnQZP8GT8GToRngc6dBk4IzwZOBk8GTvhGdBk+DG8Dbt8DbtgY2CLbBjYGNwi2A2zYDbN4RbhFtA2zcDbNwNu3CLaEW4RbeEW2DG8DbNwY3BjYDbNgY3A2zYItwi3CLbgbdvA27YGN/CLaDG4RbgxsDG4Rb8ItsI7oR3cGb00m0wmTT6aTZoJgUpMc0kwaa//PkZNcYqeLUAAAUHjw8DgQAe88cYTXTXNBpXiQdfLVpLJoaCSJs0TQNAbRpJpDWleaGlDmlfQ9fQ7tBZoa0IeOw3Ccq44TcHgrufDVzQNA0Om0wmDTNE0EymkymumU2mU0aSY6ZE8NFMmiaaYNDptMGn+aJpdNptNps0OmU0J50wNtMGmmEz/zQTJpppNplMJlM9M8FAYCoKAAApgqDIMACwAQbBsAMGQAQaCkGg0GgyCkGeCgNABwAAUgrwA+CoAQNAeHCAOAeAyIQHBwgDg4QYDAGgMEEOEAeA0Q4DxAHh0PEMGYMBsFQYDPgoDMGQV4NBqryAZfhGfwjMDl4Rv/wjcGT/4R/CPBH//hH4H3gzv4M7A+/gzoR4GdBnAf+DPBnwj4M7BnwivA1QIpCKcIpgaqDFgaqBogMWBqgGqgxQinA0XBi8IqEUCKBFcD7/CPwj0I+DPA/8GfBnQZ8I+EeCPwZ4R6EfhGcI0GSDIDJCNCMBkgdsIwGQDkBk4HIEZgy4RoHZwZQjcDtCMgcoRgRoRgHKDJBl4RgHIDKDIEYEaEZgyYMoRsIwGQGQIwGUGUI3A5AZMI2EaDLBlwjQZQjAjAZQoqIqqN+pypx/qNIqoqqNKNKcqchwGrCAPqN//PkZOsaCgjiBUZRnkhEBfAgw9tw+iu1RUqp2qNUNalOVG1GkV/U58sLU48sLLCiwFU4hAYA+qQQgasVhVIYQNWKwmAKpvasNoHIDm4OQHIDlGwNgbH4D+JuWQm4mhZFoJsWgm4I4TcbA2xtA5ODnGyNoHJ+NgHKDl/LMBXLUtS04mvLQteAqCaCbFoWQmha8bQ2Acg2ht8bI2RsjaGyNrjYGwNvjbByja/GxFYE4ipBOIrwTiK4J2KuK8BAK4rAnAJwKkE4FYE7FUVgEIqgIRVBO4qRXFQVBVBOMVwCcE5itBOoqAnQqCpBOIrxVBOoJ0KwJxgnQrCuKsVBXioCcCqCdAnYJyKsVYqipBOgjwiAj/8InhH4RMIkIioAC4RiJCMRP////CNk//Blkv4M6F8I9C/8GWT/8I2SwjZOEbJQZZIGWShGyYMsnwj0P///CPQ/hGyQRsn8I2SCNkgOyVkoMsnhGyQMslCNkoMsl4MsnhGyXCNk4MsmEbJ/wZZP8I2SA7JWTgyyQMiKDIieEYiAcRIihGIkIxFwZEUIxEA4iREgcRYihGIoHESIkDiJEUIxFwjEQIxEwZEWDIihGIoRiKEYiHcYJRIr9kzDmO5cIaApXE/NA0TTTKZGym/0//PkZMQWjdCsAwAWCsQ8Cfwoe89cyaXTKZACgKxsmybQFQCyPQPUbRtA9x6QAoegHKmRtClpk0RSkwaCYE/GyaaZ6ZFJTaaTCbTabTBomgmk2mxS0x0waSaTI2gcgOcT0T5MiedM9M9NCfCeGgNhMJlNJoT1MdNJhMjaNPptNGkmhtpnmgmv+KQmRSE0aaY6ZTKZTRoJg0U0aBopg0emU1/xPzTTaa5o80DRTZoJs0TRNEUhMikJs0P0x0wmkwmUymkwaKb5pppNJg0OaInhpGgmeaSbTBp9N/ptNJo0DTNAbOCkGAwGABgA4NgwAAAMAPBgAQKAyDAZgoCkFINAABWAEDAUBTAABgMBTgqACDcGAAQYDAUqLUlVt///+Bj4MIRcGH/hE//hEwY/wi8GPBj8GH8IgRcIv4RYMQi+DAIsIsIn8GHCLCJCJ/BhBgBpgwwifhFhEhF/gwCIDAGIMIMAMQYBFhFBgDH4GAMQiQNAYAwwYBECIAMIAMAAiHBgAMIAiAIg4MABgABhADAhEAGAARCBhCEQhEIMABh6EQAwIMABgCEQwMAQYD4MDCIcGACIQiHwYGDAhEOEQ4MAENB8hJD7PsnXJ0fZ98+D6LItQR3PgnZHmgPYYRopk0xj//PkZMkU/gLsKkITrkL0CfzIetvgJtNdNGkmkwCPLITf8s+WpaFmApAjgFUsyz49jSTCaGMmkyaRZlkJsWpaiagKBZlmWomh8c+CdcnROj4Pk+Akh9E6DsJ0fJ8c+OTs+idk4J2Tg+j7Pr8nB9nwfAa59k7598+D74Sk+eEkFQdDmKsOhwBEVYCeAiAmAiHcBEV4CYCIWmCHF6FqC0haRcF4XYvxfF2LwvC+FqC0xcC0C/FwLSFoF0XBfi7C0xei8LwvcLQLoWoXheC0BaIWoXBdiNiMY6cZ8RkZxnjqOojAz4zx0HUdBGozjoMw6iMjpxdi+L4uC5F/xd/haIui/bZ/+DGBp4RYMQYgw8Ivgw/CJ4RfBh/hECKBgEUGODH8InhFwY4GoMcIgRIMcInCIBrBhCIESESBp+DEGARfhEA1gxBjBj4RAYQYgxgYwiYRcIgMAiAwBjCJgYAawYYRQMQMAYhFgagYhEA0AxA1A1CJBhBgEXwMQNAihFhFAxwYAwgaYMPCJA1hEBiBrwYQiwYwiBFwYhFgxgawihFCLA0gYAwCKESBoBpCJ4MIRcGOEVB9ALR8BJj7/PonB9HyEoJwfZ9E4Dt5OeTnlqJtxNAH7nwfHPonJ8E759E6PoJI//PkZOAWKgjoZUAQYka0Ffgge9VcfZOCdE7J0To+Cc8JWTo+D7J0EqPoO0+T5PsJSfJ9n0TkJUfJOeTknPPo+z6J2Ts+ycE759/k7Pg+z5J2TonBOeTkJUTg+T5DtJ0Tvk5Pjk5DXPg+idH2HYfR9E6PgnR9k5JyfZ9cnR9cNYJSfROidE6Ps+Cdn0fB8E6DtPs+CdHwfH5OAlR8nyfB98+SdE4J0ff5OidH2TknfPkJMfYSg+Cd8+D6PsnP/JwTk++fYSQO0+D5J0fZ8HwTjn2AWDgdAL8ApALQCkO8GACwMgyAVBiAVhzwY4BeDIMgFMOh0ArDgc4BeAV4cgFsOhz/wP225HGw7wCsO4M8AqHP/+DEGQ7/8OgzgFoM4Bf4MhwO4BT4cDmHcGfDnw78GcVhUFTFXFeKoqYJ3isKuKkVgTsVoqCsKwrCoKsVQTqKorYWoXhfxeF/xdi58XOL4WmLnFYVQToE4FXiuK0VwTnFQVRVFcVhU4JzFfDgdhzBnDuHfALgyDAMQZBgGQCgBUAoDAMh3BkAsDMGcGAYgxBn+HAC0ArwCwMAS5adAry0yBSBfoFBVaKqKwVUVrRXUa9FUOEqVUjV3ySPLkvkzlNlNn02E2S06pvVKWACECpW//PkZN8VDgj+zymq5krb1ewAxJvkqe1XysDVFSqlVIo2o0ispyFVoqKNIrKcqNKcKcFhSjaKiKyKhYWiv6nCnCKijajSnPorKNKcKcqcIrqNoqKNqcKNoqKNKNqNKcIqKN//orf6BSbKbKBSBXlp0CvQKTYTZ/0C/LTxFxFoigioigCLC4cRYRWItEXC4cRcI0IoFwwXCiKwjQXC8LhRFcRcRQRSFwoikRcLhxFRFguHiKRF8E7FYVhVBOgCYVRUACKKgqgE0E6ACJFYVoJ0CcgnQrAnMVwTgE6ioKoRwDdhHhG4RARgDcCMEaEYIiAbwRIRuESEcIwRwiYRwjQjBEgWoFuBa4FngWkIQQigwhEwigx/CL/4RfCKEQGP/wYiEUwYHwYGDAwYAGA4RCEQBEGB0rCNcGU4RrBlcIsGGDCESBiEWDCBhCIEWBiDAGHCKEUGEGEGMIgMAiwigxCIDADQGIRfCIEQDXgYYRfBgBoESEXwY/CJCKEQIsGIRODEGIRQYgw8IgRYMMGAGGDEDGDAIoMcDQIkGMGGBrgwCKDAIsIkDUDWDGDDA1hE4RQMQYgwBhhFBhBh4MAMYRMIoRAiAxBjhF4mhZFpxNBNy0LQTUTXhKglR9FqWpaAP5Zi//PkZNYXkgTkGEJwlkXcDfQAe9r8bCa/k5JwTriacsizBHE6CSH1w7efHLPgjuJqWnLITYTX8tRNAH/ialqJuJuWZaFkCO4m5aE7J2TonB8E559nyEnJyfB8FmJrxNxNhNS1E3LT8sxNC0E0LTlqJuWQm3E15ZiaFqWRZiaCagP5aCblkKoqCsCdioKoqwToE6FcVwAhRWBOIrCpFbgnEVRVFUVIJ2K4rAnIqioKgrcV4riuK0E4FcVQTsVxUBOoJ3FUE7itFYE7FYVRXFUVwTkVoqAnYJxBO4rReF4XYWsLWLoui4LwuC9AdsLQL0LQA9C8Lgvi6LguBahfFwXAtIvQQ4vCqKwrxX/8E5xXit4JwKzBnwj+DF+F1guvBiQYkDRIR8I/gz8Gd4R/wYsGLBi8I8DPBneDPBnwZ/8I8DP8I8B/0Gd+DPA+8I/+Ef+DOgzvwj4R/hHoM+Ee4M4D74M+Ef/A/7gfcDPBn4R7BnfCPgz4M7Bngf8DPwjwR6B/3CPwj0Gfgz+EfBnhH8GfwioRQGIBqgRUDVAYoGiBFcIoBqoMWEUA1UDRYRUIqEUA1WBooGiAaqBogRUGJwigM8I/gz+DOCPwj/Bnwj3BnBHgZ4M4I+DOhHhNCz5aiaCb//PkZM0YugrgAAASBEUEBfQAe9rclmWompZ8shNyzLMsy1LMBUAfhNxNicBJCcE5J0JpyyLMTcBVLXloCO5aCagKACiAqflqWYmvE3E3BHlmArFnxNRNC1LUBS5aFoWhZFmWR8k5CTnxz4PonZ8E5Pg+j4LUshNQH4TYtSzLMshNBNhNSyAViyE0FQE4FYVoJ0CcRUgnYqisKoJxFWAhiuKgrCtFUE7FQE5iqKgqRVFWKorwTsVxVFYE7FTFTBOxVgnAqRXBOPisK4BOK0VoriuK0E5BOxUivFcE5FYE5FQVBXFQE6FQVBVFYVxWioCcCoLovi4LoWiL0LSL+LouBaIvBahdi6LoWgEMFoC1hacXxdC14uipiqKn8VPFbiqKsVb//Bm/+EXgx4RdhFb///hE1/8GLP//CKwIrQjoGa/wPewZqEdYM1wZqDNAetgzWEd8GagzYM2DN4M1wjoI7Bm+DNhHcD3rA9awZuEdwZvCOwjsGaA964M1A978I7hHQR0DNge98I6hHYR1wZrBmwPWgPWwZsI7wjqB63COvgzQR3BmwZsGaget8D3rCOgZoGa4R1gzYM0EdwZsI6CO+DN4R1wZsD3oGaBmwjqEdAzXCO/4R0DNAzYR0WgI8TQT//PkZL4XFgTcAE6Tekf8EfQAe9t8YTXiagKwCsJuWXLMTUtC1LMTT8TYTUJP+fAdomomoD8JuWoCgWoI7iaFkJqJqfZ8hrk4CSE5Pk+Cdk5PgnBOT7JwTg+uWZaiaCbcsgFAsy0LPlmJsWYmom5ZFmWpaibiaAjy15ZFkWQm5Zll+JsJqJvy1E0CThJz65OQlJ8H2TknZOT759k6J3z4PgTQTcsy0LITflmWfLUsiyLITYTcTT8syzLQsi0LMEcWZa8tSyE1LTibibFqWYI/8shNCyE1LQsy1LUTUBTLLloWXLUsiyLUtBN+JqJvy1E05Z8TcsxNeWn/LTnxydHwfZ9n1ydk4PsnHJyfR9E4JwTgnB8k4588nB9cnR8c+D7PjxV4q4r8VsVgTgE4/itFShX/xV4rirxVFWKoq4qfxX8E6xVxUBOYrCtwTvwTj/xV8E5/irBOsVuKwqRXFTFQVorCrFf/xWioKwrCtioCcxUFUVAToE4FUVxWFQVhUBO4rgnUVIJyKkVgToE4ipFUVoq4qisKsE64qCoCdxUFUVxXFUE78VxWFQV4qiuKgqiuK4CCK2KoqirBOATsE4FWK4qxVFUVhVFYE4gnIriuCcQTiK4rCoCdCtirBORUiqK2//PkZLAWsgzuADQNNkZj/fjIe9r8K/FXFUVwSE5aiaAKgmhaFpxNQkp8n3z5PsJOGsffLQsyyE1LItS1E1Af+CPLMTUTfibFmJoWQmxanzydHwTsnASknBaCalqWom5ZcsxNyc8nASsnHDt59BrhJgkpOicBKg7D7JyfZ8E5Pk+Cd8EeWXE0LQsiyLQtSyLIsi0LUTYsy0E3LITQshNiyLUsiy4I78shNy0LMVcE6ipgnArRVgncE4wTsVIrCqCcCtBOYrwTgE7iuKwqCoKwrcE7BOQTqKgqiqFpBEC1gPYD3F0X4WoLTF0Xxei6FqC0BaAtQWgXxdwtWFqC0haBW/FQVRUBOBUFcE6ioCcAnEVRX4rYrxWFUVBViuLsXgtAuC6FoBDBaYvi7F8XxexdF8XhcFyI//gx//CJBhgxhEwY/+EXwYgx8ImDH8GPhE8GPhEwigwhFwNQNQNfhE+DGDAGHCIBrhEhEBh4RQMAY/gYBFBhhEAxCIDCEUDEDHBiEUIoRQY+DCBp4McGEIgGgMcGIGMGIGIGgRQYgxCKBiBjBgDGESDADWBgEUDEIuDADWBpBiEUDEDDgYgwBgDEDQDUGIGgRAYQYAxCKBhCKEThEBgBiEUGIRQMQiQiwNAY//PkZKwWNgjoZUAQREakFfQAe9t8YMfwi4GBaFoJsWpaFlyyBHctCzE25ZiaFoAocsy1E24Sk+idk6LMTYTYTQsyyLUtCyLQTUswFYJMGuTg+CdHwErPotAFAsuJtxNCz4m4mvBHiafloWZZ8YppBqzTNI0jTNBMpg0jTTZZFqWfE3Af/xNf+WomhZ8suWZZCb8tC1LQtS14m/LQtBNhNOfR8hKCc8nHJ2EqCUE5CSHxydk6Pg+D7Ps+Sdk6LUTQTcTcTctSz4mwmha8TXlmJvyy5ZiaFl+WpZFoWZa8TQshNCz4mhalmJsWfLQsuWRactBNRNC1E1LLlly0E2PgJWfR8h2H2fJOSdnx+fXPs+T5PgNbnzz6Po+T7JwTk+z4PonROglJ84qCvxXxUirFX4q4qeCd1f8InCI/4R/CP//4RMI/CMEYI4RAR8I8IjCJ4REI/gG8ESEfCOERCP4R/+EaERCPCNCNCI4BvQjYRMHINobIOfjZBzDZG3xtja42gcw2PwcvG2Nng5+NgbY2wcn42htDYGwNrjYGwNsbX42vxscbI2gc3Bzg5Qcg2uNvjaGwNgbI2+Dl4OUbI2Qc42RsjbBy//g5eAboR4RwjQDeCP+EcI8IwBuwjwjBEBEA//PkZKoZMgrqADXt9EV8FfQAe9scG+EThEBGCMESESEbhEQjwjwjwjBHCIwiQDcCNCI/hHE0/LQBSLITf/lqWoSvk7LT8BWLMtRNAk58E7Po+CyLQTcsyyLUsi0Afi1LUTUTUtBNS05aFkWpZHzwkoSgnB9HwfQSsTYsizLQtRNRNgFf/8NcJWEmAWCdn0To+T4CUHyGtxNiyLT/lmJqJqJqWgmpZFqJsWgmwmwmwmv5ZiaibiactBNv/yyLTiaFkWZagKgCmJqWQmgmom3E0LTibAKfE0LLiuKgrYqipBO4JzFUE5BORXBOhVioKwqRWBOYJyKkE6BOIrYqCqCcxVxVFUV8E4FSCdcVgAgCuKkLTBDC6CHi+LwuRfha4uC+FpF8XQtAWgB2wtAWoXBchaBfwtQWnFSCdxVxXFUVhUFYV4rgnOK3wTiKir//1eDCsf//7/+wOYd///ei/f6lmiqGXpyOlCSRm+yP3UtDhFIzqBhwCFHAGFHABYGcAnAAMOAAYcAAw4BYKOAIROANgicAQYcABE4AAzgE4B+1wmcAwYcAK+sDOADgFLCJwAlWBnABwABnABwDWraETgEDOADgDBiRkgoJpGaP+64RSMoRSMGBiRkkwMSMlq7AxIy4//PkZJUYEgieBFw3fkL8FgAied8AROAAicA8DOATgAGHAAROAFwM4BOAGBhwADDgAGHANQUcAgicAYROAfgw4AIkbPNNNpo0TSNBNJgUs0l7lomEwmRSOaRp80zQFK4nvTInnTEGgwGwAwYmOmkyaInppJpMJg0k1+KUaaaTCb42U0mBsGiaSaNNNpo0OaKZNE0jTTSY5oGmaZpJrphM9MGkmDQTCZBzpg0OKR+mBtdMJobfTSbTfG2KSaBpGgaZomiaBomn02mOmkwmjSNPpjmmaKZNA0zSNFNCeClJkT40DTTCY5oJk0kyaJpdMppMdMdN80TR6ZTXTfNJNmimumem+aKZTKaTaaTRops0kwaZppk0+aSa6ZTKYTfTfTPTHTKa5omgmEyaJo9NmkaRp/pnmmaf6aNNMplMplMdMpv8TxMJlNplNJn9MdM1OM6hWa/EjiRiRiO/xIcSP+GgCZQ1+GvDRDV//4aP///4I8EwTwTBLwS/4AHgnBHBHgiwR4JgAgS4IwAYPA8ADg+AAAAFwfB4L4WADC2AGAGFwsFwuD2FgAcAPC+F/B8L4X/B7B4L4WwuD+AGDwXACAAC2D2AEFgfCwAAAAXB8LhcLeDwXCwPYPA+ACACD+AH4XwA//PkZJMVIgb2ejVLxkBMEgTIe898vwv4X/ACB/C4WwtgBg/gA4PA9gBeFhLRTXTRomkmP0yJ6J+mPy0NA0OvibNDQmfzTNNMjaFKNATxMiemiaRoGkmE2mkwmTRTHNBMGiaCZTSZTZomh0PaV9fX2hoX14kzSmOaCY5pJr80U0aPTfNFMps0jSNJMmiaSaTKb6aTKYNLphMpg0eaJoGkJ8aBoppMppMJg00xzTTabNFNJpNJpNpnpg0DT6bTRoppoJMWrSh/690NQ5paV5D2le/LND2hoQxDF/rzR1/r/aWhfaWleQxfXmheaevNDS0tLQ0ryGoch/X15D+vLy+0oc0ry/19DUOXuvIc0oav9oXkNX1/r3X18QCGHQGQHB8PiAPAaHgPDsBgcH+Hqv//+DJ0GNuEW4MbQY2wZO4Rn///4R34R3Qjv//8Gbv//8GbgZuwZvCO4GbsD37+Ed3A586DJ4Rn8DnToRn8GTsGT8GToRn4HOngyf4HOnBGeDJ0IzgjOCM8DnTwjOgydwOdP4RnYMncDbtwY2A27cItgNs3CLeDGwMbwY3CLaEWwRbQi3A27eDG0GN4G2bBFvA2zcItgY3A27YGN4G2bAxtA58/gc6eDJwHOnAyfCM7A588//PkZLMYngTSAFAUhEYcDfggw9V8DnzwOdOBk8IzuEZ4MnAyfgychsy7F3oE13Nl9sy7myrsL6qqOU5anCqkHqNDI3KVUTEU8GNU7U6gxyHKchyVV/Xa2Zspfds3rubK2VsjZmztk9djZi/TZV2NnXYu0vsm0yaBoDZNEbA2k0aKZNjmwbH/Nvm2bRtGyBVArD1G0bQPUevg9h6/+PRzZNkCrzZNgesegesermyPQPXzbHpNvm0PQPUPSbJs82TaHqAtj082h6DaNn8eo2DbHrHpNjj1m1zYHqNo2jYNnmwbPNgek2ja5sj0D1m0bJs80xtJlMdMCeps0U0meaaa6b5p/mmmU3zRTfNFN/pgHPzQNPmkaaaTXTKbTRoJk0zS6b/NBNdNJlNGj02aH6Z4IgAEEYJ4I+CMEQJcEUEXBOpHDX/w1Q0Q1Q1cNWGvw0Q0/hp/AmIaA0cCYhow0w1/w0hoDRhpw1w1BrgTLDXw1BrhrDQGgNQEzAmOGuGiGgNfgTHDQGoCZw1w0BrDWBMIEzDVDTDUGgNfAFwGjBrg1A1YNcGsAXAaQaABcBqg1g1QagaINYaoEyw1Bow1YaA1hoDSBMw1gTICYQJkGrDQGoNGGmGsNcNQawJkGuBM4aIa//PkZKAYngTsATQNQkKMFgDifh7AYagJkGsCZ+GkNWGiGsNAaYaOGgCYgTENQaw0Yaw1Q1Q0/hqw1BkAfmkaCb6ZTCY6bNBNLwmqGA5fzSTCb/lgwXOmMmMmTQ5pmkmUwmkymfzRTaZFJ6aNM002NrppMpg0kwKQmE2m0yKUaKaE95o9MJj9N9NJk0UymOaSaE/TabNNNmmmk2mU2aHTKZTCaNDjaTJoGimkyNvpk0TRTHTf6bTRopg001+mU0aXNBMjYNA0k2mjR5pfps0U100mUz0ym02mDRTHTaaTRpplMc0kz0ySA000mDSTKbNI002mzQTHTaYTf//NA0zQTBodNJk0UyKSaaZNJMprmkaP5oGmKUmEymUyaCbTHNBMJlN80DRNBMmkm/00mUwaZpprplNpvmiaJo80+aSa//TaY/6ZaH//wY4ReEX4RIMfwiAxBh/BhCJ/+ESDDwYcIn+EQIoMAiQYAw8IsGIGGETBj4MP4MQiAxhEAwAxAxBjBiEUIgMIMcDCDAGIMcGMDEGGBgEUDTwNfAx4MAiwiQYgwBgEUIgMIRAiQYhFwYAwBhA1CKDEIoGoGgMQi4MeDADGEQIkIgGMDCDAIoMAiQiAYwYYMQNQigwCJBiDEGAR//PkZJwV+gzoZUAQRkZsCfQAe9tcQYgx8GEGIMQiwMAY4MANAMcIoMSyE1E1/LMTUtCz5OD5PkJJz5Pk+uA/FqWRaib8TUTUTQtC05alqWYm4momgI8TYsxNCzE3LUtQFEsgFM+z6J0fB8nz+TsNcnB9BK+Tk+g7CdhJT6LTiaFqWYI7lqWoCvy05ZlnxNy0/LUshNBNvwR4moCj+Wv5ZlkJqWpalkCOE1E1LQsiyLITUBULLlqWZZlmJsWhZcsi1/4CiWpalkJqJuWvLXlkJsJpyy4mwm5ZlmJuWXLUTQteWgmgmwCsJoWfE3LMsiyLP8TTlkJuAolqJryzE1LTibCbloJuWhZFoWYmxZ8TcXIvxeC0i+FrF0B2i4L8LSL4uBaIDyCHF8XRfF6FqgiwtIuYWoXIrYqAncVvxVip8VIqCvUxPqtFbFf/4q/8V/8V/iririr8VATjxXipxWgnYq+KwqfFTFQVoq+KsVBW8VhUisKuK0VRXivFYE4FTBOhVFcVRV4riuCdCuCdCtwTiCcCqCcgnYqxWFcVIJwKsVxWisK8VxVgnArYqRWFeK0V4qgnQrgnYrfBOoqAnAq4J0CciqKviuK3BOoJyKsE4FUVoqisK2KwrAnArgBAFSK4//PkZJ0VagjyJgGtbkOkFfwAbh4AqRViuK4J0KgrCrFUVxVjOEeDQgjlcT4T40xtjaNI0uaI2QciGNJIl4kJZtCGIaSckIm6GL3TQ2zRTY2UwmjSNE0fxS02aY2BsJs0/+mzSE8TQpHTKZTaaG0aQpApZp/mmm+aHTfTCZGwNgUk0E0aRp/ilJlNJgT5MmkJ9zQNA0TQTH6ZG2mk0mk0mk3zQTKY/G3zQTHTabTBpGgmU0aKaTJpJpNJtMphNjYTfNE0emkymE2mEyaCbNBNfmkaJpdNJnpg0k0mDTTCbTaZTBp80k2aCbTfNE00yaCb6bTZoplMmmaKZTKaTJpmiaHTXNJNdMDbTab6Y6Z6ZNNMJhMJhN9NJrmim02m0ymU300aPTSa6Y//5pJpNdN/9NppxWxU4Jx/xWxU/xU4qcV/ipiuKwqxWFbioK/8VIqivFTwTkVgTkVor4JxFXxX8VcVxUFQE4FaCcwTvBOIqwToVuKwqCtFUVYqxXxWFeK0E7FQVYrwTnwTsV4rCqCcfFaCcRVFQE5gnAr4JyK4r4Jz4J0Koqip4rCvisKoJ3xWBOME7iuKgriuKgrAnAqgnArxXiqCcgnYJzFQVQTmAEIVYrwToAIYrwTiKkVQTkE5//PkZK4XGgzsADQNAkIcCfwAe898FXFTFYVxXxUFQVkzzS5oilg5TTTY2kyaJpJtNGgJ8aKaTQ2k2aCaNI0eaSYNJM/tKHEiQxfJG09MmgaSYTRppg0TRNNMJlMptMCfppNprmiaA2jQNLmmaRppk0jRFLNP9NJhMGmaQpZpJhNCkGkmE0J+mxSk0m0x02mjRTKbTCZ42EwaQpJpptNprmgaRpmim00J4mzSNM0kymkyKWmE0muaKYGwNjmgafTPNE0U0mUwJ7+mem01+J8mhSk2mjRTSb6aTCbNBM9MpjpjppMpk0E2mE2mE2mjSTfTaZ6YNFMcT1MpnprptNmim0wmE100aSaTRo9MGjzTTHTaaTfTSaNLpoFMAAFYNBQGwAvwAYM4NgqqkjaAN3d3d3etERNK5CZ/3Ctf8AaiAc/u7vaIn/+8XPv//+GDKv8W1/+AC8K4Yw+94xe940jgceOBwOcRaxGwH4EuNIjBfxazB8HhkwVjIAII/vDkjG/wAcJPeF5e98hNgSYLWMFvhZ73pX06aoehpmh01hMJtM9K3TKY9E10x+memvlIpZM9MUTCbShbUrtM+n5ophNZuXK+0wmemumMCemkmvc0Uwm/lJJlLe5oJZI0SyW6R0mE//PkZLcXlgrzECFvrEmMEfgAfh7k2aORpbTYUo9SBNsekGYNVKgqg6hrUXK4Q42DOwPWbILEzBSumEgkWJPU8S72G5wUuGDwguEKa1Q0UykS3Bn7FJNgg5qoEgpsGabBtGabZt7NrKCNgLYes1idmabBtm2bZsBRm0PQbF9mwPSPUBbMwzB6QojYM42ePTzbMwzR6TaNs1eBVNv81yDUJ2QYhJtD0m0PVe+x6T2M8HsbFwsh6B6D7HpugT2uZhO6HqZhmE7ISZhhkFNcghtmybBnnsD1Ho49ZtG2bZs5PVBc2EEepCaEHNjj1EJHq5smabZtmwbNEEPR+bJse9z2PY2T1SN0rdNJq6yXI06COvNJj9MGmkkGmUj7pI0TToNGlEsNEnCW10ymi5FtNFKpvps0kz0uW3aaTF00mTSzdNJu0KFYz1KjaGAhyoQCFGM//zFARgIUZ/oZpdCttay6M5drW1joSj6Ekk1b7J7R7aoQNlPrWBKLTTzOsGT5yYxLrtHTy2iUxEkES0HIBVD066VjGj31odPkkSjJtbWs6OIjKmlXHR9K5MTv5pdZolE10kk2lly74TFx5KTXeTGLrS6ExiucvJSSDUdXZm3NLn1rtYBCUEoRj77WOhCPc+g5//PkZJ8XPgzoAABMTrz8BfQyY9ONGxJULutaa1TE5LHxWEo+XecmMa3p0kqBCR6qOFaFUGpNJIIjqVi0ylBqJIkiSJIkmJj605EkSRJPetWAyVacmodBUVhGfrAZPF0AUrgRLNiqDU4VHo8h6HRObJJNdqlRBMFT0qdNE0WZhmay2tCuOY6oieWieianCnVSbzjd7SGhrLi6eUSeLcZTWqdML5PM50uOGJms9VqtYU6hrgrm4V0frUzTvYsiegR2FOkqUxSKdVCpmRCSkIAUZ4VPhqEKgFDU2VhUiIhUaIg0RAkTBYEjYBUbBMuCJgLAkCUBUinABgBE3/9EQqFRM0s0qzktk9ZFqqFC6RULE11JVDkd8Y1vVFOx9oUIpZ8Vnq5klkxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";var Gb=t=>t instanceof Date,ise=t=>t==null;const sse=t=>typeof t=="object";var GV=t=>!ise(t)&&!Array.isArray(t)&&sse(t)&&!Gb(t),WV=t=>ise(t)||!sse(t);function ose(t,e){if(WV(t)||WV(e))return t===e;if(Gb(t)&&Gb(e))return t.getTime()===e.getTime();const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(const i of r){const s=t[i];if(!n.includes(i))return!1;if(i!=="ref"){const o=e[i];if(Gb(s)&&Gb(o)||GV(s)&&GV(o)||Array.isArray(s)&&Array.isArray(o)?!ose(s,o):s!==o)return!1}}return!0}function _6(t){if(t===null)throw new Error("Canvas should always be defined when component is mounted.");const e=t.getContext("2d");if(e===null)throw new Error("Canvas 2D context should be non-null");e.clearRect(0,0,t.width,t.height)}function DHe(t){var e;const{onScan:r,constraints:n,formats:i=["qr_code"],paused:s=!1,components:o,children:a,styles:c,classNames:l,allowMultiple:f,scanDelay:u,onError:h}=t,g=T.useRef(null),y=T.useRef(null),m=T.useRef(null),S=T.useMemo(()=>({...THe,...n}),[n]),E=T.useMemo(()=>({...PHe,...o}),[o]),[A,P]=T.useState(!1),[N,L]=T.useState(!0),[V,I]=T.useState(S),U=function(){const v=T.useRef(Promise.resolve({type:"stop",data:{}})),b=T.useRef(null),M=T.useRef(null),[B,x]=T.useState({}),[C,w]=T.useState({}),k=T.useCallback(async(X,W)=>{var Z,te,F;if(!window.isSecureContext)throw new Error("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.");if(((Z=navigator==null?void 0:navigator.mediaDevices)===null||Z===void 0?void 0:Z.getUserMedia)===void 0)throw new Error("this browser has no Stream API support");MHe();const ee=await navigator.mediaDevices.getUserMedia({audio:!1,video:W});X.srcObject!==void 0?X.srcObject=ee:X.mozSrcObject!==void 0?X.mozSrcObject=ee:window.URL.createObjectURL?X.src=window.URL.createObjectURL(ee):window.webkitURL?X.src=window.webkitURL.createObjectURL(ee):X.src=ee.id,await Promise.race([X.play(),new Promise(xe=>setTimeout(xe,3e3)).then(()=>{throw new Error("Loading camera stream timed out after 3 seconds.")})]),await new Promise(xe=>setTimeout(xe,500));const[fe]=ee.getVideoTracks();return w(fe.getSettings()),x((F=(te=fe==null?void 0:fe.getCapabilities)===null||te===void 0?void 0:te.call(fe))!==null&&F!==void 0?F:{}),b.current=ee,M.current=fe,{type:"start",data:{videoEl:X,stream:ee,constraints:W}}},[]),O=T.useCallback(async(X,W)=>{X.src="",X.srcObject=null,X.load();for(const Z of W.getTracks())W.removeTrack(Z),Z.stop();return b.current=null,M.current=null,w({}),{type:"stop",data:{}}},[]),G=T.useCallback(async(X,{constraints:W,restart:Z=!1})=>{if(v.current=v.current.then(te=>{if(te.type==="start"){const{data:{videoEl:F,stream:ee,constraints:fe}}=te;return Z||X!==F||W!==fe?O(F,ee).then(()=>k(X,W)):te}return k(X,W)}),(await v.current).type==="stop")throw new Error("Something went wrong with the camera task queue (start task).")},[k,O]),oe=T.useCallback(async()=>{if(v.current=v.current.then(X=>{if(X.type==="stop")return X;const{data:{videoEl:W,stream:Z}}=X;return O(W,Z)}),(await v.current).type==="start")throw new Error("Something went wrong with the camera task queue (stop task).")},[O]),$=T.useCallback(async X=>{const W=M.current;if(!W)throw new Error("No active video track found.");{X.advanced&&X.advanced[0].zoom&&W.getCapabilities().torch&&await W.applyConstraints({advanced:[{torch:!1}]}),await W.applyConstraints(X);const Z=W.getCapabilities(),te=W.getSettings();x(Z),w(te)}},[]);return T.useEffect(()=>()=>{(async()=>await oe())()},[oe]),{capabilities:B,settings:C,startCamera:G,stopCamera:oe,updateConstraints:$}}(),{startScanning:ie,stopScanning:ae}=function(v){const{videoElementRef:b,onScan:M,onFound:B,retryDelay:x=100,scanDelay:C=0,formats:w=[],audio:k=!0,allowMultiple:O=!1}=v,G=T.useRef(new GT({formats:w})),oe=T.useRef(null),$=T.useRef(null);T.useEffect(()=>{G.current=new GT({formats:w})},[w]),T.useEffect(()=>{typeof window<"u"&&k&&(oe.current=new Audio(OHe))},[k]);const X=T.useCallback(W=>async Z=>{if(b.current!==null&&b.current.readyState>1){const{lastScan:te,contentBefore:F,lastScanHadContent:ee}=W;if(Z-te!F.includes(ze.rawValue)),_e=fe.length>0;let Me=W.lastOnScan;(xe||O&&_e&&Z-Me>=C)&&(k&&oe.current&&oe.current.paused&&oe.current.play().catch(ze=>console.error("Error playing the sound",ze)),Me=Z,M(fe)),_e&&B(fe),!_e&&ee&&B(fe);const Ke={lastScan:Z,lastOnScan:Me,lastScanHadContent:_e,contentBefore:xe?fe.map(ze=>ze.rawValue):F};$.current=window.requestAnimationFrame(X(Ke))}}},[b.current,M,B,x]);return{startScanning:T.useCallback(()=>{const W=performance.now(),Z={lastScan:W,lastOnScan:W,contentBefore:[],lastScanHadContent:!1};$.current=window.requestAnimationFrame(X(Z))},[X]),stopScanning:T.useCallback(()=>{$.current!==null&&(window.cancelAnimationFrame($.current),$.current=null)},[])}}({videoElementRef:g,onScan:r,onFound:v=>function(b,M,B,x){const C=B;if(C==null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas is always defined.");const w=M;if(w==null)throw new Error("onFound handler should only be called when component is mounted. Thus video element is always defined.");if(b.length===0||x===void 0)_6(C);else{const k=w.offsetWidth,O=w.offsetHeight,G=w.videoWidth,oe=w.videoHeight,$=Math.max(k/G,O/oe),X=G*$,W=oe*$,Z=X/G,te=W/oe,F=(k-X)/2,ee=(O-W)/2,fe=({x:Ke,y:ze})=>({x:Math.floor(Ke*Z),y:Math.floor(ze*te)}),xe=({x:Ke,y:ze})=>({x:Math.floor(Ke+F),y:Math.floor(ze+ee)}),_e=b.map(Ke=>{const{boundingBox:ze,cornerPoints:Je}=Ke,{x:Xe,y:lt}=xe(fe({x:ze.x,y:ze.y})),{x:Re,y:$e}=fe({x:ze.width,y:ze.height});return{...Ke,cornerPoints:Je.map(st=>xe(fe(st))),boundingBox:DOMRectReadOnly.fromRect({x:Xe,y:lt,width:Re,height:$e})}});C.width=w.offsetWidth,C.height=w.offsetHeight;const Me=C.getContext("2d");if(Me===null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas 2D context is always defined.");x(_e,Me)}}(v,g.current,m.current,E.tracker),formats:i,audio:E.audio,allowMultiple:f,retryDelay:E.tracker===void 0?500:10,scanDelay:u});T.useEffect(()=>(P(!0),()=>{P(!1)}),[]),T.useEffect(()=>{A&&(ae(),ie())},[o==null?void 0:o.tracker]),T.useEffect(()=>{if(!ose(S,V)){const v=S;n!=null&&n.deviceId&&delete v.facingMode,I(v)}},[n]);const K=T.useMemo(()=>({constraints:V,shouldStream:A&&!s}),[V,A,s]),R=async()=>{const v=g.current;if(v==null)throw new Error("Video should be defined when component is mounted.");const b=y.current;if(b==null)throw new Error("Canvas should be defined when component is mounted.");const M=b.getContext("2d");if(M==null)throw new Error("Canvas should be defined when component is mounted.");if(K.shouldStream){await U.stopCamera(),L(!1);try{await U.startCamera(v,K),v?L(!0):await U.stopCamera()}catch(B){h==null||h(B),console.error("error",B)}}else b.width=v.videoWidth,b.height=v.videoHeight,M.drawImage(v,0,0,v.videoWidth,v.videoHeight),await U.stopCamera(),L(!1)};T.useEffect(()=>{(async()=>await R())()},[K]);const D=T.useMemo(()=>K.shouldStream&&N,[K.shouldStream,N]);return T.useEffect(()=>{if(D){if(y.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus pause frame canvas is defined");if(_6(y.current),m.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus tracking canvas is defined");if(_6(m.current),g.current==null)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus video element is defined");ie()}},[D]),qt.createElement("div",{style:{...kHe,...c==null?void 0:c.container},className:l==null?void 0:l.container},qt.createElement("video",{ref:g,style:{...RHe,...c==null?void 0:c.video,visibility:s?"hidden":"visible"},className:l==null?void 0:l.video,autoPlay:!0,muted:!0,playsInline:!0}),qt.createElement("canvas",{ref:y,style:{display:s?"block":"none",position:"absolute",top:0,left:0,width:"100%"}}),qt.createElement("canvas",{ref:m,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"}}),qt.createElement("div",{style:{top:0,left:0,position:"absolute",width:"100%",height:"100%"}},E.finder&&qt.createElement(IHe,{scanning:N,capabilities:U.capabilities,loading:!1,onOff:E.onOff,zoom:E.zoom&&U.settings.zoom?{value:U.settings.zoom,onChange:async v=>{const b={...V,advanced:[{zoom:v}]};await U.updateConstraints(b)}}:void 0,torch:E.torch?{status:(e=U.settings.torch)!==null&&e!==void 0&&e,toggle:async v=>{const b={...V,advanced:[{torch:v}]};await U.updateConstraints(b)}}:void 0,startScanning:async()=>await R(),stopScanning:async()=>{await U.stopCamera(),_6(m.current),L(!1)},border:c==null?void 0:c.finderBorder}),a))}function NHe({onQrUri:t}){const e=rm("isMobile"),r=fr(kx),[n,i]=T.useState(""),s=async()=>{if(n){console.log(n);try{await r.pair(n)}catch(o){console.error("Error pairing with dapp",o),t(!1);return}}t(!0)};return j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{flexDirection:"column",justifyContent:"space-between",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Connect a Dapp"}),j.jsx(ye,{alignSelf:"center",style:{height:"280px",width:"280px"},children:j.jsx(DHe,{onScan:o=>{o[0].rawValue&&i(o[0].rawValue)},styles:{video:{transform:e?"scaleX(-1)":"scaleX(1)",borderRadius:"10px"}}})}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Paste connection string"}),j.jsx(Sn,{name:"signClientUri",value:n,onChange:o=>i(o.target.value)})]})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Kt,{size:"md",shape:"square",label:"Cancel",onClick:()=>{t(!1)}}),j.jsx(Kt,{variant:"primary",size:"md",shape:"square",label:"Connect Dapp",disabled:!n,onClick:()=>{n&&s()}})]})]})}function BHe(){const t=fr(Fr),e=rm("isMobile"),r=fr(kx),n=Wr(r.allSessions),[i,s]=T.useState(!1),[o,a]=T.useState(!1),c=Wr(t.selectedExternalProvider),l=async()=>{a(!0)};return j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{justifyContent:"space-between",alignItems:"center",gap:"2",children:[j.jsxs(ye,{alignItems:"center",gap:"2",children:[j.jsx(Fi,{src:lze,width:"7",height:"7"}),j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Connected Dapps"})]}),j.jsx(Kt,{size:"sm",leftIcon:$w,label:"Connect",shape:"square",disabled:(c==null?void 0:c.info.name)==="WalletConnect",onClick:()=>s(!0)})]}),j.jsx(hi,{marginY:"2"}),n.length>0?j.jsx(cze,{sessionList:n}):j.jsx(vn,{flexDirection:"column",children:(c==null?void 0:c.info.name)==="WalletConnect"?j.jsxs(ye,{flexDirection:"column",alignItems:"center",gap:"4",children:[j.jsx(Fi,{src:Oie,color:"text50",width:"8",height:"8"}),j.jsx(Te,{textAlign:"center",variant:"large",color:"text50",padding:"4",children:"To connect to Dapps, switch from WalletConnect to a different wallet as your External Wallet connection method."})]}):j.jsx(Te,{alignSelf:"center",textAlign:"center",variant:"large",color:"text50",padding:"4",children:"Connect a Dapp with WalletConnect to sign actions"})}),i&&j.jsx(oa,{size:"md",contentProps:{style:{width:e?"100%":"500px"}},onClose:()=>s(!1),children:j.jsx(NHe,{onQrUri:f=>{f&&l(),s(!1)}})}),o&&j.jsx(oa,{size:"md",onClose:()=>a(!1),children:j.jsx(fze,{onClose:()=>a(!1)})})]})}const LHe="data:image/svg+xml,%3csvg%20fill='none'%20height='400'%20viewBox='0%200%20400%20400'%20width='400'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cclipPath%20id='a'%3e%3cpath%20d='m0%200h400v400h-400z'/%3e%3c/clipPath%3e%3cg%20clip-path='url(%23a)'%3e%3ccircle%20cx='200'%20cy='200'%20fill='%233396ff'%20r='199.5'%20stroke='%2366b1ff'/%3e%3cpath%20d='m122.519%20148.965c42.791-41.729%20112.171-41.729%20154.962%200l5.15%205.022c2.14%202.086%202.14%205.469%200%207.555l-17.617%2017.18c-1.07%201.043-2.804%201.043-3.874%200l-7.087-6.911c-29.853-29.111-78.253-29.111-108.106%200l-7.59%207.401c-1.07%201.043-2.804%201.043-3.874%200l-17.617-17.18c-2.14-2.086-2.14-5.469%200-7.555zm191.397%2035.529%2015.679%2015.29c2.14%202.086%202.14%205.469%200%207.555l-70.7%2068.944c-2.139%202.087-5.608%202.087-7.748%200l-50.178-48.931c-.535-.522-1.402-.522-1.937%200l-50.178%2048.931c-2.139%202.087-5.608%202.087-7.748%200l-70.7015-68.945c-2.1396-2.086-2.1396-5.469%200-7.555l15.6795-15.29c2.1396-2.086%205.6085-2.086%207.7481%200l50.1789%2048.932c.535.522%201.402.522%201.937%200l50.177-48.932c2.139-2.087%205.608-2.087%207.748%200l50.179%2048.932c.535.522%201.402.522%201.937%200l50.179-48.931c2.139-2.087%205.608-2.087%207.748%200z'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e";function FHe({onSelectProvider:t}){const e=fr(kx),r=Mie(),[n,i]=T.useState(!1),s=e.allSessions.get().length>0,o=async()=>{await e.disconnectAllSessions(),t();const a=await Rie(!0);await a.connect(),t(kie(a))};return j.jsx(ye,{children:n?j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",color:"text100",children:"Use WalletConnect for External Wallet?"}),j.jsxs(vn,{alignItems:"center",gap:"3",style:{background:"rgba(176, 126, 30, 0.3)"},children:[j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"medium",color:"text100",children:"Attention"}),s?j.jsx(Te,{variant:"normal",color:"text80",children:"If you connect your external wallet using WalletConnect, you'll lose all Dapps connections you already made using WalletConnect."}):j.jsxs(Te,{variant:"normal",color:"text80",children:["If you connect your external wallet using WalletConnect, you won't be able to connect to any other Dapps during this session. ",j.jsx("br",{})," ",j.jsx("br",{}),"If you need to connect Dapps, please consider using a different external wallet instead."]})]}),j.jsx(Fi,{src:Oie,width:"8",height:"8"})]}),j.jsxs(ye,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"6",children:[j.jsx(Kt,{width:"full",label:"Cancel",shape:"square",onClick:()=>t()}),j.jsx(Kt,{width:"full",variant:"primary",label:"Confirm",shape:"square",onClick:()=>o(),"data-id":"signingContinue"})]})]}):j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",color:"text100",children:"Connect external wallet"}),j.jsx(Te,{variant:"normal",color:"text50",children:"You need an external wallet to relay transactions"}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsx(vn,{flexDirection:"row",justifyContent:"center",gap:"2",cursor:"pointer",borderRadius:"circle",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>{i(!0)},children:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Fi,{src:LHe,width:"5",height:"auto"}),j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:"Wallet Connect"})]})}),r.map(a=>j.jsx(vn,{flexDirection:"row",justifyContent:"center",gap:"2",cursor:"pointer",borderRadius:"circle",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>t(a),children:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Fi,{src:a.info.icon,width:"5",height:"auto"}),j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:a.info.name})]})},a.info.uuid))]})]})})}function jHe(){const t=fr(Fr),e=Wr(t.selectedExternalProvider),r=Wr(t.selectedExternalWalletAddress),[n,i]=T.useState(!1),[s,o]=T.useState(!1);T.useEffect(()=>{s&&setTimeout(()=>{o(!1)},2e3)},[s]);const a=async()=>{e===void 0&&i(!0)},c=async()=>{t.setExternalProvider(void 0);const f=e;(f==null?void 0:f.info.name)==="WalletConnect"&&f.provider.disconnect()},l=()=>{navigator.clipboard.writeText(r),o(!0)};return j.jsxs(ye,{flexDirection:"column",width:"full",children:[j.jsxs(ye,{justifyContent:"space-between",alignItems:"center",gap:"2",children:[j.jsxs(ye,{alignItems:"center",gap:"2",children:[j.jsx(Xge,{color:"text100",style:{width:"28px",height:"28px"}}),j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"External Wallet"})]}),!e&&j.jsx(Kt,{size:"sm",leftIcon:$w,label:"Connect Wallet",variant:"primary",shape:"square",onClick:()=>a()})]}),j.jsx(hi,{marginY:"2"}),j.jsx(vn,{flexDirection:"column",children:e?j.jsxs(ye,{justifyContent:"space-between",alignItems:"center",children:[j.jsxs(ye,{flexDirection:"row",gap:"4",children:[j.jsx(DC,{background:"text80",src:e.info.icon}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"medium",color:"text100",children:e.info.name}),j.jsxs(ye,{gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text50",width:"full",children:r}),s?j.jsx(qw,{color:"borderNormal",cursor:"pointer",onClick:()=>l()}):j.jsx(QW,{color:"borderNormal",cursor:"pointer",onClick:()=>l()})]})]})]}),j.jsx(up,{icon:j.jsx(Tu,{color:"text100"}),onClick:()=>c()})]}):j.jsx(Te,{alignSelf:"center",textAlign:"center",variant:"large",color:"text50",padding:"4",children:"Connect an external wallet to relay transactions"})}),n&&j.jsx(oa,{size:"sm",onClose:()=>i(!1),children:j.jsx(FHe,{onSelectProvider:async f=>{var u,h;f&&(((u=t.selectedExternalProvider.get())==null?void 0:u.info.name)==="WalletConnect"&&await((h=t.selectedExternalProvider.get())==null?void 0:h.provider).disconnect(),t.setExternalProvider(f)),i(!1)}})})]})}function FO({chainId:t,paddingTop:e="0",paddingBottom:r="1"}){return j.jsx(ye,{background:"backgroundMuted",width:"fit",height:"fit",borderRadius:"sm",paddingTop:e,paddingBottom:r,paddingX:"2",children:j.jsx(Te,{variant:"xsmall",color:"text100",children:um(t)})})}function w7({symbol:t,chainId:e,to:r,amount:n}){return j.jsxs(ye,{flexDirection:"column",width:"full",gap:"5",paddingTop:"7",children:[j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:"Pending transactions"}),j.jsxs(ye,{background:"backgroundSecondary",borderRadius:"sm",alignItems:"center",padding:"4",gap:"5",children:[j.jsx(Q1,{size:"lg"}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"1",children:[j.jsxs(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:["Sending ",n," ",t," on"]}),j.jsx(FO,{chainId:e,paddingTop:"0",paddingBottom:"1"}),j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"to"}),j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text80",style:{fontFamily:"monospace"},children:r})]}),j.jsx(Te,{variant:"normal",color:"text50",children:"Your external wallet will prompt you to confirm the transaction"})]})]})]})}function UHe({...t}){var s,o;const e=fr(Fr),r=Wr(e.isSendingTokenTransaction),n=Wr(e.isSendingCollectibleTransaction),i=Wr(e.isSendingSignedTokenTransaction);return j.jsxs(ye,{flexDirection:"column",justifyContent:"center",alignItems:"center",width:"full",gap:"4",...t,children:[r&&j.jsx(w7,{symbol:((o=(s=r.tokenBalance)==null?void 0:s.contractInfo)==null?void 0:o.symbol)??"",chainId:r.tokenBalance.chainId,to:r.to,amount:r.amount}),n&&j.jsx(w7,{symbol:n.collectibleInfo.collectibleInfoResponse.name??"",chainId:n.collectibleInfo.collectibleInfoParams.chainId,to:n.to,amount:n.amount}),i&&j.jsx(w7,{symbol:"tokens",chainId:i.chainId,to:i.txn[0].to,amount:String(Number(i.txn[0].value))})]})}const KV=["https://dweb.link/ipfs/","https://gateway.pinata.cloud/ipfs/","https://nftstorage.link/ipfs/","https://flk-ipfs.io/ipfs/","https://storry.tv/ipfs/","https://ipfs.io/ipfs/","https://hardbin.com/ipfs/","https://ipfs.runfission.com/ipfs/","https://ipfs.eth.aragon.network/ipfs/","https://4everland.io/ipfs/","https://w3s.link/ipfs/","https://trustless-gateway.link/ipfs/"],$He="QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/1";class qHe{constructor(){ue(this,"gatewayURL");ue(this,"localStore");this.localStore=new hu(Ul.GATEWAY_ADDRESS),this.gatewayURL=this.localStore.get(),this.findAccessibleGateway()}async findAccessibleGateway(){const e=this.localStore.get();if(e&&await this.isGatewayAccessible(e)){this.gatewayURL=e;return}for(const r of KV)if(await this.isGatewayAccessible(r)){this.gatewayURL=r,this.localStore.set(r);return}this.gatewayURL=KV[0],console.warn("No accessible IPFS gateways found, falling back to default")}async isGatewayAccessible(e){try{return await fetch(`${e}${$He}`,{signal:AbortSignal.timeout(3e3)}),!0}catch{return!1}}async fetch(e){this.gatewayURL||await this.findAccessibleGateway();const r=await this.getGatewayURL(e);return fetch(r,{signal:AbortSignal.timeout(3e3)})}async getGatewayURL(e){if(this.gatewayURL||await this.findAccessibleGateway(),!e.startsWith("ipfs://"))throw new Error("Invalid IPFS URI");return e.replace("ipfs://",this.gatewayURL)}}function VHe(t,e){e(t.get()),t.subscribe(e)}const zHe={ERC721:"ERC721",ERC1155:"ERC1155"};class ase{constructor(e){ue(this,"isFetchingBalances",_r(!1));ue(this,"isFetchingCollectibleInfo",_r(!1));ue(this,"ipfsGatewayHelper",new qHe);ue(this,"userCollectibles",_r([]));ue(this,"local",{userCollectibles:new hu(Ul.COLLECTIBLES)});this.store=e;const r=this.store.get(In);VHe(r.networks,n=>{const i=this.store.get(oi).accountAddress.get();i&&n.length>0&&this.loadBalances(i)})}async loadBalances(e){const r=this.local.userCollectibles.get()??[];if(r.length===0)return;this.isFetchingBalances.set(!0);const n=[],i=r.map(async s=>{const o=await this.getCollectibleInfo(s);if(!o.isOwner){this.removeCollectible({collectibleInfoParams:s,collectibleInfoResponse:o});return}n.push({collectibleInfoParams:s,collectibleInfoResponse:o})});await Promise.allSettled(i),this.userCollectibles.set(n),this.isFetchingBalances.set(!1)}async getCollectibleInfo(e){const r=this.store.get(oi).accountAddress.get();if(!r)throw new Error("No account found");const n=this.store.get(In).providerForChainId(e.chainId);this.isFetchingCollectibleInfo.set(!0);let i,s,o,a,c;if(e.contractType===Ph.ERC721){const f=new Si(e.address,fte,n),h=(await f.ownerOf(e.tokenId)).toLowerCase()===r.toLowerCase();if(!h)return this.isFetchingCollectibleInfo.set(!1),{isOwner:h,uri:""};i=await f.tokenURI(e.tokenId)}else if(e.contractType===Ph.ERC1155){const f=new Si(e.address,ute,n);if(a=await f.balanceOf(r,e.tokenId),!a)return this.isFetchingCollectibleInfo.set(!1),{isOwner:!1,uri:""};a=a??BigInt(1),i=await f.uri(e.tokenId)}if(!i)throw new Error("Could not get collectible URI");i.includes("{id}")&&(i=i.replace("{id}",e.tokenId.toString()));let l;try{i.startsWith("ipfs://")?l=await this.ipfsGatewayHelper.fetch(i).then(f=>f.json()):l=await fetch(i).then(f=>f.json()),l&&(c=l.decimals,s=l.image,o=l.name),s!=null&&s.startsWith("ipfs://")&&(s=await this.ipfsGatewayHelper.getGatewayURL(s))}catch{o||(o=`No Metadata Found Address: ${e.address} TokenId: ${e.tokenId}`)}return c=c??0,this.isFetchingCollectibleInfo.set(!1),{isOwner:!0,uri:i,image:s,name:o,balance:a,decimals:c}}async addCollectible(e){if(e.collectibleInfoResponse.isOwner){const r=this.local.userCollectibles.get()??[];if(r.some(n=>n.address===e.collectibleInfoParams.address&&n.tokenId===e.collectibleInfoParams.tokenId))throw new Error("Collectible already added");this.local.userCollectibles.set([...r,e.collectibleInfoParams]),this.isFetchingCollectibleInfo.set(!0),this.loadBalances(),this.isFetchingCollectibleInfo.set(!1)}}async removeCollectible(e){const n=(this.local.userCollectibles.get()??[]).filter(o=>o.address!==e.collectibleInfoParams.address||o.tokenId!==e.collectibleInfoParams.tokenId);this.local.userCollectibles.set(n);const s=this.userCollectibles.get().filter(o=>o.collectibleInfoParams.address!==e.collectibleInfoParams.address||o.collectibleInfoParams.tokenId!==e.collectibleInfoParams.tokenId);this.userCollectibles.set(s)}}const HHe="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='collection'%3e%3cg%20id='Vector'%3e%3cpath%20d='M6.37183%2013.326V6.12354H13.5743V7.86282H8.11042V13.326H6.37183Z'%20fill='white'/%3e%3cpath%20d='M3%209.95247V2.75H10.2025V4.48928H4.7386V9.95247H3Z'%20fill='white'/%3e%3cpath%20d='M9.79834%2016.7508V9.54834H17.0008V16.7508H9.79834Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",cse="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Send%20(Default)'%3e%3cpath%20id='Subtract'%20d='M14.952%202.86937L3.33984%2010.6285C3.00008%2010.8569%202.89796%2011.3362%203.11176%2011.6991C3.2446%2011.9246%203.46815%2012.0521%203.6999%2012.0616L3.70388%2012.0651L3.708%2012.0686H6.28605C6.78202%2012.0686%207.26064%2011.8739%207.63066%2011.5216C8.1492%2011.0279%2010.4926%209.12312%2011.7011%208.14595C12.0915%207.83027%2012.8551%207.99125%2012.625%208.4375L11.2433%2010.9344C10.7104%2011.8479%2010.8913%2013.0409%2011.667%2013.7286L14.4613%2016.206L14.718%2016.4303L14.928%2016.6297L14.998%2016.6795L15.0641%2016.7149C15.0822%2016.7245%2015.1011%2016.7323%2015.1206%2016.738C15.1476%2016.746%2015.1755%2016.75%2015.2035%2016.75H15.3981C15.7996%2016.75%2016.125%2016.4024%2016.125%2015.9736L16.125%203.53132C16.125%203.11184%2015.8136%202.77006%2015.4242%202.75541C15.2649%202.73526%2015.0984%202.77102%2014.952%202.86937Z'%20fill='white'/%3e%3c/g%3e%3c/svg%3e";function GHe({collectibleInfo:t,onSendClick:e,onRemoveClick:r}){return j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",children:[j.jsxs(ye,{flexDirection:"row",gap:"3",children:[t.collectibleInfoResponse.image&&j.jsx(ye,{children:j.jsx(DC,{background:"text80",src:t.collectibleInfoResponse.image})}),j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{gap:"2",alignItems:"center",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:t.collectibleInfoResponse.name??"Collectible"}),j.jsxs(Te,{variant:"small",fontWeight:"bold",color:"text50",children:["#",t.collectibleInfoParams.tokenId]}),j.jsx(FO,{chainId:t.collectibleInfoParams.chainId})]}),j.jsx(ye,{children:j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text50",children:t.collectibleInfoParams.contractType==="ERC1155"?Number(Ih(t.collectibleInfoResponse.balance,t.collectibleInfoResponse.decimals??0)):1})})]})]}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(up,{icon:j.jsx(Fi,{src:cse}),disabled:!1,onClick:e}),r&&j.jsx(up,{icon:j.jsx(Tu,{color:"text100"}),onClick:()=>r==null?void 0:r()})]})]})}function WHe({onClose:t}){const r=fr(In).networks.get(),n=r.filter(U=>U.type===Mt.MAINNET),i=fr(ase),s=Wr(i.isFetchingCollectibleInfo),o=tm(),[a,c]=T.useState(),[l,f]=T.useState(),[u,h]=T.useState(),[g,y]=T.useState(),[m,S]=T.useState(),[E,A]=T.useState(!1),[P,N]=T.useState();T.useEffect(()=>{var U,ie;a&&N((ie=(U=r.find(ae=>ae.chainId===a.chainId))==null?void 0:U.blockExplorer)==null?void 0:ie.rootUrl),a&&l&&u&&g?i.getCollectibleInfo({chainId:a.chainId,address:l,tokenId:u,contractType:g}).then(ae=>{S(ae)}):S(void 0)},[a,l,u,g]);const L=n.filter(U=>!U.disabled).map(U=>({label:U.title,value:U.chainId.toString()})),V=async()=>{a&&l&&m&&u&&g&&(await i.addCollectible({collectibleInfoParams:{chainId:a.chainId,address:l,tokenId:u,contractType:g},collectibleInfoResponse:m}),A(!1),o({variant:"success",title:g===zHe.ERC721?"ERC721 collectible added successfully":"ERC1155 collectible added successfully",description:"You'll be able to see this collectible on your browser as long as you don't clear your cache."}),I(),t())},I=()=>{f(void 0),c(void 0),h(void 0),y(void 0)};return j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Import ERC721 or ERC1155 Collectible"}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Collectible Network"}),j.jsx(V_,{name:"collectibleNetwork",options:L,onValueChange:U=>c(r.find(ie=>ie.chainId===Number(U)))})]}),j.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Collectible Address"}),j.jsxs(ye,{flexDirection:"row",gap:"1",paddingBottom:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text50",children:"See addresses on network's"}),j.jsx(Te,{variant:"normal",color:"text50",underline:!!P,cursor:P?"pointer":"default",onClick:()=>{P&&window.open(P)},children:"directory"})]}),j.jsx(Sn,{name:"collectibleAddress",value:l??"",onChange:U=>{f(U.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Collectible Type"}),j.jsx(V_,{name:"collectibleType",options:[{value:"ERC721",label:"ERC721"},{value:"ERC1155",label:"ERC1155"}],onValueChange:U=>y(U)})]}),j.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Collectible Token ID"}),j.jsx(Sn,{name:"collectibleTokenId",value:u??"",onKeyPress:U=>{/[0-9]/.test(U.key)||U.preventDefault()},onChange:U=>{if(U.target.value===""){h(void 0);return}h(U.target.value)}})]})]}),s&&j.jsx(ye,{alignItems:"center",justifyContent:"center",children:j.jsx(Q1,{size:"lg"})}),m&&!m.isOwner&&!s&&j.jsx(ye,{alignItems:"center",justifyContent:"center",children:j.jsx(Te,{variant:"medium",color:"warning",children:"You do not own this collectible"})}),m&&m.isOwner&&!s&&j.jsxs(vn,{flexDirection:"row",gap:"6",children:[j.jsx(Fi,{src:m.image,style:{width:"120px",height:"auto"}}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"medium",color:"text100",children:m.name??""}),j.jsx(Te,{variant:"small",color:"text80",children:"Your Balance:"}),j.jsx(Te,{variant:"medium",color:"text100",children:Number(Ih(m.balance,m.decimals??0))})]})]})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Kt,{label:"Cancel",size:"md",shape:"square",onClick:t}),j.jsx(Kt,{label:"Add Collectible",variant:"primary",shape:"square",disabled:m===void 0||E,onClick:()=>{V()}})]})]})}function KHe({onSendClick:t}){const e=fr(ase),r=fr(In),n=Wr(e.isFetchingBalances),i=Wr(e.userCollectibles),s=T.useMemo(()=>i,[i]),o=T.useMemo(()=>s.filter(l=>{var f;return!((f=r.networks.get().find(u=>u.chainId===l.collectibleInfoParams.chainId))!=null&&f.disabled)}),[s,r]),[a,c]=T.useState(!1);return j.jsxs(ye,{width:"full",children:[j.jsxs(ye,{justifyContent:"space-between",alignItems:"center",children:[j.jsxs(ye,{gap:"2",children:[j.jsx(Fi,{src:HHe,width:"7",height:"7"}),j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Collectibles"})]}),j.jsx(Kt,{size:"sm",leftIcon:$w,label:"Import",shape:"square",onClick:()=>c(!0)})]}),j.jsx(hi,{marginY:"2"}),j.jsx(ye,{width:"full",flexDirection:"column",gap:"4",marginBottom:"8",children:n?j.jsx(ye,{marginTop:"4",alignItems:"center",justifyContent:"center",children:j.jsx(Q1,{size:"lg"})}):j.jsx(j.Fragment,{children:o.length>0?j.jsx(j.Fragment,{children:s.map(l=>j.jsx(ye,{children:j.jsx(GHe,{collectibleInfo:l,onSendClick:()=>{t(l)},onRemoveClick:()=>{e.removeCollectible(l)}})},l.collectibleInfoParams.chainId+l.collectibleInfoParams.address+l.collectibleInfoParams.tokenId))}):j.jsx(vn,{flexDirection:"column",children:j.jsx(Te,{alignSelf:"center",variant:"large",color:"text50",padding:"4",children:"Import ERC721 or ERC1155 Collectibles"})})})}),a&&j.jsx(oa,{size:"sm",onClose:()=>c(!1),children:j.jsx(WHe,{onClose:()=>c(!1)})})]})}function YHe({collectibleInfo:t,onClose:e}){var h,g,y;const r=rm("isMobile"),n=fr(Fr),[i,s]=T.useState(void 0),[o,a]=T.useState(void 0),[c,l]=T.useState(!1);if(T.useEffect(()=>{const m=n.selectedExternalWalletAddress.get();c&&m&&a(n.selectedExternalWalletAddress.get())},[c]),!t)return null;const f=t.collectibleInfoParams.contractType==="ERC721",u=um(t.collectibleInfoParams.chainId);return j.jsxs(ye,{style:{minWidth:r?"100vw":"500px"},children:[j.jsxs(ye,{flexDirection:"column",gap:"6",padding:"6",children:[j.jsxs(Te,{variant:"large",fontWeight:"bold",color:"text100",children:["Sending ",(h=t==null?void 0:t.collectibleInfoResponse)==null?void 0:h.name," on ",u]}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Amount"}),j.jsxs(Te,{variant:"normal",color:"text50",children:["Current Balance:"," ",Ih((g=t==null?void 0:t.collectibleInfoResponse)==null?void 0:g.balance,((y=t==null?void 0:t.collectibleInfoResponse)==null?void 0:y.decimals)??18)]})]}),j.jsx(Sn,{name:"amount",value:f?"1":i??"",disabled:f,onChange:m=>{s(m.target.value)},controls:j.jsx(Kt,{label:"Max",size:"xs",shape:"square",onClick:()=>{var m,S;s(Ih((m=t==null?void 0:t.collectibleInfoResponse)==null?void 0:m.balance,((S=t==null?void 0:t.collectibleInfoResponse)==null?void 0:S.decimals)??18))}})})]}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"To"}),j.jsx(Sn,{name:"to",value:o??"",placeholder:"0x...",disabled:c,onChange:m=>{a(m.target.value)}})]})]}),j.jsx(Kt,{variant:"text",label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(ux,{checked:c,size:"md"}),j.jsx(Te,{variant:"small",color:"text100",children:"Send to connected external wallet address"})]}),onClick:()=>l(!c)})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{alignItems:"center",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Kt,{label:"Cancel",size:"md",shape:"square",onClick:()=>{e()}}),j.jsx(Kt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:f?!o:!o||!i,onClick:()=>{o&&i&&e(o,i)}})]})]})}function QHe({tokenBalance:t,onClose:e}){var u,h;const r=rm("isMobile"),n=fr(Fr),[i,s]=T.useState(void 0),[o,a]=T.useState(void 0),[c,l]=T.useState(!1);if(T.useEffect(()=>{const g=n.selectedExternalWalletAddress.get();c&&g&&a(n.selectedExternalWalletAddress.get())},[c]),!t)return null;const f=um(t.chainId);return j.jsxs(ye,{style:{minWidth:r?"100vw":"500px"},children:[j.jsxs(ye,{flexDirection:"column",gap:"6",padding:"6",children:[j.jsxs(Te,{variant:"large",fontWeight:"bold",color:"text100",children:["Sending ",(u=t==null?void 0:t.contractInfo)==null?void 0:u.symbol," on ",f]}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Amount"}),j.jsxs(Te,{variant:"normal",color:"text50",children:["Current Balance:"," ",Ih(t==null?void 0:t.balance,((h=t==null?void 0:t.contractInfo)==null?void 0:h.decimals)??18)]})]}),j.jsx(Sn,{name:"amount",value:i??"",onChange:g=>{s(g.target.value)},controls:j.jsx(Kt,{label:"Max",size:"xs",shape:"square",onClick:()=>{var g;s(Ih(t==null?void 0:t.balance,((g=t==null?void 0:t.contractInfo)==null?void 0:g.decimals)??18))}})})]}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"To"}),j.jsx(Sn,{name:"to",value:o??"",placeholder:"0x...",disabled:c,onChange:g=>{a(g.target.value)}})]})]}),j.jsx(Kt,{variant:"text",label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(ux,{checked:c,size:"md"}),j.jsx(Te,{variant:"small",color:"text100",children:"Send to connected external wallet address"})]}),onClick:()=>l(!c)})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{alignItems:"center",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Kt,{label:"Cancel",size:"md",shape:"square",onClick:()=>{e()}}),j.jsx(Kt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:!o||!i,onClick:()=>{o&&i&&e(o,i)}})]})]})}const JHe="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='coins'%3e%3cg%20id='Vector'%3e%3cpath%20d='M11.1921%207.78597C11.1921%208.14419%2010.5971%208.69061%209.27961%209.03061C8.55711%209.23097%207.70711%209.33418%206.82068%209.33418C5.94032%209.33418%205.09032%209.23097%204.37389%209.03668C3.04425%208.69061%202.45532%208.15633%202.45532%207.78597C2.45532%207.15454%204.15532%206.23776%206.82068%206.23776C9.49211%206.23776%2011.1921%207.15454%2011.1921%207.78597Z'%20fill='white'/%3e%3cpath%20d='M9.62814%2015.1728C8.78725%2015.3938%207.81704%2015.5109%206.82132%2015.5109C5.82986%2015.5109%204.86207%2015.3944%204.02179%2015.1734C3.16996%2014.9481%202.49361%2014.6263%202%2014.2378V15.9815C2%2017.0865%204.15961%2017.9844%206.82193%2017.9844C9.49032%2017.9844%2011.6499%2017.0865%2011.6499%2015.9815V14.2378C11.1563%2014.6263%2010.48%2014.9481%209.62814%2015.1728Z'%20fill='white'/%3e%3cpath%20d='M9.50732%2010.5956C8.72836%2010.8112%207.79396%2010.9277%206.82071%2010.9277C5.85779%2010.9277%204.92946%2010.8136%204.13532%2010.5987C3.15661%2010.3437%202.43168%209.96298%202%209.50337V11.8512C2%2012.567%202.89796%2013.1887%204.25371%2013.5463C4.99443%2013.7412%205.87964%2013.8542%206.82132%2013.8542C7.76907%2013.8542%208.65429%2013.7412%209.39561%2013.5463C10.752%2013.1887%2011.6493%2012.5603%2011.6493%2011.8512V9.49002C11.214%209.95569%2010.4818%2010.3443%209.50732%2010.5956Z'%20fill='white'/%3e%3cpath%20d='M15.8134%204.56107C17.0151%204.25095%2017.5578%203.75254%2017.5578%203.42581C17.5578%202.84988%2016.0072%202.01367%2013.5706%202.01367C11.1395%202.01367%209.58887%202.84988%209.58887%203.42581C9.58887%203.76362%2010.126%204.25095%2011.3388%204.5666C11.9923%204.74381%2012.7676%204.83796%2013.5706%204.83796C14.3791%204.83796%2015.1544%204.74381%2015.8134%204.56107Z'%20fill='white'/%3e%3cpath%20d='M13.5711%2014.1821C14.4793%2014.1821%2015.3643%2014.0752%2016.1313%2013.8737C16.9082%2013.6688%2017.5251%2013.3753%2017.9754%2013.0208V14.6113C17.9754%2015.6192%2016.0056%2016.4382%2013.5717%2016.4382C13.4159%2016.4382%2013.2619%2016.4349%2013.1103%2016.4283C13.153%2016.2336%2013.1755%2016.0314%2013.1755%2015.824V14.1753C13.3067%2014.1798%2013.4387%2014.1821%2013.5711%2014.1821Z'%20fill='white'/%3e%3cpath%20d='M13.1755%2012.7206C13.306%2012.7255%2013.4382%2012.7279%2013.5717%2012.7279C16.0056%2012.7279%2017.9754%2011.9089%2017.9754%2010.901V9.31055C17.5251%209.66497%2016.9082%209.95848%2016.1313%2010.1634C15.3643%2010.365%2014.4793%2010.4718%2013.5711%2010.4718C13.4387%2010.4718%2013.3067%2010.4696%2013.1755%2010.465V12.7206Z'%20fill='white'/%3e%3cpath%20d='M13.1755%208.95334C13.3059%208.95819%2013.4379%208.96067%2013.5711%208.96067C14.4356%208.96067%2015.243%208.85767%2015.9192%208.6799C17.1563%208.35372%2017.9748%207.78056%2017.9748%207.13375V4.98009C17.5778%205.40484%2016.9099%205.75926%2016.0211%205.98853C15.3106%206.18512%2014.4583%206.29144%2013.5706%206.29144C13.3313%206.29144%2013.0943%206.28371%2012.8615%206.2685C13.0621%206.65495%2013.1755%207.09399%2013.1755%207.55951V8.95334Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";function ZHe({onClose:t}){const r=fr(In).networks.get(),n=r.filter(N=>N.type===Mt.MAINNET),i=fr(eC),s=Wr(i.isFetchingTokenInfo),o=tm(),[a,c]=T.useState(),[l,f]=T.useState(),[u,h]=T.useState(),[g,y]=T.useState(!1),[m,S]=T.useState();T.useEffect(()=>{var N,L;a&&S((L=(N=r.find(V=>V.chainId===a.chainId))==null?void 0:N.blockExplorer)==null?void 0:L.rootUrl),a&&l?i.getTokenInfo(a.chainId,l).then(V=>{h(V)}):h(void 0)},[a,l]);const E=n.filter(N=>!N.disabled).map(N=>({label:N.title,value:N.chainId.toString()})),A=async()=>{a&&l&&u&&(y(!0),await i.addToken({chainId:a.chainId,address:l,contractType:Ph.ERC20,symbol:u.symbol,decimals:u.decimals}),y(!1),o({variant:"success",title:"ERC20 token added sucessfully",description:"You'll be able to see this token on your browser as long as you don't clear your cache."}),P(),t())},P=()=>{f(void 0),c(void 0)};return j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Import Token"}),j.jsxs(ye,{flexDirection:"column",children:[j.jsx(ye,{flexDirection:"row",style:{paddingBottom:"5px"},children:j.jsxs(ye,{children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",paddingY:"2",paddingX:"4",children:"ERC20 Token"}),j.jsx(hi,{color:"white",height:"0.5",position:"relative",marginY:"0",style:{top:"6px"}})]})}),j.jsx(hi,{marginY:"0"})]}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Token Network"}),j.jsx(V_,{name:"tokenNetwork",options:E,onValueChange:N=>c(r.find(L=>L.chainId===Number(N)))})]}),j.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Token Address"}),j.jsxs(ye,{flexDirection:"row",gap:"1",paddingBottom:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text50",children:"See addresses on network's"}),j.jsx(Te,{variant:"normal",color:"text50",underline:!!m,cursor:m?"pointer":"default",onClick:()=>{m&&window.open(m)},children:"directory"})]}),j.jsx(Sn,{name:"tokenAddress",value:l??"",onChange:N=>{f(N.target.value)}})]})]}),s&&j.jsx(ye,{alignItems:"center",justifyContent:"center",children:j.jsx(Q1,{size:"lg"})}),!s&&u&&j.jsxs(vn,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"medium",color:"text100",children:u.symbol??""}),j.jsx(Te,{variant:"small",color:"text80",children:"Your Balance:"}),j.jsx(Te,{variant:"medium",color:"text100",children:u.balance})]})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Kt,{label:"Cancel",size:"md",shape:"square",onClick:t}),j.jsx(Kt,{label:"Add Token",variant:"primary",shape:"square",disabled:u===void 0||g,onClick:()=>{A()}})]})]})}const XHe=(t,e)=>Math.floor(t*10**e)/10**e;function eGe({disabled:t,tokenBalance:e,onSendClick:r,onRemoveClick:n}){var o,a;const i=Ih(e.balance,((o=e.contractInfo)==null?void 0:o.decimals)??18),s=XHe(Number(i),5);return j.jsxs(vn,{flexDirection:"row",alignItems:"center",gap:"3",children:[j.jsx(DC,{background:"text80",src:hge(e==null?void 0:e.chainId,e==null?void 0:e.contractAddress)}),j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{gap:"2",alignItems:"center",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:((a=e.contractInfo)==null?void 0:a.symbol)??"Native Token"}),j.jsx(FO,{chainId:e.chainId})]}),j.jsx(ye,{children:j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text50",children:s})})]}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",marginLeft:"auto",gap:"2",children:[j.jsx(up,{icon:j.jsx(Fi,{src:cse}),disabled:t,onClick:r}),n&&j.jsx(up,{icon:j.jsx(Tu,{color:"text100"}),onClick:()=>n==null?void 0:n()})]})]})}function tGe({onSendClick:t}){const e=fr(Fr),r=fr(eC),n=fr(In),i=Wr(r.balances),s=Wr(r.isFetchingBalances),o=Wr(e.selectedExternalProvider)!==void 0,[a,c]=T.useState(!1),[l,f]=T.useState(!0),u=T.useMemo(()=>{const g=new Map,y=m=>!l||m.balance!=="0";return i.forEach(m=>{var E;if((E=n.networks.get().find(A=>A.chainId===m.chainId))!=null&&E.disabled)return;const S=`${m.contractAddress}-${m.chainId}`;!g.has(S)&&y(m)&&g.set(S,m)}),Array.from(g.values())},[i,l,s]),h=g=>g.contractType===Ph.NATIVE?void 0:()=>{var y,m;r.removeToken({chainId:g.chainId,address:g.contractAddress,contractType:g.contractType,decimals:(y=g.contractInfo)==null?void 0:y.decimals,symbol:(m=g.contractInfo)==null?void 0:m.symbol})};return j.jsxs(ye,{children:[j.jsxs(ye,{justifyContent:"space-between",alignItems:"center",children:[j.jsxs(ye,{gap:"2",children:[j.jsx(Fi,{src:JHe,width:"7",height:"7"}),j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Coins"})]}),j.jsxs(ye,{gap:"4",children:[j.jsxs(ye,{flexDirection:"row",alignItems:"center",cursor:"pointer",gap:"2",onClick:()=>f(!l),children:[j.jsx(ux,{checked:l}),j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text80",children:"Filter zero balances"})]}),j.jsx(Kt,{size:"sm",leftIcon:$w,label:"Import",shape:"square",onClick:()=>c(!0)})]})]}),j.jsx(hi,{marginY:"2"}),j.jsx(ye,{width:"full",flexDirection:"column",gap:"2",children:s?j.jsx(ye,{marginTop:"4",alignItems:"center",justifyContent:"center",children:j.jsx(Q1,{size:"lg"})}):j.jsx(j.Fragment,{children:u.length>0?j.jsx(j.Fragment,{children:u.map(g=>j.jsx(eGe,{tokenBalance:g,disabled:!o,onSendClick:()=>t(g),onRemoveClick:h(g)},g.contractAddress+g.chainId))}):j.jsx(vn,{flexDirection:"column",children:j.jsx(Te,{alignSelf:"center",variant:"large",color:"text50",padding:"4",children:"Import ERC 20 token address"})})})}),a&&j.jsx(oa,{size:"sm",onClose:()=>c(!1),children:j.jsx(ZHe,{onClose:()=>c(!1)})})]})}const lse=800;function rGe(){const t=Mie(),e=fr(oi),r=fr(eC),n=fr(Fr),i=fr(In),s=fr(kx),o=Wr(e.accountAddress),a=Wr(n.isSigningTxn),c=Wr(n.isSigningMsg),l=Wr(i.networks),f=tm(),u=rm("isMobile"),h=sze();T.useEffect(()=>{o&&l.length>0&&r.loadBalances(o,l)},[o,l]),T.useEffect(()=>{if(h&&h.connected&&!n.selectedExternalProvider.get()){let v=kie(h),b=n.availableExternalProviders.get();b?n.availableExternalProviders.set([v,...b]):n.availableExternalProviders.set([v])}},[h]),T.useEffect(()=>{t.length>0&&n.availableExternalProviders.set(t)},[t]);const[g,y]=T.useState(void 0),[m,S]=T.useState(void 0),[E,A]=T.useState(!1),[P,N]=T.useState(!1),[L,V]=T.useState(!1),I=v=>{S(void 0),n.isSendingCollectibleTransaction.set(void 0),y(v),N(!0)},U=v=>{y(void 0),n.isSendingTokenTransaction.set(void 0),S(v),V(!0)},ie=async(v,b)=>{if(!n.selectedExternalProvider.get()){console.warn("No external provider selected");return}var M;let B;try{if(g)M=g.chainId,B=await n.sendToken(g,v,b);else if(m)M=m.collectibleInfoParams.chainId,B=await n.sendCollectible(m,v,b);else{console.warn("No pending send found");return}}catch(w){w.code===4001&&f({variant:"error",title:"User denied transaction signature."}),console.error(w);return}const x=i.providerForChainId(M),C=await jV(x,B.hash);C&&f({variant:"success",title:"Transaction confirmed",description:"You can view the transaction details on your connected external wallet"}),g&&r.updateTokenBalance(g),y(void 0),S(void 0),n.isSendingTokenTransaction.set(void 0),n.isSendingCollectibleTransaction.set(void 0),console.log("receipt",C)},ae=async(v,b)=>{const M=i.providerForChainId(b);await jV(M,v)&&(n.isSendingSignedTokenTransaction.set(void 0),f({variant:"success",title:"Sign transaction confirmed",description:"You can view the transaction details on your connected external wallet"}))},K=()=>{n.resetSignObservables(),s.rejectRequest(),n.toSignPermission.set("cancelled")};async function R(v){var C;const b=async(w,k)=>{try{const O=await n.getExternalProviderAddress(M);if(!O)throw new Error("No provider address found");return console.log("sendTransaction chainId",k),await n.sendTransaction(B,M,O,w,k)}catch(O){throw n.isSendingSignedTokenTransaction.set(void 0),O}},M=(C=n.selectedExternalProvider.get())==null?void 0:C.provider,B=e.account;let x;if(v)try{n.isSendingSignedTokenTransaction.set(v),x=await b(v.txn,v.chainId),ae(x.hash,v.chainId),n.toSignResult.set(x),n.toSignPermission.set("approved"),n.isSigningTxn.set(!1)}catch(w){throw f({variant:"error",title:"Transaction failed",description:"Please try again."}),n.isSendingSignedTokenTransaction.set(void 0),K(),w}}async function D(v){const b=async(x,C)=>{try{let w;if(x.message)console.log("signMessage chainId",x.chainId),w=await M.signMessage(x.message,x.chainId,x.eip6492?"eip6492":"throw");else if(x.typedData){const k=x.typedData;w=await M.signTypedData(k.domain,k.types,k.message,x.chainId,x.eip6492?"eip6492":"throw")}if(!w)throw new Error("Account sign method failed");return{hash:w}}catch(w){throw w}},M=e.account;let B;if(v)try{B=await b(v.message),n.toSignResult.set(B),n.toSignPermission.set("approved")}catch(x){throw f({variant:"error",title:"Transaction failed",description:"Please try again."}),n.isSendingSignedTokenTransaction.set(void 0),K(),x}}return j.jsxs(ye,{children:[j.jsx(are,{handleNetworkModal:()=>A(!0)}),j.jsx(ye,{justifySelf:"center",flexDirection:"column",padding:"5",width:"full",style:{maxWidth:"800px"},paddingBottom:"20",children:j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{flexDirection:"column",gap:"5",children:[j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text50",children:"External connections"}),j.jsx(jHe,{}),j.jsx(BHe,{})]}),j.jsx(UHe,{paddingY:"5"}),j.jsxs(ye,{flexDirection:"column",gap:"5",children:[j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text50",children:"My Sequence wallet"}),j.jsx(tGe,{onSendClick:I}),j.jsx(KHe,{onSendClick:U})]})]})}),E&&j.jsx(oa,{onClose:()=>{A(!1),i.discardUnsavedNetworkEdits(),i.isAddingNetwork.set(!1)},contentProps:{style:{scrollbarColor:"gray black",scrollbarWidth:"thin"}},children:j.jsx(hte,{})}),a&&j.jsx(oa,{isDismissible:!1,size:"md",contentProps:{style:{width:u?"100%":"800px",maxHeight:"100%",overflowY:"auto"}},children:j.jsx(aze,{onClose:()=>{K()},handleSignTxn:v=>R(v)})}),c&&j.jsx(oa,{isDismissible:!1,size:"md",contentProps:{style:{width:u?"100%":"800px",maxHeight:"90%",overflowY:"auto"}},children:j.jsx(oze,{onClose:v=>{n.isSigningMsg.set(!1),v?D(v):K()}})}),P&&j.jsx(oa,{size:"md",onClose:()=>N(!1),children:j.jsx(QHe,{tokenBalance:g,onClose:(v,b)=>{N(!1),v&&b&&ie(v,b)}})}),L&&j.jsx(oa,{size:"md",onClose:()=>V(!1),children:j.jsx(YHe,{collectibleInfo:m,onClose:(v,b)=>{V(!1),(v&&(m==null?void 0:m.collectibleInfoParams.contractType)==="ERC721"||v&&b)&&ie(v,b)}})})]})}const nGe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Checkmark'%3e%3cpath%20id='Vector%20332%20(Stroke)'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13.0635%204.14864L6.93414%2013.8114L2.99475%209.38482L3.89118%208.58706L6.77296%2011.8253L12.0502%203.50586L13.0635%204.14864Z'%20fill='black'/%3e%3c/g%3e%3c/svg%3e",iGe="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='round%20checkbox'%3e%3cpath%20id='circle'%20d='M1%2016C1%207.71573%207.71573%201%2016%201C24.2843%201%2031%207.71573%2031%2016C31%2024.2843%2024.2843%2031%2016%2031C7.71573%2031%201%2024.2843%201%2016Z'%20stroke='%235D5D5D'%20stroke-width='2'/%3e%3c/g%3e%3c/svg%3e",Wb=8;function sGe({checked:t}){return j.jsx(ye,{width:`${Wb}`,height:`${Wb}`,justifyContent:"center",alignItems:"center",background:t?"white":"transparent",borderRadius:"circle",children:t?j.jsx("img",{src:nGe,alt:"Checkmark",style:{width:"24px",height:"24px"}}):j.jsx("img",{src:iGe,alt:"Empty Round Checkbox",style:{width:`${Wb*4}px`,height:`${Wb*4}px`}})})}function oGe({possibleWallets:t,handleSelectWallet:e}){const[r,n]=T.useState(t[0]),i=2;return j.jsxs(ye,{flexDirection:"column",gap:`${i}`,children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Wallets found"}),t.map(s=>j.jsx(ye,{children:j.jsx(Kt,{shape:"square",width:"full",variant:"text",label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:`${i}`,style:{height:"52px"},children:[j.jsx(sGe,{checked:r===s}),j.jsx(ye,{background:"buttonGlass",borderRadius:"md",alignItems:"center",height:"full",paddingX:"4",style:{width:`${lse-Wb*4-i*4}px`},children:j.jsx(Te,{variant:"normal",color:"text100",style:{fontFamily:"monospace"},children:s})})]}),onClick:()=>{n(s),e(s)}})},s))]})}function aGe(){const t=fr(oi),r=fr(In).networks.get(),[n,i]=T.useState(""),[s,o]=T.useState([]),[a,c]=T.useState(""),[l,f]=T.useState(""),[u,h]=T.useState(""),[g,y]=T.useState(!0),[m,S]=T.useState(!1),[E,A]=T.useState(!1),[P,N]=T.useState(!1),[L,V]=T.useState(!1),[I,U]=T.useState(!1),[ie,ae]=T.useState(!1);T.useEffect(()=>{if(N(!1),!lg(n))return;U(!0);const x=Zt(n);B(x)},[n]);const K=()=>{const x=Zt(n);t.signInWithRecoveryMnemonic(x,a.trim(),l)},R=(x=a)=>x.replace(/\s+/g," ").trim().split(" ").length==12,D=()=>(l==null?void 0:l.length)>=8,v=()=>n?lg(n):!0,b=async x=>{if(i(""),o([]),c(x),ae(!1),!!R(x)){V(!0);try{const C=B4.fromPhrase(x),w=[...(await aT.walletsOfSigner({signer:C.address})).map(({wallet:k})=>k),...(x_e[C.address]??[]).map(({wallet:k})=>k)];o(w),w&&i(w[0])}catch(C){console.error(C)}V(!1)}},M=async x=>{i(x),ae(!1)},B=async x=>{try{const C=B4.fromPhrase(a),w=new JE([C]),G=(await new fx({address:x,tracker:aT,contexts:ite,orchestrator:w,networks:r}).status(ge.MAINNET)).config,X=Ps.genericCoderFor(G.version).config.signersOf(G).some(W=>W.address===C.address);ae(X),X||N(!0)}catch(C){N(!0),console.error("failed to validate wallet address",C)}U(!1)};return j.jsxs(ye,{flexDirection:"column",background:"backgroundPrimary",children:[j.jsx(are,{handleNetworkModal:()=>A(!0)}),j.jsxs(ye,{alignSelf:"center",flexDirection:"column",marginY:"10",gap:"4",width:"full",style:{maxWidth:lse},children:[j.jsx(Kt,{leftIcon:YW,label:"Back",size:"sm",as:JQ,to:"/"}),j.jsxs(ye,{flexDirection:"column",children:[j.jsx(Te,{variant:"xlarge",color:"text100",children:"Recover your wallet"}),j.jsx(hi,{marginY:"6"}),j.jsx(Te,{variant:"normal",color:"text100",children:"Recovery phrase"}),j.jsx(Te,{variant:"normal",color:"text50",marginBottom:"1",children:"Paste your 12-word mnemonic, with each word separated by a space."}),j.jsx(Sn,{name:"mnemonic",value:a,type:g?"text":"password",onChange:x=>b(x.target.value)}),a&&!R()&&j.jsx(Te,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Mnemonic must be 12 words"})]}),j.jsx(Kt,{variant:"text",label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"1",children:[j.jsx(ux,{checked:g}),j.jsx(Te,{variant:"normal",color:"text100",children:"Show secret recovery phrase"})]}),onClick:()=>y(!g)}),j.jsxs(ye,{flexDirection:"column",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Create password"}),j.jsx(Te,{variant:"normal",color:"text50",marginBottom:"1",children:"Encrypt your mnemonic with an 8+ character password."}),j.jsx(Sn,{type:"password",name:"password",value:l,onChange:x=>f(x.target.value)}),l&&!D()&&j.jsx(Te,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Password not long enough"})]}),j.jsxs(ye,{flexDirection:"column",children:[j.jsx(Te,{variant:"normal",color:"text100",marginBottom:"1",children:"Confirm password"}),j.jsx(Sn,{type:"password",name:"confirmPassword",value:u,onChange:x=>h(x.target.value)}),l&&u&&l!==u&&j.jsx(Te,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Passwords must match"})]}),L&&j.jsxs(ye,{alignSelf:"center",alignItems:"center",gap:"1",children:[j.jsx(Q1,{size:"md"}),j.jsx(Te,{variant:"small",color:"text100",children:"Looking for wallet address..."})]}),s.length>0&&j.jsx(oGe,{possibleWallets:s,handleSelectWallet:x=>M(x)}),m&&j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Enter wallet address manually"}),j.jsx(Sn,{name:"wallet",labelLocation:"top",value:n,onChange:x=>M(x.target.value)})]}),I&&j.jsxs(ye,{alignSelf:"center",alignItems:"center",gap:"1",children:[j.jsx(Q1,{size:"md"}),j.jsx(Te,{variant:"small",color:"text100",children:"Checking wallet address..."})]}),(P||!v())&&j.jsx(j.Fragment,{children:P?j.jsx(Te,{variant:"small",color:"negative",children:"No wallet match found. Try again in 10 min or enter a wallet address manually."}):j.jsx(Te,{variant:"small",color:"negative",children:"Invalid wallet address"})}),j.jsxs(ye,{flexDirection:"row",children:[!m&&j.jsx(Kt,{label:"Enter wallet address manually",size:"md",shape:"square",onClick:()=>S(!0)}),j.jsx(Kt,{variant:"primary",size:"md",shape:"square",label:"Recover wallet",marginLeft:"auto",disabled:!a||!lg(n)||!l||l.length<8||l!==u||ie===!1,onClick:()=>{K()}})]})]}),E&&j.jsx(oa,{onClose:()=>A(!1),children:j.jsx(hte,{})})]})}const cGe=()=>{const t=fr(oi),e=Wr(t.accountAddress);return j.jsxs(C5e,{basename:"/",children:[j.jsxs(g5e,{children:[j.jsx(G6,{path:"/",element:e?j.jsx(Z9,{replace:!0,to:"/wallet"}):j.jsx(w_e,{})}),j.jsx(G6,{path:"recovery",element:e?j.jsx(Z9,{replace:!0,to:"/wallet"}):j.jsx(aGe,{})}),j.jsx(G6,{path:"wallet",element:e?j.jsx(rGe,{}):j.jsx(Z9,{replace:!0,to:"/"})})]}),j.jsx(v_e,{})]})},lGe=S6e();Y_.createRoot(document.getElementById("root")).render(j.jsx(qt.StrictMode,{children:j.jsx(_6e,{store:lGe,children:j.jsx(Pwe,{theme:"dark",children:j.jsx(D3e,{children:j.jsx(cGe,{})})})})}));export{_Pe as _}; +`),GVe=t=>Ru(t)?Fe(t):Ai(t),Iie=t=>{const e=GVe(t);return UVe(e)?e:Fe(Vr([k5,Ai(String(e.length)),e]))},WVe=t=>{if(JSON.stringify(t.slice(0,k5.length))!==JSON.stringify(k5))return t;const e=t.slice(k5.length),r=String(e.length).length;let n,i;try{i=Number(J1(e.slice(0,r)))}catch{i=Number(ke(e.slice(0,r)))}return i>e.length||!Number.isInteger(i)?n=r-1:n=r,e.slice(n)},BV=async(t,e,r,n)=>new yt.reader.OnChainReader(n).isValidSignature(t,e,r);async function KVe(t){return Array.isArray(t)?Promise.all(t.map(e=>fi(e))):fi(t)}function YVe(t){return[t,...t.auxiliary||[]]}const QVe=1e4;class JVe{constructor(e,r,n){var i=this;this.account=void 0,this.signerReadyCallbacks=[],this.prompter=void 0,this.networks=void 0,this._openIntent=void 0,this._connectOptions=void 0,this.events=new AVe.EventEmitter2,this.onConnectOptionsChange=void 0,this.promptConnect=async function(s){if(!s&&!i._connectOptions)throw new Error("prompter connect options are empty");if(!i.prompter)return i.connect(s);const o=await i.prompter.promptConnect(s||i._connectOptions).catch(c=>({connected:!1})),a=o;return a.connected&&!a.session&&(a.session=await i.walletSession(s==null?void 0:s.networkId)),o},this.isSignedIn=async function(){return await i.signerReady(),!!i.account},this.getAccount=async function(){if(await i.signerReady(),i.account===void 0)throw new Error("signerReady failed resolve");return i.account},this.account=e,this.prompter=r,this.networks=n}defaultChainId(){var e,r;return(e=(r=this.prompter)==null?void 0:r.getDefaultChainId())!=null?e:this.networks[0].chainId}async signIn(e,r={}){this.setAccount(e);const{connect:n,defaultNetworkId:i}=r;if(n){const a=this._connectOptions;let c;if(this.prompter!==null){var s;c=await((s=this.prompter)==null?void 0:s.promptSignInConnect(a))}else c=await this.connect(a);this.notifyConnect(c),(!a||a.keepWalletOpened!==!0)&&this.notifyClose()}if(i&&this.defaultChainId()!==i){var o;await((o=this.prompter)==null?void 0:o.promptChangeNetwork(i))}}signOut(){this.account&&this.notifyDisconnect(),this.setAccount(null)}signerReset(){this.account=void 0}signerReady(e=QVe){return new Promise((r,n)=>{this.account!==void 0?r():(setTimeout(()=>{this.account===void 0&&(this.signerReadyCallbacks=[],n("signerReady timed out"))},e),this.signerReadyCallbacks.push(r))})}async connect(e){var r,n;if(!this.account)return{connected:!1,chainId:"0x0",error:"unable to connect without signed in account"};const i=(r=(n=e==null?void 0:e.networkId)!=null?n:this.defaultChainId())!=null?r:ge.MAINNET,s=DSe(i).chainId,o={connected:!0,chainId:qc(s)};if(e&&e.authorize){const a={app:e.app,origin:e.origin,expiry:e.expiry,nonce:e.authorizeNonce};try{o.proof=await OVe(this.account,s,a)}catch(c){return bi.warn(`connect, signAuthorization failed for options: ${JSON.stringify(e)}, due to: ${c.message}`),{connected:!1,chainId:"0x0",error:`signAuthorization failed: ${c.message}`}}}return o.session=this.walletSession(s),o}async sendMessageRequest(e){var r;const i=Number(((r=e.clientVersion)==null?void 0:r.split(".")[0])||"0")<2,s={id:e.data.id,jsonrpc:"2.0",result:null,error:void 0};try{const o=await this.request({method:e.data.method,params:e.data.params,chainId:e.chainId,origin:e.origin,projectAccessKey:e.projectAccessKey});return jc({},e,{data:i?jc({},s,{result:o}):o})}catch(o){return jc({},e,{data:i?jc({},s,{error:o}):{error:o}})}}async request(e){await this.getAccount();try{var r,n;if((!this.account||this.account===null)&&!ZVe.includes(e.method))throw jVe;const l=this.account;if(!l)throw new Error("WalletRequestHandler: wallet account is not configured");const f=(r=this.account)==null?void 0:r.providerFor((n=e.chainId)!=null?n:this.defaultChainId());if(!f)throw new Error(`WalletRequestHandler: wallet provider is not configured for chainId ${e.chainId}`);const u=XVe(f)?f:void 0;switch(e.method){case"net_version":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("net_version",[])}case"eth_chainId":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("eth_chainId",[])}case"eth_accounts":return[l.address];case"eth_getBalance":{const[h,g]=e.params,y=await f.getBalance(h,g);return hg(y)}case"sequence_sign":case"personal_sign":case"eth_sign":{let h;switch(e.method){case"sequence_sign":case"personal_sign":{const[S,E]=e.params;h=S;break}case"eth_sign":{const[S,E]=e.params;h=E;break}}let g="";const y=Iie(h),m=e.method==="sequence_sign";if(this.prompter===null){var i;g=await l.signMessage(y,(i=e.chainId)!=null?i:this.defaultChainId(),m?"eip6492":"ignore")}else g=await this.prompter.promptSignMessage({chainId:e.chainId,message:Fe(y),eip6492:m},e.origin,e.projectAccessKey);if(g&&g.length>0)return g;throw new Error("declined by user")}case"sequence_signTypedData_v4":case"eth_signTypedData":case"eth_signTypedData_v4":{const[h,g]=e.params;let y;if(typeof g=="string")try{y=JSON.parse(g)}catch(E){console.warn("walletRequestHandler: error parsing typedData",E)}else y=g;if(!y||!y.domain||!y.types||!y.message)throw new Error("invalid typedData object");let m="";const S=e.method==="sequence_signTypedData_v4";if(this.prompter===null){var s;m=await l.signTypedData(y.domain,y.types,y.message,(s=e.chainId)!=null?s:this.defaultChainId(),S?"eip6492":"ignore")}else m=await this.prompter.promptSignMessage({chainId:e.chainId,typedData:y,eip6492:S},e.origin,e.projectAccessKey);if(m&&m.length>0)return m;throw new Error("declined by user")}case"eth_sendTransaction":{const h=YVe(e.params[0]).map(y=>("gas"in y&&y.gasLimit===void 0&&(y.gasLimit=y.gas,delete y.gas),y));zT(l.address,h);let g="";if(this.prompter===null){var o,a;const y=await l.sendTransaction(h,(o=e.chainId)!=null?o:this.defaultChainId());g=(a=y==null?void 0:y.hash)!=null?a:""}else g=await this.prompter.promptSendTransaction(h,e.chainId,e.origin,e.projectAccessKey);if(g)return g;throw new Error("declined by user")}case"eth_signTransaction":{const[h]=e.params;if(Zt(h.from)!==l.address)throw new Error("sender address does not match wallet");if(zT(l.address,h),this.prompter===null){var c;return await l.signTransactions(h,(c=e.chainId)!=null?c:this.defaultChainId())}else return await this.prompter.promptSignTransaction(h,e.chainId,e.origin,e.projectAccessKey)}case"eth_sendRawTransaction":if(yt.transaction.isSignedTransactionBundle(e.params[0])){const h=Number(e.params[0].chainId);return(await l.relayer(h).relay(e.params[0])).hash}else return(await f.broadcastTransaction(e.params[0])).hash;case"eth_getTransactionCount":{const h=Zt(e.params[0]),g=e.params[1],y=await f.getTransactionCount(h,g);return hg(BigInt(y))}case"eth_blockNumber":return await f.getBlockNumber();case"eth_getBlockByNumber":return await f.getBlock(e.params[0]);case"eth_getBlockByHash":return await f.getBlock(e.params[0]);case"eth_getTransactionByHash":return await f.getTransaction(e.params[0]);case"eth_call":{const[h,g]=e.params;return await f.call(jc({},h,{blockTag:g}))}case"eth_getCode":{const[h,g]=e.params;return await f.getCode(h,g)}case"eth_estimateGas":{const[h]=e.params;return await f.estimateGas(h)}case"eth_gasPrice":{const h=await f.getFeeData();return h.gasPrice===null?null:hg(h.gasPrice)}case"wallet_switchEthereumChain":{const[h]=e.params;if(!h.chainId||h.chainId.length===0)throw new Error("invalid chainId");const g=BigInt(h.chainId);return this.setDefaultChainId(Number(g)),null}case"sequence_getWalletContext":return l.contexts;case"sequence_getWalletConfig":{const[h]=e.params;return h?[(await l.status(h)).onChain.config]:await Promise.all(l.networks.map(async function(g){return(await l.status(g.chainId)).onChain.config}))}case"sequence_getWalletState":{const[h]=e.params;return h?[LV(h,await l.status(h))]:await Promise.all(l.networks.map(async function(g){const y=await l.status(g.chainId);return LV(g.chainId,y)}))}case"sequence_getNetworks":return await this.getNetworks(!0);case"sequence_isSequence":return!0;case"sequence_updateConfig":throw new Error("sequence_updateConfig method is not allowed from a dapp");case"sequence_publishConfig":throw new Error("sequence_publishConfig method is not allowed from a dapp");case"sequence_gasRefundOptions":break;case"sequence_getNonce":break;case"sequence_relay":break;case"sequence_setDefaultNetwork":{const[h]=e.params;if(!h)throw new Error("invalid request, method argument defaultChainId cannot be empty");return this.setDefaultChainId(h),await this.getNetworks(!0)}default:{if(!u)throw new Error("Account provider doesn't support send method");return await u.send(e.method,e.params)}}}catch(l){throw bi.error(l),{message:typeof l=="string"?l:(l==null?void 0:l.message)||"unkown error",code:4001}}}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}async getAddress(){var e,r;return(e=(r=this.account)==null?void 0:r.address)!=null?e:""}get openIntent(){return this._openIntent}setOpenIntent(e){this._openIntent=e}get connectOptions(){return this._connectOptions}setConnectOptions(e){var r;this._connectOptions=e,(r=this.onConnectOptionsChange)==null||r.call(this,e)}async setDefaultChainId(e){var r;return await((r=this.prompter)==null?void 0:r.promptChangeNetwork(e)),this.defaultChainId()}async getNetworks(e){return this.account?e?this.account.networks.map(r=>{const n=jc({},r);return n.provider=void 0,n.relayer=void 0,n}):this.account.networks:(bi.warn("signer not set: getNetworks is returning an empty list"),[])}walletSession(e){if(!this.account)return;const r={walletContext:this.account.contexts,accountAddress:this.account.address,networks:this.account.networks.map(i=>jc({},i,{provider:void 0,relayer:void 0}))};if(e){const i=aw(r.networks,e);if(i){var n;(n=r.networks)==null||n.forEach(s=>delete s.isDefaultChain),i.isDefaultChain=!0}}return r}notifyConnect(e,r){var n;if(console.log("emit connect",e),this.events.emit("connect",e),(n=e.session)!=null&&n.accountAddress){var i;this.events.emit("accountsChanged",[(i=e.session)==null?void 0:i.accountAddress],r)}}notifyDisconnect(e){this.events.emit("accountsChanged",[],e),this.events.emit("disconnect",void 0,e)}notifyChainChanged(e,r){this.events.emit("chainChanged",qc(e),r)}async notifyNetworks(e){const r=e||await this.getNetworks(!0);if(this.events.emit("networks",r),r.length>0){const n=r.find(i=>i.chainId===this.defaultChainId());n&&this.events.emit("chainChanged",qc(n.chainId))}else this.events.emit("chainChanged","0x0")}async notifyWalletContext(){if(!this.account){bi.warn("signer not set: skipping to notify wallet context");return}const e=this.account.contexts;this.events.emit("walletContext",e)}notifyClose(e){this.events.emit("close",e)}setAccount(e){if(this.account=e,e!==void 0){for(let r=0;rl.canOnchainValidate||l.original.version===2&&n,a=await r.status(i);if(o(a))return!0;if(await e.promptConfirmWalletDeploy(i,s)){const l=await r.status(i);return o(l)?!0:(bi.error("WalletRequestHandler: result for promptConfirmWalletDeploy is not correct"),!1)}return!1}}function LV(t,e){return{context:e.original.context,config:e.onChain.config,address:yt.context.addressOf(e.original.context,e.original.imageHash),chainId:t,deployed:e.onChain.deployed,imageHash:e.imageHash,lastImageHash:e.onChain.imageHash,published:!0,status:e}}const ZVe=["net_version","eth_chainId","eth_getBalance","eth_getTransactionCount","eth_blockNumber","eth_getBlockByNumber","eth_getBlockByHash","eth_getTransactionByHash","eth_getCode","eth_estimateGas","eth_gasPrice","sequence_getWalletContext","sequence_getNetworks","sequence_setDefaultNetwork"];function XVe(t){return t&&typeof t=="object"&&typeof t.send=="function"&&typeof t.getNetwork=="function"}function eze(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}class OC{get utils(){return this.provider.utils}constructor(e,r){this.client=e,this.provider=r,this.singleNetworkSigners={},this._isSequenceSigner=!0}async getAddress(){return this.client.getAddress()}connect(e){if(!NO.is(e))throw new Error("SequenceSigner can only be connected to a SequenceProvider");return new OC(this.client,e)}getSigner(e){if(!e)return this;const r=this.provider.toChainId(e);return this.singleNetworkSigners[r]||(this.singleNetworkSigners[r]=new Tie(this.client,this.provider,r)),this.singleNetworkSigners[r]}useChainId(e){return this.provider.toChainId(e)||this.client.getChainId()}async signMessage(e,r){const{eip6492:n=!0}=r||{},i=this.useChainId(r==null?void 0:r.chainId);return this.client.signMessage(e,{eip6492:n,chainId:i})}async signTypedData(e,r,n,i){const{eip6492:s=!0}=i||{},o=this.useChainId(i==null?void 0:i.chainId);return this.client.signTypedData({domain:e,types:r,message:n},{eip6492:s,chainId:o})}getProvider(e){return this.provider.getProvider(e)}async sendTransaction(e,r){const n=this.useChainId(r==null?void 0:r.chainId),i=await KVe(e),s=await this.client.sendTransaction(i,{chainId:n}),o=this.getProvider(n);try{return await new Promise(c=>{(async function f(){const u=await o.getTransaction(s);if(u!==null)return c(u);await o.once("block",f)})()})}catch(a){throw a.transactionHash=s,a}}async getWalletConfig(e){const r=this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}getNetworks(){return this.client.getNetworks()}async getBalance(e,r){return this.getProvider(r==null?void 0:r.chainId).getBalance(this.getAddress(),e)}async estimateGas(e,r){return this.getProvider(r==null?void 0:r.chainId).estimateGas(e)}async call(e,r){return this.getProvider(r==null?void 0:r.chainId).call(e)}getChainId(){return Promise.resolve(this.client.getChainId())}async getFeeData(e){return this.getProvider(e==null?void 0:e.chainId).getFeeData()}async resolveName(e){const r=await this.provider.resolveName(e);if(r===null)throw new Error(`ENS name not found: ${e}`);return r}_checkProvider(e){}getNonce(e){throw new Error("SequenceSigner does not support getNonce")}populateCall(e){throw new Error("SequenceSigner does not support populateCall")}populateTransaction(e){throw new Error("SequenceSigner does not support populateTransaction")}checkTransaction(e){throw new Error("SequenceSigner does not support checkTransaction")}getTransactionCount(e){throw new Error("SequenceSigner does not support getTransactionCount")}signTransaction(e){throw new Error("SequenceWallet does not support signTransaction, use sendTransaction instead.")}static is(e){return e&&typeof e=="object"&&e._isSequenceSigner===!0}}class Tie extends OC{constructor(e,r,n){super(e,r.getProvider(n)),this.chainId=n,this._isSingleNetworkSequenceSigner=!0}_useChainId(e){const r=this.provider.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This signer only supports the network ${this.chainId}, but ${r} was requested.`);return r||this.provider.toChainId(this.chainId)}useChainId(e){return this._useChainId(e)}getChainId(){return Promise.resolve(this.provider.toChainId(this.chainId))}getProvider(e){return super.getProvider(this._useChainId(e))}getSigner(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceSigner===!0}}class tze{constructor(e){if(this.signer=e,Tie.is(e))throw new Error("WalletUtils does not support SingleNetworkSequenceSigner")}signMessage(e,r,n){return this.signer.signMessage(e,{chainId:r,eip6492:n})}signTypedData(e,r,n,i,s){return this.signer.signTypedData(e,r,n,{chainId:i,eip6492:s})}async isValidSignature(e,r,n,i){return BV(e,r,n,this.signer.getProvider(i))}async isValidMessageSignature(e,r,n,i){const s=this.signer.getProvider(i),o=Iie(r),a=S9e(o);return BV(e,a,n,s)}isValidTypedDataSignature(e,r,n,i){return this.isValidSignature(e,fM(r),n,i)}}const rze=["method"],FV=["connect","disconnect","chainChanged","accountsChanged"];class NO extends hX{constructor(e,r,n=TM,i){super(e.getChainId(),i),this.client=e,this.providerFor=r,this.networks=n,this.options=i,this.singleNetworkProviders={},this._isSequenceProvider=!0,this.utils=void 0,this.signer=void 0,this.eip1193EventListeners=new Map,e.onConnect(s=>{var o;(o=this.eip1193EventListeners.get("connect"))==null||o.forEach(a=>a(s))}),e.onDisconnect(s=>{var o;(o=this.eip1193EventListeners.get("disconnect"))==null||o.forEach(a=>a(s))}),e.onDefaultChainIdChanged(s=>{var o;(o=this.eip1193EventListeners.get("chainChanged"))==null||o.forEach(a=>a(s))}),e.onAccountsChanged(s=>{var o;(o=this.eip1193EventListeners.get("accountsChanged"))==null||o.forEach(a=>a(s))}),this.signer=new OC(this.client,this),this.utils=new tze(this.signer)}async on(e,r){if(FV.includes(e)){const n=this.eip1193EventListeners.get(e)||new Set;return n.add(r),this.eip1193EventListeners.set(e,n),this}return super.on(e,r)}async off(e,r){if(FV.includes(e)){const n=this.eip1193EventListeners.get(e);return n&&(r?n.delete(r):n.clear()),this}return super.off(e,r)}getSigner(e){return this.signer.getSigner(e)}connect(e){return this.client.connect(e)}disconnect(){return this.client.disconnect()}isConnected(){return this.client.isConnected()}getSession(){return this.client.getSession()}listAccounts(){return[this.client.getAddress()]}getAddress(){return this.client.getAddress()}getNetworks(){return this.client.getNetworks()}getChainId(){return this.client.getChainId()}setDefaultChainId(e){return this.client.setDefaultChainId(this.toChainId(e))}isOpened(){return this.client.isOpened()}closeWallet(){return this.client.closeWallet()}getWalletContext(){return this.client.getWalletContext()}async getWalletConfig(e){const r=await this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}authorize(e){return this.client.connect(jc({},e,{authorize:!0}))}async openWallet(e,r){return await this.client.openWallet(e,r),!0}toChainId(e){if(e===void 0)return;const r=aw(this.networks,e);if(!r)throw new Error(`Unsupported network ${e}`);return r.chainId}async useChainId(e){return this.toChainId(e)||this.client.getChainId()}getProvider(e){if(!e)return this;const r=this.toChainId(e);return this.singleNetworkProviders[r]||(this.singleNetworkProviders[r]=new nze(this.client,this.providerFor,r,this.options)),this.singleNetworkProviders[r]}async _getSubprovider(e){const r=await this.useChainId(e),n=this.providerFor(r);if(!n)throw new Error(`Unsupported network ${r}`);return n}async _perform(e){var r;const{method:n}=e,i=eze(e,rze),s=await this._getSubprovider(),o=(r=s.getRpcRequest(e))!=null?r:{method:n,args:Object.values(i)};if(!o)throw new Error(`Unsupported method ${e.method}`);return s.send(o.method,o.args)}async perform(e,r){if(e==="eth_chainId")return qc(await this.useChainId());if(e==="eth_accounts")return[this.client.getAddress()];if(e==="wallet_switchEthereumChain"){const n=r[0],i=Pie(n);return this.setDefaultChainId(i)}return e==="eth_sendTransaction"||e==="eth_sign"||e==="eth_signTypedData"||e==="eth_signTypedData_v4"||e==="personal_sign"||e==="sequence_sign"||e==="sequence_signTypedData_v4"?this.client.request({method:e,params:r,chainId:this.getChainId()}):this._perform(jc({method:e},r))}send(e,r){return this.perform(e,r)}request(e){return this.perform(e.method,e.params)}async _detectNetwork(){const e=this.client.getChainId(),r=aw(this.networks,e);if(!r)throw new Error(`Unknown network ${e}`);return new ca(r.name,r.chainId)}async detectNetwork(){return this._detectNetwork()}async waitForTransaction(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).waitForTransaction(e,r,n)}async getBlockNumber(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getBlockNumber()}async getFeeData(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getFeeData()}async getBalance(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBalance(e,r)}async getTransactionCount(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getTransactionCount(e,r)}async getCode(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getCode(e,r)}async getStorage(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).getStorage(e,r,n)}async call(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).call(e)}async estimateGas(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).estimateGas(e)}async getBlock(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBlock(e,r)}async getTransaction(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getTransaction(e)}async getLogs(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getLogs(e)}async supportsENS(){return(await this.getNetworks()).some(r=>r.chainId===1)}async getResolver(e){return await this.supportsENS()?(await this._getSubprovider(1)).getResolver(e):null}async resolveName(e){return lg(e)?e:await this.supportsENS()?(await this._getSubprovider(1)).resolveName(e):null}async lookupAddress(e){return await this.supportsENS()?(await this._getSubprovider(1)).lookupAddress(e):null}async getAvatar(e){return await this.supportsENS()?(await this._getSubprovider(1)).getAvatar(e):null}}NO.is=t=>t&&typeof t=="object"&&t._isSequenceProvider===!0;function Pie(t){return typeof t=="object"?Pie(t.chainId):Number(t)}class nze extends NO{constructor(e,r,n,i){super(e,r,void 0,i),this.chainId=n,this._isSingleNetworkSequenceProvider=!0}_useChainId(e){const r=this.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This provider only supports the network ${this.chainId}, but ${r} was requested.`);return r||super.toChainId(this.chainId)}useChainId(e){return Promise.resolve(this._useChainId(e))}getChainId(){return super.toChainId(this.chainId)}async getNetwork(){const e=await this.client.getNetworks(),r=aw(e,this.chainId);if(!r)throw new Error(`Unsupported network ${this.chainId}`);return new ca(r.name,r.chainId)}getProvider(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}getSigner(e){return super.getSigner(this._useChainId(e))}setDefaultChainId(e){throw new Error(`This provider only supports the network ${this.chainId}; use the parent provider to switch networks.`)}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceProvider===!0}}class Fr{constructor(e){ue(this,"toast",tm());ue(this,"networkStore",fr(In));ue(this,"authStore",fr(oi));ue(this,"accountAddress",this.authStore.accountAddress.get());ue(this,"availableExternalProviders",_r([]));ue(this,"selectedExternalProvider",_r(void 0));ue(this,"selectedExternalWalletAddress",_r(void 0));ue(this,"isSendingTokenTransaction",_r(void 0));ue(this,"isSendingCollectibleTransaction",_r(void 0));ue(this,"isSendingSignedTokenTransaction",_r(void 0));ue(this,"connectDetails",_r(void 0));ue(this,"connectOptions",_r(void 0));ue(this,"isSigningTxn",_r(!1));ue(this,"isSigningMsg",_r(!1));ue(this,"toSignPermission",_r(void 0));ue(this,"toSignResult",_r(void 0));ue(this,"toSignTxnDetails",_r(void 0));ue(this,"toSignMsgDetails",_r(void 0));ue(this,"isCheckingWalletDeployment",_r(!1));ue(this,"walletNotDeployed",_r(!1));ue(this,"walletRequestHandler");ue(this,"local",{lastConnectedExternalProviderInfo:new hu(Ul.LAST_CONNECTED_EXTERNAL_PROVIDER_INFO)});ue(this,"defaultNetwork",new hu(Ul.DEFAULT_NETWORK));ue(this,"getLastConnectedExternalProviderInfo",()=>this.local.lastConnectedExternalProviderInfo.get());ue(this,"sendToken",async(e,r,n)=>{var i,s;try{const o=this.store.get(oi).account,a=e.chainId;if(!o)throw new Error("No account found");const c=this.store.get(In).providerForChainId(a);this.isSendingTokenTransaction.set({tokenBalance:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let h;if(!n)return{hash:""};if(e.contractType===Ph.NATIVE?(console.info("Sending native token with address, on chainId: ",e.contractAddress,a),h={to:r,value:p4e(n)}):e.contractType===Ph.ERC20&&(console.info("Sending ERC20 token with address, on chainId: ",e.contractAddress,a),h=await new Si(e.contractAddress,v5,c).transfer.populateTransaction(r,sI(n,((s=e.contractInfo)==null?void 0:s.decimals)??18))),!h)throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,h,a)).hash}catch(y){throw this.isSendingTokenTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction")}});ue(this,"sendCollectible",async(e,r,n)=>{var i,s;try{const o=this.store.get(oi).account,a=e.collectibleInfoParams.chainId;if(!o)throw new Error("No account found");const c=this.store.get(In).providerForChainId(a);this.isSendingCollectibleTransaction.set({collectibleInfo:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let h;if(e.collectibleInfoParams.contractType==="ERC721")console.info("Sending ERC721 non-fungible token with address, on chainId: ",e.collectibleInfoParams.address,a),h=await new Si(e.collectibleInfoParams.address,fte,c).safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId);else if(e.collectibleInfoParams.contractType==="ERC1155"){console.info("Sending ERC1155 token with address, on chainId: ",e.collectibleInfoParams.address,a);const y=new Si(e.collectibleInfoParams.address,ute,c);if(!n)return{hash:""};h=await y.safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId,sI(n,((s=e==null?void 0:e.collectibleInfoResponse)==null?void 0:s.decimals)??18),"0x")}if(!h)throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,h,a)).hash}catch(y){throw this.isSendingCollectibleTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction")}});ue(this,"setExternalProvider",async(e,r)=>{if(!e){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0),this.local.lastConnectedExternalProviderInfo.set(void 0);return}const i=(await this.getExternalProviderAccounts(e.provider))[0];this.local.lastConnectedExternalProviderInfo.set(e.info),this.selectedExternalProvider.set(e),this.selectedExternalWalletAddress.set(i),r||this.toast({variant:"success",title:"External wallet added successfully",description:"You can now relay transactions."}),e.provider.on("accountsChanged",async s=>{if(s.length===0){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0);return}if(s[0]!==i){const a=(await this.getExternalProviderAccounts(e.provider))[0];this.selectedExternalWalletAddress.set(a)}})});ue(this,"resetSignObservables",()=>{this.isSigningTxn.set(!1),this.toSignTxnDetails.set(void 0),this.toSignMsgDetails.set(void 0),this.toSignPermission.set(void 0),this.toSignResult.set(void 0)});ue(this,"checkWalletDeployment",async e=>{const r=this.store.get(oi).account;if(!r)throw new Error("No account found");return(await r.status(e)).onChain.deployed});this.store=e,this.walletRequestHandler=new JVe(void 0,new ize(e),this.networkStore.networks.get()),this.walletRequestHandler.onConnectOptionsChange=n=>{this.connectOptions.set(n)},this.availableExternalProviders.subscribe(n=>{const i=this.local.lastConnectedExternalProviderInfo.get(),s=n.find(o=>(i==null?void 0:i.name)===o.info.name);s&&this.setExternalProvider(s,!0)});const r=this.store.get(oi).account;this.walletRequestHandler.signIn(r??null)}async sendTransaction(e,r,n,i,s){const o=await e.status(s),a=await e.predecorateTransactions(i,o,s),c=await e.signTransactions(a,s,void 0,{serial:!0}),l=await e.decorateTransactions(c,o);await this.switchToChain(r,s);const f=await r.request({method:"eth_estimateGas",params:[{from:n,to:l.entrypoint,data:yt.transaction.encodeBundleExecData(l)}]});return{hash:await r.request({method:"eth_sendTransaction",params:[{from:n,to:l.entrypoint,data:yt.transaction.encodeBundleExecData(l),gas:f}]})}}async getExternalProviderAccounts(e){return new Promise((r,n)=>{var i;(i=e.sendAsync)==null||i.call(e,{method:"eth_requestAccounts",params:[]},(s,o)=>{s&&n(s),o.result.length===0&&n(new Error("No accounts found")),r(o.result)})})}async getExternalProviderAddress(e){return(await this.getExternalProviderAccounts(e))[0]}async switchToChain(e,r){return new Promise((n,i)=>{var s;(s=e.sendAsync)==null||s.call(e,{method:"wallet_switchEthereumChain",params:[{chainId:qc(r)}]},(o,a)=>{o&&i(o),n(a)})})}}class ize{constructor(e){this.store=e}getDefaultChainId(){return this.store.get(Fr).defaultNetwork.get()??1}async promptChangeNetwork(e){return this.store.get(In).networks.get().some(n=>n.chainId===e)?(this.store.get(Fr).defaultNetwork.set(Number(e)),!0):!1}async promptConfirmWalletDeploy(e,r){if(console.log("prompt confirm wallet deploy:",e,r),!e)return Promise.resolve(!1);const n=await this.store.get(Fr).checkWalletDeployment(e);return new Promise((i,s)=>{i(!!n)})}async promptConnect(e){console.log("promptconnect",e);const r=this.store.get(oi).account;return await this.store.get(Fr).walletRequestHandler.signIn(r??null),e&&this.store.get(Fr).walletRequestHandler.setConnectOptions(e),new Promise((n,i)=>{const s=this.store.get(Fr).connectDetails.subscribe(o=>{s(),!o||!o.connected?i("connect cancelled by user"):n(o)})})}async promptSignInConnect(e){return console.log("prompt sign in connect:",e),{connected:!1}}async promptSignMessage(e,r){return console.log("prompt sign message:",e,r),e.chainId?e.eip6492!==!0&&!(await this.store.get(oi).account.status(e.chainId)).canOnchainValidate&&!await this.promptConfirmWalletDeploy(e.chainId,r)?(this.store.get(Fr).walletNotDeployed.set(!0),Promise.reject("User rejected wallet deploy request")):(this.store.get(Fr).isSigningMsg.set(!0),this.store.get(Fr).toSignMsgDetails.set({message:e,chainId:e.chainId,origin:r}),new Promise((n,i)=>{const s=this.store.get(Fr).toSignPermission.subscribe(()=>{s();const o=this.store.get(Fr).toSignPermission.get();if(this.store.get(Fr).toSignPermission.set(void 0),!o||o==="cancelled")i("request failed");else{const a=this.store.get(Fr).toSignResult.get();a&&n(a.hash)}})})):Promise.reject("No chainId found in message")}promptSignTransaction(e,r,n,i){console.log("prompt sign transaction:",e,r,n,i);let s;Array.isArray(e)?s=e:s=[e];const o=this.store.get(oi).accountAddress.get();if(!o)throw new Error("Unknown account address");const a=yt.transaction.fromTransactionish(o,s);return console.log("prompt sign txn:",a,r,n,i),zT(o,s),new Promise((c,l)=>{this.store.get(Fr).toSignTxnDetails.set({txn:s,chainId:Number(r),origin:n,projectAccessKey:i}),this.store.get(Fr).isSigningTxn.set(!0);const f=this.store.get(Fr).toSignPermission.subscribe(()=>{f();const u=this.store.get(Fr).toSignPermission.get();if(this.store.get(Fr).toSignPermission.set(void 0),!u||u==="cancelled")l("request failed");else{const h=this.store.get(Fr).toSignResult.get();h&&c(h.hash)}})})}promptSendTransaction(e,r,n,i){return this.promptSignTransaction(e,r,n,i)}}const kie=t=>({info:{walletId:"",uuid:"",name:"WalletConnect",icon:"https://avatars.githubusercontent.com/u/37784886"},provider:t});async function Rie(t){return await CVe.init({projectId:ste,showQrModal:t,optionalChains:[1],metadata:{name:"Sequence Recovery Wallet External Wallet",description:"",url:"https://recovery.sequence.app",icons:[]}})}function sze(){const[t,e]=T.useState(null),n=fr(Fr).getLastConnectedExternalProviderInfo();return T.useEffect(()=>{async function i(){const s=await Rie(!1);await s.enable(),e(s)}return(n==null?void 0:n.name)==="WalletConnect"&&i(),()=>{t&&t.disconnect()}},[]),t}const jV=async(t,e,r=15)=>{let n,i=0;do{if(i>5&&await new Promise(s=>setTimeout(s,100*i)),n=await t.getTransactionReceipt(e),i===r){console.warn(`Could not get receipt for transaction ${e} after ${i} tries`);return}if(n)return n;i++}while(!n&&i<=r)};let S6=[];const b7={value:()=>S6,subscribe:t=>{function e(r){S6.some(n=>n.info.uuid===r.detail.info.uuid)||(S6=[...S6,r.detail],t())}return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}},Mie=()=>T.useSyncExternalStore(b7.subscribe,b7.value,b7.value);class kx{constructor(e){ue(this,"authStore",fr(oi));ue(this,"accountAddress",this.authStore.accountAddress.get());ue(this,"isReady",_r(!1));ue(this,"signClient");ue(this,"currentRequestInfo");ue(this,"allSessions",_r([]));ue(this,"sessions",this.allSessions.readOnly());ue(this,"createSignClient",async()=>{this.signClient=await MC.init({projectId:ste,metadata:{name:"Sequence Recovery Wallet",description:"Sequence Recovery Wallet - Recover Your Wallet",url:"https://recovery.sequence.app",icons:["https://sequence.app/apple-touch-icon.png"]}}),this.signClient.on("session_proposal",this.onSessionProposal),this.signClient.on("session_request",this.onSessionRequest),this.signClient.on("session_ping",this.onSessionPing),this.signClient.on("session_event",this.onSessionEvent),this.signClient.on("session_update",this.onSessionUpdate),this.signClient.on("session_delete",this.onSessionDelete);const e=this.getSignClientSessions();e?this.allSessions.set(e):this.allSessions.set([]),this.isReady.set(!0)});ue(this,"getSignClientSessions",()=>this.signClient.session.getAll().filter(r=>r.self.metadata.name!=="Sequence Recovery Wallet External Wallet"));ue(this,"pair",async e=>{if(!this.signClient)throw new Error("WalletConnect signClient not initialized.");await this.signClient.core.pairing.pair({uri:e}),this.allSessions.set(this.getSignClientSessions())});ue(this,"rejectRequest",()=>{var e;this.currentRequestInfo&&((e=this.signClient)==null||e.respond({topic:this.currentRequestInfo.topic,response:{id:this.currentRequestInfo.id,jsonrpc:"2.0",error:{message:"User rejected.",code:4001}}}))});ue(this,"disconnectSession",async e=>{var n,i;const r=(n=this.signClient)==null?void 0:n.session.get(e);r&&(await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:r.topic,reason:{message:"User disconnected.",code:6e3}})),this.allSessions.set(this.getSignClientSessions()??[]))});ue(this,"disconnectAllSessions",async()=>{var r;(((r=this.signClient)==null?void 0:r.session.getAll())??[]).forEach(async n=>{var i;await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:n.topic,reason:{message:"User disconnected.",code:6e3}}))}),this.allSessions.set([])});ue(this,"onSessionProposal",async e=>{var l,f,u,h,g;console.log("onSessionProposal",e);const r=e.params.requiredNamespaces,n=e.params.optionalNamespaces,i=Object.keys(r).length===0?[]:r.eip155.chains??[],s=Object.keys(n).length===0?[]:n.eip155.chains??[],o=((l=i[0])==null?void 0:l.split(":").pop())??((f=s[0])==null?void 0:f.split(":").pop());if(!o)throw new Error("No chainId found in WalletConnect session proposal namespaces.");const a={app:e.params.proposer.metadata.name,origin:e.params.proposer.metadata.url,networkId:o,keepWalletOpened:!0},c=await this.store.get(Fr).walletRequestHandler.promptConnect(a);if(c&&c.connected){const m=this.store.get(In).networks.get(),S=i.map(I=>Number(I.split(":").pop())),E=s.map(I=>Number(I.split(":").pop())),N={eip155:{accounts:m.map(I=>I.chainId).filter(I=>[...S,...E].includes(I)).map(I=>"eip155:"+I+":"+this.accountAddress),methods:["eth_sendTransaction","eth_sign","personal_sign","eth_signTypedData","eth_signTypedData_v4","wallet_switchEthereumChain"],events:["chainChanged","accountsChanged","connect","disconnect"]}},L=await((u=this.signClient)==null?void 0:u.approve({id:e.id,namespaces:N})),V=await(L==null?void 0:L.acknowledged());console.log("session",V),this.allSessions.set(this.getSignClientSessions()??[]),(h=this.signClient)==null||h.core.pairing.getPairings().filter(I=>e.params.pairingTopic!==I.topic).forEach(async I=>{var U,ie;e.params.proposer.metadata.url===((U=I.peerMetadata)==null?void 0:U.url)&&await((ie=this.signClient)==null?void 0:ie.core.pairing.disconnect({topic:I.topic}))})}else(g=this.signClient)==null||g.reject({id:e.id,reason:{message:"User rejected.",code:5e3}})});ue(this,"onSessionRequest",async e=>{var o,a,c;console.log("onSessionRequest",e);const r=e.params.chainId.split(":").pop(),n={jsonrpc:"2.0",id:e.id,method:e.params.request.method,params:e.params.request.params,chainId:Number(r)};n.method==="eth_sendTransaction"&&Array.isArray(n.params)&&n.params.forEach(l=>{delete l.nonce});const i=(o=this.signClient)==null?void 0:o.session.get(e.topic),s={app:(i==null?void 0:i.peer.metadata.name)??"",origin:i==null?void 0:i.peer.metadata.url,networkId:r};this.store.get(Fr).walletRequestHandler.setConnectOptions(s),this.currentRequestInfo={topic:e.topic,id:e.id};try{const l=await this.store.get(Fr).walletRequestHandler.request(n);(a=this.signClient)==null||a.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",result:l}})}catch(l){(c=this.signClient)==null||c.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",error:{message:l.message,code:l.code??4001}}})}this.currentRequestInfo=void 0});ue(this,"onSessionPing",async e=>{console.log("onSessionPing",e)});ue(this,"onSessionEvent",async e=>{console.log("onSessionEvent",e)});ue(this,"onSessionUpdate",async e=>{console.log("onSessionUpdate",e)});ue(this,"onSessionDelete",async e=>{console.log("onSessionDelete",e),this.allSessions.set(this.getSignClientSessions()??[])});this.store=e,this.createSignClient()}}function oze({onClose:t}){var a;const e=fr(Fr),r=fr(oi),n=e.toSignMsgDetails.get(),i=r.accountAddress.get(),[s,o]=T.useState("");return T.useEffect(()=>{if(n!=null&&n.message.message){const c=WVe(n.message.message);try{o(J1(c))}catch{o(ke(c))}}else n!=null&&n.message.typedData&&o(JSON.stringify(n.message.typedData,void 0,4))},[n]),j.jsx(ye,{children:n&&j.jsxs(j.Fragment,{children:[j.jsxs(ye,{flexDirection:"column",gap:"6",padding:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Would you like to approve this transaction?"}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Origin"}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:(a=n==null?void 0:n.origin)==null?void 0:a.split("//")[1]}),j.jsx(mp,{size:"xs",icon:G8,onClick:()=>window.open(n==null?void 0:n.origin,"_blank"),style:{width:"24px",height:"24px"}})]})]}),j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Network"}),j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:um(Number(n.chainId))})]}),j.jsxs(vn,{flexDirection:"column",gap:"4",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Signee"}),j.jsx(vn,{children:j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",style:{fontFamily:"monospace"},children:`${i}`})})]}),j.jsx(tK,{label:"Message Content",children:j.jsx(vn,{children:j.jsx(Te,{variant:"code",color:"text80",style:{overflowWrap:"anywhere",whiteSpace:"pre-wrap"},children:s})})})]})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{alignItems:"center",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Vt,{label:"Cancel",size:"md",shape:"square",onClick:()=>{t()}}),j.jsx(Vt,{label:"Send",variant:"primary",size:"md",shape:"square",onClick:()=>t(n)})]})]})})}function aze({onClose:t,handleSignTxn:e}){var i;const n=fr(Fr).toSignTxnDetails.get();return T.useEffect(()=>{n&&e(n)},[n]),j.jsx(ye,{children:n&&j.jsxs(j.Fragment,{children:[j.jsxs(ye,{flexDirection:"column",gap:"6",padding:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Waiting for external wallet confirmation"}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Origin"}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:(i=n==null?void 0:n.origin)==null?void 0:i.split("//")[1]}),j.jsx(mp,{size:"xs",icon:G8,onClick:()=>window.open(n==null?void 0:n.origin,"_blank"),style:{width:"24px",height:"24px"}})]})]}),j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Network"}),j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:um(Number(n.chainId))})]}),j.jsx(tK,{label:"Transaction Data",children:j.jsx(ye,{flexDirection:"column",gap:"2",children:n.txn.map((s,o)=>j.jsx(vn,{children:j.jsx(Te,{variant:"code",color:"text80",style:{overflowWrap:"anywhere",whiteSpace:"pre-wrap"},children:JSON.stringify(s,null,4)||"Native token transfer"})},o))})})]})]}),j.jsx(hi,{marginY:"0"}),j.jsx(ye,{alignItems:"center",justifyContent:"flex-end",padding:"6",gap:"2",children:j.jsx(Vt,{label:"Ignore transaction",size:"md",shape:"square",onClick:()=>{t()}})})]})})}const up=({icon:t,onClick:e,disabled:r=!1})=>j.jsx(Vt,{shape:"square",borderRadius:"sm",disabled:r,onClick:()=>{r||e()},label:j.jsx(ye,{justifyContent:"center",alignItems:"center",children:j.jsx(ye,{position:"absolute",children:t})}),style:{height:"40px",width:"40px",background:"rgba(255, 255, 255, 0.05)"}}),DC=({src:t,...e})=>j.jsx(ye,{justifyContent:"center",alignItems:"center",borderRadius:"sm",style:{height:"44px",width:"44px"},...e,children:j.jsx(Fi,{width:"10",height:"10",src:t,borderRadius:"xs"})});function cze({sessionList:t}){const e=fr(kx);return j.jsx(j.Fragment,{children:t.map((r,n)=>j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"2",children:[j.jsxs(ye,{alignItems:"center",gap:"4",children:[j.jsx(DC,{background:"text80",src:r.peer.metadata.icons[0]}),j.jsx(Te,{variant:"medium",color:"text100",children:r.peer.metadata.name?r.peer.metadata.name:r.peer.metadata.url})]}),j.jsxs(ye,{gap:"2",children:[r.peer.metadata.url&&j.jsx(up,{icon:j.jsx(G8,{color:"text100"}),onClick:()=>window.open(r.peer.metadata.url,"_blank")}),j.jsx(up,{icon:j.jsx(Tu,{color:"text100"}),onClick:()=>e.disconnectSession(r.topic)})]})]},n))})}const lze="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Link-Connection'%3e%3cg%20id='Vector'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5.65098%205.00098L5.65098%2012.5868C5.65098%2012.8986%206.02798%2013.0547%206.24846%2012.8343L12.8342%206.24846C13.8737%205.20902%2015.651%205.9452%2015.651%207.41519V15.001H14.351V7.41519C14.351%207.10337%2013.974%206.94722%2013.7535%207.1677L7.1677%2013.7535C6.12826%2014.7929%204.35098%2014.0568%204.35098%2012.5868L4.35098%205.00098H5.65098Z'%20fill='white'/%3e%3cpath%20d='M5.00065%202.03125C3.3607%202.03125%202.03125%203.3607%202.03125%205.00065C2.03125%206.64061%203.3607%207.97005%205.00065%207.97005C6.64061%207.97005%207.97005%206.64061%207.97005%205.00065C7.97005%203.3607%206.64061%202.03125%205.00065%202.03125Z'%20fill='white'/%3e%3cpath%20d='M14.9997%2012.0312C13.3597%2012.0312%2012.0303%2013.3607%2012.0303%2015.0007C12.0303%2016.6406%2013.3597%2017.9701%2014.9997%2017.9701C16.6396%2017.9701%2017.9691%2016.6406%2017.9691%2015.0007C17.9691%2013.3607%2016.6396%2012.0312%2014.9997%2012.0312Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Oie="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Warning'%3e%3cpath%20id='Subtract'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M18%2017.4267L9.99998%203.57031L2%2017.4267H18ZM10.6778%2013.0944V7.32511H9.21569V13.0944H10.6778ZM9.94669%2016.1808C10.5481%2016.1808%2011.0356%2015.6933%2011.0356%2015.0919C11.0356%2014.4905%2010.5481%2014.003%209.94669%2014.003C9.3453%2014.003%208.85777%2014.4905%208.85777%2015.0919C8.85777%2015.6933%209.3453%2016.1808%209.94669%2016.1808Z'%20fill='%236D6D6D'/%3e%3c/g%3e%3c/svg%3e";function fze({onClose:t}){var l;const e=rm("isMobile"),r=fr(Fr),n=Wr(r.connectOptions),i=tm(),[s,o]=T.useState(!1),a=async()=>{if(s)return;o(!0);const f=await r.walletRequestHandler.connect(n);r.connectDetails.set(f),o(!1),i({variant:"success",title:"Dapp connection added successfully",description:"You can now receive dapp action requests."}),t()},c=()=>{r.connectDetails.set({connected:!1}),t()};return j.jsxs(ye,{style:{minWidth:e?"100vw":"500px"},children:[j.jsxs(ye,{flexDirection:"column",gap:"6",padding:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Would you like to connect to this dapp?"}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Origin"}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:(l=n==null?void 0:n.origin)==null?void 0:l.split("//")[1]}),j.jsx(mp,{size:"xs",icon:G8,onClick:()=>window.open(n==null?void 0:n.origin,"_blank"),style:{width:"24px",height:"24px"}})]})]}),j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"Network"}),j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:um(Number(n==null?void 0:n.networkId))})]})]})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{alignItems:"center",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Vt,{label:"Cancel",size:"md",shape:"square",onClick:()=>c()}),j.jsx(Vt,{label:s?"Authorizing…":"Connect",variant:"primary",size:"md",shape:"square",disabled:s,onClick:()=>a()})]})]})}var Die={},$o={};Object.defineProperty($o,"__esModule",{value:!0});$o.compactObject=Lie;$o.deprecated=bze;var uze=$o.detectBrowser=wze;$o.disableLog=gze;$o.disableWarnings=yze;$o.extractVersion=R5;$o.filterStats=xze;$o.log=mze;$o.walkStats=d8;$o.wrapPeerConnectionEvent=vze;function dze(t,e,r){return e=hze(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hze(t){var e=pze(t,"string");return Bh(e)=="symbol"?e:e+""}function pze(t,e){if(Bh(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Bh(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Bh(t){"@babel/helpers - typeof";return Bh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bh(t)}var Nie=!0,Bie=!0;function R5(t,e,r){var n=t.match(e);return n&&n.length>=r&&parseInt(n[r],10)}function vze(t,e,r){if(t.RTCPeerConnection){var n=t.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(o,a){if(o!==e)return i.apply(this,arguments);var c=function(f){var u=r(f);u&&(a.handleEvent?a.handleEvent(u):a(u))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,c),i.apply(this,[o,c])};var s=n.removeEventListener;n.removeEventListener=function(o,a){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(a))return s.apply(this,arguments);var c=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,c])},Object.defineProperty(n,"on"+e,{get:function(){return this["_on"+e]},set:function(a){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),a&&this.addEventListener(e,this["_on"+e]=a)},enumerable:!0,configurable:!0})}}function gze(t){return typeof t!="boolean"?new Error("Argument type: "+Bh(t)+". Please use a boolean."):(Nie=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function yze(t){return typeof t!="boolean"?new Error("Argument type: "+Bh(t)+". Please use a boolean."):(Bie=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function mze(){if((typeof window>"u"?"undefined":Bh(window))==="object"){if(Nie)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function bze(t,e){Bie&&console.warn(t+" is deprecated, please use "+e+" instead.")}function wze(t){var e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;var r=t.navigator;if(r.userAgentData&&r.userAgentData.brands){var n=r.userAgentData.brands.find(function(i){return i.brand==="Chromium"});if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(r.mozGetUserMedia)e.browser="firefox",e.version=R5(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=R5(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=R5(r.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function UV(t){return Object.prototype.toString.call(t)==="[object Object]"}function Lie(t){return UV(t)?Object.keys(t).reduce(function(e,r){var n=UV(t[r]),i=n?Lie(t[r]):t[r],s=n&&!Object.keys(i).length;return i===void 0||s?e:Object.assign(e,dze({},r,i))},{}):t}function d8(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(function(n){n.endsWith("Id")?d8(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(function(i){d8(t,t.get(i),r)})}))}function xze(t,e,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;var s=[];return t.forEach(function(o){o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(function(o){t.forEach(function(a){a.type===n&&a.trackId===o.id&&d8(t,a,i)})}),i}Object.defineProperty(Die,"__esModule",{value:!0});var Eze=Die.shimGetUserMedia=Sze,Cze=Aze($o);function Fie(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Fie=function(i){return i?r:e})(t)}function Aze(t,e){if(t&&t.__esModule)return t;if(t===null||Md(t)!="object"&&typeof t!="function")return{default:t};var r=Fie(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Md(t){"@babel/helpers - typeof";return Md=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Md(t)}var $V=Cze.log;function Sze(t,e){var r=t&&t.navigator;if(r.mediaDevices){var n=function(l){if(Md(l)!=="object"||l.mandatory||l.optional)return l;var f={};return Object.keys(l).forEach(function(u){if(!(u==="require"||u==="advanced"||u==="mediaSource")){var h=Md(l[u])==="object"?l[u]:{ideal:l[u]};h.exact!==void 0&&typeof h.exact=="number"&&(h.min=h.max=h.exact);var g=function(S,E){return S?S+E.charAt(0).toUpperCase()+E.slice(1):E==="deviceId"?"sourceId":E};if(h.ideal!==void 0){f.optional=f.optional||[];var y={};typeof h.ideal=="number"?(y[g("min",u)]=h.ideal,f.optional.push(y),y={},y[g("max",u)]=h.ideal,f.optional.push(y)):(y[g("",u)]=h.ideal,f.optional.push(y))}h.exact!==void 0&&typeof h.exact!="number"?(f.mandatory=f.mandatory||{},f.mandatory[g("",u)]=h.exact):["min","max"].forEach(function(m){h[m]!==void 0&&(f.mandatory=f.mandatory||{},f.mandatory[g(m,u)]=h[m])})}}),l.advanced&&(f.optional=(f.optional||[]).concat(l.advanced)),f},i=function(l,f){if(e.version>=61)return f(l);if(l=JSON.parse(JSON.stringify(l)),l&&Md(l.audio)==="object"){var u=function(S,E,A){E in S&&!(A in S)&&(S[A]=S[E],delete S[E])};l=JSON.parse(JSON.stringify(l)),u(l.audio,"autoGainControl","googAutoGainControl"),u(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=n(l.audio)}if(l&&Md(l.video)==="object"){var h=l.video.facingMode;h=h&&(Md(h)==="object"?h:{ideal:h});var g=e.version<66;if(h&&(h.exact==="user"||h.exact==="environment"||h.ideal==="user"||h.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!g)){delete l.video.facingMode;var y;if(h.exact==="environment"||h.ideal==="environment"?y=["back","rear"]:(h.exact==="user"||h.ideal==="user")&&(y=["front"]),y)return r.mediaDevices.enumerateDevices().then(function(m){m=m.filter(function(E){return E.kind==="videoinput"});var S=m.find(function(E){return y.some(function(A){return E.label.toLowerCase().includes(A)})});return!S&&m.length&&y.includes("back")&&(S=m[m.length-1]),S&&(l.video.deviceId=h.exact?{exact:S.deviceId}:{ideal:S.deviceId}),l.video=n(l.video),$V("chrome: "+JSON.stringify(l)),f(l)})}l.video=n(l.video)}return $V("chrome: "+JSON.stringify(l)),f(l)},s=function(l){return e.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},o=function(l,f,u){i(l,function(h){r.webkitGetUserMedia(h,f,function(g){u&&u(s(g))})})};if(r.getUserMedia=o.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(c){return i(c,function(l){return a(l).then(function(f){if(l.audio&&!f.getAudioTracks().length||l.video&&!f.getVideoTracks().length)throw f.getTracks().forEach(function(u){u.stop()}),new DOMException("","NotFoundError");return f},function(f){return Promise.reject(s(f))})})}}}}var jie={};Object.defineProperty(jie,"__esModule",{value:!0});var _ze=jie.shimGetUserMedia=Pze,Ize=Tze($o);function Uie(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Uie=function(i){return i?r:e})(t)}function Tze(t,e){if(t&&t.__esModule)return t;if(t===null||Cg(t)!="object"&&typeof t!="function")return{default:t};var r=Uie(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Cg(t){"@babel/helpers - typeof";return Cg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cg(t)}function Pze(t,e){var r=t&&t.navigator,n=t&&t.MediaStreamTrack;if(r.getUserMedia=function(c,l,f){Ize.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(c).then(l,f)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(l,f,u){f in l&&!(u in l)&&(l[u]=l[f],delete l[f])},s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(c){return Cg(c)==="object"&&Cg(c.audio)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c.audio,"autoGainControl","mozAutoGainControl"),i(c.audio,"noiseSuppression","mozNoiseSuppression")),s(c)},n&&n.prototype.getSettings){var o=n.prototype.getSettings;n.prototype.getSettings=function(){var c=o.apply(this,arguments);return i(c,"mozAutoGainControl","autoGainControl"),i(c,"mozNoiseSuppression","noiseSuppression"),c}}if(n&&n.prototype.applyConstraints){var a=n.prototype.applyConstraints;n.prototype.applyConstraints=function(c){return this.kind==="audio"&&Cg(c)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c,"autoGainControl","mozAutoGainControl"),i(c,"noiseSuppression","mozNoiseSuppression")),a.apply(this,[c])}}}}var vf={};Object.defineProperty(vf,"__esModule",{value:!0});vf.shimAudioContext=jze;vf.shimCallbacksAPI=Dze;vf.shimConstraints=Vie;vf.shimCreateOfferLegacy=Fze;var kze=vf.shimGetUserMedia=Nze;vf.shimLocalStreamsAPI=Mze;vf.shimRTCIceServerUrls=Bze;vf.shimRemoteStreamsAPI=Oze;vf.shimTrackEventTransceiver=Lze;var $ie=Rze($o);function qie(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(qie=function(i){return i?r:e})(t)}function Rze(t,e){if(t&&t.__esModule)return t;if(t===null||Lh(t)!="object"&&typeof t!="function")return{default:t};var r=qie(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Lh(t){"@babel/helpers - typeof";return Lh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lh(t)}function Mze(t){if(!(Lh(t)!=="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){var e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(function(s){return e.call(i,s,n)}),n.getVideoTracks().forEach(function(s){return e.call(i,s,n)})},t.RTCPeerConnection.prototype.addTrack=function(n){for(var i=this,s=arguments.length,o=new Array(s>1?s-1:0),a=1;a=0)){n._remoteStreams.push(s);var o=new Event("addstream");o.stream=s,n.dispatchEvent(o)}})}),e.apply(n,arguments)}}}function Dze(t){if(!(Lh(t)!=="object"||!t.RTCPeerConnection)){var e=t.RTCPeerConnection.prototype,r=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,s=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],h=r.apply(this,[u]);return f?(h.then(l,f),Promise.resolve()):h},e.createAnswer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],h=n.apply(this,[u]);return f?(h.then(l,f),Promise.resolve()):h};var a=function(l,f,u){var h=i.apply(this,[l]);return u?(h.then(f,u),Promise.resolve()):h};e.setLocalDescription=a,a=function(l,f,u){var h=s.apply(this,[l]);return u?(h.then(f,u),Promise.resolve()):h},e.setRemoteDescription=a,a=function(l,f,u){var h=o.apply(this,[l]);return u?(h.then(f,u),Promise.resolve()):h},e.addIceCandidate=a}}function Nze(t){var e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){var r=e.mediaDevices,n=r.getUserMedia.bind(r);e.mediaDevices.getUserMedia=function(i){return n(Vie(i))}}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(s,o,a){e.mediaDevices.getUserMedia(s).then(o,a)}).bind(e))}function Vie(t){return t&&t.video!==void 0?Object.assign({},t,{video:$ie.compactObject(t.video)}):t}function Bze(t){if(t.RTCPeerConnection){var e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,i){if(n&&n.iceServers){for(var s=[],o=0;o{throw TypeError(t)},Hie=(t,e,r)=>e.has(t)||zie("Cannot "+r),Uze=(t,e,r)=>(Hie(t,e,"read from private field"),r?r.call(t):e.get(t)),$ze=(t,e,r)=>e.has(t)?zie("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),qze=(t,e,r,n)=>(Hie(t,e,"write to private field"),e.set(t,r),r);const qV=["Aztec","Codabar","Code128","Code39","Code93","DataBar","DataBarExpanded","DataBarLimited","DataMatrix","DXFilmEdge","EAN-13","EAN-8","ITF","Linear-Codes","Matrix-Codes","MaxiCode","MicroQRCode","None","PDF417","QRCode","rMQRCode","UPC-A","UPC-E"];function Vze(t){return t.join("|")}function zze(t){const e=VV(t);let r=0,n=qV.length-1;for(;r<=n;){const i=Math.floor((r+n)/2),s=qV[i],o=VV(s);if(o===e)return s;o{const r=t.match(/_(.+?)\.wasm$/);return r?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.3.4/dist/${r[1]}/${t}`:e+t}};let zV=new WeakMap;function BO(t,e){var r;const n=zV.get(t);if(n!=null&&n.modulePromise&&e===void 0)return n.modulePromise;const i=(r=n==null?void 0:n.moduleOverrides)!=null?r:Jze,s=t({...i});return zV.set(t,{moduleOverrides:i,modulePromise:s}),s}async function Zze(t,e,r=Vy){const n={...Vy,...r},i=await BO(t),{size:s}=e,o=new Uint8Array(await e.arrayBuffer()),a=i._malloc(s);i.HEAPU8.set(o,a);const c=i.readBarcodesFromImage(a,s,Gie(i,n));i._free(a);const l=[];for(let f=0;f{var t,e=typeof document<"u"&&((t=document.currentScript)==null?void 0:t.tagName.toUpperCase())==="SCRIPT"?document.currentScript.src:void 0;return function(r={}){var n,i=r,s,o,a=new Promise((z,H)=>{s=z,o=H}),c=typeof window=="object",l=typeof Bun<"u",f=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var u=Object.assign({},i),h="./this.program",g="";function y(z){return i.locateFile?i.locateFile(z,g):g+z}var m,S;if(c||f||l){var E;f?g=self.location.href:typeof document<"u"&&((E=document.currentScript)===null||E===void 0?void 0:E.tagName.toUpperCase())==="SCRIPT"&&(g=document.currentScript.src),e&&(g=e),g.startsWith("blob:")?g="":g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1),f&&(S=z=>{var H=new XMLHttpRequest;return H.open("GET",z,!1),H.responseType="arraybuffer",H.send(null),new Uint8Array(H.response)}),m=z=>fetch(z,{credentials:"same-origin"}).then(H=>H.ok?H.arrayBuffer():Promise.reject(new Error(H.status+" : "+H.url)))}var A=i.print||console.log.bind(console),P=i.printErr||console.error.bind(console);Object.assign(i,u),u=null,i.arguments&&i.arguments,i.thisProgram&&(h=i.thisProgram);var N=i.wasmBinary,L,V=!1,I,U,ie,ae,K,R,D,v;function b(){var z=L.buffer;i.HEAP8=I=new Int8Array(z),i.HEAP16=ie=new Int16Array(z),i.HEAPU8=U=new Uint8Array(z),i.HEAPU16=ae=new Uint16Array(z),i.HEAP32=K=new Int32Array(z),i.HEAPU32=R=new Uint32Array(z),i.HEAPF32=D=new Float32Array(z),i.HEAPF64=v=new Float64Array(z)}var M=[],B=[],x=[];function C(){var z=i.preRun;z&&(typeof z=="function"&&(z=[z]),z.forEach(O)),lt(M)}function w(){lt(B)}function k(){var z=i.postRun;z&&(typeof z=="function"&&(z=[z]),z.forEach(oe)),lt(x)}function O(z){M.unshift(z)}function G(z){B.unshift(z)}function oe(z){x.unshift(z)}var $=0,X=null;function W(z){var H;$++,(H=i.monitorRunDependencies)===null||H===void 0||H.call(i,$)}function Z(z){var H;if($--,(H=i.monitorRunDependencies)===null||H===void 0||H.call(i,$),$==0&&X){var re=X;X=null,re()}}function te(z){var H;(H=i.onAbort)===null||H===void 0||H.call(i,z),z="Aborted("+z+")",P(z),V=!0,z+=". Build with -sASSERTIONS for more info.";var re=new WebAssembly.RuntimeError(z);throw o(re),re}var F="data:application/octet-stream;base64,",ee=z=>z.startsWith(F);function fe(){var z="zxing_reader.wasm";return ee(z)?z:y(z)}var xe;function _e(z){if(z==xe&&N)return new Uint8Array(N);if(S)return S(z);throw"both async and sync fetching of the wasm failed"}function Me(z){return N?Promise.resolve().then(()=>_e(z)):m(z).then(H=>new Uint8Array(H),()=>_e(z))}function Ke(z,H,re){return Me(z).then(ce=>WebAssembly.instantiate(ce,H)).then(re,ce=>{P(`failed to asynchronously prepare wasm: ${ce}`),te(ce)})}function ze(z,H,re,ce){return!z&&typeof WebAssembly.instantiateStreaming=="function"&&!ee(H)&&typeof fetch=="function"?fetch(H,{credentials:"same-origin"}).then(ve=>{var be=WebAssembly.instantiateStreaming(ve,re);return be.then(ce,function(Se){return P(`wasm streaming compile failed: ${Se}`),P("falling back to ArrayBuffer instantiation"),Ke(H,re,ce)})}):Ke(H,re,ce)}function Je(){return{a:KC}}function Xe(){var z,H=Je();function re(ve,be){return Qr=ve.exports,L=Qr.za,b(),Mp=Qr.Da,G(Qr.Aa),Z(),Qr}W();function ce(ve){re(ve.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(H,re)}catch(ve){P(`Module.instantiateWasm callback failed with error: ${ve}`),o(ve)}return(z=xe)!==null&&z!==void 0||(xe=fe()),ze(N,xe,H,ce).catch(o),{}}var lt=z=>{z.forEach(H=>H(i))};i.noExitRuntime;var Re=z=>jx(z),$e=()=>Ux(),st=[],Qe=0,ct=z=>{var H=new at(z);return H.get_caught()||(H.set_caught(!0),Qe--),H.set_rethrown(!1),st.push(H),Sf(z),Om(z)},tt=0,He=()=>{nr(0,0);var z=st.pop();$x(z.excPtr),tt=0};class at{constructor(H){this.excPtr=H,this.ptr=H-24}set_type(H){R[this.ptr+4>>2]=H}get_type(){return R[this.ptr+4>>2]}set_destructor(H){R[this.ptr+8>>2]=H}get_destructor(){return R[this.ptr+8>>2]}set_caught(H){H=H?1:0,I[this.ptr+12]=H}get_caught(){return I[this.ptr+12]!=0}set_rethrown(H){H=H?1:0,I[this.ptr+13]=H}get_rethrown(){return I[this.ptr+13]!=0}init(H,re){this.set_adjusted_ptr(0),this.set_type(H),this.set_destructor(re)}set_adjusted_ptr(H){R[this.ptr+16>>2]=H}get_adjusted_ptr(){return R[this.ptr+16>>2]}}var pt=z=>{throw tt||(tt=z),tt},Ge=z=>d0(z),vt=z=>{var H=tt;if(!H)return Ge(0),0;var re=new at(H);re.set_adjusted_ptr(H);var ce=re.get_type();if(!ce)return Ge(0),H;for(var ve of z){if(ve===0||ve===ce)break;var be=re.ptr+16;if(yo(ve,ce,be))return Ge(ve),H}return Ge(ce),H},bt=()=>vt([]),Ze=z=>vt([z]),_t=(z,H)=>vt([z,H]),Ct=()=>{var z=st.pop();z||te("no exception to throw");var H=z.excPtr;throw z.get_rethrown()||(st.push(z),z.set_rethrown(!0),z.set_caught(!1),Qe++),tt=H,tt},It=(z,H,re)=>{var ce=new at(z);throw ce.init(H,re),tt=z,Qe++,tt},er=()=>Qe,dr=()=>{te("")},wt={},lr=z=>{for(;z.length;){var H=z.pop(),re=z.pop();re(H)}};function ir(z){return this.fromWireType(R[z>>2])}var Pt={},Dt={},Nt={},dt,Lt=z=>{throw new dt(z)},kt=(z,H,re)=>{z.forEach(Ae=>Nt[Ae]=H);function ce(Ae){var De=re(Ae);De.length!==z.length&&Lt("Mismatched type converter count");for(var We=0;We{Dt.hasOwnProperty(Ae)?ve[De]=Dt[Ae]:(be.push(Ae),Pt.hasOwnProperty(Ae)||(Pt[Ae]=[]),Pt[Ae].push(()=>{ve[De]=Dt[Ae],++Se,Se===be.length&&ce(ve)}))}),be.length===0&&ce(ve)},ut=z=>{var H=wt[z];delete wt[z];var re=H.rawConstructor,ce=H.rawDestructor,ve=H.fields,be=ve.map(Se=>Se.getterReturnType).concat(ve.map(Se=>Se.setterArgumentType));kt([z],be,Se=>{var Ae={};return ve.forEach((De,We)=>{var rt=De.fieldName,Ft=Se[We],xr=De.getter,Wt=De.getterContext,hr=Se[We+ve.length],Yn=De.setter,$n=De.setterContext;Ae[rt]={read:Mn=>Ft.fromWireType(xr(Wt,Mn)),write:(Mn,_f)=>{var yi=[];Yn($n,Mn,hr.toWireType(yi,_f)),lr(yi)}}}),[{name:H.name,fromWireType:De=>{var We={};for(var rt in Ae)We[rt]=Ae[rt].read(De);return ce(De),We},toWireType:(De,We)=>{for(var rt in Ae)if(!(rt in We))throw new TypeError(`Missing field: "${rt}"`);var Ft=re();for(rt in Ae)Ae[rt].write(Ft,We[rt]);return De!==null&&De.push(ce,Ft),Ft},argPackAdvance:ot,readValueFromPointer:ir,destructorFunction:ce}]})},zt=(z,H,re,ce,ve)=>{},Ht=()=>{for(var z=new Array(256),H=0;H<256;++H)z[H]=String.fromCharCode(H);ht=z},ht,xt=z=>{for(var H="",re=z;U[re];)H+=ht[U[re++]];return H},Bt,Ve=z=>{throw new Bt(z)};function $t(z,H){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var ce=H.name;if(z||Ve(`type "${ce}" must have a positive integer typeid pointer`),Dt.hasOwnProperty(z)){if(re.ignoreDuplicateRegistrations)return;Ve(`Cannot register type '${ce}' twice`)}if(Dt[z]=H,delete Nt[z],Pt.hasOwnProperty(z)){var ve=Pt[z];delete Pt[z],ve.forEach(be=>be())}}function Et(z,H){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $t(z,H,re)}var ot=8,Gt=(z,H,re,ce)=>{H=xt(H),Et(z,{name:H,fromWireType:function(ve){return!!ve},toWireType:function(ve,be){return be?re:ce},argPackAdvance:ot,readValueFromPointer:function(ve){return this.fromWireType(U[ve])},destructorFunction:null})},Nr=z=>({count:z.count,deleteScheduled:z.deleteScheduled,preservePointerOnDelete:z.preservePointerOnDelete,ptr:z.ptr,ptrType:z.ptrType,smartPtr:z.smartPtr,smartPtrType:z.smartPtrType}),Ut=z=>{function H(re){return re.$$.ptrType.registeredClass.name}Ve(H(z)+" instance already deleted")},Pr=!1,tr=z=>{},Or=z=>{z.smartPtr?z.smartPtrType.rawDestructor(z.smartPtr):z.ptrType.registeredClass.rawDestructor(z.ptr)},pi=z=>{z.count.value-=1;var H=z.count.value===0;H&&Or(z)},vi=(z,H,re)=>{if(H===re)return z;if(re.baseClass===void 0)return null;var ce=vi(z,H,re.baseClass);return ce===null?null:re.downcast(ce)},gi={},_i={},Tn=(z,H)=>{for(H===void 0&&Ve("ptr should not be undefined");z.baseClass;)H=z.upcast(H),z=z.baseClass;return H},ps=(z,H)=>(H=Tn(z,H),_i[H]),vs=(z,H)=>{(!H.ptrType||!H.ptr)&&Lt("makeClassHandle requires ptr and ptrType");var re=!!H.smartPtrType,ce=!!H.smartPtr;return re!==ce&&Lt("Both smartPtrType and smartPtr must be specified"),H.count={value:1},Hi(Object.create(z,{$$:{value:H,writable:!0}}))};function gs(z){var H=this.getPointee(z);if(!H)return this.destructor(z),null;var re=ps(this.registeredClass,H);if(re!==void 0){if(re.$$.count.value===0)return re.$$.ptr=H,re.$$.smartPtr=z,re.clone();var ce=re.clone();return this.destructor(z),ce}function ve(){return this.isSmartPointer?vs(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:H,smartPtrType:this,smartPtr:z}):vs(this.registeredClass.instancePrototype,{ptrType:this,ptr:z})}var be=this.registeredClass.getActualType(H),Se=gi[be];if(!Se)return ve.call(this);var Ae;this.isConst?Ae=Se.constPointerType:Ae=Se.pointerType;var De=vi(H,this.registeredClass,Ae.registeredClass);return De===null?ve.call(this):this.isSmartPointer?vs(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:De,smartPtrType:this,smartPtr:z}):vs(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:De})}var Hi=z=>typeof FinalizationRegistry>"u"?(Hi=H=>H,z):(Pr=new FinalizationRegistry(H=>{pi(H.$$)}),Hi=H=>{var re=H.$$,ce=!!re.smartPtr;if(ce){var ve={$$:re};Pr.register(H,ve,H)}return H},tr=H=>Pr.unregister(H),Hi(z)),ys=[],ms=()=>{for(;ys.length;){var z=ys.pop();z.$$.deleteScheduled=!1,z.delete()}},qs,ho=()=>{Object.assign(Pn.prototype,{isAliasOf(z){if(!(this instanceof Pn)||!(z instanceof Pn))return!1;var H=this.$$.ptrType.registeredClass,re=this.$$.ptr;z.$$=z.$$;for(var ce=z.$$.ptrType.registeredClass,ve=z.$$.ptr;H.baseClass;)re=H.upcast(re),H=H.baseClass;for(;ce.baseClass;)ve=ce.upcast(ve),ce=ce.baseClass;return H===ce&&re===ve},clone(){if(this.$$.ptr||Ut(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var z=Hi(Object.create(Object.getPrototypeOf(this),{$$:{value:Nr(this.$$)}}));return z.$$.count.value+=1,z.$$.deleteScheduled=!1,z},delete(){this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ve("Object already scheduled for deletion"),tr(this),pi(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ve("Object already scheduled for deletion"),ys.push(this),ys.length===1&&qs&&qs(ms),this.$$.deleteScheduled=!0,this}})};function Pn(){}var Gi=(z,H)=>Object.defineProperty(H,"name",{value:z}),po=(z,H,re)=>{if(z[H].overloadTable===void 0){var ce=z[H];z[H]=function(){for(var ve=arguments.length,be=new Array(ve),Se=0;Se{i.hasOwnProperty(z)?((re===void 0||i[z].overloadTable!==void 0&&i[z].overloadTable[re]!==void 0)&&Ve(`Cannot register public name '${z}' twice`),po(i,z,z),i.hasOwnProperty(re)&&Ve(`Cannot register multiple overloads of a function with the same number of arguments (${re})!`),i[z].overloadTable[re]=H):(i[z]=H,re!==void 0&&(i[z].numArguments=re))},gf=48,nl=57,Pp=z=>{z=z.replace(/[^a-zA-Z0-9_]/g,"$");var H=z.charCodeAt(0);return H>=gf&&H<=nl?`_${z}`:z};function yf(z,H,re,ce,ve,be,Se,Ae){this.name=z,this.constructor=H,this.instancePrototype=re,this.rawDestructor=ce,this.baseClass=ve,this.getActualType=be,this.upcast=Se,this.downcast=Ae,this.pureVirtualFunctions=[]}var mf=(z,H,re)=>{for(;H!==re;)H.upcast||Ve(`Expected null or instance of ${re.name}, got an instance of ${H.name}`),z=H.upcast(z),H=H.baseClass;return z};function bf(z,H){if(H===null)return this.isReference&&Ve(`null is not a valid ${this.name}`),0;H.$$||Ve(`Cannot pass "${le(H)}" as a ${this.name}`),H.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`);var re=H.$$.ptrType.registeredClass,ce=mf(H.$$.ptr,re,this.registeredClass);return ce}function r0(z,H){var re;if(H===null)return this.isReference&&Ve(`null is not a valid ${this.name}`),this.isSmartPointer?(re=this.rawConstructor(),z!==null&&z.push(this.rawDestructor,re),re):0;(!H||!H.$$)&&Ve(`Cannot pass "${le(H)}" as a ${this.name}`),H.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&H.$$.ptrType.isConst&&Ve(`Cannot convert argument of type ${H.$$.smartPtrType?H.$$.smartPtrType.name:H.$$.ptrType.name} to parameter type ${this.name}`);var ce=H.$$.ptrType.registeredClass;if(re=mf(H.$$.ptr,ce,this.registeredClass),this.isSmartPointer)switch(H.$$.smartPtr===void 0&&Ve("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:H.$$.smartPtrType===this?re=H.$$.smartPtr:Ve(`Cannot convert argument of type ${H.$$.smartPtrType?H.$$.smartPtrType.name:H.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:re=H.$$.smartPtr;break;case 2:if(H.$$.smartPtrType===this)re=H.$$.smartPtr;else{var ve=H.clone();re=this.rawShare(re,vo.toHandle(()=>ve.delete())),z!==null&&z.push(this.rawDestructor,re)}break;default:Ve("Unsupporting sharing policy")}return re}function wf(z,H){if(H===null)return this.isReference&&Ve(`null is not a valid ${this.name}`),0;H.$$||Ve(`Cannot pass "${le(H)}" as a ${this.name}`),H.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`),H.$$.ptrType.isConst&&Ve(`Cannot convert argument of type ${H.$$.ptrType.name} to parameter type ${this.name}`);var re=H.$$.ptrType.registeredClass,ce=mf(H.$$.ptr,re,this.registeredClass);return ce}var kp=()=>{Object.assign(Qu.prototype,{getPointee(z){return this.rawGetPointee&&(z=this.rawGetPointee(z)),z},destructor(z){var H;(H=this.rawDestructor)===null||H===void 0||H.call(this,z)},argPackAdvance:ot,readValueFromPointer:ir,fromWireType:gs})};function Qu(z,H,re,ce,ve,be,Se,Ae,De,We,rt){this.name=z,this.registeredClass=H,this.isReference=re,this.isConst=ce,this.isSmartPointer=ve,this.pointeeType=be,this.sharingPolicy=Se,this.rawGetPointee=Ae,this.rawConstructor=De,this.rawShare=We,this.rawDestructor=rt,!ve&&H.baseClass===void 0?ce?(this.toWireType=bf,this.destructorFunction=null):(this.toWireType=wf,this.destructorFunction=null):this.toWireType=r0}var n0=(z,H,re)=>{i.hasOwnProperty(z)||Lt("Replacing nonexistent public symbol"),i[z].overloadTable!==void 0&&re!==void 0?i[z].overloadTable[re]=H:(i[z]=H,i[z].argCount=re)},Rp=(z,H,re)=>{z=z.replace(/p/g,"i");var ce=i["dynCall_"+z];return ce(H,...re)},vc=[],Mp,mr=z=>{var H=vc[z];return H||(z>=vc.length&&(vc.length=z+1),vc[z]=H=Mp.get(z)),H},Ju=function(z,H){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(z.includes("j"))return Rp(z,H,re);var ce=mr(H)(...re);return ce},il=(z,H)=>function(){for(var re=arguments.length,ce=new Array(re),ve=0;ve{z=xt(z);function re(){return z.includes("j")?il(z,H):mr(H)}var ce=re();return typeof ce!="function"&&Ve(`unknown function pointer with signature ${z}: ${H}`),ce},Op=(z,H)=>{var re=Gi(H,function(ce){this.name=H,this.message=ce;var ve=new Error(ce).stack;ve!==void 0&&(this.stack=this.toString()+` +`+ve.replace(/^Error(:[^\n]*)?\n/,""))});return re.prototype=Object.create(z.prototype),re.prototype.constructor=re,re.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},re},i0,qo=z=>{var H=Fx(z),re=xt(H);return yc(H),re},xf=(z,H)=>{var re=[],ce={};function ve(be){if(!ce[be]&&!Dt[be]){if(Nt[be]){Nt[be].forEach(ve);return}re.push(be),ce[be]=!0}}throw H.forEach(ve),new i0(`${z}: `+re.map(qo).join([", "]))},Dp=(z,H,re,ce,ve,be,Se,Ae,De,We,rt,Ft,xr)=>{rt=xt(rt),be=xn(ve,be),Ae&&(Ae=xn(Se,Ae)),We&&(We=xn(De,We)),xr=xn(Ft,xr);var Wt=Pp(rt);Vs(Wt,function(){xf(`Cannot construct ${rt} due to unbound types`,[ce])}),kt([z,H,re],ce?[ce]:[],hr=>{hr=hr[0];var Yn,$n;ce?(Yn=hr.registeredClass,$n=Yn.instancePrototype):$n=Pn.prototype;var Mn=Gi(rt,function(){if(Object.getPrototypeOf(this)!==_f)throw new Bt("Use 'new' to construct "+rt);if(yi.constructor_body===void 0)throw new Bt(rt+" has no accessible constructor");for(var v0=arguments.length,mc=new Array(v0),Kp=0;Kp{for(var re=[],ce=0;ce>2]);return re};function Np(z){for(var H=1;H{var Se=Zu(H,re);ve=xn(ce,ve),kt([],[z],Ae=>{Ae=Ae[0];var De=`constructor ${Ae.name}`;if(Ae.registeredClass.constructor_body===void 0&&(Ae.registeredClass.constructor_body=[]),Ae.registeredClass.constructor_body[H-1]!==void 0)throw new Bt(`Cannot register multiple constructors with identical number of parameters (${H-1}) for class '${Ae.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return Ae.registeredClass.constructor_body[H-1]=()=>{xf(`Cannot construct ${Ae.name} due to unbound types`,Se)},kt([],Se,We=>(We.splice(1,0,null),Ae.registeredClass.constructor_body[H-1]=s0(De,We,null,ve,be),[])),[]})},o0=z=>{z=z.trim();const H=z.indexOf("(");return H!==-1?z.substr(0,H):z},Bp=(z,H,re,ce,ve,be,Se,Ae,De,We)=>{var rt=Zu(re,ce);H=xt(H),H=o0(H),be=xn(ve,be),kt([],[z],Ft=>{Ft=Ft[0];var xr=`${Ft.name}.${H}`;H.startsWith("@@")&&(H=Symbol[H.substring(2)]),Ae&&Ft.registeredClass.pureVirtualFunctions.push(H);function Wt(){xf(`Cannot call ${xr} due to unbound types`,rt)}var hr=Ft.registeredClass.instancePrototype,Yn=hr[H];return Yn===void 0||Yn.overloadTable===void 0&&Yn.className!==Ft.name&&Yn.argCount===re-2?(Wt.argCount=re-2,Wt.className=Ft.name,hr[H]=Wt):(po(hr,H,xr),hr[H].overloadTable[re-2]=Wt),kt([],rt,$n=>{var Mn=s0(xr,$n,Ft,be,Se);return hr[H].overloadTable===void 0?(Mn.argCount=re-2,hr[H]=Mn):hr[H].overloadTable[re-2]=Mn,[]}),[]})},sl=[],Vo=[],Ef=z=>{z>9&&--Vo[z+1]===0&&(Vo[z]=void 0,sl.push(z))},Sm=()=>Vo.length/2-5-sl.length,Xu=()=>{Vo.push(0,1,void 0,1,null,1,!0,1,!1,1),i.count_emval_handles=Sm},vo={toValue:z=>(z||Ve("Cannot use deleted val. handle = "+z),Vo[z]),toHandle:z=>{switch(z){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const H=sl.pop()||Vo.length;return Vo[H]=z,Vo[H+1]=1,H}}}},a0={name:"emscripten::val",fromWireType:z=>{var H=vo.toValue(z);return Ef(z),H},toWireType:(z,H)=>vo.toHandle(H),argPackAdvance:ot,readValueFromPointer:ir,destructorFunction:null},Cf=z=>Et(z,a0),Lp=(z,H,re)=>{switch(H){case 1:return re?function(ce){return this.fromWireType(I[ce])}:function(ce){return this.fromWireType(U[ce])};case 2:return re?function(ce){return this.fromWireType(ie[ce>>1])}:function(ce){return this.fromWireType(ae[ce>>1])};case 4:return re?function(ce){return this.fromWireType(K[ce>>2])}:function(ce){return this.fromWireType(R[ce>>2])};default:throw new TypeError(`invalid integer width (${H}): ${z}`)}},_m=(z,H,re,ce)=>{H=xt(H);function ve(){}ve.values={},Et(z,{name:H,constructor:ve,fromWireType:function(be){return this.constructor.values[be]},toWireType:(be,Se)=>Se.value,argPackAdvance:ot,readValueFromPointer:Lp(H,re,ce),destructorFunction:null}),Vs(H,ve)},Hr=(z,H)=>{var re=Dt[z];return re===void 0&&Ve(`${H} has unknown type ${qo(z)}`),re},Yr=(z,H,re)=>{var ce=Hr(z,"enum");H=xt(H);var ve=ce.constructor,be=Object.create(ce.constructor.prototype,{value:{value:re},constructor:{value:Gi(`${ce.name}_${H}`,function(){})}});ve.values[re]=be,ve[H]=be},le=z=>{if(z===null)return"null";var H=typeof z;return H==="object"||H==="array"||H==="function"?z.toString():""+z},Ee=(z,H)=>{switch(H){case 4:return function(re){return this.fromWireType(D[re>>2])};case 8:return function(re){return this.fromWireType(v[re>>3])};default:throw new TypeError(`invalid float width (${H}): ${z}`)}},Ue=(z,H,re)=>{H=xt(H),Et(z,{name:H,fromWireType:ce=>ce,toWireType:(ce,ve)=>ve,argPackAdvance:ot,readValueFromPointer:Ee(H,re),destructorFunction:null})},gt=(z,H,re,ce,ve,be,Se,Ae)=>{var De=Zu(H,re);z=xt(z),z=o0(z),ve=xn(ce,ve),Vs(z,function(){xf(`Cannot call ${z} due to unbound types`,De)},H-1),kt([],De,We=>{var rt=[We[0],null].concat(We.slice(1));return n0(z,s0(z,rt,null,ve,be),H-1),[]})},tn=(z,H,re)=>{switch(H){case 1:return re?ce=>I[ce]:ce=>U[ce];case 2:return re?ce=>ie[ce>>1]:ce=>ae[ce>>1];case 4:return re?ce=>K[ce>>2]:ce=>R[ce>>2];default:throw new TypeError(`invalid integer width (${H}): ${z}`)}},rr=(z,H,re,ce,ve)=>{H=xt(H);var be=rt=>rt;if(ce===0){var Se=32-8*re;be=rt=>rt<>>Se}var Ae=H.includes("unsigned"),De=(rt,Ft)=>{},We;Ae?We=function(rt,Ft){return De(Ft,this.name),Ft>>>0}:We=function(rt,Ft){return De(Ft,this.name),Ft},Et(z,{name:H,fromWireType:be,toWireType:We,argPackAdvance:ot,readValueFromPointer:tn(H,re,ce!==0),destructorFunction:null})},hn=(z,H,re)=>{var ce=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ve=ce[H];function be(Se){var Ae=R[Se>>2],De=R[Se+4>>2];return new ve(I.buffer,De,Ae)}re=xt(re),Et(z,{name:re,fromWireType:be,argPackAdvance:ot,readValueFromPointer:be},{ignoreDuplicateRegistrations:!0})},Un=Object.assign({optional:!0},a0),Cr=(z,H)=>{Et(z,Un)},rn=(z,H,re,ce)=>{if(!(ce>0))return 0;for(var ve=re,be=re+ce-1,Se=0;Se=55296&&Ae<=57343){var De=z.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|De&1023}if(Ae<=127){if(re>=be)break;H[re++]=Ae}else if(Ae<=2047){if(re+1>=be)break;H[re++]=192|Ae>>6,H[re++]=128|Ae&63}else if(Ae<=65535){if(re+2>=be)break;H[re++]=224|Ae>>12,H[re++]=128|Ae>>6&63,H[re++]=128|Ae&63}else{if(re+3>=be)break;H[re++]=240|Ae>>18,H[re++]=128|Ae>>12&63,H[re++]=128|Ae>>6&63,H[re++]=128|Ae&63}}return H[re]=0,re-ve},pn=(z,H,re)=>rn(z,U,H,re),bs=z=>{for(var H=0,re=0;re=55296&&ce<=57343?(H+=4,++re):H+=3}return H},Rn=typeof TextDecoder<"u"?new TextDecoder:void 0,cn=function(z){let H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN;for(var ce=H+re,ve=H;z[ve]&&!(ve>=ce);)++ve;if(ve-H>16&&z.buffer&&Rn)return Rn.decode(z.subarray(H,ve));for(var be="";H>10,56320|We&1023)}}return be},Wi=(z,H)=>z?cn(U,z,H):"",zo=(z,H)=>{H=xt(H);var re=H==="std::string";Et(z,{name:H,fromWireType(ce){var ve=R[ce>>2],be=ce+4,Se;if(re)for(var Ae=be,De=0;De<=ve;++De){var We=be+De;if(De==ve||U[We]==0){var rt=We-Ae,Ft=Wi(Ae,rt);Se===void 0?Se=Ft:(Se+="\0",Se+=Ft),Ae=We+1}}else{for(var xr=new Array(ve),De=0;De>2]=be,re&&Se)pn(ve,De,be+1);else if(Se)for(var We=0;We255&&(yc(De),Ve("String has UTF-16 code units that do not fit in 8 bits")),U[De+We]=rt}else for(var We=0;We{for(var re=z,ce=re>>1,ve=ce+H/2;!(ce>=ve)&&ae[ce];)++ce;if(re=ce<<1,re-z>32&&zs)return zs.decode(U.subarray(z,re));for(var be="",Se=0;!(Se>=H/2);++Se){var Ae=ie[z+Se*2>>1];if(Ae==0)break;be+=String.fromCharCode(Ae)}return be},c0=(z,H,re)=>{var ce;if((ce=re)!==null&&ce!==void 0||(re=2147483647),re<2)return 0;re-=2;for(var ve=H,be=re>1]=Ae,H+=2}return ie[H>>1]=0,H-ve},Af=z=>z.length*2,li=(z,H)=>{for(var re=0,ce="";!(re>=H/4);){var ve=K[z+re*4>>2];if(ve==0)break;if(++re,ve>=65536){var be=ve-65536;ce+=String.fromCharCode(55296|be>>10,56320|be&1023)}else ce+=String.fromCharCode(ve)}return ce},NC=(z,H,re)=>{var ce;if((ce=re)!==null&&ce!==void 0||(re=2147483647),re<4)return 0;for(var ve=H,be=ve+re-4,Se=0;Se=55296&&Ae<=57343){var De=z.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|De&1023}if(K[H>>2]=Ae,H+=4,H+4>be)break}return K[H>>2]=0,H-ve},go=z=>{for(var H=0,re=0;re=55296&&ce<=57343&&++re,H+=4}return H},BC=(z,H,re)=>{re=xt(re);var ce,ve,be,Se;H===2?(ce=Aa,ve=c0,Se=Af,be=Ae=>ae[Ae>>1]):H===4&&(ce=li,ve=NC,Se=go,be=Ae=>R[Ae>>2]),Et(z,{name:re,fromWireType:Ae=>{for(var De=R[Ae>>2],We,rt=Ae+4,Ft=0;Ft<=De;++Ft){var xr=Ae+4+Ft*H;if(Ft==De||be(xr)==0){var Wt=xr-rt,hr=ce(rt,Wt);We===void 0?We=hr:(We+="\0",We+=hr),rt=xr+H}}return yc(Ae),We},toWireType:(Ae,De)=>{typeof De!="string"&&Ve(`Cannot pass non-string to C++ string type ${re}`);var We=Se(De),rt=u0(4+We+H);return R[rt>>2]=We/H,ve(De,rt+4,We+H),Ae!==null&&Ae.push(yc,rt),rt},argPackAdvance:ot,readValueFromPointer:ir,destructorFunction(Ae){yc(Ae)}})},Rx=(z,H,re,ce,ve,be)=>{wt[z]={name:xt(H),rawConstructor:xn(re,ce),rawDestructor:xn(ve,be),fields:[]}},ol=(z,H,re,ce,ve,be,Se,Ae,De,We)=>{wt[z].fields.push({fieldName:xt(H),getterReturnType:re,getter:xn(ce,ve),getterContext:be,setterArgumentType:Se,setter:xn(Ae,De),setterContext:We})},Fp=(z,H)=>{H=xt(H),Et(z,{isVoid:!0,name:H,argPackAdvance:0,fromWireType:()=>{},toWireType:(re,ce)=>{}})},Im=(z,H,re)=>U.copyWithin(z,H,H+re),ln=[],al=(z,H,re,ce)=>(z=ln[z],H=vo.toValue(H),z(null,H,re,ce)),Tm={},LC=z=>{var H=Tm[z];return H===void 0?xt(z):H},jp=()=>{if(typeof globalThis=="object")return globalThis;function z(H){H.$$$embind_global$$$=H;var re=typeof $$$embind_global$$$=="object"&&H.$$$embind_global$$$==H;return re||delete H.$$$embind_global$$$,re}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&z(global)?$$$embind_global$$$=global:typeof self=="object"&&z(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},FC=z=>z===0?vo.toHandle(jp()):(z=LC(z),vo.toHandle(jp()[z])),jC=z=>{var H=ln.length;return ln.push(z),H},UC=(z,H)=>{for(var re=new Array(z),ce=0;ce>2],"parameter "+ce);return re},Mx=Reflect.construct,Up=(z,H,re)=>{var ce=[],ve=z.toWireType(ce,re);return ce.length&&(R[H>>2]=vo.toHandle(ce)),ve},ed=(z,H,re)=>{var ce=UC(z,H),ve=ce.shift();z--;var be=new Array(z),Se=(De,We,rt,Ft)=>{for(var xr=0,Wt=0;WtDe.name).join(", ")}) => ${ve.name}>`;return jC(Gi(Ae,Se))},$C=z=>{z>9&&(Vo[z+1]+=1)},Ox=z=>{var H=vo.toValue(z);lr(H),Ef(z)},Dx=(z,H)=>{z=Hr(z,"_emval_take_value");var re=z.readValueFromPointer(H);return vo.toHandle(re)},Pm=(z,H,re,ce)=>{var ve=new Date().getFullYear(),be=new Date(ve,0,1),Se=new Date(ve,6,1),Ae=be.getTimezoneOffset(),De=Se.getTimezoneOffset(),We=Math.max(Ae,De);R[z>>2]=We*60,K[H>>2]=+(Ae!=De);var rt=Wt=>{var hr=Wt>=0?"-":"+",Yn=Math.abs(Wt),$n=String(Math.floor(Yn/60)).padStart(2,"0"),Mn=String(Yn%60).padStart(2,"0");return`UTC${hr}${$n}${Mn}`},Ft=rt(Ae),xr=rt(De);De2147483648,Nx=(z,H)=>Math.ceil(z/H)*H,qC=z=>{var H=L.buffer,re=(z-H.byteLength+65535)/65536|0;try{return L.grow(re),b(),1}catch{}},Rm=z=>{var H=U.length;z>>>=0;var re=km();if(z>re)return!1;for(var ce=1;ce<=4;ce*=2){var ve=H*(1+.2/ce);ve=Math.min(ve,z+100663296);var be=Math.min(re,Nx(Math.max(z,ve),65536)),Se=qC(be);if(Se)return!0}return!1},l0={},VC=()=>h||"./this.program",td=()=>{if(!td.strings){var z=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",H={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:z,_:VC()};for(var re in l0)l0[re]===void 0?delete H[re]:H[re]=l0[re];var ce=[];for(var re in H)ce.push(`${re}=${H[re]}`);td.strings=ce}return td.strings},Hs=(z,H)=>{for(var re=0;re{var re=0;return td().forEach((ce,ve)=>{var be=H+re;R[z+ve*4>>2]=be,Hs(ce,be),re+=ce.length+1}),0},f0=(z,H)=>{var re=td();R[z>>2]=re.length;var ce=0;return re.forEach(ve=>ce+=ve.length+1),R[H>>2]=ce,0},Bx=z=>52;function Lx(z,H,re,ce,ve){return 70}var zC=[null,[],[]],HC=(z,H)=>{var re=zC[z];H===0||H===10?((z===1?A:P)(cn(re)),re.length=0):re.push(H)},GC=(z,H,re,ce)=>{for(var ve=0,be=0;be>2],Ae=R[H+4>>2];H+=8;for(var De=0;De>2]=ve,0},WC=z=>z;dt=i.InternalError=class extends Error{constructor(z){super(z),this.name="InternalError"}},Ht(),Bt=i.BindingError=class extends Error{constructor(z){super(z),this.name="BindingError"}},ho(),kp(),i0=i.UnboundTypeError=Op(Error,"UnboundTypeError"),Xu();var KC={t:ct,x:He,a:bt,j:Ze,k:_t,O:Ct,q:It,ga:er,d:pt,ca:dr,va:ut,ba:zt,pa:Gt,ta:Dp,sa:gc,E:Bp,oa:Cf,F:_m,n:Yr,W:Ue,X:gt,y:rr,u:hn,ua:Cr,V:zo,P:BC,L:Rx,wa:ol,qa:Fp,ja:Im,T:al,xa:Ef,ya:FC,U:ed,Y:$C,Z:Ox,ra:Dx,da:Pm,ha:Rm,ea:Mm,fa:f0,ia:Bx,$:Lx,S:GC,J:Vp,C:tA,Q:rd,R:cl,r:$p,b:YC,D:qp,la:zp,c:Oe,ka:rA,h:ZC,i:Lr,s:Kn,N:nd,w:Nm,I:iA,K:eA,z:Vx,H:Gp,aa:Wp,_:Hx,l:Pe,f:we,e:JC,g:QC,M:Hp,m:Xt,ma:Gr,p:nn,v:XC,na:mo,B:nA,o:mt,G:zx,A:WC},Qr=Xe(),Fx=z=>(Fx=Qr.Ba)(z),yc=i._free=z=>(yc=i._free=Qr.Ca)(z),u0=i._malloc=z=>(u0=i._malloc=Qr.Ea)(z),Om=z=>(Om=Qr.Fa)(z),nr=(z,H)=>(nr=Qr.Ga)(z,H),d0=z=>(d0=Qr.Ha)(z),jx=z=>(jx=Qr.Ia)(z),Ux=()=>(Ux=Qr.Ja)(),$x=z=>($x=Qr.Ka)(z),Sf=z=>(Sf=Qr.La)(z),yo=(z,H,re)=>(yo=Qr.Ma)(z,H,re);i.dynCall_viijii=(z,H,re,ce,ve,be,Se)=>(i.dynCall_viijii=Qr.Na)(z,H,re,ce,ve,be,Se);var Dm=i.dynCall_jiii=(z,H,re,ce)=>(Dm=i.dynCall_jiii=Qr.Oa)(z,H,re,ce);i.dynCall_jiji=(z,H,re,ce,ve)=>(i.dynCall_jiji=Qr.Pa)(z,H,re,ce,ve);var qx=i.dynCall_jiiii=(z,H,re,ce,ve)=>(qx=i.dynCall_jiiii=Qr.Qa)(z,H,re,ce,ve);i.dynCall_iiiiij=(z,H,re,ce,ve,be,Se)=>(i.dynCall_iiiiij=Qr.Ra)(z,H,re,ce,ve,be,Se),i.dynCall_iiiiijj=(z,H,re,ce,ve,be,Se,Ae,De)=>(i.dynCall_iiiiijj=Qr.Sa)(z,H,re,ce,ve,be,Se,Ae,De),i.dynCall_iiiiiijj=(z,H,re,ce,ve,be,Se,Ae,De,We)=>(i.dynCall_iiiiiijj=Qr.Ta)(z,H,re,ce,ve,be,Se,Ae,De,We);function YC(z,H){var re=$e();try{return mr(z)(H)}catch(ce){if(Re(re),ce!==ce+0)throw ce;nr(1,0)}}function QC(z,H,re,ce){var ve=$e();try{mr(z)(H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function JC(z,H,re){var ce=$e();try{mr(z)(H,re)}catch(ve){if(Re(ce),ve!==ve+0)throw ve;nr(1,0)}}function ZC(z,H,re,ce){var ve=$e();try{return mr(z)(H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function rd(z,H,re,ce,ve){var be=$e();try{return mr(z)(H,re,ce,ve)}catch(Se){if(Re(be),Se!==Se+0)throw Se;nr(1,0)}}function we(z,H){var re=$e();try{mr(z)(H)}catch(ce){if(Re(re),ce!==ce+0)throw ce;nr(1,0)}}function Oe(z,H,re){var ce=$e();try{return mr(z)(H,re)}catch(ve){if(Re(ce),ve!==ve+0)throw ve;nr(1,0)}}function Pe(z){var H=$e();try{mr(z)()}catch(re){if(Re(H),re!==re+0)throw re;nr(1,0)}}function mt(z,H,re,ce,ve,be,Se,Ae,De,We,rt){var Ft=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae,De,We,rt)}catch(xr){if(Re(Ft),xr!==xr+0)throw xr;nr(1,0)}}function Xt(z,H,re,ce,ve){var be=$e();try{mr(z)(H,re,ce,ve)}catch(Se){if(Re(be),Se!==Se+0)throw Se;nr(1,0)}}function Lr(z,H,re,ce,ve){var be=$e();try{return mr(z)(H,re,ce,ve)}catch(Se){if(Re(be),Se!==Se+0)throw Se;nr(1,0)}}function Kn(z,H,re,ce,ve,be){var Se=$e();try{return mr(z)(H,re,ce,ve,be)}catch(Ae){if(Re(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function nn(z,H,re,ce,ve,be){var Se=$e();try{mr(z)(H,re,ce,ve,be)}catch(Ae){if(Re(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function Nm(z,H,re,ce,ve,be,Se){var Ae=$e();try{return mr(z)(H,re,ce,ve,be,Se)}catch(De){if(Re(Ae),De!==De+0)throw De;nr(1,0)}}function XC(z,H,re,ce,ve,be,Se,Ae){var De=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae)}catch(We){if(Re(De),We!==We+0)throw We;nr(1,0)}}function mo(z,H,re,ce,ve,be,Se,Ae,De){var We=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae,De)}catch(rt){if(Re(We),rt!==rt+0)throw rt;nr(1,0)}}function $p(z){var H=$e();try{return mr(z)()}catch(re){if(Re(H),re!==re+0)throw re;nr(1,0)}}function eA(z,H,re,ce,ve,be,Se,Ae,De){var We=$e();try{return mr(z)(H,re,ce,ve,be,Se,Ae,De)}catch(rt){if(Re(We),rt!==rt+0)throw rt;nr(1,0)}}function nd(z,H,re,ce,ve,be,Se){var Ae=$e();try{return mr(z)(H,re,ce,ve,be,Se)}catch(De){if(Re(Ae),De!==De+0)throw De;nr(1,0)}}function qp(z,H,re,ce){var ve=$e();try{return mr(z)(H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function Vp(z,H,re,ce){var ve=$e();try{return mr(z)(H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function Gr(z,H,re,ce,ve,be,Se,Ae){var De=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae)}catch(We){if(Re(De),We!==We+0)throw We;nr(1,0)}}function tA(z,H,re,ce,ve,be){var Se=$e();try{return mr(z)(H,re,ce,ve,be)}catch(Ae){if(Re(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function Vx(z,H,re,ce,ve,be,Se,Ae,De,We){var rt=$e();try{return mr(z)(H,re,ce,ve,be,Se,Ae,De,We)}catch(Ft){if(Re(rt),Ft!==Ft+0)throw Ft;nr(1,0)}}function zp(z,H,re){var ce=$e();try{return mr(z)(H,re)}catch(ve){if(Re(ce),ve!==ve+0)throw ve;nr(1,0)}}function rA(z,H,re,ce,ve){var be=$e();try{return mr(z)(H,re,ce,ve)}catch(Se){if(Re(be),Se!==Se+0)throw Se;nr(1,0)}}function nA(z,H,re,ce,ve,be,Se,Ae,De,We){var rt=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae,De,We)}catch(Ft){if(Re(rt),Ft!==Ft+0)throw Ft;nr(1,0)}}function iA(z,H,re,ce,ve,be,Se,Ae){var De=$e();try{return mr(z)(H,re,ce,ve,be,Se,Ae)}catch(We){if(Re(De),We!==We+0)throw We;nr(1,0)}}function Hp(z,H,re,ce,ve,be,Se){var Ae=$e();try{mr(z)(H,re,ce,ve,be,Se)}catch(De){if(Re(Ae),De!==De+0)throw De;nr(1,0)}}function cl(z,H,re,ce){var ve=$e();try{return mr(z)(H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function Gp(z,H,re,ce,ve,be,Se,Ae,De,We,rt,Ft){var xr=$e();try{return mr(z)(H,re,ce,ve,be,Se,Ae,De,We,rt,Ft)}catch(Wt){if(Re(xr),Wt!==Wt+0)throw Wt;nr(1,0)}}function zx(z,H,re,ce,ve,be,Se,Ae,De,We,rt,Ft,xr,Wt,hr,Yn){var $n=$e();try{mr(z)(H,re,ce,ve,be,Se,Ae,De,We,rt,Ft,xr,Wt,hr,Yn)}catch(Mn){if(Re($n),Mn!==Mn+0)throw Mn;nr(1,0)}}function Wp(z,H,re,ce){var ve=$e();try{return Dm(z,H,re,ce)}catch(be){if(Re(ve),be!==be+0)throw be;nr(1,0)}}function Hx(z,H,re,ce,ve){var be=$e();try{return qx(z,H,re,ce,ve)}catch(Se){if(Re(be),Se!==Se+0)throw Se;nr(1,0)}}var h0,p0;X=function z(){h0||Bm(),h0||(X=z)};function Bm(){if($>0||!p0&&(p0=1,C(),$>0))return;function z(){var H;h0||(h0=1,i.calledRun=1,!V&&(w(),s(i),(H=i.onRuntimeInitialized)===null||H===void 0||H.call(i),k()))}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),z()},1)):z()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Bm(),n=a,n}})();function eHe(t){return BO(LO,t)}async function tHe(t,e){return Zze(LO,t,e)}async function rHe(t,e){return Xze(LO,t,e)}const Kie=[["aztec","Aztec"],["code_128","Code128"],["code_39","Code39"],["code_93","Code93"],["codabar","Codabar"],["databar","DataBar"],["databar_expanded","DataBarExpanded"],["databar_limited","DataBarLimited"],["data_matrix","DataMatrix"],["dx_film_edge","DXFilmEdge"],["ean_13","EAN-13"],["ean_8","EAN-8"],["itf","ITF"],["maxi_code","MaxiCode"],["micro_qr_code","MicroQRCode"],["pdf417","PDF417"],["qr_code","QRCode"],["rm_qr_code","rMQRCode"],["upc_a","UPC-A"],["upc_e","UPC-E"],["linear_codes","Linear-Codes"],["matrix_codes","Matrix-Codes"]],nHe=[...Kie,["unknown"]].map(t=>t[0]),HT=new Map(Kie);function iHe(t){for(const[e,r]of HT)if(t===r)return e;return"unknown"}function sHe(t){if(Yie(t))return{width:t.naturalWidth,height:t.naturalHeight};if(Qie(t))return{width:t.width.baseVal.value,height:t.height.baseVal.value};if(Jie(t))return{width:t.videoWidth,height:t.videoHeight};if(Xie(t))return{width:t.width,height:t.height};if(tse(t))return{width:t.displayWidth,height:t.displayHeight};if(Zie(t))return{width:t.width,height:t.height};if(ese(t))return{width:t.width,height:t.height};throw new TypeError("The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'.")}function Yie(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLImageElement)}catch{return!1}}function Qie(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.SVGImageElement)}catch{return!1}}function Jie(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLVideoElement)}catch{return!1}}function Zie(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLCanvasElement)}catch{return!1}}function Xie(t){try{return t instanceof ImageBitmap||Object.prototype.toString.call(t)==="[object ImageBitmap]"}catch{return!1}}function ese(t){try{return t instanceof OffscreenCanvas||Object.prototype.toString.call(t)==="[object OffscreenCanvas]"}catch{return!1}}function tse(t){try{return t instanceof VideoFrame||Object.prototype.toString.call(t)==="[object VideoFrame]"}catch{return!1}}function rse(t){try{return t instanceof Blob||Object.prototype.toString.call(t)==="[object Blob]"}catch{return!1}}function oHe(t){try{return t instanceof ImageData||Object.prototype.toString.call(t)==="[object ImageData]"}catch{return!1}}function aHe(t,e){try{const r=new OffscreenCanvas(t,e);if(r.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return r;throw void 0}catch{const r=document.createElement("canvas");return r.width=t,r.height=e,r}}async function nse(t){if(Yie(t)&&!await uHe(t))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(Qie(t)&&!await dHe(t))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(tse(t)&&hHe(t))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(Jie(t)&&(t.readyState===0||t.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(Xie(t)&&vHe(t))throw new DOMException("The image source is detached.","InvalidStateError");const{width:e,height:r}=sHe(t);if(e===0||r===0)return null;const n=aHe(e,r).getContext("2d");n.drawImage(t,0,0);try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function cHe(t){let e;try{if(globalThis.createImageBitmap)e=await createImageBitmap(t);else if(globalThis.Image){e=new Image;let r="";try{r=URL.createObjectURL(t),e.src=r,await e.decode()}finally{URL.revokeObjectURL(r)}}else return t}catch{throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await nse(e)}function lHe(t){const{width:e,height:r}=t;if(e===0||r===0)return null;const n=t.getContext("2d");try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function fHe(t){if(rse(t))return await cHe(t);if(oHe(t)){if(pHe(t))throw new DOMException("The image data has been detached.","InvalidStateError");return t}return Zie(t)||ese(t)?lHe(t):await nse(t)}async function uHe(t){try{return await t.decode(),!0}catch{return!1}}async function dHe(t){var e;try{return await((e=t.decode)==null?void 0:e.call(t)),!0}catch{return!1}}function hHe(t){return t.format===null}function pHe(t){return t.data.buffer.byteLength===0}function vHe(t){return t.width===0&&t.height===0}function HV(t,e){return gHe(t)?new DOMException(`${e}: ${t.message}`,t.name):yHe(t)?new t.constructor(`${e}: ${t.message}`):new Error(`${e}: ${t}`)}function gHe(t){return t instanceof DOMException||Object.prototype.toString.call(t)==="[object DOMException]"}function yHe(t){return t instanceof Error||Object.prototype.toString.call(t)==="[object Error]"}var M5;class GT extends EventTarget{constructor(e={}){var r;super(),$ze(this,M5);try{const n=(r=e==null?void 0:e.formats)==null?void 0:r.filter(i=>i!=="unknown");if((n==null?void 0:n.length)===0)throw new TypeError("Hint option provided, but is empty.");for(const i of n??[])if(!HT.has(i))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${i}' is not a valid enum value of type BarcodeFormat.`);qze(this,M5,n??[]),eHe().then(i=>{this.dispatchEvent(new CustomEvent("load",{detail:i}))}).catch(i=>{this.dispatchEvent(new CustomEvent("error",{detail:i}))})}catch(n){throw HV(n,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return nHe.filter(e=>e!=="unknown")}async detect(e){try{const r=await fHe(e);if(r===null)return[];let n;const i={tryHarder:!0,returnCodabarStartEnd:!0,formats:Uze(this,M5).map(s=>HT.get(s))};try{rse(r)?n=await tHe(r,i):n=await rHe(r,i)}catch(s){throw console.error(s),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return n.map(s=>{const{topLeft:{x:o,y:a},topRight:{x:c,y:l},bottomLeft:{x:f,y:u},bottomRight:{x:h,y:g}}=s.position,y=Math.min(o,c,f,h),m=Math.min(a,l,u,g),S=Math.max(o,c,f,h),E=Math.max(a,l,u,g);return{boundingBox:new DOMRectReadOnly(y,m,S-y,E-m),rawValue:s.text,format:iHe(s.format),cornerPoints:[{x:o,y:a},{x:c,y:l},{x:h,y:g},{x:f,y:u}]}})}catch(r){throw HV(r,"Failed to execute 'detect' on 'BarcodeDetector'")}}}M5=new WeakMap;globalThis.BarcodeDetector!=null||(globalThis.BarcodeDetector=GT);function mHe(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M3 3L6.00007 6.00007M21 21L19.8455 19.8221M9.74194 4.06811C9.83646 4.04279 9.93334 4.02428 10.0319 4.01299C10.1453 4 10.2683 4 10.5141 4H13.5327C13.7786 4 13.9015 4 14.015 4.01299C14.6068 4.08078 15.1375 4.40882 15.4628 4.90782C15.5252 5.00345 15.5802 5.11345 15.6901 5.33333C15.7451 5.44329 15.7726 5.49827 15.8037 5.54609C15.9664 5.79559 16.2318 5.95961 16.5277 5.9935C16.5844 6 16.6459 6 16.7688 6H17.8234C18.9435 6 19.5036 6 19.9314 6.21799C20.3077 6.40973 20.6137 6.71569 20.8055 7.09202C21.0234 7.51984 21.0234 8.0799 21.0234 9.2V15.3496M19.8455 19.8221C19.4278 20 18.8702 20 17.8234 20H6.22344C5.10333 20 4.54328 20 4.11546 19.782C3.73913 19.5903 3.43317 19.2843 3.24142 18.908C3.02344 18.4802 3.02344 17.9201 3.02344 16.8V9.2C3.02344 8.0799 3.02344 7.51984 3.24142 7.09202C3.43317 6.71569 3.73913 6.40973 4.11546 6.21799C4.51385 6.015 5.0269 6.00103 6.00007 6.00007M19.8455 19.8221L14.5619 14.5619M14.5619 14.5619C14.0349 15.4243 13.0847 16 12 16C10.3431 16 9 14.6569 9 13C9 11.9153 9.57566 10.9651 10.4381 10.4381M14.5619 14.5619L10.4381 10.4381M10.4381 10.4381L6.00007 6.00007"}))}function bHe(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M12 16C13.6569 16 15 14.6569 15 13C15 11.3431 13.6569 10 12 10C10.3431 10 9 11.3431 9 13C9 14.6569 10.3431 16 12 16Z"}),qt.createElement("path",{d:"M3 16.8V9.2C3 8.0799 3 7.51984 3.21799 7.09202C3.40973 6.71569 3.71569 6.40973 4.09202 6.21799C4.51984 6 5.0799 6 6.2 6H7.25464C7.37758 6 7.43905 6 7.49576 5.9935C7.79166 5.95961 8.05705 5.79559 8.21969 5.54609C8.25086 5.49827 8.27836 5.44328 8.33333 5.33333C8.44329 5.11342 8.49827 5.00346 8.56062 4.90782C8.8859 4.40882 9.41668 4.08078 10.0085 4.01299C10.1219 4 10.2448 4 10.4907 4H13.5093C13.7552 4 13.8781 4 13.9915 4.01299C14.5833 4.08078 15.1141 4.40882 15.4394 4.90782C15.5017 5.00345 15.5567 5.11345 15.6667 5.33333C15.7216 5.44329 15.7491 5.49827 15.7803 5.54609C15.943 5.79559 16.2083 5.95961 16.5042 5.9935C16.561 6 16.6224 6 16.7454 6H17.8C18.9201 6 19.4802 6 19.908 6.21799C20.2843 6.40973 20.5903 6.71569 20.782 7.09202C21 7.51984 21 8.0799 21 9.2V16.8C21 17.9201 21 18.4802 20.782 18.908C20.5903 19.2843 20.2843 19.5903 19.908 19.782C19.4802 20 18.9201 20 17.8 20H6.2C5.0799 20 4.51984 20 4.09202 19.782C3.71569 19.5903 3.40973 19.2843 3.21799 18.908C3 18.4802 3 17.9201 3 16.8Z"}))}function wHe(t){const{scanning:e,startScanning:r,stopScanning:n}=t,[i,s]=T.useState(!1);function o(){s(!0),e?n():r(),setTimeout(()=>s(!1),1e3)}return qt.createElement("div",{style:{bottom:85,right:3,position:"absolute",zIndex:2,cursor:i?"default":"pointer"}},e?qt.createElement(mHe,{disabled:i,onClick:o}):qt.createElement(bHe,{disabled:i,onClick:o}))}function xHe(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M13.225 9l5.025-7h-7.972l-3.3 11h5.359l-2.452 8.648.75.364L20.374 9zm.438 3H8.322l2.7-9H16.3l-5.025 7h7.101l-6.7 8.953z"}))}function EHe(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M14.516 15.158l.714.714-4.595 6.14-.75-.364L12.337 13H6.978L8.22 8.861l.803.803L8.322 12h3.036l1.793 1.792-1.475 5.16zm5.984 4.05L4.793 3.5l.707-.707 3.492 3.492L10.278 2h7.972l-5.025 7h7.149l-3.71 4.957 4.543 4.543zM12.707 10l3.243 3.243L18.376 10zM9.795 7.088l2.079 2.079L16.3 3h-5.278z"}))}function CHe(t){const{status:e,scanning:r,torchToggle:n}=t;function i(s){n(s)}return r&&n?qt.createElement("div",{style:{bottom:35,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},e?qt.createElement(EHe,{onClick:()=>i(!1)}):qt.createElement(xHe,{onClick:()=>i(!0)})):null}function AHe(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-7.46,0.5l-1.5,0c-0.645,0 -0.643,-1 -0,-1l1.5,0l-0,-1.5c-0,-0.645 1,-0.643 1,0l-0,1.5l1.5,0c0.645,0 0.643,1 -0,1l-1.5,0l-0,1.5c-0,0.645 -1,0.643 -1,0l-0,-1.5Z"}))}function SHe(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-4.96,-0.5c0.645,0 0.643,1 -0,1l-4,0c-0.645,0 -0.643,-1 -0,-1l4,0Z"}))}function _He(t){const{scanning:e,capabilities:r,onZoom:n,value:i}=t;if(!e||!n)return null;const s=(r.max-r.min)/3;return qt.createElement(T.Fragment,null,qt.createElement("div",{style:{bottom:130,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(SHe,{disabled:i<=r.min,onClick:function(){n(Math.max(i-s,r.min))}})),qt.createElement("div",{style:{bottom:180,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(AHe,{disabled:i>=r.max,onClick:function(){n(Math.min(i+s,r.max))}})))}function IHe(t){const{scanning:e,loading:r,capabilities:n,border:i=35,onOff:s,torch:o,zoom:a,startScanning:c,stopScanning:l}=t,f="rgba(255, 0, 0, 0.5)";return qt.createElement("div",{style:{position:"relative"}},qt.createElement("svg",{viewBox:"0 0 100 100",style:{top:0,left:0,zIndex:1,boxSizing:"border-box",border:`${i>=35?i:35}px solid rgba(0, 0, 0, 0.2)`}},r&&qt.createElement("text",{x:"50",y:"50",textAnchor:"middle",fill:"black",fontSize:"8",fontFamily:"Arial",fontWeight:"bold"},"Loading ...",qt.createElement("animate",{attributeName:"opacity",values:"0;1;0",dur:"2s",repeatCount:"indefinite"})),qt.createElement("path",{fill:"none",d:"M23,0 L0,0 L0,23",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M0,77 L0,100 L23,100",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M77,100 L100,100 L100,77",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M100,23 L100,0 77,0",stroke:f,strokeWidth:3})),s&&qt.createElement(wHe,{scanning:e,startScanning:c,stopScanning:l}),o&&n.torch&&qt.createElement(CHe,{scanning:e,status:o.status,torchToggle:o.toggle}),a&&n.zoom&&qt.createElement(_He,{scanning:e,capabilities:n.zoom,value:a.value,onZoom:a.onChange}))}const THe={facingMode:"environment",width:{min:640,ideal:720,max:1920},height:{min:640,ideal:720,max:1080}},PHe={audio:!0,tracker:void 0,onOff:!1,finder:!0,torch:!0,zoom:!1},kHe={width:"100%",height:"100%",position:"relative"},RHe={top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden"};var MHe=function(t){let e,r=!1;return(...n)=>(r||(e=t(n),r=!0),e)}(()=>{const t=uze(window);switch(t.browser){case"chrome":Eze(window,t);break;case"firefox":_ze(window,t);break;case"safari":kze(window,t);break;default:throw new Error("Unsupported browser")}});const OHe="data:audio/mp3;base64,//PkZAAhghE0AKToAJra/n0FQygAAAGIkYJgmCYXBMAAGCTJz3zhCEM//z//1hz//8MMMMN08ssV6e5DDWIQreAgCvFKy8bXgIKMkUDDBgzJwIBtkRMQAocxIFdxghQGKDoEziAzQxOBOdH92i/iGi+zDCAEIX46a73HrSybZw1x3JZjXp7dSNy/P68rjcbt7p7fakMP5LVMyzCaj1pjvejYYAIDgDGzECjEAk1Jl3559HIon8hzlfPVTCvGJZzfcKSxXfyMWM88//9VKSxXdtnb9vomOuuRyiWVYbf+X8zp6fKGHIdycuWMMMMMMKSnp+6wsYc/9f/7z7rPPWHN556p6fP8MMMP///PPP/7+GHK9PT6p7f/unldP2np7YeHjweiYA4GLNAgAiI7u57n5//oc5/yfk6znOcPhwOBwggHCMpA4HA4KEyHOc5znO+hPIc5//+fqJh8XQPh90JU5xQinOf//87/zvP+ggAYuhCKHxdA+Hxd0EA4KKHA4ciB3kOXfXB/gmf8p/B96lAMKAgAADU+BujARHgwdisgHMfAUHAiceBg4ASBgZBiBIBH4ZaHOJsLhf8R+HYEciIgYSwj/+Bi7EqBh+AcBn5P6Bh4TuBmrAMBiZH7gaLEWgew//PkZFMlyek60MpYAShzqqZhm6gCUWeEUWAewEWYGN4X4GDEPwGE8S4GDoOIGAYKgIQOkz//gGARAUB+CwGxTwMAACAEgyAwdAlAxKhzAxXiZ///AxcEwAwJjDAziCAAwQgdAwRgdAsJQDAmAcGzYDwAhZIAKAcIQB4GT9TQMJ9/4Gi1Fv/AcAYUqKBAwGgNAwVBAAwGhwAwdBlAxFg1AwlgzAwNBuAkJQDBgEEDEqGECgChFgBgL//CIswYYH//+HKCpk4K0C9AaKKCAOBeMcR4X9C44BwABCgGAsGYCgTwHAcAwXAiAwSAQV///CJP9lwMBQAwAAAWGo5lVLCcaeneVhJAVGai3//ioaUEf//gaTAYGCj8BnEwfrIqDcsIQb/vmhU/8fAs0G8YGGwKST8Igj4GCATipksVzY8p//90FWJwh45AkX//4fCF9wMEgkL3uQc+gbGJ8t4MBAMBP/hEXf9FRuWBcAfIFjYzQdoLCBwh7IWVlxaX/w8oMCP/+EQT5poGB1Ir90DhiV6af/jFYBpT2BgoQyyt2M0ToBdEaZyzt8nTo3xdNDCTSd//o6F06CjooxRr4jVF/0bOKD6OMUNDRxiMUVFR0FFQPhGXRjDpr4MAEA4wIQUhYOIw//PkZE4nrg08sOx4ACQ0CopD2aAAlwTTBxQeMcwd8w8gZTAgABXwGABOkzpI0wAQAExnWfP4x8ZjKunWdZ1o1Qe6lFGKCNULORQCELAAPnRUf/GIx/0FHGfo3SdZ0qP2cukXKLlRtBKFgAQwCkwJgFRYBEEATmDsLSY2QiQYCEnEra+UZo6F1aKMRr6GhoaP/+j//ov+i+hjLqBgMkYoqChoo1GqCjoY06TpRqjjLOYzRRmMuizmgdKhdF8kjTAAAPMCwGswzglgwAJfzqxmioKH/////////////+ijLOAwFmN0f/////////Q///8ZjP/9DGYyFwIDBeB3MA4AlBWidKM5spykAUAQOCakK+udGqN8VDYjTRuN//0bVX//6Kio4xQFv//nf//kKOoAEIB6SY6hcxenp85///4/DEPf/84Xvl4vF4dwtxfEJgCYQHMSgKCROp4+fn////L4tQf0unz89OecLxeL0ul09y6enzp4dIhKAQFA5hKfLu1nU7/Wr71rRKJUBQSUVt////l08GUPVWgAAYAeNKsxbQNAAhQx3/oKGMM6dZ1Yy6sajMbfKio7lNcv0sScZ47lNcw32ekVFMP9fp/f+mklI6at6u/dBMQuW6y+C5BcgwAA//PkZEomGg1HYGe0riWsCqbEwiY0BJFJMxrCcxGgQ2VK8xxCF1wsABgQBBgQBAYAFCkYCgALkK4fJ00E5ctJN1Uxy5au3XoGcM4dSN0EYZwzhW0WCh1PZwzhnFFQxtnbO2d0Kt6CdXbruggkTEX5Rs4TEQUVsdVXaCcuWXIBQUGmwmgoAGcJiM4dSioHQdBnEY+hjcbov//jcb/43G43G/jCRibfxugdBnDqULO2duvQumztncbo4xGKKNxugooxGIxQULoOgFgUMTA/jbrxiMDmETL+eLhcPThzOeeOZfL5fIcBYuXD/OHv8t//LJFxjxQYHHKDGFkZMtlmKM0RgQfbVtxFIHbQBDRuzRguEI1c9XZ/rWmrZfVU3Oc/9utNNygRQkCoHlAYstNN6DJ1IINpoINppv+WG/+g2mmnUmmmpBAoJIJhnwB5xkymn606Df/t000xhU03UXC5Ol8uFyXy+Xy/l8v5w4cLk4XAvwAYUvl/QL5fTdlKZkEEEEGumaKaX00zIOemf6CH///ywI3LKpiQ2Ef4xYWMSDyI0XwzikpL0ajVHZ3j9DGIjeuXcNfjn96/S/TUz/X/vX////5K/r+v7Jn+LlAoGZOIQIwMKBQM/yppKYURmhGZkR2b//PkZE0mHg1HEG8wyiD7mlwAyDU8nJHi5htakZmZGNiRcpkJhBmUmZYQcM1VDEEBggNDV/ASEZRYKFZIhkXKLlKmk7IVTKmZNJ5KhiqVUqpX+k7+qlVKyV/ZIqZDFDWTJlFyi5TJpKhiXKBQyZzIS5JhBoayV/AQWVpGWkcYTV5O/rIVSv8/0nkr+v6/vyR/X9f1/ZN8kf5/n99/n+f5/lTKmf9/mRP8yFUqpWSv4yJUqpX9kj/MmZNJ5K/z/P9J5P/v6yFUz/CEoywgUMqZkz/FssECIsVq0aPRrRRatFFFykQZJ2Ukl///5KjmksOaA7ALROJLDnEsLbq3GTMVrwb/0dGzmM0DlfBlHQOmrdR0MYi92TX6b/cmDHLclyUVYO/4O8sFTKFTKFf8yhUyhUyhXzKlDKlCsr/+ZUoVlSsr/+ZQqZUoZUoceMfcoZUoZUoVlfOPGcmDHKcpynKg9yXJcr3JclyXJclyYO+DXJclyfgxFZVb3KcqD/g2MxzsY72L9LubPR0dCyf5K5NNd+Tv9GXRdV0XJclyfcl/n+k8kf6SX/iVynvXf///4Mg/1OkxguYzmM5jMcLHMxwwGhgNCwXMLAcwMXTLi1MD7w7tmTdBvMmE0xQFzCwHMDAd//PkZGMpigkmAGOUvCfTgcgAuC+ITswMFzC4oMLhYMByn0xvU+p9Tr0xUxf/0xv///1PBYDhgNTFTFTGTGTGTGTGTGTGTGC4GTFMDAcLAdMVMVMULAcMBpgYDhcDGFwsYXFBikLGFwMGA4MBxgcDKfTEMUoAx2BisD+mKp5Tv1OkxkxkxkxkxkxkxkxlO0xVPJi/6nv////U7CwHTFTFTGTGTGTGU+p71PpjJipihYDpipi/6n1Ov//C4GC4GTGTGTGTFU8WBSZdLhWB//yKlotyLZFiLf8tyyRUipFSKkVGRBZQMiWC3yx//wxUGKsSvDFQGHUAL3QMsHDFIYpCYy2Bmagy6BjLgy6Bh3od58DCLAizBgRb+EQiyEQiwGBFuDAi3/////20QqSBJf/qcumv/////wMZdGXAYMu1gYy6MuBEZdBgy4BjLgy6BjLgy6BjLgy6BjLQy6DBlz2cJDLgRGXAMZdGXAYMuhMZcCIy6sJGaoGMuppwNRl3WBjLgy63wiEWAwIt/+EQi0IhFsDCLAi0GBFkGBFgMJCqaqYAgAYIhBBvwf7kwcqRq7V3IctacvlN6NxqgooxRRuNRiijEZjMGRuMvz9FGozQ+1X2qe1T1S//+VhaWAtKwtML//PkZEIkbgcaAHc1xCJrjeAAtfuUAtLAWf///mWePH95ZFgsyssvM88+jzO6K+z7OM48sH+WDiweZx5YOK+zxWLGJWsa6xadAv02fTZLSpsFpvLSga0tMgWgUgWmwgUmyWl8tMgWWmLSoFJsoFlpSwsmyBg4HhEdgwHAYPBwGDgeBg8HwMHg4DB4PBgOAwcOwMHLwDn5lAwcDgiDgYDwMHA/4MB3//+EQeDAdwiDwYLPhEWQYLODBYERZBgt8Ii34GLBaB5pfAZ0FvEAQ/UfwxULlx+IXx+8f5CELH8fxKhAIDFoHBEDRc3////gwHgaRXgMHYMB2EU/gwZ/gYbw3gY3QbgYNgbgYiAbgwN3/+EQbBEG4MBuDAbAwG4RBtAwbg2////+B9B6F//////////hEdD//////////8DRahEQGCInMNg3LBElgNjDciCwG/lgNiwGxWG///mG4bf/+WA3Kw3KyIMNw2Kw3MNg3MNg3MNiIMiQ2OK0xMiA3KyJLAEZgRARmBEDEYFwBBgEgEeomowol5YAJKwCDAIAJ8sAE+gGBgCJYAQUZ/13LubMu5dyiYOAhKwEFGf9AOoz/g4CFAIol/lgAjysAgsAElYBP////lgJksBM//lgRUxF//PkZGApggsIAHt2wiNLoggAqCz8RFSwIqYioipkjEjHCCSN/+WJg5iYOYmPK5krmTmZk5mZ8sTJYmf8yJiNiIisi/ywRmRkZkZGZGRmRERkREZERGRERkREZERGxEf///hETIMEyBiZEyBiZEzwiJgDEwU4DV2gQGFOBgmP8GAiAwRAiBgIgYCIGAi/4MBHAwRgjAwRgjwMEQIgMcgY8DBGCMDBGCMDEyJn///+BiYQIBlObj4eYLIwsjAOBGFkYBoEQ84eULIw88LIA88PKHnw8sPKFkeHlANAiAaFUDAiMYPIHmDzBZBhZB///8GBOA1sH/Awni7AwnhPCITwYE/CKzBgt8Ig8GA4Ig6EQdww4Yb+F1sIgtwYCwGAsAwWAsBgLAYCwDBYCwDBaHUDF+VEDKgC2BgtBaDAWgYLQW////gYLAWQMFgLAMFoLcGAt////4RMABmBSj4NgwMOGHBsHhdcLrwbB4XXC6+F14YcLrww4Ng8MOGHBsHww4Ng8AUC4AoMQMC4fgw3wutV4QIsAgFYIBWCCVgHeVgHeWABCwAIVgH+YBwB5aRAstKgV6Ba1oMg9avtUVN/qdLWciD/cqD3Jg6DFPuTB/////lYAn//mC8C+YLwL5gvgvGC//PkZFEpLgMKYXt2xB5LogAArbdc+C8VgvlYL/mC8C+YLwL5YBfMNgNkwXixDWoHPMc4VUxVA2TBeDZPYXzXl815fK14sLxYXvK1//NeXzXl815fMtdDLSw3UsMtLCstMtLDLSwsFhWWlgt//8sFhW6f/////+WF7zXl8sL5ry+Vrxry+WF/wMLwX4MC+EQv/AwvBfAxsjYAyqpKA0lpLAwvBfBgXv///4RA2DANAYGgNgYGgNgYGwN+EQvf/BgXwYF//8DC+F4Dd6NgGBf4AgFwbB0MMF1wuuDYMBsGwusDYOBsHA2Dvg2DQuuDYOhdcMMF14YYDGYDEGwfhhgbB0MN///4RBaEQWgZByoYRWYMFvwiDsGwaF1gbB34GDwdC64XW/w1aKxDVgatir4YcLrQbBwNg7////////////+ESfgZPyff/////////4MFmBvvMAERZ8CC5adNj02E2S0qbCBSBZaYtN///oFlpU2QMXIFAYuQK9AtAo7IxLTpsIFJs/5aZRxQawaxGfIg9CsrI+PUqkWdOHp7ODsOl6cOHZ4dsulfLI9/8BAAgMBACsBLACVgBjoAWAE5OTM6WDAR0zodMdHCsJLASWAjzCQgsBJhASWAjysI8wkJMICU//PkZFkeqgcaYDd1th6DogAAqCuIxQwtDA5MdMULgyY6YqnXqdep5TpMdMVRNRL/UT9AN6jCiSjKAZRNRhAMomgFQDfCIJwYCQiCAiCMGAkGAgDBJUA3eVAMEgj////8SrDFIYqh5g8kPMHkDzB5OFkYeYPJ+HlDzB5+AYVQDibCyIPLLEZIsjIliWS0WywWyyWuWCyWJaLZbLJYDHgLAItFvy3///4eYPKBlQTh5QYEODBb//hhoNg7/C62DYPFUKwKsVgNWBq8VkVcVkVUVYrH//hGff/8Iz8GT7//////wiX4ML3gwvgwvf4ML3gZeqoHVGyBl4vgZfL2F1oNg4Lrg2DcLrg2DQw0Lrhh8Lr4YcMNBsGhdcGBcMOGGAFGAGMQsF1guuGG4XXV/4uQXOLmF1kL/8lCXkuSk4O8/FzHzuP0hIucf/CIFAMCgFPgYFAKAwCgGBQCgGHYO4GBVM4GgQI4RCMEQKQOtQjUI1CNcI14MqDKwDIAGQDzh5wsjDyw8uHmDzYeUPN+DEYRRhFEIowYgDQgIhWDApgwKAwKQYFAYFQMKkYDOxHAzsRgMKBUGBX/h5v+Hm4ecPNh5A8wBwjhZHhZAHlDzBZAFkAeQPKHnCyILIAsih5QsgDz//PkZLQgIgsMAFp1xCGLogAAA2rkB5w8oeYLIQ8kPMHkCyGHnAMKoGmAgFkUPMHmDYAtfHPHNkr/JYl8c8lCWHPHMkqSo5onMAkBDnfJX//8IgDBgBhEdAaxSQMHUGAEIgAV4risCcipBOMVRVBO////hEvAxsAwvf////8MPDDww4XWC64XXDDww4YcMPC6wYb/wYGgiGwMplMDYhTCIaCIaBga/////8GA+EQdgYPB4MB4GDwdhEH8Ig8Ig8GA6EQcEQf8DBxlBjoAweDuFwgCQXiL//iLiKCKCL4XCiKRFwEgoRT4iqpMQU1FMy4xMDCqqqqqqqr////xuDd8fv/DVwrArEIg6EQdhEHAYPBwMB+ERYBi0WAwWAZ0FoGLYOB+JfgZ0FoGdBaDBYbn+WHm9xW7/Nzzc83PLDzc8reWlA7S0oHamx//6BflpU2C0qbBaf/8yk/ysn+VkMhTKQrKVk8yE8rIVkKyYsAn/5WC+YICmCApWCGTkxtKMcVWlgFMEBTBAX////0C0C0C/////////LTFpvTZLTlpv/0Ci0xaYtOgWmymyWkAxcWmTZTYTY8tMmygUWmLTIFpsFpv9NnywLmLCx2RgWmQKTZ98UjnzZ1/++D4M6/////3//PkZOgjIg8IAFcbxCaTogAAoCuIzfJ8vfJ8Wcs5fBnD5//++L5f////////6nCKv//+o0o0FUYwqDNGCwgUMKC0VVGkVv//4Yf8LrxVCriqDVoasDVuKsNWw1bisBqwVkVkVX//gy/4YYMMGGhhgwwNg4LrhdcLrAYWGAA0zBsH4Ng3C6/////4MAoGBQIDAKBgUCAwCgYEAsDAoEAwKBAYBYMAoGBQIBgUCYGBQIBgUCwiBAYBYMAoRAgRAoGBBMBooCAYFAkIgTEUxFv/EWxFxFhFoi0LhQuFiLCL/EWqTEFNRTMuMTAwqqqq//////8TWJriV/hERAwRgYiEYGIhGBmIRgYiEYMEQMEcDMSiA1GYwMR+UDMTkA7KIgMRGIGGM0SIrRGjRlhEV4jxov8rR/5YRFhEdQSViCsR5iRJWIKxPlgQYgSViSsR5WJMQJLC78IiKERF4REeERGEREERHwMRGOBmIRhERhERAwRAYiEQGIhGBmIRAajkgG5TEEREDBHwYIwYI4REXCIV/4MCmDArgwKAYUO/gYVCkGBUGBTgYUCsGBUIhUDCoUCIVBgVBgVBgUhEKQMKhUDCoUBgVAwoFAYFcGBQDI6oA5+qQiFAMjBUGBXCyEPIFkOH//PkZPMj6gr6AFdVwifkBdwAoC2Ilh5/8PPh5Qsih5IeUA0TAZrE8PP////wMRiIIqID8piAxEIwMxCMDEQjCIj//BiIDRo8Iogii/4MKwYVhEoESkDEiIGJEgYlfBgmDBIMEAYgSBiBIREAwSERH/8I7wPfuCO4I7v/8GBvAw3Bv/////gwN34RBuBg2BuBg2BuBg2BuEQbhEG+EQbAwG4MBtwiDaDAbhEGwMBuDAbAwG4GDYG8DBsDcDBuNwDRWDcIg2AwbA34RBv///CINvCINgMRIN/////wiG4DDeG+TEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq/zB4OLAP8rBxWDisHlYOKxb5WLTFgsMWiw18LDOnjPxZoxadDOgsLAtLAbKymVhsrDZWG/LAb8w2GywGysNlgNFgNGFwuBQuWnTZLToFFpisLJsFp0Cy0voFAQLFZkMCAQwIBCsC/5WBCwBCwBCwBCsCeVgUwIBCwBDEwEMCAQrAhgUClgCFgTlgCGJgJ5gQTGJwKWAKYFApgQTGBQL5kY0HMjQYnAhWJvKwIWAIVgQrApYAhWBPBgECIEBgE/8IgXhECQiBAMCkcDEwEwMCAQGAQIhoIhsGBsIhvgwN//PkZN4irgr2AAOVqiUThegAnCtMgwNwiG/8IhuDA1hENhENgYbKYHb2IBhoNhENAwN////8IhsDKZS////8IhuBhspgc0KQRDWEQ3///CNf4GAIMDAwgAwAAwhAwAwYAIgwiHBgAMAYGAAGHv///CIBqBqESDEIgRYGoGHBiDEIgGoGgMAYgxgwgxCIETwYFYMCoMCuDApBgU8DCoU//gY3G//wYFOBhUKBEKQYFfBgV8IhSEQoBkYK8IhT/wMKhXBgUCIU4RCoRCvgYVCsDCp3A1SqAYFAiFP////gY3G1TEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVgwCAwCBEC///////8IgUIgWEQIBgUCAwTQMCAQDAoEhECAYFIwGaRMBotWAasdwH/KqBmhFgaKI4GRgKVpjCBTCBPMJHNMFMIFKwnlgJ5hUxhUwGWlpAMuMuWLTFpvQKQLQKLTIFJsoFIFFZb/8woQwoT///MIF8rC+WAphAphAppgpYClgsmwBC6bHoFFpUCi0wGXFguWCwFLgUsgX6BZaVNj0Ci03//+EQKEQKEQLCIFAxMBcDAgFAwIBQYBODAKBgUCAYEAuDAKBgUCAYFAgRAngwCgwCwiBIRAmE//PkZN4iogj2AFdVxiUrhewAhOkwQIBgQ0gbOI4GRhOBiYCgYEAv////CIFAyMBQYBf///CIF8IgUDAgFBgEAwIRwMCCcDEwFAwIBf///CIEQGMDGEXCKBpCIDCEQDCAsYInDFQMMAuYSoTQMVfBlf//+DKfBgAiGDAQMIMIgCIQYADAEGAgwP////8ItgNu2/8DAAAiABgHhECBgQGEQARA8GAeEQIMABECEQIMAwYBBgCDAARA4GAAgYACDAARAwiAgwDhED4RABEBCIGBgDoH2dgZwCBgAP//BhX/+DCiTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqF1ww////////hdeGGDDBhwjeF102E2fTYAowMLjE0zTDfyyMYjEDJTwMLSwFi0/gQLoFIFpsegWmyBQsWlQL9ApNgtIWn8tMgX6BaBX+WmQL9Nn02f9NktIgUgWmwWl9Avy06bCBSbJaUtImyWkQKLTIFgYWoFFpAKFwMLzZgwAwvLTIFlpU2fQLQK///4Yf4YaF1sLrg2DAuuDYNDDQw4NgwLrhh4XXC64Ng3C60MNwbB4XWC64YcMODYPCJYDlMQBlwRLg2DOF1v/////PkZM0eKgz0AE+UuCnLFfAAk3Fsg2DAYX/ww//4YaGGDDhdbDDACFwMuXA2DADlygusDYOBsGhhv//wNU/CKQusF1oXX+F1wuuGGC6wXWDDBdbC6wXXhHv//4AHIFgC0BZAA4Ba4FkADwFsC3AtQAOcC0BYAtgAcAA9+BYAsgW4FvgWOABwC1oq+it4RT0VVG0VFGkVywo1/RWU4U59TlFb1GvRX////QK9Nj/9AtNn02fTY9NhNlAr/QK//TYTZLSJsIFemx///oF/5aZNj02U2C0yBaBfoFAS6bKBfoFVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQiA8GAO/4RAf//////wYA4GAO+EQHAwB4GDoB4GA4HQRB0BhlDIBpEAcBgPDIBgPAeDAHIFAYuLTpspsJsFpi0haRApAtAstIYKClgF/ysF/ysE/ysF//LAJ6plTlYC1ZUypmqtWVK1VqyplSFgBaqqcwAAVIqcrEBAAKmMBERCQhwD5iICIQEyABMAABBVGXF4gIA4DLAAWAEQgLVSsBaq1ZUv+YKClgELAJ////5YBP//LAL5WC+Vgn+WAX/LT+gW//PkZMIhLgrsAFt1yiD7FiB6A9qwmwViybCbCbCBSBabCBSBabPpsegWmwWn9ApApApNgCGBmEwWlLSpsf////hEHgYOB3////4GDkiBxMHhEdgYOB4GDwcBg4HW23gooFYHd/+BnAz8O8Vv//FaBm4rBWh38es2zbAtD1m2PVBqBrBqBrAF7AF3/5el84MkuHTgyy+dL0dRnEajMIyOn8RsZ5HGG/kbIpHIkYUiD0y2WctlZaWSwrKx6FZbxnL54ul04eLhw9Ol84dl86cOHT3Ipb5Z8qKpVx6/j0EkLctVTEFNRTMuMTAwgWQLQAHgLf/////4Fn+EQESEcIgInCIRW9TkrCzH0YIjjWtI+YeCD0woLCBQwsKRWUaRVCBZFZRtRtFRTlTlThRtAr0C0C//02E2fTZQK/0Ck2f9TlFRTlTlFT/9TlFVFRFb/9ThThynIQbWkAREue5S11rKdlkDEVABh61ExYPU+tOD4MQgcn4iwigivxFRFoXDcRQLhoiwioXCeAkFBcNiL8RURQBIKEVEWiLBcKIqIpEXC4QReIoIpCIKAQMxFAFAsIuIr/4YYLr//ww4XWBgwC64XX/hhgw3hhwuv8MNhhguvhdcAUYgaYTAAoWDDg2DQbBg//PkZPYe6gzuADd1uDKsBhBAe89cYYdGjtDT2hDmlD2leaOv9oX0OX/0NNLplNf8ewakNWGrTfTRpphNJtfaeh7T1/tStdtTpqN532lpX/1/kmQ5eaf2hoaV9paGleJAvd0rer2pWu1ar2vk56vVrV5Hj1Nop+/lfv5Zpkem5kX/2vtata2rq783nbvtbW6VjW6a2rq13+rO6VysV58K7tbp0ru6Vrtqa1a67tr6sau1ulYrnfa2v927Vrt21NSuN5X927/D4diAQANh4gEIfxB+IQG/D/4gDw/iGIRD+HRATEFNRTMuMTAwqqqqqqqqqqqqqqqqqiIEK/ititFX///8VcVuK38VsVhXBOQTpq/qm8QCAcBmIxgdfFZCHECpxFBFAuFEUC4cLhsRTEVEUDVoDQD+KrFYirFX+KwKoVgVUVUVeKwGrhWRWBViqFYDV4rMViKyGroauBg/A0YThVgNAEVQqw1fisis4quKxxWYrAatxWIqoqg1dFYxVxWIrAavAaAArIrAqoqhWYrIqvxWMVYrARCADhcKoVYavDVgqhV4qorIrHFWKuKxFViscVUVYasAaAfFY/4YcMNhdfwuuGGC64YfDDA2DwusANygbBwAxhAECwNg8MOF1hD4//PkZOkc4g7yBjd1sDNkDhgqYwtcYoUyiQ0NCkxQ0NCQkSIbGKIyRGEo5mUaNEhGKEHMmaGhI0UokORvMmZmZSZSiMZQkRnKKZkzRoSNCQpQ0NEZoaNFJkhh3KOUJEhIcoSJCQkIzlDlEjMDMyMpQ0JCQzNCRGaNCRISEZoZihoaIwlEHKNGiMzFEjRmSIwlHMyZmcyiGyMxRyhIkIxRSZokSEYGBkiRojAPESNGjQxvKHMmMoSKTJCQkIwlFKLDYWGhoZhYWAAUGBsAwsMDYUAcK4XDPhQVwwLAH/DfgHC6TEFNRaqqBgjwYI//wYI/8GCL///+DBFhERgwRcIiPAzGYgMRKIDcskBgjAxEIwYI4GiRwNEjhFH4MRwYjA0aOEUf8Io/BiLgxGEUYRRQij/BiKDEYMR+DBGBiMRQiIgYIwiIwYIgiIgMRGIDUSjhEReEREBiIRAwR/wYI/8IiP4MEcGCIIiOERH8GCIIiMIiIIiODBHBgjBgjwiIoREcIiOEREDBFCKiAxHJcIiMGCMGCLwYI8IiPhERgwRAwRAYjEUIiIGCP/AxGIgiIsGCL//4REYMEXhERBERhExhExAzyAZiEWDBGERGeKsVsVRVFcVwTnFcVxVgnYqipFUV//PkZPkcfgzeAFaVxDgUBgAgatvIYrgnYqgnQJyK4riqK4rwTsVor4rQAjABAgnQritFSKoqQTsE5C1haxfF7F4XQtULSFqC1i4LwWkXIWkXRdF+LwqAnME4iqCdwToVuK+HAERWAkAlgJB0OB3Doc8OYc8VCsVgIB3DuHAERUAkAkHMOBwOAIisO4dwEAEAEg6AkAl4CeHA4AkKhXioBIOiv8OB3F+LgWkXxeF8XouxcF0XBeF8XBdF8XhdAdouC8AEsXYWsXOKsVBU/FaKmK/FTxXFbFUVPiv/8VfxXitVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVAXX/8MN/wwwYf//DDBh4Yf/+DYODDfCIFAwKBQiaANFgUDAgFAwIBcADwFuBY/At8C1wLfgAdAtwLGBawLcC3AsgWeBYwLX4XW8LrBhgiFgMlhYLrhh4XWhdb8MOGGhdcMP4YaF1gw8LrwuvhhoYYLrYXWDDBdcGwfC60MN/ww8GwZ4XXC64GZQsF1wbBnDD4XXg2DcLrBdaDYPhhgusF1uGGC64YfhhoNg0LrQwwYcMNC62F1/g2DYXW4XXC6+GH8DTIW4YeB/wR/wjwR+DP/y06bJaRAtAtAtAs//PkZNwY2grqBFW1xDhTRegABLBstL6BRaVAstN5aYtN/psIFf5aQtIgWgUWk8tImyWkQL9Avy0qbKbKbJaf02f/0CkCy05adAsC3K7+mx5aVAv0C/TZ8tOmymwB2pspsFpPLSlpy0qbCBSBXlpk2E2E2C0paUtP6Bfpslp0CkCy0ibJaZAosWQLLTJsemwgUmz6BZaYtOgUWmLTpsJsoFJslpPLT+mwmz//6Bfpsf6BSBSbCBXoFeWk9NhNhAr0Cy0/+WnTZ8tJ/oFf6bP+myWn//8tMmz/lpf//////8sPTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVBgJwiCYMBP//gwE//////wiCAMEgkIggIqIDKpUCIIgwE8IzA4j+EYhGAZMIyDJA5gGRhGcIyDIhEQiIGAgwIRDwiAGAAwYMHBghGAZMGRCMhGYRgGRA5gIyDIwZPBk/wZIRmEY/gyOBxIMgIzCMgcTgwRBgjwYJBgngwTwYJhEQBiBGERMIrwOouAxAgGCQYIhERhEQDBGDBAREgwTCIgGCQYJgwSDBHwiI4MEAwSBiRHCIkGCYGJEQiI/Bgn4REYREeBiBIH6XhERhETwogoy04mpZibFmJuWYmx8n//PkZN4ZrgrkAFZUyDcjofgAA9qc0HafZ8HwNrjaG3xtjaDtJwTo+D55Ow7fxNRNSyLPlqJsAr/lmA/FmWYm5acTQVgTkVQTnBOQTgVxVBOBVFWK4J3FUE7gBABOwToVQTsVhUFcVRXBOhUBORWiuKkVYrCqK+KoqgnQrAnEV+K8E7FQE5xWBOQToVQTsVRW8V4qRUFYVgTsVhXioKgrCqKwqAnYqCtBOhUioK+CcisK8VRUFSKnirFQVBVFcE6FcVoJwKoqCrFXFUE7gnAqiuCcQTsE7xU8VP8VYrgnYrCuTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqn3/l/J/8vHL5f/BhwCETgGpIDOATgEIOFoDcHzgEIDgC+pG7eve1S/6tat7rXupDXSStWoIpGS4TSMQNIySMwpIyAaRkkZ8GJGdBtbwYkZ63tCKRkoIpGWDEjLCKRmEkjOvsEUjJOsIpGa6bOrgxIzsEkjIGJGYUkZVKCKRmqoDkgEjMJJGSYMSMAikZJ3qhp0dq9ru3X1I36FujPbXuxwKbr//waABfg0AC6DUDUDXBqBoAmQawJiGrhqDUGoN//PkZL8USgKcAAblrroTgfQAbhtQAag1QawaYNIAuQa12Lv9si7F2NnXa2Vsi7i/DZl2tlL9l+vL8tlUTUTUTUYQDIBlGUAyifqJKJqJ+p5Mf/U7TETEU7CxkxVO1PKdqeU8u4vq2ddnrsbM2Zs/tl9s67V2NlbIu5sgaA1Q14ExAmAaA0BrDVDXhpgTPDQGuBMA0gTKGgCYgTHDQGrDUGgNcNQaw1hoAmcNIaRIAtALVEgC1gteI8FpBaBIAtcRwkAWgFpBaILVBaIkAWgRwjhIiPEeDXwa/4NUGr+DRwaKBgX/8IhP//wiF8GBMGBP/wYEhEKEQmEQuDAoGFTAwLgwLhG/4MvCM8GSDJCNwZQOXg2DwbB8MPDDhhuGGBsHhh8Lrf4MCQYFCIUGJgiE8GBQMIFhELDDhdaGHhdYGwaGGDDhhuDYMBsHg2D8MMGHBsH8GwYDYMhEKEQgMCeDAsIhAiFBgQIhAYFhEKDAkGBMIhYGEC4GFCBELgYUKDAuEQsGBQMKEwiEBgUGBcIhQYFwYFAwgWDAoRC8GBAYE4RCgwKEQvhEJgYUIBhQkIhAiECIUGBIMC4RCgwJCIUGBAiFgaYLwiEA5cGXCNhGBGwZAw4Ng0MPBkqNqcoqorlh//PkZP8cygrkAFI0wjo7lfAAjhq4SnPor//psoFemygWmwWm/0C0Ci05adApNn/TZQLU5RU9FRFVFdTn1OFG1Gywv/UbUa9Ff0VoFgCwBbAtQLUCzAtgAchHAN8ImAbgBvwDd4RwjQDeAN8I0ImEQEQAbwRgiQjBHhHAN0A3vgG6Ab/CIhEgG5AN6EQESAbmEYI4RABvYRoRABuYRgDehEQiAiIRABvcA3QiQDfwjwDfCICPCJCJCJ4RwiYRwjBEwDehEYRgDfCNCOEQEQEcI+BagAd4FrAscCxAswLfwLAFgC1wLNVMQU1FMy4xMDBVVVVVVVVVBlBkwO3wZAZMIz//////+DJwO0IwI0DsA7cGUI34Rn4RgMuEZgywZQjAZP/hGAcmDKEYDIB28GQGQGXhGgcgRoMgRoHYBywZAZYMmBygyQYFCIUDChQYE4MCgaYJ/gwKEQsGBAiEBgXAwgQLrhdcGwcGHBsGA2Dgw4YYGwZC6/hdYMMF14YcLrYYcMPDDhdYGweF1oYb4MCwYEwYEgwJBgTCIQGBIRC/BgQDCBcIhAMKFhEKDAsGBQYFAwgTgwKDAoMCQiEgwIBhAnCIUGBQiFwiEBicIhAiFhEIgIoBooGieDPA+4GeDPCP//PkZOobXgrkAEY0jjazieQgBKKIBGgyBGhGhGgyAdoMmEaDIB2gyhGwZYMsI0GSDIEaDKB2QOWEaDKB2hGgygcoHYBygdkDtgygcngyAyhG4MgMgRgRmDJCNBkA7QjAZIRoRoMuByhGgyAyAyhGwZYHKByAcgMgRoHIEbCNCNA7fCNA7AZAO0GSEYEaDLA7cDthGgyAyAyQjAOwGUIyDKEYEaEYEYEaEbA5AZQZAZAZIMgRkGXBlBkCMgyAyQZYMngcmEb8GUGQIyDIBywZAZOEZhGBGwO2EbwjcI3hGYMqTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqquDqz8GMDQIvBj///+DGDEGAMAifBj8IuEThFCIEQGPCLwiQYBFCKESDCETBhhGAZGEZ4MjgcSEY4GoRQigxCIEQGPCKBiBrgxwiBEwMIRAY4MQNMIkImDEGIRYMIRYRAYhFBjwYwNQYgwBgBh4GAMQiwYgxA0gahFBgBjgYBFhFhFCKEWBgEWEUGEIgMQYQMYRAMQigxhFBh4GkIgRIRYRAY4RIMQYgYhFA18IoMQYQihFhEgwhFCIDEGIRQieBiEUIoRQYhEwYDAFwGrBog0waAaQawacGsGiDQp9MZMVT3piJjJjK//PkZOYZBgjoaUJQ0DprofQgbhq0dep71PqeU69TpMdMVT6n1OlPKdJjpiKdFZkxlPKdJiJj+mKp/0xFPBoAmYaw0BpwJhDSBMQ1BqAmIEzDSGgNXDRDRhp+GsNMNAEyAmYagJkBMA1BpDXAmECZhoDXhqAmYawJjgTICZBrDSGsNAExDVDQGqGgNHDWBMIaQ0BrAmcCYgTHAmIEzDWGgNYaOBMw0BqDSBMYaA04aA1hqwJhw0ATKGqBM8NYEz4aQJkGoNMNIag1+GsCY+BMQJlDVw0cCYfDXw1ho4aQ0gTCTEFNRTMuMTAwqqoD37wjuhHf/////hGf////hHf/gycEZwRn4MnYMncIzsGTwOdOA507A507hGeEZ8GTuDJ4Rn4HPn4Mn4RnhGcDJwM3YM3gzdBm6DNwR3QjvA927Bm//Bm7Bm/Bm8GbgZvBm4GboR3gzeEd+DN8GbvBm6EZ+Bzp4Mn4HOnBGfA588IzsDnTgZPCM8Iz+EZ/CM4DnTgOdPBk8Iz4RJwGTidBi7AycTgiT4RJ8GE6ESdhEngZPJwGTieDCcESfwYToMJ3AycTwiTsDJ5OhEnwibwYb+ETdwibwibvCJuwYb/4RN/Btf/jYGyNv8bHLUtSzE0/LQBW//PkZPQcHgjQAFKVrjfDmgAge1eMLITcshNy1LX8si0LUTQtCyLQTUteWQmvLItSz4mgmnTJops0umEymDSPsnR9HwfB8k7Pvn0fAvwtcLXF/F+L4vQtQWuFoC0BaReF7AeBfwtcXBdF4XheFwXAtAui9C1haRdi6LwvirgnUE6FcVBVisKgrCvioK+KoqiqAhh3AQFXhwVYrFYCWHMOioVAI4dFWHPDgCAdDgdDmHcBIBEO+HRWAiKsBMO4dFQCAdATw6HBWHBWAgHBUHMOf/gICsOCoV4qw7+KxWHA6KhVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVC11Fz1+NP+/Xkqpr9OfuhQ6lZNWf+XsZc/si+KNoOj/Ntai9j7IISgZAklTqQhjToNTeQoreRdaSDODWvYAVFaWWkQmVuZPP8bRUzq896vc+XS6mm5gnnW7JLnV4z9N5XnW4k86x+uyHyxnWkmdborzraff2SvOtvljOtjd/5XRW8MivOsry/K3gUzrFPS1eFTOttTsul1+lLGdbV3c53h51mdbK7xPOr1SpnWlM63kedZnV4XPK86onnW7myrnWTmRTOqascoabXd/L+yuzS95dv1efjhl92ntYyTuIb6wuWRZFmWRa//PkZOcb/gqMACDf1LTLofggA9qc/gKRZiblqWYm3E24moSQnR9BJj6JwfBaFqWZZFoWvLUshNPxNuWn6bTZHgozRTSaNAY5oGjFQVgTkE6FUVorioK8VBXBO8VRUioAhxVioK4qAnIrYrCqKsVRVBORXBORVFcVcVwTgVBUBORUisK4rCoKwrxXFYE4FYVATjFcVhX4rcVBVFQV4rxVFSKwqCpFcV+K8VhXFYV4qivFUE4FaCdivBORUBOfBOgToE6FUVYqisKgqCtxWFbFQVxXisKgqRU4qioKuKwqCvxVBkH/4Mgf4Rg4RgfgxZBizhFYEVuDFvhFbBi3CKyEVsGLf/4MgAxaDFoGsWYMWgaxYBrFngxaDFnCKwIrAYswNas+DFgRWYGtWYMWBFZgxbgaxbgxZCKwGLIRWgxZCK2EVmDFmDFgMW4GtW8IrAYtBi3Bi0GLAYsCK0IrQit4MWeEVgRW+DFsI9cDW9AYtgxZhFaBrVgMWgxaDFvCKwIrIGtWhFaBrFuEVvBi3hFZA1i0IrYMWYMWAxaEVkGLAisCKzBizCK0DWrIRg+EYIRgQjABkHwODABkDhGDwODBgyAEYIRoRvww4YcKILYKILfhRg5htjY4OQbQ2hNAH8su//PkZP8cRgjWAFAUYjwDofQAi9pcJry1E1LUsuWvE2E0LQTcB+E2LMTctQFEEcWnFYVwTkAI4rRWFYE6BOhWwToBBAQgnIrisETANwIiAb/COEQEbgG+EcA38A3wjhGCMEeEaEeKoJwK4J2KoARBVBOIJ1FWKoJ0CcCuCdRWFcV4rioK4rAnYJ2K0V8VYr8E4xWFUVBVFQE6FXBORWFSKorxVFcVwToE5wTvBOoqwToVIJziuKwJxAQgnUVBUgnAqQCaCdxWirFaKwrRWFcE7FfFeK4rgnIrAnYrCoKoqgnAqCrip4qgnCr/////8Iu8BjvP4Ry5/8Izggc4Zw4RnD/hGcP8GThBk4eDJwgycIMnDwjOD4MnBA3eu9hF3kGO8gx3vBjvAN3jvMGO8CLvAY72DHeAbvXe+DHehF3kGO8gbvHeBF3oG713gG713vgx3oMd5BjvAi7wGO9A3eu8BjvMDd470Iu9wN3jvQY7wGO9wN3jvIRd4Bu9d6Bu9d6DHeAbvHewi7yEXecGO9BjvQN3rvIG7zykGO9A3eO9CLvYMd6EXegx3gG7x3kDd470Dd472DHewY7yDHeAKomwmhZFkAof8tCy4m5aCbcTUswFYsy0/LQTX9NBqBgJgYaY//PkZPcaTdCuAFgWlkI0DfQAe9r8Jxz6CShr8++JsArgjxNBNC0LQsyyLMsgRxallyyLIsi0LUTUtS0AVwFPia8si0LMTXiacsxNizLMTYTcsi1LMsy0E2LUsuJqJvxNyy/E1LMteWgm4mpZlkJuWRZFmWnLQTfgncVATkVcVQTsVIqQToVxWFeK4rwTmATCsCcAnQJyKoriqKwrxWiqKoqwToVRWBORWBOBVFSKgq4qAnAqAnArRVgnIJ3FYVQAgCriqK4qYqivBOsVoJwKgJ3FYVBWFfBOIqCoCcivipxUFSCd4qRV4rCvFaCc/BOhW8VxWFUVhX4r1eX/+DHgaYMOEX/CJgwwYQY8GODH/wYf4RAiQiAxCKBj4GAMYRQiwYcGEGMIoMfhECIBgEXAwCJhEA1BjhF+BhCIDEGARYGoRAYgxCLwYeESEUGMDEIoGAMAiAwBiBrCJ8GMGGEWEUGIRYMAYAxCKBiBgBqDDA1wiBEBiDAIsGIMANANMIoMAYhEBh4GMGMGARfAxBj8GAMANYRAYBFAwCIBhgYhEwNQMYGIRAMAiwNYRQi4RQYwYgahEBiBqBgESEUIqa6Z6bTBpGkmUwmkwaZpJlNCkifmkaaaBymgm0wmRPxSDTTa//PkZOYYTgboZUAQIkCEFgAAe898YTZpJtMJhNilphNdMJhMGgmemDSNJNmkaX6aNJN9MJhMc0E2mzSNJMpg0umU2mDS5oJlNJtNJnpg0DSTBoml0wmzTE8TRpGgm00mkzzRNNMJg0jQTSb/NFNdNGl02KTzRTfTPTSbTKZNLphNJpNmgmUymkwaaaTKZ/TSYTBoJr/ifptMpr9MJlNptMpg0kymumEwmf+mEwmOmkymTT5ppv80eaHTCYTHTSaNBNJtN80/0yaBoJo0k2aPTPNA0OaSaTJoplMJv9MgBAB4MBUGwbwVwUBkFAYDAU4NBoMBqhAELk//h/y1/vz6/6zMnEglwqnIsVSHBzAMMIqXiLgxS8ucoLCKl7VwipeupwYpeAxS8Z22hSl4U+qE1L2goKUva1GUJqXqwkpeAxS81IQpS8smBqXql6E1LyEVLxdEJqXoSUvAmpeJhFS8rpH3CKl6EVLxPWFKXgDUvVL1LCal4kuDFL2EVLxFlPClLyEVL2FKXhdwYpeswGpeqXkGKXqLAxS8wYpeqWk8KUvATUvQYpehJS9Bil6yoUpegipeZT2x1vN5NR2X3KrRuXjFmaS0AUCyE1BHflmWZacTYsvy05ZgAIs+WQCqJoWZ//PkZOwZ+gaYBgbm6EQMAfQAe9r8ZCbiaFkWv5ZibialoArlryyDtCSnyfR8hrE7PpNmiaIxDTGKafTJalqJoJoWQm4mnLUtSzE1LUsxNyy4mpZlqJpy14mgD8WpagKvLIEcJuWnLItBNhNhNxNgH8tSyLMTflmA/iaCaFqJqWf4mxZFmCdCvFWKwqivgnQJzFfwToAIwqgnOKgqCoK4J2KwqisKwJwKwqCqKgJwK4rYqirgnIJ2K8VhVwTmKorYrioK4JwKwrRWFQE5FUE6BOwTgV4qYqiuCdAnYqAnMVBVFUVATkVBVirioKoqCviuK8VwTjxWFfivFUVxXBOcVuKvFaKoqiuCdeEW3Bjb/gxvhFvCLYGN8GNwi3CLf8DbtuEW//CM7+DG+EW+DG8DbNgi3CLfA2zYItwY3gbZuDG8GT/Bk+DJ+DJ/hGdCM+EZwMnQZP8GT8GToRngc6dBk4IzwZOBk8GTvhGdBk+DG8Dbt8DbtgY2CLbBjYGNwi2A2zYDbN4RbhFtA2zcDbNwNu3CLaEW4RbeEW2DG8DbNwY3BjYDbNgY3A2zYItwi3CLbgbdvA27YGN/CLaDG4RbgxsDG4Rb8ItsI7oR3cGb00m0wmTT6aTZoJgUpMc0kwaa//PkZNcYqeLUAAAUHjw8DgQAe88cYTXTXNBpXiQdfLVpLJoaCSJs0TQNAbRpJpDWleaGlDmlfQ9fQ7tBZoa0IeOw3Ccq44TcHgrufDVzQNA0Om0wmDTNE0EymkymumU2mU0aSY6ZE8NFMmiaaYNDptMGn+aJpdNptNps0OmU0J50wNtMGmmEz/zQTJpppNplMJlM9M8FAYCoKAAApgqDIMACwAQbBsAMGQAQaCkGg0GgyCkGeCgNABwAAUgrwA+CoAQNAeHCAOAeAyIQHBwgDg4QYDAGgMEEOEAeA0Q4DxAHh0PEMGYMBsFQYDPgoDMGQV4NBqryAZfhGfwjMDl4Rv/wjcGT/4R/CPBH//hH4H3gzv4M7A+/gzoR4GdBnAf+DPBnwj4M7BnwivA1QIpCKcIpgaqDFgaqBogMWBqgGqgxQinA0XBi8IqEUCKBFcD7/CPwj0I+DPA/8GfBnQZ8I+EeCPwZ4R6EfhGcI0GSDIDJCNCMBkgdsIwGQDkBk4HIEZgy4RoHZwZQjcDtCMgcoRgRoRgHKDJBl4RgHIDKDIEYEaEZgyYMoRsIwGQGQIwGUGUI3A5AZMI2EaDLBlwjQZQjAjAZQoqIqqN+pypx/qNIqoqqNKNKcqchwGrCAPqN//PkZOsaCgjiBUZRnkhEBfAgw9tw+iu1RUqp2qNUNalOVG1GkV/U58sLU48sLLCiwFU4hAYA+qQQgasVhVIYQNWKwmAKpvasNoHIDm4OQHIDlGwNgbH4D+JuWQm4mhZFoJsWgm4I4TcbA2xtA5ODnGyNoHJ+NgHKDl/LMBXLUtS04mvLQteAqCaCbFoWQmha8bQ2Acg2ht8bI2RsjaGyNrjYGwNvjbByja/GxFYE4ipBOIrwTiK4J2KuK8BAK4rAnAJwKkE4FYE7FUVgEIqgIRVBO4qRXFQVBVBOMVwCcE5itBOoqAnQqCpBOIrxVBOoJ0KwJxgnQrCuKsVBXioCcCqCdAnYJyKsVYqipBOgjwiAj/8InhH4RMIkIioAC4RiJCMRP////CNk//Blkv4M6F8I9C/8GWT/8I2SwjZOEbJQZZIGWShGyYMsnwj0P///CPQ/hGyQRsn8I2SCNkgOyVkoMsnhGyQMslCNkoMsl4MsnhGyXCNk4MsmEbJ/wZZP8I2SA7JWTgyyQMiKDIieEYiAcRIihGIkIxFwZEUIxEA4iREgcRYihGIoHESIkDiJEUIxFwjEQIxEwZEWDIihGIoRiKEYiHcYJRIr9kzDmO5cIaApXE/NA0TTTKZGym/0//PkZMQWjdCsAwAWCsQ8Cfwoe89cyaXTKZACgKxsmybQFQCyPQPUbRtA9x6QAoegHKmRtClpk0RSkwaCYE/GyaaZ6ZFJTaaTCbTabTBomgmk2mxS0x0waSaTI2gcgOcT0T5MiedM9M9NCfCeGgNhMJlNJoT1MdNJhMjaNPptNGkmhtpnmgmv+KQmRSE0aaY6ZTKZTRoJg0U0aBopg0emU1/xPzTTaa5o80DRTZoJs0TRNEUhMikJs0P0x0wmkwmUymkwaKb5pppNJg0OaInhpGgmeaSbTBp9N/ptNJo0DTNAbOCkGAwGABgA4NgwAAAMAPBgAQKAyDAZgoCkFINAABWAEDAUBTAABgMBTgqACDcGAAQYDAUqLUlVt///+Bj4MIRcGH/hE//hEwY/wi8GPBj8GH8IgRcIv4RYMQi+DAIsIsIn8GHCLCJCJ/BhBgBpgwwifhFhEhF/gwCIDAGIMIMAMQYBFhFBgDH4GAMQiQNAYAwwYBECIAMIAMAAiHBgAMIAiAIg4MABgABhADAhEAGAARCBhCEQhEIMABh6EQAwIMABgCEQwMAQYD4MDCIcGACIQiHwYGDAhEOEQ4MAENB8hJD7PsnXJ0fZ98+D6LItQR3PgnZHmgPYYRopk0xj//PkZMkU/gLsKkITrkL0CfzIetvgJtNdNGkmkwCPLITf8s+WpaFmApAjgFUsyz49jSTCaGMmkyaRZlkJsWpaiagKBZlmWomh8c+CdcnROj4Pk+Akh9E6DsJ0fJ8c+OTs+idk4J2Tg+j7Pr8nB9nwfAa59k7598+D74Sk+eEkFQdDmKsOhwBEVYCeAiAmAiHcBEV4CYCIWmCHF6FqC0haRcF4XYvxfF2LwvC+FqC0xcC0C/FwLSFoF0XBfi7C0xei8LwvcLQLoWoXheC0BaIWoXBdiNiMY6cZ8RkZxnjqOojAz4zx0HUdBGozjoMw6iMjpxdi+L4uC5F/xd/haIui/bZ/+DGBp4RYMQYgw8Ivgw/CJ4RfBh/hECKBgEUGODH8InhFwY4GoMcIgRIMcInCIBrBhCIESESBp+DEGARfhEA1gxBjBj4RAYQYgxgYwiYRcIgMAiAwBjCJgYAawYYRQMQMAYhFgagYhEA0AxA1A1CJBhBgEXwMQNAihFhFAxwYAwgaYMPCJA1hEBiBrwYQiwYwiBFwYhFgxgawihFCLA0gYAwCKESBoBpCJ4MIRcGOEVB9ALR8BJj7/PonB9HyEoJwfZ9E4Dt5OeTnlqJtxNAH7nwfHPonJ8E759E6PoJI//PkZOAWKgjoZUAQYka0Ffgge9VcfZOCdE7J0To+Cc8JWTo+D7J0EqPoO0+T5PsJSfJ9n0TkJUfJOeTknPPo+z6J2Ts+ycE759/k7Pg+z5J2TonBOeTkJUTg+T5DtJ0Tvk5Pjk5DXPg+idH2HYfR9E6PgnR9k5JyfZ9cnR9cNYJSfROidE6Ps+Cdn0fB8E6DtPs+CdHwfH5OAlR8nyfB98+SdE4J0ff5OidH2TknfPkJMfYSg+Cd8+D6PsnP/JwTk++fYSQO0+D5J0fZ8HwTjn2AWDgdAL8ApALQCkO8GACwMgyAVBiAVhzwY4BeDIMgFMOh0ArDgc4BeAV4cgFsOhz/wP225HGw7wCsO4M8AqHP/+DEGQ7/8OgzgFoM4Bf4MhwO4BT4cDmHcGfDnw78GcVhUFTFXFeKoqYJ3isKuKkVgTsVoqCsKwrCoKsVQTqKorYWoXhfxeF/xdi58XOL4WmLnFYVQToE4FXiuK0VwTnFQVRVFcVhU4JzFfDgdhzBnDuHfALgyDAMQZBgGQCgBUAoDAMh3BkAsDMGcGAYgxBn+HAC0ArwCwMAS5adAry0yBSBfoFBVaKqKwVUVrRXUa9FUOEqVUjV3ySPLkvkzlNlNn02E2S06pvVKWACECpW//PkZN8VDgj+zymq5krb1ewAxJvkqe1XysDVFSqlVIo2o0ispyFVoqKNIrKcqNKcKcFhSjaKiKyKhYWiv6nCnCKijajSnPorKNKcKcqcIrqNoqKNqcKNoqKNKNqNKcIqKN//orf6BSbKbKBSBXlp0CvQKTYTZ/0C/LTxFxFoigioigCLC4cRYRWItEXC4cRcI0IoFwwXCiKwjQXC8LhRFcRcRQRSFwoikRcLhxFRFguHiKRF8E7FYVhVBOgCYVRUACKKgqgE0E6ACJFYVoJ0CcgnQrAnMVwTgE6ioKoRwDdhHhG4RARgDcCMEaEYIiAbwRIRuESEcIwRwiYRwjQjBEgWoFuBa4FngWkIQQigwhEwigx/CL/4RfCKEQGP/wYiEUwYHwYGDAwYAGA4RCEQBEGB0rCNcGU4RrBlcIsGGDCESBiEWDCBhCIEWBiDAGHCKEUGEGEGMIgMAiwigxCIDADQGIRfCIEQDXgYYRfBgBoESEXwY/CJCKEQIsGIRODEGIRQYgw8IgRYMMGAGGDEDGDAIoMcDQIkGMGGBrgwCKDAIsIkDUDWDGDDA1hE4RQMQYgwBhhFBhBh4MAMYRMIoRAiAxBjhF4mhZFpxNBNy0LQTUTXhKglR9FqWpaAP5Zi//PkZNYXkgTkGEJwlkXcDfQAe9r8bCa/k5JwTriacsizBHE6CSH1w7efHLPgjuJqWnLITYTX8tRNAH/ialqJuJuWZaFkCO4m5aE7J2TonB8E559nyEnJyfB8FmJrxNxNhNS1E3LT8sxNC0E0LTlqJuWQm3E15ZiaFqWRZiaCagP5aCblkKoqCsCdioKoqwToE6FcVwAhRWBOIrCpFbgnEVRVFUVIJ2K4rAnIqioKgrcV4riuK0E4FcVQTsVxUBOoJ3FUE7itFYE7FYVRXFUVwTkVoqAnYJxBO4rReF4XYWsLWLoui4LwuC9AdsLQL0LQA9C8Lgvi6LguBahfFwXAtIvQQ4vCqKwrxX/8E5xXit4JwKzBnwj+DF+F1guvBiQYkDRIR8I/gz8Gd4R/wYsGLBi8I8DPBneDPBnwZ/8I8DP8I8B/0Gd+DPA+8I/+Ef+DOgzvwj4R/hHoM+Ee4M4D74M+Ef/A/7gfcDPBn4R7BnfCPgz4M7Bngf8DPwjwR6B/3CPwj0Gfgz+EfBnhH8GfwioRQGIBqgRUDVAYoGiBFcIoBqoMWEUA1UDRYRUIqEUA1WBooGiAaqBogRUGJwigM8I/gz+DOCPwj/Bnwj3BnBHgZ4M4I+DOhHhNCz5aiaCb//PkZM0YugrgAAASBEUEBfQAe9rclmWompZ8shNyzLMsy1LMBUAfhNxNicBJCcE5J0JpyyLMTcBVLXloCO5aCagKACiAqflqWYmvE3E3BHlmArFnxNRNC1LUBS5aFoWhZFmWR8k5CTnxz4PonZ8E5Pg+j4LUshNQH4TYtSzLMshNBNhNSyAViyE0FQE4FYVoJ0CcRUgnYqisKoJxFWAhiuKgrCtFUE7FQE5iqKgqRVFWKorwTsVxVFYE7FTFTBOxVgnAqRXBOPisK4BOK0VoriuK0E5BOxUivFcE5FYE5FQVBXFQE6FQVBVFYVxWioCcCoLovi4LoWiL0LSL+LouBaIvBahdi6LoWgEMFoC1hacXxdC14uipiqKn8VPFbiqKsVb//Bm/+EXgx4RdhFb///hE1/8GLP//CKwIrQjoGa/wPewZqEdYM1wZqDNAetgzWEd8GagzYM2DN4M1wjoI7Bm+DNhHcD3rA9awZuEdwZvCOwjsGaA964M1A978I7hHQR0DNge98I6hHYR1wZrBmwPWgPWwZsI7wjqB63COvgzQR3BmwZsGaget8D3rCOgZoGa4R1gzYM0EdwZsI6CO+DN4R1wZsD3oGaBmwjqEdAzXCO/4R0DNAzYR0WgI8TQT//PkZL4XFgTcAE6Tekf8EfQAe9t8YTXiagKwCsJuWXLMTUtC1LMTT8TYTUJP+fAdomomoD8JuWoCgWoI7iaFkJqJqfZ8hrk4CSE5Pk+Cdk5PgnBOT7JwTg+uWZaiaCbcsgFAsy0LPlmJsWYmom5ZFmWpaibiaAjy15ZFkWQm5Zll+JsJqJvy1E0CThJz65OQlJ8H2TknZOT759k6J3z4PgTQTcsy0LITflmWfLUsiyLITYTcTT8syzLQsi0LMEcWZa8tSyE1LTibibFqWYI/8shNCyE1LQsy1LUTUBTLLloWXLUsiyLUtBN+JqJvy1E05Z8TcsxNeWn/LTnxydHwfZ9n1ydk4PsnHJyfR9E4JwTgnB8k4588nB9cnR8c+D7PjxV4q4r8VsVgTgE4/itFShX/xV4rirxVFWKoq4qfxX8E6xVxUBOYrCtwTvwTj/xV8E5/irBOsVuKwqRXFTFQVorCrFf/xWioKwrCtioCcxUFUVAToE4FUVxWFQVhUBO4rgnUVIJyKkVgToE4ipFUVoq4qisKsE64qCoCdxUFUVxXFUE78VxWFQV4qiuKgqiuK4CCK2KoqirBOATsE4FWK4qxVFUVhVFYE4gnIriuCcQTiK4rCoCdCtirBORUiqK2//PkZLAWsgzuADQNNkZj/fjIe9r8K/FXFUVwSE5aiaAKgmhaFpxNQkp8n3z5PsJOGsffLQsyyE1LItS1E1Af+CPLMTUTfibFmJoWQmxanzydHwTsnASknBaCalqWom5ZcsxNyc8nASsnHDt59BrhJgkpOicBKg7D7JyfZ8E5Pk+Cd8EeWXE0LQsiyLQtSyLIsi0LUTYsy0E3LITQshNiyLUsiy4I78shNy0LMVcE6ipgnArRVgncE4wTsVIrCqCcCtBOYrwTgE7iuKwqCoKwrcE7BOQTqKgqiqFpBEC1gPYD3F0X4WoLTF0Xxei6FqC0BaAtQWgXxdwtWFqC0haBW/FQVRUBOBUFcE6ioCcAnEVRX4rYrxWFUVBViuLsXgtAuC6FoBDBaYvi7F8XxexdF8XhcFyI//gx//CJBhgxhEwY/+EXwYgx8ImDH8GPhE8GPhEwigwhFwNQNQNfhE+DGDAGHCIBrhEhEBh4RQMAY/gYBFBhhEAxCIDCEUDEDHBiEUIoRQY+DCBp4McGEIgGgMcGIGMGIGIGgRQYgxCKBiBjBgDGESDADWBgEUDEIuDADWBpBiEUDEDDgYgwBgDEDQDUGIGgRAYQYAxCKBhCKEThEBgBiEUGIRQMQiQiwNAY//PkZKwWNgjoZUAQREakFfQAe9t8YMfwi4GBaFoJsWpaFlyyBHctCzE25ZiaFoAocsy1E24Sk+idk6LMTYTYTQsyyLUtCyLQTUswFYJMGuTg+CdHwErPotAFAsuJtxNCz4m4mvBHiafloWZZ8YppBqzTNI0jTNBMpg0jTTZZFqWfE3Af/xNf+WomhZ8suWZZCb8tC1LQtS14m/LQtBNhNOfR8hKCc8nHJ2EqCUE5CSHxydk6Pg+D7Ps+Sdk6LUTQTcTcTctSz4mwmha8TXlmJvyy5ZiaFl+WpZFoWZa8TQshNCz4mhalmJsWfLQsuWRactBNRNC1E1LLlly0E2PgJWfR8h2H2fJOSdnx+fXPs+T5PgNbnzz6Po+T7JwTk+z4PonROglJ84qCvxXxUirFX4q4qeCd1f8InCI/4R/CP//4RMI/CMEYI4RAR8I8IjCJ4REI/gG8ESEfCOERCP4R/+EaERCPCNCNCI4BvQjYRMHINobIOfjZBzDZG3xtja42gcw2PwcvG2Nng5+NgbY2wcn42htDYGwNrjYGwNsbX42vxscbI2gc3Bzg5Qcg2uNvjaGwNgbI2+Dl4OUbI2Qc42RsjbBy//g5eAboR4RwjQDeCP+EcI8IwBuwjwjBEBEA//PkZKoZMgrqADXt9EV8FfQAe9scG+EThEBGCMESESEbhEQjwjwjwjBHCIwiQDcCNCI/hHE0/LQBSLITf/lqWoSvk7LT8BWLMtRNAk58E7Po+CyLQTcsyyLUsi0Afi1LUTUTUtBNS05aFkWpZHzwkoSgnB9HwfQSsTYsizLQtRNRNgFf/8NcJWEmAWCdn0To+T4CUHyGtxNiyLT/lmJqJqJqWgmpZFqJsWgmwmwmwmv5ZiaibiactBNv/yyLTiaFkWZagKgCmJqWQmgmom3E0LTibAKfE0LLiuKgrYqipBO4JzFUE5BORXBOhVioKwqRWBOYJyKkE6BOIrYqCqCcxVxVFUV8E4FSCdcVgAgCuKkLTBDC6CHi+LwuRfha4uC+FpF8XQtAWgB2wtAWoXBchaBfwtQWnFSCdxVxXFUVhUFYV4rgnOK3wTiKir//1eDCsf//7/+wOYd///ei/f6lmiqGXpyOlCSRm+yP3UtDhFIzqBhwCFHAGFHABYGcAnAAMOAAYcAAw4BYKOAIROANgicAQYcABE4AAzgE4B+1wmcAwYcAK+sDOADgFLCJwAlWBnABwABnABwDWraETgEDOADgDBiRkgoJpGaP+64RSMoRSMGBiRkkwMSMlq7AxIy4//PkZJUYEgieBFw3fkL8FgAied8AROAAicA8DOATgAGHAAROAFwM4BOAGBhwADDgAGHANQUcAgicAYROAfgw4AIkbPNNNpo0TSNBNJgUs0l7lomEwmRSOaRp80zQFK4nvTInnTEGgwGwAwYmOmkyaInppJpMJg0k1+KUaaaTCb42U0mBsGiaSaNNNpo0OaKZNE0jTTSY5oGmaZpJrphM9MGkmDQTCZBzpg0OKR+mBtdMJobfTSbTfG2KSaBpGgaZomiaBomn02mOmkwmjSNPpjmmaKZNA0zSNFNCeClJkT40DTTCY5oJk0kyaJpdMppMdMdN80TR6ZTXTfNJNmimumem+aKZTKaTaaTRops0kwaZppk0+aSa6ZTKYTfTfTPTHTKa5omgmEyaJo9NmkaRp/pnmmaf6aNNMplMplMdMpv8TxMJlNplNJn9MdM1OM6hWa/EjiRiRiO/xIcSP+GgCZQ1+GvDRDV//4aP///4I8EwTwTBLwS/4AHgnBHBHgiwR4JgAgS4IwAYPA8ADg+AAAAFwfB4L4WADC2AGAGFwsFwuD2FgAcAPC+F/B8L4X/B7B4L4WwuD+AGDwXACAAC2D2AEFgfCwAAAAXB8LhcLeDwXCwPYPA+ACACD+AH4XwA//PkZJMVIgb2ejVLxkBMEgTIe898vwv4X/ACB/C4WwtgBg/gA4PA9gBeFhLRTXTRomkmP0yJ6J+mPy0NA0OvibNDQmfzTNNMjaFKNATxMiemiaRoGkmE2mkwmTRTHNBMGiaCZTSZTZomh0PaV9fX2hoX14kzSmOaCY5pJr80U0aPTfNFMps0jSNJMmiaSaTKb6aTKYNLphMpg0eaJoGkJ8aBoppMppMJg00xzTTabNFNJpNJpNpnpg0DT6bTRoppoJMWrSh/690NQ5paV5D2le/LND2hoQxDF/rzR1/r/aWhfaWleQxfXmheaevNDS0tLQ0ryGoch/X15D+vLy+0oc0ry/19DUOXuvIc0oav9oXkNX1/r3X18QCGHQGQHB8PiAPAaHgPDsBgcH+Hqv//+DJ0GNuEW4MbQY2wZO4Rn///4R34R3Qjv//8Gbv//8GbgZuwZvCO4GbsD37+Ed3A586DJ4Rn8DnToRn8GTsGT8GToRn4HOngyf4HOnBGeDJ0IzgjOCM8DnTwjOgydwOdP4RnYMncDbtwY2A27cItgNs3CLeDGwMbwY3CLaEWwRbQi3A27eDG0GN4G2bBFvA2zcItgY3A27YGN4G2bAxtA58/gc6eDJwHOnAyfCM7A588//PkZLMYngTSAFAUhEYcDfggw9V8DnzwOdOBk8IzuEZ4MnAyfgychsy7F3oE13Nl9sy7myrsL6qqOU5anCqkHqNDI3KVUTEU8GNU7U6gxyHKchyVV/Xa2Zspfds3rubK2VsjZmztk9djZi/TZV2NnXYu0vsm0yaBoDZNEbA2k0aKZNjmwbH/Nvm2bRtGyBVArD1G0bQPUevg9h6/+PRzZNkCrzZNgesegesermyPQPXzbHpNvm0PQPUPSbJs82TaHqAtj082h6DaNn8eo2DbHrHpNjj1m1zYHqNo2jYNnmwbPNgek2ja5sj0D1m0bJs80xtJlMdMCeps0U0meaaa6b5p/mmmU3zRTfNFN/pgHPzQNPmkaaaTXTKbTRoJk0zS6b/NBNdNJlNGj02aH6Z4IgAEEYJ4I+CMEQJcEUEXBOpHDX/w1Q0Q1Q1cNWGvw0Q0/hp/AmIaA0cCYhow0w1/w0hoDRhpw1w1BrgTLDXw1BrhrDQGgNQEzAmOGuGiGgNfgTHDQGoCZw1w0BrDWBMIEzDVDTDUGgNfAFwGjBrg1A1YNcGsAXAaQaABcBqg1g1QagaINYaoEyw1Bow1YaA1hoDSBMw1gTICYQJkGrDQGoNGGmGsNcNQawJkGuBM4aIa//PkZKAYngTsATQNQkKMFgDifh7AYagJkGsCZ+GkNWGiGsNAaYaOGgCYgTENQaw0Yaw1Q1Q0/hqw1BkAfmkaCb6ZTCY6bNBNLwmqGA5fzSTCb/lgwXOmMmMmTQ5pmkmUwmkymfzRTaZFJ6aNM002NrppMpg0kwKQmE2m0yKUaKaE95o9MJj9N9NJk0UymOaSaE/TabNNNmmmk2mU2aHTKZTCaNDjaTJoGimkyNvpk0TRTHTf6bTRopg001+mU0aXNBMjYNA0k2mjR5pfps0U100mUz0ym02mDRTHTaaTRpplMc0kz0ySA000mDSTKbNI002mzQTHTaYTf//NA0zQTBodNJk0UyKSaaZNJMprmkaP5oGmKUmEymUyaCbTHNBMJlN80DRNBMmkm/00mUwaZpprplNpvmiaJo80+aSa//TaY/6ZaH//wY4ReEX4RIMfwiAxBh/BhCJ/+ESDDwYcIn+EQIoMAiQYAw8IsGIGGETBj4MP4MQiAxhEAwAxAxBjBiEUIgMIMcDCDAGIMcGMDEGGBgEUDTwNfAx4MAiwiQYgwBgEUIgMIRAiQYhFwYAwBhA1CKDEIoGoGgMQi4MeDADGEQIkIgGMDCDAIoMAiQiAYwYYMQNQigwCJBiDEGAR//PkZJwV+gzoZUAQRkZsCfQAe9tcQYgx8GEGIMQiwMAY4MANAMcIoMSyE1E1/LMTUtCz5OD5PkJJz5Pk+uA/FqWRaib8TUTUTQtC05alqWYm4momgI8TYsxNCzE3LUtQFEsgFM+z6J0fB8nz+TsNcnB9BK+Tk+g7CdhJT6LTiaFqWYI7lqWoCvy05ZlnxNy0/LUshNBNvwR4moCj+Wv5ZlkJqWpalkCOE1E1LQsiyLITUBULLlqWZZlmJsWhZcsi1/4CiWpalkJqJuWvLXlkJsJpyy4mwm5ZlmJuWXLUTQteWgmgmwCsJoWfE3LMsiyLP8TTlkJuAolqJryzE1LTibCbloJuWhZFoWYmxZ8TcXIvxeC0i+FrF0B2i4L8LSL4uBaIDyCHF8XRfF6FqgiwtIuYWoXIrYqAncVvxVip8VIqCvUxPqtFbFf/4q/8V/8V/iririr8VATjxXipxWgnYq+KwqfFTFQVoq+KsVBW8VhUisKuK0VRXivFYE4FTBOhVFcVRV4riuCdCuCdCtwTiCcCqCcgnYqxWFcVIJwKsVxWisK8VxVgnArYqRWFeK0V4qgnQrgnYrfBOoqAnAq4J0CciqKviuK3BOoJyKsE4FUVoqisK2KwrAnArgBAFSK4//PkZJ0VagjyJgGtbkOkFfwAbh4AqRViuK4J0KgrCrFUVxVjOEeDQgjlcT4T40xtjaNI0uaI2QciGNJIl4kJZtCGIaSckIm6GL3TQ2zRTY2UwmjSNE0fxS02aY2BsJs0/+mzSE8TQpHTKZTaaG0aQpApZp/mmm+aHTfTCZGwNgUk0E0aRp/ilJlNJgT5MmkJ9zQNA0TQTH6ZG2mk0mk0mk3zQTKY/G3zQTHTabTBpGgmU0aKaTJpJpNJtMphNjYTfNE0emkymE2mEyaCbNBNfmkaJpdNJnpg0k0mDTTCbTaZTBp80k2aCbTfNE00yaCb6bTZoplMmmaKZTKaTJpmiaHTXNJNdMDbTab6Y6Z6ZNNMJhMJhN9NJrmim02m0ymU300aPTSa6Y//5pJpNdN/9NppxWxU4Jx/xWxU/xU4qcV/ipiuKwqxWFbioK/8VIqivFTwTkVgTkVor4JxFXxX8VcVxUFQE4FaCcwTvBOIqwToVuKwqCtFUVYqxXxWFeK0E7FQVYrwTnwTsV4rCqCcfFaCcRVFQE5gnAr4JyK4r4Jz4J0Koqip4rCvisKoJ3xWBOME7iuKgriuKgrAnAqgnArxXiqCcgnYJzFQVQTmAEIVYrwToAIYrwTiKkVQTkE5//PkZK4XGgzsADQNAkIcCfwAe898FXFTFYVxXxUFQVkzzS5oilg5TTTY2kyaJpJtNGgJ8aKaTQ2k2aCaNI0eaSYNJM/tKHEiQxfJG09MmgaSYTRppg0TRNNMJlMptMCfppNprmiaA2jQNLmmaRppk0jRFLNP9NJhMGmaQpZpJhNCkGkmE0J+mxSk0m0x02mjRTKbTCZ42EwaQpJpptNprmgaRpmim00J4mzSNM0kymkyKWmE0muaKYGwNjmgafTPNE0U0mUwJ7+mem01+J8mhSk2mjRTSb6aTCbNBM9MpjpjppMpk0E2mE2mE2mjSTfTaZ6YNFMcT1MpnprptNmim0wmE100aSaTRo9MGjzTTHTaaTfTSaNLpoFMAAFYNBQGwAvwAYM4NgqqkjaAN3d3d3etERNK5CZ/3Ctf8AaiAc/u7vaIn/+8XPv//+GDKv8W1/+AC8K4Yw+94xe940jgceOBwOcRaxGwH4EuNIjBfxazB8HhkwVjIAII/vDkjG/wAcJPeF5e98hNgSYLWMFvhZ73pX06aoehpmh01hMJtM9K3TKY9E10x+memvlIpZM9MUTCbShbUrtM+n5ophNZuXK+0wmemumMCemkmvc0Uwm/lJJlLe5oJZI0SyW6R0mE//PkZLcXlgrzECFvrEmMEfgAfh7k2aORpbTYUo9SBNsekGYNVKgqg6hrUXK4Q42DOwPWbILEzBSumEgkWJPU8S72G5wUuGDwguEKa1Q0UykS3Bn7FJNgg5qoEgpsGabBtGabZt7NrKCNgLYes1idmabBtm2bZsBRm0PQbF9mwPSPUBbMwzB6QojYM42ePTzbMwzR6TaNs1eBVNv81yDUJ2QYhJtD0m0PVe+x6T2M8HsbFwsh6B6D7HpugT2uZhO6HqZhmE7ISZhhkFNcghtmybBnnsD1Ho49ZtG2bZs5PVBc2EEepCaEHNjj1EJHq5smabZtmwbNEEPR+bJse9z2PY2T1SN0rdNJq6yXI06COvNJj9MGmkkGmUj7pI0TToNGlEsNEnCW10ymi5FtNFKpvps0kz0uW3aaTF00mTSzdNJu0KFYz1KjaGAhyoQCFGM//zFARgIUZ/oZpdCttay6M5drW1joSj6Ekk1b7J7R7aoQNlPrWBKLTTzOsGT5yYxLrtHTy2iUxEkES0HIBVD066VjGj31odPkkSjJtbWs6OIjKmlXHR9K5MTv5pdZolE10kk2lly74TFx5KTXeTGLrS6ExiucvJSSDUdXZm3NLn1rtYBCUEoRj77WOhCPc+g5//PkZJ8XPgzoAABMTrz8BfQyY9ONGxJULutaa1TE5LHxWEo+XecmMa3p0kqBCR6qOFaFUGpNJIIjqVi0ylBqJIkiSJIkmJj605EkSRJPetWAyVacmodBUVhGfrAZPF0AUrgRLNiqDU4VHo8h6HRObJJNdqlRBMFT0qdNE0WZhmay2tCuOY6oieWieianCnVSbzjd7SGhrLi6eUSeLcZTWqdML5PM50uOGJms9VqtYU6hrgrm4V0frUzTvYsiegR2FOkqUxSKdVCpmRCSkIAUZ4VPhqEKgFDU2VhUiIhUaIg0RAkTBYEjYBUbBMuCJgLAkCUBUinABgBE3/9EQqFRM0s0qzktk9ZFqqFC6RULE11JVDkd8Y1vVFOx9oUIpZ8Vnq5klkxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";var Gb=t=>t instanceof Date,ise=t=>t==null;const sse=t=>typeof t=="object";var GV=t=>!ise(t)&&!Array.isArray(t)&&sse(t)&&!Gb(t),WV=t=>ise(t)||!sse(t);function ose(t,e){if(WV(t)||WV(e))return t===e;if(Gb(t)&&Gb(e))return t.getTime()===e.getTime();const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(const i of r){const s=t[i];if(!n.includes(i))return!1;if(i!=="ref"){const o=e[i];if(Gb(s)&&Gb(o)||GV(s)&&GV(o)||Array.isArray(s)&&Array.isArray(o)?!ose(s,o):s!==o)return!1}}return!0}function _6(t){if(t===null)throw new Error("Canvas should always be defined when component is mounted.");const e=t.getContext("2d");if(e===null)throw new Error("Canvas 2D context should be non-null");e.clearRect(0,0,t.width,t.height)}function DHe(t){var e;const{onScan:r,constraints:n,formats:i=["qr_code"],paused:s=!1,components:o,children:a,styles:c,classNames:l,allowMultiple:f,scanDelay:u,onError:h}=t,g=T.useRef(null),y=T.useRef(null),m=T.useRef(null),S=T.useMemo(()=>({...THe,...n}),[n]),E=T.useMemo(()=>({...PHe,...o}),[o]),[A,P]=T.useState(!1),[N,L]=T.useState(!0),[V,I]=T.useState(S),U=function(){const v=T.useRef(Promise.resolve({type:"stop",data:{}})),b=T.useRef(null),M=T.useRef(null),[B,x]=T.useState({}),[C,w]=T.useState({}),k=T.useCallback(async(X,W)=>{var Z,te,F;if(!window.isSecureContext)throw new Error("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.");if(((Z=navigator==null?void 0:navigator.mediaDevices)===null||Z===void 0?void 0:Z.getUserMedia)===void 0)throw new Error("this browser has no Stream API support");MHe();const ee=await navigator.mediaDevices.getUserMedia({audio:!1,video:W});X.srcObject!==void 0?X.srcObject=ee:X.mozSrcObject!==void 0?X.mozSrcObject=ee:window.URL.createObjectURL?X.src=window.URL.createObjectURL(ee):window.webkitURL?X.src=window.webkitURL.createObjectURL(ee):X.src=ee.id,await Promise.race([X.play(),new Promise(xe=>setTimeout(xe,3e3)).then(()=>{throw new Error("Loading camera stream timed out after 3 seconds.")})]),await new Promise(xe=>setTimeout(xe,500));const[fe]=ee.getVideoTracks();return w(fe.getSettings()),x((F=(te=fe==null?void 0:fe.getCapabilities)===null||te===void 0?void 0:te.call(fe))!==null&&F!==void 0?F:{}),b.current=ee,M.current=fe,{type:"start",data:{videoEl:X,stream:ee,constraints:W}}},[]),O=T.useCallback(async(X,W)=>{X.src="",X.srcObject=null,X.load();for(const Z of W.getTracks())W.removeTrack(Z),Z.stop();return b.current=null,M.current=null,w({}),{type:"stop",data:{}}},[]),G=T.useCallback(async(X,{constraints:W,restart:Z=!1})=>{if(v.current=v.current.then(te=>{if(te.type==="start"){const{data:{videoEl:F,stream:ee,constraints:fe}}=te;return Z||X!==F||W!==fe?O(F,ee).then(()=>k(X,W)):te}return k(X,W)}),(await v.current).type==="stop")throw new Error("Something went wrong with the camera task queue (start task).")},[k,O]),oe=T.useCallback(async()=>{if(v.current=v.current.then(X=>{if(X.type==="stop")return X;const{data:{videoEl:W,stream:Z}}=X;return O(W,Z)}),(await v.current).type==="start")throw new Error("Something went wrong with the camera task queue (stop task).")},[O]),$=T.useCallback(async X=>{const W=M.current;if(!W)throw new Error("No active video track found.");{X.advanced&&X.advanced[0].zoom&&W.getCapabilities().torch&&await W.applyConstraints({advanced:[{torch:!1}]}),await W.applyConstraints(X);const Z=W.getCapabilities(),te=W.getSettings();x(Z),w(te)}},[]);return T.useEffect(()=>()=>{(async()=>await oe())()},[oe]),{capabilities:B,settings:C,startCamera:G,stopCamera:oe,updateConstraints:$}}(),{startScanning:ie,stopScanning:ae}=function(v){const{videoElementRef:b,onScan:M,onFound:B,retryDelay:x=100,scanDelay:C=0,formats:w=[],audio:k=!0,allowMultiple:O=!1}=v,G=T.useRef(new GT({formats:w})),oe=T.useRef(null),$=T.useRef(null);T.useEffect(()=>{G.current=new GT({formats:w})},[w]),T.useEffect(()=>{typeof window<"u"&&k&&(oe.current=new Audio(OHe))},[k]);const X=T.useCallback(W=>async Z=>{if(b.current!==null&&b.current.readyState>1){const{lastScan:te,contentBefore:F,lastScanHadContent:ee}=W;if(Z-te!F.includes(ze.rawValue)),_e=fe.length>0;let Me=W.lastOnScan;(xe||O&&_e&&Z-Me>=C)&&(k&&oe.current&&oe.current.paused&&oe.current.play().catch(ze=>console.error("Error playing the sound",ze)),Me=Z,M(fe)),_e&&B(fe),!_e&&ee&&B(fe);const Ke={lastScan:Z,lastOnScan:Me,lastScanHadContent:_e,contentBefore:xe?fe.map(ze=>ze.rawValue):F};$.current=window.requestAnimationFrame(X(Ke))}}},[b.current,M,B,x]);return{startScanning:T.useCallback(()=>{const W=performance.now(),Z={lastScan:W,lastOnScan:W,contentBefore:[],lastScanHadContent:!1};$.current=window.requestAnimationFrame(X(Z))},[X]),stopScanning:T.useCallback(()=>{$.current!==null&&(window.cancelAnimationFrame($.current),$.current=null)},[])}}({videoElementRef:g,onScan:r,onFound:v=>function(b,M,B,x){const C=B;if(C==null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas is always defined.");const w=M;if(w==null)throw new Error("onFound handler should only be called when component is mounted. Thus video element is always defined.");if(b.length===0||x===void 0)_6(C);else{const k=w.offsetWidth,O=w.offsetHeight,G=w.videoWidth,oe=w.videoHeight,$=Math.max(k/G,O/oe),X=G*$,W=oe*$,Z=X/G,te=W/oe,F=(k-X)/2,ee=(O-W)/2,fe=({x:Ke,y:ze})=>({x:Math.floor(Ke*Z),y:Math.floor(ze*te)}),xe=({x:Ke,y:ze})=>({x:Math.floor(Ke+F),y:Math.floor(ze+ee)}),_e=b.map(Ke=>{const{boundingBox:ze,cornerPoints:Je}=Ke,{x:Xe,y:lt}=xe(fe({x:ze.x,y:ze.y})),{x:Re,y:$e}=fe({x:ze.width,y:ze.height});return{...Ke,cornerPoints:Je.map(st=>xe(fe(st))),boundingBox:DOMRectReadOnly.fromRect({x:Xe,y:lt,width:Re,height:$e})}});C.width=w.offsetWidth,C.height=w.offsetHeight;const Me=C.getContext("2d");if(Me===null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas 2D context is always defined.");x(_e,Me)}}(v,g.current,m.current,E.tracker),formats:i,audio:E.audio,allowMultiple:f,retryDelay:E.tracker===void 0?500:10,scanDelay:u});T.useEffect(()=>(P(!0),()=>{P(!1)}),[]),T.useEffect(()=>{A&&(ae(),ie())},[o==null?void 0:o.tracker]),T.useEffect(()=>{if(!ose(S,V)){const v=S;n!=null&&n.deviceId&&delete v.facingMode,I(v)}},[n]);const K=T.useMemo(()=>({constraints:V,shouldStream:A&&!s}),[V,A,s]),R=async()=>{const v=g.current;if(v==null)throw new Error("Video should be defined when component is mounted.");const b=y.current;if(b==null)throw new Error("Canvas should be defined when component is mounted.");const M=b.getContext("2d");if(M==null)throw new Error("Canvas should be defined when component is mounted.");if(K.shouldStream){await U.stopCamera(),L(!1);try{await U.startCamera(v,K),v?L(!0):await U.stopCamera()}catch(B){h==null||h(B),console.error("error",B)}}else b.width=v.videoWidth,b.height=v.videoHeight,M.drawImage(v,0,0,v.videoWidth,v.videoHeight),await U.stopCamera(),L(!1)};T.useEffect(()=>{(async()=>await R())()},[K]);const D=T.useMemo(()=>K.shouldStream&&N,[K.shouldStream,N]);return T.useEffect(()=>{if(D){if(y.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus pause frame canvas is defined");if(_6(y.current),m.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus tracking canvas is defined");if(_6(m.current),g.current==null)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus video element is defined");ie()}},[D]),qt.createElement("div",{style:{...kHe,...c==null?void 0:c.container},className:l==null?void 0:l.container},qt.createElement("video",{ref:g,style:{...RHe,...c==null?void 0:c.video,visibility:s?"hidden":"visible"},className:l==null?void 0:l.video,autoPlay:!0,muted:!0,playsInline:!0}),qt.createElement("canvas",{ref:y,style:{display:s?"block":"none",position:"absolute",top:0,left:0,width:"100%"}}),qt.createElement("canvas",{ref:m,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"}}),qt.createElement("div",{style:{top:0,left:0,position:"absolute",width:"100%",height:"100%"}},E.finder&&qt.createElement(IHe,{scanning:N,capabilities:U.capabilities,loading:!1,onOff:E.onOff,zoom:E.zoom&&U.settings.zoom?{value:U.settings.zoom,onChange:async v=>{const b={...V,advanced:[{zoom:v}]};await U.updateConstraints(b)}}:void 0,torch:E.torch?{status:(e=U.settings.torch)!==null&&e!==void 0&&e,toggle:async v=>{const b={...V,advanced:[{torch:v}]};await U.updateConstraints(b)}}:void 0,startScanning:async()=>await R(),stopScanning:async()=>{await U.stopCamera(),_6(m.current),L(!1)},border:c==null?void 0:c.finderBorder}),a))}function NHe({onQrUri:t}){const e=rm("isMobile"),r=fr(kx),[n,i]=T.useState(""),s=async()=>{if(n){console.log(n);try{await r.pair(n)}catch(o){console.error("Error pairing with dapp",o),t(!1);return}}t(!0)};return j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{flexDirection:"column",justifyContent:"space-between",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Connect a Dapp"}),j.jsx(ye,{alignSelf:"center",style:{height:"280px",width:"280px"},children:j.jsx(DHe,{onScan:o=>{o[0].rawValue&&i(o[0].rawValue)},styles:{video:{transform:e?"scaleX(-1)":"scaleX(1)",borderRadius:"10px"}}})}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Paste connection string"}),j.jsx(Sn,{name:"signClientUri",value:n,onChange:o=>i(o.target.value)})]})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Vt,{size:"md",shape:"square",label:"Cancel",onClick:()=>{t(!1)}}),j.jsx(Vt,{variant:"primary",size:"md",shape:"square",label:"Connect Dapp",disabled:!n,onClick:()=>{n&&s()}})]})]})}function BHe(){const t=fr(Fr),e=rm("isMobile"),r=fr(kx),n=Wr(r.allSessions),[i,s]=T.useState(!1),[o,a]=T.useState(!1),c=Wr(t.selectedExternalProvider),l=async()=>{a(!0)};return j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{justifyContent:"space-between",alignItems:"center",gap:"2",children:[j.jsxs(ye,{alignItems:"center",gap:"2",children:[j.jsx(Fi,{src:lze,width:"7",height:"7"}),j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Connected Dapps"})]}),j.jsx(Vt,{size:"sm",leftIcon:$w,label:"Connect",shape:"square",disabled:(c==null?void 0:c.info.name)==="WalletConnect",onClick:()=>s(!0)})]}),j.jsx(hi,{marginY:"2"}),n.length>0?j.jsx(cze,{sessionList:n}):j.jsx(vn,{flexDirection:"column",children:(c==null?void 0:c.info.name)==="WalletConnect"?j.jsxs(ye,{flexDirection:"column",alignItems:"center",gap:"4",children:[j.jsx(Fi,{src:Oie,color:"text50",width:"8",height:"8"}),j.jsx(Te,{textAlign:"center",variant:"large",color:"text50",padding:"4",children:"To connect to Dapps, switch from WalletConnect to a different wallet as your External Wallet connection method."})]}):j.jsx(Te,{alignSelf:"center",textAlign:"center",variant:"large",color:"text50",padding:"4",children:"Connect a Dapp with WalletConnect to sign actions"})}),i&&j.jsx(oa,{size:"md",contentProps:{style:{width:e?"100%":"500px"}},onClose:()=>s(!1),children:j.jsx(NHe,{onQrUri:f=>{f&&l(),s(!1)}})}),o&&j.jsx(oa,{size:"md",onClose:()=>a(!1),children:j.jsx(fze,{onClose:()=>a(!1)})})]})}const LHe="data:image/svg+xml,%3csvg%20fill='none'%20height='400'%20viewBox='0%200%20400%20400'%20width='400'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cclipPath%20id='a'%3e%3cpath%20d='m0%200h400v400h-400z'/%3e%3c/clipPath%3e%3cg%20clip-path='url(%23a)'%3e%3ccircle%20cx='200'%20cy='200'%20fill='%233396ff'%20r='199.5'%20stroke='%2366b1ff'/%3e%3cpath%20d='m122.519%20148.965c42.791-41.729%20112.171-41.729%20154.962%200l5.15%205.022c2.14%202.086%202.14%205.469%200%207.555l-17.617%2017.18c-1.07%201.043-2.804%201.043-3.874%200l-7.087-6.911c-29.853-29.111-78.253-29.111-108.106%200l-7.59%207.401c-1.07%201.043-2.804%201.043-3.874%200l-17.617-17.18c-2.14-2.086-2.14-5.469%200-7.555zm191.397%2035.529%2015.679%2015.29c2.14%202.086%202.14%205.469%200%207.555l-70.7%2068.944c-2.139%202.087-5.608%202.087-7.748%200l-50.178-48.931c-.535-.522-1.402-.522-1.937%200l-50.178%2048.931c-2.139%202.087-5.608%202.087-7.748%200l-70.7015-68.945c-2.1396-2.086-2.1396-5.469%200-7.555l15.6795-15.29c2.1396-2.086%205.6085-2.086%207.7481%200l50.1789%2048.932c.535.522%201.402.522%201.937%200l50.177-48.932c2.139-2.087%205.608-2.087%207.748%200l50.179%2048.932c.535.522%201.402.522%201.937%200l50.179-48.931c2.139-2.087%205.608-2.087%207.748%200z'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e";function FHe({onSelectProvider:t}){const e=fr(kx),r=Mie(),[n,i]=T.useState(!1),s=e.allSessions.get().length>0,o=async()=>{await e.disconnectAllSessions(),t();const a=await Rie(!0);await a.connect(),t(kie(a))};return j.jsx(ye,{children:n?j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",color:"text100",children:"Use WalletConnect for External Wallet?"}),j.jsxs(vn,{alignItems:"center",gap:"3",style:{background:"rgba(176, 126, 30, 0.3)"},children:[j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"medium",color:"text100",children:"Attention"}),s?j.jsx(Te,{variant:"normal",color:"text80",children:"If you connect your external wallet using WalletConnect, you'll lose all Dapps connections you already made using WalletConnect."}):j.jsxs(Te,{variant:"normal",color:"text80",children:["If you connect your external wallet using WalletConnect, you won't be able to connect to any other Dapps during this session. ",j.jsx("br",{})," ",j.jsx("br",{}),"If you need to connect Dapps, please consider using a different external wallet instead."]})]}),j.jsx(Fi,{src:Oie,width:"8",height:"8"})]}),j.jsxs(ye,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"6",children:[j.jsx(Vt,{width:"full",label:"Cancel",shape:"square",onClick:()=>t()}),j.jsx(Vt,{width:"full",variant:"primary",label:"Confirm",shape:"square",onClick:()=>o(),"data-id":"signingContinue"})]})]}):j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",color:"text100",children:"Connect external wallet"}),j.jsx(Te,{variant:"normal",color:"text50",children:"You need an external wallet to relay transactions"}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsx(vn,{flexDirection:"row",justifyContent:"center",gap:"2",cursor:"pointer",borderRadius:"circle",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>{i(!0)},children:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Fi,{src:LHe,width:"5",height:"auto"}),j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:"Wallet Connect"})]})}),r.map(a=>j.jsx(vn,{flexDirection:"row",justifyContent:"center",gap:"2",cursor:"pointer",borderRadius:"circle",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>t(a),children:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(Fi,{src:a.info.icon,width:"5",height:"auto"}),j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:a.info.name})]})},a.info.uuid))]})]})})}function jHe(){const t=fr(Fr),e=Wr(t.selectedExternalProvider),r=Wr(t.selectedExternalWalletAddress),[n,i]=T.useState(!1),[s,o]=T.useState(!1);T.useEffect(()=>{s&&setTimeout(()=>{o(!1)},2e3)},[s]);const a=async()=>{e===void 0&&i(!0)},c=async()=>{t.setExternalProvider(void 0);const f=e;(f==null?void 0:f.info.name)==="WalletConnect"&&f.provider.disconnect()},l=()=>{navigator.clipboard.writeText(r),o(!0)};return j.jsxs(ye,{flexDirection:"column",width:"full",children:[j.jsxs(ye,{justifyContent:"space-between",alignItems:"center",gap:"2",children:[j.jsxs(ye,{alignItems:"center",gap:"2",children:[j.jsx(Xge,{color:"text100",style:{width:"28px",height:"28px"}}),j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"External Wallet"})]}),!e&&j.jsx(Vt,{size:"sm",leftIcon:$w,label:"Connect Wallet",variant:"primary",shape:"square",onClick:()=>a()})]}),j.jsx(hi,{marginY:"2"}),j.jsx(vn,{flexDirection:"column",children:e?j.jsxs(ye,{justifyContent:"space-between",alignItems:"center",children:[j.jsxs(ye,{flexDirection:"row",gap:"4",children:[j.jsx(DC,{background:"text80",src:e.info.icon}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"medium",color:"text100",children:e.info.name}),j.jsxs(ye,{gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text50",width:"full",children:r}),s?j.jsx(qw,{color:"borderNormal",cursor:"pointer",onClick:()=>l()}):j.jsx(QW,{color:"borderNormal",cursor:"pointer",onClick:()=>l()})]})]})]}),j.jsx(up,{icon:j.jsx(Tu,{color:"text100"}),onClick:()=>c()})]}):j.jsx(Te,{alignSelf:"center",textAlign:"center",variant:"large",color:"text50",padding:"4",children:"Connect an external wallet to relay transactions"})}),n&&j.jsx(oa,{size:"sm",onClose:()=>i(!1),children:j.jsx(FHe,{onSelectProvider:async f=>{var u,h;f&&(((u=t.selectedExternalProvider.get())==null?void 0:u.info.name)==="WalletConnect"&&await((h=t.selectedExternalProvider.get())==null?void 0:h.provider).disconnect(),t.setExternalProvider(f)),i(!1)}})})]})}function FO({chainId:t,paddingTop:e="0",paddingBottom:r="1"}){return j.jsx(ye,{background:"backgroundMuted",width:"fit",height:"fit",borderRadius:"sm",paddingTop:e,paddingBottom:r,paddingX:"2",children:j.jsx(Te,{variant:"xsmall",color:"text100",children:um(t)})})}function w7({symbol:t,chainId:e,to:r,amount:n}){return j.jsxs(ye,{flexDirection:"column",width:"full",gap:"5",paddingTop:"7",children:[j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text100",children:"Pending transactions"}),j.jsxs(ye,{background:"backgroundSecondary",borderRadius:"sm",alignItems:"center",padding:"4",gap:"5",children:[j.jsx(Q1,{size:"lg"}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"1",children:[j.jsxs(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:["Sending ",n," ",t," on"]}),j.jsx(FO,{chainId:e,paddingTop:"0",paddingBottom:"1"}),j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",children:"to"}),j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text80",style:{fontFamily:"monospace"},children:r})]}),j.jsx(Te,{variant:"normal",color:"text50",children:"Your external wallet will prompt you to confirm the transaction"})]})]})]})}function UHe({...t}){var s,o;const e=fr(Fr),r=Wr(e.isSendingTokenTransaction),n=Wr(e.isSendingCollectibleTransaction),i=Wr(e.isSendingSignedTokenTransaction);return j.jsxs(ye,{flexDirection:"column",justifyContent:"center",alignItems:"center",width:"full",gap:"4",...t,children:[r&&j.jsx(w7,{symbol:((o=(s=r.tokenBalance)==null?void 0:s.contractInfo)==null?void 0:o.symbol)??"",chainId:r.tokenBalance.chainId,to:r.to,amount:r.amount}),n&&j.jsx(w7,{symbol:n.collectibleInfo.collectibleInfoResponse.name??"",chainId:n.collectibleInfo.collectibleInfoParams.chainId,to:n.to,amount:n.amount}),i&&j.jsx(w7,{symbol:"tokens",chainId:i.chainId,to:i.txn[0].to,amount:String(Number(i.txn[0].value))})]})}const KV=["https://dweb.link/ipfs/","https://gateway.pinata.cloud/ipfs/","https://nftstorage.link/ipfs/","https://flk-ipfs.io/ipfs/","https://storry.tv/ipfs/","https://ipfs.io/ipfs/","https://hardbin.com/ipfs/","https://ipfs.runfission.com/ipfs/","https://ipfs.eth.aragon.network/ipfs/","https://4everland.io/ipfs/","https://w3s.link/ipfs/","https://trustless-gateway.link/ipfs/"],$He="QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/1";class qHe{constructor(){ue(this,"gatewayURL");ue(this,"localStore");this.localStore=new hu(Ul.GATEWAY_ADDRESS),this.gatewayURL=this.localStore.get(),this.findAccessibleGateway()}async findAccessibleGateway(){const e=this.localStore.get();if(e&&await this.isGatewayAccessible(e)){this.gatewayURL=e;return}for(const r of KV)if(await this.isGatewayAccessible(r)){this.gatewayURL=r,this.localStore.set(r);return}this.gatewayURL=KV[0],console.warn("No accessible IPFS gateways found, falling back to default")}async isGatewayAccessible(e){try{return await fetch(`${e}${$He}`,{signal:AbortSignal.timeout(3e3)}),!0}catch{return!1}}async fetch(e){this.gatewayURL||await this.findAccessibleGateway();const r=await this.getGatewayURL(e);return fetch(r,{signal:AbortSignal.timeout(3e3)})}async getGatewayURL(e){if(this.gatewayURL||await this.findAccessibleGateway(),!e.startsWith("ipfs://"))throw new Error("Invalid IPFS URI");return e.replace("ipfs://",this.gatewayURL)}}function VHe(t,e){e(t.get()),t.subscribe(e)}const zHe={ERC721:"ERC721",ERC1155:"ERC1155"};class ase{constructor(e){ue(this,"isFetchingBalances",_r(!1));ue(this,"isFetchingCollectibleInfo",_r(!1));ue(this,"ipfsGatewayHelper",new qHe);ue(this,"userCollectibles",_r([]));ue(this,"local",{userCollectibles:new hu(Ul.COLLECTIBLES)});this.store=e;const r=this.store.get(In);VHe(r.networks,n=>{const i=this.store.get(oi).accountAddress.get();i&&n.length>0&&this.loadBalances(i)})}async loadBalances(e){const r=this.local.userCollectibles.get()??[];if(r.length===0)return;this.isFetchingBalances.set(!0);const n=[],i=r.map(async s=>{const o=await this.getCollectibleInfo(s);if(!o.isOwner){this.removeCollectible({collectibleInfoParams:s,collectibleInfoResponse:o});return}n.push({collectibleInfoParams:s,collectibleInfoResponse:o})});await Promise.allSettled(i),this.userCollectibles.set(n),this.isFetchingBalances.set(!1)}async getCollectibleInfo(e){const r=this.store.get(oi).accountAddress.get();if(!r)throw new Error("No account found");const n=this.store.get(In).providerForChainId(e.chainId);this.isFetchingCollectibleInfo.set(!0);let i,s,o,a,c;if(e.contractType===Ph.ERC721){const f=new Si(e.address,fte,n),h=(await f.ownerOf(e.tokenId)).toLowerCase()===r.toLowerCase();if(!h)return this.isFetchingCollectibleInfo.set(!1),{isOwner:h,uri:""};i=await f.tokenURI(e.tokenId)}else if(e.contractType===Ph.ERC1155){const f=new Si(e.address,ute,n);if(a=await f.balanceOf(r,e.tokenId),!a)return this.isFetchingCollectibleInfo.set(!1),{isOwner:!1,uri:""};a=a??BigInt(1),i=await f.uri(e.tokenId)}if(!i)throw new Error("Could not get collectible URI");i.includes("{id}")&&(i=i.replace("{id}",e.tokenId.toString()));let l;try{i.startsWith("ipfs://")?l=await this.ipfsGatewayHelper.fetch(i).then(f=>f.json()):l=await fetch(i).then(f=>f.json()),l&&(c=l.decimals,s=l.image,o=l.name),s!=null&&s.startsWith("ipfs://")&&(s=await this.ipfsGatewayHelper.getGatewayURL(s))}catch{o||(o=`No Metadata Found Address: ${e.address} TokenId: ${e.tokenId}`)}return c=c??0,this.isFetchingCollectibleInfo.set(!1),{isOwner:!0,uri:i,image:s,name:o,balance:a,decimals:c}}async addCollectible(e){if(e.collectibleInfoResponse.isOwner){const r=this.local.userCollectibles.get()??[];if(r.some(n=>n.address===e.collectibleInfoParams.address&&n.tokenId===e.collectibleInfoParams.tokenId))throw new Error("Collectible already added");this.local.userCollectibles.set([...r,e.collectibleInfoParams]),this.isFetchingCollectibleInfo.set(!0),this.loadBalances(),this.isFetchingCollectibleInfo.set(!1)}}async removeCollectible(e){const n=(this.local.userCollectibles.get()??[]).filter(o=>o.address!==e.collectibleInfoParams.address||o.tokenId!==e.collectibleInfoParams.tokenId);this.local.userCollectibles.set(n);const s=this.userCollectibles.get().filter(o=>o.collectibleInfoParams.address!==e.collectibleInfoParams.address||o.collectibleInfoParams.tokenId!==e.collectibleInfoParams.tokenId);this.userCollectibles.set(s)}}const HHe="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='collection'%3e%3cg%20id='Vector'%3e%3cpath%20d='M6.37183%2013.326V6.12354H13.5743V7.86282H8.11042V13.326H6.37183Z'%20fill='white'/%3e%3cpath%20d='M3%209.95247V2.75H10.2025V4.48928H4.7386V9.95247H3Z'%20fill='white'/%3e%3cpath%20d='M9.79834%2016.7508V9.54834H17.0008V16.7508H9.79834Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",cse="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Send%20(Default)'%3e%3cpath%20id='Subtract'%20d='M14.952%202.86937L3.33984%2010.6285C3.00008%2010.8569%202.89796%2011.3362%203.11176%2011.6991C3.2446%2011.9246%203.46815%2012.0521%203.6999%2012.0616L3.70388%2012.0651L3.708%2012.0686H6.28605C6.78202%2012.0686%207.26064%2011.8739%207.63066%2011.5216C8.1492%2011.0279%2010.4926%209.12312%2011.7011%208.14595C12.0915%207.83027%2012.8551%207.99125%2012.625%208.4375L11.2433%2010.9344C10.7104%2011.8479%2010.8913%2013.0409%2011.667%2013.7286L14.4613%2016.206L14.718%2016.4303L14.928%2016.6297L14.998%2016.6795L15.0641%2016.7149C15.0822%2016.7245%2015.1011%2016.7323%2015.1206%2016.738C15.1476%2016.746%2015.1755%2016.75%2015.2035%2016.75H15.3981C15.7996%2016.75%2016.125%2016.4024%2016.125%2015.9736L16.125%203.53132C16.125%203.11184%2015.8136%202.77006%2015.4242%202.75541C15.2649%202.73526%2015.0984%202.77102%2014.952%202.86937Z'%20fill='white'/%3e%3c/g%3e%3c/svg%3e";function GHe({collectibleInfo:t,onSendClick:e,onRemoveClick:r}){return j.jsxs(vn,{flexDirection:"row",justifyContent:"space-between",children:[j.jsxs(ye,{flexDirection:"row",gap:"3",children:[t.collectibleInfoResponse.image&&j.jsx(ye,{children:j.jsx(DC,{background:"text80",src:t.collectibleInfoResponse.image})}),j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{gap:"2",alignItems:"center",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:t.collectibleInfoResponse.name??"Collectible"}),j.jsxs(Te,{variant:"small",fontWeight:"bold",color:"text50",children:["#",t.collectibleInfoParams.tokenId]}),j.jsx(FO,{chainId:t.collectibleInfoParams.chainId})]}),j.jsx(ye,{children:j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text50",children:t.collectibleInfoParams.contractType==="ERC1155"?Number(Ih(t.collectibleInfoResponse.balance,t.collectibleInfoResponse.decimals??0)):1})})]})]}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(up,{icon:j.jsx(Fi,{src:cse}),disabled:!1,onClick:e}),r&&j.jsx(up,{icon:j.jsx(Tu,{color:"text100"}),onClick:()=>r==null?void 0:r()})]})]})}function WHe({onClose:t}){const r=fr(In).networks.get(),n=r.filter(U=>U.type===Mt.MAINNET),i=fr(ase),s=Wr(i.isFetchingCollectibleInfo),o=tm(),[a,c]=T.useState(),[l,f]=T.useState(),[u,h]=T.useState(),[g,y]=T.useState(),[m,S]=T.useState(),[E,A]=T.useState(!1),[P,N]=T.useState();T.useEffect(()=>{var U,ie;a&&N((ie=(U=r.find(ae=>ae.chainId===a.chainId))==null?void 0:U.blockExplorer)==null?void 0:ie.rootUrl),a&&l&&u&&g?i.getCollectibleInfo({chainId:a.chainId,address:l,tokenId:u,contractType:g}).then(ae=>{S(ae)}):S(void 0)},[a,l,u,g]);const L=n.filter(U=>!U.disabled).map(U=>({label:U.title,value:U.chainId.toString()})),V=async()=>{a&&l&&m&&u&&g&&(await i.addCollectible({collectibleInfoParams:{chainId:a.chainId,address:l,tokenId:u,contractType:g},collectibleInfoResponse:m}),A(!1),o({variant:"success",title:g===zHe.ERC721?"ERC721 collectible added successfully":"ERC1155 collectible added successfully",description:"You'll be able to see this collectible on your browser as long as you don't clear your cache."}),I(),t())},I=()=>{f(void 0),c(void 0),h(void 0),y(void 0)};return j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Import ERC721 or ERC1155 Collectible"}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Collectible Network"}),j.jsx(V_,{name:"collectibleNetwork",options:L,onValueChange:U=>c(r.find(ie=>ie.chainId===Number(U)))})]}),j.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Collectible Address"}),j.jsxs(ye,{flexDirection:"row",gap:"1",paddingBottom:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text50",children:"See addresses on network's"}),j.jsx(Te,{variant:"normal",color:"text50",underline:!!P,cursor:P?"pointer":"default",onClick:()=>{P&&window.open(P)},children:"directory"})]}),j.jsx(Sn,{name:"collectibleAddress",value:l??"",onChange:U=>{f(U.target.value)}})]}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Collectible Type"}),j.jsx(V_,{name:"collectibleType",options:[{value:"ERC721",label:"ERC721"},{value:"ERC1155",label:"ERC1155"}],onValueChange:U=>y(U)})]}),j.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Collectible Token ID"}),j.jsx(Sn,{name:"collectibleTokenId",value:u??"",onKeyPress:U=>{/[0-9]/.test(U.key)||U.preventDefault()},onChange:U=>{if(U.target.value===""){h(void 0);return}h(U.target.value)}})]})]}),s&&j.jsx(ye,{alignItems:"center",justifyContent:"center",children:j.jsx(Q1,{size:"lg"})}),m&&!m.isOwner&&!s&&j.jsx(ye,{alignItems:"center",justifyContent:"center",children:j.jsx(Te,{variant:"medium",color:"warning",children:"You do not own this collectible"})}),m&&m.isOwner&&!s&&j.jsxs(vn,{flexDirection:"row",gap:"6",children:[j.jsx(Fi,{src:m.image,style:{width:"120px",height:"auto"}}),j.jsxs(ye,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"medium",color:"text100",children:m.name??""}),j.jsx(Te,{variant:"small",color:"text80",children:"Your Balance:"}),j.jsx(Te,{variant:"medium",color:"text100",children:Number(Ih(m.balance,m.decimals??0))})]})]})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Vt,{label:"Cancel",size:"md",shape:"square",onClick:t}),j.jsx(Vt,{label:"Add Collectible",variant:"primary",shape:"square",disabled:m===void 0||E,onClick:()=>{V()}})]})]})}function KHe({onSendClick:t}){const e=fr(ase),r=fr(In),n=Wr(e.isFetchingBalances),i=Wr(e.userCollectibles),s=T.useMemo(()=>i,[i]),o=T.useMemo(()=>s.filter(l=>{var f;return!((f=r.networks.get().find(u=>u.chainId===l.collectibleInfoParams.chainId))!=null&&f.disabled)}),[s,r]),[a,c]=T.useState(!1);return j.jsxs(ye,{width:"full",children:[j.jsxs(ye,{justifyContent:"space-between",alignItems:"center",children:[j.jsxs(ye,{gap:"2",children:[j.jsx(Fi,{src:HHe,width:"7",height:"7"}),j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Collectibles"})]}),j.jsx(Vt,{size:"sm",leftIcon:$w,label:"Import",shape:"square",onClick:()=>c(!0)})]}),j.jsx(hi,{marginY:"2"}),j.jsx(ye,{width:"full",flexDirection:"column",gap:"4",marginBottom:"8",children:n?j.jsx(ye,{marginTop:"4",alignItems:"center",justifyContent:"center",children:j.jsx(Q1,{size:"lg"})}):j.jsx(j.Fragment,{children:o.length>0?j.jsx(j.Fragment,{children:s.map(l=>j.jsx(ye,{children:j.jsx(GHe,{collectibleInfo:l,onSendClick:()=>{t(l)},onRemoveClick:()=>{e.removeCollectible(l)}})},l.collectibleInfoParams.chainId+l.collectibleInfoParams.address+l.collectibleInfoParams.tokenId))}):j.jsx(vn,{flexDirection:"column",children:j.jsx(Te,{alignSelf:"center",variant:"large",color:"text50",padding:"4",children:"Import ERC721 or ERC1155 Collectibles"})})})}),a&&j.jsx(oa,{size:"sm",onClose:()=>c(!1),children:j.jsx(WHe,{onClose:()=>c(!1)})})]})}function YHe({collectibleInfo:t,onClose:e}){var h,g,y;const r=rm("isMobile"),n=fr(Fr),[i,s]=T.useState(void 0),[o,a]=T.useState(void 0),[c,l]=T.useState(!1);if(T.useEffect(()=>{const m=n.selectedExternalWalletAddress.get();c&&m&&a(n.selectedExternalWalletAddress.get())},[c]),!t)return null;const f=t.collectibleInfoParams.contractType==="ERC721",u=um(t.collectibleInfoParams.chainId);return j.jsxs(ye,{style:{minWidth:r?"100vw":"500px"},children:[j.jsxs(ye,{flexDirection:"column",gap:"6",padding:"6",children:[j.jsxs(Te,{variant:"large",fontWeight:"bold",color:"text100",children:["Sending ",(h=t==null?void 0:t.collectibleInfoResponse)==null?void 0:h.name," on ",u]}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Amount"}),j.jsxs(Te,{variant:"normal",color:"text50",children:["Current Balance:"," ",Ih((g=t==null?void 0:t.collectibleInfoResponse)==null?void 0:g.balance,((y=t==null?void 0:t.collectibleInfoResponse)==null?void 0:y.decimals)??18)]})]}),j.jsx(Sn,{name:"amount",value:f?"1":i??"",disabled:f,onChange:m=>{s(m.target.value)},controls:j.jsx(Vt,{label:"Max",size:"xs",shape:"square",onClick:()=>{var m,S;s(Ih((m=t==null?void 0:t.collectibleInfoResponse)==null?void 0:m.balance,((S=t==null?void 0:t.collectibleInfoResponse)==null?void 0:S.decimals)??18))}})})]}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"To"}),j.jsx(Sn,{name:"to",value:o??"",placeholder:"0x...",disabled:c,onChange:m=>{a(m.target.value)}})]})]}),j.jsx(Vt,{variant:"text",label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(ux,{checked:c,size:"md"}),j.jsx(Te,{variant:"small",color:"text100",children:"Send to connected external wallet address"})]}),onClick:()=>l(!c)})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{alignItems:"center",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Vt,{label:"Cancel",size:"md",shape:"square",onClick:()=>{e()}}),j.jsx(Vt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:f?!o:!o||!i,onClick:()=>{o&&i&&e(o,i)}})]})]})}function QHe({tokenBalance:t,onClose:e}){var u,h;const r=rm("isMobile"),n=fr(Fr),[i,s]=T.useState(void 0),[o,a]=T.useState(void 0),[c,l]=T.useState(!1);if(T.useEffect(()=>{const g=n.selectedExternalWalletAddress.get();c&&g&&a(n.selectedExternalWalletAddress.get())},[c]),!t)return null;const f=um(t.chainId);return j.jsxs(ye,{style:{minWidth:r?"100vw":"500px"},children:[j.jsxs(ye,{flexDirection:"column",gap:"6",padding:"6",children:[j.jsxs(Te,{variant:"large",fontWeight:"bold",color:"text100",children:["Sending ",(u=t==null?void 0:t.contractInfo)==null?void 0:u.symbol," on ",f]}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Amount"}),j.jsxs(Te,{variant:"normal",color:"text50",children:["Current Balance:"," ",Ih(t==null?void 0:t.balance,((h=t==null?void 0:t.contractInfo)==null?void 0:h.decimals)??18)]})]}),j.jsx(Sn,{name:"amount",value:i??"",onChange:g=>{s(g.target.value)},controls:j.jsx(Vt,{label:"Max",size:"xs",shape:"square",onClick:()=>{var g;s(Ih(t==null?void 0:t.balance,((g=t==null?void 0:t.contractInfo)==null?void 0:g.decimals)??18))}})})]}),j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"To"}),j.jsx(Sn,{name:"to",value:o??"",placeholder:"0x...",disabled:c,onChange:g=>{a(g.target.value)}})]})]}),j.jsx(Vt,{variant:"text",label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"2",children:[j.jsx(ux,{checked:c,size:"md"}),j.jsx(Te,{variant:"small",color:"text100",children:"Send to connected external wallet address"})]}),onClick:()=>l(!c)})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{alignItems:"center",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Vt,{label:"Cancel",size:"md",shape:"square",onClick:()=>{e()}}),j.jsx(Vt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:!o||!i,onClick:()=>{o&&i&&e(o,i)}})]})]})}const JHe="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='coins'%3e%3cg%20id='Vector'%3e%3cpath%20d='M11.1921%207.78597C11.1921%208.14419%2010.5971%208.69061%209.27961%209.03061C8.55711%209.23097%207.70711%209.33418%206.82068%209.33418C5.94032%209.33418%205.09032%209.23097%204.37389%209.03668C3.04425%208.69061%202.45532%208.15633%202.45532%207.78597C2.45532%207.15454%204.15532%206.23776%206.82068%206.23776C9.49211%206.23776%2011.1921%207.15454%2011.1921%207.78597Z'%20fill='white'/%3e%3cpath%20d='M9.62814%2015.1728C8.78725%2015.3938%207.81704%2015.5109%206.82132%2015.5109C5.82986%2015.5109%204.86207%2015.3944%204.02179%2015.1734C3.16996%2014.9481%202.49361%2014.6263%202%2014.2378V15.9815C2%2017.0865%204.15961%2017.9844%206.82193%2017.9844C9.49032%2017.9844%2011.6499%2017.0865%2011.6499%2015.9815V14.2378C11.1563%2014.6263%2010.48%2014.9481%209.62814%2015.1728Z'%20fill='white'/%3e%3cpath%20d='M9.50732%2010.5956C8.72836%2010.8112%207.79396%2010.9277%206.82071%2010.9277C5.85779%2010.9277%204.92946%2010.8136%204.13532%2010.5987C3.15661%2010.3437%202.43168%209.96298%202%209.50337V11.8512C2%2012.567%202.89796%2013.1887%204.25371%2013.5463C4.99443%2013.7412%205.87964%2013.8542%206.82132%2013.8542C7.76907%2013.8542%208.65429%2013.7412%209.39561%2013.5463C10.752%2013.1887%2011.6493%2012.5603%2011.6493%2011.8512V9.49002C11.214%209.95569%2010.4818%2010.3443%209.50732%2010.5956Z'%20fill='white'/%3e%3cpath%20d='M15.8134%204.56107C17.0151%204.25095%2017.5578%203.75254%2017.5578%203.42581C17.5578%202.84988%2016.0072%202.01367%2013.5706%202.01367C11.1395%202.01367%209.58887%202.84988%209.58887%203.42581C9.58887%203.76362%2010.126%204.25095%2011.3388%204.5666C11.9923%204.74381%2012.7676%204.83796%2013.5706%204.83796C14.3791%204.83796%2015.1544%204.74381%2015.8134%204.56107Z'%20fill='white'/%3e%3cpath%20d='M13.5711%2014.1821C14.4793%2014.1821%2015.3643%2014.0752%2016.1313%2013.8737C16.9082%2013.6688%2017.5251%2013.3753%2017.9754%2013.0208V14.6113C17.9754%2015.6192%2016.0056%2016.4382%2013.5717%2016.4382C13.4159%2016.4382%2013.2619%2016.4349%2013.1103%2016.4283C13.153%2016.2336%2013.1755%2016.0314%2013.1755%2015.824V14.1753C13.3067%2014.1798%2013.4387%2014.1821%2013.5711%2014.1821Z'%20fill='white'/%3e%3cpath%20d='M13.1755%2012.7206C13.306%2012.7255%2013.4382%2012.7279%2013.5717%2012.7279C16.0056%2012.7279%2017.9754%2011.9089%2017.9754%2010.901V9.31055C17.5251%209.66497%2016.9082%209.95848%2016.1313%2010.1634C15.3643%2010.365%2014.4793%2010.4718%2013.5711%2010.4718C13.4387%2010.4718%2013.3067%2010.4696%2013.1755%2010.465V12.7206Z'%20fill='white'/%3e%3cpath%20d='M13.1755%208.95334C13.3059%208.95819%2013.4379%208.96067%2013.5711%208.96067C14.4356%208.96067%2015.243%208.85767%2015.9192%208.6799C17.1563%208.35372%2017.9748%207.78056%2017.9748%207.13375V4.98009C17.5778%205.40484%2016.9099%205.75926%2016.0211%205.98853C15.3106%206.18512%2014.4583%206.29144%2013.5706%206.29144C13.3313%206.29144%2013.0943%206.28371%2012.8615%206.2685C13.0621%206.65495%2013.1755%207.09399%2013.1755%207.55951V8.95334Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";function ZHe({onClose:t}){const r=fr(In).networks.get(),n=r.filter(N=>N.type===Mt.MAINNET),i=fr(eC),s=Wr(i.isFetchingTokenInfo),o=tm(),[a,c]=T.useState(),[l,f]=T.useState(),[u,h]=T.useState(),[g,y]=T.useState(!1),[m,S]=T.useState();T.useEffect(()=>{var N,L;a&&S((L=(N=r.find(V=>V.chainId===a.chainId))==null?void 0:N.blockExplorer)==null?void 0:L.rootUrl),a&&l?i.getTokenInfo(a.chainId,l).then(V=>{h(V)}):h(void 0)},[a,l]);const E=n.filter(N=>!N.disabled).map(N=>({label:N.title,value:N.chainId.toString()})),A=async()=>{a&&l&&u&&(y(!0),await i.addToken({chainId:a.chainId,address:l,contractType:Ph.ERC20,symbol:u.symbol,decimals:u.decimals}),y(!1),o({variant:"success",title:"ERC20 token added sucessfully",description:"You'll be able to see this token on your browser as long as you don't clear your cache."}),P(),t())},P=()=>{f(void 0),c(void 0)};return j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{flexDirection:"column",padding:"6",gap:"6",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Import Token"}),j.jsxs(ye,{flexDirection:"column",children:[j.jsx(ye,{flexDirection:"row",style:{paddingBottom:"5px"},children:j.jsxs(ye,{children:[j.jsx(Te,{variant:"normal",fontWeight:"semibold",color:"text100",paddingY:"2",paddingX:"4",children:"ERC20 Token"}),j.jsx(hi,{color:"white",height:"0.5",position:"relative",marginY:"0",style:{top:"6px"}})]})}),j.jsx(hi,{marginY:"0"})]}),j.jsxs(ye,{flexDirection:"column",gap:"3",children:[j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Token Network"}),j.jsx(V_,{name:"tokenNetwork",options:E,onValueChange:N=>c(r.find(L=>L.chainId===Number(N)))})]}),j.jsxs(ye,{flexDirection:"column",gap:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Token Address"}),j.jsxs(ye,{flexDirection:"row",gap:"1",paddingBottom:"0.5",children:[j.jsx(Te,{variant:"normal",color:"text50",children:"See addresses on network's"}),j.jsx(Te,{variant:"normal",color:"text50",underline:!!m,cursor:m?"pointer":"default",onClick:()=>{m&&window.open(m)},children:"directory"})]}),j.jsx(Sn,{name:"tokenAddress",value:l??"",onChange:N=>{f(N.target.value)}})]})]}),s&&j.jsx(ye,{alignItems:"center",justifyContent:"center",children:j.jsx(Q1,{size:"lg"})}),!s&&u&&j.jsxs(vn,{flexDirection:"column",gap:"2",children:[j.jsx(Te,{variant:"medium",color:"text100",children:u.symbol??""}),j.jsx(Te,{variant:"small",color:"text80",children:"Your Balance:"}),j.jsx(Te,{variant:"medium",color:"text100",children:u.balance})]})]}),j.jsx(hi,{marginY:"0"}),j.jsxs(ye,{flexDirection:"row",justifyContent:"flex-end",padding:"6",gap:"2",children:[j.jsx(Vt,{label:"Cancel",size:"md",shape:"square",onClick:t}),j.jsx(Vt,{label:"Add Token",variant:"primary",shape:"square",disabled:u===void 0||g,onClick:()=>{A()}})]})]})}const XHe=(t,e)=>Math.floor(t*10**e)/10**e;function eGe({disabled:t,tokenBalance:e,onSendClick:r,onRemoveClick:n}){var o,a;const i=Ih(e.balance,((o=e.contractInfo)==null?void 0:o.decimals)??18),s=XHe(Number(i),5);return j.jsxs(vn,{flexDirection:"row",alignItems:"center",gap:"3",children:[j.jsx(DC,{background:"text80",src:hge(e==null?void 0:e.chainId,e==null?void 0:e.contractAddress)}),j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{gap:"2",alignItems:"center",children:[j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:((a=e.contractInfo)==null?void 0:a.symbol)??"Native Token"}),j.jsx(FO,{chainId:e.chainId})]}),j.jsx(ye,{children:j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text50",children:s})})]}),j.jsxs(ye,{flexDirection:"row",alignItems:"center",marginLeft:"auto",gap:"2",children:[j.jsx(up,{icon:j.jsx(Fi,{src:cse}),disabled:t,onClick:r}),n&&j.jsx(up,{icon:j.jsx(Tu,{color:"text100"}),onClick:()=>n==null?void 0:n()})]})]})}function tGe({onSendClick:t}){const e=fr(Fr),r=fr(eC),n=fr(In),i=Wr(r.balances),s=Wr(r.isFetchingBalances),o=Wr(e.selectedExternalProvider)!==void 0,[a,c]=T.useState(!1),[l,f]=T.useState(!0),u=T.useMemo(()=>{const g=new Map,y=m=>!l||m.balance!=="0";return i.forEach(m=>{var E;if((E=n.networks.get().find(A=>A.chainId===m.chainId))!=null&&E.disabled)return;const S=`${m.contractAddress}-${m.chainId}`;!g.has(S)&&y(m)&&g.set(S,m)}),Array.from(g.values())},[i,l,s]),h=g=>g.contractType===Ph.NATIVE?void 0:()=>{var y,m;r.removeToken({chainId:g.chainId,address:g.contractAddress,contractType:g.contractType,decimals:(y=g.contractInfo)==null?void 0:y.decimals,symbol:(m=g.contractInfo)==null?void 0:m.symbol})};return j.jsxs(ye,{children:[j.jsxs(ye,{justifyContent:"space-between",alignItems:"center",children:[j.jsxs(ye,{gap:"2",children:[j.jsx(Fi,{src:JHe,width:"7",height:"7"}),j.jsx(Te,{variant:"large",fontWeight:"bold",color:"text100",children:"Coins"})]}),j.jsxs(ye,{gap:"4",children:[j.jsxs(ye,{flexDirection:"row",alignItems:"center",cursor:"pointer",gap:"2",onClick:()=>f(!l),children:[j.jsx(ux,{checked:l}),j.jsx(Te,{variant:"normal",fontWeight:"medium",color:"text80",children:"Filter zero balances"})]}),j.jsx(Vt,{size:"sm",leftIcon:$w,label:"Import",shape:"square",onClick:()=>c(!0)})]})]}),j.jsx(hi,{marginY:"2"}),j.jsx(ye,{width:"full",flexDirection:"column",gap:"2",children:s?j.jsx(ye,{marginTop:"4",alignItems:"center",justifyContent:"center",children:j.jsx(Q1,{size:"lg"})}):j.jsx(j.Fragment,{children:u.length>0?j.jsx(j.Fragment,{children:u.map(g=>j.jsx(eGe,{tokenBalance:g,disabled:!o,onSendClick:()=>t(g),onRemoveClick:h(g)},g.contractAddress+g.chainId))}):j.jsx(vn,{flexDirection:"column",children:j.jsx(Te,{alignSelf:"center",variant:"large",color:"text50",padding:"4",children:"Import ERC 20 token address"})})})}),a&&j.jsx(oa,{size:"sm",onClose:()=>c(!1),children:j.jsx(ZHe,{onClose:()=>c(!1)})})]})}const lse=800;function rGe(){const t=Mie(),e=fr(oi),r=fr(eC),n=fr(Fr),i=fr(In),s=fr(kx),o=Wr(e.accountAddress),a=Wr(n.isSigningTxn),c=Wr(n.isSigningMsg),l=Wr(i.networks),f=tm(),u=rm("isMobile"),h=sze();T.useEffect(()=>{o&&l.length>0&&r.loadBalances(o,l)},[o,l]),T.useEffect(()=>{if(h&&h.connected&&!n.selectedExternalProvider.get()){let v=kie(h),b=n.availableExternalProviders.get();b?n.availableExternalProviders.set([v,...b]):n.availableExternalProviders.set([v])}},[h]),T.useEffect(()=>{t.length>0&&n.availableExternalProviders.set(t)},[t]);const[g,y]=T.useState(void 0),[m,S]=T.useState(void 0),[E,A]=T.useState(!1),[P,N]=T.useState(!1),[L,V]=T.useState(!1),I=v=>{S(void 0),n.isSendingCollectibleTransaction.set(void 0),y(v),N(!0)},U=v=>{y(void 0),n.isSendingTokenTransaction.set(void 0),S(v),V(!0)},ie=async(v,b)=>{if(!n.selectedExternalProvider.get()){console.warn("No external provider selected");return}var M;let B;try{if(g)M=g.chainId,B=await n.sendToken(g,v,b);else if(m)M=m.collectibleInfoParams.chainId,B=await n.sendCollectible(m,v,b);else{console.warn("No pending send found");return}}catch(w){w.code===4001&&f({variant:"error",title:"User denied transaction signature."}),console.error(w);return}const x=i.providerForChainId(M),C=await jV(x,B.hash);C&&f({variant:"success",title:"Transaction confirmed",description:"You can view the transaction details on your connected external wallet"}),g&&r.updateTokenBalance(g),y(void 0),S(void 0),n.isSendingTokenTransaction.set(void 0),n.isSendingCollectibleTransaction.set(void 0),console.log("receipt",C)},ae=async(v,b)=>{const M=i.providerForChainId(b);await jV(M,v)&&(n.isSendingSignedTokenTransaction.set(void 0),f({variant:"success",title:"Sign transaction confirmed",description:"You can view the transaction details on your connected external wallet"}))},K=()=>{n.resetSignObservables(),s.rejectRequest(),n.toSignPermission.set("cancelled")};async function R(v){var C;const b=async(w,k)=>{try{const O=await n.getExternalProviderAddress(M);if(!O)throw new Error("No provider address found");return console.log("sendTransaction chainId",k),await n.sendTransaction(B,M,O,w,k)}catch(O){throw n.isSendingSignedTokenTransaction.set(void 0),O}},M=(C=n.selectedExternalProvider.get())==null?void 0:C.provider,B=e.account;let x;if(v)try{n.isSendingSignedTokenTransaction.set(v),x=await b(v.txn,v.chainId),ae(x.hash,v.chainId),n.toSignResult.set(x),n.toSignPermission.set("approved"),n.isSigningTxn.set(!1)}catch(w){throw f({variant:"error",title:"Transaction failed",description:"Please try again."}),n.isSendingSignedTokenTransaction.set(void 0),K(),w}}async function D(v){const b=async(x,C)=>{try{let w;if(x.message)console.log("signMessage chainId",x.chainId),w=await M.signMessage(x.message,x.chainId,x.eip6492?"eip6492":"throw");else if(x.typedData){const k=x.typedData;w=await M.signTypedData(k.domain,k.types,k.message,x.chainId,x.eip6492?"eip6492":"throw")}if(!w)throw new Error("Account sign method failed");return{hash:w}}catch(w){throw w}},M=e.account;let B;if(v)try{B=await b(v.message),n.toSignResult.set(B),n.toSignPermission.set("approved")}catch(x){throw f({variant:"error",title:"Transaction failed",description:"Please try again."}),n.isSendingSignedTokenTransaction.set(void 0),K(),x}}return j.jsxs(ye,{children:[j.jsx(are,{handleNetworkModal:()=>A(!0)}),j.jsx(ye,{justifySelf:"center",flexDirection:"column",padding:"5",width:"full",style:{maxWidth:"800px"},paddingBottom:"20",children:j.jsxs(ye,{flexDirection:"column",children:[j.jsxs(ye,{flexDirection:"column",gap:"5",children:[j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text50",children:"External connections"}),j.jsx(jHe,{}),j.jsx(BHe,{})]}),j.jsx(UHe,{paddingY:"5"}),j.jsxs(ye,{flexDirection:"column",gap:"5",children:[j.jsx(Te,{variant:"normal",fontWeight:"bold",color:"text50",children:"My Sequence wallet"}),j.jsx(tGe,{onSendClick:I}),j.jsx(KHe,{onSendClick:U})]})]})}),E&&j.jsx(oa,{onClose:()=>{A(!1),i.discardUnsavedNetworkEdits(),i.isAddingNetwork.set(!1)},contentProps:{style:{scrollbarColor:"gray black",scrollbarWidth:"thin"}},children:j.jsx(hte,{})}),a&&j.jsx(oa,{isDismissible:!1,size:"md",contentProps:{style:{width:u?"100%":"800px",maxHeight:"100%",overflowY:"auto"}},children:j.jsx(aze,{onClose:()=>{K()},handleSignTxn:v=>R(v)})}),c&&j.jsx(oa,{isDismissible:!1,size:"md",contentProps:{style:{width:u?"100%":"800px",maxHeight:"90%",overflowY:"auto"}},children:j.jsx(oze,{onClose:v=>{n.isSigningMsg.set(!1),v?D(v):K()}})}),P&&j.jsx(oa,{size:"md",onClose:()=>N(!1),children:j.jsx(QHe,{tokenBalance:g,onClose:(v,b)=>{N(!1),v&&b&&ie(v,b)}})}),L&&j.jsx(oa,{size:"md",onClose:()=>V(!1),children:j.jsx(YHe,{collectibleInfo:m,onClose:(v,b)=>{V(!1),(v&&(m==null?void 0:m.collectibleInfoParams.contractType)==="ERC721"||v&&b)&&ie(v,b)}})})]})}const nGe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Checkmark'%3e%3cpath%20id='Vector%20332%20(Stroke)'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13.0635%204.14864L6.93414%2013.8114L2.99475%209.38482L3.89118%208.58706L6.77296%2011.8253L12.0502%203.50586L13.0635%204.14864Z'%20fill='black'/%3e%3c/g%3e%3c/svg%3e",iGe="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='round%20checkbox'%3e%3cpath%20id='circle'%20d='M1%2016C1%207.71573%207.71573%201%2016%201C24.2843%201%2031%207.71573%2031%2016C31%2024.2843%2024.2843%2031%2016%2031C7.71573%2031%201%2024.2843%201%2016Z'%20stroke='%235D5D5D'%20stroke-width='2'/%3e%3c/g%3e%3c/svg%3e",Wb=8;function sGe({checked:t}){return j.jsx(ye,{width:`${Wb}`,height:`${Wb}`,justifyContent:"center",alignItems:"center",background:t?"white":"transparent",borderRadius:"circle",children:t?j.jsx("img",{src:nGe,alt:"Checkmark",style:{width:"24px",height:"24px"}}):j.jsx("img",{src:iGe,alt:"Empty Round Checkbox",style:{width:`${Wb*4}px`,height:`${Wb*4}px`}})})}function oGe({possibleWallets:t,handleSelectWallet:e}){const[r,n]=T.useState(t[0]),i=2;return j.jsxs(ye,{flexDirection:"column",gap:`${i}`,children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Wallets found"}),t.map(s=>j.jsx(ye,{children:j.jsx(Vt,{shape:"square",width:"full",variant:"text",label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:`${i}`,style:{height:"52px"},children:[j.jsx(sGe,{checked:r===s}),j.jsx(ye,{background:"buttonGlass",borderRadius:"md",alignItems:"center",height:"full",paddingX:"4",style:{width:`${lse-Wb*4-i*4}px`},children:j.jsx(Te,{variant:"normal",color:"text100",style:{fontFamily:"monospace"},children:s})})]}),onClick:()=>{n(s),e(s)}})},s))]})}function aGe(){const t=fr(oi),r=fr(In).networks.get(),[n,i]=T.useState(""),[s,o]=T.useState([]),[a,c]=T.useState(""),[l,f]=T.useState(""),[u,h]=T.useState(""),[g,y]=T.useState(!0),[m,S]=T.useState(!1),[E,A]=T.useState(!1),[P,N]=T.useState(!1),[L,V]=T.useState(!1),[I,U]=T.useState(!1),[ie,ae]=T.useState(!1);T.useEffect(()=>{if(N(!1),!lg(n))return;U(!0);const x=Zt(n);B(x)},[n]);const K=()=>{const x=Zt(n);t.signInWithRecoveryMnemonic(x,a.trim(),l)},R=(x=a)=>x.replace(/\s+/g," ").trim().split(" ").length==12,D=()=>(l==null?void 0:l.length)>=8,v=()=>n?lg(n):!0,b=async x=>{if(i(""),o([]),c(x),ae(!1),!!R(x)){V(!0);try{const C=B4.fromPhrase(x),w=[...(await aT.walletsOfSigner({signer:C.address})).map(({wallet:k})=>k),...(x_e[C.address]??[]).map(({wallet:k})=>k)];o(w),w&&i(w[0])}catch(C){console.error(C)}V(!1)}},M=async x=>{i(x),ae(!1)},B=async x=>{try{const C=B4.fromPhrase(a),w=new JE([C]),G=(await new fx({address:x,tracker:aT,contexts:ite,orchestrator:w,networks:r}).status(ge.MAINNET)).config,X=Ps.genericCoderFor(G.version).config.signersOf(G).some(W=>W.address===C.address);ae(X),X||N(!0)}catch(C){N(!0),console.error("failed to validate wallet address",C)}U(!1)};return j.jsxs(ye,{flexDirection:"column",background:"backgroundPrimary",children:[j.jsx(are,{handleNetworkModal:()=>A(!0)}),j.jsxs(ye,{alignSelf:"center",flexDirection:"column",marginY:"10",gap:"4",width:"full",style:{maxWidth:lse},children:[j.jsx(Vt,{leftIcon:YW,label:"Back",size:"sm",as:JQ,to:"/"}),j.jsxs(ye,{flexDirection:"column",children:[j.jsx(Te,{variant:"xlarge",color:"text100",children:"Recover your wallet"}),j.jsx(hi,{marginY:"6"}),j.jsx(Te,{variant:"normal",color:"text100",children:"Recovery phrase"}),j.jsx(Te,{variant:"normal",color:"text50",marginBottom:"1",children:"Paste your 12-word mnemonic, with each word separated by a space."}),j.jsx(Sn,{name:"mnemonic",value:a,type:g?"text":"password",onChange:x=>b(x.target.value)}),a&&!R()&&j.jsx(Te,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Mnemonic must be 12 words"})]}),j.jsx(Vt,{variant:"text",label:j.jsxs(ye,{flexDirection:"row",alignItems:"center",gap:"1",children:[j.jsx(ux,{checked:g}),j.jsx(Te,{variant:"normal",color:"text100",children:"Show secret recovery phrase"})]}),onClick:()=>y(!g)}),j.jsxs(ye,{flexDirection:"column",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Create password"}),j.jsx(Te,{variant:"normal",color:"text50",marginBottom:"1",children:"Encrypt your mnemonic with an 8+ character password."}),j.jsx(Sn,{type:"password",name:"password",value:l,onChange:x=>f(x.target.value)}),l&&!D()&&j.jsx(Te,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Password not long enough"})]}),j.jsxs(ye,{flexDirection:"column",children:[j.jsx(Te,{variant:"normal",color:"text100",marginBottom:"1",children:"Confirm password"}),j.jsx(Sn,{type:"password",name:"confirmPassword",value:u,onChange:x=>h(x.target.value)}),l&&u&&l!==u&&j.jsx(Te,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Passwords must match"})]}),L&&j.jsxs(ye,{alignSelf:"center",alignItems:"center",gap:"1",children:[j.jsx(Q1,{size:"md"}),j.jsx(Te,{variant:"small",color:"text100",children:"Looking for wallet address..."})]}),s.length>0&&j.jsx(oGe,{possibleWallets:s,handleSelectWallet:x=>M(x)}),m&&j.jsxs(ye,{flexDirection:"column",gap:"1",children:[j.jsx(Te,{variant:"normal",color:"text100",children:"Enter wallet address manually"}),j.jsx(Sn,{name:"wallet",labelLocation:"top",value:n,onChange:x=>M(x.target.value)})]}),I&&j.jsxs(ye,{alignSelf:"center",alignItems:"center",gap:"1",children:[j.jsx(Q1,{size:"md"}),j.jsx(Te,{variant:"small",color:"text100",children:"Checking wallet address..."})]}),(P||!v())&&j.jsx(j.Fragment,{children:P?j.jsx(Te,{variant:"small",color:"negative",children:"No wallet match found. Try again in 10 min or enter a wallet address manually."}):j.jsx(Te,{variant:"small",color:"negative",children:"Invalid wallet address"})}),j.jsxs(ye,{flexDirection:"row",children:[!m&&j.jsx(Vt,{label:"Enter wallet address manually",size:"md",shape:"square",onClick:()=>S(!0)}),j.jsx(Vt,{variant:"primary",size:"md",shape:"square",label:"Recover wallet",marginLeft:"auto",disabled:!a||!lg(n)||!l||l.length<8||l!==u||ie===!1,onClick:()=>{K()}})]})]}),E&&j.jsx(oa,{onClose:()=>A(!1),children:j.jsx(hte,{})})]})}const cGe=()=>{const t=fr(oi),e=Wr(t.accountAddress);return j.jsxs(C5e,{basename:"/",children:[j.jsxs(g5e,{children:[j.jsx(G6,{path:"/",element:e?j.jsx(Z9,{replace:!0,to:"/wallet"}):j.jsx(w_e,{})}),j.jsx(G6,{path:"recovery",element:e?j.jsx(Z9,{replace:!0,to:"/wallet"}):j.jsx(aGe,{})}),j.jsx(G6,{path:"wallet",element:e?j.jsx(rGe,{}):j.jsx(Z9,{replace:!0,to:"/"})})]}),j.jsx(v_e,{})]})},lGe=S6e();Y_.createRoot(document.getElementById("root")).render(j.jsx(qt.StrictMode,{children:j.jsx(_6e,{store:lGe,children:j.jsx(Pwe,{theme:"dark",children:j.jsx(D3e,{children:j.jsx(cGe,{})})})})}));export{_Pe as _}; diff --git a/assets/index-CtcyC_mc.js b/assets/index-D_ntFxfn.js similarity index 99% rename from assets/index-CtcyC_mc.js rename to assets/index-D_ntFxfn.js index b54a7a1..4c382a9 100644 --- a/assets/index-CtcyC_mc.js +++ b/assets/index-D_ntFxfn.js @@ -1,4 +1,4 @@ -import{T as xt,M as re,R as N,E as k,C as x,a as X,b as Wo,O as Z,c as ht}from"./index-DBvK_T1-.js";import"./index-Btp85TCW.js";/** +import{T as xt,M as re,R as N,E as k,C as x,a as X,b as Wo,O as Z,c as ht}from"./index-BTRILIvE.js";import"./index-BjDBzBW_.js";/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause diff --git a/index.html b/index.html index 598a7f0..a9f3ceb 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Sequence Recovery Wallet - +