@dodoex/wallet-web3 0.0.64-beta.0 → 0.0.65

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 (63) hide show
  1. package/dist/{alchemy-provider-5870b6fa-0e7efe86.js → alchemy-provider-5870b6fa-66fa57c4.js} +1 -1
  2. package/dist/{alchemy-websocket-provider-213da986-5879af4c.js → alchemy-websocket-provider-213da986-81f5908b.js} +1 -1
  3. package/dist/{blocto-83420bc5.js → blocto-a0fb786c.js} +1 -1
  4. package/dist/{ccip-7e4c2707.js → ccip-8057d290.js} +1 -1
  5. package/dist/cjs/{alchemy-provider-5870b6fa-95b06d16.cjs → alchemy-provider-5870b6fa-ae5f424d.cjs} +1 -1
  6. package/dist/cjs/{alchemy-websocket-provider-213da986-8eaf8ea7.cjs → alchemy-websocket-provider-213da986-d62eca48.cjs} +1 -1
  7. package/dist/cjs/{blocto-2858491c.cjs → blocto-0d2f6547.cjs} +1 -1
  8. package/dist/cjs/{ccip-5927284f.cjs → ccip-32d25bb9.cjs} +1 -1
  9. package/dist/cjs/{draggabilly-1fad510b.cjs → draggabilly-9a233d31.cjs} +1 -1
  10. package/dist/cjs/id-cd1c0250.cjs +1 -0
  11. package/dist/cjs/{index-0e39c749.cjs → index-0d072f8e.cjs} +1 -1
  12. package/dist/cjs/{index-bd43dd77.cjs → index-28ccfd4f.cjs} +1 -1
  13. package/dist/cjs/{index-50a7a341.cjs → index-42d4f376.cjs} +6 -6
  14. package/dist/cjs/{index-6cf7a63b.cjs → index-51df874d.cjs} +1 -1
  15. package/dist/cjs/{index-e10201eb.cjs → index-530ea415.cjs} +1 -1
  16. package/dist/cjs/{index-989b7922.cjs → index-702527b2.cjs} +2 -2
  17. package/dist/cjs/{index-a3b30593.cjs → index-99530e6c.cjs} +1 -1
  18. package/dist/cjs/{index-acec9b03.cjs → index-a6e52f1a.cjs} +2 -2
  19. package/dist/cjs/{index-66dce2f4.cjs → index-c17746ed.cjs} +1 -1
  20. package/dist/cjs/{index-6f5efd50.cjs → index-e6e26ad5.cjs} +1 -1
  21. package/dist/cjs/index.cjs +1 -1
  22. package/dist/cjs/{index.es-2d20f405.cjs → index.es-d4262962.cjs} +1 -1
  23. package/dist/cjs/{interface-06b19086.cjs → interface-e004907f.cjs} +1 -1
  24. package/dist/cjs/{lib-typedarrays-64f3b3e5.cjs → lib-typedarrays-dbe83bf4.cjs} +1 -1
  25. package/dist/cjs/{portis-c783997b.cjs → portis-9e401273.cjs} +1 -1
  26. package/dist/cjs/{provider-97ca127a.cjs → provider-7bfbbff3.cjs} +1 -1
  27. package/dist/cjs/{rainbow-1819d560.cjs → rainbow-6331cb27.cjs} +1 -1
  28. package/dist/cjs/{sha224-c96a6732.cjs → sha224-0d4d6fdd.cjs} +1 -1
  29. package/dist/cjs/{sha256-dd9409c0.cjs → sha256-3aa003e0.cjs} +1 -1
  30. package/dist/cjs/{typed-data-6a7b4ec2.cjs → typed-data-01967235.cjs} +1 -1
  31. package/dist/cjs/{uAuth-eefff9d2.cjs → uAuth-766da269.cjs} +1 -1
  32. package/dist/cjs/{walletConnect-77e90d8c.cjs → walletConnect-0c48b404.cjs} +1 -1
  33. package/dist/cjs/{walletLink-7b70596e.cjs → walletLink-99768078.cjs} +2 -2
  34. package/dist/{draggabilly-d039a840.js → draggabilly-042d2baf.js} +1 -1
  35. package/dist/id-06102aea.js +1 -0
  36. package/dist/{index-fd2c21c3.js → index-2461634e.js} +1 -1
  37. package/dist/{index-0ed5f418.js → index-553ce10b.js} +1 -1
  38. package/dist/{index-704fe442.js → index-75136e75.js} +1 -1
  39. package/dist/{index-80a332b5.js → index-7d9f2ac0.js} +6 -6
  40. package/dist/{index-b226f34c.js → index-7ed0e2da.js} +2 -2
  41. package/dist/{index-5d40b9a4.js → index-938018a1.js} +1 -1
  42. package/dist/{index-ca0b1f05.js → index-bd8e8702.js} +1 -1
  43. package/dist/{index-82f4e128.js → index-d9830b67.js} +1 -1
  44. package/dist/{index-1d412803.js → index-ea4428da.js} +2 -2
  45. package/dist/{index-0c778e7c.js → index-fa54ba53.js} +1 -1
  46. package/dist/{index.es-39ab5513.js → index.es-938556e7.js} +1 -1
  47. package/dist/index.js +1 -1
  48. package/dist/{interface-7f60ee74.js → interface-424d0728.js} +1 -1
  49. package/dist/lib-typedarrays-7ec5ace4.js +1 -0
  50. package/dist/{portis-c6245d09.js → portis-df3f2ecc.js} +1 -1
  51. package/dist/{provider-1bb74116.js → provider-c1f0eadb.js} +1 -1
  52. package/dist/rainbow-9dbf58c4.js +1 -0
  53. package/dist/{sha224-999e6ecf.js → sha224-f656013d.js} +1 -1
  54. package/dist/{sha256-6f23a4aa.js → sha256-1f582b12.js} +1 -1
  55. package/dist/{typed-data-8ec3e6de.js → typed-data-869afd88.js} +1 -1
  56. package/dist/{uAuth-4cce3aa7.js → uAuth-2faa4403.js} +1 -1
  57. package/dist/{walletConnect-9cdb4555.js → walletConnect-590ee7ef.js} +1 -1
  58. package/dist/{walletLink-e1a7df90.js → walletLink-af9b8335.js} +2 -2
  59. package/package.json +2 -3
  60. package/dist/cjs/id-d6c41f55.cjs +0 -1
  61. package/dist/id-e35700dd.js +0 -1
  62. package/dist/lib-typedarrays-83659fcd.js +0 -1
  63. package/dist/rainbow-99e95d46.js +0 -1
@@ -1,3 +1,3 @@
1
- "use strict";var e=require("./index-50a7a341.cjs"),t=require("events"),n=require("buffer");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@ethersproject/providers"),require("zustand"),require("@ethersproject/bytes"),require("@ethersproject/properties"),require("@ethersproject/address"),require("@ethersproject/abstract-signer"),require("@ethersproject/abstract-provider"),require("@ethersproject/contracts"),require("@ethersproject/constants"),require("@ethersproject/transactions");var i=r(t),s=r(n),a={},o={},c={};Object.defineProperty(c,"__esModule",{value:!0}),c.walletLogo=void 0;c.walletLogo=(e,t)=>{let n;switch(e){case"standard":default:return n=t,`data:image/svg+xml,%3Csvg width='${t}' height='${n}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return n=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${n}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return n=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return n=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return n=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return n=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`}};var l={},u={},d={};Object.defineProperty(d,"__esModule",{value:!0}),d.errorValues=d.standardErrorCodes=void 0,d.standardErrorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},d.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var h={},f={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=d,n="Unspecified error message.";function r(r,i=n){if(r&&Number.isInteger(r)){const n=r.toString();if(o(t.errorValues,n))return t.errorValues[n].message;if(s(r))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return i}function i(e){if(!Number.isInteger(e))return!1;const n=e.toString();return!!t.errorValues[n]||!!s(e)}function s(e){return e>=-32099&&e<=-32e3}function a(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return"object"==typeof e&&null!==e&&t in e&&"string"==typeof e[t]}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=r,e.isValidCode=i,e.getErrorCode=function(e){var t;return"number"==typeof e?e:function(e){return"object"==typeof e&&null!==e&&("number"==typeof e.code||"number"==typeof e.errorCode)}(e)?null!==(t=e.code)&&void 0!==t?t:e.errorCode:void 0},e.serialize=function(e,{shouldIncludeStack:s=!1}={}){const l={};if(e&&"object"==typeof e&&!Array.isArray(e)&&o(e,"code")&&i(e.code)){const t=e;l.code=t.code,t.message&&"string"==typeof t.message?(l.message=t.message,o(t,"data")&&(l.data=t.data)):(l.message=r(l.code),l.data={originalError:a(e)})}else l.code=t.standardErrorCodes.rpc.internal,l.message=c(e,"message")?e.message:n,l.data={originalError:a(e)};return s&&(l.stack=c(e,"stack")?e.stack:void 0),l}}(f),Object.defineProperty(h,"__esModule",{value:!0}),h.standardErrors=void 0;const p=d,_=f;function g(e,t){const[n,r]=b(t);return new y(e,n||(0,_.getMessageFromCode)(e),r)}function m(e,t){const[n,r]=b(t);return new w(e,n||(0,_.getMessageFromCode)(e),r)}function b(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}h.standardErrors={rpc:{parse:e=>g(p.standardErrorCodes.rpc.parse,e),invalidRequest:e=>g(p.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>g(p.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>g(p.standardErrorCodes.rpc.methodNotFound,e),internal:e=>g(p.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return g(t,e)},invalidInput:e=>g(p.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>g(p.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>g(p.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>g(p.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>g(p.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>g(p.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>m(p.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>m(p.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>m(p.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>m(p.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>m(p.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>m(p.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw new Error('"message" must be a nonempty string');return new w(t,n,r)}}};class y extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}}class w extends y{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=void 0;var t=d;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});var n=h;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return n.standardErrors}})}(u);var v={},E={};Object.defineProperty(E,"__esModule",{value:!0}),E.isErrorResponse=void 0,E.isErrorResponse=function(e){return void 0!==e.errorMessage};var S={};Object.defineProperty(S,"__esModule",{value:!0}),S.LIB_VERSION=void 0,S.LIB_VERSION="4.0.2",Object.defineProperty(v,"__esModule",{value:!0}),v.serializeError=void 0;const k=E,C=S,I=d,M=f;v.serializeError=function(e,t){const n=(0,M.serialize)(function(e){if("string"==typeof e)return{message:e,code:I.standardErrorCodes.rpc.internal};if((0,k.isErrorResponse)(e))return Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}});return e}(e),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");r.searchParams.set("version",C.LIB_VERSION),r.searchParams.set("code",n.code.toString());const i=function(e,t){const n=null==e?void 0:e.method;if(n)return n;if(void 0===t)return;if("string"==typeof t)return t;if(!Array.isArray(t))return t.method;if(t.length>0)return t[0].method;return}(n.data,t);return i&&r.searchParams.set("method",i),r.searchParams.set("message",n.message),Object.assign(Object.assign({},n),{docUrl:r.href})};var R={};function x(){return e=>e}Object.defineProperty(R,"__esModule",{value:!0}),R.RegExpString=R.IntNumber=R.BigIntString=R.AddressString=R.HexString=R.OpaqueType=void 0,R.OpaqueType=x,R.HexString=e=>e,R.AddressString=e=>e,R.BigIntString=e=>e,R.IntNumber=function(e){return Math.floor(e)},R.RegExpString=e=>e;var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.areAddressArraysEqual=L.getFavicon=L.range=L.isBigNumber=L.ensureParsedJSONObject=L.ensureBigInt=L.ensureRegExpString=L.ensureIntNumber=L.ensureBuffer=L.ensureAddressString=L.ensureEvenLengthHexString=L.ensureHexString=L.isHexString=L.prepend0x=L.strip0x=L.has0xPrefix=L.hexStringFromIntNumber=L.intNumberFromHexString=L.bigIntStringFromBigInt=L.hexStringFromBuffer=L.hexStringToUint8Array=L.uint8ArrayToHex=L.randomBytesHex=void 0;const A=u,P=R,j=/^[0-9]*$/,T=/^[a-f0-9]*$/;function N(e){return[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function O(e){return e.startsWith("0x")||e.startsWith("0X")}function D(e){return O(e)?e.slice(2):e}function U(e){return O(e)?`0x${e.slice(2)}`:`0x${e}`}function B(e){if("string"!=typeof e)return!1;const t=D(e).toLowerCase();return T.test(t)}function W(e,t=!1){if("string"==typeof e){const n=D(e).toLowerCase();if(T.test(n))return(0,P.HexString)(t?`0x${n}`:n)}throw A.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function q(e,t=!1){let n=W(e,!1);return n.length%2==1&&(n=(0,P.HexString)(`0${n}`)),t?(0,P.HexString)(`0x${n}`):n}function H(e){if("number"==typeof e&&Number.isInteger(e))return(0,P.IntNumber)(e);if("string"==typeof e){if(j.test(e))return(0,P.IntNumber)(Number(e));if(B(e))return(0,P.IntNumber)(Number(BigInt(q(e,!0))))}throw A.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}function F(e){if(null==e||"function"!=typeof e.constructor)return!1;const{constructor:t}=e;return"function"==typeof t.config&&"number"==typeof t.EUCLID}L.randomBytesHex=function(e){return N(crypto.getRandomValues(new Uint8Array(e)))},L.uint8ArrayToHex=N,L.hexStringToUint8Array=function(e){return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},L.hexStringFromBuffer=function(e,t=!1){const n=e.toString("hex");return(0,P.HexString)(t?`0x${n}`:n)},L.bigIntStringFromBigInt=function(e){return(0,P.BigIntString)(e.toString(10))},L.intNumberFromHexString=function(e){return(0,P.IntNumber)(Number(BigInt(q(e,!0))))},L.hexStringFromIntNumber=function(e){return(0,P.HexString)(`0x${BigInt(e).toString(16)}`)},L.has0xPrefix=O,L.strip0x=D,L.prepend0x=U,L.isHexString=B,L.ensureHexString=W,L.ensureEvenLengthHexString=q,L.ensureAddressString=function(e){if("string"==typeof e){const t=D(e).toLowerCase();if(B(t)&&40===t.length)return(0,P.AddressString)(U(t))}throw A.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)},L.ensureBuffer=function(e){if(Buffer.isBuffer(e))return e;if("string"==typeof e){if(B(e)){const t=q(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw A.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)},L.ensureIntNumber=H,L.ensureRegExpString=function(e){if(e instanceof RegExp)return(0,P.RegExpString)(e.toString());throw A.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)},L.ensureBigInt=function(e){if(null!==e&&("bigint"==typeof e||F(e)))return BigInt(e.toString(10));if("number"==typeof e)return BigInt(H(e));if("string"==typeof e){if(j.test(e))return BigInt(e);if(B(e))return BigInt(q(e,!0))}throw A.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)},L.ensureParsedJSONObject=function(e){if("string"==typeof e)return JSON.parse(e);if("object"==typeof e)return e;throw A.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)},L.isBigNumber=F,L.range=function(e,t){return Array.from({length:t-e},((t,n)=>e+n))},L.getFavicon=function(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:n}=document.location,r=e?e.getAttribute("href"):null;return!r||r.startsWith("javascript:")||r.startsWith("vbscript:")?null:r.startsWith("http://")||r.startsWith("https://")||r.startsWith("data:")?r:r.startsWith("//")?t+r:`${t}//${n}${r}`},L.areAddressArraysEqual=function(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))};var z={},V={},K={},Z={};Object.defineProperty(Z,"__esModule",{value:!0}),Z.decryptContent=Z.encryptContent=Z.importKeyFromHexString=Z.exportKeyToHexString=Z.decrypt=Z.encrypt=Z.deriveSharedSecret=Z.generateKeyPair=void 0;const G=L;async function $(e,t){const n=crypto.getRandomValues(new Uint8Array(12));return{iv:n,cipherText:await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,(new TextEncoder).encode(t))}}async function Y(e,{iv:t,cipherText:n}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return(new TextDecoder).decode(r)}function J(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}Z.generateKeyPair=async function(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])},Z.deriveSharedSecret=async function(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])},Z.encrypt=$,Z.decrypt=Y,Z.exportKeyToHexString=async function(e,t){const n=J(e),r=await crypto.subtle.exportKey(n,t);return(0,G.uint8ArrayToHex)(new Uint8Array(r))},Z.importKeyFromHexString=async function(e,t){const n=J(e),r=(0,G.hexStringToUint8Array)(t).buffer;return await crypto.subtle.importKey(n,r,{name:"ECDH",namedCurve:"P-256"},!0,"private"===e?["deriveKey"]:[])},Z.encryptContent=async function(e,t){const n=JSON.stringify(e,((e,t)=>{if(!(t instanceof Error))return t;const n=t;return Object.assign(Object.assign({},n.code?{code:n.code}:{}),{message:n.message})}));return $(t,n)},Z.decryptContent=async function(e,t){return JSON.parse(await Y(t,e))};var Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.ScopedLocalStorage=void 0;class X{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);"string"==typeof r&&r.startsWith(e)&&t.push(r)}t.forEach((e=>localStorage.removeItem(e)))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new X("CBWSDK").clear(),new X("walletlink").clear()}}Q.ScopedLocalStorage=X,Object.defineProperty(K,"__esModule",{value:!0}),K.SCWKeyManager=void 0;const ee=Z,te=Q,ne={storageKey:"ownPrivateKey",keyType:"private"},re={storageKey:"ownPublicKey",keyType:"public"},ie={storageKey:"peerPublicKey",keyType:"public"};K.SCWKeyManager=class{constructor(){this.storage=new te.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(ie,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(re.storageKey),this.storage.removeItem(ne.storageKey),this.storage.removeItem(ie.storageKey)}async generateKeyPair(){const e=await(0,ee.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(ne,e.privateKey),await this.storeKey(re,e.publicKey)}async loadKeysIfNeeded(){if(null===this.ownPrivateKey&&(this.ownPrivateKey=await this.loadKey(ne)),null===this.ownPublicKey&&(this.ownPublicKey=await this.loadKey(re)),null!==this.ownPrivateKey&&null!==this.ownPublicKey||await this.generateKeyPair(),null===this.peerPublicKey&&(this.peerPublicKey=await this.loadKey(ie)),null===this.sharedSecret){if(null===this.ownPrivateKey||null===this.peerPublicKey)return;this.sharedSecret=await(0,ee.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const t=this.storage.getItem(e.storageKey);return t?(0,ee.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){const n=await(0,ee.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,n)}};var se={};Object.defineProperty(se,"__esModule",{value:!0}),se.SCWStateManager=void 0;const ae=Q,oe="accounts",ce="activeChain",le="availableChains",ue="walletCapabilities";se.SCWStateManager=class{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,n;this.storage=new ae.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(le),this._walletCapabilities=this.loadItemFromStorage(ue);const r=this.loadItemFromStorage(oe),i=this.loadItemFromStorage(ce);r&&this.updateListener.onAccountsUpdate({accounts:r,source:"storage"}),i&&this.updateListener.onChainUpdate({chain:i,source:"storage"}),this._accounts=r||[],this._activeChain=i||{id:null!==(n=null===(t=e.appChainIds)||void 0===t?void 0:t[0])&&void 0!==n?n:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(oe,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const n=null===(t=this.availableChains)||void 0===t?void 0:t.find((t=>t.id===e));return!!n&&(n===this._activeChain||(this._activeChain=n,this.storeItemToStorage(ce,n),this.updateListener.onChainUpdate({chain:n,source:"wallet"})),!0)}updateAvailableChains(e){if(!e||0===Object.keys(e).length)return;const t=Object.entries(e).map((([e,t])=>({id:Number(e),rpcUrl:t})));this.availableChains=t,this.storeItemToStorage(le,t),this.switchChain(this._activeChain.id)}updateWalletCapabilities(e){this._walletCapabilities=e,this.storeItemToStorage(ue,e)}storeItemToStorage(e,t){this.storage.setItem(e,JSON.stringify(t))}loadItemFromStorage(e){const t=this.storage.getItem(e);return t?JSON.parse(t):void 0}clear(){this.storage.clear()}},Object.defineProperty(V,"__esModule",{value:!0}),V.SCWSigner=void 0;const de=K,he=se,fe=u,pe=L,_e=Z;V.SCWSigner=class{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new de.SCWKeyManager,this.stateManager=new he.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:e.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const e=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),t=await this.communicator.postRequestAndWaitForResponse(e);if("failure"in t.content)throw t.content.failure;const n=await(0,_e.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(n);const r=await this.decryptResponseMessage(t);this.updateInternalState({method:"eth_requestAccounts"},r);const i=r.result;if("error"in i)throw i.error;return this.stateManager.accounts}async request(e){const t=this.tryLocalHandling(e);if(void 0!==t){if(t instanceof Error)throw t;return t}await this.communicator.waitForPopupLoaded();const n=await this.sendEncryptedRequest(e),r=await this.decryptResponseMessage(n);this.updateInternalState(e,r);const i=r.result;if("error"in i)throw i.error;return i.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;switch(e.method){case"wallet_switchEthereumChain":{const n=e.params;if(!n||!(null===(t=n[0])||void 0===t?void 0:t.chainId))throw fe.standardErrors.rpc.invalidParams();const r=(0,pe.ensureIntNumber)(n[0].chainId);return this.stateManager.switchChain(r)?null:void 0}case"wallet_getCapabilities":{const e=this.stateManager.walletCapabilities;if(!e)throw fe.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return e}default:return}}async sendEncryptedRequest(e){const t=await this.keyManager.getSharedSecret();if(!t)throw fe.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await(0,_e.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),r=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(r)}async createRequestMessage(e){const t=await(0,_e.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:t,content:e,timestamp:new Date}}async decryptResponseMessage(e){const t=e.content;if("failure"in t)throw t.failure;const n=await this.keyManager.getSharedSecret();if(!n)throw fe.standardErrors.provider.unauthorized("Invalid session");return(0,_e.decryptContent)(t.encrypted,n)}updateInternalState(e,t){var n,r;const i=null===(n=t.data)||void 0===n?void 0:n.chains;i&&this.stateManager.updateAvailableChains(i);const s=null===(r=t.data)||void 0===r?void 0:r.capabilities;s&&this.stateManager.updateWalletCapabilities(s);const a=t.result;if(!("error"in a))switch(e.method){case"eth_requestAccounts":{const e=a.value;this.stateManager.updateAccounts(e);break}case"wallet_switchEthereumChain":{if(null!==a.value)return;const t=e.params,n=(0,pe.ensureIntNumber)(t[0].chainId);this.stateManager.switchChain(n);break}}}};var ge,me,be={},ye={exports:{}},we=i.default.EventEmitter;function ve(){if(me)return ge;function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?t(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function r(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}me=1;var o=s.default.Buffer,c=e.require$$1.inspect,l=c&&c.custom||"inspect";return ge=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,s;return t=e,r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,r=a,o.prototype.copy.call(t,n,r),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,s=e>i.length?i.length:e;if(s===i.length?r+=i:r+=i.slice(0,e),0==(e-=s)){s===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(s));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(s));break}++r}return this.length-=r,t}},{key:l,value:function(e,t){return c(this,n(n({},t),{},{depth:0,customInspect:!1}))}}],r&&i(t.prototype,r),s&&i(t,s),Object.defineProperty(t,"prototype",{writable:!1}),e}(),ge}function Ee(e,t){ke(e,t),Se(e)}function Se(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function ke(e,t){e.emit("error",t)}var Ce={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(ke,this,e)):process.nextTick(ke,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?process.nextTick(Se,n):(n._writableState.errorEmitted=!0,process.nextTick(Ee,n,e)):process.nextTick(Ee,n,e):t?(process.nextTick(Se,n),t(e)):process.nextTick(Se,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},Ie={};var Me={};function Re(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i))||this}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,Me[e]=r}function xe(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}Re("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),Re("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i,s,a;if("string"==typeof t&&(i="not ",t.substr(!s||s<0?0:+s,i.length)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))a="The ".concat(e," ").concat(r," ").concat(xe(t,"type"));else{var o=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(o," ").concat(r," ").concat(xe(t,"type"))}return a+=". Received type ".concat(typeof n)}),TypeError),Re("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Re("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),Re("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Re("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),Re("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Re("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Re("ERR_STREAM_WRITE_AFTER_END","write after end"),Re("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Re("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),Re("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Ie.codes=Me;var Le=Ie.codes.ERR_INVALID_OPT_VALUE;var Ae,Pe,je,Te,Ne,Oe,De={getHighWaterMark:function(e,t,n,r){var i=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new Le(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}};function Ue(){if(Pe)return Ae;function t(t){try{if(!e.commonjsGlobal.localStorage)return!1}catch(e){return!1}var n=e.commonjsGlobal.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}return Pe=1,Ae=function(e,n){if(t("noDeprecation"))return e;var r=!1;return function(){if(!r){if(t("throwDeprecation"))throw new Error(n);t("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return e.apply(this,arguments)}},Ae}function Be(){if(Te)return je;function t(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var n;Te=1,je=S,S.WritableState=E;var r={deprecate:Ue()},i=we,a=s.default.Buffer,o=(void 0!==e.commonjsGlobal?e.commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,l=Ce,u=De.getHighWaterMark,d=Ie.codes,h=d.ERR_INVALID_ARG_TYPE,f=d.ERR_METHOD_NOT_IMPLEMENTED,p=d.ERR_MULTIPLE_CALLBACK,_=d.ERR_STREAM_CANNOT_PIPE,g=d.ERR_STREAM_DESTROYED,m=d.ERR_STREAM_NULL_VALUES,b=d.ERR_STREAM_WRITE_AFTER_END,y=d.ERR_UNKNOWN_ENCODING,w=l.errorOrDestroy;function v(){}function E(e,r,i){n=n||We(),e=e||{},"boolean"!=typeof i&&(i=r instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=u(this,e,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new p;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(process.nextTick(i,r),process.nextTick(x,e,t),e._writableState.errorEmitted=!0,w(e,r)):(i(r),e._writableState.errorEmitted=!0,w(e,r),x(e,t))}(e,n,r,t,i);else{var s=M(n)||e.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||I(e,n),r?process.nextTick(C,e,n,s,i):C(e,n,s,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function S(e){var t=this instanceof(n=n||We());if(!t&&!c.call(S,this))return new S(e);this._writableState=new E(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function k(e,t,n,r,i,s,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new g("write")):n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function C(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),x(e,t)}function I(e,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(e._writev&&r&&r.next){var i=n.bufferedRequestCount,s=new Array(i),a=n.corkedRequestsFree;a.entry=r;for(var o=0,c=!0;r;)s[o]=r,r.isBuf||(c=!1),r=r.next,o+=1;s.allBuffers=c,k(e,n,!0,n.length,s,"",a.finish),n.pendingcb++,n.lastBufferedRequest=null,a.next?(n.corkedRequestsFree=a.next,a.next=null):n.corkedRequestsFree=new t(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,d=r.callback;if(k(e,n,!1,n.objectMode?1:l.length,l,u,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function M(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function R(e,t){e._final((function(n){t.pendingcb--,n&&w(e,n),t.prefinished=!0,e.emit("prefinish"),x(e,t)}))}function x(e,t){var n=M(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(R,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return e.inherits_browser.exports(S,i),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(e){return!!c.call(this,e)||this===S&&(e&&e._writableState instanceof E)}})):c=function(e){return e instanceof this},S.prototype.pipe=function(){w(this,new _)},S.prototype.write=function(e,t,n){var r,i=this._writableState,s=!1,c=!i.objectMode&&(r=e,a.isBuffer(r)||r instanceof o);return c&&!a.isBuffer(e)&&(e=function(e){return a.from(e)}(e)),"function"==typeof t&&(n=t,t=null),c?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=v),i.ending?function(e,t){var n=new b;w(e,n),process.nextTick(t,n)}(this,n):(c||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new h("chunk",["string","Buffer"],n)),!i||(w(e,i),process.nextTick(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,n,r,i,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=a.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var c=t.objectMode?1:r.length;t.length+=c;var l=t.length<t.highWaterMark;l||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:s,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else k(e,t,!1,c,r,i,s);return l}(this,i,c,e,t,n)),s},S.prototype.cork=function(){this._writableState.corked++},S.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||I(this,e))},S.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new y(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(e,t,n){n(new f("_write()"))},S.prototype._writev=null,S.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,x(e,t),n&&(t.finished?process.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),S.prototype.destroy=l.destroy,S.prototype._undestroy=l.undestroy,S.prototype._destroy=function(e,t){t(e)},je}function We(){if(Oe)return Ne;Oe=1;var t=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};Ne=o;var n=tt(),r=Be();e.inherits_browser.exports(o,n);for(var i=t(r.prototype),s=0;s<i.length;s++){var a=i[s];o.prototype[a]||(o.prototype[a]=r.prototype[a])}function o(e){if(!(this instanceof o))return new o(e);n.call(this,e),r.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",c)))}function c(){this._writableState.ended||process.nextTick(l,this)}function l(e){e.end()}return Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),Ne}var qe,He={},Fe={exports:{}};function ze(){if(qe)return He;qe=1;var e=Fe.exports.Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(n){var r;switch(this.encoding=function(n){var r=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(n);if("string"!=typeof r&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return r||n}(n),this.encoding){case"utf16le":this.text=s,this.end=a,r=4;break;case"utf8":this.fillLast=i,r=4;break;case"base64":this.text=o,this.end=c,r=3;break;default:return this.write=l,void(this.end=u)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(r)}function r(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function s(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function o(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function u(e){return e&&e.length?this.write(e):""}return He.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var s=r(t[i]);if(s>=0)return s>0&&(e.lastNeed=s-1),s;if(--i<n||-2===s)return 0;if(s=r(t[i]),s>=0)return s>0&&(e.lastNeed=s-2),s;if(--i<n||-2===s)return 0;if(s=r(t[i]),s>=0)return s>0&&(2===s?s=0:e.lastNeed=s-3),s;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},He}
1
+ "use strict";var e=require("./index-42d4f376.cjs"),t=require("events"),n=require("buffer");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@ethersproject/providers"),require("zustand"),require("@ethersproject/bytes"),require("@ethersproject/properties"),require("@ethersproject/address"),require("@ethersproject/abstract-signer"),require("@ethersproject/abstract-provider"),require("@ethersproject/contracts"),require("@ethersproject/constants"),require("@ethersproject/transactions");var i=r(t),s=r(n),a={},o={},c={};Object.defineProperty(c,"__esModule",{value:!0}),c.walletLogo=void 0;c.walletLogo=(e,t)=>{let n;switch(e){case"standard":default:return n=t,`data:image/svg+xml,%3Csvg width='${t}' height='${n}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return n=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${n}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return n=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return n=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return n=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return n=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`}};var l={},u={},d={};Object.defineProperty(d,"__esModule",{value:!0}),d.errorValues=d.standardErrorCodes=void 0,d.standardErrorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},d.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var h={},f={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=d,n="Unspecified error message.";function r(r,i=n){if(r&&Number.isInteger(r)){const n=r.toString();if(o(t.errorValues,n))return t.errorValues[n].message;if(s(r))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return i}function i(e){if(!Number.isInteger(e))return!1;const n=e.toString();return!!t.errorValues[n]||!!s(e)}function s(e){return e>=-32099&&e<=-32e3}function a(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return"object"==typeof e&&null!==e&&t in e&&"string"==typeof e[t]}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=r,e.isValidCode=i,e.getErrorCode=function(e){var t;return"number"==typeof e?e:function(e){return"object"==typeof e&&null!==e&&("number"==typeof e.code||"number"==typeof e.errorCode)}(e)?null!==(t=e.code)&&void 0!==t?t:e.errorCode:void 0},e.serialize=function(e,{shouldIncludeStack:s=!1}={}){const l={};if(e&&"object"==typeof e&&!Array.isArray(e)&&o(e,"code")&&i(e.code)){const t=e;l.code=t.code,t.message&&"string"==typeof t.message?(l.message=t.message,o(t,"data")&&(l.data=t.data)):(l.message=r(l.code),l.data={originalError:a(e)})}else l.code=t.standardErrorCodes.rpc.internal,l.message=c(e,"message")?e.message:n,l.data={originalError:a(e)};return s&&(l.stack=c(e,"stack")?e.stack:void 0),l}}(f),Object.defineProperty(h,"__esModule",{value:!0}),h.standardErrors=void 0;const p=d,_=f;function g(e,t){const[n,r]=b(t);return new y(e,n||(0,_.getMessageFromCode)(e),r)}function m(e,t){const[n,r]=b(t);return new w(e,n||(0,_.getMessageFromCode)(e),r)}function b(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}h.standardErrors={rpc:{parse:e=>g(p.standardErrorCodes.rpc.parse,e),invalidRequest:e=>g(p.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>g(p.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>g(p.standardErrorCodes.rpc.methodNotFound,e),internal:e=>g(p.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return g(t,e)},invalidInput:e=>g(p.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>g(p.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>g(p.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>g(p.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>g(p.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>g(p.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>m(p.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>m(p.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>m(p.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>m(p.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>m(p.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>m(p.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw new Error('"message" must be a nonempty string');return new w(t,n,r)}}};class y extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}}class w extends y{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=void 0;var t=d;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});var n=h;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return n.standardErrors}})}(u);var v={},E={};Object.defineProperty(E,"__esModule",{value:!0}),E.isErrorResponse=void 0,E.isErrorResponse=function(e){return void 0!==e.errorMessage};var S={};Object.defineProperty(S,"__esModule",{value:!0}),S.LIB_VERSION=void 0,S.LIB_VERSION="4.0.2",Object.defineProperty(v,"__esModule",{value:!0}),v.serializeError=void 0;const k=E,C=S,I=d,M=f;v.serializeError=function(e,t){const n=(0,M.serialize)(function(e){if("string"==typeof e)return{message:e,code:I.standardErrorCodes.rpc.internal};if((0,k.isErrorResponse)(e))return Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}});return e}(e),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");r.searchParams.set("version",C.LIB_VERSION),r.searchParams.set("code",n.code.toString());const i=function(e,t){const n=null==e?void 0:e.method;if(n)return n;if(void 0===t)return;if("string"==typeof t)return t;if(!Array.isArray(t))return t.method;if(t.length>0)return t[0].method;return}(n.data,t);return i&&r.searchParams.set("method",i),r.searchParams.set("message",n.message),Object.assign(Object.assign({},n),{docUrl:r.href})};var R={};function x(){return e=>e}Object.defineProperty(R,"__esModule",{value:!0}),R.RegExpString=R.IntNumber=R.BigIntString=R.AddressString=R.HexString=R.OpaqueType=void 0,R.OpaqueType=x,R.HexString=e=>e,R.AddressString=e=>e,R.BigIntString=e=>e,R.IntNumber=function(e){return Math.floor(e)},R.RegExpString=e=>e;var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.areAddressArraysEqual=L.getFavicon=L.range=L.isBigNumber=L.ensureParsedJSONObject=L.ensureBigInt=L.ensureRegExpString=L.ensureIntNumber=L.ensureBuffer=L.ensureAddressString=L.ensureEvenLengthHexString=L.ensureHexString=L.isHexString=L.prepend0x=L.strip0x=L.has0xPrefix=L.hexStringFromIntNumber=L.intNumberFromHexString=L.bigIntStringFromBigInt=L.hexStringFromBuffer=L.hexStringToUint8Array=L.uint8ArrayToHex=L.randomBytesHex=void 0;const A=u,P=R,j=/^[0-9]*$/,T=/^[a-f0-9]*$/;function N(e){return[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function O(e){return e.startsWith("0x")||e.startsWith("0X")}function D(e){return O(e)?e.slice(2):e}function U(e){return O(e)?`0x${e.slice(2)}`:`0x${e}`}function B(e){if("string"!=typeof e)return!1;const t=D(e).toLowerCase();return T.test(t)}function W(e,t=!1){if("string"==typeof e){const n=D(e).toLowerCase();if(T.test(n))return(0,P.HexString)(t?`0x${n}`:n)}throw A.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function q(e,t=!1){let n=W(e,!1);return n.length%2==1&&(n=(0,P.HexString)(`0${n}`)),t?(0,P.HexString)(`0x${n}`):n}function H(e){if("number"==typeof e&&Number.isInteger(e))return(0,P.IntNumber)(e);if("string"==typeof e){if(j.test(e))return(0,P.IntNumber)(Number(e));if(B(e))return(0,P.IntNumber)(Number(BigInt(q(e,!0))))}throw A.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}function F(e){if(null==e||"function"!=typeof e.constructor)return!1;const{constructor:t}=e;return"function"==typeof t.config&&"number"==typeof t.EUCLID}L.randomBytesHex=function(e){return N(crypto.getRandomValues(new Uint8Array(e)))},L.uint8ArrayToHex=N,L.hexStringToUint8Array=function(e){return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},L.hexStringFromBuffer=function(e,t=!1){const n=e.toString("hex");return(0,P.HexString)(t?`0x${n}`:n)},L.bigIntStringFromBigInt=function(e){return(0,P.BigIntString)(e.toString(10))},L.intNumberFromHexString=function(e){return(0,P.IntNumber)(Number(BigInt(q(e,!0))))},L.hexStringFromIntNumber=function(e){return(0,P.HexString)(`0x${BigInt(e).toString(16)}`)},L.has0xPrefix=O,L.strip0x=D,L.prepend0x=U,L.isHexString=B,L.ensureHexString=W,L.ensureEvenLengthHexString=q,L.ensureAddressString=function(e){if("string"==typeof e){const t=D(e).toLowerCase();if(B(t)&&40===t.length)return(0,P.AddressString)(U(t))}throw A.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)},L.ensureBuffer=function(e){if(Buffer.isBuffer(e))return e;if("string"==typeof e){if(B(e)){const t=q(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw A.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)},L.ensureIntNumber=H,L.ensureRegExpString=function(e){if(e instanceof RegExp)return(0,P.RegExpString)(e.toString());throw A.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)},L.ensureBigInt=function(e){if(null!==e&&("bigint"==typeof e||F(e)))return BigInt(e.toString(10));if("number"==typeof e)return BigInt(H(e));if("string"==typeof e){if(j.test(e))return BigInt(e);if(B(e))return BigInt(q(e,!0))}throw A.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)},L.ensureParsedJSONObject=function(e){if("string"==typeof e)return JSON.parse(e);if("object"==typeof e)return e;throw A.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)},L.isBigNumber=F,L.range=function(e,t){return Array.from({length:t-e},((t,n)=>e+n))},L.getFavicon=function(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:n}=document.location,r=e?e.getAttribute("href"):null;return!r||r.startsWith("javascript:")||r.startsWith("vbscript:")?null:r.startsWith("http://")||r.startsWith("https://")||r.startsWith("data:")?r:r.startsWith("//")?t+r:`${t}//${n}${r}`},L.areAddressArraysEqual=function(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))};var z={},V={},K={},Z={};Object.defineProperty(Z,"__esModule",{value:!0}),Z.decryptContent=Z.encryptContent=Z.importKeyFromHexString=Z.exportKeyToHexString=Z.decrypt=Z.encrypt=Z.deriveSharedSecret=Z.generateKeyPair=void 0;const G=L;async function $(e,t){const n=crypto.getRandomValues(new Uint8Array(12));return{iv:n,cipherText:await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,(new TextEncoder).encode(t))}}async function Y(e,{iv:t,cipherText:n}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return(new TextDecoder).decode(r)}function J(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}Z.generateKeyPair=async function(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])},Z.deriveSharedSecret=async function(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])},Z.encrypt=$,Z.decrypt=Y,Z.exportKeyToHexString=async function(e,t){const n=J(e),r=await crypto.subtle.exportKey(n,t);return(0,G.uint8ArrayToHex)(new Uint8Array(r))},Z.importKeyFromHexString=async function(e,t){const n=J(e),r=(0,G.hexStringToUint8Array)(t).buffer;return await crypto.subtle.importKey(n,r,{name:"ECDH",namedCurve:"P-256"},!0,"private"===e?["deriveKey"]:[])},Z.encryptContent=async function(e,t){const n=JSON.stringify(e,((e,t)=>{if(!(t instanceof Error))return t;const n=t;return Object.assign(Object.assign({},n.code?{code:n.code}:{}),{message:n.message})}));return $(t,n)},Z.decryptContent=async function(e,t){return JSON.parse(await Y(t,e))};var Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.ScopedLocalStorage=void 0;class X{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);"string"==typeof r&&r.startsWith(e)&&t.push(r)}t.forEach((e=>localStorage.removeItem(e)))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new X("CBWSDK").clear(),new X("walletlink").clear()}}Q.ScopedLocalStorage=X,Object.defineProperty(K,"__esModule",{value:!0}),K.SCWKeyManager=void 0;const ee=Z,te=Q,ne={storageKey:"ownPrivateKey",keyType:"private"},re={storageKey:"ownPublicKey",keyType:"public"},ie={storageKey:"peerPublicKey",keyType:"public"};K.SCWKeyManager=class{constructor(){this.storage=new te.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(ie,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(re.storageKey),this.storage.removeItem(ne.storageKey),this.storage.removeItem(ie.storageKey)}async generateKeyPair(){const e=await(0,ee.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(ne,e.privateKey),await this.storeKey(re,e.publicKey)}async loadKeysIfNeeded(){if(null===this.ownPrivateKey&&(this.ownPrivateKey=await this.loadKey(ne)),null===this.ownPublicKey&&(this.ownPublicKey=await this.loadKey(re)),null!==this.ownPrivateKey&&null!==this.ownPublicKey||await this.generateKeyPair(),null===this.peerPublicKey&&(this.peerPublicKey=await this.loadKey(ie)),null===this.sharedSecret){if(null===this.ownPrivateKey||null===this.peerPublicKey)return;this.sharedSecret=await(0,ee.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const t=this.storage.getItem(e.storageKey);return t?(0,ee.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){const n=await(0,ee.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,n)}};var se={};Object.defineProperty(se,"__esModule",{value:!0}),se.SCWStateManager=void 0;const ae=Q,oe="accounts",ce="activeChain",le="availableChains",ue="walletCapabilities";se.SCWStateManager=class{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,n;this.storage=new ae.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(le),this._walletCapabilities=this.loadItemFromStorage(ue);const r=this.loadItemFromStorage(oe),i=this.loadItemFromStorage(ce);r&&this.updateListener.onAccountsUpdate({accounts:r,source:"storage"}),i&&this.updateListener.onChainUpdate({chain:i,source:"storage"}),this._accounts=r||[],this._activeChain=i||{id:null!==(n=null===(t=e.appChainIds)||void 0===t?void 0:t[0])&&void 0!==n?n:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(oe,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const n=null===(t=this.availableChains)||void 0===t?void 0:t.find((t=>t.id===e));return!!n&&(n===this._activeChain||(this._activeChain=n,this.storeItemToStorage(ce,n),this.updateListener.onChainUpdate({chain:n,source:"wallet"})),!0)}updateAvailableChains(e){if(!e||0===Object.keys(e).length)return;const t=Object.entries(e).map((([e,t])=>({id:Number(e),rpcUrl:t})));this.availableChains=t,this.storeItemToStorage(le,t),this.switchChain(this._activeChain.id)}updateWalletCapabilities(e){this._walletCapabilities=e,this.storeItemToStorage(ue,e)}storeItemToStorage(e,t){this.storage.setItem(e,JSON.stringify(t))}loadItemFromStorage(e){const t=this.storage.getItem(e);return t?JSON.parse(t):void 0}clear(){this.storage.clear()}},Object.defineProperty(V,"__esModule",{value:!0}),V.SCWSigner=void 0;const de=K,he=se,fe=u,pe=L,_e=Z;V.SCWSigner=class{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new de.SCWKeyManager,this.stateManager=new he.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:e.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const e=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),t=await this.communicator.postRequestAndWaitForResponse(e);if("failure"in t.content)throw t.content.failure;const n=await(0,_e.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(n);const r=await this.decryptResponseMessage(t);this.updateInternalState({method:"eth_requestAccounts"},r);const i=r.result;if("error"in i)throw i.error;return this.stateManager.accounts}async request(e){const t=this.tryLocalHandling(e);if(void 0!==t){if(t instanceof Error)throw t;return t}await this.communicator.waitForPopupLoaded();const n=await this.sendEncryptedRequest(e),r=await this.decryptResponseMessage(n);this.updateInternalState(e,r);const i=r.result;if("error"in i)throw i.error;return i.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;switch(e.method){case"wallet_switchEthereumChain":{const n=e.params;if(!n||!(null===(t=n[0])||void 0===t?void 0:t.chainId))throw fe.standardErrors.rpc.invalidParams();const r=(0,pe.ensureIntNumber)(n[0].chainId);return this.stateManager.switchChain(r)?null:void 0}case"wallet_getCapabilities":{const e=this.stateManager.walletCapabilities;if(!e)throw fe.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return e}default:return}}async sendEncryptedRequest(e){const t=await this.keyManager.getSharedSecret();if(!t)throw fe.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await(0,_e.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),r=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(r)}async createRequestMessage(e){const t=await(0,_e.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:t,content:e,timestamp:new Date}}async decryptResponseMessage(e){const t=e.content;if("failure"in t)throw t.failure;const n=await this.keyManager.getSharedSecret();if(!n)throw fe.standardErrors.provider.unauthorized("Invalid session");return(0,_e.decryptContent)(t.encrypted,n)}updateInternalState(e,t){var n,r;const i=null===(n=t.data)||void 0===n?void 0:n.chains;i&&this.stateManager.updateAvailableChains(i);const s=null===(r=t.data)||void 0===r?void 0:r.capabilities;s&&this.stateManager.updateWalletCapabilities(s);const a=t.result;if(!("error"in a))switch(e.method){case"eth_requestAccounts":{const e=a.value;this.stateManager.updateAccounts(e);break}case"wallet_switchEthereumChain":{if(null!==a.value)return;const t=e.params,n=(0,pe.ensureIntNumber)(t[0].chainId);this.stateManager.switchChain(n);break}}}};var ge,me,be={},ye={exports:{}},we=i.default.EventEmitter;function ve(){if(me)return ge;function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?t(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function r(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}me=1;var o=s.default.Buffer,c=e.require$$1.inspect,l=c&&c.custom||"inspect";return ge=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,s;return t=e,r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,r=a,o.prototype.copy.call(t,n,r),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,s=e>i.length?i.length:e;if(s===i.length?r+=i:r+=i.slice(0,e),0==(e-=s)){s===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(s));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(s));break}++r}return this.length-=r,t}},{key:l,value:function(e,t){return c(this,n(n({},t),{},{depth:0,customInspect:!1}))}}],r&&i(t.prototype,r),s&&i(t,s),Object.defineProperty(t,"prototype",{writable:!1}),e}(),ge}function Ee(e,t){ke(e,t),Se(e)}function Se(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function ke(e,t){e.emit("error",t)}var Ce={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(ke,this,e)):process.nextTick(ke,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?process.nextTick(Se,n):(n._writableState.errorEmitted=!0,process.nextTick(Ee,n,e)):process.nextTick(Ee,n,e):t?(process.nextTick(Se,n),t(e)):process.nextTick(Se,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},Ie={};var Me={};function Re(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i))||this}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,Me[e]=r}function xe(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}Re("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),Re("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i,s,a;if("string"==typeof t&&(i="not ",t.substr(!s||s<0?0:+s,i.length)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))a="The ".concat(e," ").concat(r," ").concat(xe(t,"type"));else{var o=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(o," ").concat(r," ").concat(xe(t,"type"))}return a+=". Received type ".concat(typeof n)}),TypeError),Re("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Re("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),Re("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Re("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),Re("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Re("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Re("ERR_STREAM_WRITE_AFTER_END","write after end"),Re("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Re("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),Re("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Ie.codes=Me;var Le=Ie.codes.ERR_INVALID_OPT_VALUE;var Ae,Pe,je,Te,Ne={getHighWaterMark:function(e,t,n,r){var i=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new Le(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}},Oe=function(e,t){if(De("noDeprecation"))return e;var n=!1;return function(){if(!n){if(De("throwDeprecation"))throw new Error(t);De("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function De(t){try{if(!e.commonjsGlobal.localStorage)return!1}catch(e){return!1}var n=e.commonjsGlobal.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}function Ue(){if(Pe)return Ae;function t(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var n;Pe=1,Ae=S,S.WritableState=E;var r={deprecate:Oe},i=we,a=s.default.Buffer,o=(void 0!==e.commonjsGlobal?e.commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,l=Ce,u=Ne.getHighWaterMark,d=Ie.codes,h=d.ERR_INVALID_ARG_TYPE,f=d.ERR_METHOD_NOT_IMPLEMENTED,p=d.ERR_MULTIPLE_CALLBACK,_=d.ERR_STREAM_CANNOT_PIPE,g=d.ERR_STREAM_DESTROYED,m=d.ERR_STREAM_NULL_VALUES,b=d.ERR_STREAM_WRITE_AFTER_END,y=d.ERR_UNKNOWN_ENCODING,w=l.errorOrDestroy;function v(){}function E(e,r,i){n=n||Be(),e=e||{},"boolean"!=typeof i&&(i=r instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=u(this,e,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new p;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(process.nextTick(i,r),process.nextTick(x,e,t),e._writableState.errorEmitted=!0,w(e,r)):(i(r),e._writableState.errorEmitted=!0,w(e,r),x(e,t))}(e,n,r,t,i);else{var s=M(n)||e.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||I(e,n),r?process.nextTick(C,e,n,s,i):C(e,n,s,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function S(e){var t=this instanceof(n=n||Be());if(!t&&!c.call(S,this))return new S(e);this._writableState=new E(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function k(e,t,n,r,i,s,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new g("write")):n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function C(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),x(e,t)}function I(e,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(e._writev&&r&&r.next){var i=n.bufferedRequestCount,s=new Array(i),a=n.corkedRequestsFree;a.entry=r;for(var o=0,c=!0;r;)s[o]=r,r.isBuf||(c=!1),r=r.next,o+=1;s.allBuffers=c,k(e,n,!0,n.length,s,"",a.finish),n.pendingcb++,n.lastBufferedRequest=null,a.next?(n.corkedRequestsFree=a.next,a.next=null):n.corkedRequestsFree=new t(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,d=r.callback;if(k(e,n,!1,n.objectMode?1:l.length,l,u,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function M(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function R(e,t){e._final((function(n){t.pendingcb--,n&&w(e,n),t.prefinished=!0,e.emit("prefinish"),x(e,t)}))}function x(e,t){var n=M(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(R,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return e.inherits_browser.exports(S,i),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(e){return!!c.call(this,e)||this===S&&(e&&e._writableState instanceof E)}})):c=function(e){return e instanceof this},S.prototype.pipe=function(){w(this,new _)},S.prototype.write=function(e,t,n){var r,i=this._writableState,s=!1,c=!i.objectMode&&(r=e,a.isBuffer(r)||r instanceof o);return c&&!a.isBuffer(e)&&(e=function(e){return a.from(e)}(e)),"function"==typeof t&&(n=t,t=null),c?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=v),i.ending?function(e,t){var n=new b;w(e,n),process.nextTick(t,n)}(this,n):(c||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new h("chunk",["string","Buffer"],n)),!i||(w(e,i),process.nextTick(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,n,r,i,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=a.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var c=t.objectMode?1:r.length;t.length+=c;var l=t.length<t.highWaterMark;l||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:s,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else k(e,t,!1,c,r,i,s);return l}(this,i,c,e,t,n)),s},S.prototype.cork=function(){this._writableState.corked++},S.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||I(this,e))},S.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new y(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(e,t,n){n(new f("_write()"))},S.prototype._writev=null,S.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,x(e,t),n&&(t.finished?process.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),S.prototype.destroy=l.destroy,S.prototype._undestroy=l.undestroy,S.prototype._destroy=function(e,t){t(e)},Ae}function Be(){if(Te)return je;Te=1;var t=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};je=o;var n=et(),r=Ue();e.inherits_browser.exports(o,n);for(var i=t(r.prototype),s=0;s<i.length;s++){var a=i[s];o.prototype[a]||(o.prototype[a]=r.prototype[a])}function o(e){if(!(this instanceof o))return new o(e);n.call(this,e),r.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",c)))}function c(){this._writableState.ended||process.nextTick(l,this)}function l(e){e.end()}return Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),je}var We,qe={},He={exports:{}};function Fe(){if(We)return qe;We=1;var e=He.exports.Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(n){var r;switch(this.encoding=function(n){var r=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(n);if("string"!=typeof r&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return r||n}(n),this.encoding){case"utf16le":this.text=s,this.end=a,r=4;break;case"utf8":this.fillLast=i,r=4;break;case"base64":this.text=o,this.end=c,r=3;break;default:return this.write=l,void(this.end=u)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(r)}function r(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function s(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function o(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function u(e){return e&&e.length?this.write(e):""}return qe.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var s=r(t[i]);if(s>=0)return s>0&&(e.lastNeed=s-1),s;if(--i<n||-2===s)return 0;if(s=r(t[i]),s>=0)return s>0&&(e.lastNeed=s-2),s;if(--i<n||-2===s)return 0;if(s=r(t[i]),s>=0)return s>0&&(2===s?s=0:e.lastNeed=s-3),s;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},qe}
2
2
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
3
- !function(e,t){var n=s.default,r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=a),a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(Fe,Fe.exports);var Ve=Ie.codes.ERR_STREAM_PREMATURE_CLOSE;function Ke(){}var Ze,Ge,$e,Ye,Je,Qe,Xe=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(r||Ke);var i=n.readable||!1!==n.readable&&t.readable,s=n.writable||!1!==n.writable&&t.writable,a=function(){t.writable||c()},o=t._writableState&&t._writableState.finished,c=function(){s=!1,o=!0,i||r.call(t)},l=t._readableState&&t._readableState.endEmitted,u=function(){i=!1,l=!0,s||r.call(t)},d=function(e){r.call(t,e)},h=function(){var e;return i&&!l?(t._readableState&&t._readableState.ended||(e=new Ve),r.call(t,e)):s&&!o?(t._writableState&&t._writableState.ended||(e=new Ve),r.call(t,e)):void 0},f=function(){t.req.on("finish",c)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?s&&!t._writableState&&(t.on("end",a),t.on("close",a)):(t.on("complete",c),t.on("abort",h),t.req?f():t.on("request",f)),t.on("end",u),t.on("finish",c),!1!==n.error&&t.on("error",d),t.on("close",h),function(){t.removeListener("complete",c),t.removeListener("abort",h),t.removeListener("request",f),t.req&&t.req.removeListener("finish",c),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",c),t.removeListener("end",u),t.removeListener("error",d),t.removeListener("close",h)}};function et(){if(Ge)return Ze;var e;function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Ge=1;var n=Xe,r=Symbol("lastResolve"),i=Symbol("lastReject"),s=Symbol("error"),a=Symbol("ended"),o=Symbol("lastPromise"),c=Symbol("handlePromise"),l=Symbol("stream");function u(e,t){return{value:e,done:t}}function d(e){var t=e[r];if(null!==t){var n=e[l].read();null!==n&&(e[o]=null,e[r]=null,e[i]=null,t(u(n,!1)))}}function h(e){process.nextTick(d,e)}var f=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((e={get stream(){return this[l]},next:function(){var e=this,t=this[s];if(null!==t)return Promise.reject(t);if(this[a])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise((function(t,n){process.nextTick((function(){e[s]?n(e[s]):t(u(void 0,!0))}))}));var n,r=this[o];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[a]?n(u(void 0,!0)):t[c](n,r)}),r)}}(r,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(u(i,!1));n=new Promise(this[c])}return this[o]=n,n}},t(e,Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,n){e[l].destroy(null,(function(e){e?n(e):t(u(void 0,!0))}))}))})),e),f);return Ze=function(e){var d,f=Object.create(p,(t(d={},l,{value:e,writable:!0}),t(d,r,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,s,{value:null,writable:!0}),t(d,a,{value:e._readableState.endEmitted,writable:!0}),t(d,c,{value:function(e,t){var n=f[l].read();n?(f[o]=null,f[r]=null,f[i]=null,e(u(n,!1))):(f[r]=e,f[i]=t)},writable:!0}),d));return f[o]=null,n(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=f[i];return null!==t&&(f[o]=null,f[r]=null,f[i]=null,t(e)),void(f[s]=e)}var n=f[r];null!==n&&(f[o]=null,f[r]=null,f[i]=null,n(u(void 0,!0))),f[a]=!0})),e.on("readable",h.bind(null,f)),f}}function tt(){if(Qe)return Je;var t;Qe=1,Je=k,k.ReadableState=S,i.default.EventEmitter;var n=function(e,t){return e.listeners(t).length},r=we,a=s.default.Buffer,o=(void 0!==e.commonjsGlobal?e.commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,l=e.require$$1;c=l&&l.debuglog?l.debuglog("stream"):function(){};var u,d,h,f=ve(),p=Ce,_=De.getHighWaterMark,g=Ie.codes,m=g.ERR_INVALID_ARG_TYPE,b=g.ERR_STREAM_PUSH_AFTER_EOF,y=g.ERR_METHOD_NOT_IMPLEMENTED,w=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e.inherits_browser.exports(k,r);var v=p.errorOrDestroy,E=["error","close","destroy","pause","resume"];function S(e,n,r){t=t||We(),e=e||{},"boolean"!=typeof r&&(r=n instanceof t),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=_(this,e,"readableHighWaterMark",r),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(u||(u=ze().StringDecoder),this.decoder=new u(e.encoding),this.encoding=e.encoding)}function k(e){if(t=t||We(),!(this instanceof k))return new k(e);var n=this instanceof t;this._readableState=new S(e,this,n),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),r.call(this)}function C(e,t,n,r,i){c("readableAddChunk",t);var s,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(c("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?x(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,L(e)))}(e,l);else if(i||(s=function(e,t){var n;r=t,a.isBuffer(r)||r instanceof o||"string"==typeof t||void 0===t||e.objectMode||(n=new m("chunk",["string","Buffer","Uint8Array"],t));var r;return n}(l,t)),s)v(e,s);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),r)l.endEmitted?v(e,new w):I(e,l,t,!0);else if(l.ended)v(e,new b);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!n?(t=l.decoder.write(t),l.objectMode||0!==t.length?I(e,l,t,!1):A(e,l)):I(e,l,t,!1)}else r||(l.reading=!1,A(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function I(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&x(e)),A(e,t)}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),k.prototype.destroy=p.destroy,k.prototype._undestroy=p.undestroy,k.prototype._destroy=function(e,t){t(e)},k.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=a.from(e,t),t=""),n=!0),C(this,e,t,!1,n)},k.prototype.unshift=function(e){return C(this,e,null,!0,!1)},k.prototype.isPaused=function(){return!1===this._readableState.flowing},k.prototype.setEncoding=function(e){u||(u=ze().StringDecoder);var t=new u(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var M=1073741824;function R(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=M?e=M:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function x(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(L,e))}function L(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,O(e)}function A(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(P,e,t))}function P(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(c("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function j(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function T(e){c("readable nexttick read 0"),e.read(0)}function N(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),O(e),t.flowing&&!t.reading&&e.read(0)}function O(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function D(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function U(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(B,t,e))}function B(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function W(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return k.prototype.read=function(e){c("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?U(this):x(this),null;if(0===(e=R(e,t))&&t.ended)return 0===t.length&&U(this),null;var r,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&c("length less than watermark",i=!0),t.ended||t.reading?c("reading or ended",i=!1):i&&(c("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=R(n,t))),null===(r=e>0?D(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&U(this)),null!==r&&this.emit("data",r),r},k.prototype._read=function(e){v(this,new y("_read()"))},k.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,t);var s=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?o:_;function a(t,n){c("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,c("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",l),e.removeListener("error",h),e.removeListener("unpipe",a),r.removeListener("end",o),r.removeListener("end",_),r.removeListener("data",d),u=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function o(){c("onend"),e.end()}i.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",a);var l=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&n(e,"data")&&(t.flowing=!0,O(e))}}(r);e.on("drain",l);var u=!1;function d(t){c("ondata");var n=e.write(t);c("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==W(i.pipes,e))&&!u&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function h(t){c("onerror",t),_(),e.removeListener("error",h),0===n(e,"error")&&v(e,t)}function f(){e.removeListener("finish",p),_()}function p(){c("onfinish"),e.removeListener("close",f),_()}function _(){c("unpipe"),r.unpipe(e)}return r.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",f),e.once("finish",p),e.emit("pipe",r),i.flowing||(c("pipe resume"),r.resume()),e},k.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)r[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=W(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},k.prototype.on=function(e,t){var n=r.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?x(this):i.reading||process.nextTick(T,this))),n},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(j,this),n},k.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(j,this),t},k.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(N,e,t))}(this,e)),e.paused=!1,this},k.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(c("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<E.length;s++)e.on(E[s],this.emit.bind(this,E[s]));return this._read=function(t){c("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(k.prototype[Symbol.asyncIterator]=function(){return void 0===d&&(d=et()),d(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),k._fromList=D,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(k.from=function(e,t){return void 0===h&&(h=Ye?$e:(Ye=1,$e=function(){throw new Error("Readable.from is not available in the browser")})),h(k,e,t)}),Je}var nt=ut,rt=Ie.codes,it=rt.ERR_METHOD_NOT_IMPLEMENTED,st=rt.ERR_MULTIPLE_CALLBACK,at=rt.ERR_TRANSFORM_ALREADY_TRANSFORMING,ot=rt.ERR_TRANSFORM_WITH_LENGTH_0,ct=We();function lt(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new st);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function ut(e){if(!(this instanceof ut))return new ut(e);ct.call(this,e),this._transformState={afterTransform:lt.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",dt)}function dt(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?ht(this,null,null):this._flush((function(t,n){ht(e,t,n)}))}function ht(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new ot;if(e._transformState.transforming)throw new at;return e.push(null)}e.inherits_browser.exports(ut,ct),ut.prototype.push=function(e,t){return this._transformState.needTransform=!1,ct.prototype.push.call(this,e,t)},ut.prototype._transform=function(e,t,n){n(new it("_transform()"))},ut.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},ut.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},ut.prototype._destroy=function(e,t){ct.prototype._destroy.call(this,e,(function(e){t(e)}))};var ft,pt=gt,_t=nt;function gt(e){if(!(this instanceof gt))return new gt(e);_t.call(this,e)}e.inherits_browser.exports(gt,_t),gt.prototype._transform=function(e,t,n){n(null,e)};var mt=Ie.codes,bt=mt.ERR_MISSING_ARGS,yt=mt.ERR_STREAM_DESTROYED;function wt(e){if(e)throw e}function vt(e){e()}function Et(e,t){return e.pipe(t)}var St=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=function(e){return e.length?"function"!=typeof e[e.length-1]?wt:e.pop():wt}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new bt("streams");var s=t.map((function(e,n){var a=n<t.length-1;return function(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var i=!1;e.on("close",(function(){i=!0})),void 0===ft&&(ft=Xe),ft(e,{readable:t,writable:n},(function(e){if(e)return r(e);i=!0,r()}));var s=!1;return function(t){if(!i&&!s)return s=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new yt("pipe"))}}(e,a,n>0,(function(e){r||(r=e),e&&s.forEach(vt),a||(s.forEach(vt),i(r))}))}));return t.reduce(Et)};!function(e,t){(t=ye.exports=tt()).Stream=t,t.Readable=t,t.Writable=Be(),t.Duplex=We(),t.Transform=nt,t.PassThrough=pt,t.finished=Xe,t.pipeline=St}(0,ye.exports);const{Transform:kt}=ye.exports;const{Transform:Ct}=ye.exports;const It=e=>class t extends kt{constructor(t,n,r,i,s){super(s),this._rate=t,this._capacity=n,this._delimitedSuffix=r,this._hashBitLength=i,this._options=s,this._state=new e,this._state.initialize(t,n),this._finalized=!1}_transform(e,t,n){let r=null;try{this.update(e,t)}catch(e){r=e}n(r)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}},Mt=e=>class t extends Ct{constructor(t,n,r,i){super(i),this._rate=t,this._capacity=n,this._delimitedSuffix=r,this._options=i,this._state=new e,this._state.initialize(t,n),this._finalized=!1}_transform(e,t,n){let r=null;try{this.update(e,t)}catch(e){r=e}n(r)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let n=this._state.squeeze(e);return void 0!==t&&(n=n.toString(t)),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}};var Rt={};const xt=[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];Rt.p1600=function(e){for(let t=0;t<24;++t){const n=e[0]^e[10]^e[20]^e[30]^e[40],r=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],o=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],u=e[8]^e[18]^e[28]^e[38]^e[48],d=e[9]^e[19]^e[29]^e[39]^e[49];let h=u^(i<<1|s>>>31),f=d^(s<<1|i>>>31);const p=e[0]^h,_=e[1]^f,g=e[10]^h,m=e[11]^f,b=e[20]^h,y=e[21]^f,w=e[30]^h,v=e[31]^f,E=e[40]^h,S=e[41]^f;h=n^(a<<1|o>>>31),f=r^(o<<1|a>>>31);const k=e[2]^h,C=e[3]^f,I=e[12]^h,M=e[13]^f,R=e[22]^h,x=e[23]^f,L=e[32]^h,A=e[33]^f,P=e[42]^h,j=e[43]^f;h=i^(c<<1|l>>>31),f=s^(l<<1|c>>>31);const T=e[4]^h,N=e[5]^f,O=e[14]^h,D=e[15]^f,U=e[24]^h,B=e[25]^f,W=e[34]^h,q=e[35]^f,H=e[44]^h,F=e[45]^f;h=a^(u<<1|d>>>31),f=o^(d<<1|u>>>31);const z=e[6]^h,V=e[7]^f,K=e[16]^h,Z=e[17]^f,G=e[26]^h,$=e[27]^f,Y=e[36]^h,J=e[37]^f,Q=e[46]^h,X=e[47]^f;h=c^(n<<1|r>>>31),f=l^(r<<1|n>>>31);const ee=e[8]^h,te=e[9]^f,ne=e[18]^h,re=e[19]^f,ie=e[28]^h,se=e[29]^f,ae=e[38]^h,oe=e[39]^f,ce=e[48]^h,le=e[49]^f,ue=p,de=_,he=m<<4|g>>>28,fe=g<<4|m>>>28,pe=b<<3|y>>>29,_e=y<<3|b>>>29,ge=v<<9|w>>>23,me=w<<9|v>>>23,be=E<<18|S>>>14,ye=S<<18|E>>>14,we=k<<1|C>>>31,ve=C<<1|k>>>31,Ee=M<<12|I>>>20,Se=I<<12|M>>>20,ke=R<<10|x>>>22,Ce=x<<10|R>>>22,Ie=A<<13|L>>>19,Me=L<<13|A>>>19,Re=P<<2|j>>>30,xe=j<<2|P>>>30,Le=N<<30|T>>>2,Ae=T<<30|N>>>2,Pe=O<<6|D>>>26,je=D<<6|O>>>26,Te=B<<11|U>>>21,Ne=U<<11|B>>>21,Oe=W<<15|q>>>17,De=q<<15|W>>>17,Ue=F<<29|H>>>3,Be=H<<29|F>>>3,We=z<<28|V>>>4,qe=V<<28|z>>>4,He=Z<<23|K>>>9,Fe=K<<23|Z>>>9,ze=G<<25|$>>>7,Ve=$<<25|G>>>7,Ke=Y<<21|J>>>11,Ze=J<<21|Y>>>11,Ge=X<<24|Q>>>8,$e=Q<<24|X>>>8,Ye=ee<<27|te>>>5,Je=te<<27|ee>>>5,Qe=ne<<20|re>>>12,Xe=re<<20|ne>>>12,et=se<<7|ie>>>25,tt=ie<<7|se>>>25,nt=ae<<8|oe>>>24,rt=oe<<8|ae>>>24,it=ce<<14|le>>>18,st=le<<14|ce>>>18;e[0]=ue^~Ee&Te,e[1]=de^~Se&Ne,e[10]=We^~Qe&pe,e[11]=qe^~Xe&_e,e[20]=we^~Pe&ze,e[21]=ve^~je&Ve,e[30]=Ye^~he&ke,e[31]=Je^~fe&Ce,e[40]=Le^~He&et,e[41]=Ae^~Fe&tt,e[2]=Ee^~Te&Ke,e[3]=Se^~Ne&Ze,e[12]=Qe^~pe&Ie,e[13]=Xe^~_e&Me,e[22]=Pe^~ze&nt,e[23]=je^~Ve&rt,e[32]=he^~ke&Oe,e[33]=fe^~Ce&De,e[42]=He^~et&ge,e[43]=Fe^~tt&me,e[4]=Te^~Ke&it,e[5]=Ne^~Ze&st,e[14]=pe^~Ie&Ue,e[15]=_e^~Me&Be,e[24]=ze^~nt&be,e[25]=Ve^~rt&ye,e[34]=ke^~Oe&Ge,e[35]=Ce^~De&$e,e[44]=et^~ge&Re,e[45]=tt^~me&xe,e[6]=Ke^~it&ue,e[7]=Ze^~st&de,e[16]=Ie^~Ue&We,e[17]=Me^~Be&qe,e[26]=nt^~be&we,e[27]=rt^~ye&ve,e[36]=Oe^~Ge&Ye,e[37]=De^~$e&Je,e[46]=ge^~Re&Le,e[47]=me^~xe&Ae,e[8]=it^~ue&Ee,e[9]=st^~de&Se,e[18]=Ue^~We&Qe,e[19]=Be^~qe&Xe,e[28]=be^~we&Pe,e[29]=ye^~ve&je,e[38]=Ge^~Ye&he,e[39]=$e^~Je&fe,e[48]=Re^~Le&He,e[49]=xe^~Ae&Fe,e[0]^=xt[2*t],e[1]^=xt[2*t+1]}};const Lt=Rt;function At(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}At.prototype.initialize=function(e,t){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},At.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<this.count%4*8,this.count+=1,this.count===this.blockSize&&(Lt.p1600(this.state),this.count=0)},At.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<this.count%4*8,0!=(128&e)&&this.count===this.blockSize-1&&Lt.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<(this.blockSize-1)%4*8,Lt.p1600(this.state),this.count=0,this.squeezing=!0},At.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);const t=Buffer.alloc(e);for(let n=0;n<e;++n)t[n]=this.state[~~(this.count/4)]>>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(Lt.p1600(this.state),this.count=0);return t},At.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var Pt=function(e){const t=It(e),n=Mt(e);return function(e,r){switch("string"==typeof e?e.toLowerCase():e){case"keccak224":return new t(1152,448,null,224,r);case"keccak256":return new t(1088,512,null,256,r);case"keccak384":return new t(832,768,null,384,r);case"keccak512":return new t(576,1024,null,512,r);case"sha3-224":return new t(1152,448,6,224,r);case"sha3-256":return new t(1088,512,6,256,r);case"sha3-384":return new t(832,768,6,384,r);case"sha3-512":return new t(576,1024,6,512,r);case"shake128":return new n(1344,256,31,r);case"shake256":return new n(1088,512,31,r);default:throw new Error("Invald algorithm: "+e)}}}(At);const jt=Pt;function Tt(e){return Buffer.allocUnsafe(e).fill(0)}function Nt(e,t){let n=e.toString(16);n.length%2!=0&&(n="0"+n);const r=n.match(/.{1,2}/g).map((e=>parseInt(e,16)));for(;r.length<t;)r.unshift(0);return Buffer.from(r)}function Ot(e,t,n){const r=Tt(t);return e=Dt(e),n?e.length<t?(e.copy(r),r):e.slice(0,t):e.length<t?(e.copy(r,t-e.length),r):e.slice(-t)}function Dt(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);else if("string"==typeof e)e=Ut(e)?Buffer.from((t=Bt(e)).length%2?"0"+t:t,"hex"):Buffer.from(e);else if("number"==typeof e)e=intToBuffer(e);else if(null==e)e=Buffer.allocUnsafe(0);else if("bigint"==typeof e)e=Nt(e);else{if(!e.toArray)throw new Error("invalid type");e=Buffer.from(e.toArray())}var t;return e}function Ut(e){return"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]*$/)}function Bt(e){return"string"==typeof e&&e.startsWith("0x")?e.slice(2):e}var Wt={zeros:Tt,setLength:Ot,setLengthRight:function(e,t){return Ot(e,t,!0)},isHexString:Ut,stripHexPrefix:Bt,toBuffer:Dt,bufferToHex:function(e){return"0x"+(e=Dt(e)).toString("hex")},keccak:function(e,t){return e=Dt(e),t||(t=256),jt("keccak"+t).update(e).digest()},bitLengthFromBigInt:function(e){return e.toString(2).length},bufferBEFromBigInt:Nt,twosFromBigInt:function(e,t){let n;if(e<0n){n=(~e&(1n<<BigInt(t))-1n)+1n}else n=e;return n&=(1n<<BigInt(t))-1n,n}};const qt=Wt;function Ht(e){return e.startsWith("int[")?"int256"+e.slice(3):"int"===e?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):"uint"===e?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):"fixed"===e?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):"ufixed"===e?"ufixed128x128":e}function Ft(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function zt(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function Vt(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?""===t[2]?"dynamic":parseInt(t[2],10):null}function Kt(e){var t=typeof e;if("string"===t||"number"===t)return BigInt(e);if("bigint"===t)return e;throw new Error("Argument is not a number")}function Zt(e,t){var n,r,i,s;if("address"===e)return Zt("uint160",Kt(t));if("bool"===e)return Zt("uint8",t?1:0);if("string"===e)return Zt("bytes",new Buffer(t,"utf8"));if(function(e){return e.lastIndexOf("]")===e.length-1}(e)){if(void 0===t.length)throw new Error("Not an array?");if("dynamic"!==(n=Vt(e))&&0!==n&&t.length>n)throw new Error("Elements exceed array size: "+n);for(s in i=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof t&&(t=JSON.parse(t)),t)i.push(Zt(e,t[s]));if("dynamic"===n){var a=Zt("uint256",t.length);i.unshift(a)}return Buffer.concat(i)}if("bytes"===e)return t=new Buffer(t),i=Buffer.concat([Zt("uint256",t.length),t]),t.length%32!=0&&(i=Buffer.concat([i,qt.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if((n=Ft(e))<1||n>32)throw new Error("Invalid bytes<N> width: "+n);return qt.setLengthRight(t,32)}if(e.startsWith("uint")){if((n=Ft(e))%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=Kt(t);const i=qt.bitLengthFromBigInt(r);if(i>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+i);if(r<0)throw new Error("Supplied uint is negative");return qt.bufferBEFromBigInt(r,32)}if(e.startsWith("int")){if((n=Ft(e))%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=Kt(t);const i=qt.bitLengthFromBigInt(r);if(i>n)throw new Error("Supplied int exceeds width: "+n+" vs "+i);const s=qt.twosFromBigInt(r,256);return qt.bufferBEFromBigInt(s,32)}if(e.startsWith("ufixed")){if(n=zt(e),(r=Kt(t))<0)throw new Error("Supplied ufixed is negative");return Zt("uint256",r*BigInt(2)**BigInt(n[1]))}if(e.startsWith("fixed"))return n=zt(e),Zt("int256",Kt(t)*BigInt(2)**BigInt(n[1]));throw new Error("Unsupported or invalid type: "+e)}function Gt(e){return"string"===e||"bytes"===e||"dynamic"===Vt(e)}function $t(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var n,r,i=[],s=0;s<e.length;s++){var a=Ht(e[s]),o=t[s];if("bytes"===a)i.push(o);else if("string"===a)i.push(new Buffer(o,"utf8"));else if("bool"===a)i.push(new Buffer(o?"01":"00","hex"));else if("address"===a)i.push(qt.setLength(o,20));else if(a.startsWith("bytes")){if((n=Ft(a))<1||n>32)throw new Error("Invalid bytes<N> width: "+n);i.push(qt.setLengthRight(o,n))}else if(a.startsWith("uint")){if((n=Ft(a))%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=Kt(o);const e=qt.bitLengthFromBigInt(r);if(e>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+e);i.push(qt.bufferBEFromBigInt(r,n/8))}else{if(!a.startsWith("int"))throw new Error("Unsupported or invalid type: "+a);{if((n=Ft(a))%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=Kt(o);const e=qt.bitLengthFromBigInt(r);if(e>n)throw new Error("Supplied int exceeds width: "+n+" vs "+e);const t=qt.twosFromBigInt(r,n);i.push(qt.bufferBEFromBigInt(t,n/8))}}}return Buffer.concat(i)}var Yt={rawEncode:function(e,t){var n=[],r=[],i=32*e.length;for(var s in e){var a=Ht(e[s]),o=Zt(a,t[s]);Gt(a)?(n.push(Zt("uint256",i)),r.push(o),i+=o.length):n.push(o)}return Buffer.concat(n.concat(r))},solidityPack:$t,soliditySHA3:function(e,t){return qt.keccak($t(e,t))}};const Jt=Wt,Qt=Yt,Xt={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},en={encodeData(e,t,n,r=!0){const i=["bytes32"],s=[this.hashType(e,n)];if(r){const a=(e,t,i)=>{if(void 0!==n[t])return["bytes32",null==i?"0x0000000000000000000000000000000000000000000000000000000000000000":Jt.keccak(this.encodeData(t,i,n,r))];if(void 0===i)throw new Error(`missing value for field ${e} of type ${t}`);if("bytes"===t)return["bytes32",Jt.keccak(i)];if("string"===t)return"string"==typeof i&&(i=Buffer.from(i,"utf8")),["bytes32",Jt.keccak(i)];if(t.lastIndexOf("]")===t.length-1){const n=t.slice(0,t.lastIndexOf("[")),r=i.map((t=>a(e,n,t)));return["bytes32",Jt.keccak(Qt.rawEncode(r.map((([e])=>e)),r.map((([,e])=>e))))]}return[t,i]};for(const r of n[e]){const[e,n]=a(r.name,r.type,t[r.name]);i.push(e),s.push(n)}}else for(const a of n[e]){let e=t[a.name];if(void 0!==e)if("bytes"===a.type)i.push("bytes32"),e=Jt.keccak(e),s.push(e);else if("string"===a.type)i.push("bytes32"),"string"==typeof e&&(e=Buffer.from(e,"utf8")),e=Jt.keccak(e),s.push(e);else if(void 0!==n[a.type])i.push("bytes32"),e=Jt.keccak(this.encodeData(a.type,e,n,r)),s.push(e);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),s.push(e)}}return Qt.rawEncode(i,s)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter((t=>t!==e));r=[e].concat(r.sort());for(const e of r){if(!t[e])throw new Error("No type definition specified: "+e);n+=e+"("+t[e].map((({name:e,type:t})=>t+" "+e)).join(",")+")"}return n},findTypeDependencies(e,t,n=[]){if(e=e.match(/^\w*/)[0],n.includes(e)||void 0===t[e])return n;n.push(e);for(const r of t[e])for(const e of this.findTypeDependencies(r.type,t,n))!n.includes(e)&&n.push(e);return n},hashStruct(e,t,n,r=!0){return Jt.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return Jt.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n in Xt.properties)e[n]&&(t[n]=e[n]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const n=this.sanitizeData(e),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",n.domain,n.types,t)),"EIP712Domain"!==n.primaryType&&r.push(this.hashStruct(n.primaryType,n.message,n.types,t)),Jt.keccak(Buffer.concat(r))}};var tn={TYPED_MESSAGE_SCHEMA:Xt,TypedDataUtils:en,hashForSignTypedDataLegacy:function(e){return function(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;const n=e.map((function(e){return"bytes"===e.type?Jt.toBuffer(e.value):e.value})),r=e.map((function(e){return e.type})),i=e.map((function(e){if(!e.name)throw t;return e.type+" "+e.name}));return Qt.soliditySHA3(["bytes32","bytes32"],[Qt.soliditySHA3(new Array(e.length).fill("string"),i),Qt.soliditySHA3(r,n)])}(e.data)},hashForSignTypedData_v3:function(e){return en.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return en.hash(e.data)}};var nn={};Object.defineProperty(nn,"__esModule",{value:!0}),nn.APP_VERSION_KEY=nn.LOCAL_STORAGE_ADDRESSES_KEY=nn.WALLET_USER_NAME_KEY=void 0,nn.WALLET_USER_NAME_KEY="walletUsername",nn.LOCAL_STORAGE_ADDRESSES_KEY="Addresses",nn.APP_VERSION_KEY="AppVersion";var rn={};Object.defineProperty(rn,"__esModule",{value:!0}),rn.RelayEventManager=void 0;const sn=L;rn.RelayEventManager=class{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,sn.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}};var an={},on={},cn={};Object.defineProperty(cn,"__esModule",{value:!0}),cn.WalletLinkCipher=void 0;const ln=L;cn.WalletLinkCipher=class{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.importKey("raw",(0,ln.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,s=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},r,i.encode(e)),a=s.slice(s.byteLength-16),o=s.slice(0,s.byteLength-16),c=new Uint8Array(a),l=new Uint8Array(o),u=new Uint8Array([...n,...c,...l]);return(0,ln.uint8ArrayToHex)(u)}async decrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");return new Promise(((n,r)=>{!async function(){const i=await crypto.subtle.importKey("raw",(0,ln.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=(0,ln.hexStringToUint8Array)(e),a=s.slice(0,12),o=s.slice(12,28),c=s.slice(28),l=new Uint8Array([...c,...o]),u={name:"AES-GCM",iv:new Uint8Array(a)};try{const e=await window.crypto.subtle.decrypt(u,i,l),t=new TextDecoder;n(t.decode(e))}catch(e){r(e)}}()}))}};var un={};Object.defineProperty(un,"__esModule",{value:!0}),un.WalletLinkHTTP=void 0;un.WalletLinkHTTP=class{constructor(e,t,n){this.linkAPIUrl=e,this.sessionId=t;const r=`${t}:${n}`;this.auth=`Basic ${btoa(r)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map((e=>fetch(`${this.linkAPIUrl}/events/${e.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}})))).catch((e=>console.error("Unabled to mark event as failed:",e)))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:n,error:r}=await t.json();if(r)throw new Error(`Check unseen events failed: ${r}`);const i=null!==(e=null==n?void 0:n.filter((e=>"Web3Response"===e.event)).map((e=>({type:"Event",sessionId:this.sessionId,eventId:e.id,event:e.event,data:e.data}))))&&void 0!==e?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${t.status}`)}};var dn,hn={};Object.defineProperty(hn,"__esModule",{value:!0}),hn.WalletLinkWebSocket=hn.ConnectionState=void 0,function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"}(dn||(hn.ConnectionState=dn={}));hn.WalletLinkWebSocket=class{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise(((e,t)=>{var n;let r;try{this.webSocket=r=new this.WebSocketClass(this.url)}catch(e){return void t(e)}null===(n=this.connectionStateListener)||void 0===n||n.call(this,dn.CONNECTING),r.onclose=e=>{var n;this.clearWebSocket(),t(new Error(`websocket error ${e.code}: ${e.reason}`)),null===(n=this.connectionStateListener)||void 0===n||n.call(this,dn.DISCONNECTED)},r.onopen=t=>{var n;if(e(),null===(n=this.connectionStateListener)||void 0===n||n.call(this,dn.CONNECTED),this.pendingData.length>0){[...this.pendingData].forEach((e=>this.sendData(e))),this.pendingData=[]}},r.onmessage=e=>{var t,n;if("h"===e.data)null===(t=this.incomingDataListener)||void 0===t||t.call(this,{type:"Heartbeat"});else try{const t=JSON.parse(e.data);null===(n=this.incomingDataListener)||void 0===n||n.call(this,t)}catch(e){}}}))}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),null===(e=this.connectionStateListener)||void 0===e||e.call(this,dn.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch(e){}}}sendData(e){const{webSocket:t}=this;if(!t)return this.pendingData.push(e),void this.connect();t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}},Object.defineProperty(on,"__esModule",{value:!0}),on.WalletLinkConnection=void 0;const fn=nn,pn=cn,_n=un,gn=hn,mn=R;on.WalletLinkConnection=class{constructor({session:e,linkAPIUrl:t,listener:n,WebSocketClass:r=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,mn.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=e=>{if(!e)return;const t=new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",t=>e.JsonRpcUrl&&this.handleChainUpdated(t,e.JsonRpcUrl)]]);t.forEach(((t,n)=>{const r=e[n];void 0!==r&&t(r)}))},this.handleDestroyed=e=>{var t;"1"===e&&(null===(t=this.listener)||void 0===t||t.resetAndReload())},this.handleAccountUpdated=async e=>{var t;{const n=await this.cipher.decrypt(e);null===(t=this.listener)||void 0===t||t.accountUpdated(n)}},this.handleMetadataUpdated=async(e,t)=>{var n;{const r=await this.cipher.decrypt(t);null===(n=this.listener)||void 0===n||n.metadataUpdated(e,r)}},this.handleWalletUsernameUpdated=async e=>{this.handleMetadataUpdated(fn.WALLET_USER_NAME_KEY,e)},this.handleAppVersionUpdated=async e=>{this.handleMetadataUpdated(fn.APP_VERSION_KEY,e)},this.handleChainUpdated=async(e,t)=>{var n;{const r=await this.cipher.decrypt(e),i=await this.cipher.decrypt(t);null===(n=this.listener)||void 0===n||n.chainUpdated(r,i)}},this.session=e,this.cipher=new pn.WalletLinkCipher(e.secret),this.listener=n;const i=new gn.WalletLinkWebSocket(`${t}/rpc`,r);i.setConnectionStateListener((async e=>{let t=!1;switch(e){case gn.ConnectionState.DISCONNECTED:if(!this.destroyed){const e=async()=>{await new Promise((e=>setTimeout(e,5e3))),this.destroyed||i.connect().catch((()=>{e()}))};e()}break;case gn.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),t=!0}catch(e){}this.updateLastHeartbeat(),setInterval((()=>{this.heartbeat()}),1e4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();case gn.ConnectionState.CONNECTING:}this.connected!==t&&(this.connected=t)})),i.setIncomingDataListener((e=>{var t;switch(e.type){case"Heartbeat":return void this.updateLastHeartbeat();case"IsLinkedOK":case"Linked":{const t="IsLinkedOK"===e.type?e.linked:void 0;this.linked=t||e.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":this.handleSessionMetadataUpdated(e.metadata);break;case"Event":this.handleIncomingEvent(e)}void 0!==e.id&&(null===(t=this.requestResolutions.get(e.id))||void 0===t||t(e))})),this.ws=i,this.http=new _n.WalletLinkHTTP(t,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t;this._connected=e,e&&(null===(t=this.onceConnected)||void 0===t||t.call(this))}setOnceConnected(e){return new Promise((t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}}))}get linked(){return this._linked}set linked(e){var t,n;this._linked=e,e&&(null===(t=this.onceLinked)||void 0===t||t.call(this)),null===(n=this.listener)||void 0===n||n.linkedUpdated(e)}setOnceLinked(e){return new Promise((t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}}))}async handleIncomingEvent(e){var t;if("Event"===e.type&&"Web3Response"===e.event){const n=await this.cipher.decrypt(e.data),r=JSON.parse(n);if("WEB3_RESPONSE"!==r.type)return;null===(t=this.listener)||void 0===t||t.handleWeb3ResponseMessage(r)}}async checkUnseenEvents(){if(this.connected){await new Promise((e=>setTimeout(e,250)));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}else this.shouldFetchUnseenEventsOnConnect=!0}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1;(await this.http.fetchUnseenEvents()).forEach((e=>this.handleIncomingEvent(e)))}async setSessionMetadata(e,t){const n={type:"SetSessionConfig",id:(0,mn.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected((async()=>{const e=await this.makeRequest(n);if("Fail"===e.type)throw new Error(e.error||"failed to set session metadata")}))}async publishEvent(e,t,n=!1){const r=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,mn.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:r,callWebhook:n};return this.setOnceLinked((async()=>{const e=await this.makeRequest(i);if("Fail"===e.type)throw new Error(e.error||"failed to publish event");return e.eventId}))}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>2e4)this.ws.disconnect();else try{this.ws.sendData("h")}catch(e){}}async makeRequest(e,t=6e4){const n=e.id;let r;return this.sendData(e),Promise.race([new Promise(((e,i)=>{r=window.setTimeout((()=>{i(new Error(`request ${n} timed out`))}),t)})),new Promise((e=>{this.requestResolutions.set(n,(t=>{clearTimeout(r),e(t),this.requestResolutions.delete(n)}))}))])}async authenticate(){const e={type:"HostSession",id:(0,mn.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if("Fail"===t.type)throw new Error(t.error||"failed to authenticate")}sendIsLinked(){const e={type:"IsLinked",id:(0,mn.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,mn.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}};var bn={},yn={exports:{}},wn=Fe.exports.Buffer;function vn(e,t){this._block=wn.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}vn.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=wn.from(e,t));for(var n=this._block,r=this._blockSize,i=e.length,s=this._len,a=0;a<i;){for(var o=s%r,c=Math.min(i-a,r-o),l=0;l<c;l++)n[o+l]=e[a+l];a+=c,(s+=c)%r==0&&this._update(n)}return this._len+=i,this},vn.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s},vn.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var En=vn,Sn=e.inherits_browser.exports,kn=En,Cn=Fe.exports.Buffer,In=[1518500249,1859775393,-1894007588,-899497514],Mn=new Array(80);function Rn(){this.init(),this._w=Mn,kn.call(this,64,56)}function xn(e){return e<<30|e>>>2}function Ln(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}Sn(Rn,kn),Rn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Rn.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,o=0|this._e,c=0;c<16;++c)n[c]=e.readInt32BE(4*c);for(;c<80;++c)n[c]=n[c-3]^n[c-8]^n[c-14]^n[c-16];for(var l=0;l<80;++l){var u=~~(l/20),d=0|((t=r)<<5|t>>>27)+Ln(u,i,s,a)+o+n[l]+In[u];o=a,a=s,s=xn(i),i=r,r=d}this._a=r+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=o+this._e|0},Rn.prototype._hash=function(){var e=Cn.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var An=Rn,Pn=e.inherits_browser.exports,jn=En,Tn=Fe.exports.Buffer,Nn=[1518500249,1859775393,-1894007588,-899497514],On=new Array(80);function Dn(){this.init(),this._w=On,jn.call(this,64,56)}function Un(e){return e<<5|e>>>27}function Bn(e){return e<<30|e>>>2}function Wn(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}Pn(Dn,jn),Dn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Dn.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,o=0|this._e,c=0;c<16;++c)n[c]=e.readInt32BE(4*c);for(;c<80;++c)n[c]=(t=n[c-3]^n[c-8]^n[c-14]^n[c-16])<<1|t>>>31;for(var l=0;l<80;++l){var u=~~(l/20),d=Un(r)+Wn(u,i,s,a)+o+n[l]+Nn[u]|0;o=a,a=s,s=Bn(i),i=r,r=d}this._a=r+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=o+this._e|0},Dn.prototype._hash=function(){var e=Tn.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var qn=Dn,Hn=e.inherits_browser.exports,Fn=En,zn=Fe.exports.Buffer,Vn=[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],Kn=new Array(64);function Zn(){this.init(),this._w=Kn,Fn.call(this,64,56)}function Gn(e,t,n){return n^e&(t^n)}function $n(e,t,n){return e&t|n&(e|t)}function Yn(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Jn(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Qn(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function Xn(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Hn(Zn,Fn),Zn.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Zn.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,s=0|this._d,a=0|this._e,o=0|this._f,c=0|this._g,l=0|this._h,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<64;++u)t[u]=Xn(t[u-2])+t[u-7]+Qn(t[u-15])+t[u-16]|0;for(var d=0;d<64;++d){var h=l+Jn(a)+Gn(a,o,c)+Vn[d]+t[d]|0,f=Yn(n)+$n(n,r,i)|0;l=c,c=o,o=a,a=s+h|0,s=i,i=r,r=n,n=h+f|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=o+this._f|0,this._g=c+this._g|0,this._h=l+this._h|0},Zn.prototype._hash=function(){var e=zn.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var er=Zn,tr=e.inherits_browser.exports,nr=er,rr=En,ir=Fe.exports.Buffer,sr=new Array(64);function ar(){this.init(),this._w=sr,rr.call(this,64,56)}tr(ar,nr),ar.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},ar.prototype._hash=function(){var e=ir.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var or=ar,cr=e.inherits_browser.exports,lr=En,ur=Fe.exports.Buffer,dr=[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],hr=new Array(160);function fr(){this.init(),this._w=hr,lr.call(this,128,112)}function pr(e,t,n){return n^e&(t^n)}function _r(e,t,n){return e&t|n&(e|t)}function gr(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function mr(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function br(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function yr(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function wr(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function vr(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Er(e,t){return e>>>0<t>>>0?1:0}cr(fr,lr),fr.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},fr.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,s=0|this._dh,a=0|this._eh,o=0|this._fh,c=0|this._gh,l=0|this._hh,u=0|this._al,d=0|this._bl,h=0|this._cl,f=0|this._dl,p=0|this._el,_=0|this._fl,g=0|this._gl,m=0|this._hl,b=0;b<32;b+=2)t[b]=e.readInt32BE(4*b),t[b+1]=e.readInt32BE(4*b+4);for(;b<160;b+=2){var y=t[b-30],w=t[b-30+1],v=br(y,w),E=yr(w,y),S=wr(y=t[b-4],w=t[b-4+1]),k=vr(w,y),C=t[b-14],I=t[b-14+1],M=t[b-32],R=t[b-32+1],x=E+I|0,L=v+C+Er(x,E)|0;L=(L=L+S+Er(x=x+k|0,k)|0)+M+Er(x=x+R|0,R)|0,t[b]=L,t[b+1]=x}for(var A=0;A<160;A+=2){L=t[A],x=t[A+1];var P=_r(n,r,i),j=_r(u,d,h),T=gr(n,u),N=gr(u,n),O=mr(a,p),D=mr(p,a),U=dr[A],B=dr[A+1],W=pr(a,o,c),q=pr(p,_,g),H=m+D|0,F=l+O+Er(H,m)|0;F=(F=(F=F+W+Er(H=H+q|0,q)|0)+U+Er(H=H+B|0,B)|0)+L+Er(H=H+x|0,x)|0;var z=N+j|0,V=T+P+Er(z,N)|0;l=c,m=g,c=o,g=_,o=a,_=p,a=s+F+Er(p=f+H|0,f)|0,s=i,f=h,i=r,h=d,r=n,d=u,n=F+V+Er(u=H+z|0,H)|0}this._al=this._al+u|0,this._bl=this._bl+d|0,this._cl=this._cl+h|0,this._dl=this._dl+f|0,this._el=this._el+p|0,this._fl=this._fl+_|0,this._gl=this._gl+g|0,this._hl=this._hl+m|0,this._ah=this._ah+n+Er(this._al,u)|0,this._bh=this._bh+r+Er(this._bl,d)|0,this._ch=this._ch+i+Er(this._cl,h)|0,this._dh=this._dh+s+Er(this._dl,f)|0,this._eh=this._eh+a+Er(this._el,p)|0,this._fh=this._fh+o+Er(this._fl,_)|0,this._gh=this._gh+c+Er(this._gl,g)|0,this._hh=this._hh+l+Er(this._hl,m)|0},fr.prototype._hash=function(){var e=ur.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Sr=fr,kr=e.inherits_browser.exports,Cr=Sr,Ir=En,Mr=Fe.exports.Buffer,Rr=new Array(160);function xr(){this.init(),this._w=Rr,Ir.call(this,128,112)}kr(xr,Cr),xr.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},xr.prototype._hash=function(){var e=Mr.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Lr=xr,Ar=yn.exports=function(e){e=e.toLowerCase();var t=Ar[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};Ar.sha=An,Ar.sha1=qn,Ar.sha224=or,Ar.sha256=er,Ar.sha384=Lr,Ar.sha512=Sr,Object.defineProperty(bn,"__esModule",{value:!0}),bn.WalletLinkSession=void 0;const Pr=yn.exports,jr=L,Tr="session:id",Nr="session:secret",Or="session:linked";class Dr{constructor(e,t,n,r){this._storage=e,this._id=t||(0,jr.randomBytesHex)(16),this._secret=n||(0,jr.randomBytesHex)(32),this._key=(new Pr.sha256).update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!r}static load(e){const t=e.getItem(Tr),n=e.getItem(Or),r=e.getItem(Nr);return t&&r?new Dr(e,t,r,"1"===n):null}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(Tr,this._id),this._storage.setItem(Nr,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Or,this._linked?"1":"0")}}bn.WalletLinkSession=Dr;var Ur={};Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.isDarkMode=Ur.isMobileWeb=Ur.getLocation=Ur.createQrUrl=void 0,Ur.createQrUrl=function(e,t,n,r,i,s){return`${n}/#/link?${new URLSearchParams({[r?"parent-id":"id"]:e,secret:t,server:n,v:i,chainId:s.toString()}).toString()}`},Ur.getLocation=function(){try{return function(){try{return null!==window.frameElement}catch(e){return!1}}()&&window.top?window.top.location:window.location}catch(e){return window.location}},Ur.isMobileWeb=function(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.userAgent)},Ur.isDarkMode=function(){var e,t;return null!==(t=null===(e=null===window||void 0===window?void 0:window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)&&void 0!==t&&t};var Br={},Wr={},qr={};Object.defineProperty(qr,"__esModule",{value:!0}),qr.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var Hr=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.injectCssReset=void 0;const Fr=Hr(qr);Wr.injectCssReset=function(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Fr.default)),document.documentElement.appendChild(e)};var zr={};function Vr(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Vr(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Kr(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Vr(e))&&(r&&(r+=" "),r+=t);return r}var Zr,Gr,$r,Yr,Jr,Qr,Xr,ei,ti,ni,ri,ii,si=Object.freeze({__proto__:null,clsx:Kr,default:Kr}),ai=e.getAugmentedNamespace(si),oi={},ci=[],li=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ui=Array.isArray;function di(e,t){for(var n in t)e[n]=t[n];return e}function hi(e){var t=e.parentNode;t&&t.removeChild(e)}function fi(e,t,n){var r,i,s,a={};for(s in t)"key"==s?r=t[s]:"ref"==s?i=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?Zr.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return pi(e,a,r,i,null)}function pi(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==i?++$r:i,__i:-1,__u:0};return null==i&&null!=Gr.vnode&&Gr.vnode(s),s}function _i(e){return e.children}function gi(e,t){this.props=e,this.context=t}function mi(e,t){if(null==t)return e.__?mi(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?mi(e):null}function bi(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return bi(e)}}function yi(e){(!e.__d&&(e.__d=!0)&&Jr.push(e)&&!wi.__r++||Qr!==Gr.debounceRendering)&&((Qr=Gr.debounceRendering)||Xr)(wi)}function wi(){var e,t,n,r,i,s,a,o;for(Jr.sort(ei);e=Jr.shift();)e.__d&&(t=Jr.length,r=void 0,s=(i=(n=e).__v).__e,a=[],o=[],n.__P&&((r=di({},i)).__v=i.__v+1,Gr.vnode&&Gr.vnode(r),Mi(n.__P,r,i,n.__n,void 0!==n.__P.ownerSVGElement,32&i.__u?[s]:null,a,null==s?mi(i):s,!!(32&i.__u),o),r.__v=i.__v,r.__.__k[r.__i]=r,Ri(a,r,o),r.__e!=s&&bi(r)),Jr.length>t&&Jr.sort(ei));wi.__r=0}function vi(e,t,n,r,i,s,a,o,c,l,u){var d,h,f,p,_,g=r&&r.__k||ci,m=t.length;for(n.__d=c,function(e,t,n){var r,i,s,a,o,c=t.length,l=n.length,u=l,d=0;for(e.__k=[],r=0;r<c;r++)a=r+d,null!=(i=e.__k[r]=null==(i=t[r])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?pi(null,i,null,null,null):ui(i)?pi(_i,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?pi(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=e,i.__b=e.__b+1,o=Si(i,n,a,u),i.__i=o,s=null,-1!==o&&(u--,(s=n[o])&&(s.__u|=131072)),null==s||null===s.__v?(-1==o&&d--,"function"!=typeof i.type&&(i.__u|=65536)):o!==a&&(o===a+1?d++:o>a?u>c-a?d+=o-a:d--:o<a?o==a-1&&(d=o-a):d=0,o!==r+d&&(i.__u|=65536))):(s=n[a])&&null==s.key&&s.__e&&0==(131072&s.__u)&&(s.__e==e.__d&&(e.__d=mi(s)),Ai(s,s,!1),n[a]=null,u--);if(u)for(r=0;r<l;r++)null!=(s=n[r])&&0==(131072&s.__u)&&(s.__e==e.__d&&(e.__d=mi(s)),Ai(s,s))}(n,t,g),c=n.__d,d=0;d<m;d++)null!=(f=n.__k[d])&&"boolean"!=typeof f&&"function"!=typeof f&&(h=-1===f.__i?oi:g[f.__i]||oi,f.__i=d,Mi(e,f,h,i,s,a,o,c,l,u),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&Li(h.ref,null,f),u.push(f.ref,f.__c||p,f)),null==_&&null!=p&&(_=p),65536&f.__u||h.__k===f.__k?(c&&!c.isConnected&&(c=mi(h)),c=Ei(f,c,e)):"function"==typeof f.type&&void 0!==f.__d?c=f.__d:p&&(c=p.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=c,n.__e=_}function Ei(e,t,n){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=Ei(r[i],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8===t.nodeType);return t}function Si(e,t,n,r){var i=e.key,s=e.type,a=n-1,o=n+1,c=t[n];if(null===c||c&&i==c.key&&s===c.type&&0==(131072&c.__u))return n;if(r>(null!=c&&0==(131072&c.__u)?1:0))for(;a>=0||o<t.length;){if(a>=0){if((c=t[a])&&0==(131072&c.__u)&&i==c.key&&s===c.type)return a;a--}if(o<t.length){if((c=t[o])&&0==(131072&c.__u)&&i==c.key&&s===c.type)return o;o++}}return-1}function ki(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||li.test(t)?n:n+"px"}function Ci(e,t,n,r,i){var s;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||ki(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||ki(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])s=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||"onFocusOut"===t||"onFocusIn"===t?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r?n.u=r.u:(n.u=ti,e.addEventListener(t,s?ri:ni,s)):e.removeEventListener(t,s?ri:ni,s);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Ii(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=ti++;else if(t.t<n.u)return;return n(Gr.event?Gr.event(t):t)}}}function Mi(e,t,n,r,i,s,a,o,c,l){var u,d,h,f,p,_,g,m,b,y,w,v,E,S,k,C=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(c=!!(32&n.__u),s=[o=t.__e=n.__e]),(u=Gr.__b)&&u(t);e:if("function"==typeof C)try{if(m=t.props,b=(u=C.contextType)&&r[u.__c],y=u?b?b.props.value:u.__:r,n.__c?g=(d=t.__c=n.__c).__=d.__E:("prototype"in C&&C.prototype.render?t.__c=d=new C(m,y):(t.__c=d=new gi(m,y),d.constructor=C,d.render=Pi),b&&b.sub(d),d.props=m,d.state||(d.state={}),d.context=y,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=di({},d.__s)),di(d.__s,C.getDerivedStateFromProps(m,d.__s))),f=d.props,p=d.state,d.__v=t,h)null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==C.getDerivedStateFromProps&&m!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,y),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,y)||t.__v===n.__v)){for(t.__v!==n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),w=0;w<d._sb.length;w++)d.__h.push(d._sb[w]);d._sb=[],d.__h.length&&a.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,y),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(f,p,_)}))}if(d.context=y,d.props=m,d.__P=e,d.__e=!1,v=Gr.__r,E=0,"prototype"in C&&C.prototype.render){for(d.state=d.__s,d.__d=!1,v&&v(t),u=d.render(d.props,d.state,d.context),S=0;S<d._sb.length;S++)d.__h.push(d._sb[S]);d._sb=[]}else do{d.__d=!1,v&&v(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++E<25);d.state=d.__s,null!=d.getChildContext&&(r=di(di({},r),d.getChildContext())),h||null==d.getSnapshotBeforeUpdate||(_=d.getSnapshotBeforeUpdate(f,p)),vi(e,ui(k=null!=u&&u.type===_i&&null==u.key?u.props.children:u)?k:[k],t,n,r,i,s,a,o,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),g&&(d.__E=d.__=null)}catch(e){t.__v=null,c||null!=s?(t.__e=o,t.__u|=c?160:32,s[s.indexOf(o)]=null):(t.__e=n.__e,t.__k=n.__k),Gr.__e(e,t,n)}else null==s&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=xi(n.__e,t,n,r,i,s,a,c,l);(u=Gr.diffed)&&u(t)}function Ri(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)Li(n[r],n[++r],n[++r]);Gr.__c&&Gr.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Gr.__e(e,t.__v)}}))}function xi(e,t,n,r,i,s,a,o,c){var l,u,d,h,f,p,_,g=n.props,m=t.props,b=t.type;if("svg"===b&&(i=!0),null!=s)for(l=0;l<s.length;l++)if((f=s[l])&&"setAttribute"in f==!!b&&(b?f.localName===b:3===f.nodeType)){e=f,s[l]=null;break}if(null==e){if(null===b)return document.createTextNode(m);e=i?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,m.is&&m),s=null,o=!1}if(null===b)g===m||o&&e.data===m||(e.data=m);else{if(s=s&&Zr.call(e.childNodes),g=n.props||oi,!o&&null!=s)for(g={},l=0;l<e.attributes.length;l++)g[(f=e.attributes[l]).name]=f.value;for(l in g)f=g[l],"children"==l||("dangerouslySetInnerHTML"==l?d=f:"key"===l||l in m||Ci(e,l,null,f,i));for(l in m)f=m[l],"children"==l?h=f:"dangerouslySetInnerHTML"==l?u=f:"value"==l?p=f:"checked"==l?_=f:"key"===l||o&&"function"!=typeof f||g[l]===f||Ci(e,l,f,g[l],i);if(u)o||d&&(u.__html===d.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),vi(e,ui(h)?h:[h],t,n,r,i&&"foreignObject"!==b,s,a,s?s[0]:n.__k&&mi(n,0),o,c),null!=s)for(l=s.length;l--;)null!=s[l]&&hi(s[l]);o||(l="value",void 0!==p&&(p!==e[l]||"progress"===b&&!p||"option"===b&&p!==g[l])&&Ci(e,l,p,g[l],!1),l="checked",void 0!==_&&_!==e[l]&&Ci(e,l,_,g[l],!1))}return e}function Li(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Gr.__e(e,n)}}function Ai(e,t,n){var r,i;if(Gr.unmount&&Gr.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Li(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Gr.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Ai(r[i],t,n||"function"!=typeof e.type);n||null==e.__e||hi(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function Pi(e,t,n){return this.constructor(e,n)}function ji(e,t,n){var r,i,s,a;Gr.__&&Gr.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,s=[],a=[],Mi(t,e=(!r&&n||t).__k=fi(_i,null,[e]),i||oi,oi,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?Zr.call(t.childNodes):null,s,!r&&n?n:i?i.__e:t.firstChild,r,a),Ri(s,e,a)}Zr=ci.slice,Gr={__e:function(e,t,n,r){for(var i,s,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&null!=s.getDerivedStateFromError&&(i.setState(s.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(t){e=t}throw e}},$r=0,Yr=function(e){return null!=e&&null==e.constructor},gi.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=di({},this.state),"function"==typeof e&&(e=e(di({},n),this.props)),e&&di(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),yi(this))},gi.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),yi(this))},gi.prototype.render=_i,Jr=[],Xr="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ei=function(e,t){return e.__v.__b-t.__v.__b},wi.__r=0,ti=0,ni=Ii(!1),ri=Ii(!0),ii=0;var Ti,Ni,Oi,Di,Ui=Object.freeze({__proto__:null,Component:gi,Fragment:_i,cloneElement:function(e,t,n){var r,i,s,a,o=di({},e.props);for(s in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)"key"==s?r=t[s]:"ref"==s?i=t[s]:o[s]=void 0===t[s]&&void 0!==a?a[s]:t[s];return arguments.length>2&&(o.children=arguments.length>3?Zr.call(arguments,2):n),pi(e.type,o,r||e.key,i||e.ref,null)},createContext:function(e,t){var n={__c:t="__cC"+ii++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,yi(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n},createElement:fi,createRef:function(){return{current:null}},h:fi,hydrate:function e(t,n){ji(t,n,e)},get isValidElement(){return Yr},get options(){return Gr},render:ji,toChildArray:function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(ui(t)?t.some((function(t){e(t,n)})):n.push(t)),n}}),Bi=e.getAugmentedNamespace(Ui),Wi=0,qi=[],Hi=[],Fi=Gr,zi=Fi.__b,Vi=Fi.__r,Ki=Fi.diffed,Zi=Fi.__c,Gi=Fi.unmount,$i=Fi.__;function Yi(e,t){Fi.__h&&Fi.__h(Ni,e,Wi||t),Wi=0;var n=Ni.__H||(Ni.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Hi}),n.__[e]}function Ji(e){return Wi=1,Qi(os,e)}function Qi(e,t,n){var r=Yi(Ti++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):os(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Ni,!Ni.u)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter((function(e){return!!e.__c}));if(i.every((function(e){return!e.__N})))return!s||s.call(this,e,t,n);var a=!1;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}})),!(!a&&r.__c.props===e)&&(!s||s.call(this,e,t,n))};Ni.u=!0;var s=Ni.shouldComponentUpdate,a=Ni.componentWillUpdate;Ni.componentWillUpdate=function(e,t,n){if(this.__e){var r=s;s=void 0,i(e,t,n),s=r}a&&a.call(this,e,t,n)},Ni.shouldComponentUpdate=i}return r.__N||r.__}function Xi(e,t){var n=Yi(Ti++,4);!Fi.__s&&as(n.__H,t)&&(n.__=e,n.i=t,Ni.__h.push(n))}function es(e,t){var n=Yi(Ti++,7);return as(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function ts(){for(var e;e=qi.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(is),e.__H.__h.forEach(ss),e.__H.__h=[]}catch(t){e.__H.__h=[],Fi.__e(t,e.__v)}}Fi.__b=function(e){Ni=null,zi&&zi(e)},Fi.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),$i&&$i(e,t)},Fi.__r=function(e){Vi&&Vi(e),Ti=0;var t=(Ni=e.__c).__H;t&&(Oi===Ni?(t.__h=[],Ni.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Hi,e.__N=e.i=void 0}))):(t.__h.forEach(is),t.__h.forEach(ss),t.__h=[],Ti=0)),Oi=Ni},Fi.diffed=function(e){Ki&&Ki(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==qi.push(t)&&Di===Fi.requestAnimationFrame||((Di=Fi.requestAnimationFrame)||rs)(ts)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Hi&&(e.__=e.__V),e.i=void 0,e.__V=Hi}))),Oi=Ni=null},Fi.__c=function(e,t){t.some((function(e){try{e.__h.forEach(is),e.__h=e.__h.filter((function(e){return!e.__||ss(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Fi.__e(n,e.__v)}})),Zi&&Zi(e,t)},Fi.unmount=function(e){Gi&&Gi(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{is(e)}catch(e){t=e}})),n.__H=void 0,t&&Fi.__e(t,n.__v))};var ns="function"==typeof requestAnimationFrame;function rs(e){var t,n=function(){clearTimeout(r),ns&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ns&&(t=requestAnimationFrame(n))}function is(e){var t=Ni,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Ni=t}function ss(e){var t=Ni;e.__c=e.__(),Ni=t}function as(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function os(e,t){return"function"==typeof t?t(e):t}var cs=Object.freeze({__proto__:null,useCallback:function(e,t){return Wi=8,es((function(){return e}),t)},useContext:function(e){var t=Ni.context[e.__c],n=Yi(Ti++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Ni)),t.props.value):e.__},useDebugValue:function(e,t){Fi.useDebugValue&&Fi.useDebugValue(t?t(e):e)},useEffect:function(e,t){var n=Yi(Ti++,3);!Fi.__s&&as(n.__H,t)&&(n.__=e,n.i=t,Ni.__H.__h.push(n))},useErrorBoundary:function(e){var t=Yi(Ti++,10),n=Ji();return t.__=e,Ni.componentDidCatch||(Ni.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]},useId:function(){var e=Yi(Ti++,11);if(!e.__){for(var t=Ni.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__},useImperativeHandle:function(e,t,n){Wi=6,Xi((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==n?n:n.concat(e))},useLayoutEffect:Xi,useMemo:es,useReducer:Qi,useRef:function(e){return Wi=5,es((function(){return{current:e}}),[])},useState:Ji}),ls=e.getAugmentedNamespace(cs),us={};Object.defineProperty(us,"__esModule",{value:!0}),us.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",function(t){var n=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const r=n(ai),i=Bi,s=ls,a=Ur,o=n(us);t.Snackbar=class{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,a.isDarkMode)()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const t=this.nextItemKey++;return this.items.set(t,e),this.render(),()=>{this.items.delete(t),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,i.render)((0,i.h)("div",null,(0,i.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map((([e,n])=>(0,i.h)(t.SnackbarInstance,Object.assign({},n,{key:e})))))),this.root)}};t.SnackbarContainer=e=>(0,i.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,i.h)("style",null,o.default),(0,i.h)("div",{class:"-cbwsdk-snackbar"},e.children));t.SnackbarInstance=({autoExpand:e,message:t,menuItems:n})=>{const[a,o]=(0,s.useState)(!0),[c,l]=(0,s.useState)(null!=e&&e);(0,s.useEffect)((()=>{const e=[window.setTimeout((()=>{o(!1)}),1),window.setTimeout((()=>{l(!0)}),1e4)];return()=>{e.forEach(window.clearTimeout)}}));return(0,i.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",a&&"-cbwsdk-snackbar-instance-hidden",c&&"-cbwsdk-snackbar-instance-expanded")},(0,i.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:()=>{l(!c)}},(0,i.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,i.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),(0,i.h)("div",{class:"-gear-container"},!c&&(0,i.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,i.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=",class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&(0,i.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map(((e,t)=>(0,i.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:e.onClick,key:t},(0,i.h)("svg",{width:e.svgWidth,height:e.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.h)("path",{"fill-rule":e.defaultFillRule,"clip-rule":e.defaultClipRule,d:e.path,fill:"#AAAAAA"})),(0,i.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},e.info))))))}}(zr),Object.defineProperty(Br,"__esModule",{value:!0}),Br.WalletLinkRelayUI=void 0;const ds=Wr,hs=zr;Br.WalletLinkRelayUI=class{constructor(){this.attached=!1,this.snackbar=new hs.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.snackbar.attach(t),this.attached=!0,(0,ds.injectCssReset)()}showConnecting(e){let t;return t=e.isUnlinkedErrorState?{autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:{message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}};var fs={},ps={},_s={};Object.defineProperty(_s,"__esModule",{value:!0}),_s.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var gs=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ps,"__esModule",{value:!0}),ps.RedirectDialog=void 0;const ms=gs(ai),bs=Bi,ys=Wr,ws=zr,vs=Ur,Es=gs(_s);ps.RedirectDialog=class{constructor(){this.root=null,this.darkMode=(0,vs.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,ys.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,bs.render)(null,this.root),e&&(0,bs.render)((0,bs.h)(Ss,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}};const Ss=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:i})=>{const s=n?"dark":"light";return(0,bs.h)(ws.SnackbarContainer,{darkMode:n},(0,bs.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,bs.h)("style",null,Es.default),(0,bs.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),(0,bs.h)("div",{class:(0,ms.default)("-cbwsdk-redirect-dialog-box",s)},(0,bs.h)("p",null,e),(0,bs.h)("button",{onClick:r},t))))};var ks={};Object.defineProperty(ks,"__esModule",{value:!0}),ks.CBW_MOBILE_DEEPLINK_URL=ks.WALLETLINK_URL=ks.CB_KEYS_URL=void 0,ks.CB_KEYS_URL="https://keys.coinbase.com/connect",ks.WALLETLINK_URL="https://www.walletlink.org",ks.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink",Object.defineProperty(fs,"__esModule",{value:!0}),fs.WLMobileRelayUI=void 0;const Cs=ps,Is=Ur,Ms=ks;fs.WLMobileRelayUI=class{constructor(){this.attached=!1,this.redirectDialog=new Cs.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const t=new URL(Ms.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,Is.getLocation)().href),e&&t.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=t.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout((()=>{this.redirectToCoinbaseWallet(e)}),99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}},Object.defineProperty(an,"__esModule",{value:!0}),an.WalletLinkRelay=void 0;const Rs=on,xs=nn,Ls=rn,As=bn,Ps=E,js=Ur,Ts=Br,Ns=fs,Os=u,Ds=L,Us=Q;class Bs{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,js.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=e=>{this.isLinked=e;const t=this.storage.getItem(xs.LOCAL_STORAGE_ADDRESSES_KEY);if(e&&(this._session.linked=e),this.isUnlinkedErrorState=!1,t){const n=t.split(" "),r="true"===this.storage.getItem("IsStandaloneSigning");""===n[0]||e||!this._session.linked||r||(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(e,t)=>{this.storage.setItem(e,t)},this.chainUpdated=(e,t)=>{this.chainCallbackParams.chainId===e&&this.chainCallbackParams.jsonRpcUrl===t||(this.chainCallbackParams={chainId:e,jsonRpcUrl:t},this.chainCallback&&this.chainCallback(e,t))},this.accountUpdated=e=>{this.accountsCallback&&this.accountsCallback([e]),Bs.accountRequestCallbackIds.size>0&&(Array.from(Bs.accountRequestCallbackIds.values()).forEach((t=>{const n={type:"WEB3_RESPONSE",id:t,response:{method:"requestEthereumAccounts",result:[e]}};this.invokeCallback(Object.assign(Object.assign({},n),{id:t}))})),Bs.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:t,ui:n,connection:r}=this.subscribe();this._session=t,this.connection=r,this.relayEventManager=new Ls.RelayEventManager,this.ui=n}subscribe(){const e=As.WalletLinkSession.load(this.storage)||new As.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,n=new Rs.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),r=this.isMobileWeb?new Ns.WLMobileRelayUI:new Ts.WalletLinkRelayUI;return n.connect(),{session:e,ui:r,connection:n}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise((e=>setTimeout((()=>e(null)),1e3)))]).then((()=>{this.connection.destroy();const e=As.WalletLinkSession.load(this.storage);(null==e?void 0:e.id)===this._session.id&&Us.ScopedLocalStorage.clearAll(),document.location.reload()})).catch((e=>{}))}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,n,r){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,Ds.hexStringFromBuffer)(e,!0),address:t,addPrefix:n,typedDataJson:r||null}})}ethereumAddressFromSignedMessage(e,t,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,Ds.hexStringFromBuffer)(e,!0),signature:(0,Ds.hexStringFromBuffer)(t,!0),addPrefix:n}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,Ds.bigIntStringFromBigInt)(e.weiValue),data:(0,Ds.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,Ds.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,Ds.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,Ds.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,Ds.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,Ds.bigIntStringFromBigInt)(e.weiValue),data:(0,Ds.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,Ds.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,Ds.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,Ds.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,Ds.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,Ds.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getWalletLinkSession(){return this._session}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null;const n=(0,Ds.randomBytesHex)(8),r=r=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,r),null==t||t()};return new Promise(((i,s)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:r,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,(e=>{if(null==t||t(),(0,Ps.isErrorResponse)(e))return s(new Error(e.errorMessage));i(e)})),this.publishWeb3RequestEvent(n,e)}))}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const n={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",n,!0).then((e=>{})).catch((e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n.id,response:{method:t.method,errorMessage:e.message}})})),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof Ns.WLMobileRelayUI)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",(()=>{window.addEventListener("focus",(()=>{this.connection.checkUnseenEvents()}),{once:!0})}),{once:!0}),this.ui.openCoinbaseWalletDeeplink()}}publishWeb3RequestCanceledEvent(e){const t={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",t,!1).then()}publishEvent(e,t,n){return this.connection.publishEvent(e,t,n)}handleWeb3ResponseMessage(e){const{response:t}=e;if("requestEthereumAccounts"===t.method)return Bs.accountRequestCallbackIds.forEach((t=>this.invokeCallback(Object.assign(Object.assign({},e),{id:t})))),void Bs.accountRequestCallbackIds.clear();this.invokeCallback(e)}handleErrorResponse(e,t,n){var r;const i=null!==(r=null==n?void 0:n.message)&&void 0!==r?r:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:i}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,Ds.randomBytesHex)(8);return new Promise(((n,r)=>{this.relayEventManager.callbacks.set(t,(e=>{if((0,Ps.isErrorResponse)(e))return r(new Error(e.errorMessage));n(e)})),Bs.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)}))}watchAsset(e,t,n,r,i,s){const a={method:"watchAsset",params:{type:e,options:{address:t,symbol:n,decimals:r,image:i},chainId:s}};let o=null;const c=(0,Ds.randomBytesHex)(8),l=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,e),null==o||o()};return o=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise(((e,t)=>{this.relayEventManager.callbacks.set(c,(n=>{if(null==o||o(),(0,Ps.isErrorResponse)(n))return t(new Error(n.errorMessage));e(n)})),this.publishWeb3RequestEvent(c,a)}))}addEthereumChain(e,t,n,r,i,s){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:r,chainName:i,iconUrls:n,nativeCurrency:s}};let o=null;const c=(0,Ds.randomBytesHex)(8),l=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,e),null==o||o()};return o=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise(((e,t)=>{this.relayEventManager.callbacks.set(c,(n=>{if(null==o||o(),(0,Ps.isErrorResponse)(n))return t(new Error(n.errorMessage));e(n)})),this.publishWeb3RequestEvent(c,a)}))}switchEthereumChain(e,t){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},r=(0,Ds.randomBytesHex)(8);return new Promise(((e,t)=>{this.relayEventManager.callbacks.set(r,(n=>(0,Ps.isErrorResponse)(n)&&n.errorCode?t(Os.standardErrors.provider.custom({code:n.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."})):(0,Ps.isErrorResponse)(n)?t(new Error(n.errorMessage)):void e(n))),this.publishWeb3RequestEvent(r,n)}))}}an.WalletLinkRelay=Bs,Bs.accountRequestCallbackIds=new Set;var Ws=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(be,"__esModule",{value:!0}),be.WalletLinkSigner=void 0;const qs=Ws(tn),Hs=nn,Fs=rn,zs=E,Vs=an,Ks=ks,Zs=u,Gs=L,$s=Q,Ys="DefaultChainId",Js="DefaultJsonRpcUrl";be.WalletLinkSigner=class{constructor(e){var t,n;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:r,appLogoUrl:i}=e.metadata;this._appName=r,this._appLogoUrl=i,this._storage=new $s.ScopedLocalStorage("walletlink",Ks.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new Fs.RelayEventManager,this._jsonRpcUrlFromOpts="";const s=this._storage.getItem(Hs.LOCAL_STORAGE_ADDRESSES_KEY);if(s){const e=s.split(" ");""!==e[0]&&(this._addresses=e.map((e=>(0,Gs.ensureAddressString)(e))),null===(t=this.updateListener)||void 0===t||t.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(Ys)&&(null===(n=this.updateListener)||void 0===n||n.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:n}=e.getWalletLinkSession();return{id:t,secret:n}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return null!==(e=this._storage.getItem(Js))&&void 0!==e?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(Js,e)}updateProviderInfo(e,t){var n;this.jsonRpcUrl=e;const r=this.getChainId();this._storage.setItem(Ys,t.toString(10));!((0,Gs.ensureIntNumber)(t)!==r)&&this.hasMadeFirstChainChangedEmission||(null===(n=this.updateListener)||void 0===n||n.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,n,r,i,s){const a=this.initializeRelay(),o=await a.watchAsset(e,t,n,r,i,null==s?void 0:s.toString());return!(0,zs.isErrorResponse)(o)&&!!o.result}async addEthereumChain(e,t,n,r,i,s){var a,o;if((0,Gs.ensureIntNumber)(e)===this.getChainId())return!1;const c=this.initializeRelay();this._isAuthorized()||await c.requestEthereumAccounts();const l=await c.addEthereumChain(e.toString(),t,i,n,r,s);return!(0,zs.isErrorResponse)(l)&&(!0===(null===(a=l.result)||void 0===a?void 0:a.isApproved)&&this.updateProviderInfo(t[0],e),!0===(null===(o=l.result)||void 0===o?void 0:o.isApproved))}async switchEthereumChain(e){const t=this.initializeRelay(),n=await t.switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,zs.isErrorResponse)(n)){if(!n.errorCode)return;throw n.errorCode===Zs.standardErrorCodes.provider.unsupportedChain?Zs.standardErrors.provider.unsupportedChain():Zs.standardErrors.provider.custom({message:n.errorMessage,code:n.errorCode})}const r=n.result;r.isApproved&&r.rpcUrl.length>0&&this.updateProviderInfo(r.rpcUrl,e)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(e){try{return this._request(e).catch((e=>{throw e}))}catch(e){return Promise.reject(e)}}async _request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw Zs.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw Zs.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw Zs.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const r=void 0===n?[]:n,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:r,jsonrpc:"2.0",id:i})).result}_setAddresses(e,t){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const r=e.map((e=>(0,Gs.ensureAddressString)(e)));JSON.stringify(r)!==JSON.stringify(this._addresses)&&(this._addresses=r,null===(n=this.updateListener)||void 0===n||n.onAccountsUpdate({accounts:r,source:"wallet"}),this._storage.setItem(Hs.LOCAL_STORAGE_ADDRESSES_KEY,r.join(" ")))}_sendRequestAsync(e){return new Promise(((t,n)=>{try{const n=this._handleSynchronousMethods(e);if(void 0!==n)return t({jsonrpc:"2.0",id:e.id,result:n})}catch(e){return n(e)}this._handleAsynchronousMethods(e).then((n=>n&&t(Object.assign(Object.assign({},n),{id:e.id})))).catch((e=>n(e)))}))}_handleSynchronousMethods(e){const{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,n=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(n);case"eth_ecRecover":return this._eth_ecRecover(n);case"personal_sign":return this._personal_sign(n);case"personal_ecRecover":return this._personal_ecRecover(n);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(n);case"eth_signTypedData_v2":default:return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(n);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(n);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(n);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(n);case"wallet_watchAsset":return this._wallet_watchAsset(n)}}_isKnownAddress(e){try{const t=(0,Gs.ensureAddressString)(e);return this._addresses.map((e=>(0,Gs.ensureAddressString)(e))).includes(t)}catch(e){}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,Gs.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);return{fromAddress:t,toAddress:e.to?(0,Gs.ensureAddressString)(e.to):null,weiValue:null!=e.value?(0,Gs.ensureBigInt)(e.value):BigInt(0),data:e.data?(0,Gs.ensureBuffer)(e.data):Buffer.alloc(0),nonce:null!=e.nonce?(0,Gs.ensureIntNumber)(e.nonce):null,gasPriceInWei:null!=e.gasPrice?(0,Gs.ensureBigInt)(e.gasPrice):null,maxFeePerGas:null!=e.maxFeePerGas?(0,Gs.ensureBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:null!=e.maxPriorityFeePerGas?(0,Gs.ensureBigInt)(e.maxPriorityFeePerGas):null,gasLimit:null!=e.gas?(0,Gs.ensureBigInt)(e.gas):null,chainId:e.chainId?(0,Gs.ensureIntNumber)(e.chainId):this.getChainId()}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw Zs.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw Zs.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,n,r){this._ensureKnownAddress(t);try{const i=this.initializeRelay(),s=await i.signEthereumMessage(e,t,n,r);if((0,zs.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Zs.standardErrors.provider.userRejectedRequest("User denied message signature");throw e}}async _ethereumAddressFromSignedMessage(e,t,n){const r=this.initializeRelay(),i=await r.ethereumAddressFromSignedMessage(e,t,n);if((0,zs.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,Gs.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(Ys);if(!e)return(0,Gs.ensureIntNumber)(1);const t=parseInt(e,10);return(0,Gs.ensureIntNumber)(t)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let e;try{const t=this.initializeRelay();if(e=await t.requestEthereumAccounts(),(0,zs.isErrorResponse)(e))throw new Error(e.errorMessage)}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Zs.standardErrors.provider.userRejectedRequest("User denied account authorization");throw e}if(!e.result)throw new Error("accounts received is empty");return this._setAddresses(e.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const t=(0,Gs.ensureAddressString)(e[0]),n=(0,Gs.ensureBuffer)(e[1]);return this._signEthereumMessage(n,t,!1)}_eth_ecRecover(e){const t=(0,Gs.ensureBuffer)(e[0]),n=(0,Gs.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,Gs.ensureBuffer)(e[0]),n=(0,Gs.ensureAddressString)(e[1]);return this._signEthereumMessage(t,n,!0)}_personal_ecRecover(e){const t=(0,Gs.ensureBuffer)(e[0]),n=(0,Gs.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=this.initializeRelay(),n=await e.signEthereumTransaction(t);if((0,zs.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Zs.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw e}}async _eth_sendRawTransaction(e){const t=(0,Gs.ensureBuffer)(e[0]),n=this.initializeRelay(),r=await n.submitEthereumTransaction(t,this.getChainId());if((0,zs.isErrorResponse)(r))throw new Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=this.initializeRelay(),n=await e.signAndSubmitEthereumTransaction(t);if((0,zs.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Zs.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw e}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,Gs.ensureParsedJSONObject)(e[0]),n=(0,Gs.ensureAddressString)(e[1]);this._ensureKnownAddress(n);const r=qs.default.hashForSignTypedDataLegacy({data:t}),i=JSON.stringify(t,null,2);return this._signEthereumMessage(r,n,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,Gs.ensureAddressString)(e[0]),n=(0,Gs.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const r=qs.default.hashForSignTypedData_v3({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(r,t,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,Gs.ensureAddressString)(e[0]),n=(0,Gs.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const r=qs.default.hashForSignTypedData_v4({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(r,t,!1,i)}async _wallet_addEthereumChain(e){var t,n,r,i;const s=e[0];if(0===(null===(t=s.rpcUrls)||void 0===t?void 0:t.length))return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!s.chainName||""===s.chainName.trim())throw Zs.standardErrors.rpc.invalidParams("chainName is a required field");if(!s.nativeCurrency)throw Zs.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const a=parseInt(s.chainId,16);return await this.addEthereumChain(a,null!==(n=s.rpcUrls)&&void 0!==n?n:[],null!==(r=s.blockExplorerUrls)&&void 0!==r?r:[],s.chainName,null!==(i=s.iconUrls)&&void 0!==i?i:[],s.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const t=Array.isArray(e)?e[0]:e;if(!t.type)throw Zs.standardErrors.rpc.invalidParams("Type is required");if("ERC20"!==(null==t?void 0:t.type))throw Zs.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(null==t?void 0:t.options))throw Zs.standardErrors.rpc.invalidParams("Options are required");if(!(null==t?void 0:t.options.address))throw Zs.standardErrors.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:r,symbol:i,image:s,decimals:a}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,r,i,a,s,n)}}initializeRelay(){if(!this._relay){const e=new Vs.WalletLinkRelay({linkAPIUrl:Ks.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback(((e,t)=>this._setAddresses(e,t))),e.setChainCallback(((e,t)=>{this.updateProviderInfo(t,parseInt(e,10))})),this._relay=e}return this._relay}};var Qs={};Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.checkErrorForInvalidRequestArgs=Qs.getCoinbaseInjectedProvider=Qs.getCoinbaseInjectedSigner=Qs.fetchRPCRequest=void 0;const Xs=S,ea=u;function ta(){return globalThis.coinbaseWalletSigner}Qs.fetchRPCRequest=async function(e,t){if(!t.rpcUrl)throw ea.standardErrors.rpc.internal("No RPC URL set for chain");const n=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),r=await window.fetch(t.rpcUrl,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Xs.LIB_VERSION}});return(await r.json()).result},Qs.getCoinbaseInjectedSigner=ta,Qs.getCoinbaseInjectedProvider=function({metadata:e,preference:t}){var n,r,i;const s=globalThis;if("smartWalletOnly"!==t.options){if(ta())return;const t=s.coinbaseWalletExtension;if(t){const{appName:r,appLogoUrl:i,appChainIds:s}=e;return null===(n=t.setAppInfo)||void 0===n||n.call(t,r,i,s),t}}const a=null!==(r=s.ethereum)&&void 0!==r?r:null===(i=s.top)||void 0===i?void 0:i.ethereum;if(null==a?void 0:a.isCoinbaseBrowser)return a},Qs.checkErrorForInvalidRequestArgs=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return ea.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;return"string"!=typeof t||0===t.length?ea.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e}):void 0===n||Array.isArray(n)||"object"==typeof n&&null!==n?void 0:ea.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e})},Object.defineProperty(z,"__esModule",{value:!0}),z.createSigner=z.fetchSignerType=z.storeSignerType=z.loadSignerType=void 0;const na=V,ra=be,ia=u,sa=Qs,aa="SignerType",oa=new Q.ScopedLocalStorage("CBWSDK","SignerConfigurator");z.loadSignerType=function(){return oa.getItem(aa)},z.storeSignerType=function(e){oa.setItem(aa,e)},z.fetchSignerType=async function(e){const{communicator:t,metadata:n}=e;(async function(e,t){await e.onMessage((({event:e})=>"WalletLinkSessionRequest"===e));const n=new ra.WalletLinkSigner({metadata:t});e.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})})(t,n).catch((()=>{}));const r={id:crypto.randomUUID(),event:"selectSignerType",data:e.preference},{data:i}=await t.postRequestAndWaitForResponse(r);return i},z.createSigner=function(e){const{signerType:t,metadata:n,communicator:r,updateListener:i}=e;switch(t){case"scw":return new na.SCWSigner({metadata:n,updateListener:i,communicator:r});case"walletlink":return new ra.WalletLinkSigner({metadata:n,updateListener:i});case"extension":{const e=(0,sa.getCoinbaseInjectedSigner)();if(!e)throw ia.standardErrors.rpc.internal("injected signer not found");return e}}};var ca={},la={};Object.defineProperty(la,"__esModule",{value:!0}),la.closePopup=la.openPopup=void 0;const ua=u;la.openPopup=function(e){const t=(window.innerWidth-420)/2+window.screenX,n=(window.innerHeight-540)/2+window.screenY,r=window.open(e,"Smart Wallet",`width=420, height=540, left=${t}, top=${n}`);if(null==r||r.focus(),!r)throw ua.standardErrors.rpc.internal("Pop up window failed to open");return r},la.closePopup=function(e){e&&!e.closed&&e.close()},Object.defineProperty(ca,"__esModule",{value:!0}),ca.Communicator=void 0;const da=S,ha=la,fa=ks,pa=u;ca.Communicator=class{constructor(e=fa.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async e=>{(await this.waitForPopupLoaded()).postMessage(e,this.url.origin)},this.postRequestAndWaitForResponse=async e=>{const t=this.onMessage((({requestId:t})=>t===e.id));return this.postMessage(e),await t},this.onMessage=async e=>new Promise(((t,n)=>{const r=n=>{if(n.origin!==this.url.origin)return;const i=n.data;e(i)&&(t(i),window.removeEventListener("message",r),this.listeners.delete(r))};window.addEventListener("message",r),this.listeners.set(r,{reject:n})})),this.disconnect=()=>{(0,ha.closePopup)(this.popup),this.popup=null,this.listeners.forEach((({reject:e},t)=>{e(pa.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",t)})),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?this.popup:(this.popup=(0,ha.openPopup)(this.url),this.onMessage((({event:e})=>"PopupUnload"===e)).then(this.disconnect).catch((()=>{})),this.onMessage((({event:e})=>"PopupLoaded"===e)).then((e=>{this.postMessage({requestId:e.id,data:{version:da.LIB_VERSION}})})).then((()=>{if(!this.popup)throw pa.standardErrors.rpc.internal();return this.popup}))),this.url=new URL(e)}};var _a={};Object.defineProperty(_a,"__esModule",{value:!0}),_a.determineMethodCategory=void 0;const ga={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};_a.determineMethodCategory=function(e){for(const t in ga){const n=t;if(ga[n].includes(e))return n}};var ma=e.commonjsGlobal&&e.commonjsGlobal.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},ba=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoinbaseWalletProvider=void 0;const ya=ba(e.eventemitter3.exports),wa=u,va=v,Ea=R,Sa=L,ka=z,Ca=Qs,Ia=ca,Ma=_a,Ra=Q;class xa extends ya.default{constructor(e){var t,n,{metadata:r}=e,i=e.preference,{keysUrl:s}=i,a=ma(i,["keysUrl"]);super(),this.accounts=[],this.handlers={handshake:async e=>{try{if(this.connected)return this.emit("connect",{chainId:(0,Sa.hexStringFromIntNumber)((0,Ea.IntNumber)(this.chain.id))}),this.accounts;const e=await this.requestSignerSelection(),t=this.initSigner(e),n=await t.handshake();return this.signer=t,(0,ka.storeSignerType)(e),this.emit("connect",{chainId:(0,Sa.hexStringFromIntNumber)((0,Ea.IntNumber)(this.chain.id))}),n}catch(e){throw this.handleUnauthorizedError(e),e}},sign:async e=>{if(!this.connected||!this.signer)throw wa.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(e)}catch(e){throw this.handleUnauthorizedError(e),e}},fetch:e=>(0,Ca.fetchRPCRequest)(e,this.chain),state:e=>{const t=()=>{if(this.connected)return this.accounts;throw wa.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(e.method){case"eth_chainId":case"net_version":return this.chain.id;case"eth_accounts":return t();case"eth_coinbase":return t()[0];default:return this.handlers.unsupported(e)}},deprecated:({method:e})=>{throw wa.standardErrors.rpc.methodNotSupported(`Method ${e} is deprecated.`)},unsupported:({method:e})=>{throw wa.standardErrors.rpc.methodNotSupported(`Method ${e} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:e,source:t})=>{(0,Sa.areAddressArraysEqual)(this.accounts,e)||(this.accounts=e,"storage"!==t&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:e,source:t})=>{e.id===this.chain.id&&e.rpcUrl===this.chain.rpcUrl||(this.chain=e,"storage"!==t&&this.emit("chainChanged",(0,Sa.hexStringFromIntNumber)((0,Ea.IntNumber)(e.id))))}},this.metadata=r,this.preference=a,this.communicator=new Ia.Communicator(s),this.chain={id:null!==(n=null===(t=r.appChainIds)||void 0===t?void 0:t[0])&&void 0!==n?n:1};const o=(0,ka.loadSignerType)();this.signer=o?this.initSigner(o):null}get connected(){return this.accounts.length>0}async request(e){var t;try{const n=(0,Ca.checkErrorForInvalidRequestArgs)(e);if(n)throw n;const r=null!==(t=(0,Ma.determineMethodCategory)(e.method))&&void 0!==t?t:"fetch";return this.handlers[r](e)}catch(t){return Promise.reject((0,va.serializeError)(t,e.method))}}handleUnauthorizedError(e){e.code===wa.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},Ra.ScopedLocalStorage.clearAll(),this.emit("disconnect",wa.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,ka.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(e){return(0,ka.createSigner)({signerType:e,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}l.CoinbaseWalletProvider=xa,Object.defineProperty(o,"__esModule",{value:!0}),o.CoinbaseWalletSDK=void 0;const La=c,Aa=l,Pa=Q,ja=S,Ta=L,Na=Qs;o.CoinbaseWalletSDK=class{constructor(e){this.metadata={appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||(0,Ta.getFavicon)(),appChainIds:e.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(e={options:"all"}){var t;const n={metadata:this.metadata,preference:e};return null!==(t=(0,Na.getCoinbaseInjectedProvider)(n))&&void 0!==t?t:new Aa.CoinbaseWalletProvider(n)}getCoinbaseWalletLogo(e,t=240){return(0,La.walletLogo)(e,t)}storeLatestVersion(){new Pa.ScopedLocalStorage("CBWSDK").setItem("VERSION",ja.LIB_VERSION)}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CoinbaseWalletSDK=void 0;const t=o;e.default=t.CoinbaseWalletSDK;var n=o;Object.defineProperty(e,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}})}(a),exports.default=function({chainId:t,rpcUrl:n,appName:r,appLogoUrl:i,darkMode:s},o){return e.__awaiter(this,void 0,void 0,(function*(){if(window.ethereum&&(window.ethereum.isWalletLink||window.ethereum.isToshi))return e.injectedConnect(window.ethereum,o);if(!r)throw new Error("walletLink need appName");const t=new a.CoinbaseWalletSDK({appName:r,appLogoUrl:i}).makeWeb3Provider({options:"smartWalletOnly"});return yield t.request({method:"eth_requestAccounts"}),t.on("connect",o.connect),t.on("disconnect",o.disconnect),t.on("accountsChanged",o.accountsChanged),t.on("chainChanged",o.chainChanged),e.convertWeb3Provider(t)}))};
3
+ !function(e,t){var n=s.default,r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=a),a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(He,He.exports);var ze=Ie.codes.ERR_STREAM_PREMATURE_CLOSE;function Ve(){}var Ke,Ze,Ge,$e,Ye,Je,Qe=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(r||Ve);var i=n.readable||!1!==n.readable&&t.readable,s=n.writable||!1!==n.writable&&t.writable,a=function(){t.writable||c()},o=t._writableState&&t._writableState.finished,c=function(){s=!1,o=!0,i||r.call(t)},l=t._readableState&&t._readableState.endEmitted,u=function(){i=!1,l=!0,s||r.call(t)},d=function(e){r.call(t,e)},h=function(){var e;return i&&!l?(t._readableState&&t._readableState.ended||(e=new ze),r.call(t,e)):s&&!o?(t._writableState&&t._writableState.ended||(e=new ze),r.call(t,e)):void 0},f=function(){t.req.on("finish",c)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?s&&!t._writableState&&(t.on("end",a),t.on("close",a)):(t.on("complete",c),t.on("abort",h),t.req?f():t.on("request",f)),t.on("end",u),t.on("finish",c),!1!==n.error&&t.on("error",d),t.on("close",h),function(){t.removeListener("complete",c),t.removeListener("abort",h),t.removeListener("request",f),t.req&&t.req.removeListener("finish",c),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",c),t.removeListener("end",u),t.removeListener("error",d),t.removeListener("close",h)}};function Xe(){if(Ze)return Ke;var e;function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Ze=1;var n=Qe,r=Symbol("lastResolve"),i=Symbol("lastReject"),s=Symbol("error"),a=Symbol("ended"),o=Symbol("lastPromise"),c=Symbol("handlePromise"),l=Symbol("stream");function u(e,t){return{value:e,done:t}}function d(e){var t=e[r];if(null!==t){var n=e[l].read();null!==n&&(e[o]=null,e[r]=null,e[i]=null,t(u(n,!1)))}}function h(e){process.nextTick(d,e)}var f=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((e={get stream(){return this[l]},next:function(){var e=this,t=this[s];if(null!==t)return Promise.reject(t);if(this[a])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise((function(t,n){process.nextTick((function(){e[s]?n(e[s]):t(u(void 0,!0))}))}));var n,r=this[o];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[a]?n(u(void 0,!0)):t[c](n,r)}),r)}}(r,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(u(i,!1));n=new Promise(this[c])}return this[o]=n,n}},t(e,Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,n){e[l].destroy(null,(function(e){e?n(e):t(u(void 0,!0))}))}))})),e),f);return Ke=function(e){var d,f=Object.create(p,(t(d={},l,{value:e,writable:!0}),t(d,r,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,s,{value:null,writable:!0}),t(d,a,{value:e._readableState.endEmitted,writable:!0}),t(d,c,{value:function(e,t){var n=f[l].read();n?(f[o]=null,f[r]=null,f[i]=null,e(u(n,!1))):(f[r]=e,f[i]=t)},writable:!0}),d));return f[o]=null,n(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=f[i];return null!==t&&(f[o]=null,f[r]=null,f[i]=null,t(e)),void(f[s]=e)}var n=f[r];null!==n&&(f[o]=null,f[r]=null,f[i]=null,n(u(void 0,!0))),f[a]=!0})),e.on("readable",h.bind(null,f)),f}}function et(){if(Je)return Ye;var t;Je=1,Ye=k,k.ReadableState=S,i.default.EventEmitter;var n=function(e,t){return e.listeners(t).length},r=we,a=s.default.Buffer,o=(void 0!==e.commonjsGlobal?e.commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,l=e.require$$1;c=l&&l.debuglog?l.debuglog("stream"):function(){};var u,d,h,f=ve(),p=Ce,_=Ne.getHighWaterMark,g=Ie.codes,m=g.ERR_INVALID_ARG_TYPE,b=g.ERR_STREAM_PUSH_AFTER_EOF,y=g.ERR_METHOD_NOT_IMPLEMENTED,w=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e.inherits_browser.exports(k,r);var v=p.errorOrDestroy,E=["error","close","destroy","pause","resume"];function S(e,n,r){t=t||Be(),e=e||{},"boolean"!=typeof r&&(r=n instanceof t),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=_(this,e,"readableHighWaterMark",r),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(u||(u=Fe().StringDecoder),this.decoder=new u(e.encoding),this.encoding=e.encoding)}function k(e){if(t=t||Be(),!(this instanceof k))return new k(e);var n=this instanceof t;this._readableState=new S(e,this,n),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),r.call(this)}function C(e,t,n,r,i){c("readableAddChunk",t);var s,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(c("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?x(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,L(e)))}(e,l);else if(i||(s=function(e,t){var n;r=t,a.isBuffer(r)||r instanceof o||"string"==typeof t||void 0===t||e.objectMode||(n=new m("chunk",["string","Buffer","Uint8Array"],t));var r;return n}(l,t)),s)v(e,s);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),r)l.endEmitted?v(e,new w):I(e,l,t,!0);else if(l.ended)v(e,new b);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!n?(t=l.decoder.write(t),l.objectMode||0!==t.length?I(e,l,t,!1):A(e,l)):I(e,l,t,!1)}else r||(l.reading=!1,A(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function I(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&x(e)),A(e,t)}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),k.prototype.destroy=p.destroy,k.prototype._undestroy=p.undestroy,k.prototype._destroy=function(e,t){t(e)},k.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=a.from(e,t),t=""),n=!0),C(this,e,t,!1,n)},k.prototype.unshift=function(e){return C(this,e,null,!0,!1)},k.prototype.isPaused=function(){return!1===this._readableState.flowing},k.prototype.setEncoding=function(e){u||(u=Fe().StringDecoder);var t=new u(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var M=1073741824;function R(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=M?e=M:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function x(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(L,e))}function L(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,O(e)}function A(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(P,e,t))}function P(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(c("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function j(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function T(e){c("readable nexttick read 0"),e.read(0)}function N(e,t){c("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),O(e),t.flowing&&!t.reading&&e.read(0)}function O(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function D(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function U(e){var t=e._readableState;c("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(B,t,e))}function B(e,t){if(c("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function W(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return k.prototype.read=function(e){c("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?U(this):x(this),null;if(0===(e=R(e,t))&&t.ended)return 0===t.length&&U(this),null;var r,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&c("length less than watermark",i=!0),t.ended||t.reading?c("reading or ended",i=!1):i&&(c("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=R(n,t))),null===(r=e>0?D(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&U(this)),null!==r&&this.emit("data",r),r},k.prototype._read=function(e){v(this,new y("_read()"))},k.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,t);var s=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?o:_;function a(t,n){c("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,c("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",l),e.removeListener("error",h),e.removeListener("unpipe",a),r.removeListener("end",o),r.removeListener("end",_),r.removeListener("data",d),u=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function o(){c("onend"),e.end()}i.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",a);var l=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&n(e,"data")&&(t.flowing=!0,O(e))}}(r);e.on("drain",l);var u=!1;function d(t){c("ondata");var n=e.write(t);c("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==W(i.pipes,e))&&!u&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function h(t){c("onerror",t),_(),e.removeListener("error",h),0===n(e,"error")&&v(e,t)}function f(){e.removeListener("finish",p),_()}function p(){c("onfinish"),e.removeListener("close",f),_()}function _(){c("unpipe"),r.unpipe(e)}return r.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",f),e.once("finish",p),e.emit("pipe",r),i.flowing||(c("pipe resume"),r.resume()),e},k.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)r[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=W(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},k.prototype.on=function(e,t){var n=r.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?x(this):i.reading||process.nextTick(T,this))),n},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(j,this),n},k.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(j,this),t},k.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(N,e,t))}(this,e)),e.paused=!1,this},k.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(c("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<E.length;s++)e.on(E[s],this.emit.bind(this,E[s]));return this._read=function(t){c("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(k.prototype[Symbol.asyncIterator]=function(){return void 0===d&&(d=Xe()),d(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),k._fromList=D,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(k.from=function(e,t){return void 0===h&&(h=$e?Ge:($e=1,Ge=function(){throw new Error("Readable.from is not available in the browser")})),h(k,e,t)}),Ye}var tt=lt,nt=Ie.codes,rt=nt.ERR_METHOD_NOT_IMPLEMENTED,it=nt.ERR_MULTIPLE_CALLBACK,st=nt.ERR_TRANSFORM_ALREADY_TRANSFORMING,at=nt.ERR_TRANSFORM_WITH_LENGTH_0,ot=Be();function ct(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new it);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function lt(e){if(!(this instanceof lt))return new lt(e);ot.call(this,e),this._transformState={afterTransform:ct.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",ut)}function ut(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?dt(this,null,null):this._flush((function(t,n){dt(e,t,n)}))}function dt(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new at;if(e._transformState.transforming)throw new st;return e.push(null)}e.inherits_browser.exports(lt,ot),lt.prototype.push=function(e,t){return this._transformState.needTransform=!1,ot.prototype.push.call(this,e,t)},lt.prototype._transform=function(e,t,n){n(new rt("_transform()"))},lt.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},lt.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},lt.prototype._destroy=function(e,t){ot.prototype._destroy.call(this,e,(function(e){t(e)}))};var ht,ft=_t,pt=tt;function _t(e){if(!(this instanceof _t))return new _t(e);pt.call(this,e)}e.inherits_browser.exports(_t,pt),_t.prototype._transform=function(e,t,n){n(null,e)};var gt=Ie.codes,mt=gt.ERR_MISSING_ARGS,bt=gt.ERR_STREAM_DESTROYED;function yt(e){if(e)throw e}function wt(e){e()}function vt(e,t){return e.pipe(t)}var Et=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=function(e){return e.length?"function"!=typeof e[e.length-1]?yt:e.pop():yt}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new mt("streams");var s=t.map((function(e,n){var a=n<t.length-1;return function(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var i=!1;e.on("close",(function(){i=!0})),void 0===ht&&(ht=Qe),ht(e,{readable:t,writable:n},(function(e){if(e)return r(e);i=!0,r()}));var s=!1;return function(t){if(!i&&!s)return s=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new bt("pipe"))}}(e,a,n>0,(function(e){r||(r=e),e&&s.forEach(wt),a||(s.forEach(wt),i(r))}))}));return t.reduce(vt)};!function(e,t){(t=ye.exports=et()).Stream=t,t.Readable=t,t.Writable=Ue(),t.Duplex=Be(),t.Transform=tt,t.PassThrough=ft,t.finished=Qe,t.pipeline=Et}(0,ye.exports);const{Transform:St}=ye.exports;const{Transform:kt}=ye.exports;const Ct=e=>class t extends St{constructor(t,n,r,i,s){super(s),this._rate=t,this._capacity=n,this._delimitedSuffix=r,this._hashBitLength=i,this._options=s,this._state=new e,this._state.initialize(t,n),this._finalized=!1}_transform(e,t,n){let r=null;try{this.update(e,t)}catch(e){r=e}n(r)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}},It=e=>class t extends kt{constructor(t,n,r,i){super(i),this._rate=t,this._capacity=n,this._delimitedSuffix=r,this._options=i,this._state=new e,this._state.initialize(t,n),this._finalized=!1}_transform(e,t,n){let r=null;try{this.update(e,t)}catch(e){r=e}n(r)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let n=this._state.squeeze(e);return void 0!==t&&(n=n.toString(t)),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}};var Mt={};const Rt=[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];Mt.p1600=function(e){for(let t=0;t<24;++t){const n=e[0]^e[10]^e[20]^e[30]^e[40],r=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],o=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],u=e[8]^e[18]^e[28]^e[38]^e[48],d=e[9]^e[19]^e[29]^e[39]^e[49];let h=u^(i<<1|s>>>31),f=d^(s<<1|i>>>31);const p=e[0]^h,_=e[1]^f,g=e[10]^h,m=e[11]^f,b=e[20]^h,y=e[21]^f,w=e[30]^h,v=e[31]^f,E=e[40]^h,S=e[41]^f;h=n^(a<<1|o>>>31),f=r^(o<<1|a>>>31);const k=e[2]^h,C=e[3]^f,I=e[12]^h,M=e[13]^f,R=e[22]^h,x=e[23]^f,L=e[32]^h,A=e[33]^f,P=e[42]^h,j=e[43]^f;h=i^(c<<1|l>>>31),f=s^(l<<1|c>>>31);const T=e[4]^h,N=e[5]^f,O=e[14]^h,D=e[15]^f,U=e[24]^h,B=e[25]^f,W=e[34]^h,q=e[35]^f,H=e[44]^h,F=e[45]^f;h=a^(u<<1|d>>>31),f=o^(d<<1|u>>>31);const z=e[6]^h,V=e[7]^f,K=e[16]^h,Z=e[17]^f,G=e[26]^h,$=e[27]^f,Y=e[36]^h,J=e[37]^f,Q=e[46]^h,X=e[47]^f;h=c^(n<<1|r>>>31),f=l^(r<<1|n>>>31);const ee=e[8]^h,te=e[9]^f,ne=e[18]^h,re=e[19]^f,ie=e[28]^h,se=e[29]^f,ae=e[38]^h,oe=e[39]^f,ce=e[48]^h,le=e[49]^f,ue=p,de=_,he=m<<4|g>>>28,fe=g<<4|m>>>28,pe=b<<3|y>>>29,_e=y<<3|b>>>29,ge=v<<9|w>>>23,me=w<<9|v>>>23,be=E<<18|S>>>14,ye=S<<18|E>>>14,we=k<<1|C>>>31,ve=C<<1|k>>>31,Ee=M<<12|I>>>20,Se=I<<12|M>>>20,ke=R<<10|x>>>22,Ce=x<<10|R>>>22,Ie=A<<13|L>>>19,Me=L<<13|A>>>19,Re=P<<2|j>>>30,xe=j<<2|P>>>30,Le=N<<30|T>>>2,Ae=T<<30|N>>>2,Pe=O<<6|D>>>26,je=D<<6|O>>>26,Te=B<<11|U>>>21,Ne=U<<11|B>>>21,Oe=W<<15|q>>>17,De=q<<15|W>>>17,Ue=F<<29|H>>>3,Be=H<<29|F>>>3,We=z<<28|V>>>4,qe=V<<28|z>>>4,He=Z<<23|K>>>9,Fe=K<<23|Z>>>9,ze=G<<25|$>>>7,Ve=$<<25|G>>>7,Ke=Y<<21|J>>>11,Ze=J<<21|Y>>>11,Ge=X<<24|Q>>>8,$e=Q<<24|X>>>8,Ye=ee<<27|te>>>5,Je=te<<27|ee>>>5,Qe=ne<<20|re>>>12,Xe=re<<20|ne>>>12,et=se<<7|ie>>>25,tt=ie<<7|se>>>25,nt=ae<<8|oe>>>24,rt=oe<<8|ae>>>24,it=ce<<14|le>>>18,st=le<<14|ce>>>18;e[0]=ue^~Ee&Te,e[1]=de^~Se&Ne,e[10]=We^~Qe&pe,e[11]=qe^~Xe&_e,e[20]=we^~Pe&ze,e[21]=ve^~je&Ve,e[30]=Ye^~he&ke,e[31]=Je^~fe&Ce,e[40]=Le^~He&et,e[41]=Ae^~Fe&tt,e[2]=Ee^~Te&Ke,e[3]=Se^~Ne&Ze,e[12]=Qe^~pe&Ie,e[13]=Xe^~_e&Me,e[22]=Pe^~ze&nt,e[23]=je^~Ve&rt,e[32]=he^~ke&Oe,e[33]=fe^~Ce&De,e[42]=He^~et&ge,e[43]=Fe^~tt&me,e[4]=Te^~Ke&it,e[5]=Ne^~Ze&st,e[14]=pe^~Ie&Ue,e[15]=_e^~Me&Be,e[24]=ze^~nt&be,e[25]=Ve^~rt&ye,e[34]=ke^~Oe&Ge,e[35]=Ce^~De&$e,e[44]=et^~ge&Re,e[45]=tt^~me&xe,e[6]=Ke^~it&ue,e[7]=Ze^~st&de,e[16]=Ie^~Ue&We,e[17]=Me^~Be&qe,e[26]=nt^~be&we,e[27]=rt^~ye&ve,e[36]=Oe^~Ge&Ye,e[37]=De^~$e&Je,e[46]=ge^~Re&Le,e[47]=me^~xe&Ae,e[8]=it^~ue&Ee,e[9]=st^~de&Se,e[18]=Ue^~We&Qe,e[19]=Be^~qe&Xe,e[28]=be^~we&Pe,e[29]=ye^~ve&je,e[38]=Ge^~Ye&he,e[39]=$e^~Je&fe,e[48]=Re^~Le&He,e[49]=xe^~Ae&Fe,e[0]^=Rt[2*t],e[1]^=Rt[2*t+1]}};const xt=Mt;function Lt(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Lt.prototype.initialize=function(e,t){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},Lt.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<this.count%4*8,this.count+=1,this.count===this.blockSize&&(xt.p1600(this.state),this.count=0)},Lt.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<this.count%4*8,0!=(128&e)&&this.count===this.blockSize-1&&xt.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<(this.blockSize-1)%4*8,xt.p1600(this.state),this.count=0,this.squeezing=!0},Lt.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);const t=Buffer.alloc(e);for(let n=0;n<e;++n)t[n]=this.state[~~(this.count/4)]>>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(xt.p1600(this.state),this.count=0);return t},Lt.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var At=function(e){const t=Ct(e),n=It(e);return function(e,r){switch("string"==typeof e?e.toLowerCase():e){case"keccak224":return new t(1152,448,null,224,r);case"keccak256":return new t(1088,512,null,256,r);case"keccak384":return new t(832,768,null,384,r);case"keccak512":return new t(576,1024,null,512,r);case"sha3-224":return new t(1152,448,6,224,r);case"sha3-256":return new t(1088,512,6,256,r);case"sha3-384":return new t(832,768,6,384,r);case"sha3-512":return new t(576,1024,6,512,r);case"shake128":return new n(1344,256,31,r);case"shake256":return new n(1088,512,31,r);default:throw new Error("Invald algorithm: "+e)}}}(Lt);const Pt=At;function jt(e){return Buffer.allocUnsafe(e).fill(0)}function Tt(e,t){let n=e.toString(16);n.length%2!=0&&(n="0"+n);const r=n.match(/.{1,2}/g).map((e=>parseInt(e,16)));for(;r.length<t;)r.unshift(0);return Buffer.from(r)}function Nt(e,t,n){const r=jt(t);return e=Ot(e),n?e.length<t?(e.copy(r),r):e.slice(0,t):e.length<t?(e.copy(r,t-e.length),r):e.slice(-t)}function Ot(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);else if("string"==typeof e)e=Dt(e)?Buffer.from((t=Ut(e)).length%2?"0"+t:t,"hex"):Buffer.from(e);else if("number"==typeof e)e=intToBuffer(e);else if(null==e)e=Buffer.allocUnsafe(0);else if("bigint"==typeof e)e=Tt(e);else{if(!e.toArray)throw new Error("invalid type");e=Buffer.from(e.toArray())}var t;return e}function Dt(e){return"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]*$/)}function Ut(e){return"string"==typeof e&&e.startsWith("0x")?e.slice(2):e}var Bt={zeros:jt,setLength:Nt,setLengthRight:function(e,t){return Nt(e,t,!0)},isHexString:Dt,stripHexPrefix:Ut,toBuffer:Ot,bufferToHex:function(e){return"0x"+(e=Ot(e)).toString("hex")},keccak:function(e,t){return e=Ot(e),t||(t=256),Pt("keccak"+t).update(e).digest()},bitLengthFromBigInt:function(e){return e.toString(2).length},bufferBEFromBigInt:Tt,twosFromBigInt:function(e,t){let n;if(e<0n){n=(~e&(1n<<BigInt(t))-1n)+1n}else n=e;return n&=(1n<<BigInt(t))-1n,n}};const Wt=Bt;function qt(e){return e.startsWith("int[")?"int256"+e.slice(3):"int"===e?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):"uint"===e?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):"fixed"===e?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):"ufixed"===e?"ufixed128x128":e}function Ht(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function Ft(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function zt(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?""===t[2]?"dynamic":parseInt(t[2],10):null}function Vt(e){var t=typeof e;if("string"===t||"number"===t)return BigInt(e);if("bigint"===t)return e;throw new Error("Argument is not a number")}function Kt(e,t){var n,r,i,s;if("address"===e)return Kt("uint160",Vt(t));if("bool"===e)return Kt("uint8",t?1:0);if("string"===e)return Kt("bytes",new Buffer(t,"utf8"));if(function(e){return e.lastIndexOf("]")===e.length-1}(e)){if(void 0===t.length)throw new Error("Not an array?");if("dynamic"!==(n=zt(e))&&0!==n&&t.length>n)throw new Error("Elements exceed array size: "+n);for(s in i=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof t&&(t=JSON.parse(t)),t)i.push(Kt(e,t[s]));if("dynamic"===n){var a=Kt("uint256",t.length);i.unshift(a)}return Buffer.concat(i)}if("bytes"===e)return t=new Buffer(t),i=Buffer.concat([Kt("uint256",t.length),t]),t.length%32!=0&&(i=Buffer.concat([i,Wt.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if((n=Ht(e))<1||n>32)throw new Error("Invalid bytes<N> width: "+n);return Wt.setLengthRight(t,32)}if(e.startsWith("uint")){if((n=Ht(e))%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=Vt(t);const i=Wt.bitLengthFromBigInt(r);if(i>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+i);if(r<0)throw new Error("Supplied uint is negative");return Wt.bufferBEFromBigInt(r,32)}if(e.startsWith("int")){if((n=Ht(e))%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=Vt(t);const i=Wt.bitLengthFromBigInt(r);if(i>n)throw new Error("Supplied int exceeds width: "+n+" vs "+i);const s=Wt.twosFromBigInt(r,256);return Wt.bufferBEFromBigInt(s,32)}if(e.startsWith("ufixed")){if(n=Ft(e),(r=Vt(t))<0)throw new Error("Supplied ufixed is negative");return Kt("uint256",r*BigInt(2)**BigInt(n[1]))}if(e.startsWith("fixed"))return n=Ft(e),Kt("int256",Vt(t)*BigInt(2)**BigInt(n[1]));throw new Error("Unsupported or invalid type: "+e)}function Zt(e){return"string"===e||"bytes"===e||"dynamic"===zt(e)}function Gt(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var n,r,i=[],s=0;s<e.length;s++){var a=qt(e[s]),o=t[s];if("bytes"===a)i.push(o);else if("string"===a)i.push(new Buffer(o,"utf8"));else if("bool"===a)i.push(new Buffer(o?"01":"00","hex"));else if("address"===a)i.push(Wt.setLength(o,20));else if(a.startsWith("bytes")){if((n=Ht(a))<1||n>32)throw new Error("Invalid bytes<N> width: "+n);i.push(Wt.setLengthRight(o,n))}else if(a.startsWith("uint")){if((n=Ht(a))%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=Vt(o);const e=Wt.bitLengthFromBigInt(r);if(e>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+e);i.push(Wt.bufferBEFromBigInt(r,n/8))}else{if(!a.startsWith("int"))throw new Error("Unsupported or invalid type: "+a);{if((n=Ht(a))%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=Vt(o);const e=Wt.bitLengthFromBigInt(r);if(e>n)throw new Error("Supplied int exceeds width: "+n+" vs "+e);const t=Wt.twosFromBigInt(r,n);i.push(Wt.bufferBEFromBigInt(t,n/8))}}}return Buffer.concat(i)}var $t={rawEncode:function(e,t){var n=[],r=[],i=32*e.length;for(var s in e){var a=qt(e[s]),o=Kt(a,t[s]);Zt(a)?(n.push(Kt("uint256",i)),r.push(o),i+=o.length):n.push(o)}return Buffer.concat(n.concat(r))},solidityPack:Gt,soliditySHA3:function(e,t){return Wt.keccak(Gt(e,t))}};const Yt=Bt,Jt=$t,Qt={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},Xt={encodeData(e,t,n,r=!0){const i=["bytes32"],s=[this.hashType(e,n)];if(r){const a=(e,t,i)=>{if(void 0!==n[t])return["bytes32",null==i?"0x0000000000000000000000000000000000000000000000000000000000000000":Yt.keccak(this.encodeData(t,i,n,r))];if(void 0===i)throw new Error(`missing value for field ${e} of type ${t}`);if("bytes"===t)return["bytes32",Yt.keccak(i)];if("string"===t)return"string"==typeof i&&(i=Buffer.from(i,"utf8")),["bytes32",Yt.keccak(i)];if(t.lastIndexOf("]")===t.length-1){const n=t.slice(0,t.lastIndexOf("[")),r=i.map((t=>a(e,n,t)));return["bytes32",Yt.keccak(Jt.rawEncode(r.map((([e])=>e)),r.map((([,e])=>e))))]}return[t,i]};for(const r of n[e]){const[e,n]=a(r.name,r.type,t[r.name]);i.push(e),s.push(n)}}else for(const a of n[e]){let e=t[a.name];if(void 0!==e)if("bytes"===a.type)i.push("bytes32"),e=Yt.keccak(e),s.push(e);else if("string"===a.type)i.push("bytes32"),"string"==typeof e&&(e=Buffer.from(e,"utf8")),e=Yt.keccak(e),s.push(e);else if(void 0!==n[a.type])i.push("bytes32"),e=Yt.keccak(this.encodeData(a.type,e,n,r)),s.push(e);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),s.push(e)}}return Jt.rawEncode(i,s)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter((t=>t!==e));r=[e].concat(r.sort());for(const e of r){if(!t[e])throw new Error("No type definition specified: "+e);n+=e+"("+t[e].map((({name:e,type:t})=>t+" "+e)).join(",")+")"}return n},findTypeDependencies(e,t,n=[]){if(e=e.match(/^\w*/)[0],n.includes(e)||void 0===t[e])return n;n.push(e);for(const r of t[e])for(const e of this.findTypeDependencies(r.type,t,n))!n.includes(e)&&n.push(e);return n},hashStruct(e,t,n,r=!0){return Yt.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return Yt.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n in Qt.properties)e[n]&&(t[n]=e[n]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const n=this.sanitizeData(e),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",n.domain,n.types,t)),"EIP712Domain"!==n.primaryType&&r.push(this.hashStruct(n.primaryType,n.message,n.types,t)),Yt.keccak(Buffer.concat(r))}};var en={TYPED_MESSAGE_SCHEMA:Qt,TypedDataUtils:Xt,hashForSignTypedDataLegacy:function(e){return function(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;const n=e.map((function(e){return"bytes"===e.type?Yt.toBuffer(e.value):e.value})),r=e.map((function(e){return e.type})),i=e.map((function(e){if(!e.name)throw t;return e.type+" "+e.name}));return Jt.soliditySHA3(["bytes32","bytes32"],[Jt.soliditySHA3(new Array(e.length).fill("string"),i),Jt.soliditySHA3(r,n)])}(e.data)},hashForSignTypedData_v3:function(e){return Xt.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Xt.hash(e.data)}};var tn={};Object.defineProperty(tn,"__esModule",{value:!0}),tn.APP_VERSION_KEY=tn.LOCAL_STORAGE_ADDRESSES_KEY=tn.WALLET_USER_NAME_KEY=void 0,tn.WALLET_USER_NAME_KEY="walletUsername",tn.LOCAL_STORAGE_ADDRESSES_KEY="Addresses",tn.APP_VERSION_KEY="AppVersion";var nn={};Object.defineProperty(nn,"__esModule",{value:!0}),nn.RelayEventManager=void 0;const rn=L;nn.RelayEventManager=class{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,rn.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}};var sn={},an={},on={};Object.defineProperty(on,"__esModule",{value:!0}),on.WalletLinkCipher=void 0;const cn=L;on.WalletLinkCipher=class{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.importKey("raw",(0,cn.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,s=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},r,i.encode(e)),a=s.slice(s.byteLength-16),o=s.slice(0,s.byteLength-16),c=new Uint8Array(a),l=new Uint8Array(o),u=new Uint8Array([...n,...c,...l]);return(0,cn.uint8ArrayToHex)(u)}async decrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");return new Promise(((n,r)=>{!async function(){const i=await crypto.subtle.importKey("raw",(0,cn.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=(0,cn.hexStringToUint8Array)(e),a=s.slice(0,12),o=s.slice(12,28),c=s.slice(28),l=new Uint8Array([...c,...o]),u={name:"AES-GCM",iv:new Uint8Array(a)};try{const e=await window.crypto.subtle.decrypt(u,i,l),t=new TextDecoder;n(t.decode(e))}catch(e){r(e)}}()}))}};var ln={};Object.defineProperty(ln,"__esModule",{value:!0}),ln.WalletLinkHTTP=void 0;ln.WalletLinkHTTP=class{constructor(e,t,n){this.linkAPIUrl=e,this.sessionId=t;const r=`${t}:${n}`;this.auth=`Basic ${btoa(r)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map((e=>fetch(`${this.linkAPIUrl}/events/${e.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}})))).catch((e=>console.error("Unabled to mark event as failed:",e)))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:n,error:r}=await t.json();if(r)throw new Error(`Check unseen events failed: ${r}`);const i=null!==(e=null==n?void 0:n.filter((e=>"Web3Response"===e.event)).map((e=>({type:"Event",sessionId:this.sessionId,eventId:e.id,event:e.event,data:e.data}))))&&void 0!==e?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${t.status}`)}};var un,dn={};Object.defineProperty(dn,"__esModule",{value:!0}),dn.WalletLinkWebSocket=dn.ConnectionState=void 0,function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"}(un||(dn.ConnectionState=un={}));dn.WalletLinkWebSocket=class{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise(((e,t)=>{var n;let r;try{this.webSocket=r=new this.WebSocketClass(this.url)}catch(e){return void t(e)}null===(n=this.connectionStateListener)||void 0===n||n.call(this,un.CONNECTING),r.onclose=e=>{var n;this.clearWebSocket(),t(new Error(`websocket error ${e.code}: ${e.reason}`)),null===(n=this.connectionStateListener)||void 0===n||n.call(this,un.DISCONNECTED)},r.onopen=t=>{var n;if(e(),null===(n=this.connectionStateListener)||void 0===n||n.call(this,un.CONNECTED),this.pendingData.length>0){[...this.pendingData].forEach((e=>this.sendData(e))),this.pendingData=[]}},r.onmessage=e=>{var t,n;if("h"===e.data)null===(t=this.incomingDataListener)||void 0===t||t.call(this,{type:"Heartbeat"});else try{const t=JSON.parse(e.data);null===(n=this.incomingDataListener)||void 0===n||n.call(this,t)}catch(e){}}}))}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),null===(e=this.connectionStateListener)||void 0===e||e.call(this,un.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch(e){}}}sendData(e){const{webSocket:t}=this;if(!t)return this.pendingData.push(e),void this.connect();t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}},Object.defineProperty(an,"__esModule",{value:!0}),an.WalletLinkConnection=void 0;const hn=tn,fn=on,pn=ln,_n=dn,gn=R;an.WalletLinkConnection=class{constructor({session:e,linkAPIUrl:t,listener:n,WebSocketClass:r=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,gn.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=e=>{if(!e)return;const t=new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",t=>e.JsonRpcUrl&&this.handleChainUpdated(t,e.JsonRpcUrl)]]);t.forEach(((t,n)=>{const r=e[n];void 0!==r&&t(r)}))},this.handleDestroyed=e=>{var t;"1"===e&&(null===(t=this.listener)||void 0===t||t.resetAndReload())},this.handleAccountUpdated=async e=>{var t;{const n=await this.cipher.decrypt(e);null===(t=this.listener)||void 0===t||t.accountUpdated(n)}},this.handleMetadataUpdated=async(e,t)=>{var n;{const r=await this.cipher.decrypt(t);null===(n=this.listener)||void 0===n||n.metadataUpdated(e,r)}},this.handleWalletUsernameUpdated=async e=>{this.handleMetadataUpdated(hn.WALLET_USER_NAME_KEY,e)},this.handleAppVersionUpdated=async e=>{this.handleMetadataUpdated(hn.APP_VERSION_KEY,e)},this.handleChainUpdated=async(e,t)=>{var n;{const r=await this.cipher.decrypt(e),i=await this.cipher.decrypt(t);null===(n=this.listener)||void 0===n||n.chainUpdated(r,i)}},this.session=e,this.cipher=new fn.WalletLinkCipher(e.secret),this.listener=n;const i=new _n.WalletLinkWebSocket(`${t}/rpc`,r);i.setConnectionStateListener((async e=>{let t=!1;switch(e){case _n.ConnectionState.DISCONNECTED:if(!this.destroyed){const e=async()=>{await new Promise((e=>setTimeout(e,5e3))),this.destroyed||i.connect().catch((()=>{e()}))};e()}break;case _n.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),t=!0}catch(e){}this.updateLastHeartbeat(),setInterval((()=>{this.heartbeat()}),1e4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();case _n.ConnectionState.CONNECTING:}this.connected!==t&&(this.connected=t)})),i.setIncomingDataListener((e=>{var t;switch(e.type){case"Heartbeat":return void this.updateLastHeartbeat();case"IsLinkedOK":case"Linked":{const t="IsLinkedOK"===e.type?e.linked:void 0;this.linked=t||e.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":this.handleSessionMetadataUpdated(e.metadata);break;case"Event":this.handleIncomingEvent(e)}void 0!==e.id&&(null===(t=this.requestResolutions.get(e.id))||void 0===t||t(e))})),this.ws=i,this.http=new pn.WalletLinkHTTP(t,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t;this._connected=e,e&&(null===(t=this.onceConnected)||void 0===t||t.call(this))}setOnceConnected(e){return new Promise((t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}}))}get linked(){return this._linked}set linked(e){var t,n;this._linked=e,e&&(null===(t=this.onceLinked)||void 0===t||t.call(this)),null===(n=this.listener)||void 0===n||n.linkedUpdated(e)}setOnceLinked(e){return new Promise((t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}}))}async handleIncomingEvent(e){var t;if("Event"===e.type&&"Web3Response"===e.event){const n=await this.cipher.decrypt(e.data),r=JSON.parse(n);if("WEB3_RESPONSE"!==r.type)return;null===(t=this.listener)||void 0===t||t.handleWeb3ResponseMessage(r)}}async checkUnseenEvents(){if(this.connected){await new Promise((e=>setTimeout(e,250)));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}else this.shouldFetchUnseenEventsOnConnect=!0}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1;(await this.http.fetchUnseenEvents()).forEach((e=>this.handleIncomingEvent(e)))}async setSessionMetadata(e,t){const n={type:"SetSessionConfig",id:(0,gn.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected((async()=>{const e=await this.makeRequest(n);if("Fail"===e.type)throw new Error(e.error||"failed to set session metadata")}))}async publishEvent(e,t,n=!1){const r=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,gn.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:r,callWebhook:n};return this.setOnceLinked((async()=>{const e=await this.makeRequest(i);if("Fail"===e.type)throw new Error(e.error||"failed to publish event");return e.eventId}))}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>2e4)this.ws.disconnect();else try{this.ws.sendData("h")}catch(e){}}async makeRequest(e,t=6e4){const n=e.id;let r;return this.sendData(e),Promise.race([new Promise(((e,i)=>{r=window.setTimeout((()=>{i(new Error(`request ${n} timed out`))}),t)})),new Promise((e=>{this.requestResolutions.set(n,(t=>{clearTimeout(r),e(t),this.requestResolutions.delete(n)}))}))])}async authenticate(){const e={type:"HostSession",id:(0,gn.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if("Fail"===t.type)throw new Error(t.error||"failed to authenticate")}sendIsLinked(){const e={type:"IsLinked",id:(0,gn.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,gn.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}};var mn={},bn={exports:{}},yn=He.exports.Buffer;function wn(e,t){this._block=yn.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}wn.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=yn.from(e,t));for(var n=this._block,r=this._blockSize,i=e.length,s=this._len,a=0;a<i;){for(var o=s%r,c=Math.min(i-a,r-o),l=0;l<c;l++)n[o+l]=e[a+l];a+=c,(s+=c)%r==0&&this._update(n)}return this._len+=i,this},wn.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s},wn.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var vn=wn,En=e.inherits_browser.exports,Sn=vn,kn=He.exports.Buffer,Cn=[1518500249,1859775393,-1894007588,-899497514],In=new Array(80);function Mn(){this.init(),this._w=In,Sn.call(this,64,56)}function Rn(e){return e<<30|e>>>2}function xn(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}En(Mn,Sn),Mn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Mn.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,o=0|this._e,c=0;c<16;++c)n[c]=e.readInt32BE(4*c);for(;c<80;++c)n[c]=n[c-3]^n[c-8]^n[c-14]^n[c-16];for(var l=0;l<80;++l){var u=~~(l/20),d=0|((t=r)<<5|t>>>27)+xn(u,i,s,a)+o+n[l]+Cn[u];o=a,a=s,s=Rn(i),i=r,r=d}this._a=r+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=o+this._e|0},Mn.prototype._hash=function(){var e=kn.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Ln=Mn,An=e.inherits_browser.exports,Pn=vn,jn=He.exports.Buffer,Tn=[1518500249,1859775393,-1894007588,-899497514],Nn=new Array(80);function On(){this.init(),this._w=Nn,Pn.call(this,64,56)}function Dn(e){return e<<5|e>>>27}function Un(e){return e<<30|e>>>2}function Bn(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}An(On,Pn),On.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},On.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,o=0|this._e,c=0;c<16;++c)n[c]=e.readInt32BE(4*c);for(;c<80;++c)n[c]=(t=n[c-3]^n[c-8]^n[c-14]^n[c-16])<<1|t>>>31;for(var l=0;l<80;++l){var u=~~(l/20),d=Dn(r)+Bn(u,i,s,a)+o+n[l]+Tn[u]|0;o=a,a=s,s=Un(i),i=r,r=d}this._a=r+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=o+this._e|0},On.prototype._hash=function(){var e=jn.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Wn=On,qn=e.inherits_browser.exports,Hn=vn,Fn=He.exports.Buffer,zn=[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],Vn=new Array(64);function Kn(){this.init(),this._w=Vn,Hn.call(this,64,56)}function Zn(e,t,n){return n^e&(t^n)}function Gn(e,t,n){return e&t|n&(e|t)}function $n(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Yn(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Jn(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function Qn(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}qn(Kn,Hn),Kn.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Kn.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,s=0|this._d,a=0|this._e,o=0|this._f,c=0|this._g,l=0|this._h,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<64;++u)t[u]=Qn(t[u-2])+t[u-7]+Jn(t[u-15])+t[u-16]|0;for(var d=0;d<64;++d){var h=l+Yn(a)+Zn(a,o,c)+zn[d]+t[d]|0,f=$n(n)+Gn(n,r,i)|0;l=c,c=o,o=a,a=s+h|0,s=i,i=r,r=n,n=h+f|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=o+this._f|0,this._g=c+this._g|0,this._h=l+this._h|0},Kn.prototype._hash=function(){var e=Fn.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var Xn=Kn,er=e.inherits_browser.exports,tr=Xn,nr=vn,rr=He.exports.Buffer,ir=new Array(64);function sr(){this.init(),this._w=ir,nr.call(this,64,56)}er(sr,tr),sr.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},sr.prototype._hash=function(){var e=rr.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var ar=sr,or=e.inherits_browser.exports,cr=vn,lr=He.exports.Buffer,ur=[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],dr=new Array(160);function hr(){this.init(),this._w=dr,cr.call(this,128,112)}function fr(e,t,n){return n^e&(t^n)}function pr(e,t,n){return e&t|n&(e|t)}function _r(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function gr(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function mr(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function br(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function yr(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function wr(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function vr(e,t){return e>>>0<t>>>0?1:0}or(hr,cr),hr.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},hr.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,s=0|this._dh,a=0|this._eh,o=0|this._fh,c=0|this._gh,l=0|this._hh,u=0|this._al,d=0|this._bl,h=0|this._cl,f=0|this._dl,p=0|this._el,_=0|this._fl,g=0|this._gl,m=0|this._hl,b=0;b<32;b+=2)t[b]=e.readInt32BE(4*b),t[b+1]=e.readInt32BE(4*b+4);for(;b<160;b+=2){var y=t[b-30],w=t[b-30+1],v=mr(y,w),E=br(w,y),S=yr(y=t[b-4],w=t[b-4+1]),k=wr(w,y),C=t[b-14],I=t[b-14+1],M=t[b-32],R=t[b-32+1],x=E+I|0,L=v+C+vr(x,E)|0;L=(L=L+S+vr(x=x+k|0,k)|0)+M+vr(x=x+R|0,R)|0,t[b]=L,t[b+1]=x}for(var A=0;A<160;A+=2){L=t[A],x=t[A+1];var P=pr(n,r,i),j=pr(u,d,h),T=_r(n,u),N=_r(u,n),O=gr(a,p),D=gr(p,a),U=ur[A],B=ur[A+1],W=fr(a,o,c),q=fr(p,_,g),H=m+D|0,F=l+O+vr(H,m)|0;F=(F=(F=F+W+vr(H=H+q|0,q)|0)+U+vr(H=H+B|0,B)|0)+L+vr(H=H+x|0,x)|0;var z=N+j|0,V=T+P+vr(z,N)|0;l=c,m=g,c=o,g=_,o=a,_=p,a=s+F+vr(p=f+H|0,f)|0,s=i,f=h,i=r,h=d,r=n,d=u,n=F+V+vr(u=H+z|0,H)|0}this._al=this._al+u|0,this._bl=this._bl+d|0,this._cl=this._cl+h|0,this._dl=this._dl+f|0,this._el=this._el+p|0,this._fl=this._fl+_|0,this._gl=this._gl+g|0,this._hl=this._hl+m|0,this._ah=this._ah+n+vr(this._al,u)|0,this._bh=this._bh+r+vr(this._bl,d)|0,this._ch=this._ch+i+vr(this._cl,h)|0,this._dh=this._dh+s+vr(this._dl,f)|0,this._eh=this._eh+a+vr(this._el,p)|0,this._fh=this._fh+o+vr(this._fl,_)|0,this._gh=this._gh+c+vr(this._gl,g)|0,this._hh=this._hh+l+vr(this._hl,m)|0},hr.prototype._hash=function(){var e=lr.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Er=hr,Sr=e.inherits_browser.exports,kr=Er,Cr=vn,Ir=He.exports.Buffer,Mr=new Array(160);function Rr(){this.init(),this._w=Mr,Cr.call(this,128,112)}Sr(Rr,kr),Rr.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},Rr.prototype._hash=function(){var e=Ir.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var xr=Rr,Lr=bn.exports=function(e){e=e.toLowerCase();var t=Lr[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};Lr.sha=Ln,Lr.sha1=Wn,Lr.sha224=ar,Lr.sha256=Xn,Lr.sha384=xr,Lr.sha512=Er,Object.defineProperty(mn,"__esModule",{value:!0}),mn.WalletLinkSession=void 0;const Ar=bn.exports,Pr=L,jr="session:id",Tr="session:secret",Nr="session:linked";class Or{constructor(e,t,n,r){this._storage=e,this._id=t||(0,Pr.randomBytesHex)(16),this._secret=n||(0,Pr.randomBytesHex)(32),this._key=(new Ar.sha256).update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!r}static load(e){const t=e.getItem(jr),n=e.getItem(Nr),r=e.getItem(Tr);return t&&r?new Or(e,t,r,"1"===n):null}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(jr,this._id),this._storage.setItem(Tr,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Nr,this._linked?"1":"0")}}mn.WalletLinkSession=Or;var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.isDarkMode=Dr.isMobileWeb=Dr.getLocation=Dr.createQrUrl=void 0,Dr.createQrUrl=function(e,t,n,r,i,s){return`${n}/#/link?${new URLSearchParams({[r?"parent-id":"id"]:e,secret:t,server:n,v:i,chainId:s.toString()}).toString()}`},Dr.getLocation=function(){try{return function(){try{return null!==window.frameElement}catch(e){return!1}}()&&window.top?window.top.location:window.location}catch(e){return window.location}},Dr.isMobileWeb=function(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.userAgent)},Dr.isDarkMode=function(){var e,t;return null!==(t=null===(e=null===window||void 0===window?void 0:window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)&&void 0!==t&&t};var Ur={},Br={},Wr={};Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var qr=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Br,"__esModule",{value:!0}),Br.injectCssReset=void 0;const Hr=qr(Wr);Br.injectCssReset=function(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Hr.default)),document.documentElement.appendChild(e)};var Fr={};function zr(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=zr(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Vr(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=zr(e))&&(r&&(r+=" "),r+=t);return r}var Kr,Zr,Gr,$r,Yr,Jr,Qr,Xr,ei,ti,ni,ri,ii=Object.freeze({__proto__:null,clsx:Vr,default:Vr}),si=e.getAugmentedNamespace(ii),ai={},oi=[],ci=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,li=Array.isArray;function ui(e,t){for(var n in t)e[n]=t[n];return e}function di(e){var t=e.parentNode;t&&t.removeChild(e)}function hi(e,t,n){var r,i,s,a={};for(s in t)"key"==s?r=t[s]:"ref"==s?i=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?Kr.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return fi(e,a,r,i,null)}function fi(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==i?++Gr:i,__i:-1,__u:0};return null==i&&null!=Zr.vnode&&Zr.vnode(s),s}function pi(e){return e.children}function _i(e,t){this.props=e,this.context=t}function gi(e,t){if(null==t)return e.__?gi(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?gi(e):null}function mi(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return mi(e)}}function bi(e){(!e.__d&&(e.__d=!0)&&Yr.push(e)&&!yi.__r++||Jr!==Zr.debounceRendering)&&((Jr=Zr.debounceRendering)||Qr)(yi)}function yi(){var e,t,n,r,i,s,a,o;for(Yr.sort(Xr);e=Yr.shift();)e.__d&&(t=Yr.length,r=void 0,s=(i=(n=e).__v).__e,a=[],o=[],n.__P&&((r=ui({},i)).__v=i.__v+1,Zr.vnode&&Zr.vnode(r),Ii(n.__P,r,i,n.__n,void 0!==n.__P.ownerSVGElement,32&i.__u?[s]:null,a,null==s?gi(i):s,!!(32&i.__u),o),r.__v=i.__v,r.__.__k[r.__i]=r,Mi(a,r,o),r.__e!=s&&mi(r)),Yr.length>t&&Yr.sort(Xr));yi.__r=0}function wi(e,t,n,r,i,s,a,o,c,l,u){var d,h,f,p,_,g=r&&r.__k||oi,m=t.length;for(n.__d=c,function(e,t,n){var r,i,s,a,o,c=t.length,l=n.length,u=l,d=0;for(e.__k=[],r=0;r<c;r++)a=r+d,null!=(i=e.__k[r]=null==(i=t[r])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?fi(null,i,null,null,null):li(i)?fi(pi,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?fi(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=e,i.__b=e.__b+1,o=Ei(i,n,a,u),i.__i=o,s=null,-1!==o&&(u--,(s=n[o])&&(s.__u|=131072)),null==s||null===s.__v?(-1==o&&d--,"function"!=typeof i.type&&(i.__u|=65536)):o!==a&&(o===a+1?d++:o>a?u>c-a?d+=o-a:d--:o<a?o==a-1&&(d=o-a):d=0,o!==r+d&&(i.__u|=65536))):(s=n[a])&&null==s.key&&s.__e&&0==(131072&s.__u)&&(s.__e==e.__d&&(e.__d=gi(s)),Li(s,s,!1),n[a]=null,u--);if(u)for(r=0;r<l;r++)null!=(s=n[r])&&0==(131072&s.__u)&&(s.__e==e.__d&&(e.__d=gi(s)),Li(s,s))}(n,t,g),c=n.__d,d=0;d<m;d++)null!=(f=n.__k[d])&&"boolean"!=typeof f&&"function"!=typeof f&&(h=-1===f.__i?ai:g[f.__i]||ai,f.__i=d,Ii(e,f,h,i,s,a,o,c,l,u),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&xi(h.ref,null,f),u.push(f.ref,f.__c||p,f)),null==_&&null!=p&&(_=p),65536&f.__u||h.__k===f.__k?(c&&!c.isConnected&&(c=gi(h)),c=vi(f,c,e)):"function"==typeof f.type&&void 0!==f.__d?c=f.__d:p&&(c=p.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=c,n.__e=_}function vi(e,t,n){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=vi(r[i],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8===t.nodeType);return t}function Ei(e,t,n,r){var i=e.key,s=e.type,a=n-1,o=n+1,c=t[n];if(null===c||c&&i==c.key&&s===c.type&&0==(131072&c.__u))return n;if(r>(null!=c&&0==(131072&c.__u)?1:0))for(;a>=0||o<t.length;){if(a>=0){if((c=t[a])&&0==(131072&c.__u)&&i==c.key&&s===c.type)return a;a--}if(o<t.length){if((c=t[o])&&0==(131072&c.__u)&&i==c.key&&s===c.type)return o;o++}}return-1}function Si(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||ci.test(t)?n:n+"px"}function ki(e,t,n,r,i){var s;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Si(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Si(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])s=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||"onFocusOut"===t||"onFocusIn"===t?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r?n.u=r.u:(n.u=ei,e.addEventListener(t,s?ni:ti,s)):e.removeEventListener(t,s?ni:ti,s);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Ci(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=ei++;else if(t.t<n.u)return;return n(Zr.event?Zr.event(t):t)}}}function Ii(e,t,n,r,i,s,a,o,c,l){var u,d,h,f,p,_,g,m,b,y,w,v,E,S,k,C=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(c=!!(32&n.__u),s=[o=t.__e=n.__e]),(u=Zr.__b)&&u(t);e:if("function"==typeof C)try{if(m=t.props,b=(u=C.contextType)&&r[u.__c],y=u?b?b.props.value:u.__:r,n.__c?g=(d=t.__c=n.__c).__=d.__E:("prototype"in C&&C.prototype.render?t.__c=d=new C(m,y):(t.__c=d=new _i(m,y),d.constructor=C,d.render=Ai),b&&b.sub(d),d.props=m,d.state||(d.state={}),d.context=y,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=ui({},d.__s)),ui(d.__s,C.getDerivedStateFromProps(m,d.__s))),f=d.props,p=d.state,d.__v=t,h)null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==C.getDerivedStateFromProps&&m!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,y),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,y)||t.__v===n.__v)){for(t.__v!==n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),w=0;w<d._sb.length;w++)d.__h.push(d._sb[w]);d._sb=[],d.__h.length&&a.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,y),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(f,p,_)}))}if(d.context=y,d.props=m,d.__P=e,d.__e=!1,v=Zr.__r,E=0,"prototype"in C&&C.prototype.render){for(d.state=d.__s,d.__d=!1,v&&v(t),u=d.render(d.props,d.state,d.context),S=0;S<d._sb.length;S++)d.__h.push(d._sb[S]);d._sb=[]}else do{d.__d=!1,v&&v(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++E<25);d.state=d.__s,null!=d.getChildContext&&(r=ui(ui({},r),d.getChildContext())),h||null==d.getSnapshotBeforeUpdate||(_=d.getSnapshotBeforeUpdate(f,p)),wi(e,li(k=null!=u&&u.type===pi&&null==u.key?u.props.children:u)?k:[k],t,n,r,i,s,a,o,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),g&&(d.__E=d.__=null)}catch(e){t.__v=null,c||null!=s?(t.__e=o,t.__u|=c?160:32,s[s.indexOf(o)]=null):(t.__e=n.__e,t.__k=n.__k),Zr.__e(e,t,n)}else null==s&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ri(n.__e,t,n,r,i,s,a,c,l);(u=Zr.diffed)&&u(t)}function Mi(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)xi(n[r],n[++r],n[++r]);Zr.__c&&Zr.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Zr.__e(e,t.__v)}}))}function Ri(e,t,n,r,i,s,a,o,c){var l,u,d,h,f,p,_,g=n.props,m=t.props,b=t.type;if("svg"===b&&(i=!0),null!=s)for(l=0;l<s.length;l++)if((f=s[l])&&"setAttribute"in f==!!b&&(b?f.localName===b:3===f.nodeType)){e=f,s[l]=null;break}if(null==e){if(null===b)return document.createTextNode(m);e=i?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,m.is&&m),s=null,o=!1}if(null===b)g===m||o&&e.data===m||(e.data=m);else{if(s=s&&Kr.call(e.childNodes),g=n.props||ai,!o&&null!=s)for(g={},l=0;l<e.attributes.length;l++)g[(f=e.attributes[l]).name]=f.value;for(l in g)f=g[l],"children"==l||("dangerouslySetInnerHTML"==l?d=f:"key"===l||l in m||ki(e,l,null,f,i));for(l in m)f=m[l],"children"==l?h=f:"dangerouslySetInnerHTML"==l?u=f:"value"==l?p=f:"checked"==l?_=f:"key"===l||o&&"function"!=typeof f||g[l]===f||ki(e,l,f,g[l],i);if(u)o||d&&(u.__html===d.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),wi(e,li(h)?h:[h],t,n,r,i&&"foreignObject"!==b,s,a,s?s[0]:n.__k&&gi(n,0),o,c),null!=s)for(l=s.length;l--;)null!=s[l]&&di(s[l]);o||(l="value",void 0!==p&&(p!==e[l]||"progress"===b&&!p||"option"===b&&p!==g[l])&&ki(e,l,p,g[l],!1),l="checked",void 0!==_&&_!==e[l]&&ki(e,l,_,g[l],!1))}return e}function xi(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Zr.__e(e,n)}}function Li(e,t,n){var r,i;if(Zr.unmount&&Zr.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||xi(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Zr.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Li(r[i],t,n||"function"!=typeof e.type);n||null==e.__e||di(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function Ai(e,t,n){return this.constructor(e,n)}function Pi(e,t,n){var r,i,s,a;Zr.__&&Zr.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,s=[],a=[],Ii(t,e=(!r&&n||t).__k=hi(pi,null,[e]),i||ai,ai,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?Kr.call(t.childNodes):null,s,!r&&n?n:i?i.__e:t.firstChild,r,a),Mi(s,e,a)}Kr=oi.slice,Zr={__e:function(e,t,n,r){for(var i,s,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&null!=s.getDerivedStateFromError&&(i.setState(s.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(t){e=t}throw e}},Gr=0,$r=function(e){return null!=e&&null==e.constructor},_i.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=ui({},this.state),"function"==typeof e&&(e=e(ui({},n),this.props)),e&&ui(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),bi(this))},_i.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),bi(this))},_i.prototype.render=pi,Yr=[],Qr="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Xr=function(e,t){return e.__v.__b-t.__v.__b},yi.__r=0,ei=0,ti=Ci(!1),ni=Ci(!0),ri=0;var ji,Ti,Ni,Oi,Di=Object.freeze({__proto__:null,Component:_i,Fragment:pi,cloneElement:function(e,t,n){var r,i,s,a,o=ui({},e.props);for(s in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)"key"==s?r=t[s]:"ref"==s?i=t[s]:o[s]=void 0===t[s]&&void 0!==a?a[s]:t[s];return arguments.length>2&&(o.children=arguments.length>3?Kr.call(arguments,2):n),fi(e.type,o,r||e.key,i||e.ref,null)},createContext:function(e,t){var n={__c:t="__cC"+ri++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,bi(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n},createElement:hi,createRef:function(){return{current:null}},h:hi,hydrate:function e(t,n){Pi(t,n,e)},get isValidElement(){return $r},get options(){return Zr},render:Pi,toChildArray:function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(li(t)?t.some((function(t){e(t,n)})):n.push(t)),n}}),Ui=e.getAugmentedNamespace(Di),Bi=0,Wi=[],qi=[],Hi=Zr,Fi=Hi.__b,zi=Hi.__r,Vi=Hi.diffed,Ki=Hi.__c,Zi=Hi.unmount,Gi=Hi.__;function $i(e,t){Hi.__h&&Hi.__h(Ti,e,Bi||t),Bi=0;var n=Ti.__H||(Ti.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:qi}),n.__[e]}function Yi(e){return Bi=1,Ji(as,e)}function Ji(e,t,n){var r=$i(ji++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):as(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Ti,!Ti.u)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter((function(e){return!!e.__c}));if(i.every((function(e){return!e.__N})))return!s||s.call(this,e,t,n);var a=!1;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}})),!(!a&&r.__c.props===e)&&(!s||s.call(this,e,t,n))};Ti.u=!0;var s=Ti.shouldComponentUpdate,a=Ti.componentWillUpdate;Ti.componentWillUpdate=function(e,t,n){if(this.__e){var r=s;s=void 0,i(e,t,n),s=r}a&&a.call(this,e,t,n)},Ti.shouldComponentUpdate=i}return r.__N||r.__}function Qi(e,t){var n=$i(ji++,4);!Hi.__s&&ss(n.__H,t)&&(n.__=e,n.i=t,Ti.__h.push(n))}function Xi(e,t){var n=$i(ji++,7);return ss(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function es(){for(var e;e=Wi.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(rs),e.__H.__h.forEach(is),e.__H.__h=[]}catch(t){e.__H.__h=[],Hi.__e(t,e.__v)}}Hi.__b=function(e){Ti=null,Fi&&Fi(e)},Hi.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Gi&&Gi(e,t)},Hi.__r=function(e){zi&&zi(e),ji=0;var t=(Ti=e.__c).__H;t&&(Ni===Ti?(t.__h=[],Ti.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=qi,e.__N=e.i=void 0}))):(t.__h.forEach(rs),t.__h.forEach(is),t.__h=[],ji=0)),Ni=Ti},Hi.diffed=function(e){Vi&&Vi(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Wi.push(t)&&Oi===Hi.requestAnimationFrame||((Oi=Hi.requestAnimationFrame)||ns)(es)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==qi&&(e.__=e.__V),e.i=void 0,e.__V=qi}))),Ni=Ti=null},Hi.__c=function(e,t){t.some((function(e){try{e.__h.forEach(rs),e.__h=e.__h.filter((function(e){return!e.__||is(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Hi.__e(n,e.__v)}})),Ki&&Ki(e,t)},Hi.unmount=function(e){Zi&&Zi(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{rs(e)}catch(e){t=e}})),n.__H=void 0,t&&Hi.__e(t,n.__v))};var ts="function"==typeof requestAnimationFrame;function ns(e){var t,n=function(){clearTimeout(r),ts&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ts&&(t=requestAnimationFrame(n))}function rs(e){var t=Ti,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Ti=t}function is(e){var t=Ti;e.__c=e.__(),Ti=t}function ss(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function as(e,t){return"function"==typeof t?t(e):t}var os=Object.freeze({__proto__:null,useCallback:function(e,t){return Bi=8,Xi((function(){return e}),t)},useContext:function(e){var t=Ti.context[e.__c],n=$i(ji++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Ti)),t.props.value):e.__},useDebugValue:function(e,t){Hi.useDebugValue&&Hi.useDebugValue(t?t(e):e)},useEffect:function(e,t){var n=$i(ji++,3);!Hi.__s&&ss(n.__H,t)&&(n.__=e,n.i=t,Ti.__H.__h.push(n))},useErrorBoundary:function(e){var t=$i(ji++,10),n=Yi();return t.__=e,Ti.componentDidCatch||(Ti.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]},useId:function(){var e=$i(ji++,11);if(!e.__){for(var t=Ti.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__},useImperativeHandle:function(e,t,n){Bi=6,Qi((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==n?n:n.concat(e))},useLayoutEffect:Qi,useMemo:Xi,useReducer:Ji,useRef:function(e){return Bi=5,Xi((function(){return{current:e}}),[])},useState:Yi}),cs=e.getAugmentedNamespace(os),ls={};Object.defineProperty(ls,"__esModule",{value:!0}),ls.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",function(t){var n=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const r=n(si),i=Ui,s=cs,a=Dr,o=n(ls);t.Snackbar=class{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,a.isDarkMode)()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const t=this.nextItemKey++;return this.items.set(t,e),this.render(),()=>{this.items.delete(t),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,i.render)((0,i.h)("div",null,(0,i.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map((([e,n])=>(0,i.h)(t.SnackbarInstance,Object.assign({},n,{key:e})))))),this.root)}};t.SnackbarContainer=e=>(0,i.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,i.h)("style",null,o.default),(0,i.h)("div",{class:"-cbwsdk-snackbar"},e.children));t.SnackbarInstance=({autoExpand:e,message:t,menuItems:n})=>{const[a,o]=(0,s.useState)(!0),[c,l]=(0,s.useState)(null!=e&&e);(0,s.useEffect)((()=>{const e=[window.setTimeout((()=>{o(!1)}),1),window.setTimeout((()=>{l(!0)}),1e4)];return()=>{e.forEach(window.clearTimeout)}}));return(0,i.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",a&&"-cbwsdk-snackbar-instance-hidden",c&&"-cbwsdk-snackbar-instance-expanded")},(0,i.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:()=>{l(!c)}},(0,i.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,i.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),(0,i.h)("div",{class:"-gear-container"},!c&&(0,i.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,i.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=",class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&(0,i.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map(((e,t)=>(0,i.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:e.onClick,key:t},(0,i.h)("svg",{width:e.svgWidth,height:e.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.h)("path",{"fill-rule":e.defaultFillRule,"clip-rule":e.defaultClipRule,d:e.path,fill:"#AAAAAA"})),(0,i.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},e.info))))))}}(Fr),Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.WalletLinkRelayUI=void 0;const us=Br,ds=Fr;Ur.WalletLinkRelayUI=class{constructor(){this.attached=!1,this.snackbar=new ds.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.snackbar.attach(t),this.attached=!0,(0,us.injectCssReset)()}showConnecting(e){let t;return t=e.isUnlinkedErrorState?{autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:{message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}};var hs={},fs={},ps={};Object.defineProperty(ps,"__esModule",{value:!0}),ps.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var _s=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fs,"__esModule",{value:!0}),fs.RedirectDialog=void 0;const gs=_s(si),ms=Ui,bs=Br,ys=Fr,ws=Dr,vs=_s(ps);fs.RedirectDialog=class{constructor(){this.root=null,this.darkMode=(0,ws.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,bs.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,ms.render)(null,this.root),e&&(0,ms.render)((0,ms.h)(Es,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}};const Es=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:i})=>{const s=n?"dark":"light";return(0,ms.h)(ys.SnackbarContainer,{darkMode:n},(0,ms.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,ms.h)("style",null,vs.default),(0,ms.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),(0,ms.h)("div",{class:(0,gs.default)("-cbwsdk-redirect-dialog-box",s)},(0,ms.h)("p",null,e),(0,ms.h)("button",{onClick:r},t))))};var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0}),Ss.CBW_MOBILE_DEEPLINK_URL=Ss.WALLETLINK_URL=Ss.CB_KEYS_URL=void 0,Ss.CB_KEYS_URL="https://keys.coinbase.com/connect",Ss.WALLETLINK_URL="https://www.walletlink.org",Ss.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink",Object.defineProperty(hs,"__esModule",{value:!0}),hs.WLMobileRelayUI=void 0;const ks=fs,Cs=Dr,Is=Ss;hs.WLMobileRelayUI=class{constructor(){this.attached=!1,this.redirectDialog=new ks.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const t=new URL(Is.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,Cs.getLocation)().href),e&&t.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=t.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout((()=>{this.redirectToCoinbaseWallet(e)}),99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}},Object.defineProperty(sn,"__esModule",{value:!0}),sn.WalletLinkRelay=void 0;const Ms=an,Rs=tn,xs=nn,Ls=mn,As=E,Ps=Dr,js=Ur,Ts=hs,Ns=u,Os=L,Ds=Q;class Us{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,Ps.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=e=>{this.isLinked=e;const t=this.storage.getItem(Rs.LOCAL_STORAGE_ADDRESSES_KEY);if(e&&(this._session.linked=e),this.isUnlinkedErrorState=!1,t){const n=t.split(" "),r="true"===this.storage.getItem("IsStandaloneSigning");""===n[0]||e||!this._session.linked||r||(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(e,t)=>{this.storage.setItem(e,t)},this.chainUpdated=(e,t)=>{this.chainCallbackParams.chainId===e&&this.chainCallbackParams.jsonRpcUrl===t||(this.chainCallbackParams={chainId:e,jsonRpcUrl:t},this.chainCallback&&this.chainCallback(e,t))},this.accountUpdated=e=>{this.accountsCallback&&this.accountsCallback([e]),Us.accountRequestCallbackIds.size>0&&(Array.from(Us.accountRequestCallbackIds.values()).forEach((t=>{const n={type:"WEB3_RESPONSE",id:t,response:{method:"requestEthereumAccounts",result:[e]}};this.invokeCallback(Object.assign(Object.assign({},n),{id:t}))})),Us.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:t,ui:n,connection:r}=this.subscribe();this._session=t,this.connection=r,this.relayEventManager=new xs.RelayEventManager,this.ui=n}subscribe(){const e=Ls.WalletLinkSession.load(this.storage)||new Ls.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,n=new Ms.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),r=this.isMobileWeb?new Ts.WLMobileRelayUI:new js.WalletLinkRelayUI;return n.connect(),{session:e,ui:r,connection:n}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise((e=>setTimeout((()=>e(null)),1e3)))]).then((()=>{this.connection.destroy();const e=Ls.WalletLinkSession.load(this.storage);(null==e?void 0:e.id)===this._session.id&&Ds.ScopedLocalStorage.clearAll(),document.location.reload()})).catch((e=>{}))}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,n,r){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,Os.hexStringFromBuffer)(e,!0),address:t,addPrefix:n,typedDataJson:r||null}})}ethereumAddressFromSignedMessage(e,t,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,Os.hexStringFromBuffer)(e,!0),signature:(0,Os.hexStringFromBuffer)(t,!0),addPrefix:n}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,Os.bigIntStringFromBigInt)(e.weiValue),data:(0,Os.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,Os.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,Os.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,Os.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,Os.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,Os.bigIntStringFromBigInt)(e.weiValue),data:(0,Os.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,Os.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,Os.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,Os.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,Os.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,Os.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getWalletLinkSession(){return this._session}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null;const n=(0,Os.randomBytesHex)(8),r=r=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,r),null==t||t()};return new Promise(((i,s)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:r,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,(e=>{if(null==t||t(),(0,As.isErrorResponse)(e))return s(new Error(e.errorMessage));i(e)})),this.publishWeb3RequestEvent(n,e)}))}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const n={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",n,!0).then((e=>{})).catch((e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n.id,response:{method:t.method,errorMessage:e.message}})})),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof Ts.WLMobileRelayUI)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",(()=>{window.addEventListener("focus",(()=>{this.connection.checkUnseenEvents()}),{once:!0})}),{once:!0}),this.ui.openCoinbaseWalletDeeplink()}}publishWeb3RequestCanceledEvent(e){const t={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",t,!1).then()}publishEvent(e,t,n){return this.connection.publishEvent(e,t,n)}handleWeb3ResponseMessage(e){const{response:t}=e;if("requestEthereumAccounts"===t.method)return Us.accountRequestCallbackIds.forEach((t=>this.invokeCallback(Object.assign(Object.assign({},e),{id:t})))),void Us.accountRequestCallbackIds.clear();this.invokeCallback(e)}handleErrorResponse(e,t,n){var r;const i=null!==(r=null==n?void 0:n.message)&&void 0!==r?r:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:i}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,Os.randomBytesHex)(8);return new Promise(((n,r)=>{this.relayEventManager.callbacks.set(t,(e=>{if((0,As.isErrorResponse)(e))return r(new Error(e.errorMessage));n(e)})),Us.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)}))}watchAsset(e,t,n,r,i,s){const a={method:"watchAsset",params:{type:e,options:{address:t,symbol:n,decimals:r,image:i},chainId:s}};let o=null;const c=(0,Os.randomBytesHex)(8),l=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,e),null==o||o()};return o=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise(((e,t)=>{this.relayEventManager.callbacks.set(c,(n=>{if(null==o||o(),(0,As.isErrorResponse)(n))return t(new Error(n.errorMessage));e(n)})),this.publishWeb3RequestEvent(c,a)}))}addEthereumChain(e,t,n,r,i,s){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:r,chainName:i,iconUrls:n,nativeCurrency:s}};let o=null;const c=(0,Os.randomBytesHex)(8),l=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,e),null==o||o()};return o=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise(((e,t)=>{this.relayEventManager.callbacks.set(c,(n=>{if(null==o||o(),(0,As.isErrorResponse)(n))return t(new Error(n.errorMessage));e(n)})),this.publishWeb3RequestEvent(c,a)}))}switchEthereumChain(e,t){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},r=(0,Os.randomBytesHex)(8);return new Promise(((e,t)=>{this.relayEventManager.callbacks.set(r,(n=>(0,As.isErrorResponse)(n)&&n.errorCode?t(Ns.standardErrors.provider.custom({code:n.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."})):(0,As.isErrorResponse)(n)?t(new Error(n.errorMessage)):void e(n))),this.publishWeb3RequestEvent(r,n)}))}}sn.WalletLinkRelay=Us,Us.accountRequestCallbackIds=new Set;var Bs=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(be,"__esModule",{value:!0}),be.WalletLinkSigner=void 0;const Ws=Bs(en),qs=tn,Hs=nn,Fs=E,zs=sn,Vs=Ss,Ks=u,Zs=L,Gs=Q,$s="DefaultChainId",Ys="DefaultJsonRpcUrl";be.WalletLinkSigner=class{constructor(e){var t,n;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:r,appLogoUrl:i}=e.metadata;this._appName=r,this._appLogoUrl=i,this._storage=new Gs.ScopedLocalStorage("walletlink",Vs.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new Hs.RelayEventManager,this._jsonRpcUrlFromOpts="";const s=this._storage.getItem(qs.LOCAL_STORAGE_ADDRESSES_KEY);if(s){const e=s.split(" ");""!==e[0]&&(this._addresses=e.map((e=>(0,Zs.ensureAddressString)(e))),null===(t=this.updateListener)||void 0===t||t.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem($s)&&(null===(n=this.updateListener)||void 0===n||n.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:n}=e.getWalletLinkSession();return{id:t,secret:n}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return null!==(e=this._storage.getItem(Ys))&&void 0!==e?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(Ys,e)}updateProviderInfo(e,t){var n;this.jsonRpcUrl=e;const r=this.getChainId();this._storage.setItem($s,t.toString(10));!((0,Zs.ensureIntNumber)(t)!==r)&&this.hasMadeFirstChainChangedEmission||(null===(n=this.updateListener)||void 0===n||n.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,n,r,i,s){const a=this.initializeRelay(),o=await a.watchAsset(e,t,n,r,i,null==s?void 0:s.toString());return!(0,Fs.isErrorResponse)(o)&&!!o.result}async addEthereumChain(e,t,n,r,i,s){var a,o;if((0,Zs.ensureIntNumber)(e)===this.getChainId())return!1;const c=this.initializeRelay();this._isAuthorized()||await c.requestEthereumAccounts();const l=await c.addEthereumChain(e.toString(),t,i,n,r,s);return!(0,Fs.isErrorResponse)(l)&&(!0===(null===(a=l.result)||void 0===a?void 0:a.isApproved)&&this.updateProviderInfo(t[0],e),!0===(null===(o=l.result)||void 0===o?void 0:o.isApproved))}async switchEthereumChain(e){const t=this.initializeRelay(),n=await t.switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,Fs.isErrorResponse)(n)){if(!n.errorCode)return;throw n.errorCode===Ks.standardErrorCodes.provider.unsupportedChain?Ks.standardErrors.provider.unsupportedChain():Ks.standardErrors.provider.custom({message:n.errorMessage,code:n.errorCode})}const r=n.result;r.isApproved&&r.rpcUrl.length>0&&this.updateProviderInfo(r.rpcUrl,e)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(e){try{return this._request(e).catch((e=>{throw e}))}catch(e){return Promise.reject(e)}}async _request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw Ks.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw Ks.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw Ks.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const r=void 0===n?[]:n,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:r,jsonrpc:"2.0",id:i})).result}_setAddresses(e,t){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const r=e.map((e=>(0,Zs.ensureAddressString)(e)));JSON.stringify(r)!==JSON.stringify(this._addresses)&&(this._addresses=r,null===(n=this.updateListener)||void 0===n||n.onAccountsUpdate({accounts:r,source:"wallet"}),this._storage.setItem(qs.LOCAL_STORAGE_ADDRESSES_KEY,r.join(" ")))}_sendRequestAsync(e){return new Promise(((t,n)=>{try{const n=this._handleSynchronousMethods(e);if(void 0!==n)return t({jsonrpc:"2.0",id:e.id,result:n})}catch(e){return n(e)}this._handleAsynchronousMethods(e).then((n=>n&&t(Object.assign(Object.assign({},n),{id:e.id})))).catch((e=>n(e)))}))}_handleSynchronousMethods(e){const{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,n=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(n);case"eth_ecRecover":return this._eth_ecRecover(n);case"personal_sign":return this._personal_sign(n);case"personal_ecRecover":return this._personal_ecRecover(n);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(n);case"eth_signTypedData_v2":default:return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(n);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(n);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(n);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(n);case"wallet_watchAsset":return this._wallet_watchAsset(n)}}_isKnownAddress(e){try{const t=(0,Zs.ensureAddressString)(e);return this._addresses.map((e=>(0,Zs.ensureAddressString)(e))).includes(t)}catch(e){}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,Zs.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);return{fromAddress:t,toAddress:e.to?(0,Zs.ensureAddressString)(e.to):null,weiValue:null!=e.value?(0,Zs.ensureBigInt)(e.value):BigInt(0),data:e.data?(0,Zs.ensureBuffer)(e.data):Buffer.alloc(0),nonce:null!=e.nonce?(0,Zs.ensureIntNumber)(e.nonce):null,gasPriceInWei:null!=e.gasPrice?(0,Zs.ensureBigInt)(e.gasPrice):null,maxFeePerGas:null!=e.maxFeePerGas?(0,Zs.ensureBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:null!=e.maxPriorityFeePerGas?(0,Zs.ensureBigInt)(e.maxPriorityFeePerGas):null,gasLimit:null!=e.gas?(0,Zs.ensureBigInt)(e.gas):null,chainId:e.chainId?(0,Zs.ensureIntNumber)(e.chainId):this.getChainId()}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw Ks.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw Ks.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,n,r){this._ensureKnownAddress(t);try{const i=this.initializeRelay(),s=await i.signEthereumMessage(e,t,n,r);if((0,Fs.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Ks.standardErrors.provider.userRejectedRequest("User denied message signature");throw e}}async _ethereumAddressFromSignedMessage(e,t,n){const r=this.initializeRelay(),i=await r.ethereumAddressFromSignedMessage(e,t,n);if((0,Fs.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,Zs.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem($s);if(!e)return(0,Zs.ensureIntNumber)(1);const t=parseInt(e,10);return(0,Zs.ensureIntNumber)(t)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let e;try{const t=this.initializeRelay();if(e=await t.requestEthereumAccounts(),(0,Fs.isErrorResponse)(e))throw new Error(e.errorMessage)}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Ks.standardErrors.provider.userRejectedRequest("User denied account authorization");throw e}if(!e.result)throw new Error("accounts received is empty");return this._setAddresses(e.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const t=(0,Zs.ensureAddressString)(e[0]),n=(0,Zs.ensureBuffer)(e[1]);return this._signEthereumMessage(n,t,!1)}_eth_ecRecover(e){const t=(0,Zs.ensureBuffer)(e[0]),n=(0,Zs.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,Zs.ensureBuffer)(e[0]),n=(0,Zs.ensureAddressString)(e[1]);return this._signEthereumMessage(t,n,!0)}_personal_ecRecover(e){const t=(0,Zs.ensureBuffer)(e[0]),n=(0,Zs.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=this.initializeRelay(),n=await e.signEthereumTransaction(t);if((0,Fs.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Ks.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw e}}async _eth_sendRawTransaction(e){const t=(0,Zs.ensureBuffer)(e[0]),n=this.initializeRelay(),r=await n.submitEthereumTransaction(t,this.getChainId());if((0,Fs.isErrorResponse)(r))throw new Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=this.initializeRelay(),n=await e.signAndSubmitEthereumTransaction(t);if((0,Fs.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Ks.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw e}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,Zs.ensureParsedJSONObject)(e[0]),n=(0,Zs.ensureAddressString)(e[1]);this._ensureKnownAddress(n);const r=Ws.default.hashForSignTypedDataLegacy({data:t}),i=JSON.stringify(t,null,2);return this._signEthereumMessage(r,n,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,Zs.ensureAddressString)(e[0]),n=(0,Zs.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const r=Ws.default.hashForSignTypedData_v3({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(r,t,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,Zs.ensureAddressString)(e[0]),n=(0,Zs.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const r=Ws.default.hashForSignTypedData_v4({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(r,t,!1,i)}async _wallet_addEthereumChain(e){var t,n,r,i;const s=e[0];if(0===(null===(t=s.rpcUrls)||void 0===t?void 0:t.length))return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!s.chainName||""===s.chainName.trim())throw Ks.standardErrors.rpc.invalidParams("chainName is a required field");if(!s.nativeCurrency)throw Ks.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const a=parseInt(s.chainId,16);return await this.addEthereumChain(a,null!==(n=s.rpcUrls)&&void 0!==n?n:[],null!==(r=s.blockExplorerUrls)&&void 0!==r?r:[],s.chainName,null!==(i=s.iconUrls)&&void 0!==i?i:[],s.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const t=Array.isArray(e)?e[0]:e;if(!t.type)throw Ks.standardErrors.rpc.invalidParams("Type is required");if("ERC20"!==(null==t?void 0:t.type))throw Ks.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(null==t?void 0:t.options))throw Ks.standardErrors.rpc.invalidParams("Options are required");if(!(null==t?void 0:t.options.address))throw Ks.standardErrors.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:r,symbol:i,image:s,decimals:a}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,r,i,a,s,n)}}initializeRelay(){if(!this._relay){const e=new zs.WalletLinkRelay({linkAPIUrl:Vs.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback(((e,t)=>this._setAddresses(e,t))),e.setChainCallback(((e,t)=>{this.updateProviderInfo(t,parseInt(e,10))})),this._relay=e}return this._relay}};var Js={};Object.defineProperty(Js,"__esModule",{value:!0}),Js.checkErrorForInvalidRequestArgs=Js.getCoinbaseInjectedProvider=Js.getCoinbaseInjectedSigner=Js.fetchRPCRequest=void 0;const Qs=S,Xs=u;function ea(){return globalThis.coinbaseWalletSigner}Js.fetchRPCRequest=async function(e,t){if(!t.rpcUrl)throw Xs.standardErrors.rpc.internal("No RPC URL set for chain");const n=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),r=await window.fetch(t.rpcUrl,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Qs.LIB_VERSION}});return(await r.json()).result},Js.getCoinbaseInjectedSigner=ea,Js.getCoinbaseInjectedProvider=function({metadata:e,preference:t}){var n,r,i;const s=globalThis;if("smartWalletOnly"!==t.options){if(ea())return;const t=s.coinbaseWalletExtension;if(t){const{appName:r,appLogoUrl:i,appChainIds:s}=e;return null===(n=t.setAppInfo)||void 0===n||n.call(t,r,i,s),t}}const a=null!==(r=s.ethereum)&&void 0!==r?r:null===(i=s.top)||void 0===i?void 0:i.ethereum;if(null==a?void 0:a.isCoinbaseBrowser)return a},Js.checkErrorForInvalidRequestArgs=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return Xs.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;return"string"!=typeof t||0===t.length?Xs.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e}):void 0===n||Array.isArray(n)||"object"==typeof n&&null!==n?void 0:Xs.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e})},Object.defineProperty(z,"__esModule",{value:!0}),z.createSigner=z.fetchSignerType=z.storeSignerType=z.loadSignerType=void 0;const ta=V,na=be,ra=u,ia=Js,sa="SignerType",aa=new Q.ScopedLocalStorage("CBWSDK","SignerConfigurator");z.loadSignerType=function(){return aa.getItem(sa)},z.storeSignerType=function(e){aa.setItem(sa,e)},z.fetchSignerType=async function(e){const{communicator:t,metadata:n}=e;(async function(e,t){await e.onMessage((({event:e})=>"WalletLinkSessionRequest"===e));const n=new na.WalletLinkSigner({metadata:t});e.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})})(t,n).catch((()=>{}));const r={id:crypto.randomUUID(),event:"selectSignerType",data:e.preference},{data:i}=await t.postRequestAndWaitForResponse(r);return i},z.createSigner=function(e){const{signerType:t,metadata:n,communicator:r,updateListener:i}=e;switch(t){case"scw":return new ta.SCWSigner({metadata:n,updateListener:i,communicator:r});case"walletlink":return new na.WalletLinkSigner({metadata:n,updateListener:i});case"extension":{const e=(0,ia.getCoinbaseInjectedSigner)();if(!e)throw ra.standardErrors.rpc.internal("injected signer not found");return e}}};var oa={},ca={};Object.defineProperty(ca,"__esModule",{value:!0}),ca.closePopup=ca.openPopup=void 0;const la=u;ca.openPopup=function(e){const t=(window.innerWidth-420)/2+window.screenX,n=(window.innerHeight-540)/2+window.screenY,r=window.open(e,"Smart Wallet",`width=420, height=540, left=${t}, top=${n}`);if(null==r||r.focus(),!r)throw la.standardErrors.rpc.internal("Pop up window failed to open");return r},ca.closePopup=function(e){e&&!e.closed&&e.close()},Object.defineProperty(oa,"__esModule",{value:!0}),oa.Communicator=void 0;const ua=S,da=ca,ha=Ss,fa=u;oa.Communicator=class{constructor(e=ha.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async e=>{(await this.waitForPopupLoaded()).postMessage(e,this.url.origin)},this.postRequestAndWaitForResponse=async e=>{const t=this.onMessage((({requestId:t})=>t===e.id));return this.postMessage(e),await t},this.onMessage=async e=>new Promise(((t,n)=>{const r=n=>{if(n.origin!==this.url.origin)return;const i=n.data;e(i)&&(t(i),window.removeEventListener("message",r),this.listeners.delete(r))};window.addEventListener("message",r),this.listeners.set(r,{reject:n})})),this.disconnect=()=>{(0,da.closePopup)(this.popup),this.popup=null,this.listeners.forEach((({reject:e},t)=>{e(fa.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",t)})),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?this.popup:(this.popup=(0,da.openPopup)(this.url),this.onMessage((({event:e})=>"PopupUnload"===e)).then(this.disconnect).catch((()=>{})),this.onMessage((({event:e})=>"PopupLoaded"===e)).then((e=>{this.postMessage({requestId:e.id,data:{version:ua.LIB_VERSION}})})).then((()=>{if(!this.popup)throw fa.standardErrors.rpc.internal();return this.popup}))),this.url=new URL(e)}};var pa={};Object.defineProperty(pa,"__esModule",{value:!0}),pa.determineMethodCategory=void 0;const _a={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};pa.determineMethodCategory=function(e){for(const t in _a){const n=t;if(_a[n].includes(e))return n}};var ga=e.commonjsGlobal&&e.commonjsGlobal.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},ma=e.commonjsGlobal&&e.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoinbaseWalletProvider=void 0;const ba=ma(e.eventemitter3.exports),ya=u,wa=v,va=R,Ea=L,Sa=z,ka=Js,Ca=oa,Ia=pa,Ma=Q;class Ra extends ba.default{constructor(e){var t,n,{metadata:r}=e,i=e.preference,{keysUrl:s}=i,a=ga(i,["keysUrl"]);super(),this.accounts=[],this.handlers={handshake:async e=>{try{if(this.connected)return this.emit("connect",{chainId:(0,Ea.hexStringFromIntNumber)((0,va.IntNumber)(this.chain.id))}),this.accounts;const e=await this.requestSignerSelection(),t=this.initSigner(e),n=await t.handshake();return this.signer=t,(0,Sa.storeSignerType)(e),this.emit("connect",{chainId:(0,Ea.hexStringFromIntNumber)((0,va.IntNumber)(this.chain.id))}),n}catch(e){throw this.handleUnauthorizedError(e),e}},sign:async e=>{if(!this.connected||!this.signer)throw ya.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(e)}catch(e){throw this.handleUnauthorizedError(e),e}},fetch:e=>(0,ka.fetchRPCRequest)(e,this.chain),state:e=>{const t=()=>{if(this.connected)return this.accounts;throw ya.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(e.method){case"eth_chainId":case"net_version":return this.chain.id;case"eth_accounts":return t();case"eth_coinbase":return t()[0];default:return this.handlers.unsupported(e)}},deprecated:({method:e})=>{throw ya.standardErrors.rpc.methodNotSupported(`Method ${e} is deprecated.`)},unsupported:({method:e})=>{throw ya.standardErrors.rpc.methodNotSupported(`Method ${e} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:e,source:t})=>{(0,Ea.areAddressArraysEqual)(this.accounts,e)||(this.accounts=e,"storage"!==t&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:e,source:t})=>{e.id===this.chain.id&&e.rpcUrl===this.chain.rpcUrl||(this.chain=e,"storage"!==t&&this.emit("chainChanged",(0,Ea.hexStringFromIntNumber)((0,va.IntNumber)(e.id))))}},this.metadata=r,this.preference=a,this.communicator=new Ca.Communicator(s),this.chain={id:null!==(n=null===(t=r.appChainIds)||void 0===t?void 0:t[0])&&void 0!==n?n:1};const o=(0,Sa.loadSignerType)();this.signer=o?this.initSigner(o):null}get connected(){return this.accounts.length>0}async request(e){var t;try{const n=(0,ka.checkErrorForInvalidRequestArgs)(e);if(n)throw n;const r=null!==(t=(0,Ia.determineMethodCategory)(e.method))&&void 0!==t?t:"fetch";return this.handlers[r](e)}catch(t){return Promise.reject((0,wa.serializeError)(t,e.method))}}handleUnauthorizedError(e){e.code===ya.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},Ma.ScopedLocalStorage.clearAll(),this.emit("disconnect",ya.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,Sa.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(e){return(0,Sa.createSigner)({signerType:e,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}l.CoinbaseWalletProvider=Ra,Object.defineProperty(o,"__esModule",{value:!0}),o.CoinbaseWalletSDK=void 0;const xa=c,La=l,Aa=Q,Pa=S,ja=L,Ta=Js;o.CoinbaseWalletSDK=class{constructor(e){this.metadata={appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||(0,ja.getFavicon)(),appChainIds:e.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(e={options:"all"}){var t;const n={metadata:this.metadata,preference:e};return null!==(t=(0,Ta.getCoinbaseInjectedProvider)(n))&&void 0!==t?t:new La.CoinbaseWalletProvider(n)}getCoinbaseWalletLogo(e,t=240){return(0,xa.walletLogo)(e,t)}storeLatestVersion(){new Aa.ScopedLocalStorage("CBWSDK").setItem("VERSION",Pa.LIB_VERSION)}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CoinbaseWalletSDK=void 0;const t=o;e.default=t.CoinbaseWalletSDK;var n=o;Object.defineProperty(e,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}})}(a),exports.default=function({chainId:t,rpcUrl:n,appName:r,appLogoUrl:i,darkMode:s},o){return e.__awaiter(this,void 0,void 0,(function*(){if(window.ethereum&&(window.ethereum.isWalletLink||window.ethereum.isToshi))return e.injectedConnect(window.ethereum,o);if(!r)throw new Error("walletLink need appName");const t=new a.CoinbaseWalletSDK({appName:r,appLogoUrl:i}).makeWeb3Provider({options:"smartWalletOnly"});return yield t.request({method:"eth_requestAccounts"}),t.on("connect",o.connect),t.on("disconnect",o.disconnect),t.on("accountsChanged",o.accountsChanged),t.on("chainChanged",o.chainChanged),e.convertWeb3Provider(t)}))};