@dodoex/wallet-web3 0.0.29-5 → 0.0.29-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/__node-resolve_empty-1bb86108.js +1 -0
  2. package/dist/__tslib-6f859a10.js +1 -0
  3. package/dist/_commonjs-dynamic-modules-7cfc9805.js +1 -0
  4. package/dist/blocto-6fdd2522.js +7 -0
  5. package/dist/bn-3c1372bb.js +1 -0
  6. package/dist/browser-ponyfill-e86d50ae.js +1 -0
  7. package/dist/cjs/__node-resolve_empty-b9b68f61.cjs +1 -0
  8. package/dist/cjs/__tslib-5e95569a.cjs +1 -0
  9. package/dist/cjs/_commonjs-dynamic-modules-f09a98c7.cjs +1 -0
  10. package/dist/cjs/blocto-a9a7429a.cjs +7 -0
  11. package/dist/cjs/bn-f79633bb.cjs +1 -0
  12. package/dist/cjs/browser-ponyfill-262b9a1d.cjs +1 -0
  13. package/dist/cjs/ethers-2e33277b.cjs +1 -0
  14. package/dist/cjs/hash-282034e6.cjs +1 -0
  15. package/dist/cjs/id-ce261f66.cjs +1 -0
  16. package/dist/cjs/index-040d72a4.cjs +1 -0
  17. package/dist/cjs/index-269c7834.cjs +1 -0
  18. package/dist/cjs/index-46767b56.cjs +9 -0
  19. package/dist/cjs/index-6286567d.cjs +66 -0
  20. package/dist/cjs/index-70269942.cjs +1 -0
  21. package/dist/cjs/index-839d2b51.cjs +1 -0
  22. package/dist/cjs/index-8bbd780e.cjs +1 -0
  23. package/dist/cjs/index-92dad595.cjs +1 -0
  24. package/dist/cjs/index-a7b876c9.cjs +1 -0
  25. package/dist/cjs/index-b300045d.cjs +15 -0
  26. package/dist/cjs/index-b7400738.cjs +1 -0
  27. package/dist/cjs/index-c59c8727.cjs +72 -0
  28. package/dist/cjs/index-cf3bf3b5.cjs +3 -0
  29. package/dist/cjs/index-d72d2161.cjs +6 -0
  30. package/dist/cjs/index-de2a5091.cjs +1 -0
  31. package/dist/cjs/index.cjs +1 -1
  32. package/dist/cjs/index.es-eeb7e818.cjs +9 -0
  33. package/dist/cjs/inherits_browser-f88a000a.cjs +1 -0
  34. package/dist/cjs/interface-770bfae7.cjs +1 -0
  35. package/dist/cjs/portis-b2b50bfb.cjs +24 -0
  36. package/dist/cjs/provider-b83497b2.cjs +1 -0
  37. package/dist/cjs/rainbow-10b0c861.cjs +1 -0
  38. package/dist/cjs/typed-data-63d8e9ee.cjs +1 -0
  39. package/dist/cjs/uAuth-b8c6a947.cjs +1 -0
  40. package/dist/cjs/walletConnect-be645a80.cjs +1 -0
  41. package/dist/cjs/walletLink-3f05b2ee.cjs +1 -0
  42. package/dist/ethers-e9ea7b62.js +1 -0
  43. package/dist/hash-a9ebd52a.js +1 -0
  44. package/dist/id-4394eafb.js +1 -0
  45. package/dist/index-3e230de4.js +1 -0
  46. package/dist/index-4f115893.js +1 -0
  47. package/dist/index-5a901c0e.js +2 -0
  48. package/dist/index-5ef7c2c6.js +6 -0
  49. package/dist/index-6be6f872.js +1 -0
  50. package/dist/index-71412a35.js +1 -0
  51. package/dist/index-71e104e3.js +1 -0
  52. package/dist/index-853c105c.js +15 -0
  53. package/dist/index-9cb93da4.js +1 -0
  54. package/dist/index-9e75afb9.js +1 -0
  55. package/dist/index-aa70a2b2.js +66 -0
  56. package/dist/index-b12d1c2b.js +1 -0
  57. package/dist/index-bef3992a.js +9 -0
  58. package/dist/index-f4e58da8.js +72 -0
  59. package/dist/index-faabf409.js +1 -0
  60. package/dist/index.es-c2f702fd.js +9 -0
  61. package/dist/index.js +1 -1
  62. package/dist/inherits_browser-06ba108b.js +1 -0
  63. package/dist/interface-e24b9dc3.js +1 -0
  64. package/dist/portis-7a5843d0.js +24 -0
  65. package/dist/provider-3276289c.js +1 -0
  66. package/dist/rainbow-028e417a.js +1 -0
  67. package/dist/typed-data-4ee2951a.js +1 -0
  68. package/dist/uAuth-1775a01d.js +1 -0
  69. package/dist/walletConnect-4d5928fe.js +1 -0
  70. package/dist/walletLink-4295f7ca.js +1 -0
  71. package/package.json +1 -1
  72. package/dist/blocto-ec220500.js +0 -1
  73. package/dist/cjs/blocto-06e9f41b.cjs +0 -1
  74. package/dist/cjs/index-10e8c244.cjs +0 -1
  75. package/dist/cjs/index-65ef3d76.cjs +0 -1
  76. package/dist/cjs/index-6f1e3af6.cjs +0 -1
  77. package/dist/cjs/index-8983bb88.cjs +0 -1
  78. package/dist/cjs/index-ae695e20.cjs +0 -1
  79. package/dist/cjs/index-ba62c069.cjs +0 -1
  80. package/dist/cjs/index-c149be38.cjs +0 -1
  81. package/dist/cjs/portis-2054bb58.cjs +0 -1
  82. package/dist/cjs/provider-037fd0ed.cjs +0 -1
  83. package/dist/cjs/rainbow-2ad12dd2.cjs +0 -1
  84. package/dist/cjs/uAuth-7e65d2cc.cjs +0 -1
  85. package/dist/cjs/walletConnect-ade9514f.cjs +0 -1
  86. package/dist/cjs/walletLink-b6336fc1.cjs +0 -1
  87. package/dist/index-17319257.js +0 -1
  88. package/dist/index-27e5c5a9.js +0 -1
  89. package/dist/index-2806301c.js +0 -1
  90. package/dist/index-3ea85737.js +0 -1
  91. package/dist/index-890a1073.js +0 -1
  92. package/dist/index-9149aa90.js +0 -1
  93. package/dist/index-ea777add.js +0 -1
  94. package/dist/portis-8eca7dbf.js +0 -1
  95. package/dist/provider-a0690f64.js +0 -1
  96. package/dist/rainbow-9004d140.js +0 -1
  97. package/dist/uAuth-c2aa6d14.js +0 -1
  98. package/dist/walletConnect-3f4192dd.js +0 -1
  99. package/dist/walletLink-b8912567.js +0 -1
@@ -0,0 +1 @@
1
+ import{arrayify as e,isBytesLike as t,hexlify as r}from"@ethersproject/bytes";import{shallowCopy as o}from"@ethersproject/properties";import{L as n,t as s,a as i}from"./id-4394eafb.js";function l(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e(r)}function c(t){t=e(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var a=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function l(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};function u(t,r){return a(this,void 0,void 0,(function*(){null==r&&(r={});const o={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(o.mode="cors",o.cache="no-cache",o.credentials="same-origin",o.redirect="follow",o.referrer="client"),null!=r.fetchOptions){const e=r.fetchOptions;e.mode&&(o.mode=e.mode),e.cache&&(o.cache=e.cache),e.credentials&&(o.credentials=e.credentials),e.redirect&&(o.redirect=e.redirect),e.referrer&&(o.referrer=e.referrer)}const n=yield fetch(t,o),s=yield n.arrayBuffer(),i={};return n.headers.forEach?n.headers.forEach(((e,t)=>{i[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{i[e.toLowerCase()]=n.headers.get(e)})),{headers:i,statusCode:n.status,statusMessage:n.statusText,body:e(new Uint8Array(s))}}))}var h=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function l(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};const d=new n("web/5.7.1");function f(e){return new Promise((t=>{setTimeout(t,e)}))}function p(e,o){if(null==e)return null;if("string"==typeof e)return e;if(t(e)){if(o&&("text"===o.split("/")[0]||"application/json"===o.split(";")[0].trim()))try{return i(e)}catch(e){}return r(e)}return e}function y(e,t,r){const i="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;d.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const a="object"==typeof e?e.throttleCallback:null,y="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;d.assertArgument(y>0&&y%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",y);const m="object"==typeof e&&!!e.errorPassThrough,E={};let b=null;const g={method:"GET"};let w=!1,R=12e4;if("string"==typeof e)b=e;else if("object"==typeof e){if(null!=e&&null!=e.url||d.throwArgumentError("missing URL","connection.url",e),b=e.url,"number"==typeof e.timeout&&e.timeout>0&&(R=e.timeout),e.headers)for(const t in e.headers)E[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(w=!0);if(g.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==b.substring(0,6)&&!0!==e.allowInsecureAuthentication&&d.throwError("basic authentication requires a secure https url",n.errors.INVALID_ARGUMENT,{argument:"url",url:b,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;E.authorization={key:"Authorization",value:"Basic "+c(s(t))}}null!=e.skipFetchSetup&&(g.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(g.fetchOptions=o(e.fetchOptions))}const v=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),C=b?b.match(v):null;if(C)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":C[1]||"text/plain"},body:C[2]?l(C[3]):(S=C[3],s(S.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){d.throwError("processing response error",n.errors.SERVER_ERROR,{body:p(C[1],C[2]),error:e,requestBody:null,requestMethod:"GET",url:b})}var S;t&&(g.method="POST",g.body=t,null==E["content-type"]&&(E["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==E["content-length"]&&(E["content-length"]={key:"Content-Length",value:String(t.length)}));const O={};Object.keys(E).forEach((e=>{const t=E[e];O[t.key]=t.value})),g.headers=O;const T=function(){let e=null;return{promise:new Promise((function(t,r){R&&(e=setTimeout((()=>{null!=e&&(e=null,r(d.makeError("timeout",n.errors.TIMEOUT,{requestBody:p(g.body,O["content-type"]),requestMethod:g.method,timeout:R,url:b})))}),R))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),k=function(){return h(this,void 0,void 0,(function*(){for(let e=0;e<i;e++){let t=null;try{if(t=yield u(b,g),e<i)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===g.method&&e.match(/^https:/)){b=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(a&&(r=yield a(e,b)),r){let r=0;const o=t.headers["retry-after"];r="string"==typeof o&&o.match(/^[1-9][0-9]*$/)?1e3*parseInt(o):y*parseInt(String(Math.random()*Math.pow(2,e))),yield f(r);continue}}}catch(e){t=e.response,null==t&&(T.cancel(),d.throwError("missing response",n.errors.SERVER_ERROR,{requestBody:p(g.body,O["content-type"]),requestMethod:g.method,serverError:e,url:b}))}let o=t.body;if(w&&304===t.statusCode?o=null:!m&&(t.statusCode<200||t.statusCode>=300)&&(T.cancel(),d.throwError("bad response",n.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:p(o,t.headers?t.headers["content-type"]:null),requestBody:p(g.body,O["content-type"]),requestMethod:g.method,url:b})),r)try{const e=yield r(o,t);return T.cancel(),e}catch(r){if(r.throttleRetry&&e<i){let t=!0;if(a&&(t=yield a(e,b)),t){const t=y*parseInt(String(Math.random()*Math.pow(2,e)));yield f(t);continue}}T.cancel(),d.throwError("processing response error",n.errors.SERVER_ERROR,{body:p(o,t.headers?t.headers["content-type"]:null),error:r,requestBody:p(g.body,O["content-type"]),requestMethod:g.method,url:b})}return T.cancel(),o}return d.throwError("failed response",n.errors.SERVER_ERROR,{requestBody:p(g.body,O["content-type"]),requestMethod:g.method,url:b})}))}();return Promise.race([T.promise,k])}function m(e,t,r){let l=null;if(null!=t){l=s(t);const r="string"==typeof e?{url:e}:o(e);if(r.headers){0!==Object.keys(r.headers).filter((e=>"content-type"===e.toLowerCase())).length||(r.headers=o(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return y(e,l,((e,t)=>{let o=null;if(null!=e)try{o=JSON.parse(i(e))}catch(t){d.throwError("invalid JSON",n.errors.SERVER_ERROR,{body:e,error:t})}return r&&(o=r(o,t)),o}))}function E(e,t){return t||(t={}),null==(t=o(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,o){let n=null,s=!1;const i=()=>!s&&(s=!0,n&&clearTimeout(n),!0);t.timeout&&(n=setTimeout((()=>{i()&&o(new Error("timeout"))}),t.timeout));const l=t.retryLimit;let c=0;!function n(){return e().then((function(e){if(void 0!==e)i()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",n);else if(t.onceBlock)t.onceBlock.once("block",n);else if(!s){if(c++,c>l)return void(i()&&o(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(n,e)}return null}),(function(e){i()&&o(e)}))}()}))}var b=Object.freeze({__proto__:null,_fetchData:y,fetchJson:m,poll:E});export{y as _,l as d,c as e,m as f,b as l,E as p};
@@ -0,0 +1 @@
1
+ const e=Symbol(),t=Object.getPrototypeOf,s=new WeakMap,o=o=>(e=>e&&(s.has(e)?s.get(e):t(e)===Object.prototype||t(e)===Array.prototype))(o)&&o[e]||null,n=(e,t=!0)=>{s.set(e,t)},a=e=>"object"==typeof e&&null!==e,r=new WeakMap,i=new WeakSet,[l]=((e=Object.is,t=((e,t)=>new Proxy(e,t)),s=(e=>a(e)&&!i.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)),l=(e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}}),c=new WeakMap,d=((e,t,s=l)=>{const o=c.get(e);if((null==o?void 0:o[0])===t)return o[1];const a=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return n(a,!0),c.set(e,[t,a]),Reflect.ownKeys(e).forEach((t=>{if(Object.getOwnPropertyDescriptor(a,t))return;const o=Reflect.get(e,t),l={value:o,enumerable:!0,configurable:!0};if(i.has(o))n(o,!1);else if(o instanceof Promise)delete l.value,l.get=()=>s(o);else if(r.has(o)){const[e,t]=r.get(o);l.value=d(e,t(),s)}Object.defineProperty(a,t,l)})),Object.preventExtensions(a)}),p=new WeakMap,u=[1,1],m=(n=>{if(!a(n))throw new Error("object required");const l=p.get(n);if(l)return l;let c=u[0];const g=new Set,h=(e,t=++u[0])=>{c!==t&&(c=t,g.forEach((s=>s(e,t))))};let f=u[1];const b=e=>(t,s)=>{const o=[...t];o[1]=[e,...o[1]],h(o,s)},v=new Map,y=e=>{var t;const s=v.get(e);s&&(v.delete(e),null==(t=s[1])||t.call(s))},w=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),I=t(w,{deleteProperty(e,t){const s=Reflect.get(e,t);y(t);const o=Reflect.deleteProperty(e,t);return o&&h(["delete",[t],s]),o},set(t,n,l,c){const d=Reflect.has(t,n),u=Reflect.get(t,n,c);if(d&&(e(u,l)||p.has(l)&&e(u,p.get(l))))return!0;y(n),a(l)&&(l=o(l)||l);let f=l;if(l instanceof Promise)l.then((e=>{l.status="fulfilled",l.value=e,h(["resolve",[n],e])})).catch((e=>{l.status="rejected",l.reason=e,h(["reject",[n],e])}));else{!r.has(l)&&s(l)&&(f=m(l));const e=!i.has(f)&&r.get(f);e&&((e,t)=>{if("production"!==(import.meta.env?import.meta.env.MODE:void 0)&&v.has(e))throw new Error("prop listener already exists");if(g.size){const s=t[3](b(e));v.set(e,[t,s])}else v.set(e,[t])})(n,e)}return Reflect.set(t,n,f,c),h(["set",[n],l,u]),!0}});p.set(n,I);const O=[w,(e=++u[1])=>(f===e||g.size||(f=e,v.forEach((([t])=>{const s=t[1](e);s>c&&(c=s)}))),c),d,e=>{g.add(e),1===g.size&&v.forEach((([e,t],s)=>{if("production"!==(import.meta.env?import.meta.env.MODE:void 0)&&t)throw new Error("remove already exists");const o=e[3](b(s));v.set(s,[e,o])}));return()=>{g.delete(e),0===g.size&&v.forEach((([e,t],s)=>{t&&(t(),v.set(s,[e]))}))}}];return r.set(I,O),Reflect.ownKeys(n).forEach((e=>{const t=Object.getOwnPropertyDescriptor(n,e);"value"in t&&(I[e]=n[e],delete t.value,delete t.writable),Object.defineProperty(w,e,t)})),I}))=>[m,r,i,e,t,s,l,c,d,p,u])();function c(e={}){return l(e)}function d(e,t,s){const o=r.get(e);let n;"production"===(import.meta.env?import.meta.env.MODE:void 0)||o||console.warn("Please use proxy object");const a=[],i=o[3];let l=!1;const c=i((e=>{a.push(e),s?t(a.splice(0)):n||(n=Promise.resolve().then((()=>{n=void 0,l&&t(a.splice(0))})))}));return l=!0,()=>{l=!1,c()}}const p=c({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),u={state:p,subscribe:e=>d(p,(()=>e(p))),push(e,t){e!==p.view&&(p.view=e,t&&(p.data=t),p.history.push(e))},reset(e){p.view=e,p.history=[e]},replace(e){p.history.length>1&&(p.history[p.history.length-1]=e,p.view=e)},goBack(){if(p.history.length>1){p.history.pop();const[e]=p.history.slice(-1);p.view=e}},setData(e){p.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile:()=>typeof window<"u"&&Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)),isAndroid:()=>m.isMobile()&&navigator.userAgent.toLowerCase().includes("android"),isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),isArray:e=>Array.isArray(e)&&e.length>0,formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let o=e;o.includes("://")||(o=e.replaceAll("/","").replaceAll(":",""),o=`${o}://`),o.endsWith("/")||(o=`${o}/`),this.setWalletConnectDeepLink(o,s);return`${o}wc?uri=${encodeURIComponent(t)}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let o=e;o.endsWith("/")||(o=`${o}/`),this.setWalletConnectDeepLink(o,s);return`${o}wc?uri=${encodeURIComponent(t)}`},wait:async e=>new Promise((t=>{setTimeout(t,e)})),openHref(e,t){window.open(e,t,"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.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=null==(e=u.state.data)?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},g=c({enabled:typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),userSessionId:"",events:[],connectedWalletId:void 0}),h={state:g,subscribe:e=>d(g.events,(()=>e(function(e,t){const s=r.get(e);"production"===(import.meta.env?import.meta.env.MODE:void 0)||s||console.warn("Please use proxy object");const[o,n,a]=s;return a(o,n(),t)}(g.events[g.events.length-1])))),initialize(){g.enabled&&typeof(null==crypto?void 0:crypto.randomUUID)<"u"&&(g.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){g.connectedWalletId=e},click(e){if(g.enabled){const t={type:"CLICK",name:e.name,userSessionId:g.userSessionId,timestamp:Date.now(),data:e};g.events.push(t)}},track(e){if(g.enabled){const t={type:"TRACK",name:e.name,userSessionId:g.userSessionId,timestamp:Date.now(),data:e};g.events.push(t)}},view(e){if(g.enabled){const t={type:"VIEW",name:e.name,userSessionId:g.userSessionId,timestamp:Date.now(),data:e};g.events.push(t)}}},f=c({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:f,subscribe:e=>d(f,(()=>e(f))),setChains(e){f.chains=e},setWalletConnectUri(e){f.walletConnectUri=e},setIsCustomDesktop(e){f.isCustomDesktop=e},setIsCustomMobile(e){f.isCustomMobile=e},setIsDataLoaded(e){f.isDataLoaded=e},setIsUiLoaded(e){f.isUiLoaded=e},setIsAuth(e){f.isAuth=e}},v=c({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}),y={state:v,subscribe:e=>d(v,(()=>e(v))),setConfig(e){var t,s;h.initialize(),b.setChains(e.chains),b.setIsAuth(Boolean(e.enableAuthMode)),b.setIsCustomMobile(Boolean(null==(t=e.mobileWallets)?void 0:t.length)),b.setIsCustomDesktop(Boolean(null==(s=e.desktopWallets)?void 0:s.length)),m.setModalVersionInStorage(),Object.assign(v,e)}};var w=Object.defineProperty,I=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,W=(e,t,s)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;const E="https://explorer-api.walletconnect.com",L="wcm",j="js-2.6.2";async function A(e,t){const s=((e,t)=>{for(var s in t||(t={}))O.call(t,s)&&W(e,s,t[s]);if(I)for(var s of I(t))C.call(t,s)&&W(e,s,t[s]);return e})({sdkType:L,sdkVersion:j},t),o=new URL(e,E);return o.searchParams.append("projectId",y.state.projectId),Object.entries(s).forEach((([e,t])=>{t&&o.searchParams.append(e,String(t))})),(await fetch(o)).json()}const M={getDesktopListings:async e=>A("/w3m/v1/getDesktopListings",e),getMobileListings:async e=>A("/w3m/v1/getMobileListings",e),getInjectedListings:async e=>A("/w3m/v1/getInjectedListings",e),getAllListings:async e=>A("/w3m/v1/getAllListings",e),getWalletImageUrl:e=>`${E}/w3m/v1/getWalletImage/${e}?projectId=${y.state.projectId}&sdkType=${L}&sdkVersion=${j}`,getAssetImageUrl:e=>`${E}/w3m/v1/getAssetImage/${e}?projectId=${y.state.projectId}&sdkType=${L}&sdkVersion=${j}`};var D=Object.defineProperty,U=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,S=(e,t,s)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;const N=m.isMobile(),x=c({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),T={state:x,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=y.state;if("NONE"===e||"ALL"===t&&!e)return x.recomendedWallets;if(m.isArray(e)){const t={recommendedIds:e.join(",")},{listings:s}=await M.getAllListings(t),o=Object.values(s);o.sort(((t,s)=>e.indexOf(t.id)-e.indexOf(s.id))),x.recomendedWallets=o}else{const{chains:e,isAuth:s}=b.state,o=e?.join(","),n=m.isArray(t),a={page:1,sdks:s?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:o,version:2,excludedIds:n?t.join(","):void 0},{listings:r}=N?await M.getMobileListings(a):await M.getDesktopListings(a);x.recomendedWallets=Object.values(r)}return x.recomendedWallets},async getWallets(e){const t=((e,t)=>{for(var s in t||(t={}))k.call(t,s)&&S(e,s,t[s]);if(U)for(var s of U(t))P.call(t,s)&&S(e,s,t[s]);return e})({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:o}=y.state,{recomendedWallets:n}=x;if("ALL"===o)return x.wallets;n.length?t.excludedIds=n.map((e=>e.id)).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(o)&&(t.excludedIds=[t.excludedIds,o].filter(Boolean).join(",")),b.state.isAuth&&(t.sdks="auth_v1");const{page:a,search:r}=e,{listings:i,total:l}=N?await M.getMobileListings(t):await M.getDesktopListings(t),c=Object.values(i),d=r?"search":"wallets";return x[d]={listings:[...x[d].listings,...c],total:l,page:a??1},{listings:c,total:l}},getWalletImageUrl:e=>M.getWalletImageUrl(e),getAssetImageUrl:e=>M.getAssetImageUrl(e),resetSearch(){x.search={listings:[],total:0,page:1}}},R=c({open:!1}),_={state:R,subscribe:e=>d(R,(()=>e(R))),open:async e=>new Promise((t=>{const{isUiLoaded:s,isDataLoaded:o}=b.state;if(m.removeWalletConnectDeepLink(),b.setWalletConnectUri(e?.uri),b.setChains(e?.chains),u.reset("ConnectWallet"),s&&o)R.open=!0,t();else{const e=setInterval((()=>{const s=b.state;s.isUiLoaded&&s.isDataLoaded&&(clearInterval(e),R.open=!0,t())}),200)}})),close(){R.open=!1}};var $=Object.defineProperty,V=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,K=(e,t,s)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;const z=c({themeMode:typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}),J={state:z,subscribe:e=>d(z,(()=>e(z))),setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(z.themeMode=t),s&&(z.themeVariables=((e,t)=>{for(var s in t||(t={}))B.call(t,s)&&K(e,s,t[s]);if(V)for(var s of V(t))H.call(t,s)&&K(e,s,t[s]);return e})({},s))}},q=c({open:!1,message:"",variant:"success"}),F={state:q,subscribe:e=>d(q,(()=>e(q))),openToast(e,t){q.open=!0,q.message=e,q.variant=t},closeToast(){q.open=!1}};var G=Object.freeze({__proto__:null,WalletConnectModal:class{constructor(e){this.openModal=_.open,this.closeModal=_.close,this.subscribeModal=_.subscribe,this.setTheme=J.setThemeConfig,J.setThemeConfig(e),y.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await import("./index-aa70a2b2.js");const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),b.setIsUiLoaded(!0)}}}});export{h as R,u as T,m as a,G as i,J as n,F as o,b as p,_ as s,T as t,y};