@dodoex/wallet-web3 0.0.30-0 → 0.0.30-1

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 (71) hide show
  1. package/dist/__node-resolve_empty-672b707d.js +1 -0
  2. package/dist/__tslib-923c862b.js +1 -0
  3. package/dist/{blocto-12a77399.js → blocto-db551fc5.js} +1 -1
  4. package/dist/{bn-e5737c91.js → bn-7804cfdf.js} +1 -1
  5. package/dist/{browser-ponyfill-30587718.js → browser-ponyfill-8e2008b7.js} +1 -1
  6. package/dist/cjs/{__node-resolve_empty-a0cbc09a.cjs → __node-resolve_empty-f8dee878.cjs} +1 -1
  7. package/dist/cjs/__tslib-405cd1d9.cjs +1 -0
  8. package/dist/cjs/{blocto-49e140ff.cjs → blocto-f0b7f03f.cjs} +1 -1
  9. package/dist/cjs/{bn-789c2be6.cjs → bn-6c1313c5.cjs} +1 -1
  10. package/dist/cjs/{browser-ponyfill-34262ce7.cjs → browser-ponyfill-b18374e2.cjs} +1 -1
  11. package/dist/cjs/{draggabilly-ad97ed53.cjs → draggabilly-f36b9091.cjs} +1 -1
  12. package/dist/cjs/{ethers-2d3c8d93.cjs → ethers-bd5ec50c.cjs} +1 -1
  13. package/dist/cjs/{id-4b4752dc.cjs → id-f2e7548d.cjs} +1 -1
  14. package/dist/cjs/index-4ef116f7.cjs +1 -0
  15. package/dist/cjs/{index-f789c360.cjs → index-561280c7.cjs} +2 -2
  16. package/dist/cjs/{index-565bca0f.cjs → index-721554f1.cjs} +1 -1
  17. package/dist/cjs/{index-beb3b0f2.cjs → index-76c55c27.cjs} +1 -1
  18. package/dist/cjs/{index-6253ce12.cjs → index-80908cfe.cjs} +1 -1
  19. package/dist/cjs/{index-1abefdbf.cjs → index-81f77116.cjs} +1 -1
  20. package/dist/cjs/{index-a486f293.cjs → index-9bf871a7.cjs} +1 -1
  21. package/dist/cjs/{index-a8d33cfb.cjs → index-9cd47e00.cjs} +1 -1
  22. package/dist/cjs/{index-25a0268f.cjs → index-bd17c4cb.cjs} +1 -1
  23. package/dist/cjs/{index-1e606be3.cjs → index-d37833cc.cjs} +1 -1
  24. package/dist/cjs/{index-1d8b8f1c.cjs → index-f55fcdab.cjs} +1 -1
  25. package/dist/cjs/index.cjs +1 -1
  26. package/dist/cjs/{index.es-bfd28bbe.cjs → index.es-9fd13725.cjs} +1 -1
  27. package/dist/cjs/{interface-e0df2618.cjs → interface-d88520ca.cjs} +1 -1
  28. package/dist/cjs/{lib-typedarrays-d05cf01f.cjs → lib-typedarrays-84c1a064.cjs} +1 -1
  29. package/dist/cjs/{portis-5727290f.cjs → portis-d5550394.cjs} +1 -1
  30. package/dist/cjs/{provider-f2a8d807.cjs → provider-726d22d6.cjs} +1 -1
  31. package/dist/cjs/{rainbow-2c1e233f.cjs → rainbow-57c16ca9.cjs} +1 -1
  32. package/dist/cjs/{sha224-5e808855.cjs → sha224-29808c34.cjs} +1 -1
  33. package/dist/cjs/{sha256-efad4d00.cjs → sha256-d8366d85.cjs} +1 -1
  34. package/dist/cjs/{typed-data-3135d89d.cjs → typed-data-2e6d0d70.cjs} +1 -1
  35. package/dist/cjs/{uAuth-bbfdcae9.cjs → uAuth-68de3860.cjs} +1 -1
  36. package/dist/cjs/{walletConnect-ad5b90e8.cjs → walletConnect-0c2f1b68.cjs} +1 -1
  37. package/dist/cjs/{walletLink-c2fddf9f.cjs → walletLink-3ac69ff8.cjs} +1 -1
  38. package/dist/{draggabilly-65ce0a91.js → draggabilly-bb9f2b8b.js} +1 -1
  39. package/dist/{ethers-eefa35f7.js → ethers-6c6c5deb.js} +1 -1
  40. package/dist/{id-fcd21368.js → id-831ffa07.js} +1 -1
  41. package/dist/{index-c6e5a811.js → index-08a4d7ba.js} +1 -1
  42. package/dist/{index-efd7e09c.js → index-18c7d702.js} +1 -1
  43. package/dist/{index-f77dc630.js → index-293e0871.js} +1 -1
  44. package/dist/{index-502aa5bd.js → index-3a2afde2.js} +1 -1
  45. package/dist/{index-7c96bebb.js → index-4867d010.js} +1 -1
  46. package/dist/{index-614f5c3e.js → index-80e912b8.js} +1 -1
  47. package/dist/{index-85646ff0.js → index-b1beeb18.js} +1 -1
  48. package/dist/{index-d491a088.js → index-b8eeae74.js} +1 -1
  49. package/dist/{index-a1c7f913.js → index-e0e8a880.js} +1 -1
  50. package/dist/{index-944df233.js → index-ee581bef.js} +3 -3
  51. package/dist/{index-3cd8e009.js → index-fd49f2bb.js} +1 -1
  52. package/dist/{index.es-ebfb23eb.js → index.es-00774c49.js} +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/{interface-f9439acf.js → interface-9053458c.js} +1 -1
  55. package/dist/{lib-typedarrays-0bf66dd4.js → lib-typedarrays-6e614d5f.js} +1 -1
  56. package/dist/{portis-65fddc6a.js → portis-47ec414f.js} +1 -1
  57. package/dist/{provider-5512f8a9.js → provider-d08f49b0.js} +1 -1
  58. package/dist/rainbow-87c73394.js +1 -0
  59. package/dist/sha224-f7b32ee3.js +1 -0
  60. package/dist/{sha256-5cb46634.js → sha256-8385aa76.js} +1 -1
  61. package/dist/{typed-data-0d0e63b5.js → typed-data-62327e55.js} +1 -1
  62. package/dist/{uAuth-934d6b61.js → uAuth-22df1f68.js} +1 -1
  63. package/dist/{walletConnect-781bce02.js → walletConnect-e55a769c.js} +1 -1
  64. package/dist/{walletLink-975cc13a.js → walletLink-11caac51.js} +1 -1
  65. package/package.json +1 -1
  66. package/dist/__node-resolve_empty-3e741f9d.js +0 -1
  67. package/dist/__tslib-470afd02.js +0 -1
  68. package/dist/cjs/__tslib-23965bc1.cjs +0 -1
  69. package/dist/cjs/index-0de21c4e.cjs +0 -1
  70. package/dist/rainbow-cc851b7a.js +0 -1
  71. package/dist/sha224-dd1012ce.js +0 -1
@@ -1 +1 @@
1
- import{c as e,g as t,b as s,_ as a,d as r,u as n}from"./index-3cd8e009.js";import{b as i}from"./browser-ponyfill-30587718.js";import{e as o,W as d,F as c,l as u,u as l,w as f,v as h,a as g}from"./ethers-eefa35f7.js";import{Signer as p,VoidSigner as _}from"@ethersproject/abstract-signer";import*as E from"@ethersproject/providers";import{getDefaultProvider as m}from"@ethersproject/providers";import{BaseContract as v,Contract as T,ContractFactory as y}from"@ethersproject/contracts";import{B as w,E as S}from"./id-fcd21368.js";import*as I from"@ethersproject/constants";import b from"events";import"zustand";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/bytes";import"@ethersproject/abstract-provider";import"./typed-data-0d0e63b5.js";import"./__node-resolve_empty-3e741f9d.js";import"./hash-a9ebd52a.js";import"./inherits_browser-06ba108b.js";import"@ethersproject/json-wallets";import"./interface-f9439acf.js";import"./index-a1c7f913.js";import"./index-85646ff0.js";var A={},P={},M={},O={},C={},R={name:"@safe-global/safe-apps-sdk",version:"7.10.1",description:"SDK developed to integrate third-party apps with Safe app.",main:"dist/src/index.js",typings:"dist/src/index.d.ts",_files:["dist/**/*","src/**/*","CHANGELOG.md","README.md"],keywords:["Safe","sdk","apps"],scripts:{test:"jest","format-dist":"sed -i '' 's/\"files\":/\"_files\":/' dist/package.json",build:"yarn rimraf dist && tsc && yarn format-dist"},author:"Safe (https://safe.global)",license:"MIT",dependencies:{"@safe-global/safe-gateway-typescript-sdk":"^3.5.3",ethers:"^5.7.2"},devDependencies:{rimraf:"^3.0.2"},repository:{type:"git",url:"git+https://github.com/safe-global/safe-apps-sdk.git"},bugs:{url:"https://github.com/safe-global/safe-apps-sdk/issues"},homepage:"https://github.com/safe-global/safe-apps-sdk#readme",publishConfig:{access:"public"}},N=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(C,"__esModule",{value:!0}),C.getSDKVersion=void 0;const L=N(R);C.getSDKVersion=()=>L.default.version.split("-")[0];var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.generateRequestId=void 0;const j=e=>e.toString(16).padStart(2,"0");D.generateRequestId=()=>"undefined"!=typeof window?(e=>{const t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,j).join("")})(10):(new Date).getTime().toString(36),Object.defineProperty(O,"__esModule",{value:!0}),O.MessageFormatter=void 0;const x=C,H=D;class B{}O.MessageFormatter=B,B.makeRequest=(e,t)=>({id:(0,H.generateRequestId)(),method:e,params:t,env:{sdkVersion:(0,x.getSDKVersion)()}}),B.makeResponse=(e,t,s)=>({id:e,success:!0,version:s,data:t}),B.makeErrorResponse=(e,t,s)=>({id:e,success:!1,error:t,version:s});var k,q,U={};k=U,Object.defineProperty(k,"__esModule",{value:!0}),k.RestrictedMethods=k.Methods=void 0,(q=k.Methods||(k.Methods={})).sendTransactions="sendTransactions",q.rpcCall="rpcCall",q.getChainInfo="getChainInfo",q.getSafeInfo="getSafeInfo",q.getTxBySafeTxHash="getTxBySafeTxHash",q.getSafeBalances="getSafeBalances",q.signMessage="signMessage",q.signTypedMessage="signTypedMessage",q.getEnvironmentInfo="getEnvironmentInfo",q.getOffChainSignature="getOffChainSignature",q.requestAddressBook="requestAddressBook",q.wallet_getPermissions="wallet_getPermissions",q.wallet_requestPermissions="wallet_requestPermissions",(k.RestrictedMethods||(k.RestrictedMethods={})).requestAddressBook="requestAddressBook",function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0});const r=O;t.default=class{constructor(e=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer="undefined"==typeof window,this.isValidMessage=({origin:e,data:t,source:s})=>{const a=!t,r=!this.isServer&&s===window.parent,n=(void 0!==t.version&&parseInt(t.version.split(".")[0]))>=1;let i=!0;return Array.isArray(this.allowedOrigins)&&(i=void 0!==this.allowedOrigins.find((t=>t.test(e)))),!a&&r&&n&&i},this.logIncomingMessage=e=>{console.info(`Safe Apps SDK v1: A message was received from origin ${e.origin}. `,e.data)},this.onParentMessage=e=>{this.isValidMessage(e)&&(this.debugMode&&this.logIncomingMessage(e),this.handleIncomingMessage(e.data))},this.handleIncomingMessage=e=>{const{id:t}=e,s=this.callbacks.get(t);s&&(s(e),this.callbacks.delete(t))},this.send=(e,t)=>{const s=r.MessageFormatter.makeRequest(e,t);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(s,"*"),new Promise(((e,t)=>{this.callbacks.set(s.id,(s=>{s.success?e(s):t(new Error(s.error))}))}))},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}},a(U,t)}(M);var G={},$={},F={};Object.defineProperty(F,"__esModule",{value:!0}),F.isObjectEIP712TypedData=void 0;F.isObjectEIP712TypedData=e=>"object"==typeof e&&null!=e&&"domain"in e&&"types"in e&&"message"in e;var V={};Object.defineProperty(V,"__esModule",{value:!0});var W={},K={},Q={},X={},Y=e&&e.__awaiter||function(e,t,s,a){return new(s||(s=Promise))((function(r,n){function i(e){try{d(a.next(e))}catch(e){n(e)}}function o(e){try{d(a.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(i,o)}d((a=a.apply(e,t||[])).next())}))},J=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.fetchData=X.stringifyQuery=X.insertParams=void 0;const z=J(i.exports);X.insertParams=function(e,t){return t?Object.keys(t).reduce(((e,s)=>function(e,t,s){return e.replace(new RegExp(`\\{${t}\\}`,"g"),s)}(e,s,String(t[s]))),e):e},X.stringifyQuery=function(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach((s=>{null!=e[s]&&t.append(s,String(e[s]))}));const s=t.toString();return s?`?${s}`:""},X.fetchData=function(e,t){return Y(this,void 0,void 0,(function*(){let s;null!=t&&(s={method:"POST",body:"string"==typeof t?t:JSON.stringify(t),headers:{"Content-Type":"application/json"}});const a=yield(0,z.default)(e,s);let r;try{r=yield a.json()}catch(e){if(a.headers&&"0"!==a.headers.get("content-length"))throw new Error(`Invalid response content: ${a.statusText}`)}if(!a.ok){const e="object"==typeof(n=r)&&null!==n&&"code"in n&&"message"in n?`${r.code}: ${r.message}`:a.statusText;throw new Error(e)}var n;return r}))},Object.defineProperty(Q,"__esModule",{value:!0}),Q.getEndpoint=Q.postEndpoint=void 0;const Z=X;function ee(e,t,s,a){return`${e}${(0,Z.insertParams)(t,s)}${(0,Z.stringifyQuery)(a)}`}Q.postEndpoint=function(e,t,s){const a=ee(e,t,null==s?void 0:s.path,null==s?void 0:s.query);return(0,Z.fetchData)(a,null==s?void 0:s.body)},Q.getEndpoint=function(e,t,s,a){if(a)return(0,Z.fetchData)(a);const r=ee(e,t,null==s?void 0:s.path,null==s?void 0:s.query);return(0,Z.fetchData)(r)};var te={};Object.defineProperty(te,"__esModule",{value:!0}),te.DEFAULT_BASE_URL=void 0,te.DEFAULT_BASE_URL="https://safe-client.safe.global";var se={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,(t=e.ImplementationVersionState||(e.ImplementationVersionState={})).UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(se);var ae={};!function(e){var t,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,(t=e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})).NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST",(e.SafeAppFeatures||(e.SafeAppFeatures={})).BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS",(s=e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={})).TWITTER="TWITTER",s.GITHUB="GITHUB",s.DISCORD="DISCORD"}(ae);var re={};!function(e){var t,s,a,r,n,i,o,d,c,u;Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,(t=e.Operation||(e.Operation={}))[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE",(s=e.TransactionStatus||(e.TransactionStatus={})).AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",s.AWAITING_EXECUTION="AWAITING_EXECUTION",s.CANCELLED="CANCELLED",s.FAILED="FAILED",s.SUCCESS="SUCCESS",(a=e.TransferDirection||(e.TransferDirection={})).INCOMING="INCOMING",a.OUTGOING="OUTGOING",a.UNKNOWN="UNKNOWN",(r=e.TransactionTokenType||(e.TransactionTokenType={})).ERC20="ERC20",r.ERC721="ERC721",r.NATIVE_COIN="NATIVE_COIN",(n=e.SettingsInfoType||(e.SettingsInfoType={})).SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",n.ADD_OWNER="ADD_OWNER",n.REMOVE_OWNER="REMOVE_OWNER",n.SWAP_OWNER="SWAP_OWNER",n.CHANGE_THRESHOLD="CHANGE_THRESHOLD",n.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",n.ENABLE_MODULE="ENABLE_MODULE",n.DISABLE_MODULE="DISABLE_MODULE",n.SET_GUARD="SET_GUARD",n.DELETE_GUARD="DELETE_GUARD",(i=e.TransactionInfoType||(e.TransactionInfoType={})).TRANSFER="Transfer",i.SETTINGS_CHANGE="SettingsChange",i.CUSTOM="Custom",i.CREATION="Creation",(o=e.ConflictType||(e.ConflictType={})).NONE="None",o.HAS_NEXT="HasNext",o.END="End",(d=e.TransactionListItemType||(e.TransactionListItemType={})).TRANSACTION="TRANSACTION",d.LABEL="LABEL",d.CONFLICT_HEADER="CONFLICT_HEADER",d.DATE_LABEL="DATE_LABEL",(c=e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})).MULTISIG="MULTISIG",c.MODULE="MODULE",(u=e.LabelValue||(e.LabelValue={})).Queued="Queued",u.Next="Next"}(re);var ne={};!function(e){var t,s,a;Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,(t=e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})).API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN",(s=e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})).ORACLE="ORACLE",s.FIXED="FIXED",s.UNKNOWN="UNKNOWN",(a=e.FEATURES||(e.FEATURES={})).ERC721="ERC721",a.SAFE_APPS="SAFE_APPS",a.CONTRACT_INTERACTION="CONTRACT_INTERACTION",a.DOMAIN_LOOKUP="DOMAIN_LOOKUP",a.SPENDING_LIMIT="SPENDING_LIMIT",a.EIP1559="EIP1559",a.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",a.TX_SIMULATION="TX_SIMULATION",a.EIP1271="EIP1271"}(ne);var ie={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,(t=e.TokenType||(e.TokenType={})).ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(ie);var oe={};Object.defineProperty(oe,"__esModule",{value:!0});var de={};Object.defineProperty(de,"__esModule",{value:!0});var ce={};!function(e){var t,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,(t=e.SafeMessageListItemType||(e.SafeMessageListItemType={})).DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE",(s=e.SafeMessageStatus||(e.SafeMessageStatus={})).NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",s.CONFIRMED="CONFIRMED"}(ce),function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.confirmSafeMessage=t.proposeSafeMessage=t.getSafeMessage=t.getSafeMessages=t.getDecodedData=t.getMasterCopies=t.getSafeApps=t.getChainConfig=t.getChainsConfig=t.proposeTransaction=t.postSafeGasEstimation=t.getTransactionDetails=t.getTransactionQueue=t.getTransactionHistory=t.getCollectiblesPage=t.getCollectibles=t.getOwnedSafes=t.getFiatCurrencies=t.getBalances=t.getMultisigTransactions=t.getModuleTransactions=t.getIncomingTransfers=t.getSafeInfo=t.setBaseUrl=void 0;const r=Q,n=te;a(se,t),a(ae,t),a(re,t),a(ne,t),a(ie,t),a(oe,t),a(de,t),a(ce,t);let i=n.DEFAULT_BASE_URL;t.setBaseUrl=e=>{i=e},t.getSafeInfo=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:e,address:t}})},t.getIncomingTransfers=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:e,address:t},query:s},a)},t.getModuleTransactions=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:e,address:t},query:s},a)},t.getMultisigTransactions=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:e,address:t},query:s},a)},t.getBalances=function(e,t,s="usd",a={}){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:e,address:t,currency:s},query:a})},t.getFiatCurrencies=function(){return(0,r.getEndpoint)(i,"/v1/balances/supported-fiat-codes")},t.getOwnedSafes=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:e,address:t}})},t.getCollectibles=function(e,t,s={}){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:s})},t.getCollectiblesPage=function(e,t,s={},a){return(0,r.getEndpoint)(i,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:s},a)},t.getTransactionHistory=function(e,t,s){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:e,safe_address:t},query:{}},s)},t.getTransactionQueue=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:e,safe_address:t},query:{trusted:a}},s)},t.getTransactionDetails=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:e,transactionId:t}})},t.postSafeGasEstimation=function(e,t,s){return(0,r.postEndpoint)(i,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:e,safe_address:t},body:s})},t.proposeTransaction=function(e,t,s){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:e,safe_address:t},body:s})},t.getChainsConfig=function(e){return(0,r.getEndpoint)(i,"/v1/chains",{query:e})},t.getChainConfig=function(e){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}",{path:{chainId:e}})},t.getSafeApps=function(e,t={}){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safe-apps",{path:{chainId:e},query:t})},t.getMasterCopies=function(e){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:e}})},t.getDecodedData=function(e,t){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/data-decoder",{path:{chainId:e},body:{data:t}})},t.getSafeMessages=function(e,t,s){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},query:{}},s)},t.getSafeMessage=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:e,message_hash:t}})},t.proposeSafeMessage=function(e,t,s){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},body:s})},t.confirmSafeMessage=function(e,t,s){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:e,message_hash:t},body:s})}}(K),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TransferDirection=e.TransactionStatus=e.TokenType=e.Operation=void 0;var t=K;Object.defineProperty(e,"Operation",{enumerable:!0,get:function(){return t.Operation}}),Object.defineProperty(e,"TokenType",{enumerable:!0,get:function(){return t.TokenType}}),Object.defineProperty(e,"TransactionStatus",{enumerable:!0,get:function(){return t.TransactionStatus}}),Object.defineProperty(e,"TransferDirection",{enumerable:!0,get:function(){return t.TransferDirection}})}(W);var ue={};Object.defineProperty(ue,"__esModule",{value:!0}),function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),a(F,t),a(V,t),a(W,t),a(ue,t)}($),Object.defineProperty(G,"__esModule",{value:!0}),G.TXs=void 0;const le=U,fe=$;G.TXs=class{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(le.Methods.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const t={message:e};return(await this.communicator.send(le.Methods.signMessage,t)).data}async signTypedMessage(e){if(!(0,fe.isObjectEIP712TypedData)(e))throw new Error("Invalid typed data");return(await this.communicator.send(le.Methods.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw new Error("No transactions were passed");const s={txs:e,params:t};return(await this.communicator.send(le.Methods.sendTransactions,s)).data}};var he={},ge={};Object.defineProperty(ge,"__esModule",{value:!0}),ge.RPC_CALLS=void 0,ge.RPC_CALLS={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},Object.defineProperty(he,"__esModule",{value:!0}),he.Eth=void 0;const pe=ge,_e=U,Ee={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};he.Eth=class{constructor(e){this.communicator=e,this.call=this.buildRequest({call:pe.RPC_CALLS.eth_call,formatters:[null,Ee.defaultBlockParam]}),this.getBalance=this.buildRequest({call:pe.RPC_CALLS.eth_getBalance,formatters:[null,Ee.defaultBlockParam]}),this.getCode=this.buildRequest({call:pe.RPC_CALLS.eth_getCode,formatters:[null,Ee.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:pe.RPC_CALLS.eth_getStorageAt,formatters:[null,Ee.blockNumberToHex,Ee.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:pe.RPC_CALLS.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:pe.RPC_CALLS.eth_getBlockByHash,formatters:[null,Ee.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:pe.RPC_CALLS.eth_getBlockByNumber,formatters:[Ee.blockNumberToHex,Ee.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:pe.RPC_CALLS.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:pe.RPC_CALLS.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:pe.RPC_CALLS.eth_getTransactionCount,formatters:[null,Ee.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:pe.RPC_CALLS.eth_gasPrice}),this.getEstimateGas=e=>this.buildRequest({call:pe.RPC_CALLS.eth_estimateGas})([e]),this.setSafeSettings=this.buildRequest({call:pe.RPC_CALLS.safe_setSettings})}buildRequest(e){const{call:t,formatters:s}=e;return async e=>{s&&Array.isArray(e)&&s.forEach(((t,s)=>{t&&(e[s]=t(e[s]))}));const a={call:t,params:e||[]};return(await this.communicator.send(_e.Methods.rpcCall,a)).data}}};var me={};try{const e=window;null==e._ethers&&(e._ethers=o)}catch(e){}var ve=t(Object.freeze({__proto__:null,ethers:o,Signer:p,Wallet:d,VoidSigner:_,getDefaultProvider:m,providers:E,BaseContract:v,Contract:T,ContractFactory:y,BigNumber:w,FixedNumber:c,constants:I,get errors(){return S},logger:u,utils:l,wordlists:f,version:h,Wordlist:g})),Te={};Object.defineProperty(Te,"__esModule",{value:!0}),Te.MAGIC_VALUE_BYTES=Te.MAGIC_VALUE=Te.EIP_1271_BYTES_INTERFACE=Te.EIP_1271_INTERFACE=void 0;const ye=ve;Te.MAGIC_VALUE="0x1626ba7e";Te.MAGIC_VALUE_BYTES="0x20c13b0b";const we=new ye.ethers.utils.Interface(["function isValidSignature(bytes32 _dataHash, bytes calldata _signature) external view"]);Te.EIP_1271_INTERFACE=we;const Se=new ye.ethers.utils.Interface(["function isValidSignature(bytes calldata _data, bytes calldata _signature) public view"]);Te.EIP_1271_BYTES_INTERFACE=Se;var Ie={},be={},Ae={};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.PermissionsError=Ae.PERMISSIONS_REQUEST_REJECTED=void 0,Ae.PERMISSIONS_REQUEST_REJECTED=4001;class Pe extends Error{constructor(e,t,s){super(e),this.code=t,this.data=s,Object.setPrototypeOf(this,Pe.prototype)}}Ae.PermissionsError=Pe,Object.defineProperty(be,"__esModule",{value:!0}),be.Wallet=void 0;const Me=U,Oe=Ae;be.Wallet=class{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(Me.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new Oe.PermissionsError("Permissions request is invalid",Oe.PERMISSIONS_REQUEST_REJECTED);try{return(await this.communicator.send(Me.Methods.wallet_requestPermissions,e)).data}catch(e){throw new Oe.PermissionsError("Permissions rejected",Oe.PERMISSIONS_REQUEST_REJECTED)}}isPermissionRequestValid(e){return e.every((e=>"object"==typeof e&&Object.keys(e).every((e=>!!Object.values(Me.RestrictedMethods).includes(e)))))}},Object.defineProperty(Ie,"__esModule",{value:!0});const Ce=be,Re=Ae,Ne=(e,t)=>t.some((t=>t.parentCapability===e));Ie.default=()=>(e,t,s)=>{const a=s.value;return s.value=async function(){const e=new Ce.Wallet(this.communicator);let s=await e.getPermissions();if(Ne(t,s)||(s=await e.requestPermissions([{[t]:{}}])),!Ne(t,s))throw new Re.PermissionsError("Permissions rejected",Re.PERMISSIONS_REQUEST_REJECTED);return a.apply(this)},s};var Le=e&&e.__decorate||function(e,t,s,a){var r,n=arguments.length,i=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,s):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,s,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(i=(n<3?r(i):n>3?r(t,s,i):r(t,s))||i);return n>3&&i&&Object.defineProperty(t,s,i),i},De=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(me,"__esModule",{value:!0}),me.Safe=void 0;const je=ve,xe=Te,He=U,Be=ge,ke=$,qe=De(Ie);class Ue{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(He.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(He.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(He.Methods.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){const s=await this.getInfo(),a=xe.EIP_1271_INTERFACE.encodeFunctionData("isValidSignature",[e,t]),r={call:Be.RPC_CALLS.eth_call,params:[{to:s.safeAddress,data:a},"latest"]};try{return(await this.communicator.send(He.Methods.rpcCall,r)).data.slice(0,10).toLowerCase()===xe.MAGIC_VALUE}catch(e){return!1}}async check1271SignatureBytes(e,t="0x"){const s=await this.getInfo(),a=je.ethers.utils.arrayify(e),r=xe.EIP_1271_BYTES_INTERFACE.encodeFunctionData("isValidSignature",[a,t]),n={call:Be.RPC_CALLS.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(He.Methods.rpcCall,n)).data.slice(0,10).toLowerCase()===xe.MAGIC_VALUE_BYTES}catch(e){return!1}}calculateMessageHash(e){return je.ethers.utils.hashMessage(e)}calculateTypedMessageHash(e){return je.ethers.utils._TypedDataEncoder.hash(e.domain,e.types,e.message)}async getOffChainSignature(e){return(await this.communicator.send(He.Methods.getOffChainSignature,e)).data}async isMessageSigned(e,t="0x"){let s;if("string"==typeof e&&(s=async()=>{const s=this.calculateMessageHash(e);return await this.isMessageHashSigned(s,t)}),(0,ke.isObjectEIP712TypedData)(e)&&(s=async()=>{const s=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(s,t)}),s){return await s()}throw new Error("Invalid message type")}async isMessageHashSigned(e,t="0x"){const s=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const a of s){if(await a(e,t))return!0}return!1}async getEnvironmentInfo(){return(await this.communicator.send(He.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(He.Methods.requestAddressBook,void 0)).data}}Le([(0,qe.default)()],Ue.prototype,"requestAddressBook",null),me.Safe=Ue;var Ge=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(P,"__esModule",{value:!0});const $e=Ge(M),Fe=G,Ve=he,We=me,Ke=be;P.default=class{constructor(e={}){const{allowedDomains:t=null,debug:s=!1}=e;this.communicator=new $e.default(t,s),this.eth=new Ve.Eth(this.communicator),this.txs=new Fe.TXs(this.communicator),this.safe=new We.Safe(this.communicator),this.wallet=new Ke.Wallet(this.communicator)}},function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)},r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getSDKVersion=void 0;const n=r(P);t.default=n.default,a(P,t),a($,t),a(U,t),a(O,t);var i=C;Object.defineProperty(t,"getSDKVersion",{enumerable:!0,get:function(){return i.getSDKVersion}})}(A);var Qe=s(A),Xe={},Ye={},Je={};Object.defineProperty(Je,"__esModule",{value:!0}),Je.getLowerCase=void 0,Je.getLowerCase=function(e){return e?e.toLowerCase():e},Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.SafeAppProvider=void 0;const ze=b,Ze=Je;class et extends ze.EventEmitter{constructor(e,t){super(),this.submittedTxs=new Map,this.safe=e,this.sdk=t}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(e){const{method:t,params:s=[]}=e;switch(t){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[e,t]=s;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(e),"0x"}case"eth_sign":{const[e,t]=s;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase()||!t.startsWith("0x"))throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(t),"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[e,t]=s,a="string"==typeof t?JSON.parse(t):t;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase())throw new Error("The address is invalid");return await this.sdk.txs.signTypedMessage(a),"0x"}case"eth_sendTransaction":const t=Object.assign({value:"0",data:"0x"},s[0]);"string"==typeof t.gas&&t.gas.startsWith("0x")&&(t.gas=parseInt(t.gas,16));const a=await this.sdk.txs.send({txs:[t],params:{safeTxGas:t.gas}});return this.submittedTxs.set(a.safeTxHash,{from:this.safe.safeAddress,hash:a.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:t.data,value:t.value,to:t.to,blockHash:null,blockNumber:null,transactionIndex:null}),a.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,Ze.getLowerCase)(s[0]),s[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,Ze.getLowerCase)(s[0]),s[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,Ze.getLowerCase)(s[0]),s[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,Ze.getLowerCase)(s[0]),s[1],s[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([s[0],s[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([s[0],s[1]]);case"eth_getTransactionByHash":let r=s[0];try{r=(await this.sdk.txs.getBySafeTxHash(r)).txHash||r}catch(e){}return this.submittedTxs.has(r)?this.submittedTxs.get(r):this.sdk.eth.getTransactionByHash([r]).then((e=>(e&&(e.hash=s[0]),e)));case"eth_getTransactionReceipt":{let e=s[0];try{e=(await this.sdk.txs.getBySafeTxHash(e)).txHash||e}catch(e){}return this.sdk.eth.getTransactionReceipt([e]).then((e=>(e&&(e.transactionHash=s[0]),e)))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(s[0]);case"eth_call":return this.sdk.eth.call([s[0],s[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([s[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(s[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([s[0]]);default:throw Error(`"${e.method}" not implemented`)}}send(e,t){e||t("Undefined request"),this.request(e).then((s=>t(null,{jsonrpc:"2.0",id:e.id,result:s}))).catch((e=>t(e,null)))}}let tt,st;function at(){return a(this,void 0,void 0,(function*(){return st||(st=new Qe),void 0===tt&&(tt=yield Promise.race([st.safe.getInfo(),new Promise((e=>setTimeout(e,200)))])),tt}))}function rt(){return a(this,void 0,void 0,(function*(){return!!(yield at())}))}function nt(e){return a(this,void 0,void 0,(function*(){const t=yield at();if(!t)throw Error("Could not load Safe information");const s=new Xe.SafeAppProvider(t,st);return s.on("connect",e.connect),s.on("disconnect",e.disconnect),s.on("accountsChanged",e.accountsChanged),s.on("chainChanged",e.chainChanged),s.on("message",e.message),r(s)}))}Ye.SafeAppProvider=et,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppProvider=void 0;var t=Ye;Object.defineProperty(e,"SafeAppProvider",{enumerable:!0,get:function(){return t.SafeAppProvider}})}(Xe);var it={},ot={},dt={};Object.defineProperty(dt,"__esModule",{value:!0}),dt.getTxServiceBaseUrl=void 0,dt.getTxServiceBaseUrl=function(e){return`${e}/api`};var ct={},ut={exports:{}};!function(t,s){var a=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();t.exports=s=a.fetch,a.fetch&&(s.default=a.fetch.bind(a)),s.Headers=a.Headers,s.Request=a.Request,s.Response=a.Response}(ut,ut.exports),function(t){var s=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sendRequest=t.HttpMethod=void 0;const a=s(ut.exports);var r;(r=t.HttpMethod||(t.HttpMethod={})).Get="get",r.Post="post",r.Delete="delete",t.sendRequest=async function({url:e,method:t,body:s}){const r=await(0,a.default)(e,{method:t,headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)});let n;try{n=await r.json()}catch(e){if(!r.ok)throw new Error(r.statusText)}if(r.ok)return n;if(n.data)throw new Error(n.data);if(n.detail)throw new Error(n.detail);if(n.message)throw new Error(n.message);if(n.nonFieldErrors)throw new Error(n.nonFieldErrors);if(n.delegate)throw new Error(n.delegate);if(n.safe)throw new Error(n.safe);if(n.delegator)throw new Error(n.delegator);throw new Error(r.statusText)}}(ct);var lt,ft,ht=e&&e.__classPrivateFieldSet||function(e,t,s,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,s):r?r.value=s:t.set(e,s),s},gt=e&&e.__classPrivateFieldGet||function(e,t,s,a){if("a"===s&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?a:"a"===s?a.call(e):a?a.value:t.get(e)};Object.defineProperty(ot,"__esModule",{value:!0});const pt=dt,_t=ct;lt=new WeakMap,ft=new WeakMap,ot.default=class{constructor({txServiceUrl:e,ethAdapter:t}){lt.set(this,void 0),ft.set(this,void 0),ht(this,lt,(0,pt.getTxServiceBaseUrl)(e),"f"),ht(this,ft,t,"f")}async getServiceInfo(){return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/about`,method:_t.HttpMethod.Get})}async getServiceMasterCopiesInfo(){return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/about/master-copies`,method:_t.HttpMethod.Get})}async decodeData(e){if(""===e)throw new Error("Invalid data");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/data-decoder/`,method:_t.HttpMethod.Post,body:{data:e}})}async getSafesByOwner(e){if(""===e)throw new Error("Invalid owner address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/owners/${t}/safes/`,method:_t.HttpMethod.Get})}async getSafesByModule(e){if(""===e)throw new Error("Invalid module address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/modules/${t}/safes/`,method:_t.HttpMethod.Get})}async getTransaction(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/multisig-transactions/${e}/`,method:_t.HttpMethod.Get})}async getTransactionConfirmations(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:_t.HttpMethod.Get})}async confirmTransaction(e,t){if(""===e)throw new Error("Invalid safeTxHash");if(""===t)throw new Error("Invalid signature");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:_t.HttpMethod.Post,body:{signature:t}})}async getSafeInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/`,method:_t.HttpMethod.Get})}async getSafeDelegates({safeAddress:e,delegateAddress:t,delegatorAddress:s,label:a,limit:r,offset:n}){const i=new URL(`${gt(this,lt,"f")}/v1/delegates`);if(e){const{address:t}=await gt(this,ft,"f").getEip3770Address(e);i.searchParams.set("safe",t)}if(t){const{address:e}=await gt(this,ft,"f").getEip3770Address(t);i.searchParams.set("delegate",e)}if(s){const{address:e}=await gt(this,ft,"f").getEip3770Address(s);i.searchParams.set("delegator",e)}return a&&i.searchParams.set("label",a),r&&i.searchParams.set("limit",r),n&&i.searchParams.set("offset",n),(0,_t.sendRequest)({url:i.toString(),method:_t.HttpMethod.Get})}async addSafeDelegate({safeAddress:e,delegateAddress:t,delegatorAddress:s,label:a,signer:r}){if(""===t)throw new Error("Invalid Safe delegate address");if(""===s)throw new Error("Invalid Safe delegator address");if(""===a)throw new Error("Invalid label");const{address:n}=await gt(this,ft,"f").getEip3770Address(t),{address:i}=await gt(this,ft,"f").getEip3770Address(s),o=n+Math.floor(Date.now()/1e3/3600),d=await r.signMessage(o),c={safe:e?(await gt(this,ft,"f").getEip3770Address(e)).address:null,delegate:n,delegator:i,label:a,signature:d};return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/delegates/`,method:_t.HttpMethod.Post,body:c})}async removeSafeDelegate({delegateAddress:e,delegatorAddress:t,signer:s}){if(""===e)throw new Error("Invalid Safe delegate address");if(""===t)throw new Error("Invalid Safe delegator address");const{address:a}=await gt(this,ft,"f").getEip3770Address(e),{address:r}=await gt(this,ft,"f").getEip3770Address(t),n=a+Math.floor(Date.now()/1e3/3600),i=await s.signMessage(n);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/delegates/${a}`,method:_t.HttpMethod.Delete,body:{delegate:a,delegator:r,signature:i}})}async getSafeCreationInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/creation/`,method:_t.HttpMethod.Get})}async estimateSafeTransaction(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:s}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${s}/multisig-transactions/estimations/`,method:_t.HttpMethod.Post,body:t})}async proposeTransaction({safeAddress:e,safeTransactionData:t,safeTxHash:s,senderAddress:a,senderSignature:r,origin:n}){if(""===e)throw new Error("Invalid Safe address");const{address:i}=await gt(this,ft,"f").getEip3770Address(e),{address:o}=await gt(this,ft,"f").getEip3770Address(a);if(""===s)throw new Error("Invalid safeTxHash");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${i}/multisig-transactions/`,method:_t.HttpMethod.Post,body:{...t,contractTransactionHash:s,sender:o,signature:r,origin:n}})}async getIncomingTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/incoming-transfers?executed=true`,method:_t.HttpMethod.Get})}async getModuleTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/module-transactions/`,method:_t.HttpMethod.Get})}async getMultisigTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/multisig-transactions/`,method:_t.HttpMethod.Get})}async getPendingTransactions(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:s}=await gt(this,ft,"f").getEip3770Address(e),a=t||(await this.getSafeInfo(s)).nonce;return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${s}/multisig-transactions/?executed=false&nonce__gte=${a}`,method:_t.HttpMethod.Get})}async getAllTransactions(e,t){var s,a,r;if(""===e)throw new Error("Invalid Safe address");const{address:n}=await gt(this,ft,"f").getEip3770Address(e),i=new URL(`${gt(this,lt,"f")}/v1/safes/${n}/all-transactions/`),o=(null===(s=null==t?void 0:t.trusted)||void 0===s?void 0:s.toString())||"true";i.searchParams.set("trusted",o);const d=(null===(a=null==t?void 0:t.queued)||void 0===a?void 0:a.toString())||"true";i.searchParams.set("queued",d);const c=(null===(r=null==t?void 0:t.executed)||void 0===r?void 0:r.toString())||"false";return i.searchParams.set("executed",c),(0,_t.sendRequest)({url:i.toString(),method:_t.HttpMethod.Get})}async getNextNonce(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e),s=await this.getPendingTransactions(t);if(s.results.length>0){const e=s.results.map((e=>e.nonce));return Math.max(...e)+1}return(await this.getSafeInfo(t)).nonce}async getTokenList(){return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/tokens/`,method:_t.HttpMethod.Get})}async getToken(e){if(""===e)throw new Error("Invalid token address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/tokens/${t}/`,method:_t.HttpMethod.Get})}};var Et={};Object.defineProperty(Et,"__esModule",{value:!0}),function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)},r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(ot);a(Et,t),t.default=n.default}(it);var mt=s(it);const vt={1:"https://safe-transaction-mainnet.safe.global/",5:"https://safe-transaction-goerli.safe.global/",42161:"https://safe-transaction-arbitrum.safe.global/",43114:"https://safe-transaction-avalanche.safe.global/",1313161554:"https://safe-transaction-aurora.safe.global/",56:"https://safe-transaction-bsc.safe.global/",10:"https://safe-transaction-optimism.safe.global/",137:"https://safe-transaction-polygon.safe.global/"};let Tt;function yt(e){return a(this,void 0,void 0,(function*(){if((null==Tt?void 0:Tt.chainId)===e)return Tt.safeService;if(!n.getState().provider)throw new Error("provider is undefined");const t=function(){return{getEip3770Address:e=>a(this,void 0,void 0,(function*(){const{address:t,prefix:s}=function(e){const t=e.split(":"),s=t.length>1?t[1]:t[0];return{prefix:t.length>1?t[0]:"",address:s}}(e);return{address:t,prefix:s}}))}}(),s=vt[e];if(!s)return;const r=new mt({txServiceUrl:s,ethAdapter:t});return Tt={safeService:r,chainId:e},Tt.safeService}))}function wt(e,t){return a(this,void 0,void 0,(function*(){if(!t)return!1;const s=yield yt(e);if(!s)return!1;try{return!!(yield s.getSafeInfo(t))}catch(e){return console.error(e),!1}}))}function St(e,t,s){return a(this,void 0,void 0,(function*(){const a=yield yt(e);if(!a)return console.error(`chainId: ${e} is not supported safe`),s;if(s!==t)return s;const r=yield a.getMultisigTransactions(s),[n]=r.results;return n.safeTxHash}))}function It(e,t,s){return a(this,void 0,void 0,(function*(){const a=yield yt(e);if(!a)throw new Error(`chainId: ${e} is not supported safe`);try{const{results:e}=yield a.getMultisigTransactions(s),r=e.find((e=>e.safeTxHash.toLocaleLowerCase()===t.toLocaleLowerCase()));if(!r)return null;if(e.some((e=>!(e.nonce!==r.nonce||e.safeTxHash.toLocaleLowerCase()===t.toLocaleLowerCase()||!e.isExecuted||!e.isSuccessful))))return"rejected";if(null===r.isExecuted||null===r.isSuccessful)return null;return{status:r.isExecuted&&r.isSuccessful||!1,transactionHash:r.transactionHash,blockNumber:r.blockNumber||null}}catch(e){throw console.error(e),new Error(`safeTxHash: ${t} is not valid.`)}}))}function bt(e,t,s){const a={1:"eth",5:"gor",137:"matic",56:"bnb",42161:"arb1",10:"oeth",43114:"avax",1313161554:"aurora"}[t];if(!a)throw new Error(`Not Supported network: ${t}`);return`https://app.safe.global/transactions/tx?id=multisig_${s}_${e}&safe=${a}%3A${s}`}export{nt as default,wt as getAccountIsSafe,at as getConnectedSafe,rt as getIsSafe,bt as getSafeHashDetailUrl,St as getSafeTxHash,It as getSafeTxStatus};
1
+ import{c as e,g as t,b as s,_ as a,d as r,u as n}from"./index-fd49f2bb.js";import{b as i}from"./browser-ponyfill-8e2008b7.js";import{e as o,W as d,F as c,l as u,u as l,w as f,v as h,a as g}from"./ethers-6c6c5deb.js";import{Signer as p,VoidSigner as _}from"@ethersproject/abstract-signer";import*as E from"@ethersproject/providers";import{getDefaultProvider as m}from"@ethersproject/providers";import{BaseContract as v,Contract as T,ContractFactory as y}from"@ethersproject/contracts";import{B as w,E as S}from"./id-831ffa07.js";import*as I from"@ethersproject/constants";import b from"events";import"zustand";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/bytes";import"@ethersproject/abstract-provider";import"./typed-data-62327e55.js";import"./__node-resolve_empty-672b707d.js";import"./hash-a9ebd52a.js";import"./inherits_browser-06ba108b.js";import"@ethersproject/json-wallets";import"./interface-9053458c.js";import"./index-e0e8a880.js";import"./index-b1beeb18.js";var A={},P={},M={},O={},C={},R={name:"@safe-global/safe-apps-sdk",version:"7.10.1",description:"SDK developed to integrate third-party apps with Safe app.",main:"dist/src/index.js",typings:"dist/src/index.d.ts",_files:["dist/**/*","src/**/*","CHANGELOG.md","README.md"],keywords:["Safe","sdk","apps"],scripts:{test:"jest","format-dist":"sed -i '' 's/\"files\":/\"_files\":/' dist/package.json",build:"yarn rimraf dist && tsc && yarn format-dist"},author:"Safe (https://safe.global)",license:"MIT",dependencies:{"@safe-global/safe-gateway-typescript-sdk":"^3.5.3",ethers:"^5.7.2"},devDependencies:{rimraf:"^3.0.2"},repository:{type:"git",url:"git+https://github.com/safe-global/safe-apps-sdk.git"},bugs:{url:"https://github.com/safe-global/safe-apps-sdk/issues"},homepage:"https://github.com/safe-global/safe-apps-sdk#readme",publishConfig:{access:"public"}},N=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(C,"__esModule",{value:!0}),C.getSDKVersion=void 0;const L=N(R);C.getSDKVersion=()=>L.default.version.split("-")[0];var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.generateRequestId=void 0;const j=e=>e.toString(16).padStart(2,"0");D.generateRequestId=()=>"undefined"!=typeof window?(e=>{const t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,j).join("")})(10):(new Date).getTime().toString(36),Object.defineProperty(O,"__esModule",{value:!0}),O.MessageFormatter=void 0;const x=C,H=D;class B{}O.MessageFormatter=B,B.makeRequest=(e,t)=>({id:(0,H.generateRequestId)(),method:e,params:t,env:{sdkVersion:(0,x.getSDKVersion)()}}),B.makeResponse=(e,t,s)=>({id:e,success:!0,version:s,data:t}),B.makeErrorResponse=(e,t,s)=>({id:e,success:!1,error:t,version:s});var k,q,U={};k=U,Object.defineProperty(k,"__esModule",{value:!0}),k.RestrictedMethods=k.Methods=void 0,(q=k.Methods||(k.Methods={})).sendTransactions="sendTransactions",q.rpcCall="rpcCall",q.getChainInfo="getChainInfo",q.getSafeInfo="getSafeInfo",q.getTxBySafeTxHash="getTxBySafeTxHash",q.getSafeBalances="getSafeBalances",q.signMessage="signMessage",q.signTypedMessage="signTypedMessage",q.getEnvironmentInfo="getEnvironmentInfo",q.getOffChainSignature="getOffChainSignature",q.requestAddressBook="requestAddressBook",q.wallet_getPermissions="wallet_getPermissions",q.wallet_requestPermissions="wallet_requestPermissions",(k.RestrictedMethods||(k.RestrictedMethods={})).requestAddressBook="requestAddressBook",function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0});const r=O;t.default=class{constructor(e=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer="undefined"==typeof window,this.isValidMessage=({origin:e,data:t,source:s})=>{const a=!t,r=!this.isServer&&s===window.parent,n=(void 0!==t.version&&parseInt(t.version.split(".")[0]))>=1;let i=!0;return Array.isArray(this.allowedOrigins)&&(i=void 0!==this.allowedOrigins.find((t=>t.test(e)))),!a&&r&&n&&i},this.logIncomingMessage=e=>{console.info(`Safe Apps SDK v1: A message was received from origin ${e.origin}. `,e.data)},this.onParentMessage=e=>{this.isValidMessage(e)&&(this.debugMode&&this.logIncomingMessage(e),this.handleIncomingMessage(e.data))},this.handleIncomingMessage=e=>{const{id:t}=e,s=this.callbacks.get(t);s&&(s(e),this.callbacks.delete(t))},this.send=(e,t)=>{const s=r.MessageFormatter.makeRequest(e,t);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(s,"*"),new Promise(((e,t)=>{this.callbacks.set(s.id,(s=>{s.success?e(s):t(new Error(s.error))}))}))},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}},a(U,t)}(M);var G={},$={},F={};Object.defineProperty(F,"__esModule",{value:!0}),F.isObjectEIP712TypedData=void 0;F.isObjectEIP712TypedData=e=>"object"==typeof e&&null!=e&&"domain"in e&&"types"in e&&"message"in e;var V={};Object.defineProperty(V,"__esModule",{value:!0});var W={},K={},Q={},X={},Y=e&&e.__awaiter||function(e,t,s,a){return new(s||(s=Promise))((function(r,n){function i(e){try{d(a.next(e))}catch(e){n(e)}}function o(e){try{d(a.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(i,o)}d((a=a.apply(e,t||[])).next())}))},J=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.fetchData=X.stringifyQuery=X.insertParams=void 0;const z=J(i.exports);X.insertParams=function(e,t){return t?Object.keys(t).reduce(((e,s)=>function(e,t,s){return e.replace(new RegExp(`\\{${t}\\}`,"g"),s)}(e,s,String(t[s]))),e):e},X.stringifyQuery=function(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach((s=>{null!=e[s]&&t.append(s,String(e[s]))}));const s=t.toString();return s?`?${s}`:""},X.fetchData=function(e,t){return Y(this,void 0,void 0,(function*(){let s;null!=t&&(s={method:"POST",body:"string"==typeof t?t:JSON.stringify(t),headers:{"Content-Type":"application/json"}});const a=yield(0,z.default)(e,s);let r;try{r=yield a.json()}catch(e){if(a.headers&&"0"!==a.headers.get("content-length"))throw new Error(`Invalid response content: ${a.statusText}`)}if(!a.ok){const e="object"==typeof(n=r)&&null!==n&&"code"in n&&"message"in n?`${r.code}: ${r.message}`:a.statusText;throw new Error(e)}var n;return r}))},Object.defineProperty(Q,"__esModule",{value:!0}),Q.getEndpoint=Q.postEndpoint=void 0;const Z=X;function ee(e,t,s,a){return`${e}${(0,Z.insertParams)(t,s)}${(0,Z.stringifyQuery)(a)}`}Q.postEndpoint=function(e,t,s){const a=ee(e,t,null==s?void 0:s.path,null==s?void 0:s.query);return(0,Z.fetchData)(a,null==s?void 0:s.body)},Q.getEndpoint=function(e,t,s,a){if(a)return(0,Z.fetchData)(a);const r=ee(e,t,null==s?void 0:s.path,null==s?void 0:s.query);return(0,Z.fetchData)(r)};var te={};Object.defineProperty(te,"__esModule",{value:!0}),te.DEFAULT_BASE_URL=void 0,te.DEFAULT_BASE_URL="https://safe-client.safe.global";var se={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,(t=e.ImplementationVersionState||(e.ImplementationVersionState={})).UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(se);var ae={};!function(e){var t,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,(t=e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})).NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST",(e.SafeAppFeatures||(e.SafeAppFeatures={})).BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS",(s=e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={})).TWITTER="TWITTER",s.GITHUB="GITHUB",s.DISCORD="DISCORD"}(ae);var re={};!function(e){var t,s,a,r,n,i,o,d,c,u;Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,(t=e.Operation||(e.Operation={}))[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE",(s=e.TransactionStatus||(e.TransactionStatus={})).AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",s.AWAITING_EXECUTION="AWAITING_EXECUTION",s.CANCELLED="CANCELLED",s.FAILED="FAILED",s.SUCCESS="SUCCESS",(a=e.TransferDirection||(e.TransferDirection={})).INCOMING="INCOMING",a.OUTGOING="OUTGOING",a.UNKNOWN="UNKNOWN",(r=e.TransactionTokenType||(e.TransactionTokenType={})).ERC20="ERC20",r.ERC721="ERC721",r.NATIVE_COIN="NATIVE_COIN",(n=e.SettingsInfoType||(e.SettingsInfoType={})).SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",n.ADD_OWNER="ADD_OWNER",n.REMOVE_OWNER="REMOVE_OWNER",n.SWAP_OWNER="SWAP_OWNER",n.CHANGE_THRESHOLD="CHANGE_THRESHOLD",n.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",n.ENABLE_MODULE="ENABLE_MODULE",n.DISABLE_MODULE="DISABLE_MODULE",n.SET_GUARD="SET_GUARD",n.DELETE_GUARD="DELETE_GUARD",(i=e.TransactionInfoType||(e.TransactionInfoType={})).TRANSFER="Transfer",i.SETTINGS_CHANGE="SettingsChange",i.CUSTOM="Custom",i.CREATION="Creation",(o=e.ConflictType||(e.ConflictType={})).NONE="None",o.HAS_NEXT="HasNext",o.END="End",(d=e.TransactionListItemType||(e.TransactionListItemType={})).TRANSACTION="TRANSACTION",d.LABEL="LABEL",d.CONFLICT_HEADER="CONFLICT_HEADER",d.DATE_LABEL="DATE_LABEL",(c=e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})).MULTISIG="MULTISIG",c.MODULE="MODULE",(u=e.LabelValue||(e.LabelValue={})).Queued="Queued",u.Next="Next"}(re);var ne={};!function(e){var t,s,a;Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,(t=e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})).API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN",(s=e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})).ORACLE="ORACLE",s.FIXED="FIXED",s.UNKNOWN="UNKNOWN",(a=e.FEATURES||(e.FEATURES={})).ERC721="ERC721",a.SAFE_APPS="SAFE_APPS",a.CONTRACT_INTERACTION="CONTRACT_INTERACTION",a.DOMAIN_LOOKUP="DOMAIN_LOOKUP",a.SPENDING_LIMIT="SPENDING_LIMIT",a.EIP1559="EIP1559",a.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",a.TX_SIMULATION="TX_SIMULATION",a.EIP1271="EIP1271"}(ne);var ie={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,(t=e.TokenType||(e.TokenType={})).ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(ie);var oe={};Object.defineProperty(oe,"__esModule",{value:!0});var de={};Object.defineProperty(de,"__esModule",{value:!0});var ce={};!function(e){var t,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,(t=e.SafeMessageListItemType||(e.SafeMessageListItemType={})).DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE",(s=e.SafeMessageStatus||(e.SafeMessageStatus={})).NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",s.CONFIRMED="CONFIRMED"}(ce),function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.confirmSafeMessage=t.proposeSafeMessage=t.getSafeMessage=t.getSafeMessages=t.getDecodedData=t.getMasterCopies=t.getSafeApps=t.getChainConfig=t.getChainsConfig=t.proposeTransaction=t.postSafeGasEstimation=t.getTransactionDetails=t.getTransactionQueue=t.getTransactionHistory=t.getCollectiblesPage=t.getCollectibles=t.getOwnedSafes=t.getFiatCurrencies=t.getBalances=t.getMultisigTransactions=t.getModuleTransactions=t.getIncomingTransfers=t.getSafeInfo=t.setBaseUrl=void 0;const r=Q,n=te;a(se,t),a(ae,t),a(re,t),a(ne,t),a(ie,t),a(oe,t),a(de,t),a(ce,t);let i=n.DEFAULT_BASE_URL;t.setBaseUrl=e=>{i=e},t.getSafeInfo=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:e,address:t}})},t.getIncomingTransfers=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:e,address:t},query:s},a)},t.getModuleTransactions=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:e,address:t},query:s},a)},t.getMultisigTransactions=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:e,address:t},query:s},a)},t.getBalances=function(e,t,s="usd",a={}){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:e,address:t,currency:s},query:a})},t.getFiatCurrencies=function(){return(0,r.getEndpoint)(i,"/v1/balances/supported-fiat-codes")},t.getOwnedSafes=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:e,address:t}})},t.getCollectibles=function(e,t,s={}){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:s})},t.getCollectiblesPage=function(e,t,s={},a){return(0,r.getEndpoint)(i,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:s},a)},t.getTransactionHistory=function(e,t,s){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:e,safe_address:t},query:{}},s)},t.getTransactionQueue=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:e,safe_address:t},query:{trusted:a}},s)},t.getTransactionDetails=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:e,transactionId:t}})},t.postSafeGasEstimation=function(e,t,s){return(0,r.postEndpoint)(i,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:e,safe_address:t},body:s})},t.proposeTransaction=function(e,t,s){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:e,safe_address:t},body:s})},t.getChainsConfig=function(e){return(0,r.getEndpoint)(i,"/v1/chains",{query:e})},t.getChainConfig=function(e){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}",{path:{chainId:e}})},t.getSafeApps=function(e,t={}){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safe-apps",{path:{chainId:e},query:t})},t.getMasterCopies=function(e){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:e}})},t.getDecodedData=function(e,t){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/data-decoder",{path:{chainId:e},body:{data:t}})},t.getSafeMessages=function(e,t,s){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},query:{}},s)},t.getSafeMessage=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:e,message_hash:t}})},t.proposeSafeMessage=function(e,t,s){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},body:s})},t.confirmSafeMessage=function(e,t,s){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:e,message_hash:t},body:s})}}(K),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TransferDirection=e.TransactionStatus=e.TokenType=e.Operation=void 0;var t=K;Object.defineProperty(e,"Operation",{enumerable:!0,get:function(){return t.Operation}}),Object.defineProperty(e,"TokenType",{enumerable:!0,get:function(){return t.TokenType}}),Object.defineProperty(e,"TransactionStatus",{enumerable:!0,get:function(){return t.TransactionStatus}}),Object.defineProperty(e,"TransferDirection",{enumerable:!0,get:function(){return t.TransferDirection}})}(W);var ue={};Object.defineProperty(ue,"__esModule",{value:!0}),function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),a(F,t),a(V,t),a(W,t),a(ue,t)}($),Object.defineProperty(G,"__esModule",{value:!0}),G.TXs=void 0;const le=U,fe=$;G.TXs=class{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(le.Methods.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const t={message:e};return(await this.communicator.send(le.Methods.signMessage,t)).data}async signTypedMessage(e){if(!(0,fe.isObjectEIP712TypedData)(e))throw new Error("Invalid typed data");return(await this.communicator.send(le.Methods.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw new Error("No transactions were passed");const s={txs:e,params:t};return(await this.communicator.send(le.Methods.sendTransactions,s)).data}};var he={},ge={};Object.defineProperty(ge,"__esModule",{value:!0}),ge.RPC_CALLS=void 0,ge.RPC_CALLS={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},Object.defineProperty(he,"__esModule",{value:!0}),he.Eth=void 0;const pe=ge,_e=U,Ee={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};he.Eth=class{constructor(e){this.communicator=e,this.call=this.buildRequest({call:pe.RPC_CALLS.eth_call,formatters:[null,Ee.defaultBlockParam]}),this.getBalance=this.buildRequest({call:pe.RPC_CALLS.eth_getBalance,formatters:[null,Ee.defaultBlockParam]}),this.getCode=this.buildRequest({call:pe.RPC_CALLS.eth_getCode,formatters:[null,Ee.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:pe.RPC_CALLS.eth_getStorageAt,formatters:[null,Ee.blockNumberToHex,Ee.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:pe.RPC_CALLS.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:pe.RPC_CALLS.eth_getBlockByHash,formatters:[null,Ee.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:pe.RPC_CALLS.eth_getBlockByNumber,formatters:[Ee.blockNumberToHex,Ee.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:pe.RPC_CALLS.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:pe.RPC_CALLS.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:pe.RPC_CALLS.eth_getTransactionCount,formatters:[null,Ee.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:pe.RPC_CALLS.eth_gasPrice}),this.getEstimateGas=e=>this.buildRequest({call:pe.RPC_CALLS.eth_estimateGas})([e]),this.setSafeSettings=this.buildRequest({call:pe.RPC_CALLS.safe_setSettings})}buildRequest(e){const{call:t,formatters:s}=e;return async e=>{s&&Array.isArray(e)&&s.forEach(((t,s)=>{t&&(e[s]=t(e[s]))}));const a={call:t,params:e||[]};return(await this.communicator.send(_e.Methods.rpcCall,a)).data}}};var me={};try{const e=window;null==e._ethers&&(e._ethers=o)}catch(e){}var ve=t(Object.freeze({__proto__:null,ethers:o,Signer:p,Wallet:d,VoidSigner:_,getDefaultProvider:m,providers:E,BaseContract:v,Contract:T,ContractFactory:y,BigNumber:w,FixedNumber:c,constants:I,get errors(){return S},logger:u,utils:l,wordlists:f,version:h,Wordlist:g})),Te={};Object.defineProperty(Te,"__esModule",{value:!0}),Te.MAGIC_VALUE_BYTES=Te.MAGIC_VALUE=Te.EIP_1271_BYTES_INTERFACE=Te.EIP_1271_INTERFACE=void 0;const ye=ve;Te.MAGIC_VALUE="0x1626ba7e";Te.MAGIC_VALUE_BYTES="0x20c13b0b";const we=new ye.ethers.utils.Interface(["function isValidSignature(bytes32 _dataHash, bytes calldata _signature) external view"]);Te.EIP_1271_INTERFACE=we;const Se=new ye.ethers.utils.Interface(["function isValidSignature(bytes calldata _data, bytes calldata _signature) public view"]);Te.EIP_1271_BYTES_INTERFACE=Se;var Ie={},be={},Ae={};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.PermissionsError=Ae.PERMISSIONS_REQUEST_REJECTED=void 0,Ae.PERMISSIONS_REQUEST_REJECTED=4001;class Pe extends Error{constructor(e,t,s){super(e),this.code=t,this.data=s,Object.setPrototypeOf(this,Pe.prototype)}}Ae.PermissionsError=Pe,Object.defineProperty(be,"__esModule",{value:!0}),be.Wallet=void 0;const Me=U,Oe=Ae;be.Wallet=class{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(Me.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new Oe.PermissionsError("Permissions request is invalid",Oe.PERMISSIONS_REQUEST_REJECTED);try{return(await this.communicator.send(Me.Methods.wallet_requestPermissions,e)).data}catch(e){throw new Oe.PermissionsError("Permissions rejected",Oe.PERMISSIONS_REQUEST_REJECTED)}}isPermissionRequestValid(e){return e.every((e=>"object"==typeof e&&Object.keys(e).every((e=>!!Object.values(Me.RestrictedMethods).includes(e)))))}},Object.defineProperty(Ie,"__esModule",{value:!0});const Ce=be,Re=Ae,Ne=(e,t)=>t.some((t=>t.parentCapability===e));Ie.default=()=>(e,t,s)=>{const a=s.value;return s.value=async function(){const e=new Ce.Wallet(this.communicator);let s=await e.getPermissions();if(Ne(t,s)||(s=await e.requestPermissions([{[t]:{}}])),!Ne(t,s))throw new Re.PermissionsError("Permissions rejected",Re.PERMISSIONS_REQUEST_REJECTED);return a.apply(this)},s};var Le=e&&e.__decorate||function(e,t,s,a){var r,n=arguments.length,i=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,s):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,s,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(i=(n<3?r(i):n>3?r(t,s,i):r(t,s))||i);return n>3&&i&&Object.defineProperty(t,s,i),i},De=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(me,"__esModule",{value:!0}),me.Safe=void 0;const je=ve,xe=Te,He=U,Be=ge,ke=$,qe=De(Ie);class Ue{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(He.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(He.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(He.Methods.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){const s=await this.getInfo(),a=xe.EIP_1271_INTERFACE.encodeFunctionData("isValidSignature",[e,t]),r={call:Be.RPC_CALLS.eth_call,params:[{to:s.safeAddress,data:a},"latest"]};try{return(await this.communicator.send(He.Methods.rpcCall,r)).data.slice(0,10).toLowerCase()===xe.MAGIC_VALUE}catch(e){return!1}}async check1271SignatureBytes(e,t="0x"){const s=await this.getInfo(),a=je.ethers.utils.arrayify(e),r=xe.EIP_1271_BYTES_INTERFACE.encodeFunctionData("isValidSignature",[a,t]),n={call:Be.RPC_CALLS.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(He.Methods.rpcCall,n)).data.slice(0,10).toLowerCase()===xe.MAGIC_VALUE_BYTES}catch(e){return!1}}calculateMessageHash(e){return je.ethers.utils.hashMessage(e)}calculateTypedMessageHash(e){return je.ethers.utils._TypedDataEncoder.hash(e.domain,e.types,e.message)}async getOffChainSignature(e){return(await this.communicator.send(He.Methods.getOffChainSignature,e)).data}async isMessageSigned(e,t="0x"){let s;if("string"==typeof e&&(s=async()=>{const s=this.calculateMessageHash(e);return await this.isMessageHashSigned(s,t)}),(0,ke.isObjectEIP712TypedData)(e)&&(s=async()=>{const s=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(s,t)}),s){return await s()}throw new Error("Invalid message type")}async isMessageHashSigned(e,t="0x"){const s=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const a of s){if(await a(e,t))return!0}return!1}async getEnvironmentInfo(){return(await this.communicator.send(He.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(He.Methods.requestAddressBook,void 0)).data}}Le([(0,qe.default)()],Ue.prototype,"requestAddressBook",null),me.Safe=Ue;var Ge=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(P,"__esModule",{value:!0});const $e=Ge(M),Fe=G,Ve=he,We=me,Ke=be;P.default=class{constructor(e={}){const{allowedDomains:t=null,debug:s=!1}=e;this.communicator=new $e.default(t,s),this.eth=new Ve.Eth(this.communicator),this.txs=new Fe.TXs(this.communicator),this.safe=new We.Safe(this.communicator),this.wallet=new Ke.Wallet(this.communicator)}},function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)},r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getSDKVersion=void 0;const n=r(P);t.default=n.default,a(P,t),a($,t),a(U,t),a(O,t);var i=C;Object.defineProperty(t,"getSDKVersion",{enumerable:!0,get:function(){return i.getSDKVersion}})}(A);var Qe=s(A),Xe={},Ye={},Je={};Object.defineProperty(Je,"__esModule",{value:!0}),Je.getLowerCase=void 0,Je.getLowerCase=function(e){return e?e.toLowerCase():e},Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.SafeAppProvider=void 0;const ze=b,Ze=Je;class et extends ze.EventEmitter{constructor(e,t){super(),this.submittedTxs=new Map,this.safe=e,this.sdk=t}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(e){const{method:t,params:s=[]}=e;switch(t){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[e,t]=s;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(e),"0x"}case"eth_sign":{const[e,t]=s;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase()||!t.startsWith("0x"))throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(t),"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[e,t]=s,a="string"==typeof t?JSON.parse(t):t;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase())throw new Error("The address is invalid");return await this.sdk.txs.signTypedMessage(a),"0x"}case"eth_sendTransaction":const t=Object.assign({value:"0",data:"0x"},s[0]);"string"==typeof t.gas&&t.gas.startsWith("0x")&&(t.gas=parseInt(t.gas,16));const a=await this.sdk.txs.send({txs:[t],params:{safeTxGas:t.gas}});return this.submittedTxs.set(a.safeTxHash,{from:this.safe.safeAddress,hash:a.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:t.data,value:t.value,to:t.to,blockHash:null,blockNumber:null,transactionIndex:null}),a.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,Ze.getLowerCase)(s[0]),s[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,Ze.getLowerCase)(s[0]),s[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,Ze.getLowerCase)(s[0]),s[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,Ze.getLowerCase)(s[0]),s[1],s[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([s[0],s[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([s[0],s[1]]);case"eth_getTransactionByHash":let r=s[0];try{r=(await this.sdk.txs.getBySafeTxHash(r)).txHash||r}catch(e){}return this.submittedTxs.has(r)?this.submittedTxs.get(r):this.sdk.eth.getTransactionByHash([r]).then((e=>(e&&(e.hash=s[0]),e)));case"eth_getTransactionReceipt":{let e=s[0];try{e=(await this.sdk.txs.getBySafeTxHash(e)).txHash||e}catch(e){}return this.sdk.eth.getTransactionReceipt([e]).then((e=>(e&&(e.transactionHash=s[0]),e)))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(s[0]);case"eth_call":return this.sdk.eth.call([s[0],s[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([s[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(s[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([s[0]]);default:throw Error(`"${e.method}" not implemented`)}}send(e,t){e||t("Undefined request"),this.request(e).then((s=>t(null,{jsonrpc:"2.0",id:e.id,result:s}))).catch((e=>t(e,null)))}}let tt,st;function at(){return a(this,void 0,void 0,(function*(){return st||(st=new Qe),void 0===tt&&(tt=yield Promise.race([st.safe.getInfo(),new Promise((e=>setTimeout(e,200)))])),tt}))}function rt(){return a(this,void 0,void 0,(function*(){return!!(yield at())}))}function nt(e){return a(this,void 0,void 0,(function*(){const t=yield at();if(!t)throw Error("Could not load Safe information");const s=new Xe.SafeAppProvider(t,st);return s.on("connect",e.connect),s.on("disconnect",e.disconnect),s.on("accountsChanged",e.accountsChanged),s.on("chainChanged",e.chainChanged),s.on("message",e.message),r(s)}))}Ye.SafeAppProvider=et,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppProvider=void 0;var t=Ye;Object.defineProperty(e,"SafeAppProvider",{enumerable:!0,get:function(){return t.SafeAppProvider}})}(Xe);var it={},ot={},dt={};Object.defineProperty(dt,"__esModule",{value:!0}),dt.getTxServiceBaseUrl=void 0,dt.getTxServiceBaseUrl=function(e){return`${e}/api`};var ct={},ut={exports:{}};!function(t,s){var a=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();t.exports=s=a.fetch,a.fetch&&(s.default=a.fetch.bind(a)),s.Headers=a.Headers,s.Request=a.Request,s.Response=a.Response}(ut,ut.exports),function(t){var s=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sendRequest=t.HttpMethod=void 0;const a=s(ut.exports);var r;(r=t.HttpMethod||(t.HttpMethod={})).Get="get",r.Post="post",r.Delete="delete",t.sendRequest=async function({url:e,method:t,body:s}){const r=await(0,a.default)(e,{method:t,headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)});let n;try{n=await r.json()}catch(e){if(!r.ok)throw new Error(r.statusText)}if(r.ok)return n;if(n.data)throw new Error(n.data);if(n.detail)throw new Error(n.detail);if(n.message)throw new Error(n.message);if(n.nonFieldErrors)throw new Error(n.nonFieldErrors);if(n.delegate)throw new Error(n.delegate);if(n.safe)throw new Error(n.safe);if(n.delegator)throw new Error(n.delegator);throw new Error(r.statusText)}}(ct);var lt,ft,ht=e&&e.__classPrivateFieldSet||function(e,t,s,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,s):r?r.value=s:t.set(e,s),s},gt=e&&e.__classPrivateFieldGet||function(e,t,s,a){if("a"===s&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?a:"a"===s?a.call(e):a?a.value:t.get(e)};Object.defineProperty(ot,"__esModule",{value:!0});const pt=dt,_t=ct;lt=new WeakMap,ft=new WeakMap,ot.default=class{constructor({txServiceUrl:e,ethAdapter:t}){lt.set(this,void 0),ft.set(this,void 0),ht(this,lt,(0,pt.getTxServiceBaseUrl)(e),"f"),ht(this,ft,t,"f")}async getServiceInfo(){return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/about`,method:_t.HttpMethod.Get})}async getServiceMasterCopiesInfo(){return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/about/master-copies`,method:_t.HttpMethod.Get})}async decodeData(e){if(""===e)throw new Error("Invalid data");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/data-decoder/`,method:_t.HttpMethod.Post,body:{data:e}})}async getSafesByOwner(e){if(""===e)throw new Error("Invalid owner address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/owners/${t}/safes/`,method:_t.HttpMethod.Get})}async getSafesByModule(e){if(""===e)throw new Error("Invalid module address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/modules/${t}/safes/`,method:_t.HttpMethod.Get})}async getTransaction(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/multisig-transactions/${e}/`,method:_t.HttpMethod.Get})}async getTransactionConfirmations(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:_t.HttpMethod.Get})}async confirmTransaction(e,t){if(""===e)throw new Error("Invalid safeTxHash");if(""===t)throw new Error("Invalid signature");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:_t.HttpMethod.Post,body:{signature:t}})}async getSafeInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/`,method:_t.HttpMethod.Get})}async getSafeDelegates({safeAddress:e,delegateAddress:t,delegatorAddress:s,label:a,limit:r,offset:n}){const i=new URL(`${gt(this,lt,"f")}/v1/delegates`);if(e){const{address:t}=await gt(this,ft,"f").getEip3770Address(e);i.searchParams.set("safe",t)}if(t){const{address:e}=await gt(this,ft,"f").getEip3770Address(t);i.searchParams.set("delegate",e)}if(s){const{address:e}=await gt(this,ft,"f").getEip3770Address(s);i.searchParams.set("delegator",e)}return a&&i.searchParams.set("label",a),r&&i.searchParams.set("limit",r),n&&i.searchParams.set("offset",n),(0,_t.sendRequest)({url:i.toString(),method:_t.HttpMethod.Get})}async addSafeDelegate({safeAddress:e,delegateAddress:t,delegatorAddress:s,label:a,signer:r}){if(""===t)throw new Error("Invalid Safe delegate address");if(""===s)throw new Error("Invalid Safe delegator address");if(""===a)throw new Error("Invalid label");const{address:n}=await gt(this,ft,"f").getEip3770Address(t),{address:i}=await gt(this,ft,"f").getEip3770Address(s),o=n+Math.floor(Date.now()/1e3/3600),d=await r.signMessage(o),c={safe:e?(await gt(this,ft,"f").getEip3770Address(e)).address:null,delegate:n,delegator:i,label:a,signature:d};return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/delegates/`,method:_t.HttpMethod.Post,body:c})}async removeSafeDelegate({delegateAddress:e,delegatorAddress:t,signer:s}){if(""===e)throw new Error("Invalid Safe delegate address");if(""===t)throw new Error("Invalid Safe delegator address");const{address:a}=await gt(this,ft,"f").getEip3770Address(e),{address:r}=await gt(this,ft,"f").getEip3770Address(t),n=a+Math.floor(Date.now()/1e3/3600),i=await s.signMessage(n);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/delegates/${a}`,method:_t.HttpMethod.Delete,body:{delegate:a,delegator:r,signature:i}})}async getSafeCreationInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/creation/`,method:_t.HttpMethod.Get})}async estimateSafeTransaction(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:s}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${s}/multisig-transactions/estimations/`,method:_t.HttpMethod.Post,body:t})}async proposeTransaction({safeAddress:e,safeTransactionData:t,safeTxHash:s,senderAddress:a,senderSignature:r,origin:n}){if(""===e)throw new Error("Invalid Safe address");const{address:i}=await gt(this,ft,"f").getEip3770Address(e),{address:o}=await gt(this,ft,"f").getEip3770Address(a);if(""===s)throw new Error("Invalid safeTxHash");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${i}/multisig-transactions/`,method:_t.HttpMethod.Post,body:{...t,contractTransactionHash:s,sender:o,signature:r,origin:n}})}async getIncomingTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/incoming-transfers?executed=true`,method:_t.HttpMethod.Get})}async getModuleTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/module-transactions/`,method:_t.HttpMethod.Get})}async getMultisigTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/multisig-transactions/`,method:_t.HttpMethod.Get})}async getPendingTransactions(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:s}=await gt(this,ft,"f").getEip3770Address(e),a=t||(await this.getSafeInfo(s)).nonce;return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${s}/multisig-transactions/?executed=false&nonce__gte=${a}`,method:_t.HttpMethod.Get})}async getAllTransactions(e,t){var s,a,r;if(""===e)throw new Error("Invalid Safe address");const{address:n}=await gt(this,ft,"f").getEip3770Address(e),i=new URL(`${gt(this,lt,"f")}/v1/safes/${n}/all-transactions/`),o=(null===(s=null==t?void 0:t.trusted)||void 0===s?void 0:s.toString())||"true";i.searchParams.set("trusted",o);const d=(null===(a=null==t?void 0:t.queued)||void 0===a?void 0:a.toString())||"true";i.searchParams.set("queued",d);const c=(null===(r=null==t?void 0:t.executed)||void 0===r?void 0:r.toString())||"false";return i.searchParams.set("executed",c),(0,_t.sendRequest)({url:i.toString(),method:_t.HttpMethod.Get})}async getNextNonce(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e),s=await this.getPendingTransactions(t);if(s.results.length>0){const e=s.results.map((e=>e.nonce));return Math.max(...e)+1}return(await this.getSafeInfo(t)).nonce}async getTokenList(){return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/tokens/`,method:_t.HttpMethod.Get})}async getToken(e){if(""===e)throw new Error("Invalid token address");const{address:t}=await gt(this,ft,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/tokens/${t}/`,method:_t.HttpMethod.Get})}};var Et={};Object.defineProperty(Et,"__esModule",{value:!0}),function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)},r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(ot);a(Et,t),t.default=n.default}(it);var mt=s(it);const vt={1:"https://safe-transaction-mainnet.safe.global/",5:"https://safe-transaction-goerli.safe.global/",42161:"https://safe-transaction-arbitrum.safe.global/",43114:"https://safe-transaction-avalanche.safe.global/",1313161554:"https://safe-transaction-aurora.safe.global/",56:"https://safe-transaction-bsc.safe.global/",10:"https://safe-transaction-optimism.safe.global/",137:"https://safe-transaction-polygon.safe.global/"};let Tt;function yt(e){return a(this,void 0,void 0,(function*(){if((null==Tt?void 0:Tt.chainId)===e)return Tt.safeService;if(!n.getState().provider)throw new Error("provider is undefined");const t=function(){return{getEip3770Address:e=>a(this,void 0,void 0,(function*(){const{address:t,prefix:s}=function(e){const t=e.split(":"),s=t.length>1?t[1]:t[0];return{prefix:t.length>1?t[0]:"",address:s}}(e);return{address:t,prefix:s}}))}}(),s=vt[e];if(!s)return;const r=new mt({txServiceUrl:s,ethAdapter:t});return Tt={safeService:r,chainId:e},Tt.safeService}))}function wt(e,t){return a(this,void 0,void 0,(function*(){if(!t)return!1;const s=yield yt(e);if(!s)return!1;try{return!!(yield s.getSafeInfo(t))}catch(e){return console.error(e),!1}}))}function St(e,t,s){return a(this,void 0,void 0,(function*(){const a=yield yt(e);if(!a)return console.error(`chainId: ${e} is not supported safe`),s;if(s!==t)return s;const r=yield a.getMultisigTransactions(s),[n]=r.results;return n.safeTxHash}))}function It(e,t,s){return a(this,void 0,void 0,(function*(){const a=yield yt(e);if(!a)throw new Error(`chainId: ${e} is not supported safe`);try{const{results:e}=yield a.getMultisigTransactions(s),r=e.find((e=>e.safeTxHash.toLocaleLowerCase()===t.toLocaleLowerCase()));if(!r)return null;if(e.some((e=>!(e.nonce!==r.nonce||e.safeTxHash.toLocaleLowerCase()===t.toLocaleLowerCase()||!e.isExecuted||!e.isSuccessful))))return"rejected";if(null===r.isExecuted||null===r.isSuccessful)return null;return{status:r.isExecuted&&r.isSuccessful||!1,transactionHash:r.transactionHash,blockNumber:r.blockNumber||null}}catch(e){throw console.error(e),new Error(`safeTxHash: ${t} is not valid.`)}}))}function bt(e,t,s){const a={1:"eth",5:"gor",137:"matic",56:"bnb",42161:"arb1",10:"oeth",43114:"avax",1313161554:"aurora"}[t];if(!a)throw new Error(`Not Supported network: ${t}`);return`https://app.safe.global/transactions/tx?id=multisig_${s}_${e}&safe=${a}%3A${s}`}export{nt as default,wt as getAccountIsSafe,at as getConnectedSafe,rt as getIsSafe,bt as getSafeHashDetailUrl,St as getSafeTxHash,It as getSafeTxStatus};
@@ -1 +1 @@
1
- import{hexlify as r,arrayify as t,isBytesLike as o}from"@ethersproject/bytes";import{L as e}from"./id-fcd21368.js";const n=new e("rlp/5.7.0");function s(r){const t=[];for(;r;)t.unshift(255&r),r>>=8;return t}function c(r,t,o){let e=0;for(let n=0;n<o;n++)e=256*e+r[t+n];return e}function h(r){if(Array.isArray(r)){let t=[];if(r.forEach((function(r){t=t.concat(h(r))})),t.length<=55)return t.unshift(192+t.length),t;const o=s(t.length);return o.unshift(247+o.length),o.concat(t)}o(r)||n.throwArgumentError("RLP object must be BytesLike","object",r);const e=Array.prototype.slice.call(t(r));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const c=s(e.length);return c.unshift(183+c.length),c.concat(e)}function u(t){return r(h(t))}function a(r,t,o,s){const c=[];for(;o<t+1+s;){const h=l(r,o);c.push(h.result),(o+=h.consumed)>t+1+s&&n.throwError("child data too short",e.errors.BUFFER_OVERRUN,{})}return{consumed:1+s,result:c}}function l(t,o){if(0===t.length&&n.throwError("data too short",e.errors.BUFFER_OVERRUN,{}),t[o]>=248){const r=t[o]-247;o+1+r>t.length&&n.throwError("data short segment too short",e.errors.BUFFER_OVERRUN,{});const s=c(t,o+1,r);return o+1+r+s>t.length&&n.throwError("data long segment too short",e.errors.BUFFER_OVERRUN,{}),a(t,o,o+1+r,r+s)}if(t[o]>=192){const r=t[o]-192;return o+1+r>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{}),a(t,o,o+1,r)}if(t[o]>=184){const s=t[o]-183;o+1+s>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{});const h=c(t,o+1,s);o+1+s+h>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{});return{consumed:1+s+h,result:r(t.slice(o+1+s,o+1+s+h))}}if(t[o]>=128){const s=t[o]-128;o+1+s>t.length&&n.throwError("data too short",e.errors.BUFFER_OVERRUN,{});return{consumed:1+s,result:r(t.slice(o+1,o+1+s))}}return{consumed:1,result:r(t[o])}}function i(r){const o=t(r),e=l(o,0);return e.consumed!==o.length&&n.throwArgumentError("invalid rlp data","data",r),e.result}var f=Object.freeze({__proto__:null,encode:u,decode:i});export{i as d,u as e,f as l};
1
+ import{hexlify as r,arrayify as t,isBytesLike as o}from"@ethersproject/bytes";import{L as e}from"./id-831ffa07.js";const n=new e("rlp/5.7.0");function s(r){const t=[];for(;r;)t.unshift(255&r),r>>=8;return t}function c(r,t,o){let e=0;for(let n=0;n<o;n++)e=256*e+r[t+n];return e}function h(r){if(Array.isArray(r)){let t=[];if(r.forEach((function(r){t=t.concat(h(r))})),t.length<=55)return t.unshift(192+t.length),t;const o=s(t.length);return o.unshift(247+o.length),o.concat(t)}o(r)||n.throwArgumentError("RLP object must be BytesLike","object",r);const e=Array.prototype.slice.call(t(r));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const c=s(e.length);return c.unshift(183+c.length),c.concat(e)}function u(t){return r(h(t))}function a(r,t,o,s){const c=[];for(;o<t+1+s;){const h=l(r,o);c.push(h.result),(o+=h.consumed)>t+1+s&&n.throwError("child data too short",e.errors.BUFFER_OVERRUN,{})}return{consumed:1+s,result:c}}function l(t,o){if(0===t.length&&n.throwError("data too short",e.errors.BUFFER_OVERRUN,{}),t[o]>=248){const r=t[o]-247;o+1+r>t.length&&n.throwError("data short segment too short",e.errors.BUFFER_OVERRUN,{});const s=c(t,o+1,r);return o+1+r+s>t.length&&n.throwError("data long segment too short",e.errors.BUFFER_OVERRUN,{}),a(t,o,o+1+r,r+s)}if(t[o]>=192){const r=t[o]-192;return o+1+r>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{}),a(t,o,o+1,r)}if(t[o]>=184){const s=t[o]-183;o+1+s>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{});const h=c(t,o+1,s);o+1+s+h>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{});return{consumed:1+s+h,result:r(t.slice(o+1+s,o+1+s+h))}}if(t[o]>=128){const s=t[o]-128;o+1+s>t.length&&n.throwError("data too short",e.errors.BUFFER_OVERRUN,{});return{consumed:1+s,result:r(t.slice(o+1,o+1+s))}}return{consumed:1,result:r(t[o])}}function i(r){const o=t(r),e=l(o,0);return e.consumed!==o.length&&n.throwArgumentError("invalid rlp data","data",r),e.result}var f=Object.freeze({__proto__:null,encode:u,decode:i});export{i as d,u as e,f as l};
@@ -1,4 +1,4 @@
1
- import{_ as e,d as t}from"./index-3cd8e009.js";import{u as n,a as s,b as i,v as o,U as r,n as a,c,S as l,z as d,X as u,A as h,Z as p,e as m,Q as f,x as g,d as k,t as y,f as b,g as E,_ as C,l as S,s as v,P as A,$ as I,h as x,p as O,G as R,W as N,r as T,Y as M,D as _,J as B,w as P,i as D,C as j,O as L}from"./index-3e230de4.js";export{w as isInBinance}from"./index-3e230de4.js";import{c as F}from"./browser-ponyfill-30587718.js";import*as z from"react";import U,{createContext as H,useState as q,useEffect as V,useCallback as W,useContext as $}from"react";import J from"react-dom";import{I as Q}from"./interface-f9439acf.js";import"@ethersproject/address";import"@ethersproject/providers";import"zustand";import"events";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/bytes";import"./hash-a9ebd52a.js";import"./inherits_browser-06ba108b.js";import"./id-fcd21368.js";import"./__node-resolve_empty-3e741f9d.js";var K,G={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},Z=J;if("production"===process.env.NODE_ENV)K=Z.createRoot,Z.hydrateRoot;else{var Y=Z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;K=function(e,t){Y.usingClientEntryPoint=!0;try{return Z.createRoot(e,t)}finally{Y.usingClientEntryPoint=!1}}}var X,ee,te=Object.defineProperty,ne=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,oe=(e,t,n)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,re=(e,t)=>{for(var n in t||(t={}))se.call(t,n)&&oe(e,n,t[n]);if(ne)for(var n of ne(t))ie.call(t,n)&&oe(e,n,t[n]);return e},ae=(e,t)=>{var n={};for(var s in e)se.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&ne)for(var s of ne(e))t.indexOf(s)<0&&ie.call(e,s)&&(n[s]=e[s]);return n};(e=>{const t=class{constructor(e,n,s,i){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=4*e+17;let r=[];for(let e=0;e<this.size;e++)r.push(!1);for(let e=0;e<this.size;e++)this.modules.push(r.slice()),this.isFunction.push(r.slice());this.drawFunctionPatterns();const a=this.addEccAndInterleave(s);if(this.drawCodewords(a),-1==i){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);const n=this.getPenaltyScore();n<e&&(i=t,e=n),this.applyMask(t)}}o(0<=i&&i<=7),this.mask=i,this.applyMask(i),this.drawFormatBits(i),this.isFunction=[]}static encodeText(n,s){const i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,s)}static encodeBinary(n,s){const i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],s)}static encodeSegments(e,n,i=1,r=40,c=-1,l=!0){if(!(t.MIN_VERSION<=i&&i<=r&&r<=t.MAX_VERSION)||c<-1||c>7)throw new RangeError("Invalid value");let d,u;for(d=i;;d++){const s=8*t.getNumDataCodewords(d,n),i=a.getTotalBits(e,d);if(i<=s){u=i;break}if(d>=r)throw new RangeError("Data too long")}for(const e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&u<=8*t.getNumDataCodewords(d,e)&&(n=e);let h=[];for(const t of e){s(t.mode.modeBits,4,h),s(t.numChars,t.mode.numCharCountBits(d),h);for(const e of t.getData())h.push(e)}o(h.length==u);const p=8*t.getNumDataCodewords(d,n);o(h.length<=p),s(0,Math.min(4,p-h.length),h),s(0,(8-h.length%8)%8,h),o(h.length%8==0);for(let e=236;h.length<p;e^=253)s(e,8,h);let m=[];for(;8*m.length<h.length;)m.push(0);return h.forEach(((e,t)=>m[t>>>3]|=e<<7-(7&t))),new t(d,n,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let s=0;s<t;s++)0==n&&0==s||0==n&&s==t-1||n==t-1&&0==s||this.drawAlignmentPattern(e[n],e[s]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const t=this.errorCorrectionLevel.formatBits<<3|e;let n=t;for(let e=0;e<10;e++)n=n<<1^1335*(n>>>9);const s=21522^(t<<10|n);o(s>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,i(s,e));this.setFunctionModule(8,7,i(s,6)),this.setFunctionModule(8,8,i(s,7)),this.setFunctionModule(7,8,i(s,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,i(s,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,i(s,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,i(s,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^7973*(e>>>11);const t=this.version<<12|e;o(t>>>18==0);for(let e=0;e<18;e++){const n=i(t,e),s=this.size-11+e%3,o=Math.floor(e/3);this.setFunctionModule(s,o,n),this.setFunctionModule(o,s,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let s=-4;s<=4;s++){const i=Math.max(Math.abs(s),Math.abs(n)),o=e+s,r=t+n;0<=o&&o<this.size&&0<=r&&r<this.size&&this.setFunctionModule(o,r,2!=i&&4!=i)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let s=-2;s<=2;s++)this.setFunctionModule(e+s,t+n,1!=Math.max(Math.abs(s),Math.abs(n)))}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){const n=this.version,s=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,s))throw new RangeError("Invalid argument");const i=t.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][n],r=t.ECC_CODEWORDS_PER_BLOCK[s.ordinal][n],a=Math.floor(t.getNumRawDataModules(n)/8),c=i-a%i,l=Math.floor(a/i);let d=[];const u=t.reedSolomonComputeDivisor(r);for(let n=0,s=0;n<i;n++){let i=e.slice(s,s+l-r+(n<c?0:1));s+=i.length;const o=t.reedSolomonComputeRemainder(i,u);n<c&&i.push(0),d.push(i.concat(o))}let h=[];for(let e=0;e<d[0].length;e++)d.forEach(((t,n)=>{(e!=l-r||n>=c)&&h.push(t[e])}));return o(h.length==a),h}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let n=0;for(let t=this.size-1;t>=1;t-=2){6==t&&(t=5);for(let s=0;s<this.size;s++)for(let o=0;o<2;o++){const r=t-o,a=0==(t+1&2)?this.size-1-s:s;!this.isFunction[a][r]&&n<8*e.length&&(this.modules[a][r]=i(e[n>>>3],7-(7&n)),n++)}}o(n==8*e.length)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let s;switch(e){case 0:s=(n+t)%2==0;break;case 1:s=t%2==0;break;case 2:s=n%3==0;break;case 3:s=(n+t)%3==0;break;case 4:s=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:s=n*t%2+n*t%3==0;break;case 6:s=(n*t%2+n*t%3)%2==0;break;case 7:s=((n+t)%2+n*t%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[t][n]&&s&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let s=!1,i=0,o=[0,0,0,0,0,0,0];for(let r=0;r<this.size;r++)this.modules[n][r]==s?(i++,5==i?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,o),s||(e+=this.finderPenaltyCountPatterns(o)*t.PENALTY_N3),s=this.modules[n][r],i=1);e+=this.finderPenaltyTerminateAndCount(s,i,o)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let s=!1,i=0,o=[0,0,0,0,0,0,0];for(let r=0;r<this.size;r++)this.modules[r][n]==s?(i++,5==i?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,o),s||(e+=this.finderPenaltyCountPatterns(o)*t.PENALTY_N3),s=this.modules[r][n],i=1);e+=this.finderPenaltyTerminateAndCount(s,i,o)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let s=0;s<this.size-1;s++){const i=this.modules[n][s];i==this.modules[n][s+1]&&i==this.modules[n+1][s]&&i==this.modules[n+1][s+1]&&(e+=t.PENALTY_N2)}let n=0;for(const e of this.modules)n=e.reduce(((e,t)=>e+(t?1:0)),n);const s=this.size*this.size,i=Math.ceil(Math.abs(20*n-10*s)/s)-1;return o(0<=i&&i<=9),e+=i*t.PENALTY_N4,o(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(1==this.version)return[];{const e=Math.floor(this.version/7)+2,t=32==this.version?26:2*Math.ceil((4*this.version+4)/(2*e-2));let n=[6];for(let s=this.size-7;n.length<e;s-=t)n.splice(1,0,s);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw new RangeError("Version number out of range");let n=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return o(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let s=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],s),e+1<n.length&&(n[e]^=n[e+1]);s=t.reedSolomonMultiply(s,2)}return n}static reedSolomonComputeRemainder(e,n){let s=n.map((e=>0));for(const i of e){const e=i^s.shift();s.push(0),n.forEach(((n,i)=>s[i]^=t.reedSolomonMultiply(n,e)))}return s}static reedSolomonMultiply(e,t){if(e>>>8!=0||t>>>8!=0)throw new RangeError("Byte out of range");let n=0;for(let s=7;s>=0;s--)n=n<<1^285*(n>>>7),n^=(t>>>s&1)*e;return o(n>>>8==0),n}finderPenaltyCountPatterns(e){const t=e[1];o(t<=3*this.size);const n=t>0&&e[2]==t&&e[3]==3*t&&e[4]==t&&e[5]==t;return(n&&e[0]>=4*t&&e[6]>=t?1:0)+(n&&e[6]>=4*t&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){0==t[0]&&(e+=this.size),t.pop(),t.unshift(e)}};let n=t;function s(e,t,n){if(t<0||t>31||e>>>t!=0)throw new RangeError("Value out of range");for(let s=t-1;s>=0;s--)n.push(e>>>s&1)}function i(e,t){return 0!=(e>>>t&1)}function o(e){if(!e)throw new Error("Assertion error")}n.MIN_VERSION=1,n.MAX_VERSION=40,n.PENALTY_N1=3,n.PENALTY_N2=3,n.PENALTY_N3=40,n.PENALTY_N4=10,n.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],n.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=n;const r=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw new RangeError("Invalid argument");this.bitData=n.slice()}static makeBytes(e){let t=[];for(const n of e)s(n,8,t);return new r(r.Mode.BYTE,e.length,t)}static makeNumeric(e){if(!r.isNumeric(e))throw new RangeError("String contains non-numeric characters");let t=[];for(let n=0;n<e.length;){const i=Math.min(e.length-n,3);s(parseInt(e.substr(n,i),10),3*i+1,t),n+=i}return new r(r.Mode.NUMERIC,e.length,t)}static makeAlphanumeric(e){if(!r.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let t,n=[];for(t=0;t+2<=e.length;t+=2){let i=45*r.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t));i+=r.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),s(i,11,n)}return t<e.length&&s(r.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,n),new r(r.Mode.ALPHANUMERIC,e.length,n)}static makeSegments(e){return""==e?[]:r.isNumeric(e)?[r.makeNumeric(e)]:r.isAlphanumeric(e)?[r.makeAlphanumeric(e)]:[r.makeBytes(r.toUtf8ByteArray(e))]}static makeEci(e){let t=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)s(e,8,t);else if(e<16384)s(2,2,t),s(e,14,t);else{if(!(e<1e6))throw new RangeError("ECI assignment value out of range");s(6,3,t),s(e,21,t)}return new r(r.Mode.ECI,0,t)}static isNumeric(e){return r.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return r.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(const s of e){const e=s.mode.numCharCountBits(t);if(s.numChars>=1<<e)return 1/0;n+=4+e+s.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)"%"!=e.charAt(n)?t.push(e.charCodeAt(n)):(t.push(parseInt(e.substr(n+1,2),16)),n+=2);return t}};let a=r;a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e.QrSegment=a})(X||(X={})),(e=>{const t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};let n=t;n.LOW=new t(0,1),n.MEDIUM=new t(1,0),n.QUARTILE=new t(2,3),n.HIGH=new t(3,2),e.Ecc=n})((ee=X||(X={})).QrCode||(ee.QrCode={})),(e=>{(e=>{const t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};let n=t;n.NUMERIC=new t(1,[10,12,14]),n.ALPHANUMERIC=new t(2,[9,11,13]),n.BYTE=new t(4,[8,16,16]),n.KANJI=new t(8,[8,10,12]),n.ECI=new t(7,[0,0,0]),e.Mode=n})(e.QrSegment||(e.QrSegment={}))})(X||(X={}));var ce=X,le={L:ce.QrCode.Ecc.LOW,M:ce.QrCode.Ecc.MEDIUM,Q:ce.QrCode.Ecc.QUARTILE,H:ce.QrCode.Ecc.HIGH},de=128,ue="L",he="#FFFFFF",pe="#000000",me=!1,fe=4,ge=.1;
1
+ import{_ as e,d as t}from"./index-fd49f2bb.js";import{u as n,a as s,b as i,v as o,U as r,n as a,c,S as l,z as d,X as u,A as h,Z as p,e as m,Q as f,x as g,d as k,t as y,f as b,g as E,_ as C,l as S,s as v,P as A,$ as I,h as x,p as O,G as R,W as N,r as T,Y as M,D as _,J as B,w as P,i as D,C as j,O as L}from"./index-3e230de4.js";export{w as isInBinance}from"./index-3e230de4.js";import{c as F}from"./browser-ponyfill-8e2008b7.js";import*as z from"react";import U,{createContext as H,useState as q,useEffect as V,useCallback as W,useContext as $}from"react";import J from"react-dom";import{I as Q}from"./interface-9053458c.js";import"@ethersproject/address";import"@ethersproject/providers";import"zustand";import"events";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/bytes";import"./hash-a9ebd52a.js";import"./inherits_browser-06ba108b.js";import"./id-831ffa07.js";import"./__node-resolve_empty-672b707d.js";var K,G={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},Z=J;if("production"===process.env.NODE_ENV)K=Z.createRoot,Z.hydrateRoot;else{var Y=Z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;K=function(e,t){Y.usingClientEntryPoint=!0;try{return Z.createRoot(e,t)}finally{Y.usingClientEntryPoint=!1}}}var X,ee,te=Object.defineProperty,ne=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,oe=(e,t,n)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,re=(e,t)=>{for(var n in t||(t={}))se.call(t,n)&&oe(e,n,t[n]);if(ne)for(var n of ne(t))ie.call(t,n)&&oe(e,n,t[n]);return e},ae=(e,t)=>{var n={};for(var s in e)se.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&ne)for(var s of ne(e))t.indexOf(s)<0&&ie.call(e,s)&&(n[s]=e[s]);return n};(e=>{const t=class{constructor(e,n,s,i){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=4*e+17;let r=[];for(let e=0;e<this.size;e++)r.push(!1);for(let e=0;e<this.size;e++)this.modules.push(r.slice()),this.isFunction.push(r.slice());this.drawFunctionPatterns();const a=this.addEccAndInterleave(s);if(this.drawCodewords(a),-1==i){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);const n=this.getPenaltyScore();n<e&&(i=t,e=n),this.applyMask(t)}}o(0<=i&&i<=7),this.mask=i,this.applyMask(i),this.drawFormatBits(i),this.isFunction=[]}static encodeText(n,s){const i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,s)}static encodeBinary(n,s){const i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],s)}static encodeSegments(e,n,i=1,r=40,c=-1,l=!0){if(!(t.MIN_VERSION<=i&&i<=r&&r<=t.MAX_VERSION)||c<-1||c>7)throw new RangeError("Invalid value");let d,u;for(d=i;;d++){const s=8*t.getNumDataCodewords(d,n),i=a.getTotalBits(e,d);if(i<=s){u=i;break}if(d>=r)throw new RangeError("Data too long")}for(const e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&u<=8*t.getNumDataCodewords(d,e)&&(n=e);let h=[];for(const t of e){s(t.mode.modeBits,4,h),s(t.numChars,t.mode.numCharCountBits(d),h);for(const e of t.getData())h.push(e)}o(h.length==u);const p=8*t.getNumDataCodewords(d,n);o(h.length<=p),s(0,Math.min(4,p-h.length),h),s(0,(8-h.length%8)%8,h),o(h.length%8==0);for(let e=236;h.length<p;e^=253)s(e,8,h);let m=[];for(;8*m.length<h.length;)m.push(0);return h.forEach(((e,t)=>m[t>>>3]|=e<<7-(7&t))),new t(d,n,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let s=0;s<t;s++)0==n&&0==s||0==n&&s==t-1||n==t-1&&0==s||this.drawAlignmentPattern(e[n],e[s]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const t=this.errorCorrectionLevel.formatBits<<3|e;let n=t;for(let e=0;e<10;e++)n=n<<1^1335*(n>>>9);const s=21522^(t<<10|n);o(s>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,i(s,e));this.setFunctionModule(8,7,i(s,6)),this.setFunctionModule(8,8,i(s,7)),this.setFunctionModule(7,8,i(s,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,i(s,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,i(s,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,i(s,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^7973*(e>>>11);const t=this.version<<12|e;o(t>>>18==0);for(let e=0;e<18;e++){const n=i(t,e),s=this.size-11+e%3,o=Math.floor(e/3);this.setFunctionModule(s,o,n),this.setFunctionModule(o,s,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let s=-4;s<=4;s++){const i=Math.max(Math.abs(s),Math.abs(n)),o=e+s,r=t+n;0<=o&&o<this.size&&0<=r&&r<this.size&&this.setFunctionModule(o,r,2!=i&&4!=i)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let s=-2;s<=2;s++)this.setFunctionModule(e+s,t+n,1!=Math.max(Math.abs(s),Math.abs(n)))}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){const n=this.version,s=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,s))throw new RangeError("Invalid argument");const i=t.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][n],r=t.ECC_CODEWORDS_PER_BLOCK[s.ordinal][n],a=Math.floor(t.getNumRawDataModules(n)/8),c=i-a%i,l=Math.floor(a/i);let d=[];const u=t.reedSolomonComputeDivisor(r);for(let n=0,s=0;n<i;n++){let i=e.slice(s,s+l-r+(n<c?0:1));s+=i.length;const o=t.reedSolomonComputeRemainder(i,u);n<c&&i.push(0),d.push(i.concat(o))}let h=[];for(let e=0;e<d[0].length;e++)d.forEach(((t,n)=>{(e!=l-r||n>=c)&&h.push(t[e])}));return o(h.length==a),h}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let n=0;for(let t=this.size-1;t>=1;t-=2){6==t&&(t=5);for(let s=0;s<this.size;s++)for(let o=0;o<2;o++){const r=t-o,a=0==(t+1&2)?this.size-1-s:s;!this.isFunction[a][r]&&n<8*e.length&&(this.modules[a][r]=i(e[n>>>3],7-(7&n)),n++)}}o(n==8*e.length)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let s;switch(e){case 0:s=(n+t)%2==0;break;case 1:s=t%2==0;break;case 2:s=n%3==0;break;case 3:s=(n+t)%3==0;break;case 4:s=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:s=n*t%2+n*t%3==0;break;case 6:s=(n*t%2+n*t%3)%2==0;break;case 7:s=((n+t)%2+n*t%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[t][n]&&s&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let s=!1,i=0,o=[0,0,0,0,0,0,0];for(let r=0;r<this.size;r++)this.modules[n][r]==s?(i++,5==i?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,o),s||(e+=this.finderPenaltyCountPatterns(o)*t.PENALTY_N3),s=this.modules[n][r],i=1);e+=this.finderPenaltyTerminateAndCount(s,i,o)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let s=!1,i=0,o=[0,0,0,0,0,0,0];for(let r=0;r<this.size;r++)this.modules[r][n]==s?(i++,5==i?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,o),s||(e+=this.finderPenaltyCountPatterns(o)*t.PENALTY_N3),s=this.modules[r][n],i=1);e+=this.finderPenaltyTerminateAndCount(s,i,o)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let s=0;s<this.size-1;s++){const i=this.modules[n][s];i==this.modules[n][s+1]&&i==this.modules[n+1][s]&&i==this.modules[n+1][s+1]&&(e+=t.PENALTY_N2)}let n=0;for(const e of this.modules)n=e.reduce(((e,t)=>e+(t?1:0)),n);const s=this.size*this.size,i=Math.ceil(Math.abs(20*n-10*s)/s)-1;return o(0<=i&&i<=9),e+=i*t.PENALTY_N4,o(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(1==this.version)return[];{const e=Math.floor(this.version/7)+2,t=32==this.version?26:2*Math.ceil((4*this.version+4)/(2*e-2));let n=[6];for(let s=this.size-7;n.length<e;s-=t)n.splice(1,0,s);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw new RangeError("Version number out of range");let n=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return o(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let s=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],s),e+1<n.length&&(n[e]^=n[e+1]);s=t.reedSolomonMultiply(s,2)}return n}static reedSolomonComputeRemainder(e,n){let s=n.map((e=>0));for(const i of e){const e=i^s.shift();s.push(0),n.forEach(((n,i)=>s[i]^=t.reedSolomonMultiply(n,e)))}return s}static reedSolomonMultiply(e,t){if(e>>>8!=0||t>>>8!=0)throw new RangeError("Byte out of range");let n=0;for(let s=7;s>=0;s--)n=n<<1^285*(n>>>7),n^=(t>>>s&1)*e;return o(n>>>8==0),n}finderPenaltyCountPatterns(e){const t=e[1];o(t<=3*this.size);const n=t>0&&e[2]==t&&e[3]==3*t&&e[4]==t&&e[5]==t;return(n&&e[0]>=4*t&&e[6]>=t?1:0)+(n&&e[6]>=4*t&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){0==t[0]&&(e+=this.size),t.pop(),t.unshift(e)}};let n=t;function s(e,t,n){if(t<0||t>31||e>>>t!=0)throw new RangeError("Value out of range");for(let s=t-1;s>=0;s--)n.push(e>>>s&1)}function i(e,t){return 0!=(e>>>t&1)}function o(e){if(!e)throw new Error("Assertion error")}n.MIN_VERSION=1,n.MAX_VERSION=40,n.PENALTY_N1=3,n.PENALTY_N2=3,n.PENALTY_N3=40,n.PENALTY_N4=10,n.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],n.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=n;const r=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw new RangeError("Invalid argument");this.bitData=n.slice()}static makeBytes(e){let t=[];for(const n of e)s(n,8,t);return new r(r.Mode.BYTE,e.length,t)}static makeNumeric(e){if(!r.isNumeric(e))throw new RangeError("String contains non-numeric characters");let t=[];for(let n=0;n<e.length;){const i=Math.min(e.length-n,3);s(parseInt(e.substr(n,i),10),3*i+1,t),n+=i}return new r(r.Mode.NUMERIC,e.length,t)}static makeAlphanumeric(e){if(!r.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let t,n=[];for(t=0;t+2<=e.length;t+=2){let i=45*r.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t));i+=r.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),s(i,11,n)}return t<e.length&&s(r.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,n),new r(r.Mode.ALPHANUMERIC,e.length,n)}static makeSegments(e){return""==e?[]:r.isNumeric(e)?[r.makeNumeric(e)]:r.isAlphanumeric(e)?[r.makeAlphanumeric(e)]:[r.makeBytes(r.toUtf8ByteArray(e))]}static makeEci(e){let t=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)s(e,8,t);else if(e<16384)s(2,2,t),s(e,14,t);else{if(!(e<1e6))throw new RangeError("ECI assignment value out of range");s(6,3,t),s(e,21,t)}return new r(r.Mode.ECI,0,t)}static isNumeric(e){return r.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return r.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(const s of e){const e=s.mode.numCharCountBits(t);if(s.numChars>=1<<e)return 1/0;n+=4+e+s.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)"%"!=e.charAt(n)?t.push(e.charCodeAt(n)):(t.push(parseInt(e.substr(n+1,2),16)),n+=2);return t}};let a=r;a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e.QrSegment=a})(X||(X={})),(e=>{const t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};let n=t;n.LOW=new t(0,1),n.MEDIUM=new t(1,0),n.QUARTILE=new t(2,3),n.HIGH=new t(3,2),e.Ecc=n})((ee=X||(X={})).QrCode||(ee.QrCode={})),(e=>{(e=>{const t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};let n=t;n.NUMERIC=new t(1,[10,12,14]),n.ALPHANUMERIC=new t(2,[9,11,13]),n.BYTE=new t(4,[8,16,16]),n.KANJI=new t(8,[8,10,12]),n.ECI=new t(7,[0,0,0]),e.Mode=n})(e.QrSegment||(e.QrSegment={}))})(X||(X={}));var ce=X,le={L:ce.QrCode.Ecc.LOW,M:ce.QrCode.Ecc.MEDIUM,Q:ce.QrCode.Ecc.QUARTILE,H:ce.QrCode.Ecc.HIGH},de=128,ue="L",he="#FFFFFF",pe="#000000",me=!1,fe=4,ge=.1;
2
2
  /**
3
3
  * @license qrcode.react
4
4
  * Copyright (c) Paul O'Shannessy
@@ -1 +1 @@
1
- import{arrayify as e,isBytesLike as t,hexlify as r}from"@ethersproject/bytes";import{shallowCopy as o}from"@ethersproject/properties";import{L as n,t as s,a as i}from"./id-fcd21368.js";function l(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e(r)}function c(t){t=e(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var a=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function l(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};function u(t,r){return a(this,void 0,void 0,(function*(){null==r&&(r={});const o={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(o.mode="cors",o.cache="no-cache",o.credentials="same-origin",o.redirect="follow",o.referrer="client"),null!=r.fetchOptions){const e=r.fetchOptions;e.mode&&(o.mode=e.mode),e.cache&&(o.cache=e.cache),e.credentials&&(o.credentials=e.credentials),e.redirect&&(o.redirect=e.redirect),e.referrer&&(o.referrer=e.referrer)}const n=yield fetch(t,o),s=yield n.arrayBuffer(),i={};return n.headers.forEach?n.headers.forEach(((e,t)=>{i[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{i[e.toLowerCase()]=n.headers.get(e)})),{headers:i,statusCode:n.status,statusMessage:n.statusText,body:e(new Uint8Array(s))}}))}var h=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function l(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};const d=new n("web/5.7.1");function f(e){return new Promise((t=>{setTimeout(t,e)}))}function p(e,o){if(null==e)return null;if("string"==typeof e)return e;if(t(e)){if(o&&("text"===o.split("/")[0]||"application/json"===o.split(";")[0].trim()))try{return i(e)}catch(e){}return r(e)}return e}function y(e,t,r){const i="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;d.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const a="object"==typeof e?e.throttleCallback:null,y="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;d.assertArgument(y>0&&y%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",y);const m="object"==typeof e&&!!e.errorPassThrough,E={};let g=null;const w={method:"GET"};let b=!1,R=12e4;if("string"==typeof e)g=e;else if("object"==typeof e){if(null!=e&&null!=e.url||d.throwArgumentError("missing URL","connection.url",e),g=e.url,"number"==typeof e.timeout&&e.timeout>0&&(R=e.timeout),e.headers)for(const t in e.headers)E[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(b=!0);if(w.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==g.substring(0,6)&&!0!==e.allowInsecureAuthentication&&d.throwError("basic authentication requires a secure https url",n.errors.INVALID_ARGUMENT,{argument:"url",url:g,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;E.authorization={key:"Authorization",value:"Basic "+c(s(t))}}null!=e.skipFetchSetup&&(w.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(w.fetchOptions=o(e.fetchOptions))}const v=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),C=g?g.match(v):null;if(C)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":C[1]||"text/plain"},body:C[2]?l(C[3]):(S=C[3],s(S.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){d.throwError("processing response error",n.errors.SERVER_ERROR,{body:p(C[1],C[2]),error:e,requestBody:null,requestMethod:"GET",url:g})}var S;t&&(w.method="POST",w.body=t,null==E["content-type"]&&(E["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==E["content-length"]&&(E["content-length"]={key:"Content-Length",value:String(t.length)}));const O={};Object.keys(E).forEach((e=>{const t=E[e];O[t.key]=t.value})),w.headers=O;const T=function(){let e=null;return{promise:new Promise((function(t,r){R&&(e=setTimeout((()=>{null!=e&&(e=null,r(d.makeError("timeout",n.errors.TIMEOUT,{requestBody:p(w.body,O["content-type"]),requestMethod:w.method,timeout:R,url:g})))}),R))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),k=function(){return h(this,void 0,void 0,(function*(){for(let e=0;e<i;e++){let t=null;try{if(t=yield u(g,w),e<i)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===w.method&&e.match(/^https:/)){g=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(a&&(r=yield a(e,g)),r){let r=0;const o=t.headers["retry-after"];r="string"==typeof o&&o.match(/^[1-9][0-9]*$/)?1e3*parseInt(o):y*parseInt(String(Math.random()*Math.pow(2,e))),yield f(r);continue}}}catch(e){t=e.response,null==t&&(T.cancel(),d.throwError("missing response",n.errors.SERVER_ERROR,{requestBody:p(w.body,O["content-type"]),requestMethod:w.method,serverError:e,url:g}))}let o=t.body;if(b&&304===t.statusCode?o=null:!m&&(t.statusCode<200||t.statusCode>=300)&&(T.cancel(),d.throwError("bad response",n.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:p(o,t.headers?t.headers["content-type"]:null),requestBody:p(w.body,O["content-type"]),requestMethod:w.method,url:g})),r)try{const e=yield r(o,t);return T.cancel(),e}catch(r){if(r.throttleRetry&&e<i){let t=!0;if(a&&(t=yield a(e,g)),t){const t=y*parseInt(String(Math.random()*Math.pow(2,e)));yield f(t);continue}}T.cancel(),d.throwError("processing response error",n.errors.SERVER_ERROR,{body:p(o,t.headers?t.headers["content-type"]:null),error:r,requestBody:p(w.body,O["content-type"]),requestMethod:w.method,url:g})}return T.cancel(),o}return d.throwError("failed response",n.errors.SERVER_ERROR,{requestBody:p(w.body,O["content-type"]),requestMethod:w.method,url:g})}))}();return Promise.race([T.promise,k])}function m(e,t,r){let l=null;if(null!=t){l=s(t);const r="string"==typeof e?{url:e}:o(e);if(r.headers){0!==Object.keys(r.headers).filter((e=>"content-type"===e.toLowerCase())).length||(r.headers=o(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return y(e,l,((e,t)=>{let o=null;if(null!=e)try{o=JSON.parse(i(e))}catch(t){d.throwError("invalid JSON",n.errors.SERVER_ERROR,{body:e,error:t})}return r&&(o=r(o,t)),o}))}function E(e,t){return t||(t={}),null==(t=o(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,o){let n=null,s=!1;const i=()=>!s&&(s=!0,n&&clearTimeout(n),!0);t.timeout&&(n=setTimeout((()=>{i()&&o(new Error("timeout"))}),t.timeout));const l=t.retryLimit;let c=0;!function n(){return e().then((function(e){if(void 0!==e)i()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",n);else if(t.onceBlock)t.onceBlock.once("block",n);else if(!s){if(c++,c>l)return void(i()&&o(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(n,e)}return null}),(function(e){i()&&o(e)}))}()}))}var g=Object.freeze({__proto__:null,_fetchData:y,fetchJson:m,poll:E});export{y as _,l as d,c as e,m as f,g as l,E as p};
1
+ import{arrayify as e,isBytesLike as t,hexlify as r}from"@ethersproject/bytes";import{shallowCopy as o}from"@ethersproject/properties";import{L as n,t as s,a as i}from"./id-831ffa07.js";function l(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e(r)}function c(t){t=e(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var a=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function l(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};function u(t,r){return a(this,void 0,void 0,(function*(){null==r&&(r={});const o={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(o.mode="cors",o.cache="no-cache",o.credentials="same-origin",o.redirect="follow",o.referrer="client"),null!=r.fetchOptions){const e=r.fetchOptions;e.mode&&(o.mode=e.mode),e.cache&&(o.cache=e.cache),e.credentials&&(o.credentials=e.credentials),e.redirect&&(o.redirect=e.redirect),e.referrer&&(o.referrer=e.referrer)}const n=yield fetch(t,o),s=yield n.arrayBuffer(),i={};return n.headers.forEach?n.headers.forEach(((e,t)=>{i[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{i[e.toLowerCase()]=n.headers.get(e)})),{headers:i,statusCode:n.status,statusMessage:n.statusText,body:e(new Uint8Array(s))}}))}var h=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function l(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};const d=new n("web/5.7.1");function f(e){return new Promise((t=>{setTimeout(t,e)}))}function p(e,o){if(null==e)return null;if("string"==typeof e)return e;if(t(e)){if(o&&("text"===o.split("/")[0]||"application/json"===o.split(";")[0].trim()))try{return i(e)}catch(e){}return r(e)}return e}function y(e,t,r){const i="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;d.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const a="object"==typeof e?e.throttleCallback:null,y="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;d.assertArgument(y>0&&y%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",y);const m="object"==typeof e&&!!e.errorPassThrough,E={};let g=null;const w={method:"GET"};let b=!1,R=12e4;if("string"==typeof e)g=e;else if("object"==typeof e){if(null!=e&&null!=e.url||d.throwArgumentError("missing URL","connection.url",e),g=e.url,"number"==typeof e.timeout&&e.timeout>0&&(R=e.timeout),e.headers)for(const t in e.headers)E[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(b=!0);if(w.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==g.substring(0,6)&&!0!==e.allowInsecureAuthentication&&d.throwError("basic authentication requires a secure https url",n.errors.INVALID_ARGUMENT,{argument:"url",url:g,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;E.authorization={key:"Authorization",value:"Basic "+c(s(t))}}null!=e.skipFetchSetup&&(w.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(w.fetchOptions=o(e.fetchOptions))}const v=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),C=g?g.match(v):null;if(C)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":C[1]||"text/plain"},body:C[2]?l(C[3]):(S=C[3],s(S.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){d.throwError("processing response error",n.errors.SERVER_ERROR,{body:p(C[1],C[2]),error:e,requestBody:null,requestMethod:"GET",url:g})}var S;t&&(w.method="POST",w.body=t,null==E["content-type"]&&(E["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==E["content-length"]&&(E["content-length"]={key:"Content-Length",value:String(t.length)}));const O={};Object.keys(E).forEach((e=>{const t=E[e];O[t.key]=t.value})),w.headers=O;const T=function(){let e=null;return{promise:new Promise((function(t,r){R&&(e=setTimeout((()=>{null!=e&&(e=null,r(d.makeError("timeout",n.errors.TIMEOUT,{requestBody:p(w.body,O["content-type"]),requestMethod:w.method,timeout:R,url:g})))}),R))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),k=function(){return h(this,void 0,void 0,(function*(){for(let e=0;e<i;e++){let t=null;try{if(t=yield u(g,w),e<i)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===w.method&&e.match(/^https:/)){g=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(a&&(r=yield a(e,g)),r){let r=0;const o=t.headers["retry-after"];r="string"==typeof o&&o.match(/^[1-9][0-9]*$/)?1e3*parseInt(o):y*parseInt(String(Math.random()*Math.pow(2,e))),yield f(r);continue}}}catch(e){t=e.response,null==t&&(T.cancel(),d.throwError("missing response",n.errors.SERVER_ERROR,{requestBody:p(w.body,O["content-type"]),requestMethod:w.method,serverError:e,url:g}))}let o=t.body;if(b&&304===t.statusCode?o=null:!m&&(t.statusCode<200||t.statusCode>=300)&&(T.cancel(),d.throwError("bad response",n.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:p(o,t.headers?t.headers["content-type"]:null),requestBody:p(w.body,O["content-type"]),requestMethod:w.method,url:g})),r)try{const e=yield r(o,t);return T.cancel(),e}catch(r){if(r.throttleRetry&&e<i){let t=!0;if(a&&(t=yield a(e,g)),t){const t=y*parseInt(String(Math.random()*Math.pow(2,e)));yield f(t);continue}}T.cancel(),d.throwError("processing response error",n.errors.SERVER_ERROR,{body:p(o,t.headers?t.headers["content-type"]:null),error:r,requestBody:p(w.body,O["content-type"]),requestMethod:w.method,url:g})}return T.cancel(),o}return d.throwError("failed response",n.errors.SERVER_ERROR,{requestBody:p(w.body,O["content-type"]),requestMethod:w.method,url:g})}))}();return Promise.race([T.promise,k])}function m(e,t,r){let l=null;if(null!=t){l=s(t);const r="string"==typeof e?{url:e}:o(e);if(r.headers){0!==Object.keys(r.headers).filter((e=>"content-type"===e.toLowerCase())).length||(r.headers=o(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return y(e,l,((e,t)=>{let o=null;if(null!=e)try{o=JSON.parse(i(e))}catch(t){d.throwError("invalid JSON",n.errors.SERVER_ERROR,{body:e,error:t})}return r&&(o=r(o,t)),o}))}function E(e,t){return t||(t={}),null==(t=o(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,o){let n=null,s=!1;const i=()=>!s&&(s=!0,n&&clearTimeout(n),!0);t.timeout&&(n=setTimeout((()=>{i()&&o(new Error("timeout"))}),t.timeout));const l=t.retryLimit;let c=0;!function n(){return e().then((function(e){if(void 0!==e)i()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",n);else if(t.onceBlock)t.onceBlock.once("block",n);else if(!s){if(c++,c>l)return void(i()&&o(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(n,e)}return null}),(function(e){i()&&o(e)}))}()}))}var g=Object.freeze({__proto__:null,_fetchData:y,fetchJson:m,poll:E});export{y as _,l as d,c as e,m as f,g as l,E as p};