@d13co/use-wallet-ui-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +556 -0
- package/dist/cjs/index.cjs +233 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/index.js +65176 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/style.css +1239 -0
- package/dist/types/index.d.cts +250 -0
- package/dist/types/index.d.ts +250 -0
- package/package.json +98 -0
- package/src/theme.css +108 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";var _6=Object.defineProperty;var $E=n=>{throw TypeError(n)};var z6=(n,e,t)=>e in n?_6(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ep=(n,e,t)=>z6(n,typeof e!="symbol"?e+"":e,t),tp=(n,e,t)=>e.has(n)||$E("Cannot "+t);var he=(n,e,t)=>(tp(n,e,"read from private field"),t?t.call(n):e.get(n)),Ct=(n,e,t)=>e.has(n)?$E("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),ht=(n,e,t,r)=>(tp(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),Kt=(n,e,t)=>(tp(n,e,"access private method"),t);var sd=(n,e,t,r)=>({set _(i){ht(n,e,i,t)},get _(){return he(n,e,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react/jsx-runtime"),ce=require("react"),Ws=require("react-dom"),cr=require("@txnlab/use-wallet-react");var np=typeof document<"u"?document.currentScript:null;function wk(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const Me=wk(ce),Fc=wk(Ws),q6=()=>{typeof window>"u"||typeof document>"u"||(typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(()=>{BE()}):setTimeout(BE,0))},BE=()=>{try{if(document.getElementById("wallet-ui-fonts"))return;const e=document.createElement("style");e.id="wallet-ui-fonts";let t="";try{t=new URL("data:font/woff2;base64,d09GMk9UVE8AABnsAAwAAAAAKwgAABmgAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAADag4GhAbnH4cCgZgAFoBNgIkA4IMBAYFihkHIBsuKiMRNnv1IpD99YFNZLqC1f8AB3etT0P+1qLM2Z0ME7eg/IHrzXFQl94QC4tIDIUan3x9cxlPjoNhIgy8yDxCklmIaO0/q2dm9/fOwptHeISoEDS7E/KMupCQcXERLjYsFFIT//09uve8yMsHykwEA5iJZiZYqJUqnTpWClKu6Rme3+Y/GNQl6k4Geo8XLtNdwmrEwsZrYxSijU4XmTgWkS5bly66L/vs70H/lutfWf36tpQJjnUnYMkOMq/DE0JabAh2WX0Crh4dj0/Pz9k/Kgk84Fbu0pmhs3lVUaAiRlqH3U1L3aGiCabBrCaa/eeyJzN/UbcBP8edE5fL/dJJyjrRdIIqXD/hE3kG9WrcuE+/zJxAnfBgTvlj6lRO7f+31putCnEn7GZyToVAOEDh43JiRHXV75m+81KZ9A/2f6eD3OFJJ9kNAAuzhD4ALBdYLhu3Z9UKZ7/bXeHYdJjO5xTvAUnWDZHnp2620fTfZ38HlZlnNONTmrGUGnO9mQihyFAFJ9B1uPmRjEvVB1mZQ55J/eeUP18cc+foBee9yvVZ5eZp4Ds38+Xeczcj97XIi+3PZnJXBz9URtyrsX3nVuyyfbAL7xWevoqL4BpmdNh3MU6CtPaEHv3G2PDfCKhqA0FZFyLEb8zKCycvtDelhXoop1r8f7lYiZ8R89JpXWsWp90gq3Rz14mlZ5feWzq99IMyokwbt+llDpeV7iPLZpd9ZfqT1pm2yZRl+mj+g77T/NKzFmOp510vH68Qr2yv93oV1gh9uu7UCR0PhXm/8BE+C3yO+zz19fQd4Pu3b4bva9GWaxU55VrxFpW7UX4Qf4nAXGFMheMVHlf4bRN1bdyFiNQ5mzqzSMN/u37rf+95UbHwdvenx32pB4+nr1SllZCyfb7XhuS4o6uXjIs78nAh6Pt8qfelwyP5dJdnl0JR3TFlcK2dYtI9r3wXMuAIv6QzC6pngXG0Ixv+PrBCtnjsQGuzbdDaZbv3H9lupJimhvVrrZCNsG4/dep8ZA5AUi/LMdVU2FBTkN+463iGPTYbSJO2WqN85PSBiPPn165qaxs10Gq1D1wHqjb1m0KXbM8QrYjIjSRikl1FT7kTR8MGGTzoskk3bXmXdNIt5pjs/bZfcs80SYZ2XLtEtyjtFb20fxo1yUeUkYbJKe7Mkprafv2rwf/yHAa4d5glQXGOz+u62yRPaFrIJc337jBJbw8N2vH2ILr0LqVx0g7u3XPwUOieNUDwH3dheDCpgZN1fer2EkNAUC8bmojllk1NRIhx3oCITDEuGBIR7/JO/8DlkZkmzmwGRBIMdLC6XcBpBxeMtlRdPWwx+ZPUr5wG7tr+Tu1+Q6oHn2emv5aCeVAPQ2suN6wWyy9Fzy4srGlMB2SjM/TSbpeu67/Mzsk3NyYA9iLJxNu6emnl8oIfYuFsJNWfG1RZx6G5ptDKdD/3E1JkYz+CNid3TMejBtQG9SNO5kZnZMV6eQhVk5oQCsXSiG+bIcgFCIpC4FxBG9DTQwtK+lCFWUoUamk4f0gY8HzDXTSkU5pSqt6nailtqpnE1M0kTCg8AoCLQuChsJIaCKwnhGKHJzsB3ARuG030DR9E7oRHOCgCvsOCQH4B4VwS5uUAXoBoH3y3VwORg6h7ERpyuSwAKFMV9QW/b9fjndGGXLk4rKzL0dvkEV4WZPIQ4p+l1R0ZOSmqMtlnfUSGbNJHMOfnjul01ABuUD3ihDY6Yyo2STICZG9RepFX4cHkXnqxrV+7zbT84zU2ay/4gBCubdoM07gJvttDz2ZruYbXSDj3fBAhK+z/32OTDx3QSiBtCAMbWGOvg9U4OjAliTvDi4OwL3ChXMciUowbs5qFHIhMM27VtYhrEFcTzYyaF1AjeoC1OfcIHxJJYPuueiEUeRgKYnqsbDCktQ0R3EFk/fNgKAaE8hOJtkMFuSOyyMTbM9yPD7vxDajuqcyEo21mhFco9B2nG4/mzXR6DgnowDexn6480IaSRr7Du+uNWDCDoqaydu/q1dYpOaUemWKd8hGSWuyvoWMMao6+odHIDOp1r0GR7/2O6oa7DGsk8JvJk1NSy81JgByaTED7AkTiAI+FiPl+Nef3rS1X/4kF9r/+2brVZiQUrL732L+abhE5G+l3rh5zZCFytXXN2pVd1W3AJo+4L9LmtfWZ6xvHtCCrVrifXzJ4JSHrTNEoU8SBEOtisHede/C8utFmWUu9RpxtPx6NEI5jqf9giDQirI53IlNvv/KHfM931Nak5bp+biVPSk0rr0qswwsPDeeCshV2kQYVUxkG/OEb5pS/DteDSEOFcCiL4fG6sQXoblFkf+NJxjcjFp6RZqecuXwzeTIxD4GPQfpKtZeMqBi4Z3PyJd9YA+tBA8wH8p4aIh1hshpCRh7qmWQRq8MHOXqAC7SDh+Oqx1He9oDnHiqA2+Mm7tkA51t9jxzgbAAPOTjlLFkjKgTZa6BSUiu58BZPdL19MF5/cheutQMXnkRSFX1ziTxgXA/JhrEDItLPqG8XKzovjgwyoRivIVvRD/0h+isHC7f/Zy7HkCU96A2sXAO3rYnQm9yIQjOh7lbSzlfvPD+ULcLrnqI0OeG8QP6vlhU5VfS9Jb3D3iKiulUzAR9NOEeycQh/SStvTUR3i6pdnrQvZzBY9f6ByK6GLZT+KmHD7rSDY0+w5YzIKGOEOhVAZ2SCiUObIc4E4uKUuhEc6qrjO03Ov9ZYx3EDceuW4HRY4zf3ySQCbN9UQBverfsu/BlyTACxiCo1udqxA8gHjplzxkBaAu/Yi8TkeUhfn1ALPC1mZ/SpHFmBfV4ZWKw0U3vcQCe1EaXWfTwKrjMz7Xk7LHJl8bTVM29WtwGZPEJimfecVl4WJwtqWb0j0XGyAPyibWsD/YhBjr7QSTlUl/vwKS/1HkVWcwPAbKFJDvo/AS/JfQdvuk+wH5tzqwJY6yKDCNvnG5Fmzl8/l6n19OZAJjYfm6WziMk2pe5xDljA/hf84L3sAXhfGfS10aG1jXmyrqVdC1+lFt3KiZxjWgjgY+D2W9ynd8WwPaozSKFraiGsEbVY54AxE1QAUDpVZC7whNmmDYkyeu1dg0EKW9cHZHK6PclhyNWLEt3BGxBCTR4ir33hnQK6Fr5urA9q3iIwS2eI+bbfJH/pV5fwZ/jIB7z8gNMv+MFr0ePvhw0CC1xX3Z4jkz8Sb9x/c4qxSzHTtsNbjhzyh+qV6p+preQHBu1encEK2oAR25DPHS/anRJdJLucODPDBgRnfR3sAECjwS5eAg1bFPAXbgCaATCQJN+Zzh08cNbyFmzRrbqpQG1MCzULmrd8I93ZD+15q/AcMGYDhICUn1RszvLkWYVb44a2c00GKGi5143bGWcTrTYdSW9faonuZ9lwZC1CuRF692saFBWKpi+HqJGP1GTxk/xI71bunQLOzX/ZWB/UslUgoTOENXyQwxcGKX2qEyitoAHv81LvVtZS3QgwU+iQAGVpep2YefuaIyjMwnWg7EqIP6iItJrrpn9dR7+HoG4MwqVBXmryB8nejSXf9nBfdshzh+Qm3C4qBcpv+qC6iXVRIfg4GDu0+QeTfPs1vei9oU4JbbenKauG1SMBNDEy3FeHuWWfbXBWAorAHjxDL1kiwoyFXCKT8sggY5laovIVmoSbvisLai8DLLBzGFdwkQuMbjkmt/sllM4SdV7qHQc35dWBOZcuPZExTT+tvKW5miEf1tex1eSRB52pRecb6NiWHsYnF3VPmxxOiDimsKqFt+QFq7CYUT7AR/E6BFmvLZPr61hi8u6bhMw71+3jglO9NbnEAwvo6kKD4t6YjyLgxAt+CN/ygwwicFeXM9w77lqNgR/TFjnhDegjHUq6F7xKK7r/yDkouEWAMdoQTH6ILNhLtzXR5evz7NStsLHiOe6tuRXJG5aDsswm2Y/Nv14BWfuTDG4i64Xu88sJXrXMHUfFJ3NQizAWkQ6zCoPs2l+ULmd70uzCzfEyIq/XqvrCLq/n8cVrQvr5BIeFy0GTfFhSLl6S74m2fb9adS98JQdLY4ajvh7k6IX4wqsl8Dp3ePspzWWtYO3dSHHbAcoce3gx94klF2IT7Sf+IO+v9YiCDBNIOIVYp8s7X1KgqICsvPKTZOy3nqyPjK4LKmbv9rdHHc85E7vYPBuBzFwTDiwiUlHyerM+Sv+qHxaC/YTlWUhk2CTpjLohhMGy+cB6i+C0g/Rg1PwZ+3hdZ8CnGnSgs0zT1yzeYWAgLCCxwIQKO5rQPLNYYCOZh/nqFTuBUgdaJitPbN5gsikpyXrgDYLlQrUrMW311f/e/P1snN0il9sz3SHIHUJN9N5MYuLty6o4Te0tF5IZPSQYMuOc5/I1uZPcliZ+pkWqTKDmNVIlFWp5RLudXtJVtkF0JW7vcWExL8SpGjFGAlveXo3/VfkvhaKlWxPOfxj/Hr6viZ7hvrpHmNofwipBZWASAksh8f/KuSwmlTnzv9tTpd4N6sgQQ5rmRNF/vPwIPDapAwFFL8NrG9xnrhk9rk7WkRBe9vh0wostBobkJyRLDOOZguwS48nauYpGj1AVwaGAY6rRpuOxvqMCSKsSbByPn93JSUTZwM31cItIYOwFC5F47mwAkogYdECIaKgvmlEjCA/pFCNIHqqpVdI9MJWXxrRsNeQeyjrCDOz/Ry9eFnQgVgtO/jrYkQ+EpC9EGJhQ0FKTHxA54Pvkkf2qkeqETH4lmXZo/5Zt+wx3EdiASPKtV0TgFE62sJviGJS0/8kO4ZVUBxydNQQgjq9v5V76JcXj8DcMV/C+NSmpraTyQ/P9lJRrF5NnGHJqqoxFCJerXxTLbKQ7OdBvsJIzce86AH0koU8Zr8IyxeWDG0ezjr6Qgn7QLQZKs1szerxiAWpXtqYlXJcVps3LybNYdMYgJ32cSd58Ej8zL8NUmxY7fO/9qQYVRnxTGBFEbHwMpxbF/zT+rV+MiLDwYBKHTSeK16xC/CHR8sFB4I4PwkHBV4G9vyNeCcbzbUKUb/GBPc5OVSVhtZEsZkNbT3KKbHgxDGXA49zmA8uGNNWD3dBEPILTVprVrY0Aln8qe3Fs5Tupo+PCh1YZ9RVHL0xo1e9R8TvfMYRWUMKejRAUB34h2ggb3JmFGxwY3e3wlCdRjAErXZ83wmcduV39tYL/pvcoQA/4TPQMY1NRE9hg27ghbL3nETPgf2+/Kk6am2tHIDeIH8Pu0aNiotwEa9T+J9rEDwF4g9i7lpoSEfmlR9DR27ed6beAdF3/fUwcEB1XBjtuwy32KFvYo247SJrOtbcj/A3d+Yf7MrctiVDbT7IW5mXWlYNJ2wbhT/ARjJJWMInpU2qaPBKiDNnFRRe1C0fzTj31B+WABwxU4AGdSDkif2zxIxZpD+k+LDXf15/s1e0QT/zqWWDXH30131NzzjiMyMsapYz1a4kzCvIra1NSK3eePJEYdRXIKyHu2SNdx+zv6s5Ivns7Y7wxy1ShH2U3Z8DHlRm4dzcBYyxRc/2v10XufcEPxg2khBHr2ubdXNhcCei2U1OZ/rvXIZBiZRPIR+eeTnUYhyLKbvlns229P4XX6bX9K7ecGh0HfLnwZx/igFVSzeAHfGb5sVs3U9NvXU8LiNMXFSUCwX8TiSpioQuxD+DAHfVHDkdHpjmnby8prqsvRu5qL6dy0l34FxAtLQ0agR5gqaswbW7fuXDvth17jS0bNts2+M9obk6fhnSjg/b6nXNw2+XupOwLLYIpDIZexOG7a5Yy2EHXdyc9CdtORXkH7D0Y3qHR/A7dsrL1/6u92ccb0FbAO4De9fEB9o6Pr3KI82/4b6lV8PDw/FPbtk9WWWPr8MlzD520x2atjPefl+qtLntKlCM5Zca2srK6hrLyHQ0HgTcqhaKW2UO0LFVlpwrr2nvYebIKORoBTTcgzO+AzhHu2ol476sv9IZk6hewYE6tR0knWHX0ey8iyuWIiovQdDqVdC98lVZ490H6YGjt5UjeLCzdOTtFZ2HnaG5Qud5GoMKblaBSY+44Y9Vp3hFCKyBwcWah6GgvioAKqvDWgU9gYSu5P/Z3SQXA/QprfX4EjqSZrl6uk1XexOE5t3PxML/dTBPPR8iBmHbrJQOzGY42hXeg3pT9zYo4rh9Qvh0DFPowheFSG01FEtc1OmzIwRqGET17hfRiEaRuNuK3Hu/Jq4ZfqFSVicA8xOwY8k2NahSgxSmLpBEH7Wwxml2dk/YUQ7OIBuiS17RYvKNT3EErqK8bGAXwkYxAOGVg2mbz/p7StJUVPl22lwhkz2S/hdszBMTv8whOCaq2U1oBfB7jOb4xckvOgrRmJrvYLIXTWJ6ly4/rdBwnkBN76Pgdjf4it9isZx2IpQnWde16sFLOZQRfMC6JAKqLzygxxMs3RkCxGKQGD5JIp1uTQuPNLOKgv4SiR6HHrpT1OGPQGo/VPCBtp9hEWA2QWjBHZjraEwQXG4f5Ql28BOO0kUg2CUogg7ura7RnjuS7YXd4xlEV9is1ZJAKLM2PSUKPogolkBttNmejpeTwzvfV0ZdLGU5trXXbc5Nt69FDqg6e5VjAf9piEvxtQRK048pqveIQCOEtrUldJNOyw1SogFIe1JGVml1wbl5oLGCAB+eK9cVopoJHYZROOB0G+7vFac9MMIC/GsGncf3KDuxnGmBdbmGBHzryT2qSXaXWuXUpY3SpkvmkXc5lqikUTQFXl6VWtVO76vQJYcoxYnrkX2E9yEt4klNgW1ZHN1sWUiAiUXA+7YtsyzAXgI3UGjN29cJgcPj+1wGoCLRpoZFrjn2X1GnRZr16U2AtiBuPQ8IetOJw1DJk82PsJqcG/chiL7H94oGjwsDJLjRdCGReYUVEwzfDnK1Upx6FFobifu3rQ+6ZEkUMcvKFDwQiN8agKsD05AOQomaQzHTDd7AaEE0ZkUMnwQXYLj4y+YFtEe2JWEIW+U0OGBs8tjECY1TVOT9gc8m+dNmnTgEWcfaQdz136VR2cVfb0QBVnE0bgENsyz2GQYNk6b0i75iwNiMsArRYpVKsmivZhrxHYcbn1qWjpnMhb+Fkwl/mRmkMrLBI6x5Pmpplr0yrleWwf3K63SYD7il0LlUr+SJzsdNIP8QptZNyobvZ9IZdmk7ahnItzJnAJadzA/I3FlzDVOJ4EWhWWpahUppNJDb1QXwolfU4Kd2Q2S8Nt68YNIxpzCwr0TW9ckc4MMcya56ZHcm8yilSqzRS2qQqexU9QMrB5mgU6jItWVS4Ol1VtZqqsA+3Cay+KsGgxbqQFM1DfGpDMGt6WqmCMtO9ze1zh7qjw1KdGcEW4yO752bvBMjXEuOMEGALOrSXCZDZZ7hI61jGr6zOCkVR1SQante1L6eW63OxMtbiClDx3vt4h6B+o5oJb78DjnKcvfaC/Y4RjjjuJHbijpmw5+h+naXakmQqcoKZBVhuFW+NtZast0dB7BV5oJYIyKGU4WVOKEFNBRvTKuwtHCQxpcb2Ce9RcUsuj9NVgI5M0hYE0cFpJwjNfCYXPVV4SwJ7Y8tcEOIMoJFmcSEyW6rUGi3kpKPrnpS6rrBRnqfOdckjGjRe0IrXarTJ9RKvRtUql7umpoT/vD19A0MjY1OrLDOzwkpta0y0sHJNzI35ZshccNhj4KDIrGVb2TyJaurH3adYYJqHDAy55lqTNuy4vLuoq6VHpP9SkEB7C7mMVFDAbjhIFzbKLnO+axjcte8EQcPofFeJ8iBzVfeVtZ6hzyYJlQ6JcUdkrddpMYFL55R3NwYFdzBcpR5lRHHNU8/7UnpvubdrdacgT/LFyaHDK4+A5X6PoackNQdnKZGGyMWW2+qAO94W/JfZbLsTHpd9H+Qte0liQb+TnHRcbk/Gvzf472Er+jf1rm8Bvvyt/7eRMWDOX3d3he0cfQdV/HdEaJvNh+o+0+ywP8P9CBnpcI5YnrMNUZTe+LQVB6PhyIKZBtmii/5yeI2AaeBXDy3A3yZHybb1c/Wyzb7MsnoeQhaJseP6YuMEMI/FjkRkmiJp1tSTnYsb7fCDtX4Fpk7iHWtUDEY4k4mwRDOkLRAynmb5Mg3WB7HMHwHuaslWWiYwyCSrppUmkG4ypFRoYrQiFqsipojJbLm/hT9b588ms916XMcpWFnHktgXZEpU9iknOKW8qXMqaHuiMju9UbnkE6Uan6rC3Oeq1PfdgJWqHfTb7RuT8cOTE5MCzyc1UWI0+5Wj06O8vXNHBSvDUZln8VO55Zmv1CydqnAwPaq0cTEHrFRtHa32K/I66+wDu/SwMwpT2AeJlcbj3B7HDzzb8iPAgofLV8FP1136XJzjoLlZWGs2huMHwen9DIYJ3r7Xbq3X7Q57g9sCuZqti5/6z/w846F8NO+YsXBqua79CMRYdendMazwN2SjBH+TZfCYvBpFpF8shoGzh40Gzz2A6AVf7nLrg3reOgpLlmZcnlSA+9MRUKAqNm5pdAkA8q5DwI1cpgWHJjiihnjC8mngikDhHmADBhBlaCFMNHY5CrOHu2FzjPemBgtoGTX0grGZE7CcNjMoVpNU021DLENNTwIc4pDdwQb0IxP1SERWt6mJpmHYW9kmMyEArCUJNEYX6FWtYrhdBLedP2yLOQJ7gZxJ2SAiDCgGooEDOGC6BAva2BZrqlF3hLwbq4Kjd7c50QS/YOT4xnhPnI09uzcNFEIKJnpq0MiRBfiiVaYQKYnJR3nEdcIUXEVtRxFD/fJXJFhkOVIV1ZMC",typeof document>"u"?require("url").pathToFileURL(__filename).href:np&&np.tagName.toUpperCase()==="SCRIPT"&&np.src||new URL("index.cjs",document.baseURI).href).toString()}catch(r){console.warn("Could not resolve font URL. Using fallback styling.",r)}e.textContent=`
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: 'Aeonik';
|
|
4
|
+
src: url('${t}') format('woff2');
|
|
5
|
+
font-weight: 700;
|
|
6
|
+
font-style: normal;
|
|
7
|
+
font-display: swap;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.wallet-custom-font {
|
|
11
|
+
font-family: 'Aeonik', system-ui, sans-serif !important;
|
|
12
|
+
}
|
|
13
|
+
`,document.head.insertBefore(e,document.head.firstChild),console.log("Wallet UI fonts loaded")}catch(n){console.warn("Failed to load custom fonts, using system fonts instead",n)}},H6=()=>{typeof window<"u"&&q6()};function Sk(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=Sk(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function G6(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Sk(n))&&(r&&(r+=" "),r+=e);return r}const K6=(n,e)=>{const t=new Array(n.length+e.length);for(let r=0;r<n.length;r++)t[r]=n[r];for(let r=0;r<e.length;r++)t[n.length+r]=e[r];return t},W6=(n,e)=>({classGroupId:n,validator:e}),vk=(n=new Map,e=null,t)=>({nextPart:n,validators:e,classGroupId:t}),Ud="-",VE=[],J6="arbitrary..",Y6=n=>{const e=Q6(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return X6(s);const a=s.split(Ud),l=a[0]===""&&a.length>1?1:0;return xk(a,l,e)},getConflictingClassGroupIds:(s,a)=>{if(a){const l=r[s],c=t[s];return l?c?K6(c,l):l:c||VE}return t[s]||VE}}},xk=(n,e,t)=>{if(n.length-e===0)return t.classGroupId;const i=n[e],o=t.nextPart.get(i);if(o){const c=xk(n,e+1,o);if(c)return c}const s=t.validators;if(s===null)return;const a=e===0?n.join(Ud):n.slice(e).join(Ud),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(a))return d.classGroupId}},X6=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=n.slice(1,-1),t=e.indexOf(":"),r=e.slice(0,t);return r?J6+r:void 0})(),Q6=n=>{const{theme:e,classGroups:t}=n;return Z6(t,e)},Z6=(n,e)=>{const t=vk();for(const r in n){const i=n[r];Ex(i,t,r,e)}return t},Ex=(n,e,t,r)=>{const i=n.length;for(let o=0;o<i;o++){const s=n[o];eT(s,e,t,r)}},eT=(n,e,t,r)=>{if(typeof n=="string"){tT(n,e,t);return}if(typeof n=="function"){nT(n,e,t,r);return}rT(n,e,t,r)},tT=(n,e,t)=>{const r=n===""?e:Ek(e,n);r.classGroupId=t},nT=(n,e,t,r)=>{if(iT(n)){Ex(n(r),e,t,r);return}e.validators===null&&(e.validators=[]),e.validators.push(W6(t,n))},rT=(n,e,t,r)=>{const i=Object.entries(n),o=i.length;for(let s=0;s<o;s++){const[a,l]=i[s];Ex(l,Ek(e,a),t,r)}},Ek=(n,e)=>{let t=n;const r=e.split(Ud),i=r.length;for(let o=0;o<i;o++){const s=r[o];let a=t.nextPart.get(s);a||(a=vk(),t.nextPart.set(s,a)),t=a}return t},iT=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,oT=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),r=Object.create(null);const i=(o,s)=>{t[o]=s,e++,e>n&&(e=0,r=t,t=Object.create(null))};return{get(o){let s=t[o];if(s!==void 0)return s;if((s=r[o])!==void 0)return i(o,s),s},set(o,s){o in t?t[o]=s:i(o,s)}}},nm="!",OE=":",sT=[],NE=(n,e,t,r,i)=>({modifiers:n,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:r,isExternal:i}),aT=n=>{const{prefix:e,experimentalParseClassName:t}=n;let r=i=>{const o=[];let s=0,a=0,l=0,c;const d=i.length;for(let I=0;I<d;I++){const x=i[I];if(s===0&&a===0){if(x===OE){o.push(i.slice(l,I)),l=I+1;continue}if(x==="/"){c=I;continue}}x==="["?s++:x==="]"?s--:x==="("?a++:x===")"&&a--}const f=o.length===0?i:i.slice(l);let m=f,w=!1;f.endsWith(nm)?(m=f.slice(0,-1),w=!0):f.startsWith(nm)&&(m=f.slice(1),w=!0);const k=c&&c>l?c-l:void 0;return NE(o,w,m,k)};if(e){const i=e+OE,o=r;r=s=>s.startsWith(i)?o(s.slice(i.length)):NE(sT,!1,s,void 0,!0)}if(t){const i=r;r=o=>t({className:o,parseClassName:i})}return r},cT=n=>{const e=new Map;return n.orderSensitiveModifiers.forEach((t,r)=>{e.set(t,1e6+r)}),t=>{const r=[];let i=[];for(let o=0;o<t.length;o++){const s=t[o],a=s[0]==="[",l=e.has(s);a||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(s)):i.push(s)}return i.length>0&&(i.sort(),r.push(...i)),r}},uT=n=>({cache:oT(n.cacheSize),parseClassName:aT(n),sortModifiers:cT(n),...Y6(n)}),lT=/\s+/,hT=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:o}=e,s=[],a=n.trim().split(lT);let l="";for(let c=a.length-1;c>=0;c-=1){const d=a[c],{isExternal:f,modifiers:m,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:I}=t(d);if(f){l=d+(l.length>0?" "+l:l);continue}let x=!!I,T=r(x?k.substring(0,I):k);if(!T){if(!x){l=d+(l.length>0?" "+l:l);continue}if(T=r(k),!T){l=d+(l.length>0?" "+l:l);continue}x=!1}const b=m.length===0?"":m.length===1?m[0]:o(m).join(":"),R=w?b+nm:b,L=R+T;if(s.indexOf(L)>-1)continue;s.push(L);const G=i(T,x);for(let E=0;E<G.length;++E){const N=G[E];s.push(R+N)}l=d+(l.length>0?" "+l:l)}return l},dT=(...n)=>{let e=0,t,r,i="";for(;e<n.length;)(t=n[e++])&&(r=bk(t))&&(i&&(i+=" "),i+=r);return i},bk=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=bk(n[r]))&&(t&&(t+=" "),t+=e);return t},fT=(n,...e)=>{let t,r,i,o;const s=l=>{const c=e.reduce((d,f)=>f(d),n());return t=uT(c),r=t.cache.get,i=t.cache.set,o=a,a(l)},a=l=>{const c=r(l);if(c)return c;const d=hT(l,t);return i(l,d),d};return o=s,(...l)=>o(dT(...l))},gT=[],Hn=n=>{const e=t=>t[n]||gT;return e.isThemeGetter=!0,e},kk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ak=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pT=/^\d+\/\d+$/,mT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yT=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,wT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ST=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,vT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ja=n=>pT.test(n),nn=n=>!!n&&!Number.isNaN(Number(n)),po=n=>!!n&&Number.isInteger(Number(n)),rp=n=>n.endsWith("%")&&nn(n.slice(0,-1)),Li=n=>mT.test(n),Dk=()=>!0,xT=n=>yT.test(n)&&!wT.test(n),bx=()=>!1,ET=n=>ST.test(n),bT=n=>vT.test(n),kT=n=>!Tt(n)&&!It(n),AT=n=>os(n,Ik,bx),Tt=n=>kk.test(n),ds=n=>os(n,Mk,xT),LE=n=>os(n,PT,nn),DT=n=>os(n,Ck,Dk),FT=n=>os(n,Rk,bx),UE=n=>os(n,Fk,bx),TT=n=>os(n,Tk,bT),ad=n=>os(n,Pk,ET),It=n=>Ak.test(n),el=n=>Ga(n,Mk),IT=n=>Ga(n,Rk),jE=n=>Ga(n,Fk),MT=n=>Ga(n,Ik),RT=n=>Ga(n,Tk),cd=n=>Ga(n,Pk,!0),CT=n=>Ga(n,Ck,!0),os=(n,e,t)=>{const r=kk.exec(n);return r?r[1]?e(r[1]):t(r[2]):!1},Ga=(n,e,t=!1)=>{const r=Ak.exec(n);return r?r[1]?e(r[1]):t:!1},Fk=n=>n==="position"||n==="percentage",Tk=n=>n==="image"||n==="url",Ik=n=>n==="length"||n==="size"||n==="bg-size",Mk=n=>n==="length",PT=n=>n==="number",Rk=n=>n==="family-name",Ck=n=>n==="number"||n==="weight",Pk=n=>n==="shadow",$T=()=>{const n=Hn("color"),e=Hn("font"),t=Hn("text"),r=Hn("font-weight"),i=Hn("tracking"),o=Hn("leading"),s=Hn("breakpoint"),a=Hn("container"),l=Hn("spacing"),c=Hn("radius"),d=Hn("shadow"),f=Hn("inset-shadow"),m=Hn("text-shadow"),w=Hn("drop-shadow"),k=Hn("blur"),I=Hn("perspective"),x=Hn("aspect"),T=Hn("ease"),b=Hn("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],G=()=>[...L(),It,Tt],E=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],p=()=>[It,Tt,l],F=()=>[Ja,"full","auto",...p()],v=()=>[po,"none","subgrid",It,Tt],O=()=>["auto",{span:["full",po,It,Tt]},po,It,Tt],C=()=>[po,"auto",It,Tt],V=()=>["auto","min","max","fr",It,Tt],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],_=()=>["start","end","center","stretch","center-safe","end-safe"],ee=()=>["auto",...p()],oe=()=>[Ja,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...p()],z=()=>[n,It,Tt],ue=()=>[...L(),jE,UE,{position:[It,Tt]}],De=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ve=()=>["auto","cover","contain",MT,AT,{size:[It,Tt]}],Te=()=>[rp,el,ds],de=()=>["","none","full",c,It,Tt],ie=()=>["",nn,el,ds],ke=()=>["solid","dashed","dotted","double"],Ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ze=()=>[nn,rp,jE,UE],Ee=()=>["","none",k,It,Tt],be=()=>["none",nn,It,Tt],g=()=>["none",nn,It,Tt],A=()=>[nn,It,Tt],M=()=>[Ja,"full",...p()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Li],breakpoint:[Li],color:[Dk],container:[Li],"drop-shadow":[Li],ease:["in","out","in-out"],font:[kT],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Li],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Li],shadow:[Li],spacing:["px",nn],text:[Li],"text-shadow":[Li],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ja,Tt,It,x]}],container:["container"],columns:[{columns:[nn,Tt,It,a]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:G()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{start:F()}],end:[{end:F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[po,"auto",It,Tt]}],basis:[{basis:[Ja,"full","auto",a,...p()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nn,Ja,"auto","initial","none",Tt]}],grow:[{grow:["",nn,It,Tt]}],shrink:[{shrink:["",nn,It,Tt]}],order:[{order:[po,"first","last","none",It,Tt]}],"grid-cols":[{"grid-cols":v()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":v()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:p()}],"gap-x":[{"gap-x":p()}],"gap-y":[{"gap-y":p()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[..._(),"normal"]}],"justify-self":[{"justify-self":["auto",..._()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[..._(),{baseline:["","last"]}]}],"align-self":[{self:["auto",..._(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[..._(),"baseline"]}],"place-self":[{"place-self":["auto",..._()]}],p:[{p:p()}],px:[{px:p()}],py:[{py:p()}],ps:[{ps:p()}],pe:[{pe:p()}],pt:[{pt:p()}],pr:[{pr:p()}],pb:[{pb:p()}],pl:[{pl:p()}],m:[{m:ee()}],mx:[{mx:ee()}],my:[{my:ee()}],ms:[{ms:ee()}],me:[{me:ee()}],mt:[{mt:ee()}],mr:[{mr:ee()}],mb:[{mb:ee()}],ml:[{ml:ee()}],"space-x":[{"space-x":p()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":p()}],"space-y-reverse":["space-y-reverse"],size:[{size:oe()}],w:[{w:[a,"screen",...oe()]}],"min-w":[{"min-w":[a,"screen","none",...oe()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...oe()]}],h:[{h:["screen","lh",...oe()]}],"min-h":[{"min-h":["screen","lh","none",...oe()]}],"max-h":[{"max-h":["screen","lh",...oe()]}],"font-size":[{text:["base",t,el,ds]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,CT,DT]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",rp,Tt]}],"font-family":[{font:[IT,FT,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,It,Tt]}],"line-clamp":[{"line-clamp":[nn,"none",It,LE]}],leading:[{leading:[o,...p()]}],"list-image":[{"list-image":["none",It,Tt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",It,Tt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ke(),"wavy"]}],"text-decoration-thickness":[{decoration:[nn,"from-font","auto",It,ds]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[nn,"auto",It,Tt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:p()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",It,Tt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",It,Tt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:De()}],"bg-size":[{bg:ve()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},po,It,Tt],radial:["",It,Tt],conic:[po,It,Tt]},RT,TT]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:Te()}],"gradient-via-pos":[{via:Te()}],"gradient-to-pos":[{to:Te()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:de()}],"rounded-s":[{"rounded-s":de()}],"rounded-e":[{"rounded-e":de()}],"rounded-t":[{"rounded-t":de()}],"rounded-r":[{"rounded-r":de()}],"rounded-b":[{"rounded-b":de()}],"rounded-l":[{"rounded-l":de()}],"rounded-ss":[{"rounded-ss":de()}],"rounded-se":[{"rounded-se":de()}],"rounded-ee":[{"rounded-ee":de()}],"rounded-es":[{"rounded-es":de()}],"rounded-tl":[{"rounded-tl":de()}],"rounded-tr":[{"rounded-tr":de()}],"rounded-br":[{"rounded-br":de()}],"rounded-bl":[{"rounded-bl":de()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ke(),"hidden","none"]}],"divide-style":[{divide:[...ke(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...ke(),"none","hidden"]}],"outline-offset":[{"outline-offset":[nn,It,Tt]}],"outline-w":[{outline:["",nn,el,ds]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",d,cd,ad]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",f,cd,ad]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[nn,ds]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",m,cd,ad]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[nn,It,Tt]}],"mix-blend":[{"mix-blend":[...Ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ie()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[nn]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ze()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ze()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":Ze()}],"mask-image-t-to-pos":[{"mask-t-to":Ze()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":Ze()}],"mask-image-r-to-pos":[{"mask-r-to":Ze()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":Ze()}],"mask-image-b-to-pos":[{"mask-b-to":Ze()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":Ze()}],"mask-image-l-to-pos":[{"mask-l-to":Ze()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":Ze()}],"mask-image-x-to-pos":[{"mask-x-to":Ze()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":Ze()}],"mask-image-y-to-pos":[{"mask-y-to":Ze()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[It,Tt]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ze()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ze()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":L()}],"mask-image-conic-pos":[{"mask-conic":[nn]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ze()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ze()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:De()}],"mask-size":[{mask:ve()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",It,Tt]}],filter:[{filter:["","none",It,Tt]}],blur:[{blur:Ee()}],brightness:[{brightness:[nn,It,Tt]}],contrast:[{contrast:[nn,It,Tt]}],"drop-shadow":[{"drop-shadow":["","none",w,cd,ad]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",nn,It,Tt]}],"hue-rotate":[{"hue-rotate":[nn,It,Tt]}],invert:[{invert:["",nn,It,Tt]}],saturate:[{saturate:[nn,It,Tt]}],sepia:[{sepia:["",nn,It,Tt]}],"backdrop-filter":[{"backdrop-filter":["","none",It,Tt]}],"backdrop-blur":[{"backdrop-blur":Ee()}],"backdrop-brightness":[{"backdrop-brightness":[nn,It,Tt]}],"backdrop-contrast":[{"backdrop-contrast":[nn,It,Tt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nn,It,Tt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nn,It,Tt]}],"backdrop-invert":[{"backdrop-invert":["",nn,It,Tt]}],"backdrop-opacity":[{"backdrop-opacity":[nn,It,Tt]}],"backdrop-saturate":[{"backdrop-saturate":[nn,It,Tt]}],"backdrop-sepia":[{"backdrop-sepia":["",nn,It,Tt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":p()}],"border-spacing-x":[{"border-spacing-x":p()}],"border-spacing-y":[{"border-spacing-y":p()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",It,Tt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[nn,"initial",It,Tt]}],ease:[{ease:["linear","initial",T,It,Tt]}],delay:[{delay:[nn,It,Tt]}],animate:[{animate:["none",b,It,Tt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[I,It,Tt]}],"perspective-origin":[{"perspective-origin":G()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:g()}],"scale-x":[{"scale-x":g()}],"scale-y":[{"scale-y":g()}],"scale-z":[{"scale-z":g()}],"scale-3d":["scale-3d"],skew:[{skew:A()}],"skew-x":[{"skew-x":A()}],"skew-y":[{"skew-y":A()}],transform:[{transform:[It,Tt,"","none","gpu","cpu"]}],"transform-origin":[{origin:G()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:M()}],"translate-x":[{"translate-x":M()}],"translate-y":[{"translate-y":M()}],"translate-z":[{"translate-z":M()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",It,Tt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":p()}],"scroll-mx":[{"scroll-mx":p()}],"scroll-my":[{"scroll-my":p()}],"scroll-ms":[{"scroll-ms":p()}],"scroll-me":[{"scroll-me":p()}],"scroll-mt":[{"scroll-mt":p()}],"scroll-mr":[{"scroll-mr":p()}],"scroll-mb":[{"scroll-mb":p()}],"scroll-ml":[{"scroll-ml":p()}],"scroll-p":[{"scroll-p":p()}],"scroll-px":[{"scroll-px":p()}],"scroll-py":[{"scroll-py":p()}],"scroll-ps":[{"scroll-ps":p()}],"scroll-pe":[{"scroll-pe":p()}],"scroll-pt":[{"scroll-pt":p()}],"scroll-pr":[{"scroll-pr":p()}],"scroll-pb":[{"scroll-pb":p()}],"scroll-pl":[{"scroll-pl":p()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",It,Tt]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[nn,el,ds,LE]}],stroke:[{stroke:["none",...z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},BT=fT($T);function Bl(...n){return BT(G6(n))}const VT={sm:"py-1.5 px-3 text-sm rounded-lg",md:"py-2.5 px-4 text-base rounded-xl",lg:"py-3 px-5 text-lg rounded-xl"},Df=ce.forwardRef(({className:n="",children:e,style:t,size:r="md",...i},o)=>K.jsx("button",{ref:o,"data-wallet-ui":!0,"data-wallet-button":!0,className:Bl("bg-[var(--wui-color-primary)] transition-colors hover:bg-[var(--wui-color-primary-hover)] text-[var(--wui-color-primary-text)] font-bold cursor-pointer disabled:opacity-50 wallet-custom-font",VT[r],n),style:t,...i,type:"button",children:e||"Connect Wallet"}));Df.displayName="ConnectWalletButton";function Ff(){return typeof window<"u"}function ci(n){return kx(n)?(n.nodeName||"").toLowerCase():"#document"}function _n(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Gn(n){var e;return(e=(kx(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function kx(n){return Ff()?n instanceof Node||n instanceof _n(n).Node:!1}function on(n){return Ff()?n instanceof Element||n instanceof _n(n).Element:!1}function bn(n){return Ff()?n instanceof HTMLElement||n instanceof _n(n).HTMLElement:!1}function rm(n){return!Ff()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof _n(n).ShadowRoot}const OT=new Set(["inline","contents"]);function ss(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=$n(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!OT.has(i)}const NT=new Set(["table","td","th"]);function $k(n){return NT.has(ci(n))}const LT=[":popover-open",":modal"];function Ka(n){return LT.some(e=>{try{return n.matches(e)}catch{return!1}})}const UT=["transform","translate","scale","rotate","perspective"],jT=["transform","translate","scale","rotate","perspective","filter"],_T=["paint","layout","strict","content"];function Qh(n){const e=Lu(),t=on(n)?$n(n):n;return UT.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||jT.some(r=>(t.willChange||"").includes(r))||_T.some(r=>(t.contain||"").includes(r))}function Bk(n){let e=kr(n);for(;bn(e)&&!Rr(e);){if(Qh(e))return e;if(Ka(e))return null;e=kr(e)}return null}function Lu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const zT=new Set(["html","body","#document"]);function Rr(n){return zT.has(ci(n))}function $n(n){return _n(n).getComputedStyle(n)}function as(n){return on(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function kr(n){if(ci(n)==="html")return n;const e=n.assignedSlot||n.parentNode||rm(n)&&n.host||Gn(n);return rm(e)?e.host:e}function Vk(n){const e=kr(n);return Rr(e)?n.ownerDocument?n.ownerDocument.body:n.body:bn(e)&&ss(e)?e:Vk(e)}function si(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=Vk(n),o=i===((r=n.ownerDocument)==null?void 0:r.body),s=_n(i);if(o){const a=Vl(s);return e.concat(s,s.visualViewport||[],ss(i)?i:[],a&&t?si(a):[])}return e.concat(i,si(i,[],t))}function Vl(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}const Ai=Math.min,Rn=Math.max,Qi=Math.round,$o=Math.floor,zn=n=>({x:n,y:n}),qT={left:"right",right:"left",bottom:"top",top:"bottom"},HT={start:"end",end:"start"};function jd(n,e,t){return Rn(n,Ai(e,t))}function Vi(n,e){return typeof n=="function"?n(e):n}function Pr(n){return n.split("-")[0]}function Wa(n){return n.split("-")[1]}function Ax(n){return n==="x"?"y":"x"}function Dx(n){return n==="y"?"height":"width"}const GT=new Set(["top","bottom"]);function ar(n){return GT.has(Pr(n))?"y":"x"}function Fx(n){return Ax(ar(n))}function Ok(n,e,t){t===void 0&&(t=!1);const r=Wa(n),i=Fx(n),o=Dx(i);let s=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Ol(s)),[s,Ol(s)]}function Nk(n){const e=Ol(n);return[im(n),e,im(e)]}function im(n){return n.replace(/start|end/g,e=>HT[e])}const _E=["left","right"],zE=["right","left"],KT=["top","bottom"],WT=["bottom","top"];function JT(n,e,t){switch(n){case"top":case"bottom":return t?e?zE:_E:e?_E:zE;case"left":case"right":return e?KT:WT;default:return[]}}function Lk(n,e,t,r){const i=Wa(n);let o=JT(Pr(n),t==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(im)))),o}function Ol(n){return n.replace(/left|right|bottom|top/g,e=>qT[e])}function YT(n){return{top:0,right:0,bottom:0,left:0,...n}}function Uk(n){return typeof n!="number"?YT(n):{top:n,right:n,bottom:n,left:n}}function qo(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}/*!
|
|
14
|
+
* tabbable 6.2.0
|
|
15
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
16
|
+
*/var XT=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],_d=XT.join(","),jk=typeof Element>"u",Tc=jk?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,zd=!jk&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n==null?void 0:n.ownerDocument},qd=function n(e,t){var r;t===void 0&&(t=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),o=i===""||i==="true",s=o||t&&e&&n(e.parentNode);return s},QT=function(e){var t,r=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return r===""||r==="true"},_k=function(e,t,r){if(qd(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(_d));return t&&Tc.call(e,_d)&&i.unshift(e),i=i.filter(r),i},zk=function n(e,t,r){for(var i=[],o=Array.from(e);o.length;){var s=o.shift();if(!qd(s,!1))if(s.tagName==="SLOT"){var a=s.assignedElements(),l=a.length?a:s.children,c=n(l,!0,r);r.flatten?i.push.apply(i,c):i.push({scopeParent:s,candidates:c})}else{var d=Tc.call(s,_d);d&&r.filter(s)&&(t||!e.includes(s))&&i.push(s);var f=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),m=!qd(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(f&&m){var w=n(f===!0?s.children:f.children,!0,r);r.flatten?i.push.apply(i,w):i.push({scopeParent:s,candidates:w})}else o.unshift.apply(o,s.children)}}return i},qk=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Hk=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||QT(e))&&!qk(e)?0:e.tabIndex},ZT=function(e,t){var r=Hk(e);return r<0&&t&&!qk(e)?0:r},eI=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Gk=function(e){return e.tagName==="INPUT"},tI=function(e){return Gk(e)&&e.type==="hidden"},nI=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return t},rI=function(e,t){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===t)return e[r]},iI=function(e){if(!e.name)return!0;var t=e.form||zd(e),r=function(a){return t.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(e.name));else try{i=r(e.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var o=rI(i,e.form);return!o||o===e},oI=function(e){return Gk(e)&&e.type==="radio"},sI=function(e){return oI(e)&&!iI(e)},aI=function(e){var t,r=e&&zd(e),i=(t=r)===null||t===void 0?void 0:t.host,o=!1;if(r&&r!==e){var s,a,l;for(o=!!((s=i)!==null&&s!==void 0&&(a=s.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!o&&i;){var c,d,f;r=zd(i),i=(c=r)===null||c===void 0?void 0:c.host,o=!!((d=i)!==null&&d!==void 0&&(f=d.ownerDocument)!==null&&f!==void 0&&f.contains(i))}}return o},qE=function(e){var t=e.getBoundingClientRect(),r=t.width,i=t.height;return r===0&&i===0},cI=function(e,t){var r=t.displayCheck,i=t.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var o=Tc.call(e,"details>summary:first-of-type"),s=o?e.parentElement:e;if(Tc.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var a=e;e;){var l=e.parentElement,c=zd(e);if(l&&!l.shadowRoot&&i(l)===!0)return qE(e);e.assignedSlot?e=e.assignedSlot:!l&&c!==e.ownerDocument?e=c.host:e=l}e=a}if(aI(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return qE(e);return!1},uI=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var r=0;r<t.children.length;r++){var i=t.children.item(r);if(i.tagName==="LEGEND")return Tc.call(t,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}t=t.parentElement}return!1},om=function(e,t){return!(t.disabled||qd(t)||tI(t)||cI(t,e)||nI(t)||uI(t))},sm=function(e,t){return!(sI(t)||Hk(t)<0||!om(e,t))},lI=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},hI=function n(e){var t=[],r=[];return e.forEach(function(i,o){var s=!!i.scopeParent,a=s?i.scopeParent:i,l=ZT(a,s),c=s?n(i.candidates):a;l===0?s?t.push.apply(t,c):t.push(a):r.push({documentOrder:o,tabIndex:l,item:i,isScope:s,content:c})}),r.sort(eI).reduce(function(i,o){return o.isScope?i.push.apply(i,o.content):i.push(o.content),i},[]).concat(t)},Tf=function(e,t){t=t||{};var r;return t.getShadowRoot?r=zk([e],t.includeContainer,{filter:sm.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:lI}):r=_k(e,t.includeContainer,sm.bind(null,t)),hI(r)},dI=function(e,t){t=t||{};var r;return t.getShadowRoot?r=zk([e],t.includeContainer,{filter:om.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):r=_k(e,t.includeContainer,om.bind(null,t)),r},Kk=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Tc.call(e,_d)===!1?!1:sm(t,e)};function Wk(){const n=navigator.userAgentData;return n!=null&&n.platform?n.platform:navigator.platform}function Jk(){const n=navigator.userAgentData;return n&&Array.isArray(n.brands)?n.brands.map(e=>{let{brand:t,version:r}=e;return t+"/"+r}).join(" "):navigator.userAgent}function fI(){return/apple/i.test(navigator.vendor)}function am(){const n=/android/i;return n.test(Wk())||n.test(Jk())}function gI(){return Jk().includes("jsdom/")}const HE="data-floating-ui-focusable",pI="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function ec(n){let e=n.activeElement;for(;((t=e)==null||(t=t.shadowRoot)==null?void 0:t.activeElement)!=null;){var t;e=e.shadowRoot.activeElement}return e}function Fr(n,e){if(!n||!e)return!1;const t=e.getRootNode==null?void 0:e.getRootNode();if(n.contains(e))return!0;if(t&&rm(t)){let r=e;for(;r;){if(n===r)return!0;r=r.parentNode||r.host}}return!1}function bo(n){return"composedPath"in n?n.composedPath()[0]:n.target}function ip(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function mI(n){return n.matches("html,body")}function ri(n){return(n==null?void 0:n.ownerDocument)||document}function Yk(n){return bn(n)&&n.matches(pI)}function GE(n){return n?n.getAttribute("role")==="combobox"&&Yk(n):!1}function cm(n){return n?n.hasAttribute(HE)?n:n.querySelector("["+HE+"]")||n:null}function oc(n,e,t){return t===void 0&&(t=!0),n.filter(i=>{var o;return i.parentId===e&&(!t||((o=i.context)==null?void 0:o.open))}).flatMap(i=>[i,...oc(n,i.id,t)])}function KE(n,e){var t;let r=[],i=(t=n.find(o=>o.id===e))==null?void 0:t.parentId;for(;i;){const o=n.find(s=>s.id===i);i=o==null?void 0:o.parentId,o&&(r=r.concat(o))}return r}function op(n){n.preventDefault(),n.stopPropagation()}function yI(n){return"nativeEvent"in n}function wI(n){return n.mozInputSource===0&&n.isTrusted?!0:am()&&n.pointerType?n.type==="click"&&n.buttons===1:n.detail===0&&!n.pointerType}function SI(n){return gI()?!1:!am()&&n.width===0&&n.height===0||am()&&n.width===1&&n.height===1&&n.pressure===0&&n.detail===0&&n.pointerType==="mouse"||n.width<1&&n.height<1&&n.pressure===0&&n.detail===0&&n.pointerType==="touch"}function WE(n,e){return["mouse","pen"].includes(n)}var vI=typeof document<"u",xI=function(){},Mr=vI?ce.useLayoutEffect:xI;const EI={...Me};function sp(n){const e=Me.useRef(n);return Mr(()=>{e.current=n}),e}const bI=EI.useInsertionEffect,kI=bI||(n=>n());function Ei(n){const e=Me.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return kI(()=>{e.current=n}),Me.useCallback(function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}const Zh=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Xk(n,e){const t=Tf(n,Zh()),r=t.length;if(r===0)return;const i=ec(ri(n)),o=t.indexOf(i),s=o===-1?e===1?0:r-1:o+e;return t[s]}function Qk(n){return Xk(ri(n).body,1)||n}function Zk(n){return Xk(ri(n).body,-1)||n}function Al(n,e){const t=e||n.currentTarget,r=n.relatedTarget;return!r||!Fr(t,r)}function AI(n){Tf(n,Zh()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function JE(n){n.querySelectorAll("[data-tabindex]").forEach(t=>{const r=t.dataset.tabindex;delete t.dataset.tabindex,r?t.setAttribute("tabindex",r):t.removeAttribute("tabindex")})}function YE(n,e,t){let{reference:r,floating:i}=n;const o=ar(e),s=Fx(e),a=Dx(s),l=Pr(e),c=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let w;switch(l){case"top":w={x:d,y:r.y-i.height};break;case"bottom":w={x:d,y:r.y+r.height};break;case"right":w={x:r.x+r.width,y:f};break;case"left":w={x:r.x-i.width,y:f};break;default:w={x:r.x,y:r.y}}switch(Wa(e)){case"start":w[s]-=m*(t&&c?-1:1);break;case"end":w[s]+=m*(t&&c?-1:1);break}return w}async function DI(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:w=0}=Vi(e,n),k=Uk(w),x=a[m?f==="floating"?"reference":"floating":f],T=qo(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(x)))==null||t?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),b=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),L=await(o.isElement==null?void 0:o.isElement(R))?await(o.getScale==null?void 0:o.getScale(R))||{x:1,y:1}:{x:1,y:1},G=qo(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:R,strategy:l}):b);return{top:(T.top-G.top+k.top)/L.y,bottom:(G.bottom-T.bottom+k.bottom)/L.y,left:(T.left-G.left+k.left)/L.x,right:(G.right-T.right+k.right)/L.x}}const FI=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=t,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:f}=YE(c,r,l),m=r,w={},k=0;for(let x=0;x<a.length;x++){var I;const{name:T,fn:b}=a[x],{x:R,y:L,data:G,reset:E}=await b({x:d,y:f,initialPlacement:r,placement:m,strategy:i,middlewareData:w,rects:c,platform:{...s,detectOverflow:(I=s.detectOverflow)!=null?I:DI},elements:{reference:n,floating:e}});d=R??d,f=L??f,w={...w,[T]:{...w[T],...G}},E&&k<=50&&(k++,typeof E=="object"&&(E.placement&&(m=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:n,floating:e,strategy:i}):E.rects),{x:d,y:f}=YE(c,m,l)),x=-1)}return{x:d,y:f,placement:m,strategy:i,middlewareData:w}},TI=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:I=!0,...x}=Vi(n,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const T=Pr(i),b=ar(a),R=Pr(a)===a,L=await(l.isRTL==null?void 0:l.isRTL(c.floating)),G=m||(R||!I?[Ol(a)]:Nk(a)),E=k!=="none";!m&&E&&G.push(...Lk(a,I,k,L));const N=[a,...G],p=await l.detectOverflow(e,x),F=[];let v=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&F.push(p[T]),f){const H=Ok(i,s,L);F.push(p[H[0]],p[H[1]])}if(v=[...v,{placement:i,overflows:F}],!F.every(H=>H<=0)){var O,C;const H=(((O=o.flip)==null?void 0:O.index)||0)+1,_=N[H];if(_&&(!(f==="alignment"?b!==ar(_):!1)||v.every(z=>ar(z.placement)===b?z.overflows[0]>0:!0)))return{data:{index:H,overflows:v},reset:{placement:_}};let ee=(C=v.filter(oe=>oe.overflows[0]<=0).sort((oe,z)=>oe.overflows[1]-z.overflows[1])[0])==null?void 0:C.placement;if(!ee)switch(w){case"bestFit":{var V;const oe=(V=v.filter(z=>{if(E){const ue=ar(z.placement);return ue===b||ue==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(ue=>ue>0).reduce((ue,De)=>ue+De,0)]).sort((z,ue)=>z[1]-ue[1])[0])==null?void 0:V[0];oe&&(ee=oe);break}case"initialPlacement":ee=a;break}if(i!==ee)return{reset:{placement:ee}}}return{}}}},II=new Set(["left","top"]);async function MI(n,e){const{placement:t,platform:r,elements:i}=n,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Pr(t),a=Wa(t),l=ar(t)==="y",c=II.has(s)?-1:1,d=o&&l?-1:1,f=Vi(e,n);let{mainAxis:m,crossAxis:w,alignmentAxis:k}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof k=="number"&&(w=a==="end"?k*-1:k),l?{x:w*d,y:m*c}:{x:m*c,y:w*d}}const RI=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:o,placement:s,middlewareData:a}=e,l=await MI(e,n);return s===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},CI=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i,platform:o}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:T=>{let{x:b,y:R}=T;return{x:b,y:R}}},...c}=Vi(n,e),d={x:t,y:r},f=await o.detectOverflow(e,c),m=ar(Pr(i)),w=Ax(m);let k=d[w],I=d[m];if(s){const T=w==="y"?"top":"left",b=w==="y"?"bottom":"right",R=k+f[T],L=k-f[b];k=jd(R,k,L)}if(a){const T=m==="y"?"top":"left",b=m==="y"?"bottom":"right",R=I+f[T],L=I-f[b];I=jd(R,I,L)}const x=l.fn({...e,[w]:k,[m]:I});return{...x,data:{x:x.x-t,y:x.y-r,enabled:{[w]:s,[m]:a}}}}}};function eA(n){const e=$n(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=bn(n),o=i?n.offsetWidth:t,s=i?n.offsetHeight:r,a=Qi(t)!==o||Qi(r)!==s;return a&&(t=o,r=s),{width:t,height:r,$:a}}function Tx(n){return on(n)?n:n.contextElement}function sc(n){const e=Tx(n);if(!bn(e))return zn(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:o}=eA(e);let s=(o?Qi(t.width):t.width)/r,a=(o?Qi(t.height):t.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const PI=zn(0);function tA(n){const e=_n(n);return!Lu()||!e.visualViewport?PI:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function $I(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==_n(n)?!1:e}function Js(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),o=Tx(n);let s=zn(1);e&&(r?on(r)&&(s=sc(r)):s=sc(n));const a=$I(o,t,r)?tA(o):zn(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const m=_n(o),w=r&&on(r)?_n(r):r;let k=m,I=Vl(k);for(;I&&r&&w!==k;){const x=sc(I),T=I.getBoundingClientRect(),b=$n(I),R=T.left+(I.clientLeft+parseFloat(b.paddingLeft))*x.x,L=T.top+(I.clientTop+parseFloat(b.paddingTop))*x.y;l*=x.x,c*=x.y,d*=x.x,f*=x.y,l+=R,c+=L,k=_n(I),I=Vl(k)}}return qo({width:d,height:f,x:l,y:c})}function If(n,e){const t=as(n).scrollLeft;return e?e.left+t:Js(Gn(n)).left+t}function nA(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-If(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function BI(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const o=i==="fixed",s=Gn(r),a=e?Ka(e.floating):!1;if(r===s||a&&o)return t;let l={scrollLeft:0,scrollTop:0},c=zn(1);const d=zn(0),f=bn(r);if((f||!f&&!o)&&((ci(r)!=="body"||ss(s))&&(l=as(r)),bn(r))){const w=Js(r);c=sc(r),d.x=w.x+r.clientLeft,d.y=w.y+r.clientTop}const m=s&&!f&&!o?nA(s,l):zn(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x+m.x,y:t.y*c.y-l.scrollTop*c.y+d.y+m.y}}function VI(n){return Array.from(n.getClientRects())}function OI(n){const e=Gn(n),t=as(n),r=n.ownerDocument.body,i=Rn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Rn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-t.scrollLeft+If(n);const a=-t.scrollTop;return $n(r).direction==="rtl"&&(s+=Rn(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}const XE=25;function NI(n,e){const t=_n(n),r=Gn(n),i=t.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const d=Lu();(!d||d&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=If(r);if(c<=0){const d=r.ownerDocument,f=d.body,m=getComputedStyle(f),w=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,k=Math.abs(r.clientWidth-f.clientWidth-w);k<=XE&&(o-=k)}else c<=XE&&(o+=c);return{width:o,height:s,x:a,y:l}}const LI=new Set(["absolute","fixed"]);function UI(n,e){const t=Js(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,o=bn(n)?sc(n):zn(1),s=n.clientWidth*o.x,a=n.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function QE(n,e,t){let r;if(e==="viewport")r=NI(n,t);else if(e==="document")r=OI(Gn(n));else if(on(e))r=UI(e,t);else{const i=tA(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return qo(r)}function rA(n,e){const t=kr(n);return t===e||!on(t)||Rr(t)?!1:$n(t).position==="fixed"||rA(t,e)}function jI(n,e){const t=e.get(n);if(t)return t;let r=si(n,[],!1).filter(a=>on(a)&&ci(a)!=="body"),i=null;const o=$n(n).position==="fixed";let s=o?kr(n):n;for(;on(s)&&!Rr(s);){const a=$n(s),l=Qh(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&LI.has(i.position)||ss(s)&&!l&&rA(n,s))?r=r.filter(d=>d!==s):i=a,s=kr(s)}return e.set(n,r),r}function _I(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const s=[...t==="clippingAncestors"?Ka(e)?[]:jI(e,this._c):[].concat(t),r],a=s[0],l=s.reduce((c,d)=>{const f=QE(e,d,i);return c.top=Rn(f.top,c.top),c.right=Ai(f.right,c.right),c.bottom=Ai(f.bottom,c.bottom),c.left=Rn(f.left,c.left),c},QE(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function zI(n){const{width:e,height:t}=eA(n);return{width:e,height:t}}function qI(n,e,t){const r=bn(e),i=Gn(e),o=t==="fixed",s=Js(n,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=zn(0);function c(){l.x=If(i)}if(r||!r&&!o)if((ci(e)!=="body"||ss(i))&&(a=as(e)),r){const w=Js(e,!0,o,e);l.x=w.x+e.clientLeft,l.y=w.y+e.clientTop}else i&&c();o&&!r&&i&&c();const d=i&&!r&&!o?nA(i,a):zn(0),f=s.left+a.scrollLeft-l.x-d.x,m=s.top+a.scrollTop-l.y-d.y;return{x:f,y:m,width:s.width,height:s.height}}function ap(n){return $n(n).position==="static"}function ZE(n,e){if(!bn(n)||$n(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Gn(n)===t&&(t=t.ownerDocument.body),t}function iA(n,e){const t=_n(n);if(Ka(n))return t;if(!bn(n)){let i=kr(n);for(;i&&!Rr(i);){if(on(i)&&!ap(i))return i;i=kr(i)}return t}let r=ZE(n,e);for(;r&&$k(r)&&ap(r);)r=ZE(r,e);return r&&Rr(r)&&ap(r)&&!Qh(r)?t:r||Bk(n)||t}const HI=async function(n){const e=this.getOffsetParent||iA,t=this.getDimensions,r=await t(n.floating);return{reference:qI(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function GI(n){return $n(n).direction==="rtl"}const KI={convertOffsetParentRelativeRectToViewportRelativeRect:BI,getDocumentElement:Gn,getClippingRect:_I,getOffsetParent:iA,getElementRects:HI,getClientRects:VI,getDimensions:zI,getScale:sc,isElement:on,isRTL:GI};function oA(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function WI(n,e){let t=null,r;const i=Gn(n);function o(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=n.getBoundingClientRect(),{left:d,top:f,width:m,height:w}=c;if(a||e(),!m||!w)return;const k=$o(f),I=$o(i.clientWidth-(d+m)),x=$o(i.clientHeight-(f+w)),T=$o(d),R={rootMargin:-k+"px "+-I+"px "+-x+"px "+-T+"px",threshold:Rn(0,Ai(1,l))||1};let L=!0;function G(E){const N=E[0].intersectionRatio;if(N!==l){if(!L)return s();N?s(!1,N):r=setTimeout(()=>{s(!1,1e-7)},1e3)}N===1&&!oA(c,n.getBoundingClientRect())&&s(),L=!1}try{t=new IntersectionObserver(G,{...R,root:i.ownerDocument})}catch{t=new IntersectionObserver(G,R)}t.observe(n)}return s(!0),o}function JI(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Tx(n),d=i||o?[...c?si(c):[],...si(e)]:[];d.forEach(T=>{i&&T.addEventListener("scroll",t,{passive:!0}),o&&T.addEventListener("resize",t)});const f=c&&a?WI(c,t):null;let m=-1,w=null;s&&(w=new ResizeObserver(T=>{let[b]=T;b&&b.target===c&&w&&(w.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var R;(R=w)==null||R.observe(e)})),t()}),c&&!l&&w.observe(c),w.observe(e));let k,I=l?Js(n):null;l&&x();function x(){const T=Js(n);I&&!oA(I,T)&&t(),I=T,k=requestAnimationFrame(x)}return t(),()=>{var T;d.forEach(b=>{i&&b.removeEventListener("scroll",t),o&&b.removeEventListener("resize",t)}),f==null||f(),(T=w)==null||T.disconnect(),w=null,l&&cancelAnimationFrame(k)}}const YI=RI,XI=CI,QI=TI,ZI=(n,e,t)=>{const r=new Map,i={platform:KI,...t},o={...i.platform,_c:r};return FI(n,e,{...i,platform:o})};var e3=typeof document<"u",t3=function(){},bd=e3?ce.useLayoutEffect:t3;function Hd(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,i;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!Hd(n[r],e[r]))return!1;return!0}if(i=Object.keys(n),t=i.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=t;r--!==0;){const o=i[r];if(!(o==="_owner"&&n.$$typeof)&&!Hd(n[o],e[o]))return!1}return!0}return n!==n&&e!==e}function sA(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function e1(n,e){const t=sA(n);return Math.round(e*t)/t}function cp(n){const e=Me.useRef(n);return bd(()=>{e.current=n}),e}function n3(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[d,f]=Me.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[m,w]=Me.useState(r);Hd(m,r)||w(r);const[k,I]=Me.useState(null),[x,T]=Me.useState(null),b=Me.useCallback(z=>{z!==E.current&&(E.current=z,I(z))},[]),R=Me.useCallback(z=>{z!==N.current&&(N.current=z,T(z))},[]),L=o||k,G=s||x,E=Me.useRef(null),N=Me.useRef(null),p=Me.useRef(d),F=l!=null,v=cp(l),O=cp(i),C=cp(c),V=Me.useCallback(()=>{if(!E.current||!N.current)return;const z={placement:e,strategy:t,middleware:m};O.current&&(z.platform=O.current),ZI(E.current,N.current,z).then(ue=>{const De={...ue,isPositioned:C.current!==!1};H.current&&!Hd(p.current,De)&&(p.current=De,Fc.flushSync(()=>{f(De)}))})},[m,e,t,O,C]);bd(()=>{c===!1&&p.current.isPositioned&&(p.current.isPositioned=!1,f(z=>({...z,isPositioned:!1})))},[c]);const H=Me.useRef(!1);bd(()=>(H.current=!0,()=>{H.current=!1}),[]),bd(()=>{if(L&&(E.current=L),G&&(N.current=G),L&&G){if(v.current)return v.current(L,G,V);V()}},[L,G,V,v,F]);const _=Me.useMemo(()=>({reference:E,floating:N,setReference:b,setFloating:R}),[b,R]),ee=Me.useMemo(()=>({reference:L,floating:G}),[L,G]),oe=Me.useMemo(()=>{const z={position:t,left:0,top:0};if(!ee.floating)return z;const ue=e1(ee.floating,d.x),De=e1(ee.floating,d.y);return a?{...z,transform:"translate("+ue+"px, "+De+"px)",...sA(ee.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ue,top:De}},[t,a,ee.floating,d.x,d.y]);return Me.useMemo(()=>({...d,update:V,refs:_,elements:ee,floatingStyles:oe}),[d,V,_,ee,oe])}const r3=(n,e)=>({...YI(n),options:[n,e]}),i3=(n,e)=>({...XI(n),options:[n,e]}),o3=(n,e)=>({...QI(n),options:[n,e]});function s3(n){const e=Me.useRef(void 0),t=Me.useCallback(r=>{const i=n.map(o=>{if(o!=null){if(typeof o=="function"){const s=o,a=s(r);return typeof a=="function"?a:()=>{s(null)}}return o.current=r,()=>{o.current=null}}});return()=>{i.forEach(o=>o==null?void 0:o())}},n);return Me.useMemo(()=>n.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=t(r))},n)}const a3="data-floating-ui-focusable",t1="active",n1="selected",c3={...Me};let r1=!1,u3=0;const i1=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+u3++;function l3(){const[n,e]=Me.useState(()=>r1?i1():void 0);return Mr(()=>{n==null&&e(i1())},[]),Me.useEffect(()=>{r1=!0},[]),n}const h3=c3.useId,Di=h3||l3;let um;process.env.NODE_ENV!=="production"&&(um=new Set);function d3(){for(var n,e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i="Floating UI: "+t.join(" ");if(!((n=um)!=null&&n.has(i))){var o;(o=um)==null||o.add(i),console.error(i)}}function f3(){const n=new Map;return{emit(e,t){var r;(r=n.get(e))==null||r.forEach(i=>i(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var r;(r=n.get(e))==null||r.delete(t)}}}const g3=Me.createContext(null),p3=Me.createContext(null),aA=()=>{var n;return((n=Me.useContext(g3))==null?void 0:n.id)||null},Ix=()=>Me.useContext(p3);function Nl(n){return"data-floating-ui-"+n}function m3(n){n.current!==-1&&(clearTimeout(n.current),n.current=-1)}let o1=0;function Ya(n,e){e===void 0&&(e={});const{preventScroll:t=!1,cancelPrevious:r=!0,sync:i=!1}=e;r&&cancelAnimationFrame(o1);const o=()=>n==null?void 0:n.focus({preventScroll:t});i?o():o1=requestAnimationFrame(o)}function y3(n){return(n==null?void 0:n.ownerDocument)||document}const ac={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function s1(n){return n==="inert"?ac.inert:n==="aria-hidden"?ac["aria-hidden"]:ac.none}let ud=new WeakSet,ld={},up=0;const w3=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,cA=n=>n&&(n.host||cA(n.parentNode)),S3=(n,e)=>e.map(t=>{if(n.contains(t))return t;const r=cA(t);return n.contains(r)?r:null}).filter(t=>t!=null);function v3(n,e,t,r){const i="data-floating-ui-inert",o=r?"inert":t?"aria-hidden":null,s=S3(e,n),a=new Set,l=new Set(s),c=[];ld[i]||(ld[i]=new WeakMap);const d=ld[i];s.forEach(f),m(e),a.clear();function f(w){!w||a.has(w)||(a.add(w),w.parentNode&&f(w.parentNode))}function m(w){!w||l.has(w)||[].forEach.call(w.children,k=>{if(ci(k)!=="script")if(a.has(k))m(k);else{const I=o?k.getAttribute(o):null,x=I!==null&&I!=="false",T=s1(o),b=(T.get(k)||0)+1,R=(d.get(k)||0)+1;T.set(k,b),d.set(k,R),c.push(k),b===1&&x&&ud.add(k),R===1&&k.setAttribute(i,""),!x&&o&&k.setAttribute(o,o==="inert"?"":"true")}})}return up++,()=>{c.forEach(w=>{const k=s1(o),x=(k.get(w)||0)-1,T=(d.get(w)||0)-1;k.set(w,x),d.set(w,T),x||(!ud.has(w)&&o&&w.removeAttribute(o),ud.delete(w)),T||w.removeAttribute(i)}),up--,up||(ac.inert=new WeakMap,ac["aria-hidden"]=new WeakMap,ac.none=new WeakMap,ud=new WeakSet,ld={})}}function a1(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=y3(n[0]).body;return v3(n.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,e,t)}const Mx={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Gd=Me.forwardRef(function(e,t){const[r,i]=Me.useState();Mr(()=>{fI()&&i("button")},[]);const o={ref:t,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Nl("focus-guard")]:"",style:Mx};return K.jsx("span",{...e,...o})}),x3={clipPath:"inset(50%)",position:"fixed",top:0,left:0},uA=Me.createContext(null),c1=Nl("portal");function E3(n){n===void 0&&(n={});const{id:e,root:t}=n,r=Di(),i=lA(),[o,s]=Me.useState(null),a=Me.useRef(null);return Mr(()=>()=>{o==null||o.remove(),queueMicrotask(()=>{a.current=null})},[o]),Mr(()=>{if(!r||a.current)return;const l=e?document.getElementById(e):null;if(!l)return;const c=document.createElement("div");c.id=r,c.setAttribute(c1,""),l.appendChild(c),a.current=c,s(c)},[e,r]),Mr(()=>{if(t===null||!r||a.current)return;let l=t||(i==null?void 0:i.portalNode);l&&!kx(l)&&(l=l.current),l=l||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,l.appendChild(c));const d=document.createElement("div");d.id=r,d.setAttribute(c1,""),l=c||l,l.appendChild(d),a.current=d,s(d)},[e,t,r,i]),o}function ed(n){const{children:e,id:t,root:r,preserveTabOrder:i=!0}=n,o=E3({id:t,root:r}),[s,a]=Me.useState(null),l=Me.useRef(null),c=Me.useRef(null),d=Me.useRef(null),f=Me.useRef(null),m=s==null?void 0:s.modal,w=s==null?void 0:s.open,k=!!s&&!s.modal&&s.open&&i&&!!(r||o);return Me.useEffect(()=>{if(!o||!i||m)return;function I(x){o&&Al(x)&&(x.type==="focusin"?JE:AI)(o)}return o.addEventListener("focusin",I,!0),o.addEventListener("focusout",I,!0),()=>{o.removeEventListener("focusin",I,!0),o.removeEventListener("focusout",I,!0)}},[o,i,m]),Me.useEffect(()=>{o&&(w||JE(o))},[w,o]),K.jsxs(uA.Provider,{value:Me.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:f,portalNode:o,setFocusManagerState:a}),[i,o]),children:[k&&o&&K.jsx(Gd,{"data-type":"outside",ref:l,onFocus:I=>{if(Al(I,o)){var x;(x=d.current)==null||x.focus()}else{const T=s?s.domReference:null,b=Zk(T);b==null||b.focus()}}}),k&&o&&K.jsx("span",{"aria-owns":o.id,style:x3}),o&&Fc.createPortal(e,o),k&&o&&K.jsx(Gd,{"data-type":"outside",ref:c,onFocus:I=>{if(Al(I,o)){var x;(x=f.current)==null||x.focus()}else{const T=s?s.domReference:null,b=Qk(T);b==null||b.focus(),s!=null&&s.closeOnFocusOut&&(s==null||s.onOpenChange(!1,I.nativeEvent,"focus-out"))}}})]})}const lA=()=>Me.useContext(uA);function u1(n){return Me.useMemo(()=>e=>{n.forEach(t=>{t&&(t.current=e)})},n)}const b3=20;let Bo=[];function Rx(){Bo=Bo.filter(n=>n.isConnected)}function k3(n){Rx(),n&&ci(n)!=="body"&&(Bo.push(n),Bo.length>b3&&(Bo=Bo.slice(-20)))}function l1(){return Rx(),Bo[Bo.length-1]}function A3(n){const e=Zh();return Kk(n,e)?n:Tf(n,e)[0]||n}function h1(n,e){var t;if(!e.current.includes("floating")&&!((t=n.getAttribute("role"))!=null&&t.includes("dialog")))return;const r=Zh(),o=dI(n,r).filter(a=>{const l=a.getAttribute("data-tabindex")||"";return Kk(a,r)||a.hasAttribute("data-tabindex")&&!l.startsWith("-")}),s=n.getAttribute("tabindex");e.current.includes("floating")||o.length===0?s!=="0"&&n.setAttribute("tabindex","0"):(s!=="-1"||n.hasAttribute("data-tabindex")&&n.getAttribute("data-tabindex")!=="-1")&&(n.setAttribute("tabindex","-1"),n.setAttribute("data-tabindex","-1"))}const D3=Me.forwardRef(function(e,t){return K.jsx("button",{...e,type:"button",ref:t,tabIndex:-1,style:Mx})});function Mf(n){const{context:e,children:t,disabled:r=!1,order:i=["content"],guards:o=!0,initialFocus:s=0,returnFocus:a=!0,restoreFocus:l=!1,modal:c=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:f=!0,outsideElementsInert:m=!1,getInsideElements:w=()=>[]}=n,{open:k,onOpenChange:I,events:x,dataRef:T,elements:{domReference:b,floating:R}}=e,L=Ei(()=>{var M;return(M=T.current.floatingContext)==null?void 0:M.nodeId}),G=Ei(w),E=typeof s=="number"&&s<0,N=GE(b)&&E,p=w3(),F=p?o:!0,v=!F||p&&m,O=sp(i),C=sp(s),V=sp(a),H=Ix(),_=lA(),ee=Me.useRef(null),oe=Me.useRef(null),z=Me.useRef(!1),ue=Me.useRef(!1),De=Me.useRef(-1),ve=Me.useRef(-1),Te=_!=null,de=cm(R),ie=Ei(function(M){return M===void 0&&(M=de),M?Tf(M,Zh()):[]}),ke=Ei(M=>{const W=ie(M);return O.current.map(U=>b&&U==="reference"?b:de&&U==="floating"?de:W).filter(Boolean).flat()});Me.useEffect(()=>{if(r||!c)return;function M(U){if(U.key==="Tab"){Fr(de,ec(ri(de)))&&ie().length===0&&!N&&op(U);const q=ke(),re=bo(U);O.current[0]==="reference"&&re===b&&(op(U),U.shiftKey?Ya(q[q.length-1]):Ya(q[1])),O.current[1]==="floating"&&re===de&&U.shiftKey&&(op(U),Ya(q[0]))}}const W=ri(de);return W.addEventListener("keydown",M),()=>{W.removeEventListener("keydown",M)}},[r,b,de,c,O,N,ie,ke]),Me.useEffect(()=>{if(r||!R)return;function M(W){const U=bo(W),re=ie().indexOf(U);re!==-1&&(De.current=re)}return R.addEventListener("focusin",M),()=>{R.removeEventListener("focusin",M)}},[r,R,ie]),Me.useEffect(()=>{if(r||!f)return;function M(){ue.current=!0,setTimeout(()=>{ue.current=!1})}function W(re){const j=re.relatedTarget,X=re.currentTarget,te=bo(re);queueMicrotask(()=>{const Q=L(),le=!(Fr(b,j)||Fr(R,j)||Fr(j,R)||Fr(_==null?void 0:_.portalNode,j)||j!=null&&j.hasAttribute(Nl("focus-guard"))||H&&(oc(H.nodesRef.current,Q).find(fe=>{var ye,Ve;return Fr((ye=fe.context)==null?void 0:ye.elements.floating,j)||Fr((Ve=fe.context)==null?void 0:Ve.elements.domReference,j)})||KE(H.nodesRef.current,Q).find(fe=>{var ye,Ve,Ke;return[(ye=fe.context)==null?void 0:ye.elements.floating,cm((Ve=fe.context)==null?void 0:Ve.elements.floating)].includes(j)||((Ke=fe.context)==null?void 0:Ke.elements.domReference)===j})));if(X===b&&de&&h1(de,O),l&&X!==b&&!(te!=null&&te.isConnected)&&ec(ri(de))===ri(de).body){bn(de)&&de.focus();const fe=De.current,ye=ie(),Ve=ye[fe]||ye[ye.length-1]||de;bn(Ve)&&Ve.focus()}if(T.current.insideReactTree){T.current.insideReactTree=!1;return}(N||!c)&&j&&le&&!ue.current&&j!==l1()&&(z.current=!0,I(!1,re,"focus-out"))})}const U=!!(!H&&_);function q(){m3(ve),T.current.insideReactTree=!0,ve.current=window.setTimeout(()=>{T.current.insideReactTree=!1})}if(R&&bn(b))return b.addEventListener("focusout",W),b.addEventListener("pointerdown",M),R.addEventListener("focusout",W),U&&R.addEventListener("focusout",q,!0),()=>{b.removeEventListener("focusout",W),b.removeEventListener("pointerdown",M),R.removeEventListener("focusout",W),U&&R.removeEventListener("focusout",q,!0)}},[r,b,R,de,c,H,_,I,f,l,ie,N,L,O,T]);const Ie=Me.useRef(null),Ze=Me.useRef(null),Ee=u1([Ie,_==null?void 0:_.beforeInsideRef]),be=u1([Ze,_==null?void 0:_.afterInsideRef]);Me.useEffect(()=>{var M,W;if(r||!R)return;const U=Array.from((_==null||(M=_.portalNode)==null?void 0:M.querySelectorAll("["+Nl("portal")+"]"))||[]),re=(W=(H?KE(H.nodesRef.current,L()):[]).find(te=>{var Q;return GE(((Q=te.context)==null?void 0:Q.elements.domReference)||null)}))==null||(W=W.context)==null?void 0:W.elements.domReference,j=[R,re,...U,...G(),ee.current,oe.current,Ie.current,Ze.current,_==null?void 0:_.beforeOutsideRef.current,_==null?void 0:_.afterOutsideRef.current,O.current.includes("reference")||N?b:null].filter(te=>te!=null),X=c||N?a1(j,!v,v):a1(j);return()=>{X()}},[r,b,R,c,O,_,N,F,v,H,L,G]),Mr(()=>{if(r||!bn(de))return;const M=ri(de),W=ec(M);queueMicrotask(()=>{const U=ke(de),q=C.current,re=(typeof q=="number"?U[q]:q.current)||de,j=Fr(de,W);!E&&!j&&k&&Ya(re,{preventScroll:re===de})})},[r,k,de,E,ke,C]),Mr(()=>{if(r||!de)return;const M=ri(de),W=ec(M);k3(W);function U(j){let{reason:X,event:te,nested:Q}=j;if(["hover","safe-polygon"].includes(X)&&te.type==="mouseleave"&&(z.current=!0),X==="outside-press")if(Q)z.current=!1;else if(wI(te)||SI(te))z.current=!1;else{let le=!1;document.createElement("div").focus({get preventScroll(){return le=!0,!1}}),le?z.current=!1:z.current=!0}}x.on("openchange",U);const q=M.createElement("span");q.setAttribute("tabindex","-1"),q.setAttribute("aria-hidden","true"),Object.assign(q.style,Mx),Te&&b&&b.insertAdjacentElement("afterend",q);function re(){if(typeof V.current=="boolean"){const j=b||l1();return j&&j.isConnected?j:q}return V.current.current||q}return()=>{x.off("openchange",U);const j=ec(M),X=Fr(R,j)||H&&oc(H.nodesRef.current,L(),!1).some(Q=>{var le;return Fr((le=Q.context)==null?void 0:le.elements.floating,j)}),te=re();queueMicrotask(()=>{const Q=A3(te);V.current&&!z.current&&bn(Q)&&(!(Q!==j&&j!==M.body)||X)&&Q.focus({preventScroll:!0}),q.remove()})}},[r,R,de,V,T,x,H,Te,b,L]),Me.useEffect(()=>(queueMicrotask(()=>{z.current=!1}),()=>{queueMicrotask(Rx)}),[r]),Mr(()=>{if(!r&&_)return _.setFocusManagerState({modal:c,closeOnFocusOut:f,open:k,onOpenChange:I,domReference:b}),()=>{_.setFocusManagerState(null)}},[r,_,c,k,I,f,b]),Mr(()=>{r||de&&h1(de,O)},[r,de,O]);function g(M){return r||!d||!c?null:K.jsx(D3,{ref:M==="start"?ee:oe,onClick:W=>I(!1,W.nativeEvent),children:typeof d=="string"?d:"Dismiss"})}const A=!r&&F&&(c?!N:!0)&&(Te||c);return K.jsxs(K.Fragment,{children:[A&&K.jsx(Gd,{"data-type":"inside",ref:Ee,onFocus:M=>{if(c){const U=ke();Ya(i[0]==="reference"?U[0]:U[U.length-1])}else if(_!=null&&_.preserveTabOrder&&_.portalNode)if(z.current=!1,Al(M,_.portalNode)){const U=Qk(b);U==null||U.focus()}else{var W;(W=_.beforeOutsideRef.current)==null||W.focus()}}}),!N&&g("start"),t,g("end"),A&&K.jsx(Gd,{"data-type":"inside",ref:be,onFocus:M=>{if(c)Ya(ke()[0]);else if(_!=null&&_.preserveTabOrder&&_.portalNode)if(f&&(z.current=!0),Al(M,_.portalNode)){const U=Zk(b);U==null||U.focus()}else{var W;(W=_.afterOutsideRef.current)==null||W.focus()}}})]})}let hd=0;const d1="--floating-ui-scrollbar-width";function F3(){const n=Wk(),e=/iP(hone|ad|od)|iOS/.test(n)||n==="MacIntel"&&navigator.maxTouchPoints>1,t=document.body.style,i=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,s=t.left?parseFloat(t.left):window.scrollX,a=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",t.setProperty(d1,o+"px"),o&&(t[i]=o+"px"),e){var l,c;const d=((l=window.visualViewport)==null?void 0:l.offsetLeft)||0,f=((c=window.visualViewport)==null?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(a-Math.floor(f))+"px",left:-(s-Math.floor(d))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[i]:""}),t.removeProperty(d1),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(s,a))}}let f1=()=>{};const Cx=Me.forwardRef(function(e,t){const{lockScroll:r=!1,...i}=e;return Mr(()=>{if(r)return hd++,hd===1&&(f1=F3()),()=>{hd--,hd===0&&f1()}},[r]),K.jsx("div",{ref:t,...i,style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...i.style}})});function g1(n){return bn(n.target)&&n.target.tagName==="BUTTON"}function T3(n){return bn(n.target)&&n.target.tagName==="A"}function p1(n){return Yk(n)}function hA(n,e){e===void 0&&(e={});const{open:t,onOpenChange:r,dataRef:i,elements:{domReference:o}}=n,{enabled:s=!0,event:a="click",toggle:l=!0,ignoreMouse:c=!1,keyboardHandlers:d=!0,stickIfOpen:f=!0}=e,m=Me.useRef(),w=Me.useRef(!1),k=Me.useMemo(()=>({onPointerDown(I){m.current=I.pointerType},onMouseDown(I){const x=m.current;I.button===0&&a!=="click"&&(WE(x)&&c||(t&&l&&(!(i.current.openEvent&&f)||i.current.openEvent.type==="mousedown")?r(!1,I.nativeEvent,"click"):(I.preventDefault(),r(!0,I.nativeEvent,"click"))))},onClick(I){const x=m.current;if(a==="mousedown"&&m.current){m.current=void 0;return}WE(x)&&c||(t&&l&&(!(i.current.openEvent&&f)||i.current.openEvent.type==="click")?r(!1,I.nativeEvent,"click"):r(!0,I.nativeEvent,"click"))},onKeyDown(I){m.current=void 0,!(I.defaultPrevented||!d||g1(I))&&(I.key===" "&&!p1(o)&&(I.preventDefault(),w.current=!0),!T3(I)&&I.key==="Enter"&&r(!(t&&l),I.nativeEvent,"click"))},onKeyUp(I){I.defaultPrevented||!d||g1(I)||p1(o)||I.key===" "&&w.current&&(w.current=!1,r(!(t&&l),I.nativeEvent,"click"))}}),[i,o,a,c,d,r,t,f,l]);return Me.useMemo(()=>s?{reference:k}:{},[s,k])}const I3={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},M3={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},m1=n=>{var e,t;return{escapeKey:typeof n=="boolean"?n:(e=n==null?void 0:n.escapeKey)!=null?e:!1,outsidePress:typeof n=="boolean"?n:(t=n==null?void 0:n.outsidePress)!=null?t:!0}};function Rf(n,e){e===void 0&&(e={});const{open:t,onOpenChange:r,elements:i,dataRef:o}=n,{enabled:s=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:d=!1,referencePressEvent:f="pointerdown",ancestorScroll:m=!1,bubbles:w,capture:k}=e,I=Ix(),x=Ei(typeof l=="function"?l:()=>!1),T=typeof l=="function"?x:l,b=Me.useRef(!1),{escapeKey:R,outsidePress:L}=m1(w),{escapeKey:G,outsidePress:E}=m1(k),N=Me.useRef(!1),p=Ei(H=>{var _;if(!t||!s||!a||H.key!=="Escape"||N.current)return;const ee=(_=o.current.floatingContext)==null?void 0:_.nodeId,oe=I?oc(I.nodesRef.current,ee):[];if(!R&&(H.stopPropagation(),oe.length>0)){let z=!0;if(oe.forEach(ue=>{var De;if((De=ue.context)!=null&&De.open&&!ue.context.dataRef.current.__escapeKeyBubbles){z=!1;return}}),!z)return}r(!1,yI(H)?H.nativeEvent:H,"escape-key")}),F=Ei(H=>{var _;const ee=()=>{var oe;p(H),(oe=bo(H))==null||oe.removeEventListener("keydown",ee)};(_=bo(H))==null||_.addEventListener("keydown",ee)}),v=Ei(H=>{var _;const ee=o.current.insideReactTree;o.current.insideReactTree=!1;const oe=b.current;if(b.current=!1,c==="click"&&oe||ee||typeof T=="function"&&!T(H))return;const z=bo(H),ue="["+Nl("inert")+"]",De=ri(i.floating).querySelectorAll(ue);let ve=on(z)?z:null;for(;ve&&!Rr(ve);){const ke=kr(ve);if(Rr(ke)||!on(ke))break;ve=ke}if(De.length&&on(z)&&!mI(z)&&!Fr(z,i.floating)&&Array.from(De).every(ke=>!Fr(ve,ke)))return;if(bn(z)&&V){const ke=Rr(z),Ie=$n(z),Ze=/auto|scroll/,Ee=ke||Ze.test(Ie.overflowX),be=ke||Ze.test(Ie.overflowY),g=Ee&&z.clientWidth>0&&z.scrollWidth>z.clientWidth,A=be&&z.clientHeight>0&&z.scrollHeight>z.clientHeight,M=Ie.direction==="rtl",W=A&&(M?H.offsetX<=z.offsetWidth-z.clientWidth:H.offsetX>z.clientWidth),U=g&&H.offsetY>z.clientHeight;if(W||U)return}const Te=(_=o.current.floatingContext)==null?void 0:_.nodeId,de=I&&oc(I.nodesRef.current,Te).some(ke=>{var Ie;return ip(H,(Ie=ke.context)==null?void 0:Ie.elements.floating)});if(ip(H,i.floating)||ip(H,i.domReference)||de)return;const ie=I?oc(I.nodesRef.current,Te):[];if(ie.length>0){let ke=!0;if(ie.forEach(Ie=>{var Ze;if((Ze=Ie.context)!=null&&Ze.open&&!Ie.context.dataRef.current.__outsidePressBubbles){ke=!1;return}}),!ke)return}r(!1,H,"outside-press")}),O=Ei(H=>{var _;const ee=()=>{var oe;v(H),(oe=bo(H))==null||oe.removeEventListener(c,ee)};(_=bo(H))==null||_.addEventListener(c,ee)});Me.useEffect(()=>{if(!t||!s)return;o.current.__escapeKeyBubbles=R,o.current.__outsidePressBubbles=L;let H=-1;function _(De){r(!1,De,"ancestor-scroll")}function ee(){window.clearTimeout(H),N.current=!0}function oe(){H=window.setTimeout(()=>{N.current=!1},Lu()?5:0)}const z=ri(i.floating);a&&(z.addEventListener("keydown",G?F:p,G),z.addEventListener("compositionstart",ee),z.addEventListener("compositionend",oe)),T&&z.addEventListener(c,E?O:v,E);let ue=[];return m&&(on(i.domReference)&&(ue=si(i.domReference)),on(i.floating)&&(ue=ue.concat(si(i.floating))),!on(i.reference)&&i.reference&&i.reference.contextElement&&(ue=ue.concat(si(i.reference.contextElement)))),ue=ue.filter(De=>{var ve;return De!==((ve=z.defaultView)==null?void 0:ve.visualViewport)}),ue.forEach(De=>{De.addEventListener("scroll",_,{passive:!0})}),()=>{a&&(z.removeEventListener("keydown",G?F:p,G),z.removeEventListener("compositionstart",ee),z.removeEventListener("compositionend",oe)),T&&z.removeEventListener(c,E?O:v,E),ue.forEach(De=>{De.removeEventListener("scroll",_)}),window.clearTimeout(H)}},[o,i,a,T,c,t,r,m,s,R,L,p,G,F,v,E,O]),Me.useEffect(()=>{o.current.insideReactTree=!1},[o,T,c]);const C=Me.useMemo(()=>({onKeyDown:p,...d&&{[I3[f]]:H=>{r(!1,H.nativeEvent,"reference-press")},...f!=="click"&&{onClick(H){r(!1,H.nativeEvent,"reference-press")}}}}),[p,r,d,f]),V=Me.useMemo(()=>({onKeyDown:p,onMouseDown(){b.current=!0},onMouseUp(){b.current=!0},[M3[c]]:()=>{o.current.insideReactTree=!0}}),[p,c,o]);return Me.useMemo(()=>s?{reference:C,floating:V}:{},[s,C,V])}function R3(n){const{open:e=!1,onOpenChange:t,elements:r}=n,i=Di(),o=Me.useRef({}),[s]=Me.useState(()=>f3()),a=aA()!=null;if(process.env.NODE_ENV!=="production"){const w=r.reference;w&&!on(w)&&d3("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,c]=Me.useState(r.reference),d=Ei((w,k,I)=>{o.current.openEvent=w?k:void 0,s.emit("openchange",{open:w,event:k,reason:I,nested:a}),t==null||t(w,k,I)}),f=Me.useMemo(()=>({setPositionReference:c}),[]),m=Me.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return Me.useMemo(()=>({dataRef:o,open:e,onOpenChange:d,elements:m,events:s,floatingId:i,refs:f}),[e,d,m,s,i,f])}function Cf(n){n===void 0&&(n={});const{nodeId:e}=n,t=R3({...n,elements:{reference:null,floating:null,...n.elements}}),r=n.rootContext||t,i=r.elements,[o,s]=Me.useState(null),[a,l]=Me.useState(null),d=(i==null?void 0:i.domReference)||o,f=Me.useRef(null),m=Ix();Mr(()=>{d&&(f.current=d)},[d]);const w=n3({...n,elements:{...i,...a&&{reference:a}}}),k=Me.useCallback(R=>{const L=on(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;l(L),w.refs.setReference(L)},[w.refs]),I=Me.useCallback(R=>{(on(R)||R===null)&&(f.current=R,s(R)),(on(w.refs.reference.current)||w.refs.reference.current===null||R!==null&&!on(R))&&w.refs.setReference(R)},[w.refs]),x=Me.useMemo(()=>({...w.refs,setReference:I,setPositionReference:k,domReference:f}),[w.refs,I,k]),T=Me.useMemo(()=>({...w.elements,domReference:d}),[w.elements,d]),b=Me.useMemo(()=>({...w,...r,refs:x,elements:T,nodeId:e}),[w,x,T,e,r]);return Mr(()=>{r.dataRef.current.floatingContext=b;const R=m==null?void 0:m.nodesRef.current.find(L=>L.id===e);R&&(R.context=b)}),Me.useMemo(()=>({...w,context:b,refs:x,elements:T}),[w,x,T,b])}function lp(n,e,t){const r=new Map,i=t==="item";let o=n;if(i&&n){const{[t1]:s,[n1]:a,...l}=n;o=l}return{...t==="floating"&&{tabIndex:-1,[a3]:""},...o,...e.map(s=>{const a=s?s[t]:null;return typeof a=="function"?n?a(n):null:a}).concat(n).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(i&&[t1,n1].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof d=="function"){var f;(f=r.get(c))==null||f.push(d),s[c]=function(){for(var m,w=arguments.length,k=new Array(w),I=0;I<w;I++)k[I]=arguments[I];return(m=r.get(c))==null?void 0:m.map(x=>x(...k)).find(x=>x!==void 0)}}}else s[c]=d}),s),{})}}function Pf(n){n===void 0&&(n=[]);const e=n.map(a=>a==null?void 0:a.reference),t=n.map(a=>a==null?void 0:a.floating),r=n.map(a=>a==null?void 0:a.item),i=Me.useCallback(a=>lp(a,n,"reference"),e),o=Me.useCallback(a=>lp(a,n,"floating"),t),s=Me.useCallback(a=>lp(a,n,"item"),r);return Me.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:s}),[i,o,s])}const C3=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Px(n,e){var t,r;e===void 0&&(e={});const{open:i,elements:o,floatingId:s}=n,{enabled:a=!0,role:l="dialog"}=e,c=Di(),d=((t=o.domReference)==null?void 0:t.id)||c,f=Me.useMemo(()=>{var b;return((b=cm(o.floating))==null?void 0:b.id)||s},[o.floating,s]),m=(r=C3.get(l))!=null?r:l,k=aA()!=null,I=Me.useMemo(()=>m==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:i?f:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":m==="alertdialog"?"dialog":m,"aria-controls":i?f:void 0,...m==="listbox"&&{role:"combobox"},...m==="menu"&&{id:d},...m==="menu"&&k&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[m,f,k,i,d,l]),x=Me.useMemo(()=>{const b={id:f,...m&&{role:m}};return m==="tooltip"||l==="label"?b:{...b,...m==="menu"&&{"aria-labelledby":d}}},[m,f,d,l]),T=Me.useCallback(b=>{let{active:R,selected:L}=b;const G={role:"option",...R&&{id:f+"-fui-option"}};switch(l){case"select":case"combobox":return{...G,"aria-selected":L}}return{}},[f,l]);return Me.useMemo(()=>a?{reference:I,floating:x,item:T}:{},[a,I,x,T])}var Uu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},P3={setTimeout:(n,e)=>setTimeout(n,e),clearTimeout:n=>clearTimeout(n),setInterval:(n,e)=>setInterval(n,e),clearInterval:n=>clearInterval(n)},mi,Rs,ak,$3=(ak=class{constructor(){Ct(this,mi,P3);Ct(this,Rs,!1)}setTimeoutProvider(n){process.env.NODE_ENV!=="production"&&he(this,Rs)&&n!==he(this,mi)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:he(this,mi),provider:n}),ht(this,mi,n),process.env.NODE_ENV!=="production"&&ht(this,Rs,!1)}setTimeout(n,e){return process.env.NODE_ENV!=="production"&&ht(this,Rs,!0),he(this,mi).setTimeout(n,e)}clearTimeout(n){he(this,mi).clearTimeout(n)}setInterval(n,e){return process.env.NODE_ENV!=="production"&&ht(this,Rs,!0),he(this,mi).setInterval(n,e)}clearInterval(n){he(this,mi).clearInterval(n)}},mi=new WeakMap,Rs=new WeakMap,ak),ks=new $3;function B3(n){setTimeout(n,0)}var Ys=typeof window>"u"||"Deno"in globalThis;function dr(){}function V3(n,e){return typeof n=="function"?n(e):n}function lm(n){return typeof n=="number"&&n>=0&&n!==1/0}function dA(n,e){return Math.max(n+(e||0)-Date.now(),0)}function Uo(n,e){return typeof n=="function"?n(e):n}function jr(n,e){return typeof n=="function"?n(e):n}function y1(n,e){const{type:t="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=n;if(s){if(r){if(e.queryHash!==$x(s,e.options))return!1}else if(!Ul(e.queryKey,s))return!1}if(t!=="all"){const l=e.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||o&&!o(e))}function w1(n,e){const{exact:t,status:r,predicate:i,mutationKey:o}=n;if(o){if(!e.options.mutationKey)return!1;if(t){if(Ll(e.options.mutationKey)!==Ll(o))return!1}else if(!Ul(e.options.mutationKey,o))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function $x(n,e){return((e==null?void 0:e.queryKeyHashFn)||Ll)(n)}function Ll(n){return JSON.stringify(n,(e,t)=>hm(t)?Object.keys(t).sort().reduce((r,i)=>(r[i]=t[i],r),{}):t)}function Ul(n,e){return n===e?!0:typeof n!=typeof e?!1:n&&e&&typeof n=="object"&&typeof e=="object"?Object.keys(e).every(t=>Ul(n[t],e[t])):!1}var O3=Object.prototype.hasOwnProperty;function Kd(n,e,t=0){if(n===e)return n;if(t>500)return e;const r=S1(n)&&S1(e);if(!r&&!(hm(n)&&hm(e)))return e;const o=(r?n:Object.keys(n)).length,s=r?e:Object.keys(e),a=s.length,l=r?new Array(a):{};let c=0;for(let d=0;d<a;d++){const f=r?d:s[d],m=n[f],w=e[f];if(m===w){l[f]=m,(r?d<o:O3.call(n,f))&&c++;continue}if(m===null||w===null||typeof m!="object"||typeof w!="object"){l[f]=w;continue}const k=Kd(m,w,t+1);l[f]=k,k===m&&c++}return o===a&&c===o?n:l}function Wd(n,e){if(!e||Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(n[t]!==e[t])return!1;return!0}function S1(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function hm(n){if(!v1(n))return!1;const e=n.constructor;if(e===void 0)return!0;const t=e.prototype;return!(!v1(t)||!t.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function v1(n){return Object.prototype.toString.call(n)==="[object Object]"}function N3(n){return new Promise(e=>{ks.setTimeout(e,n)})}function dm(n,e,t){if(typeof t.structuralSharing=="function")return t.structuralSharing(n,e);if(t.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Kd(n,e)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${t.queryHash}]: ${r}`),r}return Kd(n,e)}return e}function L3(n,e,t=0){const r=[...n,e];return t&&r.length>t?r.slice(1):r}function U3(n,e,t=0){const r=[e,...n];return t&&r.length>t?r.slice(0,-1):r}var Jd=Symbol();function fA(n,e){return process.env.NODE_ENV!=="production"&&n.queryFn===Jd&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${n.queryHash}'`),!n.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!n.queryFn||n.queryFn===Jd?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function gA(n,e){return typeof n=="function"?n(...e):!!n}function j3(n,e,t){let r=!1,i;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?t():i.addEventListener("abort",t,{once:!0})),i)}),n}var Cs,Do,fc,ck,_3=(ck=class extends Uu{constructor(){super();Ct(this,Cs);Ct(this,Do);Ct(this,fc);ht(this,fc,e=>{if(!Ys&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){he(this,Do)||this.setEventListener(he(this,fc))}onUnsubscribe(){var e;this.hasListeners()||((e=he(this,Do))==null||e.call(this),ht(this,Do,void 0))}setEventListener(e){var t;ht(this,fc,e),(t=he(this,Do))==null||t.call(this),ht(this,Do,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){he(this,Cs)!==e&&(ht(this,Cs,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof he(this,Cs)=="boolean"?he(this,Cs):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Cs=new WeakMap,Do=new WeakMap,fc=new WeakMap,ck),Bx=new _3;function fm(){let n,e;const t=new Promise((i,o)=>{n=i,e=o});t.status="pending",t.catch(()=>{});function r(i){Object.assign(t,i),delete t.resolve,delete t.reject}return t.resolve=i=>{r({status:"fulfilled",value:i}),n(i)},t.reject=i=>{r({status:"rejected",reason:i}),e(i)},t}var z3=B3;function q3(){let n=[],e=0,t=a=>{a()},r=a=>{a()},i=z3;const o=a=>{e?n.push(a):i(()=>{t(a)})},s=()=>{const a=n;n=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{t(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||s()}return l},batchCalls:a=>(...l)=>{o(()=>{a(...l)})},schedule:o,setNotifyFunction:a=>{t=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var On=q3(),gc,Fo,pc,uk,H3=(uk=class extends Uu{constructor(){super();Ct(this,gc,!0);Ct(this,Fo);Ct(this,pc);ht(this,pc,e=>{if(!Ys&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}})}onSubscribe(){he(this,Fo)||this.setEventListener(he(this,pc))}onUnsubscribe(){var e;this.hasListeners()||((e=he(this,Fo))==null||e.call(this),ht(this,Fo,void 0))}setEventListener(e){var t;ht(this,pc,e),(t=he(this,Fo))==null||t.call(this),ht(this,Fo,e(this.setOnline.bind(this)))}setOnline(e){he(this,gc)!==e&&(ht(this,gc,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return he(this,gc)}},gc=new WeakMap,Fo=new WeakMap,pc=new WeakMap,uk),Yd=new H3;function G3(n){return Math.min(1e3*2**n,3e4)}function pA(n){return(n??"online")==="online"?Yd.isOnline():!0}var gm=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function mA(n){let e=!1,t=0,r;const i=fm(),o=()=>i.status!=="pending",s=I=>{var x;if(!o()){const T=new gm(I);m(T),(x=n.onCancel)==null||x.call(n,T)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>Bx.isFocused()&&(n.networkMode==="always"||Yd.isOnline())&&n.canRun(),d=()=>pA(n.networkMode)&&n.canRun(),f=I=>{o()||(r==null||r(),i.resolve(I))},m=I=>{o()||(r==null||r(),i.reject(I))},w=()=>new Promise(I=>{var x;r=T=>{(o()||c())&&I(T)},(x=n.onPause)==null||x.call(n)}).then(()=>{var I;r=void 0,o()||(I=n.onContinue)==null||I.call(n)}),k=()=>{if(o())return;let I;const x=t===0?n.initialPromise:void 0;try{I=x??n.fn()}catch(T){I=Promise.reject(T)}Promise.resolve(I).then(f).catch(T=>{var E;if(o())return;const b=n.retry??(Ys?0:3),R=n.retryDelay??G3,L=typeof R=="function"?R(t,T):R,G=b===!0||typeof b=="number"&&t<b||typeof b=="function"&&b(t,T);if(e||!G){m(T);return}t++,(E=n.onFail)==null||E.call(n,t,T),N3(L).then(()=>c()?void 0:w()).then(()=>{e?m(T):k()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?k():w().then(k),i)}}var Ps,lk,yA=(lk=class{constructor(){Ct(this,Ps)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),lm(this.gcTime)&&ht(this,Ps,ks.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(Ys?1/0:300*1e3))}clearGcTimeout(){he(this,Ps)&&(ks.clearTimeout(he(this,Ps)),ht(this,Ps,void 0))}},Ps=new WeakMap,lk),$s,mc,Lr,Bs,Kn,zh,Vs,Zr,ji,hk,K3=(hk=class extends yA{constructor(e){super();Ct(this,Zr);Ct(this,$s);Ct(this,mc);Ct(this,Lr);Ct(this,Bs);Ct(this,Kn);Ct(this,zh);Ct(this,Vs);ht(this,Vs,!1),ht(this,zh,e.defaultOptions),this.setOptions(e.options),this.observers=[],ht(this,Bs,e.client),ht(this,Lr,he(this,Bs).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,ht(this,$s,E1(this.options)),this.state=e.state??he(this,$s),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=he(this,Kn))==null?void 0:e.promise}setOptions(e){if(this.options={...he(this,zh),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=E1(this.options);t.data!==void 0&&(this.setState(x1(t.data,t.dataUpdatedAt)),ht(this,$s,t))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&he(this,Lr).remove(this)}setData(e,t){const r=dm(this.state.data,e,this.options);return Kt(this,Zr,ji).call(this,{data:r,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),r}setState(e,t){Kt(this,Zr,ji).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var r,i;const t=(r=he(this,Kn))==null?void 0:r.promise;return(i=he(this,Kn))==null||i.cancel(e),t?t.then(dr).catch(dr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(he(this,$s))}isActive(){return this.observers.some(e=>jr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jd||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Uo(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!dA(this.state.dataUpdatedAt,e)}onFocus(){var t;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(t=he(this,Kn))==null||t.continue()}onOnline(){var t;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(t=he(this,Kn))==null||t.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),he(this,Lr).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(he(this,Kn)&&(he(this,Vs)?he(this,Kn).cancel({revert:!0}):he(this,Kn).cancelRetry()),this.scheduleGc()),he(this,Lr).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Kt(this,Zr,ji).call(this,{type:"invalidate"})}async fetch(e,t){var l,c,d,f,m,w,k,I,x,T,b,R;if(this.state.fetchStatus!=="idle"&&((l=he(this,Kn))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(he(this,Kn))return he(this,Kn).continueRetry(),he(this,Kn).promise}if(e&&this.setOptions(e),!this.options.queryFn){const L=this.observers.find(G=>G.options.queryFn);L&&this.setOptions(L.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,i=L=>{Object.defineProperty(L,"signal",{enumerable:!0,get:()=>(ht(this,Vs,!0),r.signal)})},o=()=>{const L=fA(this.options,t),E=(()=>{const N={client:he(this,Bs),queryKey:this.queryKey,meta:this.meta};return i(N),N})();return ht(this,Vs,!1),this.options.persister?this.options.persister(L,E,this):L(E)},a=(()=>{const L={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:he(this,Bs),state:this.state,fetchFn:o};return i(L),L})();(c=this.options.behavior)==null||c.onFetch(a,this),ht(this,mc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Kt(this,Zr,ji).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),ht(this,Kn,mA({initialPromise:t==null?void 0:t.initialPromise,fn:a.fetchFn,onCancel:L=>{L instanceof gm&&L.revert&&this.setState({...he(this,mc),fetchStatus:"idle"}),r.abort()},onFail:(L,G)=>{Kt(this,Zr,ji).call(this,{type:"failed",failureCount:L,error:G})},onPause:()=>{Kt(this,Zr,ji).call(this,{type:"pause"})},onContinue:()=>{Kt(this,Zr,ji).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const L=await he(this,Kn).start();if(L===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(L),(w=(m=he(this,Lr).config).onSuccess)==null||w.call(m,L,this),(I=(k=he(this,Lr).config).onSettled)==null||I.call(k,L,this.state.error,this),L}catch(L){if(L instanceof gm){if(L.silent)return he(this,Kn).promise;if(L.revert){if(this.state.data===void 0)throw L;return this.state.data}}throw Kt(this,Zr,ji).call(this,{type:"error",error:L}),(T=(x=he(this,Lr).config).onError)==null||T.call(x,L,this),(R=(b=he(this,Lr).config).onSettled)==null||R.call(b,this.state.data,L,this),L}finally{this.scheduleGc()}}},$s=new WeakMap,mc=new WeakMap,Lr=new WeakMap,Bs=new WeakMap,Kn=new WeakMap,zh=new WeakMap,Vs=new WeakMap,Zr=new WeakSet,ji=function(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...wA(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...x1(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ht(this,mc,e.manual?i:void 0),i;case"error":const o=e.error;return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),On.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),he(this,Lr).notify({query:this,type:"updated",action:e})})},hk);function wA(n,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pA(e.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function x1(n,e){return{data:n,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function E1(n){const e=typeof n.initialData=="function"?n.initialData():n.initialData,t=e!==void 0,r=t?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var vr,cn,qh,hr,Os,yc,qi,To,Hh,wc,Sc,Ns,Ls,Io,vc,mn,yl,pm,mm,ym,wm,Sm,vm,xm,SA,dk,Vx=(dk=class extends Uu{constructor(e,t){super();Ct(this,mn);Ct(this,vr);Ct(this,cn);Ct(this,qh);Ct(this,hr);Ct(this,Os);Ct(this,yc);Ct(this,qi);Ct(this,To);Ct(this,Hh);Ct(this,wc);Ct(this,Sc);Ct(this,Ns);Ct(this,Ls);Ct(this,Io);Ct(this,vc,new Set);this.options=t,ht(this,vr,e),ht(this,To,null),ht(this,qi,fm()),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(he(this,cn).addObserver(this),b1(he(this,cn),this.options)?Kt(this,mn,yl).call(this):this.updateResult(),Kt(this,mn,wm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Em(he(this,cn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Em(he(this,cn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Kt(this,mn,Sm).call(this),Kt(this,mn,vm).call(this),he(this,cn).removeObserver(this)}setOptions(e){const t=this.options,r=he(this,cn);if(this.options=he(this,vr).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof jr(this.options.enabled,he(this,cn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Kt(this,mn,xm).call(this),he(this,cn).setOptions(this.options),t._defaulted&&!Wd(this.options,t)&&he(this,vr).getQueryCache().notify({type:"observerOptionsUpdated",query:he(this,cn),observer:this});const i=this.hasListeners();i&&k1(he(this,cn),r,this.options,t)&&Kt(this,mn,yl).call(this),this.updateResult(),i&&(he(this,cn)!==r||jr(this.options.enabled,he(this,cn))!==jr(t.enabled,he(this,cn))||Uo(this.options.staleTime,he(this,cn))!==Uo(t.staleTime,he(this,cn)))&&Kt(this,mn,pm).call(this);const o=Kt(this,mn,mm).call(this);i&&(he(this,cn)!==r||jr(this.options.enabled,he(this,cn))!==jr(t.enabled,he(this,cn))||o!==he(this,Io))&&Kt(this,mn,ym).call(this,o)}getOptimisticResult(e){const t=he(this,vr).getQueryCache().build(he(this,vr),e),r=this.createResult(t,e);return J3(this,r)&&(ht(this,hr,r),ht(this,yc,this.options),ht(this,Os,he(this,cn).state)),r}getCurrentResult(){return he(this,hr)}trackResult(e,t){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),t==null||t(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&he(this,qi).status==="pending"&&he(this,qi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){he(this,vc).add(e)}getCurrentQuery(){return he(this,cn)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=he(this,vr).defaultQueryOptions(e),r=he(this,vr).getQueryCache().build(he(this,vr),t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return Kt(this,mn,yl).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),he(this,hr)))}createResult(e,t){var F;const r=he(this,cn),i=this.options,o=he(this,hr),s=he(this,Os),a=he(this,yc),c=e!==r?e.state:he(this,qh),{state:d}=e;let f={...d},m=!1,w;if(t._optimisticResults){const v=this.hasListeners(),O=!v&&b1(e,t),C=v&&k1(e,r,t,i);(O||C)&&(f={...f,...wA(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:k,errorUpdatedAt:I,status:x}=f;w=f.data;let T=!1;if(t.placeholderData!==void 0&&w===void 0&&x==="pending"){let v;o!=null&&o.isPlaceholderData&&t.placeholderData===(a==null?void 0:a.placeholderData)?(v=o.data,T=!0):v=typeof t.placeholderData=="function"?t.placeholderData((F=he(this,Sc))==null?void 0:F.state.data,he(this,Sc)):t.placeholderData,v!==void 0&&(x="success",w=dm(o==null?void 0:o.data,v,t),m=!0)}if(t.select&&w!==void 0&&!T)if(o&&w===(s==null?void 0:s.data)&&t.select===he(this,Hh))w=he(this,wc);else try{ht(this,Hh,t.select),w=t.select(w),w=dm(o==null?void 0:o.data,w,t),ht(this,wc,w),ht(this,To,null)}catch(v){ht(this,To,v)}he(this,To)&&(k=he(this,To),w=he(this,wc),I=Date.now(),x="error");const b=f.fetchStatus==="fetching",R=x==="pending",L=x==="error",G=R&&b,E=w!==void 0,p={status:x,fetchStatus:f.fetchStatus,isPending:R,isSuccess:x==="success",isError:L,isInitialLoading:G,isLoading:G,data:w,dataUpdatedAt:f.dataUpdatedAt,error:k,errorUpdatedAt:I,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!R,isLoadingError:L&&!E,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:L&&E,isStale:Ox(e,t),refetch:this.refetch,promise:he(this,qi),isEnabled:jr(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const v=p.data!==void 0,O=p.status==="error"&&!v,C=_=>{O?_.reject(p.error):v&&_.resolve(p.data)},V=()=>{const _=ht(this,qi,p.promise=fm());C(_)},H=he(this,qi);switch(H.status){case"pending":e.queryHash===r.queryHash&&C(H);break;case"fulfilled":(O||p.data!==H.value)&&V();break;case"rejected":(!O||p.error!==H.reason)&&V();break}}return p}updateResult(){const e=he(this,hr),t=this.createResult(he(this,cn),this.options);if(ht(this,Os,he(this,cn).state),ht(this,yc,this.options),he(this,Os).data!==void 0&&ht(this,Sc,he(this,cn)),Wd(t,e))return;ht(this,hr,t);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!he(this,vc).size)return!0;const s=new Set(o??he(this,vc));return this.options.throwOnError&&s.add("error"),Object.keys(he(this,hr)).some(a=>{const l=a;return he(this,hr)[l]!==e[l]&&s.has(l)})};Kt(this,mn,SA).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Kt(this,mn,wm).call(this)}},vr=new WeakMap,cn=new WeakMap,qh=new WeakMap,hr=new WeakMap,Os=new WeakMap,yc=new WeakMap,qi=new WeakMap,To=new WeakMap,Hh=new WeakMap,wc=new WeakMap,Sc=new WeakMap,Ns=new WeakMap,Ls=new WeakMap,Io=new WeakMap,vc=new WeakMap,mn=new WeakSet,yl=function(e){Kt(this,mn,xm).call(this);let t=he(this,cn).fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(dr)),t},pm=function(){Kt(this,mn,Sm).call(this);const e=Uo(this.options.staleTime,he(this,cn));if(Ys||he(this,hr).isStale||!lm(e))return;const r=dA(he(this,hr).dataUpdatedAt,e)+1;ht(this,Ns,ks.setTimeout(()=>{he(this,hr).isStale||this.updateResult()},r))},mm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(he(this,cn)):this.options.refetchInterval)??!1},ym=function(e){Kt(this,mn,vm).call(this),ht(this,Io,e),!(Ys||jr(this.options.enabled,he(this,cn))===!1||!lm(he(this,Io))||he(this,Io)===0)&&ht(this,Ls,ks.setInterval(()=>{(this.options.refetchIntervalInBackground||Bx.isFocused())&&Kt(this,mn,yl).call(this)},he(this,Io)))},wm=function(){Kt(this,mn,pm).call(this),Kt(this,mn,ym).call(this,Kt(this,mn,mm).call(this))},Sm=function(){he(this,Ns)&&(ks.clearTimeout(he(this,Ns)),ht(this,Ns,void 0))},vm=function(){he(this,Ls)&&(ks.clearInterval(he(this,Ls)),ht(this,Ls,void 0))},xm=function(){const e=he(this,vr).getQueryCache().build(he(this,vr),this.options);if(e===he(this,cn))return;const t=he(this,cn);ht(this,cn,e),ht(this,qh,e.state),this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))},SA=function(e){On.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(he(this,hr))}),he(this,vr).getQueryCache().notify({query:he(this,cn),type:"observerResultsUpdated"})})},dk);function W3(n,e){return jr(e.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&e.retryOnMount===!1)}function b1(n,e){return W3(n,e)||n.state.data!==void 0&&Em(n,e,e.refetchOnMount)}function Em(n,e,t){if(jr(e.enabled,n)!==!1&&Uo(e.staleTime,n)!=="static"){const r=typeof t=="function"?t(n):t;return r==="always"||r!==!1&&Ox(n,e)}return!1}function k1(n,e,t,r){return(n!==e||jr(r.enabled,n)===!1)&&(!t.suspense||n.state.status!=="error")&&Ox(n,t)}function Ox(n,e){return jr(e.enabled,n)!==!1&&n.isStaleByTime(Uo(e.staleTime,n))}function J3(n,e){return!Wd(n.getCurrentResult(),e)}function A1(n){return{onFetch:(e,t)=>{var d,f,m,w,k;const r=e.options,i=(m=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,o=((w=e.state.data)==null?void 0:w.pages)||[],s=((k=e.state.data)==null?void 0:k.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let I=!1;const x=R=>{j3(R,()=>e.signal,()=>I=!0)},T=fA(e.options,e.fetchOptions),b=async(R,L,G)=>{if(I)return Promise.reject();if(L==null&&R.pages.length)return Promise.resolve(R);const N=(()=>{const O={client:e.client,queryKey:e.queryKey,pageParam:L,direction:G?"backward":"forward",meta:e.options.meta};return x(O),O})(),p=await T(N),{maxPages:F}=e.options,v=G?U3:L3;return{pages:v(R.pages,p,F),pageParams:v(R.pageParams,L,F)}};if(i&&o.length){const R=i==="backward",L=R?Y3:D1,G={pages:o,pageParams:s},E=L(r,G);a=await b(G,E,R)}else{const R=n??o.length;do{const L=l===0?s[0]??r.initialPageParam:D1(r,a);if(l>0&&L==null)break;a=await b(a,L),l++}while(l<R)}return a};e.options.persister?e.fetchFn=()=>{var I,x;return(x=(I=e.options).persister)==null?void 0:x.call(I,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=c}}}function D1(n,{pages:e,pageParams:t}){const r=e.length-1;return e.length>0?n.getNextPageParam(e[r],e,t[r],t):void 0}function Y3(n,{pages:e,pageParams:t}){var r;return e.length>0?(r=n.getPreviousPageParam)==null?void 0:r.call(n,e[0],e,t[0],t):void 0}var Gh,yi,or,Us,wi,So,fk,X3=(fk=class extends yA{constructor(e){super();Ct(this,wi);Ct(this,Gh);Ct(this,yi);Ct(this,or);Ct(this,Us);ht(this,Gh,e.client),this.mutationId=e.mutationId,ht(this,or,e.mutationCache),ht(this,yi,[]),this.state=e.state||Q3(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){he(this,yi).includes(e)||(he(this,yi).push(e),this.clearGcTimeout(),he(this,or).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){ht(this,yi,he(this,yi).filter(t=>t!==e)),this.scheduleGc(),he(this,or).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){he(this,yi).length||(this.state.status==="pending"?this.scheduleGc():he(this,or).remove(this))}continue(){var e;return((e=he(this,Us))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var s,a,l,c,d,f,m,w,k,I,x,T,b,R,L,G,E,N;const t=()=>{Kt(this,wi,So).call(this,{type:"continue"})},r={client:he(this,Gh),meta:this.options.meta,mutationKey:this.options.mutationKey};ht(this,Us,mA({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(p,F)=>{Kt(this,wi,So).call(this,{type:"failed",failureCount:p,error:F})},onPause:()=>{Kt(this,wi,So).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>he(this,or).canRun(this)}));const i=this.state.status==="pending",o=!he(this,Us).canStart();try{if(i)t();else{Kt(this,wi,So).call(this,{type:"pending",variables:e,isPaused:o}),he(this,or).config.onMutate&&await he(this,or).config.onMutate(e,this,r);const F=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,e,r));F!==this.state.context&&Kt(this,wi,So).call(this,{type:"pending",context:F,variables:e,isPaused:o})}const p=await he(this,Us).start();return await((c=(l=he(this,or).config).onSuccess)==null?void 0:c.call(l,p,e,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,p,e,this.state.context,r)),await((w=(m=he(this,or).config).onSettled)==null?void 0:w.call(m,p,null,this.state.variables,this.state.context,this,r)),await((I=(k=this.options).onSettled)==null?void 0:I.call(k,p,null,e,this.state.context,r)),Kt(this,wi,So).call(this,{type:"success",data:p}),p}catch(p){try{await((T=(x=he(this,or).config).onError)==null?void 0:T.call(x,p,e,this.state.context,this,r))}catch(F){Promise.reject(F)}try{await((R=(b=this.options).onError)==null?void 0:R.call(b,p,e,this.state.context,r))}catch(F){Promise.reject(F)}try{await((G=(L=he(this,or).config).onSettled)==null?void 0:G.call(L,void 0,p,this.state.variables,this.state.context,this,r))}catch(F){Promise.reject(F)}try{await((N=(E=this.options).onSettled)==null?void 0:N.call(E,void 0,p,e,this.state.context,r))}catch(F){Promise.reject(F)}throw Kt(this,wi,So).call(this,{type:"error",error:p}),p}finally{he(this,or).runNext(this)}}},Gh=new WeakMap,yi=new WeakMap,or=new WeakMap,Us=new WeakMap,wi=new WeakSet,So=function(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),On.batch(()=>{he(this,yi).forEach(r=>{r.onMutationUpdate(e)}),he(this,or).notify({mutation:this,type:"updated",action:e})})},fk);function Q3(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Hi,ei,Kh,gk,Z3=(gk=class extends Uu{constructor(e={}){super();Ct(this,Hi);Ct(this,ei);Ct(this,Kh);this.config=e,ht(this,Hi,new Set),ht(this,ei,new Map),ht(this,Kh,0)}build(e,t,r){const i=new X3({client:e,mutationCache:this,mutationId:++sd(this,Kh)._,options:e.defaultMutationOptions(t),state:r});return this.add(i),i}add(e){he(this,Hi).add(e);const t=dd(e);if(typeof t=="string"){const r=he(this,ei).get(t);r?r.push(e):he(this,ei).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(he(this,Hi).delete(e)){const t=dd(e);if(typeof t=="string"){const r=he(this,ei).get(t);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&he(this,ei).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=dd(e);if(typeof t=="string"){const r=he(this,ei).get(t),i=r==null?void 0:r.find(o=>o.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const t=dd(e);if(typeof t=="string"){const i=(r=he(this,ei).get(t))==null?void 0:r.find(o=>o!==e&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){On.batch(()=>{he(this,Hi).forEach(e=>{this.notify({type:"removed",mutation:e})}),he(this,Hi).clear(),he(this,ei).clear()})}getAll(){return Array.from(he(this,Hi))}find(e){const t={exact:!0,...e};return this.getAll().find(r=>w1(t,r))}findAll(e={}){return this.getAll().filter(t=>w1(e,t))}notify(e){On.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return On.batch(()=>Promise.all(e.map(t=>t.continue().catch(dr))))}},Hi=new WeakMap,ei=new WeakMap,Kh=new WeakMap,gk);function dd(n){var e;return(e=n.options.scope)==null?void 0:e.id}function F1(n,e){const t=new Set(e);return n.filter(r=>!t.has(r))}function eM(n,e,t){const r=n.slice(0);return r[e]=t,r}var js,Tr,xc,Ec,Ur,Mo,Wh,Jh,Yh,Xh,nr,bm,km,Am,Dm,Fm,pk,tM=(pk=class extends Uu{constructor(e,t,r){super();Ct(this,nr);Ct(this,js);Ct(this,Tr);Ct(this,xc);Ct(this,Ec);Ct(this,Ur);Ct(this,Mo);Ct(this,Wh);Ct(this,Jh);Ct(this,Yh);Ct(this,Xh,[]);ht(this,js,e),ht(this,Ec,r),ht(this,xc,[]),ht(this,Ur,[]),ht(this,Tr,[]),this.setQueries(t)}onSubscribe(){this.listeners.size===1&&he(this,Ur).forEach(e=>{e.subscribe(t=>{Kt(this,nr,Dm).call(this,e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,he(this,Ur).forEach(e=>{e.destroy()})}setQueries(e,t){if(ht(this,xc,e),ht(this,Ec,t),process.env.NODE_ENV!=="production"){const r=e.map(i=>he(this,js).defaultQueryOptions(i).queryHash);new Set(r).size!==r.length&&console.warn("[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.")}On.batch(()=>{const r=he(this,Ur),i=Kt(this,nr,Am).call(this,he(this,xc));i.forEach(f=>f.observer.setOptions(f.defaultedQueryOptions));const o=i.map(f=>f.observer),s=o.map(f=>f.getCurrentResult()),a=r.length!==o.length,l=o.some((f,m)=>f!==r[m]),c=a||l,d=c?!0:s.some((f,m)=>{const w=he(this,Tr)[m];return!w||!Wd(f,w)});!c&&!d||(c&&(ht(this,Xh,i),ht(this,Ur,o)),ht(this,Tr,s),this.hasListeners()&&(c&&(F1(r,o).forEach(f=>{f.destroy()}),F1(o,r).forEach(f=>{f.subscribe(m=>{Kt(this,nr,Dm).call(this,f,m)})})),Kt(this,nr,Fm).call(this)))})}getCurrentResult(){return he(this,Tr)}getQueries(){return he(this,Ur).map(e=>e.getCurrentQuery())}getObservers(){return he(this,Ur)}getOptimisticResult(e,t){const r=Kt(this,nr,Am).call(this,e),i=r.map(s=>s.observer.getOptimisticResult(s.defaultedQueryOptions)),o=r.map(s=>s.defaultedQueryOptions.queryHash);return[i,s=>Kt(this,nr,km).call(this,s??i,t,o),()=>Kt(this,nr,bm).call(this,i,r)]}},js=new WeakMap,Tr=new WeakMap,xc=new WeakMap,Ec=new WeakMap,Ur=new WeakMap,Mo=new WeakMap,Wh=new WeakMap,Jh=new WeakMap,Yh=new WeakMap,Xh=new WeakMap,nr=new WeakSet,bm=function(e,t){return t.map((r,i)=>{const o=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?o:r.observer.trackResult(o,s=>{t.forEach(a=>{a.observer.trackProp(s)})})})},km=function(e,t,r){if(t){const i=he(this,Yh),o=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((s,a)=>s!==i[a]));return(!he(this,Mo)||he(this,Tr)!==he(this,Jh)||o||t!==he(this,Wh))&&(ht(this,Wh,t),ht(this,Jh,he(this,Tr)),r!==void 0&&ht(this,Yh,r),ht(this,Mo,Kd(he(this,Mo),t(e)))),he(this,Mo)}return e},Am=function(e){const t=new Map;he(this,Ur).forEach(i=>{const o=i.options.queryHash;if(!o)return;const s=t.get(o);s?s.push(i):t.set(o,[i])});const r=[];return e.forEach(i=>{var l;const o=he(this,js).defaultQueryOptions(i),a=((l=t.get(o.queryHash))==null?void 0:l.shift())??new Vx(he(this,js),o);r.push({defaultedQueryOptions:o,observer:a})}),r},Dm=function(e,t){const r=he(this,Ur).indexOf(e);r!==-1&&(ht(this,Tr,eM(he(this,Tr),r,t)),Kt(this,nr,Fm).call(this))},Fm=function(){var e;if(this.hasListeners()){const t=he(this,Mo),r=Kt(this,nr,bm).call(this,he(this,Tr),he(this,Xh)),i=Kt(this,nr,km).call(this,r,(e=he(this,Ec))==null?void 0:e.combine);t!==i&&On.batch(()=>{this.listeners.forEach(o=>{o(he(this,Tr))})})}},pk),Si,mk,nM=(mk=class extends Uu{constructor(e={}){super();Ct(this,Si);this.config=e,ht(this,Si,new Map)}build(e,t,r){const i=t.queryKey,o=t.queryHash??$x(i,t);let s=this.get(o);return s||(s=new K3({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){he(this,Si).has(e.queryHash)||(he(this,Si).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=he(this,Si).get(e.queryHash);t&&(e.destroy(),t===e&&he(this,Si).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){On.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return he(this,Si).get(e)}getAll(){return[...he(this,Si).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>y1(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>y1(e,r)):t}notify(e){On.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){On.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){On.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Si=new WeakMap,mk),In,Ro,Co,bc,kc,Po,Ac,Dc,yk,rM=(yk=class{constructor(n={}){Ct(this,In);Ct(this,Ro);Ct(this,Co);Ct(this,bc);Ct(this,kc);Ct(this,Po);Ct(this,Ac);Ct(this,Dc);ht(this,In,n.queryCache||new nM),ht(this,Ro,n.mutationCache||new Z3),ht(this,Co,n.defaultOptions||{}),ht(this,bc,new Map),ht(this,kc,new Map),ht(this,Po,0)}mount(){sd(this,Po)._++,he(this,Po)===1&&(ht(this,Ac,Bx.subscribe(async n=>{n&&(await this.resumePausedMutations(),he(this,In).onFocus())})),ht(this,Dc,Yd.subscribe(async n=>{n&&(await this.resumePausedMutations(),he(this,In).onOnline())})))}unmount(){var n,e;sd(this,Po)._--,he(this,Po)===0&&((n=he(this,Ac))==null||n.call(this),ht(this,Ac,void 0),(e=he(this,Dc))==null||e.call(this),ht(this,Dc,void 0))}isFetching(n){return he(this,In).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return he(this,Ro).findAll({...n,status:"pending"}).length}getQueryData(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=he(this,In).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(n){const e=this.defaultQueryOptions(n),t=he(this,In).build(this,e),r=t.state.data;return r===void 0?this.fetchQuery(n):(n.revalidateIfStale&&t.isStaleByTime(Uo(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(n){return he(this,In).findAll(n).map(({queryKey:e,state:t})=>{const r=t.data;return[e,r]})}setQueryData(n,e,t){const r=this.defaultQueryOptions({queryKey:n}),i=he(this,In).get(r.queryHash),o=i==null?void 0:i.state.data,s=V3(e,o);if(s!==void 0)return he(this,In).build(this,r).setData(s,{...t,manual:!0})}setQueriesData(n,e,t){return On.batch(()=>he(this,In).findAll(n).map(({queryKey:r})=>[r,this.setQueryData(r,e,t)]))}getQueryState(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=he(this,In).get(e.queryHash))==null?void 0:t.state}removeQueries(n){const e=he(this,In);On.batch(()=>{e.findAll(n).forEach(t=>{e.remove(t)})})}resetQueries(n,e){const t=he(this,In);return On.batch(()=>(t.findAll(n).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...n},e)))}cancelQueries(n,e={}){const t={revert:!0,...e},r=On.batch(()=>he(this,In).findAll(n).map(i=>i.cancel(t)));return Promise.all(r).then(dr).catch(dr)}invalidateQueries(n,e={}){return On.batch(()=>(he(this,In).findAll(n).forEach(t=>{t.invalidate()}),(n==null?void 0:n.refetchType)==="none"?Promise.resolve():this.refetchQueries({...n,type:(n==null?void 0:n.refetchType)??(n==null?void 0:n.type)??"active"},e)))}refetchQueries(n,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},r=On.batch(()=>he(this,In).findAll(n).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,t);return t.throwOnError||(o=o.catch(dr)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(dr)}fetchQuery(n){const e=this.defaultQueryOptions(n);e.retry===void 0&&(e.retry=!1);const t=he(this,In).build(this,e);return t.isStaleByTime(Uo(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(dr).catch(dr)}fetchInfiniteQuery(n){return n.behavior=A1(n.pages),this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(dr).catch(dr)}ensureInfiniteQueryData(n){return n.behavior=A1(n.pages),this.ensureQueryData(n)}resumePausedMutations(){return Yd.isOnline()?he(this,Ro).resumePausedMutations():Promise.resolve()}getQueryCache(){return he(this,In)}getMutationCache(){return he(this,Ro)}getDefaultOptions(){return he(this,Co)}setDefaultOptions(n){ht(this,Co,n)}setQueryDefaults(n,e){he(this,bc).set(Ll(n),{queryKey:n,defaultOptions:e})}getQueryDefaults(n){const e=[...he(this,bc).values()],t={};return e.forEach(r=>{Ul(n,r.queryKey)&&Object.assign(t,r.defaultOptions)}),t}setMutationDefaults(n,e){he(this,kc).set(Ll(n),{mutationKey:n,defaultOptions:e})}getMutationDefaults(n){const e=[...he(this,kc).values()],t={};return e.forEach(r=>{Ul(n,r.mutationKey)&&Object.assign(t,r.defaultOptions)}),t}defaultQueryOptions(n){if(n._defaulted)return n;const e={...he(this,Co).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return e.queryHash||(e.queryHash=$x(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Jd&&(e.enabled=!1),e}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...he(this,Co).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){he(this,In).clear(),he(this,Ro).clear()}},In=new WeakMap,Ro=new WeakMap,Co=new WeakMap,bc=new WeakMap,kc=new WeakMap,Po=new WeakMap,Ac=new WeakMap,Dc=new WeakMap,yk),vA=Me.createContext(void 0),Nx=n=>{const e=Me.useContext(vA);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},xA=({client:n,children:e})=>(Me.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),K.jsx(vA.Provider,{value:n,children:e})),iM=Me.createContext(!1),EA=()=>Me.useContext(iM);function oM(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var sM=Me.createContext(oM()),bA=()=>Me.useContext(sM),kA=(n,e,t)=>{const r=t!=null&&t.state.error&&typeof n.throwOnError=="function"?gA(n.throwOnError,[t.state.error,t]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||r)&&(e.isReset()||(n.retryOnMount=!1))},AA=n=>{Me.useEffect(()=>{n.clearReset()},[n])},DA=({result:n,errorResetBoundary:e,throwOnError:t,query:r,suspense:i})=>n.isError&&!e.isReset()&&!n.isFetching&&r&&(i&&n.data===void 0||gA(t,[n.error,r])),FA=n=>{if(n.suspense){const t=i=>i==="static"?i:Math.max(i??1e3,1e3),r=n.staleTime;n.staleTime=typeof r=="function"?(...i)=>t(r(...i)):t(r),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},aM=(n,e)=>n.isLoading&&n.isFetching&&!e,Tm=(n,e)=>(n==null?void 0:n.suspense)&&e.isPending,Im=(n,e,t)=>e.fetchOptimistic(n).catch(()=>{t.clearReset()});function cM({queries:n,...e},t){const r=Nx(),i=EA(),o=bA(),s=Me.useMemo(()=>n.map(I=>{const x=r.defaultQueryOptions(I);return x._optimisticResults=i?"isRestoring":"optimistic",x}),[n,r,i]);s.forEach(I=>{FA(I);const x=r.getQueryCache().get(I.queryHash);kA(I,o,x)}),AA(o);const[a]=Me.useState(()=>new tM(r,s,e)),[l,c,d]=a.getOptimisticResult(s,e.combine),f=!i&&e.subscribed!==!1;Me.useSyncExternalStore(Me.useCallback(I=>f?a.subscribe(On.batchCalls(I)):dr,[a,f]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),Me.useEffect(()=>{a.setQueries(s,e)},[s,e,a]);const w=l.some((I,x)=>Tm(s[x],I))?l.flatMap((I,x)=>{const T=s[x];if(T&&Tm(T,I)){const b=new Vx(r,T);return Im(T,b,o)}return[]}):[];if(w.length>0)throw Promise.all(w);const k=l.find((I,x)=>{const T=s[x];return T&&DA({result:I,errorResetBoundary:o,throwOnError:T.throwOnError,query:r.getQueryCache().get(T.queryHash),suspense:T.suspense})});if(k!=null&&k.error)throw k.error;return c(d())}function uM(n,e,t){var m,w,k,I;if(process.env.NODE_ENV!=="production"&&(typeof n!="object"||Array.isArray(n)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=EA(),i=bA(),o=Nx(),s=o.defaultQueryOptions(n);(w=(m=o.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||w.call(m,s);const a=o.getQueryCache().get(s.queryHash);process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=r?"isRestoring":"optimistic",FA(s),kA(s,i,a),AA(i);const l=!o.getQueryCache().get(s.queryHash),[c]=Me.useState(()=>new e(o,s)),d=c.getOptimisticResult(s),f=!r&&n.subscribed!==!1;if(Me.useSyncExternalStore(Me.useCallback(x=>{const T=f?c.subscribe(On.batchCalls(x)):dr;return c.updateResult(),T},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),Me.useEffect(()=>{c.setOptions(s)},[s,c]),Tm(s,d))throw Im(s,c,i);if(DA({result:d,errorResetBoundary:i,throwOnError:s.throwOnError,query:a,suspense:s.suspense}))throw d.error;if((I=(k=o.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||I.call(k,s,d),s.experimental_prefetchInRender&&!Ys&&aM(d,r)){const x=l?Im(s,c,i):a==null?void 0:a.promise;x==null||x.catch(dr).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?d:c.trackResult(d)}function Lx(n,e){return uM(n,Vx)}var $f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function lM(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}function TA(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var hp={exports:{}};const hM={},dM=Object.freeze(Object.defineProperty({__proto__:null,default:hM},Symbol.toStringTag,{value:"Module"})),IA=lM(dM);var T1;function fM(){return T1||(T1=1,(function(n){(function(e){var t=function(h){var S,y=new Float64Array(16);if(h)for(S=0;S<h.length;S++)y[S]=h[S];return y},r=function(){throw new Error("no PRNG")},i=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),a=t([1]),l=t([56129,1]),c=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),f=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),m=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),w=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function k(h,S,y,u){h[S]=y>>24&255,h[S+1]=y>>16&255,h[S+2]=y>>8&255,h[S+3]=y&255,h[S+4]=u>>24&255,h[S+5]=u>>16&255,h[S+6]=u>>8&255,h[S+7]=u&255}function I(h,S,y,u,D){var Z,ne=0;for(Z=0;Z<D;Z++)ne|=h[S+Z]^y[u+Z];return(1&ne-1>>>8)-1}function x(h,S,y,u){return I(h,S,y,u,16)}function T(h,S,y,u){return I(h,S,y,u,32)}function b(h,S,y,u){for(var D=u[0]&255|(u[1]&255)<<8|(u[2]&255)<<16|(u[3]&255)<<24,Z=y[0]&255|(y[1]&255)<<8|(y[2]&255)<<16|(y[3]&255)<<24,ne=y[4]&255|(y[5]&255)<<8|(y[6]&255)<<16|(y[7]&255)<<24,pe=y[8]&255|(y[9]&255)<<8|(y[10]&255)<<16|(y[11]&255)<<24,Fe=y[12]&255|(y[13]&255)<<8|(y[14]&255)<<16|(y[15]&255)<<24,ze=u[4]&255|(u[5]&255)<<8|(u[6]&255)<<16|(u[7]&255)<<24,$e=S[0]&255|(S[1]&255)<<8|(S[2]&255)<<16|(S[3]&255)<<24,kt=S[4]&255|(S[5]&255)<<8|(S[6]&255)<<16|(S[7]&255)<<24,Oe=S[8]&255|(S[9]&255)<<8|(S[10]&255)<<16|(S[11]&255)<<24,nt=S[12]&255|(S[13]&255)<<8|(S[14]&255)<<16|(S[15]&255)<<24,rt=u[8]&255|(u[9]&255)<<8|(u[10]&255)<<16|(u[11]&255)<<24,dt=y[16]&255|(y[17]&255)<<8|(y[18]&255)<<16|(y[19]&255)<<24,ct=y[20]&255|(y[21]&255)<<8|(y[22]&255)<<16|(y[23]&255)<<24,it=y[24]&255|(y[25]&255)<<8|(y[26]&255)<<16|(y[27]&255)<<24,st=y[28]&255|(y[29]&255)<<8|(y[30]&255)<<16|(y[31]&255)<<24,ot=u[12]&255|(u[13]&255)<<8|(u[14]&255)<<16|(u[15]&255)<<24,Ue=D,Ge=Z,Be=ne,je=pe,_e=Fe,Re=ze,se=$e,ae=kt,we=Oe,ge=nt,me=rt,Ae=dt,Qe=ct,ft=it,pt=st,gt=ot,P,yt=0;yt<20;yt+=2)P=Ue+Qe|0,_e^=P<<7|P>>>25,P=_e+Ue|0,we^=P<<9|P>>>23,P=we+_e|0,Qe^=P<<13|P>>>19,P=Qe+we|0,Ue^=P<<18|P>>>14,P=Re+Ge|0,ge^=P<<7|P>>>25,P=ge+Re|0,ft^=P<<9|P>>>23,P=ft+ge|0,Ge^=P<<13|P>>>19,P=Ge+ft|0,Re^=P<<18|P>>>14,P=me+se|0,pt^=P<<7|P>>>25,P=pt+me|0,Be^=P<<9|P>>>23,P=Be+pt|0,se^=P<<13|P>>>19,P=se+Be|0,me^=P<<18|P>>>14,P=gt+Ae|0,je^=P<<7|P>>>25,P=je+gt|0,ae^=P<<9|P>>>23,P=ae+je|0,Ae^=P<<13|P>>>19,P=Ae+ae|0,gt^=P<<18|P>>>14,P=Ue+je|0,Ge^=P<<7|P>>>25,P=Ge+Ue|0,Be^=P<<9|P>>>23,P=Be+Ge|0,je^=P<<13|P>>>19,P=je+Be|0,Ue^=P<<18|P>>>14,P=Re+_e|0,se^=P<<7|P>>>25,P=se+Re|0,ae^=P<<9|P>>>23,P=ae+se|0,_e^=P<<13|P>>>19,P=_e+ae|0,Re^=P<<18|P>>>14,P=me+ge|0,Ae^=P<<7|P>>>25,P=Ae+me|0,we^=P<<9|P>>>23,P=we+Ae|0,ge^=P<<13|P>>>19,P=ge+we|0,me^=P<<18|P>>>14,P=gt+pt|0,Qe^=P<<7|P>>>25,P=Qe+gt|0,ft^=P<<9|P>>>23,P=ft+Qe|0,pt^=P<<13|P>>>19,P=pt+ft|0,gt^=P<<18|P>>>14;Ue=Ue+D|0,Ge=Ge+Z|0,Be=Be+ne|0,je=je+pe|0,_e=_e+Fe|0,Re=Re+ze|0,se=se+$e|0,ae=ae+kt|0,we=we+Oe|0,ge=ge+nt|0,me=me+rt|0,Ae=Ae+dt|0,Qe=Qe+ct|0,ft=ft+it|0,pt=pt+st|0,gt=gt+ot|0,h[0]=Ue>>>0&255,h[1]=Ue>>>8&255,h[2]=Ue>>>16&255,h[3]=Ue>>>24&255,h[4]=Ge>>>0&255,h[5]=Ge>>>8&255,h[6]=Ge>>>16&255,h[7]=Ge>>>24&255,h[8]=Be>>>0&255,h[9]=Be>>>8&255,h[10]=Be>>>16&255,h[11]=Be>>>24&255,h[12]=je>>>0&255,h[13]=je>>>8&255,h[14]=je>>>16&255,h[15]=je>>>24&255,h[16]=_e>>>0&255,h[17]=_e>>>8&255,h[18]=_e>>>16&255,h[19]=_e>>>24&255,h[20]=Re>>>0&255,h[21]=Re>>>8&255,h[22]=Re>>>16&255,h[23]=Re>>>24&255,h[24]=se>>>0&255,h[25]=se>>>8&255,h[26]=se>>>16&255,h[27]=se>>>24&255,h[28]=ae>>>0&255,h[29]=ae>>>8&255,h[30]=ae>>>16&255,h[31]=ae>>>24&255,h[32]=we>>>0&255,h[33]=we>>>8&255,h[34]=we>>>16&255,h[35]=we>>>24&255,h[36]=ge>>>0&255,h[37]=ge>>>8&255,h[38]=ge>>>16&255,h[39]=ge>>>24&255,h[40]=me>>>0&255,h[41]=me>>>8&255,h[42]=me>>>16&255,h[43]=me>>>24&255,h[44]=Ae>>>0&255,h[45]=Ae>>>8&255,h[46]=Ae>>>16&255,h[47]=Ae>>>24&255,h[48]=Qe>>>0&255,h[49]=Qe>>>8&255,h[50]=Qe>>>16&255,h[51]=Qe>>>24&255,h[52]=ft>>>0&255,h[53]=ft>>>8&255,h[54]=ft>>>16&255,h[55]=ft>>>24&255,h[56]=pt>>>0&255,h[57]=pt>>>8&255,h[58]=pt>>>16&255,h[59]=pt>>>24&255,h[60]=gt>>>0&255,h[61]=gt>>>8&255,h[62]=gt>>>16&255,h[63]=gt>>>24&255}function R(h,S,y,u){for(var D=u[0]&255|(u[1]&255)<<8|(u[2]&255)<<16|(u[3]&255)<<24,Z=y[0]&255|(y[1]&255)<<8|(y[2]&255)<<16|(y[3]&255)<<24,ne=y[4]&255|(y[5]&255)<<8|(y[6]&255)<<16|(y[7]&255)<<24,pe=y[8]&255|(y[9]&255)<<8|(y[10]&255)<<16|(y[11]&255)<<24,Fe=y[12]&255|(y[13]&255)<<8|(y[14]&255)<<16|(y[15]&255)<<24,ze=u[4]&255|(u[5]&255)<<8|(u[6]&255)<<16|(u[7]&255)<<24,$e=S[0]&255|(S[1]&255)<<8|(S[2]&255)<<16|(S[3]&255)<<24,kt=S[4]&255|(S[5]&255)<<8|(S[6]&255)<<16|(S[7]&255)<<24,Oe=S[8]&255|(S[9]&255)<<8|(S[10]&255)<<16|(S[11]&255)<<24,nt=S[12]&255|(S[13]&255)<<8|(S[14]&255)<<16|(S[15]&255)<<24,rt=u[8]&255|(u[9]&255)<<8|(u[10]&255)<<16|(u[11]&255)<<24,dt=y[16]&255|(y[17]&255)<<8|(y[18]&255)<<16|(y[19]&255)<<24,ct=y[20]&255|(y[21]&255)<<8|(y[22]&255)<<16|(y[23]&255)<<24,it=y[24]&255|(y[25]&255)<<8|(y[26]&255)<<16|(y[27]&255)<<24,st=y[28]&255|(y[29]&255)<<8|(y[30]&255)<<16|(y[31]&255)<<24,ot=u[12]&255|(u[13]&255)<<8|(u[14]&255)<<16|(u[15]&255)<<24,Ue=D,Ge=Z,Be=ne,je=pe,_e=Fe,Re=ze,se=$e,ae=kt,we=Oe,ge=nt,me=rt,Ae=dt,Qe=ct,ft=it,pt=st,gt=ot,P,yt=0;yt<20;yt+=2)P=Ue+Qe|0,_e^=P<<7|P>>>25,P=_e+Ue|0,we^=P<<9|P>>>23,P=we+_e|0,Qe^=P<<13|P>>>19,P=Qe+we|0,Ue^=P<<18|P>>>14,P=Re+Ge|0,ge^=P<<7|P>>>25,P=ge+Re|0,ft^=P<<9|P>>>23,P=ft+ge|0,Ge^=P<<13|P>>>19,P=Ge+ft|0,Re^=P<<18|P>>>14,P=me+se|0,pt^=P<<7|P>>>25,P=pt+me|0,Be^=P<<9|P>>>23,P=Be+pt|0,se^=P<<13|P>>>19,P=se+Be|0,me^=P<<18|P>>>14,P=gt+Ae|0,je^=P<<7|P>>>25,P=je+gt|0,ae^=P<<9|P>>>23,P=ae+je|0,Ae^=P<<13|P>>>19,P=Ae+ae|0,gt^=P<<18|P>>>14,P=Ue+je|0,Ge^=P<<7|P>>>25,P=Ge+Ue|0,Be^=P<<9|P>>>23,P=Be+Ge|0,je^=P<<13|P>>>19,P=je+Be|0,Ue^=P<<18|P>>>14,P=Re+_e|0,se^=P<<7|P>>>25,P=se+Re|0,ae^=P<<9|P>>>23,P=ae+se|0,_e^=P<<13|P>>>19,P=_e+ae|0,Re^=P<<18|P>>>14,P=me+ge|0,Ae^=P<<7|P>>>25,P=Ae+me|0,we^=P<<9|P>>>23,P=we+Ae|0,ge^=P<<13|P>>>19,P=ge+we|0,me^=P<<18|P>>>14,P=gt+pt|0,Qe^=P<<7|P>>>25,P=Qe+gt|0,ft^=P<<9|P>>>23,P=ft+Qe|0,pt^=P<<13|P>>>19,P=pt+ft|0,gt^=P<<18|P>>>14;h[0]=Ue>>>0&255,h[1]=Ue>>>8&255,h[2]=Ue>>>16&255,h[3]=Ue>>>24&255,h[4]=Re>>>0&255,h[5]=Re>>>8&255,h[6]=Re>>>16&255,h[7]=Re>>>24&255,h[8]=me>>>0&255,h[9]=me>>>8&255,h[10]=me>>>16&255,h[11]=me>>>24&255,h[12]=gt>>>0&255,h[13]=gt>>>8&255,h[14]=gt>>>16&255,h[15]=gt>>>24&255,h[16]=se>>>0&255,h[17]=se>>>8&255,h[18]=se>>>16&255,h[19]=se>>>24&255,h[20]=ae>>>0&255,h[21]=ae>>>8&255,h[22]=ae>>>16&255,h[23]=ae>>>24&255,h[24]=we>>>0&255,h[25]=we>>>8&255,h[26]=we>>>16&255,h[27]=we>>>24&255,h[28]=ge>>>0&255,h[29]=ge>>>8&255,h[30]=ge>>>16&255,h[31]=ge>>>24&255}function L(h,S,y,u){b(h,S,y,u)}function G(h,S,y,u){R(h,S,y,u)}var E=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function N(h,S,y,u,D,Z,ne){var pe=new Uint8Array(16),Fe=new Uint8Array(64),ze,$e;for($e=0;$e<16;$e++)pe[$e]=0;for($e=0;$e<8;$e++)pe[$e]=Z[$e];for(;D>=64;){for(L(Fe,pe,ne,E),$e=0;$e<64;$e++)h[S+$e]=y[u+$e]^Fe[$e];for(ze=1,$e=8;$e<16;$e++)ze=ze+(pe[$e]&255)|0,pe[$e]=ze&255,ze>>>=8;D-=64,S+=64,u+=64}if(D>0)for(L(Fe,pe,ne,E),$e=0;$e<D;$e++)h[S+$e]=y[u+$e]^Fe[$e];return 0}function p(h,S,y,u,D){var Z=new Uint8Array(16),ne=new Uint8Array(64),pe,Fe;for(Fe=0;Fe<16;Fe++)Z[Fe]=0;for(Fe=0;Fe<8;Fe++)Z[Fe]=u[Fe];for(;y>=64;){for(L(ne,Z,D,E),Fe=0;Fe<64;Fe++)h[S+Fe]=ne[Fe];for(pe=1,Fe=8;Fe<16;Fe++)pe=pe+(Z[Fe]&255)|0,Z[Fe]=pe&255,pe>>>=8;y-=64,S+=64}if(y>0)for(L(ne,Z,D,E),Fe=0;Fe<y;Fe++)h[S+Fe]=ne[Fe];return 0}function F(h,S,y,u,D){var Z=new Uint8Array(32);G(Z,u,D,E);for(var ne=new Uint8Array(8),pe=0;pe<8;pe++)ne[pe]=u[pe+16];return p(h,S,y,ne,Z)}function v(h,S,y,u,D,Z,ne){var pe=new Uint8Array(32);G(pe,Z,ne,E);for(var Fe=new Uint8Array(8),ze=0;ze<8;ze++)Fe[ze]=Z[ze+16];return N(h,S,y,u,D,Fe,pe)}var O=function(h){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var S,y,u,D,Z,ne,pe,Fe;S=h[0]&255|(h[1]&255)<<8,this.r[0]=S&8191,y=h[2]&255|(h[3]&255)<<8,this.r[1]=(S>>>13|y<<3)&8191,u=h[4]&255|(h[5]&255)<<8,this.r[2]=(y>>>10|u<<6)&7939,D=h[6]&255|(h[7]&255)<<8,this.r[3]=(u>>>7|D<<9)&8191,Z=h[8]&255|(h[9]&255)<<8,this.r[4]=(D>>>4|Z<<12)&255,this.r[5]=Z>>>1&8190,ne=h[10]&255|(h[11]&255)<<8,this.r[6]=(Z>>>14|ne<<2)&8191,pe=h[12]&255|(h[13]&255)<<8,this.r[7]=(ne>>>11|pe<<5)&8065,Fe=h[14]&255|(h[15]&255)<<8,this.r[8]=(pe>>>8|Fe<<8)&8191,this.r[9]=Fe>>>5&127,this.pad[0]=h[16]&255|(h[17]&255)<<8,this.pad[1]=h[18]&255|(h[19]&255)<<8,this.pad[2]=h[20]&255|(h[21]&255)<<8,this.pad[3]=h[22]&255|(h[23]&255)<<8,this.pad[4]=h[24]&255|(h[25]&255)<<8,this.pad[5]=h[26]&255|(h[27]&255)<<8,this.pad[6]=h[28]&255|(h[29]&255)<<8,this.pad[7]=h[30]&255|(h[31]&255)<<8};O.prototype.blocks=function(h,S,y){for(var u=this.fin?0:2048,D,Z,ne,pe,Fe,ze,$e,kt,Oe,nt,rt,dt,ct,it,st,ot,Ue,Ge,Be,je=this.h[0],_e=this.h[1],Re=this.h[2],se=this.h[3],ae=this.h[4],we=this.h[5],ge=this.h[6],me=this.h[7],Ae=this.h[8],Qe=this.h[9],ft=this.r[0],pt=this.r[1],gt=this.r[2],P=this.r[3],yt=this.r[4],At=this.r[5],Dt=this.r[6],mt=this.r[7],Et=this.r[8],bt=this.r[9];y>=16;)D=h[S+0]&255|(h[S+1]&255)<<8,je+=D&8191,Z=h[S+2]&255|(h[S+3]&255)<<8,_e+=(D>>>13|Z<<3)&8191,ne=h[S+4]&255|(h[S+5]&255)<<8,Re+=(Z>>>10|ne<<6)&8191,pe=h[S+6]&255|(h[S+7]&255)<<8,se+=(ne>>>7|pe<<9)&8191,Fe=h[S+8]&255|(h[S+9]&255)<<8,ae+=(pe>>>4|Fe<<12)&8191,we+=Fe>>>1&8191,ze=h[S+10]&255|(h[S+11]&255)<<8,ge+=(Fe>>>14|ze<<2)&8191,$e=h[S+12]&255|(h[S+13]&255)<<8,me+=(ze>>>11|$e<<5)&8191,kt=h[S+14]&255|(h[S+15]&255)<<8,Ae+=($e>>>8|kt<<8)&8191,Qe+=kt>>>5|u,Oe=0,nt=Oe,nt+=je*ft,nt+=_e*(5*bt),nt+=Re*(5*Et),nt+=se*(5*mt),nt+=ae*(5*Dt),Oe=nt>>>13,nt&=8191,nt+=we*(5*At),nt+=ge*(5*yt),nt+=me*(5*P),nt+=Ae*(5*gt),nt+=Qe*(5*pt),Oe+=nt>>>13,nt&=8191,rt=Oe,rt+=je*pt,rt+=_e*ft,rt+=Re*(5*bt),rt+=se*(5*Et),rt+=ae*(5*mt),Oe=rt>>>13,rt&=8191,rt+=we*(5*Dt),rt+=ge*(5*At),rt+=me*(5*yt),rt+=Ae*(5*P),rt+=Qe*(5*gt),Oe+=rt>>>13,rt&=8191,dt=Oe,dt+=je*gt,dt+=_e*pt,dt+=Re*ft,dt+=se*(5*bt),dt+=ae*(5*Et),Oe=dt>>>13,dt&=8191,dt+=we*(5*mt),dt+=ge*(5*Dt),dt+=me*(5*At),dt+=Ae*(5*yt),dt+=Qe*(5*P),Oe+=dt>>>13,dt&=8191,ct=Oe,ct+=je*P,ct+=_e*gt,ct+=Re*pt,ct+=se*ft,ct+=ae*(5*bt),Oe=ct>>>13,ct&=8191,ct+=we*(5*Et),ct+=ge*(5*mt),ct+=me*(5*Dt),ct+=Ae*(5*At),ct+=Qe*(5*yt),Oe+=ct>>>13,ct&=8191,it=Oe,it+=je*yt,it+=_e*P,it+=Re*gt,it+=se*pt,it+=ae*ft,Oe=it>>>13,it&=8191,it+=we*(5*bt),it+=ge*(5*Et),it+=me*(5*mt),it+=Ae*(5*Dt),it+=Qe*(5*At),Oe+=it>>>13,it&=8191,st=Oe,st+=je*At,st+=_e*yt,st+=Re*P,st+=se*gt,st+=ae*pt,Oe=st>>>13,st&=8191,st+=we*ft,st+=ge*(5*bt),st+=me*(5*Et),st+=Ae*(5*mt),st+=Qe*(5*Dt),Oe+=st>>>13,st&=8191,ot=Oe,ot+=je*Dt,ot+=_e*At,ot+=Re*yt,ot+=se*P,ot+=ae*gt,Oe=ot>>>13,ot&=8191,ot+=we*pt,ot+=ge*ft,ot+=me*(5*bt),ot+=Ae*(5*Et),ot+=Qe*(5*mt),Oe+=ot>>>13,ot&=8191,Ue=Oe,Ue+=je*mt,Ue+=_e*Dt,Ue+=Re*At,Ue+=se*yt,Ue+=ae*P,Oe=Ue>>>13,Ue&=8191,Ue+=we*gt,Ue+=ge*pt,Ue+=me*ft,Ue+=Ae*(5*bt),Ue+=Qe*(5*Et),Oe+=Ue>>>13,Ue&=8191,Ge=Oe,Ge+=je*Et,Ge+=_e*mt,Ge+=Re*Dt,Ge+=se*At,Ge+=ae*yt,Oe=Ge>>>13,Ge&=8191,Ge+=we*P,Ge+=ge*gt,Ge+=me*pt,Ge+=Ae*ft,Ge+=Qe*(5*bt),Oe+=Ge>>>13,Ge&=8191,Be=Oe,Be+=je*bt,Be+=_e*Et,Be+=Re*mt,Be+=se*Dt,Be+=ae*At,Oe=Be>>>13,Be&=8191,Be+=we*yt,Be+=ge*P,Be+=me*gt,Be+=Ae*pt,Be+=Qe*ft,Oe+=Be>>>13,Be&=8191,Oe=(Oe<<2)+Oe|0,Oe=Oe+nt|0,nt=Oe&8191,Oe=Oe>>>13,rt+=Oe,je=nt,_e=rt,Re=dt,se=ct,ae=it,we=st,ge=ot,me=Ue,Ae=Ge,Qe=Be,S+=16,y-=16;this.h[0]=je,this.h[1]=_e,this.h[2]=Re,this.h[3]=se,this.h[4]=ae,this.h[5]=we,this.h[6]=ge,this.h[7]=me,this.h[8]=Ae,this.h[9]=Qe},O.prototype.finish=function(h,S){var y=new Uint16Array(10),u,D,Z,ne;if(this.leftover){for(ne=this.leftover,this.buffer[ne++]=1;ne<16;ne++)this.buffer[ne]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(u=this.h[1]>>>13,this.h[1]&=8191,ne=2;ne<10;ne++)this.h[ne]+=u,u=this.h[ne]>>>13,this.h[ne]&=8191;for(this.h[0]+=u*5,u=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=u,u=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=u,y[0]=this.h[0]+5,u=y[0]>>>13,y[0]&=8191,ne=1;ne<10;ne++)y[ne]=this.h[ne]+u,u=y[ne]>>>13,y[ne]&=8191;for(y[9]-=8192,D=(u^1)-1,ne=0;ne<10;ne++)y[ne]&=D;for(D=~D,ne=0;ne<10;ne++)this.h[ne]=this.h[ne]&D|y[ne];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Z=this.h[0]+this.pad[0],this.h[0]=Z&65535,ne=1;ne<8;ne++)Z=(this.h[ne]+this.pad[ne]|0)+(Z>>>16)|0,this.h[ne]=Z&65535;h[S+0]=this.h[0]>>>0&255,h[S+1]=this.h[0]>>>8&255,h[S+2]=this.h[1]>>>0&255,h[S+3]=this.h[1]>>>8&255,h[S+4]=this.h[2]>>>0&255,h[S+5]=this.h[2]>>>8&255,h[S+6]=this.h[3]>>>0&255,h[S+7]=this.h[3]>>>8&255,h[S+8]=this.h[4]>>>0&255,h[S+9]=this.h[4]>>>8&255,h[S+10]=this.h[5]>>>0&255,h[S+11]=this.h[5]>>>8&255,h[S+12]=this.h[6]>>>0&255,h[S+13]=this.h[6]>>>8&255,h[S+14]=this.h[7]>>>0&255,h[S+15]=this.h[7]>>>8&255},O.prototype.update=function(h,S,y){var u,D;if(this.leftover){for(D=16-this.leftover,D>y&&(D=y),u=0;u<D;u++)this.buffer[this.leftover+u]=h[S+u];if(y-=D,S+=D,this.leftover+=D,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(y>=16&&(D=y-y%16,this.blocks(h,S,D),S+=D,y-=D),y){for(u=0;u<y;u++)this.buffer[this.leftover+u]=h[S+u];this.leftover+=y}};function C(h,S,y,u,D,Z){var ne=new O(Z);return ne.update(y,u,D),ne.finish(h,S),0}function V(h,S,y,u,D,Z){var ne=new Uint8Array(16);return C(ne,0,y,u,D,Z),x(h,S,ne,0)}function H(h,S,y,u,D){var Z;if(y<32)return-1;for(v(h,0,S,0,y,u,D),C(h,16,h,32,y-32,h),Z=0;Z<16;Z++)h[Z]=0;return 0}function _(h,S,y,u,D){var Z,ne=new Uint8Array(32);if(y<32||(F(ne,0,32,u,D),V(S,16,S,32,y-32,ne)!==0))return-1;for(v(h,0,S,0,y,u,D),Z=0;Z<32;Z++)h[Z]=0;return 0}function ee(h,S){var y;for(y=0;y<16;y++)h[y]=S[y]|0}function oe(h){var S,y,u=1;for(S=0;S<16;S++)y=h[S]+u+65535,u=Math.floor(y/65536),h[S]=y-u*65536;h[0]+=u-1+37*(u-1)}function z(h,S,y){for(var u,D=~(y-1),Z=0;Z<16;Z++)u=D&(h[Z]^S[Z]),h[Z]^=u,S[Z]^=u}function ue(h,S){var y,u,D,Z=t(),ne=t();for(y=0;y<16;y++)ne[y]=S[y];for(oe(ne),oe(ne),oe(ne),u=0;u<2;u++){for(Z[0]=ne[0]-65517,y=1;y<15;y++)Z[y]=ne[y]-65535-(Z[y-1]>>16&1),Z[y-1]&=65535;Z[15]=ne[15]-32767-(Z[14]>>16&1),D=Z[15]>>16&1,Z[14]&=65535,z(ne,Z,1-D)}for(y=0;y<16;y++)h[2*y]=ne[y]&255,h[2*y+1]=ne[y]>>8}function De(h,S){var y=new Uint8Array(32),u=new Uint8Array(32);return ue(y,h),ue(u,S),T(y,0,u,0)}function ve(h){var S=new Uint8Array(32);return ue(S,h),S[0]&1}function Te(h,S){var y;for(y=0;y<16;y++)h[y]=S[2*y]+(S[2*y+1]<<8);h[15]&=32767}function de(h,S,y){for(var u=0;u<16;u++)h[u]=S[u]+y[u]}function ie(h,S,y){for(var u=0;u<16;u++)h[u]=S[u]-y[u]}function ke(h,S,y){var u,D,Z=0,ne=0,pe=0,Fe=0,ze=0,$e=0,kt=0,Oe=0,nt=0,rt=0,dt=0,ct=0,it=0,st=0,ot=0,Ue=0,Ge=0,Be=0,je=0,_e=0,Re=0,se=0,ae=0,we=0,ge=0,me=0,Ae=0,Qe=0,ft=0,pt=0,gt=0,P=y[0],yt=y[1],At=y[2],Dt=y[3],mt=y[4],Et=y[5],bt=y[6],Qt=y[7],$t=y[8],qt=y[9],Ht=y[10],Gt=y[11],tn=y[12],hn=y[13],dn=y[14],fn=y[15];u=S[0],Z+=u*P,ne+=u*yt,pe+=u*At,Fe+=u*Dt,ze+=u*mt,$e+=u*Et,kt+=u*bt,Oe+=u*Qt,nt+=u*$t,rt+=u*qt,dt+=u*Ht,ct+=u*Gt,it+=u*tn,st+=u*hn,ot+=u*dn,Ue+=u*fn,u=S[1],ne+=u*P,pe+=u*yt,Fe+=u*At,ze+=u*Dt,$e+=u*mt,kt+=u*Et,Oe+=u*bt,nt+=u*Qt,rt+=u*$t,dt+=u*qt,ct+=u*Ht,it+=u*Gt,st+=u*tn,ot+=u*hn,Ue+=u*dn,Ge+=u*fn,u=S[2],pe+=u*P,Fe+=u*yt,ze+=u*At,$e+=u*Dt,kt+=u*mt,Oe+=u*Et,nt+=u*bt,rt+=u*Qt,dt+=u*$t,ct+=u*qt,it+=u*Ht,st+=u*Gt,ot+=u*tn,Ue+=u*hn,Ge+=u*dn,Be+=u*fn,u=S[3],Fe+=u*P,ze+=u*yt,$e+=u*At,kt+=u*Dt,Oe+=u*mt,nt+=u*Et,rt+=u*bt,dt+=u*Qt,ct+=u*$t,it+=u*qt,st+=u*Ht,ot+=u*Gt,Ue+=u*tn,Ge+=u*hn,Be+=u*dn,je+=u*fn,u=S[4],ze+=u*P,$e+=u*yt,kt+=u*At,Oe+=u*Dt,nt+=u*mt,rt+=u*Et,dt+=u*bt,ct+=u*Qt,it+=u*$t,st+=u*qt,ot+=u*Ht,Ue+=u*Gt,Ge+=u*tn,Be+=u*hn,je+=u*dn,_e+=u*fn,u=S[5],$e+=u*P,kt+=u*yt,Oe+=u*At,nt+=u*Dt,rt+=u*mt,dt+=u*Et,ct+=u*bt,it+=u*Qt,st+=u*$t,ot+=u*qt,Ue+=u*Ht,Ge+=u*Gt,Be+=u*tn,je+=u*hn,_e+=u*dn,Re+=u*fn,u=S[6],kt+=u*P,Oe+=u*yt,nt+=u*At,rt+=u*Dt,dt+=u*mt,ct+=u*Et,it+=u*bt,st+=u*Qt,ot+=u*$t,Ue+=u*qt,Ge+=u*Ht,Be+=u*Gt,je+=u*tn,_e+=u*hn,Re+=u*dn,se+=u*fn,u=S[7],Oe+=u*P,nt+=u*yt,rt+=u*At,dt+=u*Dt,ct+=u*mt,it+=u*Et,st+=u*bt,ot+=u*Qt,Ue+=u*$t,Ge+=u*qt,Be+=u*Ht,je+=u*Gt,_e+=u*tn,Re+=u*hn,se+=u*dn,ae+=u*fn,u=S[8],nt+=u*P,rt+=u*yt,dt+=u*At,ct+=u*Dt,it+=u*mt,st+=u*Et,ot+=u*bt,Ue+=u*Qt,Ge+=u*$t,Be+=u*qt,je+=u*Ht,_e+=u*Gt,Re+=u*tn,se+=u*hn,ae+=u*dn,we+=u*fn,u=S[9],rt+=u*P,dt+=u*yt,ct+=u*At,it+=u*Dt,st+=u*mt,ot+=u*Et,Ue+=u*bt,Ge+=u*Qt,Be+=u*$t,je+=u*qt,_e+=u*Ht,Re+=u*Gt,se+=u*tn,ae+=u*hn,we+=u*dn,ge+=u*fn,u=S[10],dt+=u*P,ct+=u*yt,it+=u*At,st+=u*Dt,ot+=u*mt,Ue+=u*Et,Ge+=u*bt,Be+=u*Qt,je+=u*$t,_e+=u*qt,Re+=u*Ht,se+=u*Gt,ae+=u*tn,we+=u*hn,ge+=u*dn,me+=u*fn,u=S[11],ct+=u*P,it+=u*yt,st+=u*At,ot+=u*Dt,Ue+=u*mt,Ge+=u*Et,Be+=u*bt,je+=u*Qt,_e+=u*$t,Re+=u*qt,se+=u*Ht,ae+=u*Gt,we+=u*tn,ge+=u*hn,me+=u*dn,Ae+=u*fn,u=S[12],it+=u*P,st+=u*yt,ot+=u*At,Ue+=u*Dt,Ge+=u*mt,Be+=u*Et,je+=u*bt,_e+=u*Qt,Re+=u*$t,se+=u*qt,ae+=u*Ht,we+=u*Gt,ge+=u*tn,me+=u*hn,Ae+=u*dn,Qe+=u*fn,u=S[13],st+=u*P,ot+=u*yt,Ue+=u*At,Ge+=u*Dt,Be+=u*mt,je+=u*Et,_e+=u*bt,Re+=u*Qt,se+=u*$t,ae+=u*qt,we+=u*Ht,ge+=u*Gt,me+=u*tn,Ae+=u*hn,Qe+=u*dn,ft+=u*fn,u=S[14],ot+=u*P,Ue+=u*yt,Ge+=u*At,Be+=u*Dt,je+=u*mt,_e+=u*Et,Re+=u*bt,se+=u*Qt,ae+=u*$t,we+=u*qt,ge+=u*Ht,me+=u*Gt,Ae+=u*tn,Qe+=u*hn,ft+=u*dn,pt+=u*fn,u=S[15],Ue+=u*P,Ge+=u*yt,Be+=u*At,je+=u*Dt,_e+=u*mt,Re+=u*Et,se+=u*bt,ae+=u*Qt,we+=u*$t,ge+=u*qt,me+=u*Ht,Ae+=u*Gt,Qe+=u*tn,ft+=u*hn,pt+=u*dn,gt+=u*fn,Z+=38*Ge,ne+=38*Be,pe+=38*je,Fe+=38*_e,ze+=38*Re,$e+=38*se,kt+=38*ae,Oe+=38*we,nt+=38*ge,rt+=38*me,dt+=38*Ae,ct+=38*Qe,it+=38*ft,st+=38*pt,ot+=38*gt,D=1,u=Z+D+65535,D=Math.floor(u/65536),Z=u-D*65536,u=ne+D+65535,D=Math.floor(u/65536),ne=u-D*65536,u=pe+D+65535,D=Math.floor(u/65536),pe=u-D*65536,u=Fe+D+65535,D=Math.floor(u/65536),Fe=u-D*65536,u=ze+D+65535,D=Math.floor(u/65536),ze=u-D*65536,u=$e+D+65535,D=Math.floor(u/65536),$e=u-D*65536,u=kt+D+65535,D=Math.floor(u/65536),kt=u-D*65536,u=Oe+D+65535,D=Math.floor(u/65536),Oe=u-D*65536,u=nt+D+65535,D=Math.floor(u/65536),nt=u-D*65536,u=rt+D+65535,D=Math.floor(u/65536),rt=u-D*65536,u=dt+D+65535,D=Math.floor(u/65536),dt=u-D*65536,u=ct+D+65535,D=Math.floor(u/65536),ct=u-D*65536,u=it+D+65535,D=Math.floor(u/65536),it=u-D*65536,u=st+D+65535,D=Math.floor(u/65536),st=u-D*65536,u=ot+D+65535,D=Math.floor(u/65536),ot=u-D*65536,u=Ue+D+65535,D=Math.floor(u/65536),Ue=u-D*65536,Z+=D-1+37*(D-1),D=1,u=Z+D+65535,D=Math.floor(u/65536),Z=u-D*65536,u=ne+D+65535,D=Math.floor(u/65536),ne=u-D*65536,u=pe+D+65535,D=Math.floor(u/65536),pe=u-D*65536,u=Fe+D+65535,D=Math.floor(u/65536),Fe=u-D*65536,u=ze+D+65535,D=Math.floor(u/65536),ze=u-D*65536,u=$e+D+65535,D=Math.floor(u/65536),$e=u-D*65536,u=kt+D+65535,D=Math.floor(u/65536),kt=u-D*65536,u=Oe+D+65535,D=Math.floor(u/65536),Oe=u-D*65536,u=nt+D+65535,D=Math.floor(u/65536),nt=u-D*65536,u=rt+D+65535,D=Math.floor(u/65536),rt=u-D*65536,u=dt+D+65535,D=Math.floor(u/65536),dt=u-D*65536,u=ct+D+65535,D=Math.floor(u/65536),ct=u-D*65536,u=it+D+65535,D=Math.floor(u/65536),it=u-D*65536,u=st+D+65535,D=Math.floor(u/65536),st=u-D*65536,u=ot+D+65535,D=Math.floor(u/65536),ot=u-D*65536,u=Ue+D+65535,D=Math.floor(u/65536),Ue=u-D*65536,Z+=D-1+37*(D-1),h[0]=Z,h[1]=ne,h[2]=pe,h[3]=Fe,h[4]=ze,h[5]=$e,h[6]=kt,h[7]=Oe,h[8]=nt,h[9]=rt,h[10]=dt,h[11]=ct,h[12]=it,h[13]=st,h[14]=ot,h[15]=Ue}function Ie(h,S){ke(h,S,S)}function Ze(h,S){var y=t(),u;for(u=0;u<16;u++)y[u]=S[u];for(u=253;u>=0;u--)Ie(y,y),u!==2&&u!==4&&ke(y,y,S);for(u=0;u<16;u++)h[u]=y[u]}function Ee(h,S){var y=t(),u;for(u=0;u<16;u++)y[u]=S[u];for(u=250;u>=0;u--)Ie(y,y),u!==1&&ke(y,y,S);for(u=0;u<16;u++)h[u]=y[u]}function be(h,S,y){var u=new Uint8Array(32),D=new Float64Array(80),Z,ne,pe=t(),Fe=t(),ze=t(),$e=t(),kt=t(),Oe=t();for(ne=0;ne<31;ne++)u[ne]=S[ne];for(u[31]=S[31]&127|64,u[0]&=248,Te(D,y),ne=0;ne<16;ne++)Fe[ne]=D[ne],$e[ne]=pe[ne]=ze[ne]=0;for(pe[0]=$e[0]=1,ne=254;ne>=0;--ne)Z=u[ne>>>3]>>>(ne&7)&1,z(pe,Fe,Z),z(ze,$e,Z),de(kt,pe,ze),ie(pe,pe,ze),de(ze,Fe,$e),ie(Fe,Fe,$e),Ie($e,kt),Ie(Oe,pe),ke(pe,ze,pe),ke(ze,Fe,kt),de(kt,pe,ze),ie(pe,pe,ze),Ie(Fe,pe),ie(ze,$e,Oe),ke(pe,ze,l),de(pe,pe,$e),ke(ze,ze,pe),ke(pe,$e,Oe),ke($e,Fe,D),Ie(Fe,kt),z(pe,Fe,Z),z(ze,$e,Z);for(ne=0;ne<16;ne++)D[ne+16]=pe[ne],D[ne+32]=ze[ne],D[ne+48]=Fe[ne],D[ne+64]=$e[ne];var nt=D.subarray(32),rt=D.subarray(16);return Ze(nt,nt),ke(rt,rt,nt),ue(h,rt),0}function g(h,S){return be(h,S,o)}function A(h,S){return r(S,32),g(h,S)}function M(h,S,y){var u=new Uint8Array(32);return be(u,y,S),G(h,i,u,E)}var W=H,U=_;function q(h,S,y,u,D,Z){var ne=new Uint8Array(32);return M(ne,D,Z),W(h,S,y,u,ne)}function re(h,S,y,u,D,Z){var ne=new Uint8Array(32);return M(ne,D,Z),U(h,S,y,u,ne)}var j=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function X(h,S,y,u){for(var D=new Int32Array(16),Z=new Int32Array(16),ne,pe,Fe,ze,$e,kt,Oe,nt,rt,dt,ct,it,st,ot,Ue,Ge,Be,je,_e,Re,se,ae,we,ge,me,Ae,Qe=h[0],ft=h[1],pt=h[2],gt=h[3],P=h[4],yt=h[5],At=h[6],Dt=h[7],mt=S[0],Et=S[1],bt=S[2],Qt=S[3],$t=S[4],qt=S[5],Ht=S[6],Gt=S[7],tn=0;u>=128;){for(_e=0;_e<16;_e++)Re=8*_e+tn,D[_e]=y[Re+0]<<24|y[Re+1]<<16|y[Re+2]<<8|y[Re+3],Z[_e]=y[Re+4]<<24|y[Re+5]<<16|y[Re+6]<<8|y[Re+7];for(_e=0;_e<80;_e++)if(ne=Qe,pe=ft,Fe=pt,ze=gt,$e=P,kt=yt,Oe=At,nt=Dt,rt=mt,dt=Et,ct=bt,it=Qt,st=$t,ot=qt,Ue=Ht,Ge=Gt,se=Dt,ae=Gt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=(P>>>14|$t<<18)^(P>>>18|$t<<14)^($t>>>9|P<<23),ae=($t>>>14|P<<18)^($t>>>18|P<<14)^(P>>>9|$t<<23),we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,se=P&yt^~P&At,ae=$t&qt^~$t&Ht,we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,se=j[_e*2],ae=j[_e*2+1],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,se=D[_e%16],ae=Z[_e%16],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,Be=me&65535|Ae<<16,je=we&65535|ge<<16,se=Be,ae=je,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=(Qe>>>28|mt<<4)^(mt>>>2|Qe<<30)^(mt>>>7|Qe<<25),ae=(mt>>>28|Qe<<4)^(Qe>>>2|mt<<30)^(Qe>>>7|mt<<25),we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,se=Qe&ft^Qe&pt^ft&pt,ae=mt&Et^mt&bt^Et&bt,we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,nt=me&65535|Ae<<16,Ge=we&65535|ge<<16,se=ze,ae=it,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=Be,ae=je,we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,ze=me&65535|Ae<<16,it=we&65535|ge<<16,ft=ne,pt=pe,gt=Fe,P=ze,yt=$e,At=kt,Dt=Oe,Qe=nt,Et=rt,bt=dt,Qt=ct,$t=it,qt=st,Ht=ot,Gt=Ue,mt=Ge,_e%16===15)for(Re=0;Re<16;Re++)se=D[Re],ae=Z[Re],we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=D[(Re+9)%16],ae=Z[(Re+9)%16],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,Be=D[(Re+1)%16],je=Z[(Re+1)%16],se=(Be>>>1|je<<31)^(Be>>>8|je<<24)^Be>>>7,ae=(je>>>1|Be<<31)^(je>>>8|Be<<24)^(je>>>7|Be<<25),we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,Be=D[(Re+14)%16],je=Z[(Re+14)%16],se=(Be>>>19|je<<13)^(je>>>29|Be<<3)^Be>>>6,ae=(je>>>19|Be<<13)^(Be>>>29|je<<3)^(je>>>6|Be<<26),we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,D[Re]=me&65535|Ae<<16,Z[Re]=we&65535|ge<<16;se=Qe,ae=mt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[0],ae=S[0],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[0]=Qe=me&65535|Ae<<16,S[0]=mt=we&65535|ge<<16,se=ft,ae=Et,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[1],ae=S[1],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[1]=ft=me&65535|Ae<<16,S[1]=Et=we&65535|ge<<16,se=pt,ae=bt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[2],ae=S[2],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[2]=pt=me&65535|Ae<<16,S[2]=bt=we&65535|ge<<16,se=gt,ae=Qt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[3],ae=S[3],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[3]=gt=me&65535|Ae<<16,S[3]=Qt=we&65535|ge<<16,se=P,ae=$t,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[4],ae=S[4],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[4]=P=me&65535|Ae<<16,S[4]=$t=we&65535|ge<<16,se=yt,ae=qt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[5],ae=S[5],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[5]=yt=me&65535|Ae<<16,S[5]=qt=we&65535|ge<<16,se=At,ae=Ht,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[6],ae=S[6],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[6]=At=me&65535|Ae<<16,S[6]=Ht=we&65535|ge<<16,se=Dt,ae=Gt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[7],ae=S[7],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[7]=Dt=me&65535|Ae<<16,S[7]=Gt=we&65535|ge<<16,tn+=128,u-=128}return u}function te(h,S,y){var u=new Int32Array(8),D=new Int32Array(8),Z=new Uint8Array(256),ne,pe=y;for(u[0]=1779033703,u[1]=3144134277,u[2]=1013904242,u[3]=2773480762,u[4]=1359893119,u[5]=2600822924,u[6]=528734635,u[7]=1541459225,D[0]=4089235720,D[1]=2227873595,D[2]=4271175723,D[3]=1595750129,D[4]=2917565137,D[5]=725511199,D[6]=4215389547,D[7]=327033209,X(u,D,S,y),y%=128,ne=0;ne<y;ne++)Z[ne]=S[pe-y+ne];for(Z[y]=128,y=256-128*(y<112?1:0),Z[y-9]=0,k(Z,y-8,pe/536870912|0,pe<<3),X(u,D,Z,y),ne=0;ne<8;ne++)k(h,8*ne,u[ne],D[ne]);return 0}function Q(h,S){var y=t(),u=t(),D=t(),Z=t(),ne=t(),pe=t(),Fe=t(),ze=t(),$e=t();ie(y,h[1],h[0]),ie($e,S[1],S[0]),ke(y,y,$e),de(u,h[0],h[1]),de($e,S[0],S[1]),ke(u,u,$e),ke(D,h[3],S[3]),ke(D,D,d),ke(Z,h[2],S[2]),de(Z,Z,Z),ie(ne,u,y),ie(pe,Z,D),de(Fe,Z,D),de(ze,u,y),ke(h[0],ne,pe),ke(h[1],ze,Fe),ke(h[2],Fe,pe),ke(h[3],ne,ze)}function le(h,S,y){var u;for(u=0;u<4;u++)z(h[u],S[u],y)}function fe(h,S){var y=t(),u=t(),D=t();Ze(D,S[2]),ke(y,S[0],D),ke(u,S[1],D),ue(h,u),h[31]^=ve(y)<<7}function ye(h,S,y){var u,D;for(ee(h[0],s),ee(h[1],a),ee(h[2],a),ee(h[3],s),D=255;D>=0;--D)u=y[D/8|0]>>(D&7)&1,le(h,S,u),Q(S,h),Q(h,h),le(h,S,u)}function Ve(h,S){var y=[t(),t(),t(),t()];ee(y[0],f),ee(y[1],m),ee(y[2],a),ke(y[3],f,m),ye(h,y,S)}function Ke(h,S,y){var u=new Uint8Array(64),D=[t(),t(),t(),t()],Z;for(y||r(S,32),te(u,S,32),u[0]&=248,u[31]&=127,u[31]|=64,Ve(D,u),fe(h,D),Z=0;Z<32;Z++)S[Z+32]=h[Z];return 0}var wt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function et(h,S){var y,u,D,Z;for(u=63;u>=32;--u){for(y=0,D=u-32,Z=u-12;D<Z;++D)S[D]+=y-16*S[u]*wt[D-(u-32)],y=Math.floor((S[D]+128)/256),S[D]-=y*256;S[D]+=y,S[u]=0}for(y=0,D=0;D<32;D++)S[D]+=y-(S[31]>>4)*wt[D],y=S[D]>>8,S[D]&=255;for(D=0;D<32;D++)S[D]-=y*wt[D];for(u=0;u<32;u++)S[u+1]+=S[u]>>8,h[u]=S[u]&255}function tt(h){var S=new Float64Array(64),y;for(y=0;y<64;y++)S[y]=h[y];for(y=0;y<64;y++)h[y]=0;et(h,S)}function vt(h,S,y,u){var D=new Uint8Array(64),Z=new Uint8Array(64),ne=new Uint8Array(64),pe,Fe,ze=new Float64Array(64),$e=[t(),t(),t(),t()];te(D,u,32),D[0]&=248,D[31]&=127,D[31]|=64;var kt=y+64;for(pe=0;pe<y;pe++)h[64+pe]=S[pe];for(pe=0;pe<32;pe++)h[32+pe]=D[32+pe];for(te(ne,h.subarray(32),y+32),tt(ne),Ve($e,ne),fe(h,$e),pe=32;pe<64;pe++)h[pe]=u[pe];for(te(Z,h,y+64),tt(Z),pe=0;pe<64;pe++)ze[pe]=0;for(pe=0;pe<32;pe++)ze[pe]=ne[pe];for(pe=0;pe<32;pe++)for(Fe=0;Fe<32;Fe++)ze[pe+Fe]+=Z[pe]*D[Fe];return et(h.subarray(32),ze),kt}function zt(h,S){var y=t(),u=t(),D=t(),Z=t(),ne=t(),pe=t(),Fe=t();return ee(h[2],a),Te(h[1],S),Ie(D,h[1]),ke(Z,D,c),ie(D,D,h[2]),de(Z,h[2],Z),Ie(ne,Z),Ie(pe,ne),ke(Fe,pe,ne),ke(y,Fe,D),ke(y,y,Z),Ee(y,y),ke(y,y,D),ke(y,y,Z),ke(y,y,Z),ke(h[0],y,Z),Ie(u,h[0]),ke(u,u,Z),De(u,D)&&ke(h[0],h[0],w),Ie(u,h[0]),ke(u,u,Z),De(u,D)?-1:(ve(h[0])===S[31]>>7&&ie(h[0],s,h[0]),ke(h[3],h[0],h[1]),0)}function Lt(h,S,y,u){var D,Z=new Uint8Array(32),ne=new Uint8Array(64),pe=[t(),t(),t(),t()],Fe=[t(),t(),t(),t()];if(y<64||zt(Fe,u))return-1;for(D=0;D<y;D++)h[D]=S[D];for(D=0;D<32;D++)h[D+32]=u[D];if(te(ne,h,y),tt(ne),ye(pe,Fe,ne),Ve(Fe,S.subarray(32)),Q(pe,Fe),fe(Z,pe),y-=64,T(S,0,Z,0)){for(D=0;D<y;D++)h[D]=0;return-1}for(D=0;D<y;D++)h[D]=S[D+64];return y}var Ut=32,Ft=24,Nt=32,xt=16,St=32,at=32,Yt=32,Xt=32,en=32,rn=Ft,sn=Nt,an=xt,qn=64,lr=32,Ar=64,ls=32,hs=64;e.lowlevel={crypto_core_hsalsa20:G,crypto_stream_xor:v,crypto_stream:F,crypto_stream_salsa20_xor:N,crypto_stream_salsa20:p,crypto_onetimeauth:C,crypto_onetimeauth_verify:V,crypto_verify_16:x,crypto_verify_32:T,crypto_secretbox:H,crypto_secretbox_open:_,crypto_scalarmult:be,crypto_scalarmult_base:g,crypto_box_beforenm:M,crypto_box_afternm:W,crypto_box:q,crypto_box_open:re,crypto_box_keypair:A,crypto_hash:te,crypto_sign:vt,crypto_sign_keypair:Ke,crypto_sign_open:Lt,crypto_secretbox_KEYBYTES:Ut,crypto_secretbox_NONCEBYTES:Ft,crypto_secretbox_ZEROBYTES:Nt,crypto_secretbox_BOXZEROBYTES:xt,crypto_scalarmult_BYTES:St,crypto_scalarmult_SCALARBYTES:at,crypto_box_PUBLICKEYBYTES:Yt,crypto_box_SECRETKEYBYTES:Xt,crypto_box_BEFORENMBYTES:en,crypto_box_NONCEBYTES:rn,crypto_box_ZEROBYTES:sn,crypto_box_BOXZEROBYTES:an,crypto_sign_BYTES:qn,crypto_sign_PUBLICKEYBYTES:lr,crypto_sign_SECRETKEYBYTES:Ar,crypto_sign_SEEDBYTES:ls,crypto_hash_BYTES:hs,gf:t,D:c,L:wt,pack25519:ue,unpack25519:Te,M:ke,A:de,S:Ie,Z:ie,pow2523:Ee,add:Q,set25519:ee,modL:et,scalarmult:ye,scalarbase:Ve};function Qu(h,S){if(h.length!==Ut)throw new Error("bad key size");if(S.length!==Ft)throw new Error("bad nonce size")}function Zg(h,S){if(h.length!==Yt)throw new Error("bad public key size");if(S.length!==Xt)throw new Error("bad secret key size")}function En(){for(var h=0;h<arguments.length;h++)if(!(arguments[h]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Zu(h){for(var S=0;S<h.length;S++)h[S]=0}e.randomBytes=function(h){var S=new Uint8Array(h);return r(S,h),S},e.secretbox=function(h,S,y){En(h,S,y),Qu(y,S);for(var u=new Uint8Array(Nt+h.length),D=new Uint8Array(u.length),Z=0;Z<h.length;Z++)u[Z+Nt]=h[Z];return H(D,u,u.length,S,y),D.subarray(xt)},e.secretbox.open=function(h,S,y){En(h,S,y),Qu(y,S);for(var u=new Uint8Array(xt+h.length),D=new Uint8Array(u.length),Z=0;Z<h.length;Z++)u[Z+xt]=h[Z];return u.length<32||_(D,u,u.length,S,y)!==0?null:D.subarray(Nt)},e.secretbox.keyLength=Ut,e.secretbox.nonceLength=Ft,e.secretbox.overheadLength=xt,e.scalarMult=function(h,S){if(En(h,S),h.length!==at)throw new Error("bad n size");if(S.length!==St)throw new Error("bad p size");var y=new Uint8Array(St);return be(y,h,S),y},e.scalarMult.base=function(h){if(En(h),h.length!==at)throw new Error("bad n size");var S=new Uint8Array(St);return g(S,h),S},e.scalarMult.scalarLength=at,e.scalarMult.groupElementLength=St,e.box=function(h,S,y,u){var D=e.box.before(y,u);return e.secretbox(h,S,D)},e.box.before=function(h,S){En(h,S),Zg(h,S);var y=new Uint8Array(en);return M(y,h,S),y},e.box.after=e.secretbox,e.box.open=function(h,S,y,u){var D=e.box.before(y,u);return e.secretbox.open(h,S,D)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var h=new Uint8Array(Yt),S=new Uint8Array(Xt);return A(h,S),{publicKey:h,secretKey:S}},e.box.keyPair.fromSecretKey=function(h){if(En(h),h.length!==Xt)throw new Error("bad secret key size");var S=new Uint8Array(Yt);return g(S,h),{publicKey:S,secretKey:new Uint8Array(h)}},e.box.publicKeyLength=Yt,e.box.secretKeyLength=Xt,e.box.sharedKeyLength=en,e.box.nonceLength=rn,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(h,S){if(En(h,S),S.length!==Ar)throw new Error("bad secret key size");var y=new Uint8Array(qn+h.length);return vt(y,h,h.length,S),y},e.sign.open=function(h,S){if(En(h,S),S.length!==lr)throw new Error("bad public key size");var y=new Uint8Array(h.length),u=Lt(y,h,h.length,S);if(u<0)return null;for(var D=new Uint8Array(u),Z=0;Z<D.length;Z++)D[Z]=y[Z];return D},e.sign.detached=function(h,S){for(var y=e.sign(h,S),u=new Uint8Array(qn),D=0;D<u.length;D++)u[D]=y[D];return u},e.sign.detached.verify=function(h,S,y){if(En(h,S,y),S.length!==qn)throw new Error("bad signature size");if(y.length!==lr)throw new Error("bad public key size");var u=new Uint8Array(qn+h.length),D=new Uint8Array(qn+h.length),Z;for(Z=0;Z<qn;Z++)u[Z]=S[Z];for(Z=0;Z<h.length;Z++)u[Z+qn]=h[Z];return Lt(D,u,u.length,y)>=0},e.sign.keyPair=function(){var h=new Uint8Array(lr),S=new Uint8Array(Ar);return Ke(h,S),{publicKey:h,secretKey:S}},e.sign.keyPair.fromSecretKey=function(h){if(En(h),h.length!==Ar)throw new Error("bad secret key size");for(var S=new Uint8Array(lr),y=0;y<S.length;y++)S[y]=h[32+y];return{publicKey:S,secretKey:new Uint8Array(h)}},e.sign.keyPair.fromSeed=function(h){if(En(h),h.length!==ls)throw new Error("bad seed size");for(var S=new Uint8Array(lr),y=new Uint8Array(Ar),u=0;u<32;u++)y[u]=h[u];return Ke(S,y,!0),{publicKey:S,secretKey:y}},e.sign.publicKeyLength=lr,e.sign.secretKeyLength=Ar,e.sign.seedLength=ls,e.sign.signatureLength=qn,e.hash=function(h){En(h);var S=new Uint8Array(hs);return te(S,h,h.length),S},e.hash.hashLength=hs,e.verify=function(h,S){return En(h,S),h.length===0||S.length===0||h.length!==S.length?!1:I(h,0,S,0,h.length)===0},e.setPRNG=function(h){r=h},(function(){var h=typeof self<"u"?self.crypto||self.msCrypto:null;if(h&&h.getRandomValues){var S=65536;e.setPRNG(function(y,u){var D,Z=new Uint8Array(u);for(D=0;D<u;D+=S)h.getRandomValues(Z.subarray(D,D+Math.min(u-D,S)));for(D=0;D<u;D++)y[D]=Z[D];Zu(Z)})}else typeof TA<"u"&&(h=IA,h&&h.randomBytes&&e.setPRNG(function(y,u){var D,Z=h.randomBytes(u);for(D=0;D<u;D++)y[D]=Z[D];Zu(Z)}))})()})(n.exports?n.exports:self.nacl=self.nacl||{})})(hp)),hp.exports}var gM=fM();const co=cs(gM);var dp={exports:{}};/*
|
|
17
|
+
* [js-sha512]{@link https://github.com/emn178/js-sha512}
|
|
18
|
+
*
|
|
19
|
+
* @version 0.8.0
|
|
20
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
21
|
+
* @copyright Chen, Yi-Cyuan 2014-2018
|
|
22
|
+
* @license MIT
|
|
23
|
+
*/var I1;function pM(){return I1||(I1=1,(function(n){(function(){var e="input is invalid type",t="finalize already called",r=typeof window=="object",i=r?window:{};i.JS_SHA512_NO_WINDOW&&(r=!1);var o=!r&&typeof self=="object",s=!i.JS_SHA512_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=$f:o&&(i=self);var a=!i.JS_SHA512_NO_COMMON_JS&&!0&&n.exports,l=!i.JS_SHA512_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),d=[-2147483648,8388608,32768,128],f=[24,16,8,0],m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],w=["hex","array","digest","arrayBuffer"],k=[];(i.JS_SHA512_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(E){return Object.prototype.toString.call(E)==="[object Array]"}),l&&(i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});var I=function(E,N){return function(p){return new R(N,!0).update(p)[E]()}},x=function(E){var N=I("hex",E);N.create=function(){return new R(E)},N.update=function(v){return N.create().update(v)};for(var p=0;p<w.length;++p){var F=w[p];N[F]=I(F,E)}return N},T=function(E,N){return function(p,F){return new L(p,N,!0).update(F)[E]()}},b=function(E){var N=T("hex",E);N.create=function(v){return new L(v,E)},N.update=function(v,O){return N.create(v).update(O)};for(var p=0;p<w.length;++p){var F=w[p];N[F]=T(F,E)}return N};function R(E,N){N?(k[0]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=k[16]=k[17]=k[18]=k[19]=k[20]=k[21]=k[22]=k[23]=k[24]=k[25]=k[26]=k[27]=k[28]=k[29]=k[30]=k[31]=k[32]=0,this.blocks=k):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],E==384?(this.h0h=3418070365,this.h0l=3238371032,this.h1h=1654270250,this.h1l=914150663,this.h2h=2438529370,this.h2l=812702999,this.h3h=355462360,this.h3l=4144912697,this.h4h=1731405415,this.h4l=4290775857,this.h5h=2394180231,this.h5l=1750603025,this.h6h=3675008525,this.h6l=1694076839,this.h7h=1203062813,this.h7l=3204075428):E==256?(this.h0h=573645204,this.h0l=4230739756,this.h1h=2673172387,this.h1l=3360449730,this.h2h=596883563,this.h2l=1867755857,this.h3h=2520282905,this.h3l=1497426621,this.h4h=2519219938,this.h4l=2827943907,this.h5h=3193839141,this.h5l=1401305490,this.h6h=721525244,this.h6l=746961066,this.h7h=246885852,this.h7l=2177182882):E==224?(this.h0h=2352822216,this.h0l=424955298,this.h1h=1944164710,this.h1l=2312950998,this.h2h=502970286,this.h2l=855612546,this.h3h=1738396948,this.h3l=1479516111,this.h4h=258812777,this.h4l=2077511080,this.h5h=2011393907,this.h5l=79989058,this.h6h=1067287976,this.h6l=1780299464,this.h7h=286451373,this.h7l=2446758561):(this.h0h=1779033703,this.h0l=4089235720,this.h1h=3144134277,this.h1l=2227873595,this.h2h=1013904242,this.h2l=4271175723,this.h3h=2773480762,this.h3l=1595750129,this.h4h=1359893119,this.h4l=2917565137,this.h5h=2600822924,this.h5l=725511199,this.h6h=528734635,this.h6l=4215389547,this.h7h=1541459225,this.h7l=327033209),this.bits=E,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1}R.prototype.update=function(E){if(this.finalized)throw new Error(t);var N,p=typeof E;if(p!=="string"){if(p==="object"){if(E===null)throw new Error(e);if(l&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!l||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);N=!0}for(var F,v=0,O,C=E.length,V=this.blocks;v<C;){if(this.hashed&&(this.hashed=!1,V[0]=this.block,V[1]=V[2]=V[3]=V[4]=V[5]=V[6]=V[7]=V[8]=V[9]=V[10]=V[11]=V[12]=V[13]=V[14]=V[15]=V[16]=V[17]=V[18]=V[19]=V[20]=V[21]=V[22]=V[23]=V[24]=V[25]=V[26]=V[27]=V[28]=V[29]=V[30]=V[31]=V[32]=0),N)for(O=this.start;v<C&&O<128;++v)V[O>>2]|=E[v]<<f[O++&3];else for(O=this.start;v<C&&O<128;++v)F=E.charCodeAt(v),F<128?V[O>>2]|=F<<f[O++&3]:F<2048?(V[O>>2]|=(192|F>>6)<<f[O++&3],V[O>>2]|=(128|F&63)<<f[O++&3]):F<55296||F>=57344?(V[O>>2]|=(224|F>>12)<<f[O++&3],V[O>>2]|=(128|F>>6&63)<<f[O++&3],V[O>>2]|=(128|F&63)<<f[O++&3]):(F=65536+((F&1023)<<10|E.charCodeAt(++v)&1023),V[O>>2]|=(240|F>>18)<<f[O++&3],V[O>>2]|=(128|F>>12&63)<<f[O++&3],V[O>>2]|=(128|F>>6&63)<<f[O++&3],V[O>>2]|=(128|F&63)<<f[O++&3]);this.lastByteIndex=O,this.bytes+=O-this.start,O>=128?(this.block=V[32],this.start=O-128,this.hash(),this.hashed=!0):this.start=O}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},R.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,N=this.lastByteIndex;E[32]=this.block,E[N>>2]|=d[N&3],this.block=E[32],N>=112&&(this.hashed||this.hash(),E[0]=this.block,E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=E[16]=E[17]=E[18]=E[19]=E[20]=E[21]=E[22]=E[23]=E[24]=E[25]=E[26]=E[27]=E[28]=E[29]=E[30]=E[31]=E[32]=0),E[30]=this.hBytes<<3|this.bytes>>>29,E[31]=this.bytes<<3,this.hash()}},R.prototype.hash=function(){var E=this.h0h,N=this.h0l,p=this.h1h,F=this.h1l,v=this.h2h,O=this.h2l,C=this.h3h,V=this.h3l,H=this.h4h,_=this.h4l,ee=this.h5h,oe=this.h5l,z=this.h6h,ue=this.h6l,De=this.h7h,ve=this.h7l,Te=this.blocks,de,ie,ke,Ie,Ze,Ee,be,g,A,M,W,U,q,re,j,X,te,Q,le,fe,ye,Ve,Ke,wt,et;for(de=32;de<160;de+=2)fe=Te[de-30],ye=Te[de-29],ie=(fe>>>1|ye<<31)^(fe>>>8|ye<<24)^fe>>>7,ke=(ye>>>1|fe<<31)^(ye>>>8|fe<<24)^(ye>>>7|fe<<25),fe=Te[de-4],ye=Te[de-3],Ie=(fe>>>19|ye<<13)^(ye>>>29|fe<<3)^fe>>>6,Ze=(ye>>>19|fe<<13)^(fe>>>29|ye<<3)^(ye>>>6|fe<<26),fe=Te[de-32],ye=Te[de-31],Ve=Te[de-14],Ke=Te[de-13],Ee=(Ke&65535)+(ye&65535)+(ke&65535)+(Ze&65535),be=(Ke>>>16)+(ye>>>16)+(ke>>>16)+(Ze>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(ie&65535)+(Ie&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(ie>>>16)+(Ie>>>16)+(g>>>16),Te[de]=A<<16|g&65535,Te[de+1]=be<<16|Ee&65535;var tt=E,vt=N,zt=p,Lt=F,Ut=v,Ft=O,Nt=C,xt=V,St=H,at=_,Yt=ee,Xt=oe,en=z,rn=ue,sn=De,an=ve;for(X=zt&Ut,te=Lt&Ft,de=0;de<160;de+=8)ie=(tt>>>28|vt<<4)^(vt>>>2|tt<<30)^(vt>>>7|tt<<25),ke=(vt>>>28|tt<<4)^(tt>>>2|vt<<30)^(tt>>>7|vt<<25),Ie=(St>>>14|at<<18)^(St>>>18|at<<14)^(at>>>9|St<<23),Ze=(at>>>14|St<<18)^(at>>>18|St<<14)^(St>>>9|at<<23),M=tt&zt,W=vt&Lt,Q=M^tt&Ut^X,le=W^vt&Ft^te,wt=St&Yt^~St&en,et=at&Xt^~at&rn,fe=Te[de],ye=Te[de+1],Ve=m[de],Ke=m[de+1],Ee=(Ke&65535)+(ye&65535)+(et&65535)+(Ze&65535)+(an&65535),be=(Ke>>>16)+(ye>>>16)+(et>>>16)+(Ze>>>16)+(an>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(wt&65535)+(Ie&65535)+(sn&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(wt>>>16)+(Ie>>>16)+(sn>>>16)+(g>>>16),fe=A<<16|g&65535,ye=be<<16|Ee&65535,Ee=(le&65535)+(ke&65535),be=(le>>>16)+(ke>>>16)+(Ee>>>16),g=(Q&65535)+(ie&65535)+(be>>>16),A=(Q>>>16)+(ie>>>16)+(g>>>16),Ve=A<<16|g&65535,Ke=be<<16|Ee&65535,Ee=(xt&65535)+(ye&65535),be=(xt>>>16)+(ye>>>16)+(Ee>>>16),g=(Nt&65535)+(fe&65535)+(be>>>16),A=(Nt>>>16)+(fe>>>16)+(g>>>16),sn=A<<16|g&65535,an=be<<16|Ee&65535,Ee=(Ke&65535)+(ye&65535),be=(Ke>>>16)+(ye>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(g>>>16),Nt=A<<16|g&65535,xt=be<<16|Ee&65535,ie=(Nt>>>28|xt<<4)^(xt>>>2|Nt<<30)^(xt>>>7|Nt<<25),ke=(xt>>>28|Nt<<4)^(Nt>>>2|xt<<30)^(Nt>>>7|xt<<25),Ie=(sn>>>14|an<<18)^(sn>>>18|an<<14)^(an>>>9|sn<<23),Ze=(an>>>14|sn<<18)^(an>>>18|sn<<14)^(sn>>>9|an<<23),U=Nt&tt,q=xt&vt,Q=U^Nt&zt^M,le=q^xt&Lt^W,wt=sn&St^~sn&Yt,et=an&at^~an&Xt,fe=Te[de+2],ye=Te[de+3],Ve=m[de+2],Ke=m[de+3],Ee=(Ke&65535)+(ye&65535)+(et&65535)+(Ze&65535)+(rn&65535),be=(Ke>>>16)+(ye>>>16)+(et>>>16)+(Ze>>>16)+(rn>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(wt&65535)+(Ie&65535)+(en&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(wt>>>16)+(Ie>>>16)+(en>>>16)+(g>>>16),fe=A<<16|g&65535,ye=be<<16|Ee&65535,Ee=(le&65535)+(ke&65535),be=(le>>>16)+(ke>>>16)+(Ee>>>16),g=(Q&65535)+(ie&65535)+(be>>>16),A=(Q>>>16)+(ie>>>16)+(g>>>16),Ve=A<<16|g&65535,Ke=be<<16|Ee&65535,Ee=(Ft&65535)+(ye&65535),be=(Ft>>>16)+(ye>>>16)+(Ee>>>16),g=(Ut&65535)+(fe&65535)+(be>>>16),A=(Ut>>>16)+(fe>>>16)+(g>>>16),en=A<<16|g&65535,rn=be<<16|Ee&65535,Ee=(Ke&65535)+(ye&65535),be=(Ke>>>16)+(ye>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(g>>>16),Ut=A<<16|g&65535,Ft=be<<16|Ee&65535,ie=(Ut>>>28|Ft<<4)^(Ft>>>2|Ut<<30)^(Ft>>>7|Ut<<25),ke=(Ft>>>28|Ut<<4)^(Ut>>>2|Ft<<30)^(Ut>>>7|Ft<<25),Ie=(en>>>14|rn<<18)^(en>>>18|rn<<14)^(rn>>>9|en<<23),Ze=(rn>>>14|en<<18)^(rn>>>18|en<<14)^(en>>>9|rn<<23),re=Ut&Nt,j=Ft&xt,Q=re^Ut&tt^U,le=j^Ft&vt^q,wt=en&sn^~en&St,et=rn&an^~rn&at,fe=Te[de+4],ye=Te[de+5],Ve=m[de+4],Ke=m[de+5],Ee=(Ke&65535)+(ye&65535)+(et&65535)+(Ze&65535)+(Xt&65535),be=(Ke>>>16)+(ye>>>16)+(et>>>16)+(Ze>>>16)+(Xt>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(wt&65535)+(Ie&65535)+(Yt&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(wt>>>16)+(Ie>>>16)+(Yt>>>16)+(g>>>16),fe=A<<16|g&65535,ye=be<<16|Ee&65535,Ee=(le&65535)+(ke&65535),be=(le>>>16)+(ke>>>16)+(Ee>>>16),g=(Q&65535)+(ie&65535)+(be>>>16),A=(Q>>>16)+(ie>>>16)+(g>>>16),Ve=A<<16|g&65535,Ke=be<<16|Ee&65535,Ee=(Lt&65535)+(ye&65535),be=(Lt>>>16)+(ye>>>16)+(Ee>>>16),g=(zt&65535)+(fe&65535)+(be>>>16),A=(zt>>>16)+(fe>>>16)+(g>>>16),Yt=A<<16|g&65535,Xt=be<<16|Ee&65535,Ee=(Ke&65535)+(ye&65535),be=(Ke>>>16)+(ye>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(g>>>16),zt=A<<16|g&65535,Lt=be<<16|Ee&65535,ie=(zt>>>28|Lt<<4)^(Lt>>>2|zt<<30)^(Lt>>>7|zt<<25),ke=(Lt>>>28|zt<<4)^(zt>>>2|Lt<<30)^(zt>>>7|Lt<<25),Ie=(Yt>>>14|Xt<<18)^(Yt>>>18|Xt<<14)^(Xt>>>9|Yt<<23),Ze=(Xt>>>14|Yt<<18)^(Xt>>>18|Yt<<14)^(Yt>>>9|Xt<<23),X=zt&Ut,te=Lt&Ft,Q=X^zt&Nt^re,le=te^Lt&xt^j,wt=Yt&en^~Yt&sn,et=Xt&rn^~Xt&an,fe=Te[de+6],ye=Te[de+7],Ve=m[de+6],Ke=m[de+7],Ee=(Ke&65535)+(ye&65535)+(et&65535)+(Ze&65535)+(at&65535),be=(Ke>>>16)+(ye>>>16)+(et>>>16)+(Ze>>>16)+(at>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(wt&65535)+(Ie&65535)+(St&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(wt>>>16)+(Ie>>>16)+(St>>>16)+(g>>>16),fe=A<<16|g&65535,ye=be<<16|Ee&65535,Ee=(le&65535)+(ke&65535),be=(le>>>16)+(ke>>>16)+(Ee>>>16),g=(Q&65535)+(ie&65535)+(be>>>16),A=(Q>>>16)+(ie>>>16)+(g>>>16),Ve=A<<16|g&65535,Ke=be<<16|Ee&65535,Ee=(vt&65535)+(ye&65535),be=(vt>>>16)+(ye>>>16)+(Ee>>>16),g=(tt&65535)+(fe&65535)+(be>>>16),A=(tt>>>16)+(fe>>>16)+(g>>>16),St=A<<16|g&65535,at=be<<16|Ee&65535,Ee=(Ke&65535)+(ye&65535),be=(Ke>>>16)+(ye>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(g>>>16),tt=A<<16|g&65535,vt=be<<16|Ee&65535;Ee=(N&65535)+(vt&65535),be=(N>>>16)+(vt>>>16)+(Ee>>>16),g=(E&65535)+(tt&65535)+(be>>>16),A=(E>>>16)+(tt>>>16)+(g>>>16),this.h0h=A<<16|g&65535,this.h0l=be<<16|Ee&65535,Ee=(F&65535)+(Lt&65535),be=(F>>>16)+(Lt>>>16)+(Ee>>>16),g=(p&65535)+(zt&65535)+(be>>>16),A=(p>>>16)+(zt>>>16)+(g>>>16),this.h1h=A<<16|g&65535,this.h1l=be<<16|Ee&65535,Ee=(O&65535)+(Ft&65535),be=(O>>>16)+(Ft>>>16)+(Ee>>>16),g=(v&65535)+(Ut&65535)+(be>>>16),A=(v>>>16)+(Ut>>>16)+(g>>>16),this.h2h=A<<16|g&65535,this.h2l=be<<16|Ee&65535,Ee=(V&65535)+(xt&65535),be=(V>>>16)+(xt>>>16)+(Ee>>>16),g=(C&65535)+(Nt&65535)+(be>>>16),A=(C>>>16)+(Nt>>>16)+(g>>>16),this.h3h=A<<16|g&65535,this.h3l=be<<16|Ee&65535,Ee=(_&65535)+(at&65535),be=(_>>>16)+(at>>>16)+(Ee>>>16),g=(H&65535)+(St&65535)+(be>>>16),A=(H>>>16)+(St>>>16)+(g>>>16),this.h4h=A<<16|g&65535,this.h4l=be<<16|Ee&65535,Ee=(oe&65535)+(Xt&65535),be=(oe>>>16)+(Xt>>>16)+(Ee>>>16),g=(ee&65535)+(Yt&65535)+(be>>>16),A=(ee>>>16)+(Yt>>>16)+(g>>>16),this.h5h=A<<16|g&65535,this.h5l=be<<16|Ee&65535,Ee=(ue&65535)+(rn&65535),be=(ue>>>16)+(rn>>>16)+(Ee>>>16),g=(z&65535)+(en&65535)+(be>>>16),A=(z>>>16)+(en>>>16)+(g>>>16),this.h6h=A<<16|g&65535,this.h6l=be<<16|Ee&65535,Ee=(ve&65535)+(an&65535),be=(ve>>>16)+(an>>>16)+(Ee>>>16),g=(De&65535)+(sn&65535)+(be>>>16),A=(De>>>16)+(sn>>>16)+(g>>>16),this.h7h=A<<16|g&65535,this.h7l=be<<16|Ee&65535},R.prototype.hex=function(){this.finalize();var E=this.h0h,N=this.h0l,p=this.h1h,F=this.h1l,v=this.h2h,O=this.h2l,C=this.h3h,V=this.h3l,H=this.h4h,_=this.h4l,ee=this.h5h,oe=this.h5l,z=this.h6h,ue=this.h6l,De=this.h7h,ve=this.h7l,Te=this.bits,de=c[E>>28&15]+c[E>>24&15]+c[E>>20&15]+c[E>>16&15]+c[E>>12&15]+c[E>>8&15]+c[E>>4&15]+c[E&15]+c[N>>28&15]+c[N>>24&15]+c[N>>20&15]+c[N>>16&15]+c[N>>12&15]+c[N>>8&15]+c[N>>4&15]+c[N&15]+c[p>>28&15]+c[p>>24&15]+c[p>>20&15]+c[p>>16&15]+c[p>>12&15]+c[p>>8&15]+c[p>>4&15]+c[p&15]+c[F>>28&15]+c[F>>24&15]+c[F>>20&15]+c[F>>16&15]+c[F>>12&15]+c[F>>8&15]+c[F>>4&15]+c[F&15]+c[v>>28&15]+c[v>>24&15]+c[v>>20&15]+c[v>>16&15]+c[v>>12&15]+c[v>>8&15]+c[v>>4&15]+c[v&15]+c[O>>28&15]+c[O>>24&15]+c[O>>20&15]+c[O>>16&15]+c[O>>12&15]+c[O>>8&15]+c[O>>4&15]+c[O&15]+c[C>>28&15]+c[C>>24&15]+c[C>>20&15]+c[C>>16&15]+c[C>>12&15]+c[C>>8&15]+c[C>>4&15]+c[C&15];return Te>=256&&(de+=c[V>>28&15]+c[V>>24&15]+c[V>>20&15]+c[V>>16&15]+c[V>>12&15]+c[V>>8&15]+c[V>>4&15]+c[V&15]),Te>=384&&(de+=c[H>>28&15]+c[H>>24&15]+c[H>>20&15]+c[H>>16&15]+c[H>>12&15]+c[H>>8&15]+c[H>>4&15]+c[H&15]+c[_>>28&15]+c[_>>24&15]+c[_>>20&15]+c[_>>16&15]+c[_>>12&15]+c[_>>8&15]+c[_>>4&15]+c[_&15]+c[ee>>28&15]+c[ee>>24&15]+c[ee>>20&15]+c[ee>>16&15]+c[ee>>12&15]+c[ee>>8&15]+c[ee>>4&15]+c[ee&15]+c[oe>>28&15]+c[oe>>24&15]+c[oe>>20&15]+c[oe>>16&15]+c[oe>>12&15]+c[oe>>8&15]+c[oe>>4&15]+c[oe&15]),Te==512&&(de+=c[z>>28&15]+c[z>>24&15]+c[z>>20&15]+c[z>>16&15]+c[z>>12&15]+c[z>>8&15]+c[z>>4&15]+c[z&15]+c[ue>>28&15]+c[ue>>24&15]+c[ue>>20&15]+c[ue>>16&15]+c[ue>>12&15]+c[ue>>8&15]+c[ue>>4&15]+c[ue&15]+c[De>>28&15]+c[De>>24&15]+c[De>>20&15]+c[De>>16&15]+c[De>>12&15]+c[De>>8&15]+c[De>>4&15]+c[De&15]+c[ve>>28&15]+c[ve>>24&15]+c[ve>>20&15]+c[ve>>16&15]+c[ve>>12&15]+c[ve>>8&15]+c[ve>>4&15]+c[ve&15]),de},R.prototype.toString=R.prototype.hex,R.prototype.digest=function(){this.finalize();var E=this.h0h,N=this.h0l,p=this.h1h,F=this.h1l,v=this.h2h,O=this.h2l,C=this.h3h,V=this.h3l,H=this.h4h,_=this.h4l,ee=this.h5h,oe=this.h5l,z=this.h6h,ue=this.h6l,De=this.h7h,ve=this.h7l,Te=this.bits,de=[E>>24&255,E>>16&255,E>>8&255,E&255,N>>24&255,N>>16&255,N>>8&255,N&255,p>>24&255,p>>16&255,p>>8&255,p&255,F>>24&255,F>>16&255,F>>8&255,F&255,v>>24&255,v>>16&255,v>>8&255,v&255,O>>24&255,O>>16&255,O>>8&255,O&255,C>>24&255,C>>16&255,C>>8&255,C&255];return Te>=256&&de.push(V>>24&255,V>>16&255,V>>8&255,V&255),Te>=384&&de.push(H>>24&255,H>>16&255,H>>8&255,H&255,_>>24&255,_>>16&255,_>>8&255,_&255,ee>>24&255,ee>>16&255,ee>>8&255,ee&255,oe>>24&255,oe>>16&255,oe>>8&255,oe&255),Te==512&&de.push(z>>24&255,z>>16&255,z>>8&255,z&255,ue>>24&255,ue>>16&255,ue>>8&255,ue&255,De>>24&255,De>>16&255,De>>8&255,De&255,ve>>24&255,ve>>16&255,ve>>8&255,ve&255),de},R.prototype.array=R.prototype.digest,R.prototype.arrayBuffer=function(){this.finalize();var E=this.bits,N=new ArrayBuffer(E/8),p=new DataView(N);return p.setUint32(0,this.h0h),p.setUint32(4,this.h0l),p.setUint32(8,this.h1h),p.setUint32(12,this.h1l),p.setUint32(16,this.h2h),p.setUint32(20,this.h2l),p.setUint32(24,this.h3h),E>=256&&p.setUint32(28,this.h3l),E>=384&&(p.setUint32(32,this.h4h),p.setUint32(36,this.h4l),p.setUint32(40,this.h5h),p.setUint32(44,this.h5l)),E==512&&(p.setUint32(48,this.h6h),p.setUint32(52,this.h6l),p.setUint32(56,this.h7h),p.setUint32(60,this.h7l)),N},R.prototype.clone=function(){var E=new R(this.bits,!1);return this.copyTo(E),E},R.prototype.copyTo=function(E){var N=0,p=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(N=0;N<p.length;++N)E[p[N]]=this[p[N]];for(N=0;N<this.blocks.length;++N)E.blocks[N]=this.blocks[N]};function L(E,N,p){var F,v=typeof E;if(v!=="string"){if(v==="object"){if(E===null)throw new Error(e);if(l&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!l||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);F=!0}var O=E.length;if(!F){for(var C=[],O=E.length,V=0,H,_=0;_<O;++_)H=E.charCodeAt(_),H<128?C[V++]=H:H<2048?(C[V++]=192|H>>6,C[V++]=128|H&63):H<55296||H>=57344?(C[V++]=224|H>>12,C[V++]=128|H>>6&63,C[V++]=128|H&63):(H=65536+((H&1023)<<10|E.charCodeAt(++_)&1023),C[V++]=240|H>>18,C[V++]=128|H>>12&63,C[V++]=128|H>>6&63,C[V++]=128|H&63);E=C}E.length>128&&(E=new R(N,!0).update(E).array());for(var ee=[],oe=[],_=0;_<128;++_){var z=E[_]||0;ee[_]=92^z,oe[_]=54^z}R.call(this,N,p),this.update(oe),this.oKeyPad=ee,this.inner=!0,this.sharedMemory=p}L.prototype=new R,L.prototype.finalize=function(){if(R.prototype.finalize.call(this),this.inner){this.inner=!1;var E=this.array();R.call(this,this.bits,this.sharedMemory),this.update(this.oKeyPad),this.update(E),R.prototype.finalize.call(this)}},L.prototype.clone=function(){var E=new L([],this.bits,!1);this.copyTo(E),E.inner=this.inner;for(var N=0;N<this.oKeyPad.length;++N)E.oKeyPad[N]=this.oKeyPad[N];return E};var G=x(512);G.sha512=G,G.sha384=x(384),G.sha512_256=x(256),G.sha512_224=x(224),G.sha512.hmac=b(512),G.sha384.hmac=b(384),G.sha512_256.hmac=b(256),G.sha512_224.hmac=b(224),a?n.exports=G:(i.sha512=G.sha512,i.sha384=G.sha384,i.sha512_256=G.sha512_256,i.sha512_224=G.sha512_224)})()})(dp)),dp.exports}var mM=pM();const yM=cs(mM);var tl={exports:{}},fp={exports:{}},kd={exports:{}},wM=kd.exports,M1;function MA(){return M1||(M1=1,(function(n){(function(e){var t,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,o=Math.floor,s="[BigNumber Error] ",a=s+"Number primitive has more than 15 significant digits: ",l=1e14,c=14,d=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,w=1e9;function k(E){var N,p,F,v=ie.prototype={constructor:ie,toString:null,valueOf:null},O=new ie(1),C=20,V=4,H=-7,_=21,ee=-1e7,oe=1e7,z=!1,ue=1,De=0,ve={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Te="0123456789abcdefghijklmnopqrstuvwxyz",de=!0;function ie(g,A){var M,W,U,q,re,j,X,te,Q=this;if(!(Q instanceof ie))return new ie(g,A);if(A==null){if(g&&g._isBigNumber===!0){Q.s=g.s,!g.c||g.e>oe?Q.c=Q.e=null:g.e<ee?Q.c=[Q.e=0]:(Q.e=g.e,Q.c=g.c.slice());return}if((j=typeof g=="number")&&g*0==0){if(Q.s=1/g<0?(g=-g,-1):1,g===~~g){for(q=0,re=g;re>=10;re/=10,q++);q>oe?Q.c=Q.e=null:(Q.e=q,Q.c=[g]);return}te=String(g)}else{if(!r.test(te=String(g)))return F(Q,te,j);Q.s=te.charCodeAt(0)==45?(te=te.slice(1),-1):1}(q=te.indexOf("."))>-1&&(te=te.replace(".","")),(re=te.search(/e/i))>0?(q<0&&(q=re),q+=+te.slice(re+1),te=te.substring(0,re)):q<0&&(q=te.length)}else{if(b(A,2,Te.length,"Base"),A==10&&de)return Q=new ie(g),Ee(Q,C+Q.e+1,V);if(te=String(g),j=typeof g=="number"){if(g*0!=0)return F(Q,te,j,A);if(Q.s=1/g<0?(te=te.slice(1),-1):1,ie.DEBUG&&te.replace(/^0\.0*|\./,"").length>15)throw Error(a+g)}else Q.s=te.charCodeAt(0)===45?(te=te.slice(1),-1):1;for(M=Te.slice(0,A),q=re=0,X=te.length;re<X;re++)if(M.indexOf(W=te.charAt(re))<0){if(W=="."){if(re>q){q=X;continue}}else if(!U&&(te==te.toUpperCase()&&(te=te.toLowerCase())||te==te.toLowerCase()&&(te=te.toUpperCase()))){U=!0,re=-1,q=0;continue}return F(Q,String(g),j,A)}j=!1,te=p(te,A,10,Q.s),(q=te.indexOf("."))>-1?te=te.replace(".",""):q=te.length}for(re=0;te.charCodeAt(re)===48;re++);for(X=te.length;te.charCodeAt(--X)===48;);if(te=te.slice(re,++X)){if(X-=re,j&&ie.DEBUG&&X>15&&(g>d||g!==o(g)))throw Error(a+Q.s*g);if((q=q-re-1)>oe)Q.c=Q.e=null;else if(q<ee)Q.c=[Q.e=0];else{if(Q.e=q,Q.c=[],re=(q+1)%c,q<0&&(re+=c),re<X){for(re&&Q.c.push(+te.slice(0,re)),X-=c;re<X;)Q.c.push(+te.slice(re,re+=c));re=c-(te=te.slice(re)).length}else re-=X;for(;re--;te+="0");Q.c.push(+te)}}else Q.c=[Q.e=0]}ie.clone=k,ie.ROUND_UP=0,ie.ROUND_DOWN=1,ie.ROUND_CEIL=2,ie.ROUND_FLOOR=3,ie.ROUND_HALF_UP=4,ie.ROUND_HALF_DOWN=5,ie.ROUND_HALF_EVEN=6,ie.ROUND_HALF_CEIL=7,ie.ROUND_HALF_FLOOR=8,ie.EUCLID=9,ie.config=ie.set=function(g){var A,M;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(A="DECIMAL_PLACES")&&(M=g[A],b(M,0,w,A),C=M),g.hasOwnProperty(A="ROUNDING_MODE")&&(M=g[A],b(M,0,8,A),V=M),g.hasOwnProperty(A="EXPONENTIAL_AT")&&(M=g[A],M&&M.pop?(b(M[0],-w,0,A),b(M[1],0,w,A),H=M[0],_=M[1]):(b(M,-w,w,A),H=-(_=M<0?-M:M))),g.hasOwnProperty(A="RANGE"))if(M=g[A],M&&M.pop)b(M[0],-w,-1,A),b(M[1],1,w,A),ee=M[0],oe=M[1];else if(b(M,-w,w,A),M)ee=-(oe=M<0?-M:M);else throw Error(s+A+" cannot be zero: "+M);if(g.hasOwnProperty(A="CRYPTO"))if(M=g[A],M===!!M)if(M)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))z=M;else throw z=!M,Error(s+"crypto unavailable");else z=M;else throw Error(s+A+" not true or false: "+M);if(g.hasOwnProperty(A="MODULO_MODE")&&(M=g[A],b(M,0,9,A),ue=M),g.hasOwnProperty(A="POW_PRECISION")&&(M=g[A],b(M,0,w,A),De=M),g.hasOwnProperty(A="FORMAT"))if(M=g[A],typeof M=="object")ve=M;else throw Error(s+A+" not an object: "+M);if(g.hasOwnProperty(A="ALPHABET"))if(M=g[A],typeof M=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(M))de=M.slice(0,10)=="0123456789",Te=M;else throw Error(s+A+" invalid: "+M)}else throw Error(s+"Object expected: "+g);return{DECIMAL_PLACES:C,ROUNDING_MODE:V,EXPONENTIAL_AT:[H,_],RANGE:[ee,oe],CRYPTO:z,MODULO_MODE:ue,POW_PRECISION:De,FORMAT:ve,ALPHABET:Te}},ie.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!ie.DEBUG)return!0;var A,M,W=g.c,U=g.e,q=g.s;e:if({}.toString.call(W)=="[object Array]"){if((q===1||q===-1)&&U>=-w&&U<=w&&U===o(U)){if(W[0]===0){if(U===0&&W.length===1)return!0;break e}if(A=(U+1)%c,A<1&&(A+=c),String(W[0]).length==A){for(A=0;A<W.length;A++)if(M=W[A],M<0||M>=l||M!==o(M))break e;if(M!==0)return!0}}}else if(W===null&&U===null&&(q===null||q===1||q===-1))return!0;throw Error(s+"Invalid BigNumber: "+g)},ie.maximum=ie.max=function(){return Ie(arguments,-1)},ie.minimum=ie.min=function(){return Ie(arguments,1)},ie.random=(function(){var g=9007199254740992,A=Math.random()*g&2097151?function(){return o(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(M){var W,U,q,re,j,X=0,te=[],Q=new ie(O);if(M==null?M=C:b(M,0,w),re=i(M/c),z)if(crypto.getRandomValues){for(W=crypto.getRandomValues(new Uint32Array(re*=2));X<re;)j=W[X]*131072+(W[X+1]>>>11),j>=9e15?(U=crypto.getRandomValues(new Uint32Array(2)),W[X]=U[0],W[X+1]=U[1]):(te.push(j%1e14),X+=2);X=re/2}else if(crypto.randomBytes){for(W=crypto.randomBytes(re*=7);X<re;)j=(W[X]&31)*281474976710656+W[X+1]*1099511627776+W[X+2]*4294967296+W[X+3]*16777216+(W[X+4]<<16)+(W[X+5]<<8)+W[X+6],j>=9e15?crypto.randomBytes(7).copy(W,X):(te.push(j%1e14),X+=7);X=re/7}else throw z=!1,Error(s+"crypto unavailable");if(!z)for(;X<re;)j=A(),j<9e15&&(te[X++]=j%1e14);for(re=te[--X],M%=c,re&&M&&(j=f[c-M],te[X]=o(re/j)*j);te[X]===0;te.pop(),X--);if(X<0)te=[q=0];else{for(q=-1;te[0]===0;te.splice(0,1),q-=c);for(X=1,j=te[0];j>=10;j/=10,X++);X<c&&(q-=c-X)}return Q.e=q,Q.c=te,Q}})(),ie.sum=function(){for(var g=1,A=arguments,M=new ie(A[0]);g<A.length;)M=M.plus(A[g++]);return M},p=(function(){var g="0123456789";function A(M,W,U,q){for(var re,j=[0],X,te=0,Q=M.length;te<Q;){for(X=j.length;X--;j[X]*=W);for(j[0]+=q.indexOf(M.charAt(te++)),re=0;re<j.length;re++)j[re]>U-1&&(j[re+1]==null&&(j[re+1]=0),j[re+1]+=j[re]/U|0,j[re]%=U)}return j.reverse()}return function(M,W,U,q,re){var j,X,te,Q,le,fe,ye,Ve,Ke=M.indexOf("."),wt=C,et=V;for(Ke>=0&&(Q=De,De=0,M=M.replace(".",""),Ve=new ie(W),fe=Ve.pow(M.length-Ke),De=Q,Ve.c=A(G(x(fe.c),fe.e,"0"),10,U,g),Ve.e=Ve.c.length),ye=A(M,W,U,re?(j=Te,g):(j=g,Te)),te=Q=ye.length;ye[--Q]==0;ye.pop());if(!ye[0])return j.charAt(0);if(Ke<0?--te:(fe.c=ye,fe.e=te,fe.s=q,fe=N(fe,Ve,wt,et,U),ye=fe.c,le=fe.r,te=fe.e),X=te+wt+1,Ke=ye[X],Q=U/2,le=le||X<0||ye[X+1]!=null,le=et<4?(Ke!=null||le)&&(et==0||et==(fe.s<0?3:2)):Ke>Q||Ke==Q&&(et==4||le||et==6&&ye[X-1]&1||et==(fe.s<0?8:7)),X<1||!ye[0])M=le?G(j.charAt(1),-wt,j.charAt(0)):j.charAt(0);else{if(ye.length=X,le)for(--U;++ye[--X]>U;)ye[X]=0,X||(++te,ye=[1].concat(ye));for(Q=ye.length;!ye[--Q];);for(Ke=0,M="";Ke<=Q;M+=j.charAt(ye[Ke++]));M=G(M,te,j.charAt(0))}return M}})(),N=(function(){function g(W,U,q){var re,j,X,te,Q=0,le=W.length,fe=U%m,ye=U/m|0;for(W=W.slice();le--;)X=W[le]%m,te=W[le]/m|0,re=ye*X+te*fe,j=fe*X+re%m*m+Q,Q=(j/q|0)+(re/m|0)+ye*te,W[le]=j%q;return Q&&(W=[Q].concat(W)),W}function A(W,U,q,re){var j,X;if(q!=re)X=q>re?1:-1;else for(j=X=0;j<q;j++)if(W[j]!=U[j]){X=W[j]>U[j]?1:-1;break}return X}function M(W,U,q,re){for(var j=0;q--;)W[q]-=j,j=W[q]<U[q]?1:0,W[q]=j*re+W[q]-U[q];for(;!W[0]&&W.length>1;W.splice(0,1));}return function(W,U,q,re,j){var X,te,Q,le,fe,ye,Ve,Ke,wt,et,tt,vt,zt,Lt,Ut,Ft,Nt,xt=W.s==U.s?1:-1,St=W.c,at=U.c;if(!St||!St[0]||!at||!at[0])return new ie(!W.s||!U.s||(St?at&&St[0]==at[0]:!at)?NaN:St&&St[0]==0||!at?xt*0:xt/0);for(Ke=new ie(xt),wt=Ke.c=[],te=W.e-U.e,xt=q+te+1,j||(j=l,te=I(W.e/c)-I(U.e/c),xt=xt/c|0),Q=0;at[Q]==(St[Q]||0);Q++);if(at[Q]>(St[Q]||0)&&te--,xt<0)wt.push(1),le=!0;else{for(Lt=St.length,Ft=at.length,Q=0,xt+=2,fe=o(j/(at[0]+1)),fe>1&&(at=g(at,fe,j),St=g(St,fe,j),Ft=at.length,Lt=St.length),zt=Ft,et=St.slice(0,Ft),tt=et.length;tt<Ft;et[tt++]=0);Nt=at.slice(),Nt=[0].concat(Nt),Ut=at[0],at[1]>=j/2&&Ut++;do{if(fe=0,X=A(at,et,Ft,tt),X<0){if(vt=et[0],Ft!=tt&&(vt=vt*j+(et[1]||0)),fe=o(vt/Ut),fe>1)for(fe>=j&&(fe=j-1),ye=g(at,fe,j),Ve=ye.length,tt=et.length;A(ye,et,Ve,tt)==1;)fe--,M(ye,Ft<Ve?Nt:at,Ve,j),Ve=ye.length,X=1;else fe==0&&(X=fe=1),ye=at.slice(),Ve=ye.length;if(Ve<tt&&(ye=[0].concat(ye)),M(et,ye,tt,j),tt=et.length,X==-1)for(;A(at,et,Ft,tt)<1;)fe++,M(et,Ft<tt?Nt:at,tt,j),tt=et.length}else X===0&&(fe++,et=[0]);wt[Q++]=fe,et[0]?et[tt++]=St[zt]||0:(et=[St[zt]],tt=1)}while((zt++<Lt||et[0]!=null)&&xt--);le=et[0]!=null,wt[0]||wt.splice(0,1)}if(j==l){for(Q=1,xt=wt[0];xt>=10;xt/=10,Q++);Ee(Ke,q+(Ke.e=Q+te*c-1)+1,re,le)}else Ke.e=te,Ke.r=+le;return Ke}})();function ke(g,A,M,W){var U,q,re,j,X;if(M==null?M=V:b(M,0,8),!g.c)return g.toString();if(U=g.c[0],re=g.e,A==null)X=x(g.c),X=W==1||W==2&&(re<=H||re>=_)?L(X,re):G(X,re,"0");else if(g=Ee(new ie(g),A,M),q=g.e,X=x(g.c),j=X.length,W==1||W==2&&(A<=q||q<=H)){for(;j<A;X+="0",j++);X=L(X,q)}else if(A-=re,X=G(X,q,"0"),q+1>j){if(--A>0)for(X+=".";A--;X+="0");}else if(A+=q-j,A>0)for(q+1==j&&(X+=".");A--;X+="0");return g.s<0&&U?"-"+X:X}function Ie(g,A){for(var M,W,U=1,q=new ie(g[0]);U<g.length;U++)W=new ie(g[U]),(!W.s||(M=T(q,W))===A||M===0&&q.s===A)&&(q=W);return q}function Ze(g,A,M){for(var W=1,U=A.length;!A[--U];A.pop());for(U=A[0];U>=10;U/=10,W++);return(M=W+M*c-1)>oe?g.c=g.e=null:M<ee?g.c=[g.e=0]:(g.e=M,g.c=A),g}F=(function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,A=/^([^.]+)\.$/,M=/^\.([^.]+)$/,W=/^-?(Infinity|NaN)$/,U=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(q,re,j,X){var te,Q=j?re:re.replace(U,"");if(W.test(Q))q.s=isNaN(Q)?null:Q<0?-1:1;else{if(!j&&(Q=Q.replace(g,function(le,fe,ye){return te=(ye=ye.toLowerCase())=="x"?16:ye=="b"?2:8,!X||X==te?fe:le}),X&&(te=X,Q=Q.replace(A,"$1").replace(M,"0.$1")),re!=Q))return new ie(Q,te);if(ie.DEBUG)throw Error(s+"Not a"+(X?" base "+X:"")+" number: "+re);q.s=null}q.c=q.e=null}})();function Ee(g,A,M,W){var U,q,re,j,X,te,Q,le=g.c,fe=f;if(le){e:{for(U=1,j=le[0];j>=10;j/=10,U++);if(q=A-U,q<0)q+=c,re=A,X=le[te=0],Q=o(X/fe[U-re-1]%10);else if(te=i((q+1)/c),te>=le.length)if(W){for(;le.length<=te;le.push(0));X=Q=0,U=1,q%=c,re=q-c+1}else break e;else{for(X=j=le[te],U=1;j>=10;j/=10,U++);q%=c,re=q-c+U,Q=re<0?0:o(X/fe[U-re-1]%10)}if(W=W||A<0||le[te+1]!=null||(re<0?X:X%fe[U-re-1]),W=M<4?(Q||W)&&(M==0||M==(g.s<0?3:2)):Q>5||Q==5&&(M==4||W||M==6&&(q>0?re>0?X/fe[U-re]:0:le[te-1])%10&1||M==(g.s<0?8:7)),A<1||!le[0])return le.length=0,W?(A-=g.e+1,le[0]=fe[(c-A%c)%c],g.e=-A||0):le[0]=g.e=0,g;if(q==0?(le.length=te,j=1,te--):(le.length=te+1,j=fe[c-q],le[te]=re>0?o(X/fe[U-re]%fe[re])*j:0),W)for(;;)if(te==0){for(q=1,re=le[0];re>=10;re/=10,q++);for(re=le[0]+=j,j=1;re>=10;re/=10,j++);q!=j&&(g.e++,le[0]==l&&(le[0]=1));break}else{if(le[te]+=j,le[te]!=l)break;le[te--]=0,j=1}for(q=le.length;le[--q]===0;le.pop());}g.e>oe?g.c=g.e=null:g.e<ee&&(g.c=[g.e=0])}return g}function be(g){var A,M=g.e;return M===null?g.toString():(A=x(g.c),A=M<=H||M>=_?L(A,M):G(A,M,"0"),g.s<0?"-"+A:A)}return v.absoluteValue=v.abs=function(){var g=new ie(this);return g.s<0&&(g.s=1),g},v.comparedTo=function(g,A){return T(this,new ie(g,A))},v.decimalPlaces=v.dp=function(g,A){var M,W,U,q=this;if(g!=null)return b(g,0,w),A==null?A=V:b(A,0,8),Ee(new ie(q),g+q.e+1,A);if(!(M=q.c))return null;if(W=((U=M.length-1)-I(this.e/c))*c,U=M[U])for(;U%10==0;U/=10,W--);return W<0&&(W=0),W},v.dividedBy=v.div=function(g,A){return N(this,new ie(g,A),C,V)},v.dividedToIntegerBy=v.idiv=function(g,A){return N(this,new ie(g,A),0,1)},v.exponentiatedBy=v.pow=function(g,A){var M,W,U,q,re,j,X,te,Q,le=this;if(g=new ie(g),g.c&&!g.isInteger())throw Error(s+"Exponent not an integer: "+be(g));if(A!=null&&(A=new ie(A)),j=g.e>14,!le.c||!le.c[0]||le.c[0]==1&&!le.e&&le.c.length==1||!g.c||!g.c[0])return Q=new ie(Math.pow(+be(le),j?g.s*(2-R(g)):+be(g))),A?Q.mod(A):Q;if(X=g.s<0,A){if(A.c?!A.c[0]:!A.s)return new ie(NaN);W=!X&&le.isInteger()&&A.isInteger(),W&&(le=le.mod(A))}else{if(g.e>9&&(le.e>0||le.e<-1||(le.e==0?le.c[0]>1||j&&le.c[1]>=24e7:le.c[0]<8e13||j&&le.c[0]<=9999975e7)))return q=le.s<0&&R(g)?-0:0,le.e>-1&&(q=1/q),new ie(X?1/q:q);De&&(q=i(De/c+2))}for(j?(M=new ie(.5),X&&(g.s=1),te=R(g)):(U=Math.abs(+be(g)),te=U%2),Q=new ie(O);;){if(te){if(Q=Q.times(le),!Q.c)break;q?Q.c.length>q&&(Q.c.length=q):W&&(Q=Q.mod(A))}if(U){if(U=o(U/2),U===0)break;te=U%2}else if(g=g.times(M),Ee(g,g.e+1,1),g.e>14)te=R(g);else{if(U=+be(g),U===0)break;te=U%2}le=le.times(le),q?le.c&&le.c.length>q&&(le.c.length=q):W&&(le=le.mod(A))}return W?Q:(X&&(Q=O.div(Q)),A?Q.mod(A):q?Ee(Q,De,V,re):Q)},v.integerValue=function(g){var A=new ie(this);return g==null?g=V:b(g,0,8),Ee(A,A.e+1,g)},v.isEqualTo=v.eq=function(g,A){return T(this,new ie(g,A))===0},v.isFinite=function(){return!!this.c},v.isGreaterThan=v.gt=function(g,A){return T(this,new ie(g,A))>0},v.isGreaterThanOrEqualTo=v.gte=function(g,A){return(A=T(this,new ie(g,A)))===1||A===0},v.isInteger=function(){return!!this.c&&I(this.e/c)>this.c.length-2},v.isLessThan=v.lt=function(g,A){return T(this,new ie(g,A))<0},v.isLessThanOrEqualTo=v.lte=function(g,A){return(A=T(this,new ie(g,A)))===-1||A===0},v.isNaN=function(){return!this.s},v.isNegative=function(){return this.s<0},v.isPositive=function(){return this.s>0},v.isZero=function(){return!!this.c&&this.c[0]==0},v.minus=function(g,A){var M,W,U,q,re=this,j=re.s;if(g=new ie(g,A),A=g.s,!j||!A)return new ie(NaN);if(j!=A)return g.s=-A,re.plus(g);var X=re.e/c,te=g.e/c,Q=re.c,le=g.c;if(!X||!te){if(!Q||!le)return Q?(g.s=-A,g):new ie(le?re:NaN);if(!Q[0]||!le[0])return le[0]?(g.s=-A,g):new ie(Q[0]?re:V==3?-0:0)}if(X=I(X),te=I(te),Q=Q.slice(),j=X-te){for((q=j<0)?(j=-j,U=Q):(te=X,U=le),U.reverse(),A=j;A--;U.push(0));U.reverse()}else for(W=(q=(j=Q.length)<(A=le.length))?j:A,j=A=0;A<W;A++)if(Q[A]!=le[A]){q=Q[A]<le[A];break}if(q&&(U=Q,Q=le,le=U,g.s=-g.s),A=(W=le.length)-(M=Q.length),A>0)for(;A--;Q[M++]=0);for(A=l-1;W>j;){if(Q[--W]<le[W]){for(M=W;M&&!Q[--M];Q[M]=A);--Q[M],Q[W]+=l}Q[W]-=le[W]}for(;Q[0]==0;Q.splice(0,1),--te);return Q[0]?Ze(g,Q,te):(g.s=V==3?-1:1,g.c=[g.e=0],g)},v.modulo=v.mod=function(g,A){var M,W,U=this;return g=new ie(g,A),!U.c||!g.s||g.c&&!g.c[0]?new ie(NaN):!g.c||U.c&&!U.c[0]?new ie(U):(ue==9?(W=g.s,g.s=1,M=N(U,g,0,3),g.s=W,M.s*=W):M=N(U,g,0,ue),g=U.minus(M.times(g)),!g.c[0]&&ue==1&&(g.s=U.s),g)},v.multipliedBy=v.times=function(g,A){var M,W,U,q,re,j,X,te,Q,le,fe,ye,Ve,Ke,wt,et=this,tt=et.c,vt=(g=new ie(g,A)).c;if(!tt||!vt||!tt[0]||!vt[0])return!et.s||!g.s||tt&&!tt[0]&&!vt||vt&&!vt[0]&&!tt?g.c=g.e=g.s=null:(g.s*=et.s,!tt||!vt?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(W=I(et.e/c)+I(g.e/c),g.s*=et.s,X=tt.length,le=vt.length,X<le&&(Ve=tt,tt=vt,vt=Ve,U=X,X=le,le=U),U=X+le,Ve=[];U--;Ve.push(0));for(Ke=l,wt=m,U=le;--U>=0;){for(M=0,fe=vt[U]%wt,ye=vt[U]/wt|0,re=X,q=U+re;q>U;)te=tt[--re]%wt,Q=tt[re]/wt|0,j=ye*te+Q*fe,te=fe*te+j%wt*wt+Ve[q]+M,M=(te/Ke|0)+(j/wt|0)+ye*Q,Ve[q--]=te%Ke;Ve[q]=M}return M?++W:Ve.splice(0,1),Ze(g,Ve,W)},v.negated=function(){var g=new ie(this);return g.s=-g.s||null,g},v.plus=function(g,A){var M,W=this,U=W.s;if(g=new ie(g,A),A=g.s,!U||!A)return new ie(NaN);if(U!=A)return g.s=-A,W.minus(g);var q=W.e/c,re=g.e/c,j=W.c,X=g.c;if(!q||!re){if(!j||!X)return new ie(U/0);if(!j[0]||!X[0])return X[0]?g:new ie(j[0]?W:U*0)}if(q=I(q),re=I(re),j=j.slice(),U=q-re){for(U>0?(re=q,M=X):(U=-U,M=j),M.reverse();U--;M.push(0));M.reverse()}for(U=j.length,A=X.length,U-A<0&&(M=X,X=j,j=M,A=U),U=0;A;)U=(j[--A]=j[A]+X[A]+U)/l|0,j[A]=l===j[A]?0:j[A]%l;return U&&(j=[U].concat(j),++re),Ze(g,j,re)},v.precision=v.sd=function(g,A){var M,W,U,q=this;if(g!=null&&g!==!!g)return b(g,1,w),A==null?A=V:b(A,0,8),Ee(new ie(q),g,A);if(!(M=q.c))return null;if(U=M.length-1,W=U*c+1,U=M[U]){for(;U%10==0;U/=10,W--);for(U=M[0];U>=10;U/=10,W++);}return g&&q.e+1>W&&(W=q.e+1),W},v.shiftedBy=function(g){return b(g,-d,d),this.times("1e"+g)},v.squareRoot=v.sqrt=function(){var g,A,M,W,U,q=this,re=q.c,j=q.s,X=q.e,te=C+4,Q=new ie("0.5");if(j!==1||!re||!re[0])return new ie(!j||j<0&&(!re||re[0])?NaN:re?q:1/0);if(j=Math.sqrt(+be(q)),j==0||j==1/0?(A=x(re),(A.length+X)%2==0&&(A+="0"),j=Math.sqrt(+A),X=I((X+1)/2)-(X<0||X%2),j==1/0?A="5e"+X:(A=j.toExponential(),A=A.slice(0,A.indexOf("e")+1)+X),M=new ie(A)):M=new ie(j+""),M.c[0]){for(X=M.e,j=X+te,j<3&&(j=0);;)if(U=M,M=Q.times(U.plus(N(q,U,te,1))),x(U.c).slice(0,j)===(A=x(M.c)).slice(0,j))if(M.e<X&&--j,A=A.slice(j-3,j+1),A=="9999"||!W&&A=="4999"){if(!W&&(Ee(U,U.e+C+2,0),U.times(U).eq(q))){M=U;break}te+=4,j+=4,W=1}else{(!+A||!+A.slice(1)&&A.charAt(0)=="5")&&(Ee(M,M.e+C+2,1),g=!M.times(M).eq(q));break}}return Ee(M,M.e+C+1,V,g)},v.toExponential=function(g,A){return g!=null&&(b(g,0,w),g++),ke(this,g,A,1)},v.toFixed=function(g,A){return g!=null&&(b(g,0,w),g=g+this.e+1),ke(this,g,A)},v.toFormat=function(g,A,M){var W,U=this;if(M==null)g!=null&&A&&typeof A=="object"?(M=A,A=null):g&&typeof g=="object"?(M=g,g=A=null):M=ve;else if(typeof M!="object")throw Error(s+"Argument not an object: "+M);if(W=U.toFixed(g,A),U.c){var q,re=W.split("."),j=+M.groupSize,X=+M.secondaryGroupSize,te=M.groupSeparator||"",Q=re[0],le=re[1],fe=U.s<0,ye=fe?Q.slice(1):Q,Ve=ye.length;if(X&&(q=j,j=X,X=q,Ve-=q),j>0&&Ve>0){for(q=Ve%j||j,Q=ye.substr(0,q);q<Ve;q+=j)Q+=te+ye.substr(q,j);X>0&&(Q+=te+ye.slice(q)),fe&&(Q="-"+Q)}W=le?Q+(M.decimalSeparator||"")+((X=+M.fractionGroupSize)?le.replace(new RegExp("\\d{"+X+"}\\B","g"),"$&"+(M.fractionGroupSeparator||"")):le):Q}return(M.prefix||"")+W+(M.suffix||"")},v.toFraction=function(g){var A,M,W,U,q,re,j,X,te,Q,le,fe,ye=this,Ve=ye.c;if(g!=null&&(j=new ie(g),!j.isInteger()&&(j.c||j.s!==1)||j.lt(O)))throw Error(s+"Argument "+(j.isInteger()?"out of range: ":"not an integer: ")+be(j));if(!Ve)return new ie(ye);for(A=new ie(O),te=M=new ie(O),W=X=new ie(O),fe=x(Ve),q=A.e=fe.length-ye.e-1,A.c[0]=f[(re=q%c)<0?c+re:re],g=!g||j.comparedTo(A)>0?q>0?A:te:j,re=oe,oe=1/0,j=new ie(fe),X.c[0]=0;Q=N(j,A,0,1),U=M.plus(Q.times(W)),U.comparedTo(g)!=1;)M=W,W=U,te=X.plus(Q.times(U=te)),X=U,A=j.minus(Q.times(U=A)),j=U;return U=N(g.minus(M),W,0,1),X=X.plus(U.times(te)),M=M.plus(U.times(W)),X.s=te.s=ye.s,q=q*2,le=N(te,W,q,V).minus(ye).abs().comparedTo(N(X,M,q,V).minus(ye).abs())<1?[te,W]:[X,M],oe=re,le},v.toNumber=function(){return+be(this)},v.toPrecision=function(g,A){return g!=null&&b(g,1,w),ke(this,g,A,2)},v.toString=function(g){var A,M=this,W=M.s,U=M.e;return U===null?W?(A="Infinity",W<0&&(A="-"+A)):A="NaN":(g==null?A=U<=H||U>=_?L(x(M.c),U):G(x(M.c),U,"0"):g===10&&de?(M=Ee(new ie(M),C+U+1,V),A=G(x(M.c),M.e,"0")):(b(g,2,Te.length,"Base"),A=p(G(x(M.c),U,"0"),10,g,W,!0)),W<0&&M.c[0]&&(A="-"+A)),A},v.valueOf=v.toJSON=function(){return be(this)},v._isBigNumber=!0,E!=null&&ie.set(E),ie}function I(E){var N=E|0;return E>0||E===N?N:N-1}function x(E){for(var N,p,F=1,v=E.length,O=E[0]+"";F<v;){for(N=E[F++]+"",p=c-N.length;p--;N="0"+N);O+=N}for(v=O.length;O.charCodeAt(--v)===48;);return O.slice(0,v+1||1)}function T(E,N){var p,F,v=E.c,O=N.c,C=E.s,V=N.s,H=E.e,_=N.e;if(!C||!V)return null;if(p=v&&!v[0],F=O&&!O[0],p||F)return p?F?0:-V:C;if(C!=V)return C;if(p=C<0,F=H==_,!v||!O)return F?0:!v^p?1:-1;if(!F)return H>_^p?1:-1;for(V=(H=v.length)<(_=O.length)?H:_,C=0;C<V;C++)if(v[C]!=O[C])return v[C]>O[C]^p?1:-1;return H==_?0:H>_^p?1:-1}function b(E,N,p,F){if(E<N||E>p||E!==o(E))throw Error(s+(F||"Argument")+(typeof E=="number"?E<N||E>p?" out of range: ":" not an integer: ":" not a primitive number: ")+String(E))}function R(E){var N=E.c.length-1;return I(E.e/c)==N&&E.c[N]%2!=0}function L(E,N){return(E.length>1?E.charAt(0)+"."+E.slice(1):E)+(N<0?"e":"e+")+N}function G(E,N,p){var F,v;if(N<0){for(v=p+".";++N;v+=p);E=v+E}else if(F=E.length,++N>F){for(v=p,N-=F;--N;v+=p);E+=v}else N<F&&(E=E.slice(0,N)+"."+E.slice(N));return E}t=k(),t.default=t.BigNumber=t,n.exports?n.exports=t:(e||(e=typeof self<"u"&&self?self:window),e.BigNumber=t)})(wM)})(kd)),kd.exports}var R1;function SM(){return R1||(R1=1,(function(n){var e=MA(),t=n.exports;(function(){var r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,i,o,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},a;function l(d){return r.lastIndex=0,r.test(d)?'"'+d.replace(r,function(f){var m=s[f];return typeof m=="string"?m:"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+d+'"'}function c(d,f){var m,w,k,I,x=i,T,b=f[d],R=b!=null&&(b instanceof e||e.isBigNumber(b));switch(b&&typeof b=="object"&&typeof b.toJSON=="function"&&(b=b.toJSON(d)),typeof a=="function"&&(b=a.call(f,d,b)),typeof b){case"string":return R?b:l(b);case"number":return isFinite(b)?String(b):"null";case"boolean":case"null":case"bigint":return String(b);case"object":if(!b)return"null";if(i+=o,T=[],Object.prototype.toString.apply(b)==="[object Array]"){for(I=b.length,m=0;m<I;m+=1)T[m]=c(m,b)||"null";return k=T.length===0?"[]":i?`[
|
|
24
|
+
`+i+T.join(`,
|
|
25
|
+
`+i)+`
|
|
26
|
+
`+x+"]":"["+T.join(",")+"]",i=x,k}if(a&&typeof a=="object")for(I=a.length,m=0;m<I;m+=1)typeof a[m]=="string"&&(w=a[m],k=c(w,b),k&&T.push(l(w)+(i?": ":":")+k));else Object.keys(b).forEach(function(L){var G=c(L,b);G&&T.push(l(L)+(i?": ":":")+G)});return k=T.length===0?"{}":i?`{
|
|
27
|
+
`+i+T.join(`,
|
|
28
|
+
`+i)+`
|
|
29
|
+
`+x+"}":"{"+T.join(",")+"}",i=x,k}}typeof t.stringify!="function"&&(t.stringify=function(d,f,m){var w;if(i="",o="",typeof m=="number")for(w=0;w<m;w+=1)o+=" ";else typeof m=="string"&&(o=m);if(a=f,f&&typeof f!="function"&&(typeof f!="object"||typeof f.length!="number"))throw new Error("JSON.stringify");return c("",{"":d})})})()})(fp)),fp.exports}var gp,C1;function vM(){if(C1)return gp;C1=1;var n=null;const e=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,t=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;var r=function(i){var o={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(i!=null){if(i.strict===!0&&(o.strict=!0),i.storeAsString===!0&&(o.storeAsString=!0),o.alwaysParseAsBig=i.alwaysParseAsBig===!0?i.alwaysParseAsBig:!1,o.useNativeBigInt=i.useNativeBigInt===!0?i.useNativeBigInt:!1,typeof i.constructorAction<"u")if(i.constructorAction==="error"||i.constructorAction==="ignore"||i.constructorAction==="preserve")o.constructorAction=i.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${i.constructorAction}`);if(typeof i.protoAction<"u")if(i.protoAction==="error"||i.protoAction==="ignore"||i.protoAction==="preserve")o.protoAction=i.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${i.protoAction}`)}var s,a,l={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
30
|
+
`,r:"\r",t:" "},c,d=function(R){throw{name:"SyntaxError",message:R,at:s,text:c}},f=function(R){return R&&R!==a&&d("Expected '"+R+"' instead of '"+a+"'"),a=c.charAt(s),s+=1,a},m=function(){var R,L="";for(a==="-"&&(L="-",f("-"));a>="0"&&a<="9";)L+=a,f();if(a===".")for(L+=".";f()&&a>="0"&&a<="9";)L+=a;if(a==="e"||a==="E")for(L+=a,f(),(a==="-"||a==="+")&&(L+=a,f());a>="0"&&a<="9";)L+=a,f();if(R=+L,!isFinite(R))d("Bad number");else return n==null&&(n=MA()),L.length>15?o.storeAsString?L:o.useNativeBigInt?BigInt(L):new n(L):o.alwaysParseAsBig?o.useNativeBigInt?BigInt(R):new n(R):R},w=function(){var R,L,G="",E;if(a==='"')for(var N=s;f();){if(a==='"')return s-1>N&&(G+=c.substring(N,s-1)),f(),G;if(a==="\\"){if(s-1>N&&(G+=c.substring(N,s-1)),f(),a==="u"){for(E=0,L=0;L<4&&(R=parseInt(f(),16),!!isFinite(R));L+=1)E=E*16+R;G+=String.fromCharCode(E)}else if(typeof l[a]=="string")G+=l[a];else break;N=s}}d("Bad string")},k=function(){for(;a&&a<=" ";)f()},I=function(){switch(a){case"t":return f("t"),f("r"),f("u"),f("e"),!0;case"f":return f("f"),f("a"),f("l"),f("s"),f("e"),!1;case"n":return f("n"),f("u"),f("l"),f("l"),null}d("Unexpected '"+a+"'")},x,T=function(){var R=[];if(a==="["){if(f("["),k(),a==="]")return f("]"),R;for(;a;){if(R.push(x()),k(),a==="]")return f("]"),R;f(","),k()}}d("Bad array")},b=function(){var R,L=Object.create(null);if(a==="{"){if(f("{"),k(),a==="}")return f("}"),L;for(;a;){if(R=w(),k(),f(":"),o.strict===!0&&Object.hasOwnProperty.call(L,R)&&d('Duplicate key "'+R+'"'),e.test(R)===!0?o.protoAction==="error"?d("Object contains forbidden prototype property"):o.protoAction==="ignore"?x():L[R]=x():t.test(R)===!0?o.constructorAction==="error"?d("Object contains forbidden constructor property"):o.constructorAction==="ignore"?x():L[R]=x():L[R]=x(),k(),a==="}")return f("}"),L;f(","),k()}}d("Bad object")};return x=function(){switch(k(),a){case"{":return b();case"[":return T();case'"':return w();case"-":return m();default:return a>="0"&&a<="9"?m():I()}},function(R,L){var G;return c=R+"",s=0,a=" ",G=x(),k(),a&&d("Syntax error"),typeof L=="function"?(function E(N,p){var F,v=N[p];return v&&typeof v=="object"&&Object.keys(v).forEach(function(O){F=E(v,O),F!==void 0?v[O]=F:delete v[O]}),L.call(N,p,v)})({"":G},""):G}};return gp=r,gp}var P1;function xM(){if(P1)return tl.exports;P1=1;var n=SM().stringify,e=vM();return tl.exports=function(t){return{parse:e(t),stringify:n}},tl.exports.parse=e(),tl.exports.stringify=n,tl.exports}var EM=xM();const bM=cs(EM);var Bn;(function(n){n.UNSAFE="unsafe",n.SAFE="safe",n.MIXED="mixed",n.BIGINT="bigint"})(Bn||(Bn={}));const RA=bM({useNativeBigInt:!0,strict:!0});function Ux(n,{intDecoding:e}){if(e!==Bn.SAFE&&e!==Bn.UNSAFE&&e!==Bn.BIGINT&&e!==Bn.MIXED)throw new Error(`Invalid intDecoding option: ${e}`);return RA.parse(n,(t,r)=>{if(r!=null&&typeof r=="object"&&Object.getPrototypeOf(r)==null&&Object.setPrototypeOf(r,Object.prototype),typeof r=="bigint"){if(e===Bn.SAFE&&r>Number.MAX_SAFE_INTEGER)throw new Error(`Integer exceeds maximum safe integer: ${r.toString()}. Try parsing with a different intDecoding option.`);return e===Bn.BIGINT||e===Bn.MIXED&&r>Number.MAX_SAFE_INTEGER?r:Number(r)}return typeof r=="number"&&e===Bn.BIGINT&&Number.isInteger(r)?BigInt(r):r})}function Xs(n,e,t){return RA.stringify(n,e,t)}function Fi(n,e){return n.length!==e.length?!1:Array.from(n).every((t,r)=>t===e[r])}function Un(...n){const e=n.reduce((i,o)=>i+o.length,0),t=new Uint8Array(e);let r=0;for(let i=0;i<n.length;i++)t.set(n[i],r),r+=n[i].length;return t}function Bf(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"}function kM(){const{navigator:n}=globalThis;return typeof n=="object"&&n.product==="ReactNative"}function Ye(n){if(typeof n>"u")throw new Error("Value is undefined");if(typeof n=="bigint"){if(n>BigInt(Number.MAX_SAFE_INTEGER)||n<BigInt(Number.MIN_SAFE_INTEGER))throw new Error(`BigInt value ${n} is not a safe integer`);return Number(n)}if(typeof n=="number"){if(Number.isSafeInteger(n))return n;throw new Error(`Value ${n} is not a safe integer`)}throw new Error(`Unexpected type ${typeof n}, ${n}`)}function Yn(n){const e=Ye(n);if(e<0)throw new Error(`Value ${e} is negative`);return e}function Ce(n){if(typeof n>"u")throw new Error("Value is undefined");if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new Error(`Value ${n} is not a safe integer`);return BigInt(n)}throw new Error(`Unexpected type ${typeof n}, ${n}`)}function yn(n){const e=Ce(n);if(e<0||e>BigInt("0xffffffffffffffff"))throw new Error(`Value ${e} is not a uint64`);return e}function Zi(n){return yM.sha512_256.array(n)}function AM(n){return kM()&&console.warn("It looks like you're running in react-native. In order to perform common crypto operations you will need to polyfill common operations such as crypto.getRandomValues"),co.randomBytes(n)}function CA(n){return co.sign.keyPair.fromSeed(n)}function DM(){const n=AM(co.box.secretKeyLength);return CA(n)}function PA(n){return n===co.sign.signatureLength}function Vf(n){return co.sign.keyPair.fromSecretKey(n)}function jl(n,e){return co.sign.detached(n,e)}function $A(n,e){return co.verify(n,e)}function Of(n,e,t){return co.sign.detached.verify(n,e,t)}const BA=co.sign.publicKeyLength,$1=32,Mm=32;var pp={exports:{}};/*
|
|
31
|
+
* [hi-base32]{@link https://github.com/emn178/hi-base32}
|
|
32
|
+
*
|
|
33
|
+
* @version 0.5.0
|
|
34
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
35
|
+
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
36
|
+
* @license MIT
|
|
37
|
+
*/var B1;function FM(){return B1||(B1=1,(function(n){(function(){var e=typeof window=="object"?window:{},t=!e.HI_BASE32_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;t&&(e=$f);var r=!e.HI_BASE32_NO_COMMON_JS&&!0&&n.exports,i="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),o={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},s=[0,0,0,0,0,0,0,0],a=function(x,T){T.length>10&&(T="..."+T.substr(-10));var b=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+x+" bytes: "+T+" <-");throw b.position=x,b},l=function(x){for(var T="",b=x.length,R=0,L=0,G,E;R<b;){if(G=x[R++],G<=127){T+=String.fromCharCode(G);continue}else G>191&&G<=223?(E=G&31,L=1):G<=239?(E=G&15,L=2):G<=247?(E=G&7,L=3):a(R,T);for(var N=0;N<L;++N)G=x[R++],(G<128||G>191)&&a(R,T),E<<=6,E+=G&63;E>=55296&&E<=57343&&a(R,T),E>1114111&&a(R,T),E<=65535?T+=String.fromCharCode(E):(E-=65536,T+=String.fromCharCode((E>>10)+55296),T+=String.fromCharCode((E&1023)+56320))}return T},c=function(x){if(x==="")return[];if(!/^[A-Z2-7=]+$/.test(x))throw new Error("Invalid base32 characters");x=x.replace(/=/g,"");for(var T,b,R,L,G,E,N,p,F=[],v=0,O=x.length,C=0,V=O>>3<<3;C<V;)T=o[x.charAt(C++)],b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],E=o[x.charAt(C++)],N=o[x.charAt(C++)],p=o[x.charAt(C++)],F[v++]=(T<<3|b>>>2)&255,F[v++]=(b<<6|R<<1|L>>>4)&255,F[v++]=(L<<4|G>>>1)&255,F[v++]=(G<<7|E<<2|N>>>3)&255,F[v++]=(N<<5|p)&255;var H=O-V;return H===2?(T=o[x.charAt(C++)],b=o[x.charAt(C++)],F[v++]=(T<<3|b>>>2)&255):H===4?(T=o[x.charAt(C++)],b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],F[v++]=(T<<3|b>>>2)&255,F[v++]=(b<<6|R<<1|L>>>4)&255):H===5?(T=o[x.charAt(C++)],b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],F[v++]=(T<<3|b>>>2)&255,F[v++]=(b<<6|R<<1|L>>>4)&255,F[v++]=(L<<4|G>>>1)&255):H===7&&(T=o[x.charAt(C++)],b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],E=o[x.charAt(C++)],N=o[x.charAt(C++)],F[v++]=(T<<3|b>>>2)&255,F[v++]=(b<<6|R<<1|L>>>4)&255,F[v++]=(L<<4|G>>>1)&255,F[v++]=(G<<7|E<<2|N>>>3)&255),F},d=function(x){for(var T,b,R,L,G,E="",N=x.length,p=0,F=parseInt(N/5)*5;p<F;)T=x.charCodeAt(p++),b=x.charCodeAt(p++),R=x.charCodeAt(p++),L=x.charCodeAt(p++),G=x.charCodeAt(p++),E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[(L<<3|G>>>5)&31]+i[G&31];var v=N-F;return v===1?(T=x.charCodeAt(p),E+=i[T>>>3]+i[T<<2&31]+"======"):v===2?(T=x.charCodeAt(p++),b=x.charCodeAt(p),E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[b<<4&31]+"===="):v===3?(T=x.charCodeAt(p++),b=x.charCodeAt(p++),R=x.charCodeAt(p),E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[R<<1&31]+"==="):v===4&&(T=x.charCodeAt(p++),b=x.charCodeAt(p++),R=x.charCodeAt(p++),L=x.charCodeAt(p),E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[L<<3&31]+"="),E},f=function(x){var T,b,R,L,G,E,N=!1,p="",F=0,v,O=0,C=x.length;if(x==="")return p;do{for(s[0]=s[5],s[1]=s[6],s[2]=s[7],v=O;F<C&&v<5;++F)E=x.charCodeAt(F),E<128?s[v++]=E:E<2048?(s[v++]=192|E>>6,s[v++]=128|E&63):E<55296||E>=57344?(s[v++]=224|E>>12,s[v++]=128|E>>6&63,s[v++]=128|E&63):(E=65536+((E&1023)<<10|x.charCodeAt(++F)&1023),s[v++]=240|E>>18,s[v++]=128|E>>12&63,s[v++]=128|E>>6&63,s[v++]=128|E&63);O=v-5,F===C&&++F,F>C&&v<6&&(N=!0),T=s[0],v>4?(b=s[1],R=s[2],L=s[3],G=s[4],p+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[(L<<3|G>>>5)&31]+i[G&31]):v===1?p+=i[T>>>3]+i[T<<2&31]+"======":v===2?(b=s[1],p+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[b<<4&31]+"===="):v===3?(b=s[1],R=s[2],p+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[R<<1&31]+"==="):(b=s[1],R=s[2],L=s[3],p+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[L<<3&31]+"=")}while(!N);return p},m=function(x){for(var T,b,R,L,G,E="",N=x.length,p=0,F=parseInt(N/5)*5;p<F;)T=x[p++],b=x[p++],R=x[p++],L=x[p++],G=x[p++],E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[(L<<3|G>>>5)&31]+i[G&31];var v=N-F;return v===1?(T=x[p],E+=i[T>>>3]+i[T<<2&31]+"======"):v===2?(T=x[p++],b=x[p],E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[b<<4&31]+"===="):v===3?(T=x[p++],b=x[p++],R=x[p],E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[R<<1&31]+"==="):v===4&&(T=x[p++],b=x[p++],R=x[p++],L=x[p],E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[L<<3&31]+"="),E},w=function(x,T){var b=typeof x!="string";return b&&x.constructor===ArrayBuffer&&(x=new Uint8Array(x)),b?m(x):T?d(x):f(x)},k=function(x,T){if(!T)return l(c(x));if(x==="")return"";if(!/^[A-Z2-7=]+$/.test(x))throw new Error("Invalid base32 characters");var b,R,L,G,E,N,p,F,v="",O=x.indexOf("=");O===-1&&(O=x.length);for(var C=0,V=O>>3<<3;C<V;)b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],E=o[x.charAt(C++)],N=o[x.charAt(C++)],p=o[x.charAt(C++)],F=o[x.charAt(C++)],v+=String.fromCharCode((b<<3|R>>>2)&255)+String.fromCharCode((R<<6|L<<1|G>>>4)&255)+String.fromCharCode((G<<4|E>>>1)&255)+String.fromCharCode((E<<7|N<<2|p>>>3)&255)+String.fromCharCode((p<<5|F)&255);var H=O-V;return H===2?(b=o[x.charAt(C++)],R=o[x.charAt(C++)],v+=String.fromCharCode((b<<3|R>>>2)&255)):H===4?(b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],v+=String.fromCharCode((b<<3|R>>>2)&255)+String.fromCharCode((R<<6|L<<1|G>>>4)&255)):H===5?(b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],E=o[x.charAt(C++)],v+=String.fromCharCode((b<<3|R>>>2)&255)+String.fromCharCode((R<<6|L<<1|G>>>4)&255)+String.fromCharCode((G<<4|E>>>1)&255)):H===7&&(b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],E=o[x.charAt(C++)],N=o[x.charAt(C++)],p=o[x.charAt(C++)],v+=String.fromCharCode((b<<3|R>>>2)&255)+String.fromCharCode((R<<6|L<<1|G>>>4)&255)+String.fromCharCode((G<<4|E>>>1)&255)+String.fromCharCode((E<<7|N<<2|p>>>3)&255)),v},I={encode:w,decode:k};k.asBytes=c,r?n.exports=I:e.base32=I})()})(pp)),pp.exports}var TM=FM();const _l=cs(TM);function VA(n){if(!(typeof n=="bigint"||Number.isInteger(n))||n<0||n>BigInt("0xffffffffffffffff"))throw new Error("Input is not a 64-bit unsigned integer");const t=new Uint8Array(8);return new DataView(t.buffer).setBigUint64(0,BigInt(n)),t}function IM(n,e="safe"){if(e!=="safe"&&e!=="mixed"&&e!=="bigint")throw new Error(`Unknown decodingMode option: ${e}`);if(n.byteLength===0||n.byteLength>8)throw new Error(`Data has unacceptable length. Expected length is between 1 and 8, got ${n.byteLength}`);const t=new Uint8Array(8-n.byteLength),r=Un(t,n),o=new DataView(r.buffer).getBigUint64(0),s=o>BigInt(Number.MAX_SAFE_INTEGER);if(e==="safe"){if(s)throw new Error(`Integer exceeds maximum safe integer: ${o.toString()}. Try decoding with "mixed" or "safe" decodingMode.`);return Number(o)}return e==="mixed"&&!s?Number(o):o}function ut(n){if(Bf())return new Uint8Array(Buffer.from(n,"base64"));const e=atob(n);return Uint8Array.from(e,t=>t.codePointAt(0))}function Qn(n){if(Bf())return Buffer.from(n).toString("base64");const e=Array.from(n,t=>String.fromCodePoint(t)).join("");return btoa(e)}function Nf(n){return new TextDecoder().decode(n)}function Ti(n){return typeof n=="string"?new TextEncoder().encode(n):n}function Lf(n){return Bf()?Buffer.from(n).toString("hex"):Array.from(n).map(e=>e.toString(16).padStart(2,"0")).join("")}function MM(n){if(Bf())return Buffer.from(n,"hex");let e=n;n.length%2!==0&&(e=n.padStart(1,"0"));const t=new Uint8Array(e.length/2);for(let r=0;r<e.length/2;r++)t[r]=parseInt(e.slice(2*r,2*r+2),16);return t}const ms=36,Dl=4,mp=58,RM="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ",nl="address seems to be malformed",CM="wrong checksum for address";function V1(n){return Uint8Array.from(Zi(n).slice($1-Dl,$1))}let Ot=class Ad{constructor(e){if(!(e instanceof Uint8Array))throw new Error(`${nl}: ${e} is not Uint8Array, type ${typeof e}`);if(e.length!==ms-Dl)throw new Error(`${nl}: 0x${Lf(e)}, length ${e.length}`);this.publicKey=e}equals(e){return e instanceof Ad&&Fi(this.publicKey,e.publicKey)}checksum(){return V1(this.publicKey)}toString(){return _l.encode(Un(this.publicKey,this.checksum())).slice(0,mp)}static fromString(e){if(typeof e!="string")throw new Error(`${nl}: expected string, got ${typeof e}, ${e}`);if(e.length!==mp)throw new Error(`${nl}: expected length ${mp}, got ${e.length}: ${e}`);const t=_l.decode.asBytes(e);if(t.length!==ms)throw new Error(`${nl}: expected byte length ${ms}, got ${t.length}`);const r=new Uint8Array(t.slice(0,ms-Dl)),i=new Uint8Array(t.slice(BA,ms)),o=V1(r);if(!Fi(o,i))throw new Error(CM);return new Ad(r)}static zeroAddress(){return new Ad(new Uint8Array(ms-Dl))}};function OA(n){return Ot.fromString(n)}function NA(n){try{Ot.fromString(n)}catch{return!1}return!0}function LA(n){return new Ot(n).toString()}const PM=new TextEncoder().encode("appID");function Xd(n){const e=Un(PM,VA(n)),t=Zi(e);return new Ot(Uint8Array.from(t))}const UA=1e6,jx="Microalgos should be positive and less than 2^53 - 1.";function $M(n){if(n<0||!Number.isSafeInteger(n))throw new Error(jx);return n/UA}function BM(n){const e=n*UA;return Math.round(e)}let VM=class extends Error{constructor(e,t){super(e),this.response=t,this.name="URLTokenBaseHTTPError",this.response=t}},OM=class tc{constructor(e,t,r,i={}){this.defaultHeaders=i;const o=t.endsWith("/")?t:`${t}/`,s=new URL(o);if(typeof r<"u"&&(s.port=r.toString()),s.protocol.length===0)throw new Error("Invalid base server URL, protocol must be defined.");this.baseURL=s,this.tokenHeader=e}getURL(e,t){let r;e.startsWith("./")?r=e:e.startsWith("/")?r=`.${e}`:r=`./${e}`;const i=new URL(r,this.baseURL);if(t)for(const[o,s]of Object.entries(t))i.searchParams.set(o,s.toString());return i.toString()}static formatFetchResponseHeaders(e){const t={};return e.forEach((r,i)=>{t[r]=i}),t}static async checkHttpError(e){if(e.ok)return;let t,r;try{t=new Uint8Array(await e.arrayBuffer());const o=JSON.parse(new TextDecoder().decode(t));o.message&&(r=o.message)}catch{}let i=`Network request error. Received status ${e.status} (${e.statusText})`;throw r&&(i+=`: ${r}`),new VM(i,{body:t??new Uint8Array,status:e.status,headers:tc.formatFetchResponseHeaders(e.headers)})}static async formatFetchResponse(e){return await this.checkHttpError(e),{body:new Uint8Array(await e.arrayBuffer()),status:e.status,headers:tc.formatFetchResponseHeaders(e.headers)}}async get(e,t,r,i){const o={...this.tokenHeader,...this.defaultHeaders,...r??{}},s=await fetch(this.getURL(e,t),{headers:o,...i??{}});return tc.formatFetchResponse(s)}async post(e,t,r,i,o){const s={...this.tokenHeader,...this.defaultHeaders,...i??{}},a=await fetch(this.getURL(e,r),{method:"POST",body:t,headers:s,...o??{}});return tc.formatFetchResponse(a)}async delete(e,t,r,i,o){const s={...this.tokenHeader,...this.defaultHeaders,...i??{}},a=await fetch(this.getURL(e,r),{method:"DELETE",body:t,headers:s,...o??{}});return tc.formatFetchResponse(a)}},NM=class{constructor(e){this.body=e.body,this.text=e.text,this.format=e.format,this.headers=e.headers,this.status=e.status,this.ok=e.ok}getJSONText(){if(this.text===void 0)throw new Error(`Response body does not contain JSON data. Format is ${this.format}`);return this.text}parseBodyAsJSON(e){if(this.text===void 0)throw new Error(`Response body does not contain JSON data. Format is ${this.format}`);return Rm.parseJSON(this.text,this.status,e)}};function LM(n){for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(!n[e]||n[e].length===0)&&delete n[e];return n}function O1(n){return Object.keys(n).reduce((e,t)=>(e[t.toLowerCase()]=n[t],e),{})}function UM(n){if(n!==void 0&&Object.prototype.hasOwnProperty.call(n,"format"))switch(n.format){case"msgpack":return"application/msgpack";case"json":default:return"application/json"}else return"application/json"}let Rm=class hi{constructor(e,t,r,i={}){t!==void 0?this.bc=new OM(e,t,r,i):this.bc=e}static parseJSON(e,t,r){try{return e?Ux(e,r):null}catch(i){const o=i;throw o.rawResponse=e||null,o.statusCode=t,o}}static serializeData(e,t){if(!e)return new Uint8Array(0);if(t["content-type"]==="application/json")return new TextEncoder().encode(Xs(e));if(typeof e=="string")return new TextEncoder().encode(e);if(e instanceof Uint8Array)return e;throw new Error("provided data is neither a string nor a Uint8Array and content-type is not application/json")}static prepareResponse(e,t){const{body:r}=e;let i;return t!=="application/msgpack"&&(i=r&&new TextDecoder().decode(r)||""),new NM({...e,format:t,text:i,ok:Math.trunc(e.status/100)===2})}static prepareResponseError(e){return e.response&&(e.response=hi.prepareResponse(e.response,"application/json"),e.status=e.response.status),e}async get({relativePath:e,query:t,requestHeaders:r,customOptions:i}){const o=UM(t),s={...r??{},accept:o};try{const a=await this.bc.get(e,t?LM(t):void 0,s,i);return hi.prepareResponse(a,o)}catch(a){throw hi.prepareResponseError(a)}}async post({relativePath:e,data:t,query:r,requestHeaders:i,customOptions:o}){const s={"content-type":"application/json",...O1(i??{})};try{const a=await this.bc.post(e,hi.serializeData(t,s),r,s,o);return hi.prepareResponse(a,"application/json")}catch(a){throw hi.prepareResponseError(a)}}async delete({relativePath:e,data:t,requestHeaders:r,customOptions:i}){const o={"content-type":"application/json",...O1(r??{})};try{const s=await this.bc.delete(e,typeof t<"u"?hi.serializeData(t,o):void 0,void 0,o,i);return hi.prepareResponse(s,"application/json")}catch(s){throw hi.prepareResponseError(s)}}};function jM(n,e=""){const t={};return e===""||(t[n]=e),t}function _M(n){return typeof n.get=="function"}let _x=class{constructor(e,t,r,i,o={}){if(_M(t))this.c=new Rm(t);else{let s;typeof t=="string"?s=jM(e,t):s=t,this.c=new Rm(s,r,i,o)}}};function zM(n){for(var e=n.length,t=0,r=0;r<e;){var i=n.charCodeAt(r++);if((i&4294967168)===0){t++;continue}else if((i&4294965248)===0)t+=2;else{if(i>=55296&&i<=56319&&r<e){var o=n.charCodeAt(r);(o&64512)===56320&&(++r,i=((i&1023)<<10)+(o&1023)+65536)}(i&4294901760)===0?t+=3:t+=4}}return t}function qM(n,e,t){for(var r=n.length,i=t,o=0;o<r;){var s=n.charCodeAt(o++);if((s&4294967168)===0){e[i++]=s;continue}else if((s&4294965248)===0)e[i++]=s>>6&31|192;else{if(s>=55296&&s<=56319&&o<r){var a=n.charCodeAt(o);(a&64512)===56320&&(++o,s=((s&1023)<<10)+(a&1023)+65536)}(s&4294901760)===0?(e[i++]=s>>12&15|224,e[i++]=s>>6&63|128):(e[i++]=s>>18&7|240,e[i++]=s>>12&63|128,e[i++]=s>>6&63|128)}e[i++]=s&63|128}}var HM=new TextEncoder,GM=50;function KM(n,e,t){HM.encodeInto(n,e.subarray(t))}function WM(n,e,t){n.length>GM?KM(n,e,t):qM(n,e,t)}var JM=4096;function jA(n,e,t){for(var r=e,i=r+t,o=[],s="";r<i;){var a=n[r++];if((a&128)===0)o.push(a);else if((a&224)===192){var l=n[r++]&63;o.push((a&31)<<6|l)}else if((a&240)===224){var l=n[r++]&63,c=n[r++]&63;o.push((a&31)<<12|l<<6|c)}else if((a&248)===240){var l=n[r++]&63,c=n[r++]&63,d=n[r++]&63,f=(a&7)<<18|l<<12|c<<6|d;f>65535&&(f-=65536,o.push(f>>>10&1023|55296),f=56320|f&1023),o.push(f)}else o.push(a);o.length>=JM&&(s+=String.fromCharCode.apply(String,o),o.length=0)}return o.length>0&&(s+=String.fromCharCode.apply(String,o)),s}var YM=new TextDecoder,XM=200;function QM(n,e,t){var r=n.subarray(e,e+t);return YM.decode(r)}function ZM(n,e,t){return t>XM?QM(n,e,t):jA(n,e,t)}var fd=(function(){function n(e,t){this.type=e,this.data=t}return n})(),eR=(function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}})(),di=(function(n){eR(e,n);function e(t){var r=n.call(this,t)||this,i=Object.create(e.prototype);return Object.setPrototypeOf(r,i),Object.defineProperty(r,"name",{configurable:!0,enumerable:!1,value:e.name}),r}return e})(Error),Cn;(function(n){n[n.UNSAFE_NUMBER=0]="UNSAFE_NUMBER",n[n.SAFE_NUMBER=1]="SAFE_NUMBER",n[n.AS_ENCODED=2]="AS_ENCODED",n[n.MIXED=3]="MIXED",n[n.BIGINT=4]="BIGINT"})(Cn||(Cn={}));var rl=4294967295;function tR(n,e,t){var r=t/4294967296,i=t;n.setUint32(e,r),n.setUint32(e+4,i)}function _A(n,e,t){var r=Math.floor(t/4294967296),i=t;n.setUint32(e,r),n.setUint32(e+4,i)}function zA(n,e,t){if(t===Cn.UNSAFE_NUMBER||t===Cn.SAFE_NUMBER){var r=n.getInt32(e),i=n.getUint32(e+4);if(t===Cn.SAFE_NUMBER&&(r<Math.floor(Number.MIN_SAFE_INTEGER/4294967296)||r===Math.floor(Number.MIN_SAFE_INTEGER/4294967296)&&i===0||r>(Number.MAX_SAFE_INTEGER-i)/4294967296)){var o="".concat(r<0?"-":"","0x").concat(Math.abs(r).toString(16)).concat(i.toString(16).padStart(8,"0"));throw new Error("Mode is IntMode.SAFE_NUMBER and value is not a safe integer: ".concat(o))}return r*4294967296+i}var s=n.getBigInt64(e);return t===Cn.MIXED&&s>=Number.MIN_SAFE_INTEGER&&s<=Number.MAX_SAFE_INTEGER?Number(s):s}function nR(n,e,t){if(t===Cn.UNSAFE_NUMBER||t===Cn.SAFE_NUMBER){var r=n.getUint32(e),i=n.getUint32(e+4);if(t===Cn.SAFE_NUMBER&&r>(Number.MAX_SAFE_INTEGER-i)/4294967296){var o="0x".concat(r.toString(16)).concat(i.toString(16).padStart(8,"0"));throw new Error("Mode is IntMode.SAFE_NUMBER and value is not a safe integer: ".concat(o))}return r*4294967296+i}var s=n.getBigUint64(e);return t===Cn.MIXED&&s<=Number.MAX_SAFE_INTEGER?Number(s):s}function rR(n,e){return e===Cn.BIGINT?BigInt(n):Number(n)}var iR=-1,oR=4294967296-1,sR=17179869184-1;function aR(n){var e=n.sec,t=n.nsec;if(e>=0&&t>=0&&e<=sR)if(t===0&&e<=oR){var r=new Uint8Array(4),i=new DataView(r.buffer);return i.setUint32(0,e),r}else{var o=e/4294967296,s=e&4294967295,r=new Uint8Array(8),i=new DataView(r.buffer);return i.setUint32(0,t<<2|o&3),i.setUint32(4,s),r}else{var r=new Uint8Array(12),i=new DataView(r.buffer);return i.setUint32(0,t),_A(i,4,e),r}}function cR(n){var e=n.getTime(),t=Math.floor(e/1e3),r=(e-t*1e3)*1e6,i=Math.floor(r/1e9);return{sec:t+i,nsec:r-i*1e9}}function uR(n){if(n instanceof Date){var e=cR(n);return aR(e)}else return null}function lR(n){var e=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(n.byteLength){case 4:{var t=e.getUint32(0),r=0;return{sec:t,nsec:r}}case 8:{var i=e.getUint32(0),o=e.getUint32(4),t=(i&3)*4294967296+o,r=i>>>2;return{sec:t,nsec:r}}case 12:{var t=zA(e,4,Cn.UNSAFE_NUMBER),r=e.getUint32(0);return{sec:t,nsec:r}}default:throw new di("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(n.length))}}function hR(n){var e=lR(n);return new Date(e.sec*1e3+e.nsec/1e6)}var dR={type:iR,encode:uR,decode:hR},qA=(function(){function n(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(dR)}return n.prototype.register=function(e){var t=e.type,r=e.encode,i=e.decode;if(t>=0)this.encoders[t]=r,this.decoders[t]=i;else{var o=1+t;this.builtInEncoders[o]=r,this.builtInDecoders[o]=i}},n.prototype.tryToEncode=function(e,t){for(var r=0;r<this.builtInEncoders.length;r++){var i=this.builtInEncoders[r];if(i!=null){var o=i(e,t);if(o!=null){var s=-1-r;return new fd(s,o)}}}for(var r=0;r<this.encoders.length;r++){var i=this.encoders[r];if(i!=null){var o=i(e,t);if(o!=null){var s=r;return new fd(s,o)}}}return e instanceof fd?e:null},n.prototype.decode=function(e,t,r){var i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(e,t,r):new fd(t,e)},n.defaultCodec=new n,n})();function ko(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n instanceof ArrayBuffer?new Uint8Array(n):Uint8Array.from(n)}function fR(n){if(n instanceof ArrayBuffer)return new DataView(n);var e=ko(n);return new DataView(e.buffer,e.byteOffset,e.byteLength)}function N1(n,e){for(var t=Math.min(n.length,e.length),r=0;r<t;r++){var i=n[r]-e[r];if(i!==0)return i}return n.length-e.length}var fr=(function(){function n(e){if(this.rawBinaryValue=e,!ArrayBuffer.isView(e))throw new TypeError("RawBinaryString: rawBinaryValue must be an ArrayBufferView")}return n})(),gR=100,pR=2048,mR=(function(){function n(e){var t,r,i,o,s,a,l,c;this.extensionCodec=(t=e==null?void 0:e.extensionCodec)!==null&&t!==void 0?t:qA.defaultCodec,this.context=e==null?void 0:e.context,this.forceBigIntToInt64=(r=e==null?void 0:e.forceBigIntToInt64)!==null&&r!==void 0?r:!1,this.maxDepth=(i=e==null?void 0:e.maxDepth)!==null&&i!==void 0?i:gR,this.initialBufferSize=(o=e==null?void 0:e.initialBufferSize)!==null&&o!==void 0?o:pR,this.sortKeys=(s=e==null?void 0:e.sortKeys)!==null&&s!==void 0?s:!1,this.forceFloat32=(a=e==null?void 0:e.forceFloat32)!==null&&a!==void 0?a:!1,this.ignoreUndefined=(l=e==null?void 0:e.ignoreUndefined)!==null&&l!==void 0?l:!1,this.forceIntegerToFloat=(c=e==null?void 0:e.forceIntegerToFloat)!==null&&c!==void 0?c:!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return n.prototype.reinitializeState=function(){this.pos=0},n.prototype.encodeSharedRef=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)},n.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)},n.prototype.doEncode=function(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth ".concat(t));e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.encodeObject(e,t)},n.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(t*2)},n.prototype.resizeBuffer=function(e){var t=new ArrayBuffer(e),r=new Uint8Array(t),i=new DataView(t);r.set(this.bytes),this.view=i,this.bytes=r},n.prototype.encodeNil=function(){this.writeU8(192)},n.prototype.encodeBoolean=function(e){e===!1?this.writeU8(194):this.writeU8(195)},n.prototype.encodeNumber=function(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)},n.prototype.encodeNumberAsFloat=function(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},n.prototype.encodeBigInt=function(e){if(this.forceBigIntToInt64)this.encodeBigIntAsInt64(e);else if(e>=0)if(e<4294967296||this.forceIntegerToFloat)this.encodeNumber(Number(e));else if(e<BigInt("0x10000000000000000"))this.encodeBigIntAsInt64(e);else throw new Error("Bigint is too large for uint64: ".concat(e));else if(e>=-2147483648||this.forceIntegerToFloat)this.encodeNumber(Number(e));else if(e>=BigInt(-1)*BigInt("0x8000000000000000"))this.encodeBigIntAsInt64(e);else throw new Error("Bigint is too small for int64: ".concat(e))},n.prototype.encodeBigIntAsInt64=function(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))},n.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error("Too long string: ".concat(e," bytes in UTF-8"))},n.prototype.encodeString=function(e){var t=5,r=zM(e);this.ensureBufferSizeToWrite(t+r),this.writeStringHeader(r),WM(e,this.bytes,this.pos),this.pos+=r},n.prototype.encodeObject=function(e,t){var r=this.extensionCodec.tryToEncode(e,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(e instanceof fr)this.encodeBinaryAsString(e);else if(typeof e=="bigint")this.encodeBigInt(e);else if(e instanceof Map)this.encodeMap(e,t);else if(typeof e=="object")this.encodeMapObject(e,t);else throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)))},n.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error("Too large binary: ".concat(t));var r=ko(e);this.writeU8a(r)},n.prototype.encodeBinaryAsString=function(e){var t=e.rawBinaryValue;this.writeStringHeader(t.byteLength);var r=ko(t);this.writeU8a(r)},n.prototype.encodeArray=function(e,t){var r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error("Too large array: ".concat(r));for(var i=0,o=e;i<o.length;i++){var s=o[i];this.doEncode(s,t+1)}},n.prototype.countWithoutUndefined=function(e,t){for(var r=0,i=0,o=t;i<o.length;i++){var s=o[i];e.get(s)!==void 0&&r++}return r},n.prototype.sortMapKeys=function(e){for(var t=[],r=[],i=[],o=[],s=0,a=e;s<a.length;s++){var l=a[s];if(typeof l=="number"){if(isNaN(l))throw new Error("Cannot sort map keys with NaN value");t.push(l)}else if(typeof l=="bigint")t.push(l);else if(typeof l=="string")r.push(l);else if(ArrayBuffer.isView(l))o.push(ko(l));else if(l instanceof fr)i.push(l);else throw new Error("Unsupported map key type: ".concat(Object.prototype.toString.apply(l)))}return t.sort(function(c,d){return c<d?-1:c>d?1:0}),r.sort(),i.sort(function(c,d){return N1(ko(c.rawBinaryValue),ko(d.rawBinaryValue))}),o.sort(N1),[].concat(t,r,i,o)},n.prototype.encodeMapObject=function(e,t){this.encodeMap(new Map(Object.entries(e)),t)},n.prototype.encodeMap=function(e,t){var r=Array.from(e.keys());this.sortKeys&&(r=this.sortMapKeys(r));var i=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error("Too large map object: ".concat(i));for(var o=0,s=r;o<s.length;o++){var a=s[o],l=e.get(a);if(!(this.ignoreUndefined&&l===void 0)){if(typeof a=="string")this.encodeString(a);else if(typeof a=="number")this.encodeNumber(a);else if(typeof a=="bigint")this.encodeBigInt(a);else if(ArrayBuffer.isView(a))this.encodeBinary(a);else if(a instanceof fr)this.encodeBinaryAsString(a);else throw new Error("Unsupported map key type: ".concat(Object.prototype.toString.apply(a)));this.doEncode(l,t+1)}}},n.prototype.encodeExtension=function(e){var t=e.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error("Too large extension object: ".concat(t));this.writeI8(e.type),this.writeU8a(e.data)},n.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},n.prototype.writeU8a=function(e){var t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t},n.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},n.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},n.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},n.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},n.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},n.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},n.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},n.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),tR(this.view,this.pos,e),this.pos+=8},n.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),_A(this.view,this.pos,e),this.pos+=8},n.prototype.writeBigUint64=function(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8},n.prototype.writeBigInt64=function(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8},n})();function yR(n,e){var t=new mR(e);return t.encodeSharedRef(n)}function yp(n){return"".concat(n<0?"-":"","0x").concat(Math.abs(n).toString(16).padStart(2,"0"))}var wR=16,SR=16,vR=(function(){function n(e,t){e===void 0&&(e=wR),t===void 0&&(t=SR),this.maxKeyLength=e,this.maxLengthPerKey=t,this.hit=0,this.miss=0,this.caches=[];for(var r=0;r<this.maxKeyLength;r++)this.caches.push([])}return n.prototype.canBeCached=function(e){return e>0&&e<=this.maxKeyLength},n.prototype.find=function(e,t,r){var i=this.caches[r-1];e:for(var o=0,s=i;o<s.length;o++){for(var a=s[o],l=a.bytes,c=0;c<r;c++)if(l[c]!==e[t+c])continue e;return a.str}return null},n.prototype.store=function(e,t){var r=this.caches[e.length-1],i={bytes:e,str:t};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=i:r.push(i)},n.prototype.decode=function(e,t,r){var i=this.find(e,t,r);if(i!=null)return this.hit++,i;this.miss++;var o=jA(e,t,r),s=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(s,o),o},n})(),xR=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(f){s(f)}}function l(d){try{c(r.throw(d))}catch(f){s(f)}}function c(d){d.done?o(d.value):i(d.value).then(a,l)}c((r=r.apply(n,e||[])).next())})},wp=function(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(d){return l([c,d])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(d){c=[6,d],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},L1=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}},cc=function(n){return this instanceof cc?(this.v=n,this):new cc(n)},ER=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(m){r[m]&&(i[m]=function(w){return new Promise(function(k,I){o.push([m,w,k,I])>1||a(m,w)})})}function a(m,w){try{l(r[m](w))}catch(k){f(o[0][3],k)}}function l(m){m.value instanceof cc?Promise.resolve(m.value.v).then(c,d):f(o[0][2],m)}function c(m){a("next",m)}function d(m){a("throw",m)}function f(m,w){m(w),o.shift(),o.length&&a(o[0][0],o[0][1])}},Cm="array",Fl="map_key",HA="map_value";function bR(n,e,t){return e?typeof n=="string"||typeof n=="number"||typeof n=="bigint"||n instanceof Uint8Array||n instanceof fr:typeof n=="string"||t&&typeof n=="number"}var kR=(function(){function n(e){this.useMap=e,this.stack=[],this.stackHeadPosition=-1}return Object.defineProperty(n.prototype,"length",{get:function(){return this.stackHeadPosition+1},enumerable:!1,configurable:!0}),n.prototype.top=function(){return this.stack[this.stackHeadPosition]},n.prototype.pushArrayState=function(e){var t=this.getUninitializedStateFromPool();t.type=Cm,t.position=0,t.size=e,t.array=new Array(e)},n.prototype.pushMapState=function(e){var t=this.getUninitializedStateFromPool();t.type=Fl,t.readCount=0,t.size=e,t.map=this.useMap?new Map:{}},n.prototype.getUninitializedStateFromPool=function(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){var e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]},n.prototype.release=function(e){var t=this.stack[this.stackHeadPosition];if(t!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===Cm){var r=e;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(e.type===Fl||e.type===HA){var r=e;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--},n.prototype.reset=function(){this.stack.length=0,this.stackHeadPosition=-1},n})(),il=-1,zx=new DataView(new ArrayBuffer(0)),AR=new Uint8Array(zx.buffer);try{zx.getInt8(0)}catch(n){if(!(n instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var Pm=RangeError,U1=new Pm("Insufficient data"),DR=new vR,FR=(function(){function n(e){var t,r,i,o,s,a,l,c,d,f,m,w;if(this.totalPos=0,this.pos=0,this.view=zx,this.bytes=AR,this.headByte=il,this.extensionCodec=(t=e==null?void 0:e.extensionCodec)!==null&&t!==void 0?t:qA.defaultCodec,this.context=e==null?void 0:e.context,this.intMode=(r=e==null?void 0:e.intMode)!==null&&r!==void 0?r:e!=null&&e.useBigInt64?Cn.AS_ENCODED:Cn.UNSAFE_NUMBER,this.rawBinaryStringValues=(i=e==null?void 0:e.rawBinaryStringValues)!==null&&i!==void 0?i:!1,this.rawBinaryStringKeys=(o=e==null?void 0:e.rawBinaryStringKeys)!==null&&o!==void 0?o:!1,this.useRawBinaryStringClass=(s=e==null?void 0:e.useRawBinaryStringClass)!==null&&s!==void 0?s:!1,this.useMap=(a=e==null?void 0:e.useMap)!==null&&a!==void 0?a:!1,this.supportObjectNumberKeys=(l=e==null?void 0:e.supportObjectNumberKeys)!==null&&l!==void 0?l:!1,this.maxStrLength=(c=e==null?void 0:e.maxStrLength)!==null&&c!==void 0?c:rl,this.maxBinLength=(d=e==null?void 0:e.maxBinLength)!==null&&d!==void 0?d:rl,this.maxArrayLength=(f=e==null?void 0:e.maxArrayLength)!==null&&f!==void 0?f:rl,this.maxMapLength=(m=e==null?void 0:e.maxMapLength)!==null&&m!==void 0?m:rl,this.maxExtLength=(w=e==null?void 0:e.maxExtLength)!==null&&w!==void 0?w:rl,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:DR,this.rawBinaryStringKeys&&!this.useMap)throw new Error("rawBinaryStringKeys is only supported when useMap is true");this.stack=new kR(this.useMap)}return n.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=il,this.stack.reset()},n.prototype.setBuffer=function(e){this.bytes=ko(e),this.view=fR(this.bytes),this.pos=0},n.prototype.appendBuffer=function(e){if(this.headByte===il&&!this.hasRemaining(1))this.setBuffer(e);else{var t=this.bytes.subarray(this.pos),r=ko(e),i=new Uint8Array(t.length+r.length);i.set(t),i.set(r,t.length),this.setBuffer(i)}},n.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},n.prototype.createExtraByteError=function(e){var t=this,r=t.view,i=t.pos;return new RangeError("Extra ".concat(r.byteLength-i," of ").concat(r.byteLength," byte(s) found at buffer[").concat(e,"]"))},n.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},n.prototype.decodeMulti=function(e){return wp(this,function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}})},n.prototype.decodeAsync=function(e){var t,r,i,o,s,a,l;return xR(this,void 0,void 0,function(){var c,d,f,m,w,k,I,x;return wp(this,function(T){switch(T.label){case 0:c=!1,T.label=1;case 1:T.trys.push([1,6,7,12]),t=!0,r=L1(e),T.label=2;case 2:return[4,r.next()];case 3:if(i=T.sent(),o=i.done,!!o)return[3,5];if(l=i.value,t=!1,f=l,c)throw this.createExtraByteError(this.totalPos);this.appendBuffer(f);try{d=this.doDecodeSync(),c=!0}catch(b){if(!(b instanceof Pm))throw b}this.totalPos+=this.pos,T.label=4;case 4:return t=!0,[3,2];case 5:return[3,12];case 6:return m=T.sent(),s={error:m},[3,12];case 7:return T.trys.push([7,,10,11]),!t&&!o&&(a=r.return)?[4,a.call(r)]:[3,9];case 8:T.sent(),T.label=9;case 9:return[3,11];case 10:if(s)throw s.error;return[7];case 11:return[7];case 12:if(c){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,d]}throw w=this,k=w.headByte,I=w.pos,x=w.totalPos,new RangeError("Insufficient data in parsing ".concat(yp(k)," at ").concat(x," (").concat(I," in the current buffer)"))}})})},n.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},n.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},n.prototype.decodeMultiAsync=function(e,t){return ER(this,arguments,function(){var i,o,s,a,l,c,d,f,m,w,k,I;return wp(this,function(x){switch(x.label){case 0:i=t,o=-1,x.label=1;case 1:x.trys.push([1,13,14,19]),s=!0,a=L1(e),x.label=2;case 2:return[4,cc(a.next())];case 3:if(l=x.sent(),m=l.done,!!m)return[3,12];if(I=l.value,s=!1,c=I,t&&o===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(c),i&&(o=this.readArraySize(),i=!1,this.complete()),x.label=4;case 4:x.trys.push([4,9,,10]),x.label=5;case 5:return[4,cc(this.doDecodeSync())];case 6:return[4,x.sent()];case 7:return x.sent(),--o===0?[3,8]:[3,5];case 8:return[3,10];case 9:if(d=x.sent(),!(d instanceof Pm))throw d;return[3,10];case 10:this.totalPos+=this.pos,x.label=11;case 11:return s=!0,[3,2];case 12:return[3,19];case 13:return f=x.sent(),w={error:f},[3,19];case 14:return x.trys.push([14,,17,18]),!s&&!m&&(k=a.return)?[4,cc(k.call(a))]:[3,16];case 15:x.sent(),x.label=16;case 16:return[3,18];case 17:if(w)throw w.error;return[7];case 18:return[7];case 19:return[2]}})})},n.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=this.convertNumber(e-256);else if(e<192)if(e<128)t=this.convertNumber(e);else if(e<144){var r=e-128;if(r!==0){this.pushMapState(r),this.complete();continue e}else t=this.useMap?new Map:{}}else if(e<160){var r=e-144;if(r!==0){this.pushArrayState(r),this.complete();continue e}else t=[]}else{var i=e-160;t=this.decodeString(i,0)}else if(e===192)t=null;else if(e===194)t=!1;else if(e===195)t=!0;else if(e===202)t=this.readF32();else if(e===203)t=this.readF64();else if(e===204)t=this.convertNumber(this.readU8());else if(e===205)t=this.convertNumber(this.readU16());else if(e===206)t=this.convertNumber(this.readU32());else if(e===207)t=this.readU64();else if(e===208)t=this.convertNumber(this.readI8());else if(e===209)t=this.convertNumber(this.readI16());else if(e===210)t=this.convertNumber(this.readI32());else if(e===211)t=this.readI64();else if(e===217){var i=this.lookU8();t=this.decodeString(i,1)}else if(e===218){var i=this.lookU16();t=this.decodeString(i,2)}else if(e===219){var i=this.lookU32();t=this.decodeString(i,4)}else if(e===220){var r=this.readU16();if(r!==0){this.pushArrayState(r),this.complete();continue e}else t=[]}else if(e===221){var r=this.readU32();if(r!==0){this.pushArrayState(r),this.complete();continue e}else t=[]}else if(e===222){var r=this.readU16();if(r!==0){this.pushMapState(r),this.complete();continue e}else t={}}else if(e===223){var r=this.readU32();if(r!==0){this.pushMapState(r),this.complete();continue e}else t={}}else if(e===196){var r=this.lookU8();t=this.decodeBinary(r,1)}else if(e===197){var r=this.lookU16();t=this.decodeBinary(r,2)}else if(e===198){var r=this.lookU32();t=this.decodeBinary(r,4)}else if(e===212)t=this.decodeExtension(1,0);else if(e===213)t=this.decodeExtension(2,0);else if(e===214)t=this.decodeExtension(4,0);else if(e===215)t=this.decodeExtension(8,0);else if(e===216)t=this.decodeExtension(16,0);else if(e===199){var r=this.lookU8();t=this.decodeExtension(r,1)}else if(e===200){var r=this.lookU16();t=this.decodeExtension(r,2)}else if(e===201){var r=this.lookU32();t=this.decodeExtension(r,4)}else throw new di("Unrecognized type byte: ".concat(yp(e)));this.complete();for(var o=this.stack;o.length>0;){var s=o.top();if(s.type===Cm)if(s.array[s.position]=t,s.position++,s.position===s.size)t=s.array,o.release(s);else continue e;else if(s.type===Fl){if(!bR(t,this.useMap,this.supportObjectNumberKeys)){var a=this.useMap?"string, number, bigint, or Uint8Array":this.supportObjectNumberKeys?"string or number":"string";throw new di("The type of key must be ".concat(a," but got ").concat(typeof t))}if(!this.useMap&&t==="__proto__")throw new di("The key __proto__ is not allowed");s.key=t,s.type=HA;continue e}else if(this.useMap?s.map.set(s.key,t):s.map[s.key]=t,s.readCount++,s.readCount===s.size)t=s.map,o.release(s);else{s.key=null,s.type=Fl;continue e}}return t}},n.prototype.readHeadByte=function(){return this.headByte===il&&(this.headByte=this.readU8()),this.headByte},n.prototype.complete=function(){this.headByte=il},n.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new di("Unrecognized array type byte: ".concat(yp(e)))}}},n.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new di("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.pushMapState(e)},n.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new di("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.pushArrayState(e)},n.prototype.decodeString=function(e,t){if(this.stateIsMapKey()?this.rawBinaryStringKeys:this.rawBinaryStringValues){var r=this.decodeBinary(e,t);return this.useRawBinaryStringClass?new fr(r):r}return this.decodeUtf8String(e,t)},n.prototype.decodeUtf8String=function(e,t){var r;if(e>this.maxStrLength)throw new di("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLength<this.pos+t+e)throw U1;var i=this.pos+t,o;return this.stateIsMapKey()&&(!((r=this.keyDecoder)===null||r===void 0)&&r.canBeCached(e))?o=this.keyDecoder.decode(this.bytes,i,e):o=ZM(this.bytes,i,e),this.pos+=t+e,o},n.prototype.stateIsMapKey=function(){if(this.stack.length>0){var e=this.stack.top();return e.type===Fl}return!1},n.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new di("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw U1;var r=this.pos+t,i=this.bytes.subarray(r,r+e);return this.pos+=t+e,i},n.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new di("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var r=this.view.getInt8(this.pos+t),i=this.decodeBinary(e,t+1);return this.extensionCodec.decode(i,r,this.context)},n.prototype.convertNumber=function(e){return rR(e,this.intMode)},n.prototype.lookU8=function(){return this.view.getUint8(this.pos)},n.prototype.lookU16=function(){return this.view.getUint16(this.pos)},n.prototype.lookU32=function(){return this.view.getUint32(this.pos)},n.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},n.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},n.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},n.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},n.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},n.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},n.prototype.readU64=function(){var e=nR(this.view,this.pos,this.intMode);return this.pos+=8,e},n.prototype.readI64=function(){var e=zA(this.view,this.pos,this.intMode);return this.pos+=8,e},n.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},n.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},n})();function qx(n,e){var t=new FR(e);return t.decode(n)}const TR="The object contains empty or 0 values. First empty or 0 value encountered during encoding: ";function IR(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&(!n[e]||n[e].length===0))return{containsEmpty:!0,firstEmptyKey:e};return{containsEmpty:!1,firstEmptyKey:void 0}}function td(n){return yR(n,{sortKeys:!0})}function MR(n){const e=IR(n);if(e.containsEmpty)throw new Error(TR+e.firstEmptyKey);return td(n)}function GA(n){switch(n){case Bn.UNSAFE:return Cn.UNSAFE_NUMBER;case Bn.SAFE:return Cn.SAFE_NUMBER;case Bn.MIXED:return Cn.MIXED;case Bn.BIGINT:return Cn.BIGINT;default:throw new Error(`Invalid intDecoding: ${n}`)}}function KA(n,e){const t={intMode:e!=null&&e.intDecoding?GA(e==null?void 0:e.intDecoding):Cn.BIGINT};return qx(n,t)}function RR(n){return KA(n,{intDecoding:Bn.MIXED})}function WA(n,e){const t={intMode:e!=null&&e.intDecoding?GA(e==null?void 0:e.intDecoding):Cn.BIGINT,useMap:!0};return qx(n,t)}function CR(n,e){const t={intMode:Cn.BIGINT,useMap:!0,rawBinaryStringKeys:!0,rawBinaryStringValues:!0,useRawBinaryStringClass:!0};return qx(n,t)}function $m(n){if(n==null)return n;if(n instanceof Uint8Array)return Qn(n);if(Array.isArray(n))return n.map($m);if(n instanceof Map){const e={};for(const[t,r]of n){if(typeof t!="string")throw new Error(`JSON map key must be a string: ${t}`);e[t]=$m(r)}return e}return n}function Bm(n){if(n==null||typeof n=="string"||typeof n=="number"||typeof n=="bigint"||typeof n=="boolean")return n;if(Array.isArray(n))return n.map(Bm);if(typeof n=="object"){const e=new Map;for(const[t,r]of Object.entries(n))e.set(t,Bm(r));return e}throw new Error(`Invalid JSON encoding data: ${n}`)}var xo;(function(n){n[n.MAP_VALUE=0]="MAP_VALUE",n[n.ARRAY_ELEMENT=1]="ARRAY_ELEMENT"})(xo||(xo={}));let PR=class Vm{constructor({parent:e,segment:t,baseObjectBytes:r}){this.resolvedCache=null,this.resolvedCachePresent=!1,this.parent=e,this.segment=t,this.baseObjectBytes=r}withMapValue(e){return new Vm({parent:this,segment:{kind:xo.MAP_VALUE,key:e}})}withArrayElement(e){return new Vm({parent:this,segment:{kind:xo.ARRAY_ELEMENT,key:e}})}getRawStringAtCurrentLocation(){const e=this.resolve();if(e instanceof fr)return e.rawBinaryValue;throw new Error(`Invalid type. Expected RawBinaryString, got ${e} (${typeof e})`)}getRawStringKeysAndValuesAtCurrentLocation(){const e=this.resolve();if(!(e instanceof Map))throw new Error(`Invalid type. Expected Map, got ${e} (${typeof e})`);const t=new Map;for(const[r,i]of e)if(r instanceof fr)t.set(r.rawBinaryValue,i);else throw new Error(`Invalid type for map key. Expected RawBinaryString, got ${r} (${typeof r})`);return t}resolve(){if(this.resolvedCachePresent)return this.resolvedCache;let e;if(this.parent?e=this.parent.resolve():e=CR(this.baseObjectBytes),!this.segment)return this.resolvedCache=e,this.resolvedCachePresent=!0,e;if(this.segment.kind===xo.MAP_VALUE){if(!(e instanceof Map))throw new Error(`Invalid type. Expected Map, got ${e} (${typeof e})`);if(typeof this.segment.key=="string"||this.segment.key instanceof Uint8Array||this.segment.key instanceof fr){const t=this.segment.key instanceof fr?this.segment.key.rawBinaryValue:Ti(this.segment.key),r=typeof this.segment.key=="string"||this.segment.key instanceof fr;for(const[i,o]of e){let s;if(r?i instanceof fr&&(s=i.rawBinaryValue):i instanceof Uint8Array&&(s=i),s&&Fi(t,s)){this.resolvedCache=o;break}}}else this.resolvedCache=e.get(this.segment.key);return this.resolvedCachePresent=!0,this.resolvedCache}if(this.segment.kind===xo.ARRAY_ELEMENT){if(!Array.isArray(e))throw new Error(`Invalid type. Expected Array, got ${e} (${typeof e})`);return this.resolvedCache=e[this.segment.key],this.resolvedCachePresent=!0,this.resolvedCache}throw new Error(`Invalid segment kind: ${this.segment.kind}`)}getPathString(){const e=this.parent?this.parent.getPathString():"root";return this.segment?this.segment.kind===xo.MAP_VALUE?`${e} -> map key "${this.segment.key}" (${typeof this.segment.key})`:this.segment.kind===xo.ARRAY_ELEMENT?`${e} -> array index ${this.segment.key} (${typeof this.segment.key})`:`${e} -> unknown segment kind ${this.segment.kind}`:e}},yr=class{};function Fn(n,e){const t=WA(n),r=new PR({baseObjectBytes:n});return e.fromEncodingData(e.encodingSchema.fromPreparedMsgpack(t,r))}function Wr(n){return td(n.getEncodingSchema().prepareMsgpack(n.toEncodingData()))}function Wt(n,e){const t=Ux(n,{intDecoding:Bn.BIGINT});return e.fromEncodingData(e.encodingSchema.fromPreparedJSON(t))}function $R(n,e){const{space:t,...r}=e??{},i=n.getEncodingSchema().prepareJSON(n.toEncodingData(),r);return Xs(i,void 0,t)}let jt=class extends yr{defaultValue(){return!1}isDefaultValue(e){return e===!1}prepareMsgpack(e){if(typeof e=="boolean")return e;throw new Error("Invalid boolean")}fromPreparedMsgpack(e,t){if(typeof e=="boolean")return e;throw new Error("Invalid boolean")}prepareJSON(e,t){if(typeof e=="boolean")return e;throw new Error("Invalid boolean")}fromPreparedJSON(e){if(typeof e=="boolean")return e;throw new Error("Invalid boolean")}},Ne=class extends yr{defaultValue(){return""}isDefaultValue(e){return e===""}prepareMsgpack(e){if(typeof e=="string")return e;throw new Error(`Invalid string: (${typeof e}) ${e}`)}fromPreparedMsgpack(e,t){if(typeof e=="string")return e;throw new Error(`Invalid string: (${typeof e}) ${e}`)}prepareJSON(e,t){if(typeof e=="string")return e;throw new Error(`Invalid string: (${typeof e}) ${e}`)}fromPreparedJSON(e){if(typeof e=="string")return e;throw new Error(`Invalid string: (${typeof e}) ${e}`)}},J=class extends yr{defaultValue(){return BigInt(0)}isDefaultValue(e){return typeof e=="bigint"?e===BigInt(0):typeof e=="number"?e===0:!1}prepareMsgpack(e){return yn(e)}fromPreparedMsgpack(e,t){return yn(e)}prepareJSON(e,t){return yn(e)}fromPreparedJSON(e){return yn(e)}},gn=class extends yr{defaultValue(){return Ot.zeroAddress()}isDefaultValue(e){return Ot.zeroAddress().equals(e)}prepareMsgpack(e){if(e instanceof Ot)return e.publicKey;throw new Error(`Invalid address: (${typeof e}) ${e}`)}fromPreparedMsgpack(e,t){return new Ot(e)}prepareJSON(e,t){if(e instanceof Ot)return e.toString();throw new Error(`Invalid address: (${typeof e}) ${e}`)}fromPreparedJSON(e){return Ot.fromString(e)}},We=class extends yr{defaultValue(){return new Uint8Array}isDefaultValue(e){return e instanceof Uint8Array&&e.byteLength===0}prepareMsgpack(e){if(e instanceof Uint8Array)return e;throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}fromPreparedMsgpack(e,t){if(e instanceof Uint8Array)return e;throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}prepareJSON(e,t){if(e instanceof Uint8Array)return Qn(e);throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}fromPreparedJSON(e){if(e==null)return this.defaultValue();if(typeof e=="string")return ut(e);throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}},vn=class extends yr{constructor(e){super(),this.length=e}defaultValue(){return new Uint8Array(this.length)}isDefaultValue(e){return e instanceof Uint8Array&&e.byteLength===this.length&&e.every(t=>t===0)}prepareMsgpack(e){if(e instanceof Uint8Array){if(e.byteLength===this.length)return e;throw new Error(`Invalid byte array length: wanted ${this.length}, got ${e.byteLength}`)}throw new Error("Invalid byte array")}fromPreparedMsgpack(e,t){if(e instanceof Uint8Array){if(e.byteLength===this.length)return e;throw new Error(`Invalid byte array length: wanted ${this.length}, got ${e.byteLength}`)}throw new Error("Invalid byte array")}prepareJSON(e){if(e instanceof Uint8Array){if(e.byteLength===this.length)return Qn(e);throw new Error(`Invalid byte array length: wanted ${this.length}, got ${e.byteLength}`)}throw new Error("Invalid byte array")}fromPreparedJSON(e){if(typeof e=="string"){const t=ut(e);if(t.byteLength===this.length)return t;throw new Error(`Invalid byte array length: wanted ${this.length}, got ${t.byteLength}`)}throw new Error("Invalid base64 byte array")}};const ol=32,j1=52;let BR=class extends yr{defaultValue(){return new Uint8Array(ol)}isDefaultValue(e){return e instanceof Uint8Array&&e.byteLength===ol&&e.every(t=>t===0)}prepareMsgpack(e){if(e instanceof Uint8Array&&e.byteLength===ol)return e;throw new Error(`Invalid block hash: (${typeof e}) ${e}`)}fromPreparedMsgpack(e,t){if(e instanceof Uint8Array&&e.byteLength===ol)return e;throw new Error(`Invalid block hash: (${typeof e}) ${e}`)}prepareJSON(e,t){if(e instanceof Uint8Array&&e.byteLength===ol)return`blk-${_l.encode(e).slice(0,j1)}`;throw new Error(`Invalid block hash: (${typeof e}) ${e}`)}fromPreparedJSON(e){if(typeof e=="string"&&e.length===j1+4&&e.startsWith("blk-"))return Uint8Array.from(_l.decode.asBytes(e.slice(4)));throw new Error(`Invalid block hash: (${typeof e}) ${e}`)}},uc=class extends yr{defaultValue(){return new Uint8Array}isDefaultValue(e){return e instanceof Uint8Array&&e.byteLength===0}prepareMsgpack(e){if(e instanceof Uint8Array)return new fr(e);throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}fromPreparedMsgpack(e,t){return t.getRawStringAtCurrentLocation()}prepareJSON(e,t){if(e instanceof Uint8Array){const r=Nf(e);if(!t.lossyBinaryStringConversion&&!Fi(Ti(r),e))throw new Error(`Invalid UTF-8 byte array encountered. Encode with lossyBinaryStringConversion enabled to bypass this check. Base64 value: ${Qn(e)}`);return r}throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}fromPreparedJSON(e){if(typeof e=="string")return Ti(e);throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}},qe=class extends yr{constructor(e){super(),this.itemSchema=e}defaultValue(){return[]}isDefaultValue(e){return Array.isArray(e)&&e.length===0}prepareMsgpack(e){if(Array.isArray(e))return e.map(t=>this.itemSchema.prepareMsgpack(t));throw new Error("ArraySchema data must be an array")}fromPreparedMsgpack(e,t){if(Array.isArray(e))return e.map((r,i)=>this.itemSchema.fromPreparedMsgpack(r,t.withArrayElement(i)));throw new Error(`ArraySchema encoded data must be an array: ${e} (${typeof e})`)}prepareJSON(e,t){if(Array.isArray(e))return e.map(r=>this.itemSchema.prepareJSON(r,t));throw new Error("ArraySchema data must be an array")}fromPreparedJSON(e){if(Array.isArray(e))return e.map(t=>this.itemSchema.fromPreparedJSON(t));throw new Error(`ArraySchema encoded data must be an array: ${e} (${typeof e})`)}};function Mt(n){return n.map(e=>({...e,omitEmpty:!0}))}let xe=class JA extends yr{constructor(e){super(),this.entries=e,this.checkEntries()}pushEntries(...e){this.entries.push(...e),this.checkEntries()}checkEntries(){for(const t of this.entries)if(t.embedded){if(t.key!=="")throw new Error("Embedded entries must have an empty key");if(!(t.valueSchema instanceof JA))throw new Error("Embedded entry valueSchema must be a NamedMapSchema")}const e=new Set;for(const t of this.getEntries()){if(e.has(t.key))throw new Error(`Duplicate key: ${t.key}`);e.add(t.key)}}getEntries(){const e=[];for(const t of this.entries)if(t.embedded){const r=t.valueSchema;e.push(...r.getEntries())}else e.push(t);return e}defaultValue(){const e=new Map;for(const t of this.getEntries())e.set(t.key,t.valueSchema.defaultValue());return e}isDefaultValue(e){if(!(e instanceof Map))return!1;for(const t of this.getEntries())if(!t.valueSchema.isDefaultValue(e.get(t.key)))return!1;return!0}prepareMsgpack(e){if(!(e instanceof Map))throw new Error(`NamedMapSchema data must be a Map. Got (${typeof e}) ${e}`);const t=new Map;for(const r of this.getEntries()){const i=e.get(r.key);r.omitEmpty&&r.valueSchema.isDefaultValue(i)||t.set(r.key,r.valueSchema.prepareMsgpack(i))}return t}fromPreparedMsgpack(e,t){if(!(e instanceof Map))throw new Error("NamedMapSchema data must be a Map");const r=new Map;for(const i of this.getEntries())if(e.has(i.key))r.set(i.key,i.valueSchema.fromPreparedMsgpack(e.get(i.key),t.withMapValue(i.key)));else if(i.omitEmpty)r.set(i.key,i.valueSchema.defaultValue());else throw new Error(`Missing key: ${i.key}`);return r}prepareJSON(e,t){if(!(e instanceof Map))throw new Error("NamedMapSchema data must be a Map");const r={};for(const i of this.getEntries()){const o=e.get(i.key);i.omitEmpty&&i.valueSchema.isDefaultValue(o)||(r[i.key]=i.valueSchema.prepareJSON(o,t))}return r}fromPreparedJSON(e){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error("NamedMapSchema data must be an object");const t=new Map;for(const r of this.getEntries())if(Object.prototype.hasOwnProperty.call(e,r.key))t.set(r.key,r.valueSchema.fromPreparedJSON(e[r.key]));else if(r.omitEmpty)t.set(r.key,r.valueSchema.defaultValue());else throw new Error(`Missing key: ${r.key}`);return t}};function ju(...n){const e=new Map;for(const t of n)for(const[r,i]of t){if(e.has(r))throw new Error(`Duplicate key: ${r}`);e.set(r,i)}return e}function Nn(n,e){const t=new Map;for(const[r,i]of n){const[o,s]=e(r,i);t.set(o,s)}return t}let Uf=class extends yr{constructor(e){super(),this.valueSchema=e}defaultValue(){return new Map}isDefaultValue(e){return e instanceof Map&&e.size===0}prepareMsgpack(e){if(!(e instanceof Map))throw new Error(`Uint64MapSchema data must be a Map. Got (${typeof e}) ${e}`);const t=new Map;for(const[r,i]of e){const o=yn(r);if(t.has(o))throw new Error(`Duplicate key: ${o}`);t.set(o,this.valueSchema.prepareMsgpack(i))}return t}fromPreparedMsgpack(e,t){if(!(e instanceof Map))throw new Error("Uint64MapSchema data must be a Map");const r=new Map;for(const[i,o]of e){const s=yn(i);if(r.has(s))throw new Error(`Duplicate key: ${s}`);r.set(s,this.valueSchema.fromPreparedMsgpack(o,t.withMapValue(i)))}return r}prepareJSON(e,t){if(!(e instanceof Map))throw new Error(`Uint64MapSchema data must be a Map. Got (${typeof e}) ${e}`);const r=new Map;for(const[o,s]of e){const a=yn(o);if(r.has(a))throw new Error(`Duplicate key: ${a}`);r.set(a,this.valueSchema.prepareJSON(s,t))}const i={};for(const[o,s]of r)i[o.toString()]=s;return i}fromPreparedJSON(e){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error("Uint64MapSchema data must be an object");const t=new Map;for(const[r,i]of Object.entries(e)){const o=BigInt(r);if(t.has(o))throw new Error(`Duplicate key: ${o}`);t.set(o,this.valueSchema.fromPreparedJSON(i))}return t}},VR=class extends yr{constructor(e){super(),this.valueSchema=e}defaultValue(){return new Map}isDefaultValue(e){return e instanceof Map&&e.size===0}prepareMsgpack(e){if(!(e instanceof Map))throw new Error(`ByteArrayMapSchema data must be a Map. Got (${typeof e}) ${e}`);const t=new Map;for(const[r,i]of e){if(!(r instanceof Uint8Array))throw new Error(`Invalid key: ${r} (${typeof r})`);t.set(r,this.valueSchema.prepareMsgpack(i))}return t}fromPreparedMsgpack(e,t){if(!(e instanceof Map))throw new Error("ByteArrayMapSchema data must be a Map");const r=new Map;for(const[i,o]of e){if(!(i instanceof Uint8Array))throw new Error(`Invalid key: ${i} (${typeof i})`);r.set(i,this.valueSchema.fromPreparedMsgpack(o,t.withMapValue(i)))}return r}prepareJSON(e,t){if(!(e instanceof Map))throw new Error(`ByteArrayMapSchema data must be a Map. Got (${typeof e}) ${e}`);const r=new Map;for(const[o,s]of e){if(!(o instanceof Uint8Array))throw new Error(`Invalid key: ${o} (${typeof o})`);const a=Qn(o);if(r.has(a))throw new Error(`Duplicate key (base64): ${a}`);r.set(a,this.valueSchema.prepareJSON(s,t))}const i={};for(const[o,s]of r)i[o]=s;return i}fromPreparedJSON(e){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error("ByteArrayMapSchema data must be an object");const t=new Map;for(const[r,i]of Object.entries(e))t.set(ut(r),this.valueSchema.fromPreparedJSON(i));return t}};function Dd(n){if(n instanceof fr)return Nf(n.rawBinaryValue);if(n instanceof Map){const e=new Map;for(const[t,r]of n)e.set(Dd(t),Dd(r));return e}return Array.isArray(n)?n.map(Dd):n}let zl=class extends yr{constructor(e){super(),this.valueSchema=e}defaultValue(){return new Map}isDefaultValue(e){return e instanceof Map&&e.size===0}prepareMsgpack(e){if(!(e instanceof Map))throw new Error(`SpecialCaseBinaryStringMapSchema data must be a Map. Got (${typeof e}) ${e}`);const t=new Map;for(const[r,i]of e){if(!(r instanceof Uint8Array))throw new Error(`Invalid key: ${r} (${typeof r})`);t.set(new fr(r),this.valueSchema.prepareMsgpack(i))}return t}fromPreparedMsgpack(e,t){const r=new Map,i=t.getRawStringKeysAndValuesAtCurrentLocation();for(const[o,s]of i)r.set(o,this.valueSchema.fromPreparedMsgpack(Dd(s),t.withMapValue(new fr(o))));return r}prepareJSON(e,t){if(!(e instanceof Map))throw new Error(`SpecialCaseBinaryStringMapSchema data must be a Map. Got (${typeof e}) ${e}`);const r=new Map;for(const[o,s]of e){if(!(o instanceof Uint8Array))throw new Error(`Invalid key: ${o}`);const a=Nf(o);if(!t.lossyBinaryStringConversion&&!Fi(Ti(a),o))throw new Error(`Invalid UTF-8 byte array encountered. Encode with lossyBinaryStringConversion enabled to bypass this check. Base64 value: ${Qn(o)}`);r.set(a,this.valueSchema.prepareJSON(s,t))}const i={};for(const[o,s]of r)i[o]=s;return i}fromPreparedJSON(e){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error("SpecialCaseBinaryStringMapSchema data must be an object");const t=new Map;for(const[r,i]of Object.entries(e))t.set(Ti(r),this.valueSchema.fromPreparedJSON(i));return t}},$=class extends yr{constructor(e){super(),this.valueSchema=e}defaultValue(){}isDefaultValue(e){return e===void 0||this.valueSchema.isDefaultValue(e)}prepareMsgpack(e){if(e!==void 0)return this.valueSchema.prepareMsgpack(e)}fromPreparedMsgpack(e,t){if(e!=null)return this.valueSchema.fromPreparedMsgpack(e,t)}prepareJSON(e,t){return e===void 0?null:this.valueSchema.prepareJSON(e,t)}fromPreparedJSON(e){if(e!=null)return this.valueSchema.fromPreparedJSON(e)}},YA=class extends yr{defaultValue(){}isDefaultValue(e){return e===void 0}prepareMsgpack(e){return e}fromPreparedMsgpack(e,t){return e}prepareJSON(e,t){return $m(e)}fromPreparedJSON(e){return Bm(e)}};function OR(n,e,t){const r=BigInt(n.appIndex),i=n.name,o=r===BigInt(0)||r===t,s=e.indexOf(r)+1;if(s===0&&!o)throw new Error(`Box ref with appId ${r} not in foreign-apps`);return new Map([["i",s],["n",i]])}function NR(n,e,t){const r=BigInt(t),i=e.map(BigInt);return n.map(o=>OR(o,i,r))}function LR(n,e){const t=[];function r(o){for(let s=0;s<t.length;s++){const a=t[s],l=a.get("d");if((!o.address&&!l||o.address&&l&&o.address.equals(l))&&a.get("s")===o.assetIndex&&a.get("p")===o.appIndex)return s+1}return o.address&&t.push(new Map([["d",o.address]])),o.assetIndex&&t.push(new Map([["s",o.assetIndex]])),o.appIndex&&t.push(new Map([["p",o.appIndex]])),t.length}const i=Ot.zeroAddress();for(const o of e){if(o.address||o.assetIndex||o.appIndex){r(o);continue}if(o.holding){const s=o.holding;let a=0;s.address&&!s.address.equals(i)&&(a=r({address:s.address}));const l=r({assetIndex:s.assetIndex});t.push(new Map([["h",new Map([["d",a],["s",l]])]]));continue}if(o.locals){const s=o.locals;let a=0;s.address&&!s.address.equals(i)&&(a=r({address:s.address}));let l=0;s.appIndex&&BigInt(s.appIndex)!==n&&(l=r({appIndex:s.appIndex})),t.push(new Map([["l",new Map([["d",a],["p",l]])]]));continue}if(o.box){const s=o.box;let a=0;s.appIndex&&BigInt(s.appIndex)!==n&&(a=r({appIndex:s.appIndex})),t.push(new Map([["b",new Map([["i",a],["n",s.name]])]]))}}return t}function UR(n){const e=[];for(const t of n){const r=t.get("d"),i=t.get("s"),o=t.get("p");if(r){e.push({address:r});continue}if(i){e.push({assetIndex:i});continue}if(o){e.push({appIndex:o});continue}const s=t.get("h");if(s){const c=Yn(s.get("d")??0),d=Yn(s.get("s"));if(!d)throw new Error(`Holding missing asset index: ${s}`);const f=c===0?Ot.zeroAddress():e[c-1].address,m=e[d-1].assetIndex;e.push({holding:{address:f,assetIndex:m}});continue}const a=t.get("l");if(a){const c=Yn(a.get("d")??0),d=Yn(a.get("p")??0),f=c===0?Ot.zeroAddress():e[c-1].address,m=d===0?BigInt(0):e[d-1].appIndex;e.push({locals:{address:f,appIndex:m}});continue}const l=t.get("b");if(l){const c=Yn(l.get("i")??0),d=l.get("n");if(!d)throw new Error(`Box missing name: ${l}`);const f=c===0?BigInt(0):e[c-1].appIndex;e.push({box:{appIndex:f,name:d}})}}return e}function jR({appIndex:n,accounts:e,foreignAssets:t,foreignApps:r,holdings:i,locals:o,boxes:s}){const a=[];function l(f){let m;if(typeof f=="string"){if(f==="")return;m=Ot.fromString(f)}else m=f;if(m.equals(Ot.zeroAddress()))return;let w=!1;for(const k of a){if(!k.address)continue;let I=k.address;if(typeof k.address=="string"&&(I=Ot.fromString(k.address)),I.equals(m)){w=!0;break}}w||a.push({address:f})}function c(f){let m=!1;for(const w of a)if(w.assetIndex===f){m=!0;break}m||a.push({assetIndex:f})}function d(f){let m=!1;for(const w of a)if(w.appIndex===f){m=!0;break}m||a.push({appIndex:f})}for(const f of e??[])l(f);for(const f of t??[])c(f);for(const f of r??[])d(f);for(const f of i??[])f.address&&l(f.address),c(f.assetIndex),a.push({holding:f});for(const f of o??[])f.address&&l(f.address),f.appIndex&&BigInt(f.appIndex)!==n&&d(f.appIndex),a.push({locals:f});for(const f of s??[])f.appIndex&&BigInt(f.appIndex)!==n&&d(f.appIndex),a.push({box:f});return a}var un;(function(n){n.pay="pay",n.keyreg="keyreg",n.acfg="acfg",n.axfer="axfer",n.afrz="afrz",n.appl="appl",n.stpf="stpf",n.hb="hb"})(un||(un={}));function Om(n){return n===un.pay||n===un.keyreg||n===un.acfg||n===un.axfer||n===un.afrz||n===un.appl||n===un.stpf||n===un.hb}var er;(function(n){n[n.NoOpOC=0]="NoOpOC",n[n.OptInOC=1]="OptInOC",n[n.CloseOutOC=2]="CloseOutOC",n[n.ClearStateOC=3]="ClearStateOC",n[n.UpdateApplicationOC=4]="UpdateApplicationOC",n[n.DeleteApplicationOC=5]="DeleteApplicationOC"})(er||(er={}));function XA(n){return n===er.NoOpOC||n===er.OptInOC||n===er.CloseOutOC||n===er.ClearStateOC||n===er.UpdateApplicationOC||n===er.DeleteApplicationOC}let jf=class Nm{constructor(e){this.hashType=e.hashType}getEncodingSchema(){return Nm.encodingSchema}toEncodingData(){return new Map([["t",this.hashType]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HashFactory: ${e}`);return new Nm({hashType:Number(e.get("t"))})}};jf.encodingSchema=new xe(Mt([{key:"t",valueSchema:new J}]));let Ho=class Lm{constructor(e){this.path=e.path,this.hashFactory=e.hashFactory,this.treeDepth=e.treeDepth}getEncodingSchema(){return Lm.encodingSchema}toEncodingData(){return new Map([["pth",this.path],["hsh",this.hashFactory.toEncodingData()],["td",this.treeDepth]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded MerkleArrayProof: ${e}`);return new Lm({path:e.get("pth"),hashFactory:jf.fromEncodingData(e.get("hsh")),treeDepth:Number(e.get("td"))})}};Ho.encodingSchema=new xe(Mt([{key:"pth",valueSchema:new qe(new We)},{key:"hsh",valueSchema:jf.encodingSchema},{key:"td",valueSchema:new J}]));let _f=class Um{constructor(e){this.commitment=e.commitment,this.keyLifetime=e.keyLifetime}getEncodingSchema(){return Um.encodingSchema}toEncodingData(){return new Map([["cmt",this.commitment],["lf",this.keyLifetime]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded MerkleSignatureVerifier: ${e}`);return new Um({commitment:e.get("cmt"),keyLifetime:e.get("lf")})}};_f.encodingSchema=new xe(Mt([{key:"cmt",valueSchema:new vn(64)},{key:"lf",valueSchema:new J}]));let zf=class jm{constructor(e){this.pk=e.pk,this.weight=e.weight}getEncodingSchema(){return jm.encodingSchema}toEncodingData(){return new Map([["p",this.pk.toEncodingData()],["w",this.weight]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Participant: ${e}`);return new jm({pk:_f.fromEncodingData(e.get("p")),weight:e.get("w")})}};zf.encodingSchema=new xe(Mt([{key:"p",valueSchema:_f.encodingSchema},{key:"w",valueSchema:new J}]));let qf=class _m{constructor(e){this.publicKey=e.publicKey}getEncodingSchema(){return _m.encodingSchema}toEncodingData(){return new Map([["k",this.publicKey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded FalconVerifier: ${e}`);return new _m({publicKey:e.get("k")})}};qf.encodingSchema=new xe(Mt([{key:"k",valueSchema:new vn(1793)}]));let Hf=class zm{constructor(e){this.signature=e.signature,this.vectorCommitmentIndex=e.index,this.proof=e.proof,this.verifyingKey=e.verifyingKey}getEncodingSchema(){return zm.encodingSchema}toEncodingData(){return new Map([["sig",this.signature],["idx",this.vectorCommitmentIndex],["prf",this.proof.toEncodingData()],["vkey",this.verifyingKey.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded FalconSignatureStruct: ${e}`);return new zm({signature:e.get("sig"),index:e.get("idx"),proof:Ho.fromEncodingData(e.get("prf")),verifyingKey:qf.fromEncodingData(e.get("vkey"))})}};Hf.encodingSchema=new xe(Mt([{key:"sig",valueSchema:new We},{key:"idx",valueSchema:new J},{key:"prf",valueSchema:Ho.encodingSchema},{key:"vkey",valueSchema:qf.encodingSchema}]));let Gf=class qm{constructor(e){this.sig=e.sig,this.l=e.l}getEncodingSchema(){return qm.encodingSchema}toEncodingData(){return new Map([["s",this.sig.toEncodingData()],["l",this.l]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SigslotCommit: ${e}`);return new qm({sig:Hf.fromEncodingData(e.get("s")),l:e.get("l")})}};Gf.encodingSchema=new xe(Mt([{key:"s",valueSchema:Hf.encodingSchema},{key:"l",valueSchema:new J}]));let Kf=class Hm{constructor(e){this.sigslot=e.sigslot,this.participant=e.participant}getEncodingSchema(){return Hm.encodingSchema}toEncodingData(){return new Map([["s",this.sigslot.toEncodingData()],["p",this.participant.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Reveal: ${e}`);return new Hm({sigslot:Gf.fromEncodingData(e.get("s")),participant:zf.fromEncodingData(e.get("p"))})}};Kf.encodingSchema=new xe(Mt([{key:"s",valueSchema:Gf.encodingSchema},{key:"p",valueSchema:zf.encodingSchema}]));let Wf=class Gm{constructor(e){this.sigCommit=e.sigCommit,this.signedWeight=e.signedWeight,this.sigProofs=e.sigProofs,this.partProofs=e.partProofs,this.merkleSignatureSaltVersion=e.merkleSignatureSaltVersion,this.reveals=e.reveals,this.positionsToReveal=e.positionsToReveal}getEncodingSchema(){return Gm.encodingSchema}toEncodingData(){return new Map([["c",this.sigCommit],["w",this.signedWeight],["S",this.sigProofs.toEncodingData()],["P",this.partProofs.toEncodingData()],["v",this.merkleSignatureSaltVersion],["r",Nn(this.reveals,(e,t)=>[e,t.toEncodingData()])],["pr",this.positionsToReveal]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProof: ${e}`);return new Gm({sigCommit:e.get("c"),signedWeight:e.get("w"),sigProofs:Ho.fromEncodingData(e.get("S")),partProofs:Ho.fromEncodingData(e.get("P")),merkleSignatureSaltVersion:Number(e.get("v")),reveals:Nn(e.get("r"),(t,r)=>[t,Kf.fromEncodingData(r)]),positionsToReveal:e.get("pr")})}};Wf.encodingSchema=new xe(Mt([{key:"c",valueSchema:new We},{key:"w",valueSchema:new J},{key:"S",valueSchema:Ho.encodingSchema},{key:"P",valueSchema:Ho.encodingSchema},{key:"v",valueSchema:new J},{key:"r",valueSchema:new Uf(Kf.encodingSchema)},{key:"pr",valueSchema:new qe(new J)}]));let Jf=class Fd{constructor(e){this.blockHeadersCommitment=e.blockHeadersCommitment,this.votersCommitment=e.votersCommitment,this.lnProvenWeight=e.lnProvenWeight,this.firstAttestedRound=e.firstAttestedRound,this.lastAttestedRound=e.lastAttestedRound}getEncodingSchema(){return Fd.encodingSchema}toEncodingData(){return new Map([["b",this.blockHeadersCommitment],["v",this.votersCommitment],["P",this.lnProvenWeight],["f",this.firstAttestedRound],["l",this.lastAttestedRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofMessage: ${e}`);return new Fd({blockHeadersCommitment:e.get("b"),votersCommitment:e.get("v"),lnProvenWeight:e.get("P"),firstAttestedRound:e.get("f"),lastAttestedRound:e.get("l")})}static fromMap(e){return new Fd({blockHeadersCommitment:e.get("b"),votersCommitment:e.get("v"),lnProvenWeight:e.get("P"),firstAttestedRound:e.get("f"),lastAttestedRound:e.get("l")})}};Jf.encodingSchema=new xe(Mt([{key:"b",valueSchema:new We},{key:"v",valueSchema:new We},{key:"P",valueSchema:new J},{key:"f",valueSchema:new J},{key:"l",valueSchema:new J}]));let Hx=class Km{constructor(e){this.sig=e.sig,this.pk=e.pk,this.pk2=e.pk2,this.pk1Sig=e.pk1Sig,this.pk2Sig=e.pk2Sig}getEncodingSchema(){return Km.encodingSchema}toEncodingData(){return new Map([["s",this.sig],["p",this.pk],["p2",this.pk2],["p1s",this.pk1Sig],["p2s",this.pk2Sig]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HeartbeatProof: ${e}`);return new Km({sig:e.get("s"),pk:e.get("p"),pk2:e.get("p2"),pk1Sig:e.get("p1s"),pk2Sig:e.get("p2s")})}};Hx.encodingSchema=new xe(Mt([{key:"s",valueSchema:new vn(64)},{key:"p",valueSchema:new vn(32)},{key:"p2",valueSchema:new vn(32)},{key:"p1s",valueSchema:new vn(64)},{key:"p2s",valueSchema:new vn(64)}]));let Tl=class Wm{constructor(e){this.address=e.address,this.proof=e.proof,this.seed=e.seed,this.voteID=e.voteID,this.keyDilution=e.keyDilution}getEncodingSchema(){return Wm.encodingSchema}toEncodingData(){return new Map([["a",this.address],["prf",this.proof.toEncodingData()],["sd",this.seed],["vid",this.voteID],["kd",this.keyDilution]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Heartbeat: ${e}`);return new Wm({address:e.get("a"),proof:Hx.fromEncodingData(e.get("prf")),seed:e.get("sd"),voteID:e.get("vid"),keyDilution:e.get("kd")})}};Tl.encodingSchema=new xe(Mt([{key:"a",valueSchema:new gn},{key:"prf",valueSchema:Hx.encodingSchema},{key:"sd",valueSchema:new We},{key:"vid",valueSchema:new vn(32)},{key:"kd",valueSchema:new J}]));const _R=52,zR=32,qR=75,HR=32,GR=32,KR=32,WR=64,JR=32;function QA(n){return n.every(e=>e===0)}function Sp(n,e,t){if(n==null)return;let r;if(n instanceof Uint8Array&&(r=n),r==null||r.byteLength!==t)throw Error(`${e} must be a ${t} byte Uint8Array`);return r}function _i(n){if(n==null)throw new Error("Address must not be null or undefined");if(typeof n=="string")return Ot.fromString(n);if(n instanceof Ot)return n;throw new Error(`Not an address: ${n}`)}function mo(n){if(n==null)return;let e;if(n instanceof Ot)e=n;else if(typeof n=="string")e=Ot.fromString(n);else throw new Error(`Not an address: ${n}`);if(QA(e.publicKey))throw new Error("Invalid use of the zero address. To omit this value, pass in undefined");return e}function ZA(n){if(!(typeof n>"u")){if(n instanceof Uint8Array)return n;throw new Error(`Not a Uint8Array: ${n}`)}}function ys(n){if(n instanceof Uint8Array)return n;throw new Error(`Not a Uint8Array: ${n}`)}function vp(n){if(!(typeof n>"u"))return yn(n)}function gd(n){if(n===!0||n===!1)return n;throw new Error(`Not a boolean: ${n}`)}function Xa(n){if(Array.isArray(n))return n.slice();throw new Error(`Not an array: ${n}`)}function _1(n,e,t){const r=ZA(n);if(!(typeof r>"u")){if(r.byteLength!==e)throw new Error(`${t} must be ${e} bytes long, was ${r.byteLength}`);if(!QA(r))return r}}function eD(n){if(n!=null&&typeof n=="object"){const{appIndex:e,name:t}=n;return{appIndex:yn(e),name:ys(t)}}throw new Error(`Not a box reference: ${n}`)}function YR(n){if(n!=null&&typeof n=="object"){const{assetIndex:e,address:t}=n;return{assetIndex:yn(e),address:_i(t)}}throw new Error(`Not a holding reference: ${n}`)}function XR(n){if(n!=null&&typeof n=="object"){const{appIndex:e,address:t}=n;return{appIndex:yn(e),address:_i(t)}}throw new Error(`Not a locals reference: ${n}`)}function QR(n){if(n!=null&&typeof n=="object"){const{address:e,appIndex:t,assetIndex:r,holding:i,locals:o,box:s}=n;if(e!==void 0)return{address:_i(e)};if(t!==void 0)return{appIndex:yn(t)};if(r!==void 0)return{assetIndex:yn(r)};if(i!==void 0)return{holding:YR(i)};if(o!==void 0)return{locals:XR(o)};if(s!==void 0)return{box:eD(s)}}throw new Error(`Not a resource reference: ${n}`)}const z1=new TextEncoder().encode("TX");let Jr=class Td{constructor(e){if(!Om(e.type))throw new Error(`Invalid transaction type: ${e.type}`);if(this.type=e.type,this.sender=_i(e.sender),this.note=ys(e.note??new Uint8Array),this.lease=_1(e.lease,zR,"lease"),this.rekeyTo=mo(e.rekeyTo),this.group=void 0,this.firstValid=yn(e.suggestedParams.firstValid),this.lastValid=yn(e.suggestedParams.lastValid),e.suggestedParams.genesisID){if(typeof e.suggestedParams.genesisID!="string")throw new Error("Genesis ID must be a string if present");this.genesisID=e.suggestedParams.genesisID}this.genesisHash=ZA(e.suggestedParams.genesisHash);const t=[];if(e.paymentParams&&t.push(un.pay),e.keyregParams&&t.push(un.keyreg),e.assetConfigParams&&t.push(un.acfg),e.assetTransferParams&&t.push(un.axfer),e.assetFreezeParams&&t.push(un.afrz),e.appCallParams&&t.push(un.appl),e.stateProofParams&&t.push(un.stpf),e.heartbeatParams&&t.push(un.hb),t.length!==1)throw new Error(`Transaction has wrong number of type fields present (${t.length}): ${t}`);if(this.type!==t[0])throw new Error(`Transaction has type ${this.type} but fields present for ${t[0]}`);if(e.paymentParams&&(this.payment={receiver:_i(e.paymentParams.receiver),amount:yn(e.paymentParams.amount),closeRemainderTo:mo(e.paymentParams.closeRemainderTo)}),e.keyregParams){if(this.keyreg={voteKey:Sp(e.keyregParams.voteKey,"voteKey",GR),selectionKey:Sp(e.keyregParams.selectionKey,"selectionKey",KR),stateProofKey:Sp(e.keyregParams.stateProofKey,"stateProofKey",WR),voteFirst:vp(e.keyregParams.voteFirst),voteLast:vp(e.keyregParams.voteLast),voteKeyDilution:vp(e.keyregParams.voteKeyDilution),nonParticipation:gd(e.keyregParams.nonParticipation??!1)},this.keyreg.nonParticipation&&(this.keyreg.voteKey||this.keyreg.selectionKey||this.keyreg.stateProofKey||typeof this.keyreg.voteFirst<"u"||typeof this.keyreg.voteLast<"u"||typeof this.keyreg.voteKeyDilution<"u"))throw new Error("nonParticipation is true but participation params are present.");if(!this.keyreg.nonParticipation&&(this.keyreg.voteKey||this.keyreg.selectionKey||this.keyreg.stateProofKey||typeof this.keyreg.voteFirst<"u"||typeof this.keyreg.voteLast<"u"||typeof this.keyreg.voteKeyDilution<"u")&&!(this.keyreg.voteKey&&this.keyreg.selectionKey&&typeof this.keyreg.voteFirst<"u"&&typeof this.keyreg.voteLast<"u"&&typeof this.keyreg.voteKeyDilution<"u"))throw new Error("Online key registration missing at least one of the following fields: voteKey, selectionKey, voteFirst, voteLast, voteKeyDilution")}if(e.assetConfigParams&&(this.assetConfig={assetIndex:yn(e.assetConfigParams.assetIndex??0),total:yn(e.assetConfigParams.total??0),decimals:Yn(e.assetConfigParams.decimals??0),defaultFrozen:gd(e.assetConfigParams.defaultFrozen??!1),manager:mo(e.assetConfigParams.manager),reserve:mo(e.assetConfigParams.reserve),freeze:mo(e.assetConfigParams.freeze),clawback:mo(e.assetConfigParams.clawback),unitName:e.assetConfigParams.unitName,assetName:e.assetConfigParams.assetName,assetURL:e.assetConfigParams.assetURL,assetMetadataHash:_1(e.assetConfigParams.assetMetadataHash,HR,"assetMetadataHash")}),e.assetTransferParams&&(this.assetTransfer={assetIndex:yn(e.assetTransferParams.assetIndex),amount:yn(e.assetTransferParams.amount),assetSender:mo(e.assetTransferParams.assetSender),receiver:_i(e.assetTransferParams.receiver),closeRemainderTo:mo(e.assetTransferParams.closeRemainderTo)}),e.assetFreezeParams&&(this.assetFreeze={assetIndex:yn(e.assetFreezeParams.assetIndex),freezeAccount:_i(e.assetFreezeParams.freezeTarget),frozen:gd(e.assetFreezeParams.frozen)}),e.appCallParams){const{onComplete:i}=e.appCallParams;if(!XA(i))throw new Error(`Invalid onCompletion value: ${i}`);this.applicationCall={appIndex:yn(e.appCallParams.appIndex),onComplete:i,numLocalInts:Yn(e.appCallParams.numLocalInts??0),numLocalByteSlices:Yn(e.appCallParams.numLocalByteSlices??0),numGlobalInts:Yn(e.appCallParams.numGlobalInts??0),numGlobalByteSlices:Yn(e.appCallParams.numGlobalByteSlices??0),extraPages:Yn(e.appCallParams.extraPages??0),approvalProgram:ys(e.appCallParams.approvalProgram??new Uint8Array),clearProgram:ys(e.appCallParams.clearProgram??new Uint8Array),appArgs:Xa(e.appCallParams.appArgs??[]).map(ys),accounts:Xa(e.appCallParams.accounts??[]).map(_i),foreignApps:Xa(e.appCallParams.foreignApps??[]).map(yn),foreignAssets:Xa(e.appCallParams.foreignAssets??[]).map(yn),boxes:Xa(e.appCallParams.boxes??[]).map(eD),access:Xa(e.appCallParams.access??[]).map(QR),rejectVersion:Yn(e.appCallParams.rejectVersion??0)}}if(e.stateProofParams&&(this.stateProof={stateProofType:Yn(e.stateProofParams.stateProofType??0),stateProof:e.stateProofParams.stateProof,message:e.stateProofParams.message}),e.heartbeatParams&&(this.heartbeat=new Tl({address:e.heartbeatParams.address,proof:e.heartbeatParams.proof,seed:e.heartbeatParams.seed,voteID:e.heartbeatParams.voteID,keyDilution:e.heartbeatParams.keyDilution})),this.fee=yn(e.suggestedParams.fee),!gd(e.suggestedParams.flatFee??!1)){const i=yn(e.suggestedParams.minFee);this.fee*=BigInt(this.estimateSize()),this.fee<i&&(this.fee=i)}}getEncodingSchema(){return Td.encodingSchema}toEncodingData(){const e=new Map([["type",this.type],["fv",this.firstValid],["lv",this.lastValid],["snd",this.sender],["gen",this.genesisID],["gh",this.genesisHash],["fee",this.fee],["note",this.note],["lx",this.lease],["rekey",this.rekeyTo],["grp",this.group]]);if(this.payment)return e.set("amt",this.payment.amount),e.set("rcv",this.payment.receiver),e.set("close",this.payment.closeRemainderTo),e;if(this.keyreg)return e.set("votekey",this.keyreg.voteKey),e.set("selkey",this.keyreg.selectionKey),e.set("sprfkey",this.keyreg.stateProofKey),e.set("votefst",this.keyreg.voteFirst),e.set("votelst",this.keyreg.voteLast),e.set("votekd",this.keyreg.voteKeyDilution),e.set("nonpart",this.keyreg.nonParticipation),e;if(this.assetConfig){e.set("caid",this.assetConfig.assetIndex);const t=new Map([["t",this.assetConfig.total],["dc",this.assetConfig.decimals],["df",this.assetConfig.defaultFrozen],["m",this.assetConfig.manager],["r",this.assetConfig.reserve],["f",this.assetConfig.freeze],["c",this.assetConfig.clawback],["un",this.assetConfig.unitName],["an",this.assetConfig.assetName],["au",this.assetConfig.assetURL],["am",this.assetConfig.assetMetadataHash]]);return e.set("apar",t),e}if(this.assetTransfer)return e.set("xaid",this.assetTransfer.assetIndex),e.set("aamt",this.assetTransfer.amount),e.set("arcv",this.assetTransfer.receiver),e.set("aclose",this.assetTransfer.closeRemainderTo),e.set("asnd",this.assetTransfer.assetSender),e;if(this.assetFreeze)return e.set("faid",this.assetFreeze.assetIndex),e.set("afrz",this.assetFreeze.frozen),e.set("fadd",this.assetFreeze.freezeAccount),e;if(this.applicationCall)return e.set("apid",this.applicationCall.appIndex),e.set("apan",this.applicationCall.onComplete),e.set("apaa",this.applicationCall.appArgs),e.set("apat",this.applicationCall.accounts),e.set("apas",this.applicationCall.foreignAssets),e.set("apfa",this.applicationCall.foreignApps),e.set("apbx",NR(this.applicationCall.boxes,this.applicationCall.foreignApps,this.applicationCall.appIndex)),e.set("al",LR(this.applicationCall.appIndex,this.applicationCall.access)),e.set("apap",this.applicationCall.approvalProgram),e.set("apsu",this.applicationCall.clearProgram),e.set("apls",new Map([["nui",this.applicationCall.numLocalInts],["nbs",this.applicationCall.numLocalByteSlices]])),e.set("apgs",new Map([["nui",this.applicationCall.numGlobalInts],["nbs",this.applicationCall.numGlobalByteSlices]])),e.set("apep",this.applicationCall.extraPages),e.set("aprv",this.applicationCall.rejectVersion),e;if(this.stateProof)return e.set("sptype",this.stateProof.stateProofType),e.set("sp",this.stateProof.stateProof?this.stateProof.stateProof.toEncodingData():void 0),e.set("spmsg",this.stateProof.message?this.stateProof.message.toEncodingData():void 0),e;if(this.heartbeat){const t=new Tl({address:this.heartbeat.address,proof:this.heartbeat.proof,seed:this.heartbeat.seed,voteID:this.heartbeat.voteID,keyDilution:this.heartbeat.keyDilution});return e.set("hb",t.toEncodingData()),e}throw new Error(`Unexpected transaction type: ${this.type}`)}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded logic sig account: ${e}`);const t={minFee:BigInt(0),flatFee:!0,fee:e.get("fee")??0,firstValid:e.get("fv")??0,lastValid:e.get("lv")??0,genesisHash:e.get("gh"),genesisID:e.get("gen")},r=e.get("type");if(!Om(r))throw new Error(`Unrecognized transaction type: ${r}`);const i={type:r,sender:e.get("snd")??Ot.zeroAddress(),note:e.get("note"),lease:e.get("lx"),suggestedParams:t};if(e.get("rekey")&&(i.rekeyTo=e.get("rekey")),i.type===un.pay){const s={amount:e.get("amt")??0,receiver:e.get("rcv")??Ot.zeroAddress()};e.get("close")&&(s.closeRemainderTo=e.get("close")),i.paymentParams=s}else if(i.type===un.keyreg){const s={voteKey:e.get("votekey"),selectionKey:e.get("selkey"),stateProofKey:e.get("sprfkey"),voteFirst:e.get("votefst"),voteLast:e.get("votelst"),voteKeyDilution:e.get("votekd"),nonParticipation:e.get("nonpart")};i.keyregParams=s}else if(i.type===un.acfg){const s={assetIndex:e.get("caid")};if(e.get("apar")){const a=e.get("apar");s.total=a.get("t"),s.decimals=a.get("dc"),s.defaultFrozen=a.get("df"),s.unitName=a.get("un"),s.assetName=a.get("an"),s.assetURL=a.get("au"),s.assetMetadataHash=a.get("am"),a.get("m")&&(s.manager=a.get("m")),a.get("r")&&(s.reserve=a.get("r")),a.get("f")&&(s.freeze=a.get("f")),a.get("c")&&(s.clawback=a.get("c"))}i.assetConfigParams=s}else if(i.type===un.axfer){const s={assetIndex:e.get("xaid")??0,amount:e.get("aamt")??0,receiver:e.get("arcv")??Ot.zeroAddress()};e.get("aclose")&&(s.closeRemainderTo=e.get("aclose")),e.get("asnd")&&(s.assetSender=e.get("asnd")),i.assetTransferParams=s}else if(i.type===un.afrz){const s={assetIndex:e.get("faid")??0,freezeTarget:e.get("fadd")??Ot.zeroAddress(),frozen:e.get("afrz")??!1};i.assetFreezeParams=s}else if(i.type===un.appl){const s={appIndex:e.get("apid")??0,onComplete:Yn(e.get("apan")??0),appArgs:e.get("apaa"),accounts:e.get("apat"),foreignAssets:e.get("apas"),foreignApps:e.get("apfa"),approvalProgram:e.get("apap"),clearProgram:e.get("apsu"),extraPages:e.get("apep"),rejectVersion:e.get("aprv")??0},a=e.get("apls");a&&(s.numLocalInts=a.get("nui"),s.numLocalByteSlices=a.get("nbs"));const l=e.get("apgs");l&&(s.numGlobalInts=l.get("nui"),s.numGlobalByteSlices=l.get("nbs"));const c=e.get("apbx");c&&(s.boxes=c.map(f=>{const m=Yn(f.get("i")??0),w=ys(f.get("n")??new Uint8Array);if(m===0)return{appIndex:0,name:w};if(!s.foreignApps||m>s.foreignApps.length)throw new Error(`Cannot find foreign app index ${m} in ${s.foreignApps}`);return{appIndex:s.foreignApps[m-1],name:w}}));const d=e.get("al");d&&(s.access=UR(d)),i.appCallParams=s}else if(i.type===un.stpf){const s={stateProofType:e.get("sptype"),stateProof:e.get("sp")?Wf.fromEncodingData(e.get("sp")):void 0,message:e.get("spmsg")?Jf.fromEncodingData(e.get("spmsg")):void 0};i.stateProofParams=s}else if(i.type===un.hb){const s=Tl.fromEncodingData(e.get("hb")),a={address:s.address,proof:s.proof,seed:s.seed,voteID:s.voteID,keyDilution:s.keyDilution};i.heartbeatParams=a}else{const s=i.type;throw new Error(`Unexpected transaction type: ${s}`)}const o=new Td(i);if(e.get("grp")){const s=ys(e.get("grp"));if(s.byteLength!==JR)throw new Error(`Invalid group length: ${s.byteLength}`);o.group=s}return o}estimateSize(){return this.toByte().length+qR}bytesToSign(){const e=this.toByte();return Un(z1,e)}toByte(){return Wr(this)}rawSignTxn(e){const t=this.bytesToSign();return jl(t,e)}signTxn(e){const t=Vf(e),r=new Ot(t.publicKey),i=this.rawSignTxn(e);return this.attachSignature(r,i)}attachSignature(e,t){if(!PA(t.length))throw new Error("Invalid signature length");const r=new Map([["sig",t],["txn",this.toEncodingData()]]),i=_i(e);this.sender.equals(i)||r.set("sgnr",i);const o=new xe(Mt([{key:"txn",valueSchema:Td.encodingSchema},{key:"sig",valueSchema:new vn(64)},{key:"sgnr",valueSchema:new $(new gn)}]));return td(o.prepareMsgpack(r))}rawTxID(){const e=this.toByte(),t=Un(z1,e);return Uint8Array.from(Zi(t))}txID(){const e=this.rawTxID();return _l.encode(e).slice(0,_R)}};Jr.encodingSchema=new xe(Mt([{key:"type",valueSchema:new Ne},{key:"snd",valueSchema:new gn},{key:"lv",valueSchema:new J},{key:"gen",valueSchema:new $(new Ne)},{key:"gh",valueSchema:new $(new vn(32))},{key:"fee",valueSchema:new J},{key:"fv",valueSchema:new J},{key:"note",valueSchema:new We},{key:"lx",valueSchema:new $(new vn(32))},{key:"rekey",valueSchema:new $(new gn)},{key:"grp",valueSchema:new $(new vn(32))},{key:"amt",valueSchema:new $(new J)},{key:"rcv",valueSchema:new $(new gn)},{key:"close",valueSchema:new $(new gn)},{key:"votekey",valueSchema:new $(new vn(32))},{key:"selkey",valueSchema:new $(new vn(32))},{key:"sprfkey",valueSchema:new $(new vn(64))},{key:"votefst",valueSchema:new $(new J)},{key:"votelst",valueSchema:new $(new J)},{key:"votekd",valueSchema:new $(new J)},{key:"nonpart",valueSchema:new $(new jt)},{key:"caid",valueSchema:new $(new J)},{key:"apar",valueSchema:new $(new xe(Mt([{key:"t",valueSchema:new J},{key:"dc",valueSchema:new J},{key:"df",valueSchema:new jt},{key:"m",valueSchema:new $(new gn)},{key:"r",valueSchema:new $(new gn)},{key:"f",valueSchema:new $(new gn)},{key:"c",valueSchema:new $(new gn)},{key:"un",valueSchema:new $(new Ne)},{key:"an",valueSchema:new $(new Ne)},{key:"au",valueSchema:new $(new Ne)},{key:"am",valueSchema:new $(new vn(32))}])))},{key:"xaid",valueSchema:new $(new J)},{key:"aamt",valueSchema:new $(new J)},{key:"arcv",valueSchema:new $(new gn)},{key:"aclose",valueSchema:new $(new gn)},{key:"asnd",valueSchema:new $(new gn)},{key:"faid",valueSchema:new $(new J)},{key:"afrz",valueSchema:new $(new jt)},{key:"fadd",valueSchema:new $(new gn)},{key:"apid",valueSchema:new $(new J)},{key:"apan",valueSchema:new $(new J)},{key:"apaa",valueSchema:new $(new qe(new We))},{key:"apat",valueSchema:new $(new qe(new gn))},{key:"apas",valueSchema:new $(new qe(new J))},{key:"apfa",valueSchema:new $(new qe(new J))},{key:"apbx",valueSchema:new $(new qe(new xe(Mt([{key:"i",valueSchema:new J},{key:"n",valueSchema:new We}]))))},{key:"al",valueSchema:new $(new qe(new xe(Mt([{key:"d",valueSchema:new $(new gn)},{key:"s",valueSchema:new $(new J)},{key:"p",valueSchema:new $(new J)},{key:"h",valueSchema:new $(new xe(Mt([{key:"d",valueSchema:new J},{key:"s",valueSchema:new J}])))},{key:"l",valueSchema:new $(new xe(Mt([{key:"d",valueSchema:new J},{key:"p",valueSchema:new J}])))},{key:"b",valueSchema:new $(new xe(Mt([{key:"i",valueSchema:new J},{key:"n",valueSchema:new We}])))}]))))},{key:"apap",valueSchema:new $(new We)},{key:"apsu",valueSchema:new $(new We)},{key:"apls",valueSchema:new $(new xe(Mt([{key:"nui",valueSchema:new J},{key:"nbs",valueSchema:new J}])))},{key:"apgs",valueSchema:new $(new xe(Mt([{key:"nui",valueSchema:new J},{key:"nbs",valueSchema:new J}])))},{key:"apep",valueSchema:new $(new J)},{key:"aprv",valueSchema:new $(new J)},{key:"sptype",valueSchema:new $(new J)},{key:"sp",valueSchema:new $(Wf.encodingSchema)},{key:"spmsg",valueSchema:new $(Jf.encodingSchema)},{key:"hb",valueSchema:new $(Tl.encodingSchema)}]));function ZR(n){return Wr(n)}function eC(n){return Fn(n,Jr)}const sl=new Uint8Array([77,117,108,116,105,115,105,103,65,100,100,114]),tC="invalid multisig version",nC="bad multisig threshold",rC="bad multisig public key - wrong length",iC="nacl public key length is not 32 bytes";function _u(n){return n.map(e=>typeof e=="string"?Ot.fromString(e).publicKey:e.publicKey)}function eo({version:n,threshold:e,pks:t}){if(n!==1||n>255||n<0)throw new Error(tC);if(e===0||t.length===0||e>t.length||e>255)throw new Error(nC);const r=ms-Dl;if(r!==BA)throw new Error(iC);const i=new Uint8Array(sl.length+2+r*t.length);i.set(sl,0),i.set([n],sl.length),i.set([e],sl.length+1);for(let o=0;o<t.length;o++){if(t[o].length!==r)throw new Error(rC);i.set(t[o],sl.length+2+o*r)}return new Ot(Uint8Array.from(Zi(i)))}function oC({version:n,threshold:e,addrs:t}){const r=_u(t);return eo({version:n,threshold:e,pks:r})}function Jm(n,e,t){const r=e.v,i=e.thr,o=e.subsig,s=o.map(d=>d.pk);if(e.subsig.length<i)return!1;let a;try{a=eo({version:r,threshold:i,pks:s}).publicKey}catch{return!1}if(!Fi(a,t))return!1;let l=0;for(const d of o)d.s!==void 0&&(l+=1);if(l<i)return!1;let c=0;for(const d of o)d.s!==void 0&&Of(n,d.s,d.pk)&&(c+=1);return!(c<i)}function sC({version:n,threshold:e,addrs:t}){return oC({version:n,threshold:e,addrs:t})}const tD=new xe(Mt([{key:"pk",valueSchema:new vn(32)},{key:"s",valueSchema:new $(new vn(64))}]));function nD(n){if(!(n instanceof Map))throw new Error(`Invalid decoded EncodedSubsig: ${n}`);const e={pk:n.get("pk")};return n.get("s")&&(e.s=n.get("s")),e}function rD(n){const e=new Map([["pk",n.pk]]);return n.s&&e.set("s",n.s),e}const Qd=new xe(Mt([{key:"v",valueSchema:new J},{key:"thr",valueSchema:new J},{key:"subsig",valueSchema:new qe(tD)}]));function Zd(n){if(!(n instanceof Map))throw new Error(`Invalid decoded EncodedMultiSig: ${n}`);return{v:Yn(n.get("v")),thr:Yn(n.get("thr")),subsig:n.get("subsig").map(nD)}}function ef(n){return new Map([["v",n.v],["thr",n.thr],["subsig",n.subsig.map(rD)]])}const aC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;function q1(n){if(!n||n.length===0)throw new Error("empty program");const e=10,t=32,r=126,i=s=>t<=s&&s<=r;if(n.every(s=>s===e||i(s))){const s=new TextDecoder().decode(n);throw NA(s)?new Error("requesting program bytes, get Algorand address"):aC.test(s)?new Error("program should not be b64 encoded"):new Error("program bytes are all ASCII printable characters, not looking like Teal byte code")}}const xp=new TextEncoder().encode("Program"),H1=new TextEncoder().encode("MsigProgram");let to=class Id{constructor(e,t){if(t&&(!Array.isArray(t)||!t.every(i=>i.constructor===Uint8Array)))throw new TypeError("Invalid arguments");let r=[];t!=null&&(r=t.map(i=>new Uint8Array(i))),q1(e),this.logic=e,this.args=r,this.sig=void 0,this.msig=void 0,this.lmsig=void 0}getEncodingSchema(){return Id.encodingSchema}toEncodingData(){const e=new Map([["l",this.logic],["arg",this.args],["sig",this.sig]]);return this.msig&&e.set("msig",ef(this.msig)),this.lmsig&&e.set("lmsig",ef(this.lmsig)),e}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded logic sig: ${e}`);const t=new Id(e.get("l"),e.get("arg"));return t.sig=e.get("sig"),e.get("msig")&&(t.msig=Zd(e.get("msig"))),e.get("lmsig")&&(t.lmsig=Zd(e.get("lmsig"))),t}verify(e){if([this.sig,this.msig,this.lmsig].filter(Boolean).length>1)return!1;try{q1(this.logic)}catch{return!1}const r=Un(xp,this.logic);if(!this.sig&&!this.msig&&!this.lmsig){const i=Zi(r);return Fi(i,e)}if(this.sig)return Of(r,this.sig,e);if(this.lmsig){const i=eo({version:this.lmsig.v,threshold:this.lmsig.thr,pks:this.lmsig.subsig.map(s=>s.pk)}),o=Un(H1,i.publicKey,this.logic);return Jm(o,this.lmsig,e)}return this.msig?Jm(r,this.msig,e):!1}address(){const e=Un(xp,this.logic),t=Zi(e);return new Ot(Uint8Array.from(t))}sign(e,t){if(t==null)this.sig=this.signProgram(e);else{const r=_u(t.addrs).map(s=>({pk:s}));this.lmsig={v:t.version,thr:t.threshold,subsig:r};const[i,o]=this.singleSignMultisig(e,this.lmsig);this.lmsig.subsig[o].s=i}}appendToMultisig(e){if(this.lmsig===void 0)throw new Error("no multisig present");const[t,r]=this.singleSignMultisig(e,this.lmsig);this.lmsig.subsig[r].s=t}signProgram(e){const t=Un(xp,this.logic);return jl(t,e)}signProgramMultisig(e,t){const r=eo({version:t.v,threshold:t.thr,pks:t.subsig.map(s=>s.pk)}),i=Un(H1,r.publicKey,this.logic);return jl(i,e)}singleSignMultisig(e,t){let r=-1;const i=Vf(e).publicKey;for(let s=0;s<t.subsig.length;s++){const{pk:a}=t.subsig[s];if(Fi(a,i)){r=s;break}}if(r===-1)throw new Error("invalid secret key");return[this.signProgramMultisig(e,t),r]}toByte(){return Wr(this)}static fromByte(e){return Fn(e,Id)}};to.encodingSchema=new xe(Mt([{key:"l",valueSchema:new We},{key:"arg",valueSchema:new qe(new We)},{key:"sig",valueSchema:new $(new vn(64))},{key:"msig",valueSchema:new $(Qd)},{key:"lmsig",valueSchema:new $(Qd)}]));let Gx=class Md{constructor(e,t){this.lsig=new to(e,t),this.sigkey=void 0}getEncodingSchema(){return Md.encodingSchema}toEncodingData(){return new Map([["lsig",this.lsig.toEncodingData()],["sigkey",this.sigkey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded logic sig account: ${e}`);const t=e,r=to.fromEncodingData(t.get("lsig")),i=new Md(r.logic,r.args);return i.lsig=r,i.sigkey=t.get("sigkey"),i}toByte(){return Wr(this)}static fromByte(e){return Fn(e,Md)}isDelegated(){return!!(this.lsig.sig||this.lsig.msig||this.lsig.lmsig)}verify(){const e=this.address();return this.lsig.verify(e.publicKey)}address(){if([this.lsig.sig,this.lsig.msig,this.lsig.lmsig].filter(Boolean).length>1)throw new Error("LogicSig has too many signatures. At most one of sig, msig, or lmsig may be present");if(this.lsig.sig){if(!this.sigkey)throw new Error("Signing key for delegated account is missing");return new Ot(this.sigkey)}const t=this.lsig.lmsig||this.lsig.msig;if(t){const r={version:t.v,threshold:t.thr,pks:t.subsig.map(i=>i.pk)};return eo(r)}return this.lsig.address()}signMultisig(e,t){this.lsig.sign(t,e)}appendToMultisig(e){this.lsig.appendToMultisig(e)}sign(e){this.lsig.sign(e),this.sigkey=Vf(e).publicKey}};Gx.encodingSchema=new xe(Mt([{key:"lsig",valueSchema:to.encodingSchema},{key:"sigkey",valueSchema:new $(new vn(32))}]));function cC(n){return Fn(n,to)}const iD=new TextEncoder().encode("ProgData");function oD(n,e,t){const r=typeof t=="string"?Ot.fromString(t):t,i=Un(r.publicKey,e),o=Un(iD,i);return jl(o,n)}function uC(n,e,t,r){const i=typeof e=="string"?Ot.fromString(e):e,o=Un(i.publicKey,n),s=Un(iD,o);return Of(s,t,r)}function lC(n,e,t){const i=new to(t).address();return oD(n,e,i)}let kn=class Ym{constructor({txn:e,sig:t,msig:r,lsig:i,sgnr:o}){this.txn=e,this.sig=t,this.msig=r,this.lsig=i,this.sgnr=o;let s=0;if(t&&(s+=1),r&&(s+=1),i&&(s+=1),s>1)throw new Error(`SignedTransaction must not have more than 1 signature. Got ${s}`)}getEncodingSchema(){return Ym.encodingSchema}toEncodingData(){return new Map([["txn",this.txn.toEncodingData()],["sig",this.sig],["msig",this.msig?ef(this.msig):void 0],["lsig",this.lsig?this.lsig.toEncodingData():void 0],["sgnr",this.sgnr]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SignedTransaction: ${e}`);return new Ym({txn:Jr.fromEncodingData(e.get("txn")),sig:e.get("sig"),msig:e.get("msig")?Zd(e.get("msig")):void 0,lsig:e.get("lsig")?to.fromEncodingData(e.get("lsig")):void 0,sgnr:e.get("sgnr")})}};kn.encodingSchema=new xe(Mt([{key:"txn",valueSchema:Jr.encodingSchema},{key:"sig",valueSchema:new $(new vn(64))},{key:"msig",valueSchema:new $(Qd)},{key:"lsig",valueSchema:new $(to.encodingSchema)},{key:"sgnr",valueSchema:new $(new gn)}]));function hC(n){return Fn(n,kn)}function sD(n){const e=new kn({txn:n});return Wr(e)}let Yf=class Xm{constructor(e){this.stateProofVotersCommitment=e.stateProofVotersCommitment,this.stateProofOnlineTotalWeight=e.stateProofOnlineTotalWeight,this.stateProofNextRound=e.stateProofNextRound}getEncodingSchema(){return Xm.encodingSchema}toEncodingData(){return new Map([["v",this.stateProofVotersCommitment],["t",this.stateProofOnlineTotalWeight],["n",this.stateProofNextRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofTrackingData: ${e}`);return new Xm({stateProofVotersCommitment:e.get("v"),stateProofOnlineTotalWeight:e.get("t"),stateProofNextRound:e.get("n")})}};Yf.encodingSchema=new xe(Mt([{key:"v",valueSchema:new We},{key:"t",valueSchema:new J},{key:"n",valueSchema:new J}]));let Xf=class Qm{constructor(e){this.nativeSha512_256Commitment=e.nativeSha512_256Commitment,this.sha256Commitment=e.sha256Commitment}getEncodingSchema(){return Qm.encodingSchema}toEncodingData(){return new Map([["txn",this.nativeSha512_256Commitment],["txn256",this.sha256Commitment]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TxnCommitments: ${e}`);return new Qm({nativeSha512_256Commitment:e.get("txn"),sha256Commitment:e.get("txn256")})}};Xf.encodingSchema=new xe(Mt([{key:"txn",valueSchema:new vn(32)},{key:"txn256",valueSchema:new vn(32)}]));let Qf=class Zm{constructor(e){this.feeSink=e.feeSink,this.rewardsPool=e.rewardsPool,this.rewardsLevel=e.rewardsLevel,this.rewardsRate=e.rewardsRate,this.rewardsResidue=e.rewardsResidue,this.rewardsRecalculationRound=e.rewardsRecalculationRound}getEncodingSchema(){return Zm.encodingSchema}toEncodingData(){return new Map([["fees",this.feeSink],["rwd",this.rewardsPool],["earn",this.rewardsLevel],["rate",this.rewardsRate],["frac",this.rewardsResidue],["rwcalr",this.rewardsRecalculationRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded RewardState: ${e}`);return new Zm({feeSink:e.get("fees"),rewardsPool:e.get("rwd"),rewardsLevel:e.get("earn"),rewardsRate:e.get("rate"),rewardsResidue:e.get("frac"),rewardsRecalculationRound:e.get("rwcalr")})}};Qf.encodingSchema=new xe(Mt([{key:"fees",valueSchema:new gn},{key:"rwd",valueSchema:new gn},{key:"earn",valueSchema:new J},{key:"rate",valueSchema:new J},{key:"frac",valueSchema:new J},{key:"rwcalr",valueSchema:new J}]));let Zf=class ey{constructor(e){this.currentProtocol=e.currentProtocol,this.nextProtocol=e.nextProtocol,this.nextProtocolApprovals=e.nextProtocolApprovals,this.nextProtocolVoteBefore=e.nextProtocolVoteBefore,this.nextProtocolSwitchOn=e.nextProtocolSwitchOn}getEncodingSchema(){return ey.encodingSchema}toEncodingData(){return new Map([["proto",this.currentProtocol],["nextproto",this.nextProtocol],["nextyes",this.nextProtocolApprovals],["nextbefore",this.nextProtocolVoteBefore],["nextswitch",this.nextProtocolSwitchOn]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded UpgradeState: ${e}`);return new ey({currentProtocol:e.get("proto"),nextProtocol:e.get("nextproto"),nextProtocolApprovals:e.get("nextyes"),nextProtocolVoteBefore:e.get("nextbefore"),nextProtocolSwitchOn:e.get("nextswitch")})}};Zf.encodingSchema=new xe(Mt([{key:"proto",valueSchema:new Ne},{key:"nextproto",valueSchema:new Ne},{key:"nextyes",valueSchema:new J},{key:"nextbefore",valueSchema:new J},{key:"nextswitch",valueSchema:new J}]));let eg=class ty{constructor(e){this.upgradePropose=e.upgradePropose,this.upgradeDelay=e.upgradeDelay,this.upgradeApprove=e.upgradeApprove}getEncodingSchema(){return ty.encodingSchema}toEncodingData(){return new Map([["upgradeprop",this.upgradePropose],["upgradedelay",this.upgradeDelay],["upgradeyes",this.upgradeApprove]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded UpgradeVote: ${e}`);return new ty({upgradePropose:e.get("upgradeprop"),upgradeDelay:e.get("upgradedelay"),upgradeApprove:e.get("upgradeyes")})}};eg.encodingSchema=new xe(Mt([{key:"upgradeprop",valueSchema:new Ne},{key:"upgradedelay",valueSchema:new J},{key:"upgradeyes",valueSchema:new jt}]));let tg=class ny{constructor(e){this.expiredParticipationAccounts=e.expiredParticipationAccounts,this.absentParticipationAccounts=e.absentParticipationAccounts}getEncodingSchema(){return ny.encodingSchema}toEncodingData(){return new Map([["partupdrmv",this.expiredParticipationAccounts],["partupdabs",this.absentParticipationAccounts]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ParticipationUpdates: ${e}`);return new ny({expiredParticipationAccounts:e.get("partupdrmv"),absentParticipationAccounts:e.get("partupdabs")})}};tg.encodingSchema=new xe(Mt([{key:"partupdrmv",valueSchema:new qe(new gn)},{key:"partupdabs",valueSchema:new qe(new gn)}]));let zu=class ry{constructor(e){this.round=e.round,this.branch=e.branch,this.seed=e.seed,this.txnCommitments=e.txnCommitments,this.timestamp=e.timestamp,this.genesisID=e.genesisID,this.genesisHash=e.genesisHash,this.proposer=e.proposer,this.feesCollected=e.feesCollected,this.bonus=e.bonus,this.proposerPayout=e.proposerPayout,this.rewardState=e.rewardState,this.upgradeState=e.upgradeState,this.upgradeVote=e.upgradeVote,this.txnCounter=e.txnCounter,this.stateproofTracking=e.stateproofTracking,this.participationUpdates=e.participationUpdates}getEncodingSchema(){return ry.encodingSchema}toEncodingData(){const e=new Map([["rnd",this.round],["prev",this.branch],["seed",this.seed],["ts",this.timestamp],["gen",this.genesisID],["gh",this.genesisHash],["prp",this.proposer],["fc",this.feesCollected],["bi",this.bonus],["pp",this.proposerPayout],["tc",this.txnCounter],["spt",Nn(this.stateproofTracking,(t,r)=>[t,r.toEncodingData()])]]);return ju(e,this.txnCommitments.toEncodingData(),this.rewardState.toEncodingData(),this.upgradeState.toEncodingData(),this.upgradeVote.toEncodingData(),this.participationUpdates.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockHeader: ${e}`);return new ry({round:e.get("rnd"),branch:e.get("prev"),seed:e.get("seed"),txnCommitments:Xf.fromEncodingData(e),timestamp:e.get("ts"),genesisID:e.get("gen"),genesisHash:e.get("gh"),proposer:e.get("prp"),feesCollected:e.get("fc"),bonus:e.get("bi"),proposerPayout:e.get("pp"),rewardState:Qf.fromEncodingData(e),upgradeState:Zf.fromEncodingData(e),upgradeVote:eg.fromEncodingData(e),txnCounter:e.get("tc"),stateproofTracking:Nn(e.get("spt"),(t,r)=>[Number(t),Yf.fromEncodingData(r)]),participationUpdates:tg.fromEncodingData(e)})}};zu.encodingSchema=new xe(Mt([{key:"rnd",valueSchema:new J},{key:"prev",valueSchema:new BR},{key:"seed",valueSchema:new We},{key:"",valueSchema:Xf.encodingSchema,embedded:!0},{key:"ts",valueSchema:new J},{key:"gen",valueSchema:new Ne},{key:"gh",valueSchema:new vn(32)},{key:"prp",valueSchema:new gn},{key:"fc",valueSchema:new J},{key:"bi",valueSchema:new J},{key:"pp",valueSchema:new J},{key:"",valueSchema:Qf.encodingSchema,embedded:!0},{key:"",valueSchema:Zf.encodingSchema,embedded:!0},{key:"",valueSchema:eg.encodingSchema,embedded:!0},{key:"tc",valueSchema:new J},{key:"spt",valueSchema:new Uf(Yf.encodingSchema)},{key:"",valueSchema:tg.encodingSchema,embedded:!0}]));let nc=class iy{constructor(e){this.action=e.action,this.bytes=e.bytes,this.uint=e.uint}getEncodingSchema(){return iy.encodingSchema}toEncodingData(){return new Map([["at",this.action],["bs",this.bytes],["ui",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ValueDelta: ${e}`);return new iy({action:Number(e.get("at")),bytes:e.get("bs"),uint:e.get("ui")})}};nc.encodingSchema=new xe(Mt([{key:"at",valueSchema:new J},{key:"bs",valueSchema:new uc},{key:"ui",valueSchema:new J}]));let oy=class sy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries(...Mt([{key:"gd",valueSchema:new $(new zl(nc.encodingSchema))},{key:"ld",valueSchema:new $(new Uf(new zl(nc.encodingSchema)))},{key:"sa",valueSchema:new $(new qe(new gn))},{key:"lg",valueSchema:new $(new qe(new uc))},{key:"itx",valueSchema:new $(new qe(ql.encodingSchema))}]))),this.encodingSchemaValue}constructor(e){this.globalDelta=e.globalDelta??new Map,this.localDeltas=e.localDeltas??new Map,this.sharedAccts=e.sharedAccts??[],this.logs=e.logs??[],this.innerTxns=e.innerTxns??[]}getEncodingSchema(){return sy.encodingSchema}toEncodingData(){return new Map([["gd",Nn(this.globalDelta,(e,t)=>[e,t.toEncodingData()])],["ld",Nn(this.localDeltas,(e,t)=>[e,Nn(t,(r,i)=>[r,i.toEncodingData()])])],["sa",this.sharedAccts],["lg",this.logs],["itx",this.innerTxns.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded EvalDelta: ${e}`);return new sy({globalDelta:e.get("gd")?Nn(e.get("gd"),(t,r)=>[t,nc.fromEncodingData(r)]):void 0,localDeltas:e.get("ld")?Nn(e.get("ld"),(t,r)=>[Number(t),Nn(r,(i,o)=>[i,nc.fromEncodingData(o)])]):void 0,sharedAccts:e.get("sa"),logs:e.get("lg"),innerTxns:(e.get("itx")??[]).map(ql.fromEncodingData)})}},ay=class cy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries(...Mt([{key:"ca",valueSchema:new $(new J)},{key:"aca",valueSchema:new $(new J)},{key:"rs",valueSchema:new $(new J)},{key:"rr",valueSchema:new $(new J)},{key:"rc",valueSchema:new $(new J)},{key:"dt",valueSchema:new $(oy.encodingSchema)},{key:"caid",valueSchema:new $(new J)},{key:"apid",valueSchema:new $(new J)}]))),this.encodingSchemaValue}constructor(e){this.closingAmount=e.closingAmount,this.assetClosingAmount=e.assetClosingAmount,this.senderRewards=e.senderRewards,this.receiverRewards=e.receiverRewards,this.closeRewards=e.closeRewards,this.evalDelta=e.evalDelta,this.configAsset=e.configAsset,this.applicationID=e.applicationID}getEncodingSchema(){return cy.encodingSchema}toEncodingData(){return new Map([["ca",this.closingAmount],["aca",this.assetClosingAmount],["rs",this.senderRewards],["rr",this.receiverRewards],["rc",this.closeRewards],["dt",this.evalDelta?this.evalDelta.toEncodingData():void 0],["caid",this.configAsset],["apid",this.applicationID]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplyData: ${e}`);return new cy({closingAmount:e.get("ca"),assetClosingAmount:e.get("aca"),senderRewards:e.get("rs"),receiverRewards:e.get("rr"),closeRewards:e.get("rc"),evalDelta:e.get("dt")?oy.fromEncodingData(e.get("dt")):void 0,configAsset:e.get("caid"),applicationID:e.get("apid")})}},ql=class uy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries(...Mt([{key:"",valueSchema:kn.encodingSchema,embedded:!0},{key:"",valueSchema:ay.encodingSchema,embedded:!0}]))),this.encodingSchemaValue}constructor(e){this.signedTxn=e.signedTxn,this.applyData=e.applyData}getEncodingSchema(){return uy.encodingSchema}toEncodingData(){return ju(this.signedTxn.toEncodingData(),this.applyData.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SignedTxnWithAD: ${e}`);return new uy({signedTxn:kn.fromEncodingData(e),applyData:ay.fromEncodingData(e)})}},ng=class ly{constructor(e){this.signedTxn=e.signedTxn,this.hasGenesisID=e.hasGenesisID,this.hasGenesisHash=e.hasGenesisHash}getEncodingSchema(){return ly.encodingSchema}toEncodingData(){const e=new Map([["hgi",this.hasGenesisID],["hgh",this.hasGenesisHash]]);return ju(e,this.signedTxn.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SignedTxnInBlock: ${e}`);return new ly({signedTxn:ql.fromEncodingData(e),hasGenesisID:e.get("hgi"),hasGenesisHash:e.get("hgh")})}};ng.encodingSchema=new xe(Mt([{key:"",valueSchema:ql.encodingSchema,embedded:!0},{key:"hgi",valueSchema:new jt},{key:"hgh",valueSchema:new jt}]));let tf=class hy{constructor(e){this.header=e.header,this.payset=e.payset}getEncodingSchema(){return hy.encodingSchema}toEncodingData(){const e=new Map([["txns",this.payset.map(t=>t.toEncodingData())]]);return ju(e,this.header.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockHeader: ${e}`);return new hy({header:zu.fromEncodingData(e),payset:e.get("txns").map(ng.fromEncodingData)})}};tf.encodingSchema=new xe(Mt([{key:"",valueSchema:zu.encodingSchema,embedded:!0},{key:"txns",valueSchema:new qe(ng.encodingSchema)}]));let pr=class dy{constructor(e){this.data=e}getEncodingSchema(){return dy.encodingSchema}toEncodingData(){return this.data}static fromEncodingData(e){return new dy(e)}};pr.encodingSchema=new YA;let qu=class fy{constructor(e){this.type=e.type,this.bytes=e.bytes,this.uint=e.uint}getEncodingSchema(){return fy.encodingSchema}toEncodingData(){return new Map([["tt",this.type],["tb",this.bytes],["ui",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TealValue: ${e}`);return new fy({type:Number(e.get("tt")),bytes:e.get("tb"),uint:e.get("ui")})}};qu.encodingSchema=new xe(Mt([{key:"tt",valueSchema:new J},{key:"tb",valueSchema:new $(new uc)},{key:"ui",valueSchema:new $(new J)}]));let Ii=class gy{constructor(e){this.numUints=e.numUints,this.numByteSlices=e.numByteSlices}getEncodingSchema(){return gy.encodingSchema}toEncodingData(){return new Map([["nui",this.numUints],["nbs",this.numByteSlices]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateSchema: ${e}`);return new gy({numUints:Number(e.get("nui")),numByteSlices:Number(e.get("nbs"))})}};Ii.encodingSchema=new xe(Mt([{key:"nui",valueSchema:new J},{key:"nbs",valueSchema:new J}]));let rg=class py{constructor(e){this.approvalProgram=e.approvalProgram,this.clearStateProgram=e.clearStateProgram,this.globalState=e.globalState,this.localStateSchema=e.localStateSchema,this.globalStateSchema=e.globalStateSchema,this.extraProgramPages=e.extraProgramPages}getEncodingSchema(){return py.encodingSchema}toEncodingData(){return new Map([["approv",this.approvalProgram],["clearp",this.clearStateProgram],["gs",Nn(this.globalState,(e,t)=>[e,t.toEncodingData()])],["lsch",this.localStateSchema.toEncodingData()],["gsch",this.globalStateSchema.toEncodingData()],["epp",this.extraProgramPages]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppParams: ${e}`);return new py({approvalProgram:e.get("approv"),clearStateProgram:e.get("clearp"),globalState:Nn(e.get("gs"),(t,r)=>[t,qu.fromEncodingData(r)]),localStateSchema:Ii.fromEncodingData(e.get("lsch")),globalStateSchema:Ii.fromEncodingData(e.get("gsch")),extraProgramPages:Number(e.get("epp"))})}};rg.encodingSchema=new xe(Mt([{key:"approv",valueSchema:new We},{key:"clearp",valueSchema:new We},{key:"gs",valueSchema:new zl(qu.encodingSchema)},{key:"lsch",valueSchema:Ii.encodingSchema},{key:"gsch",valueSchema:Ii.encodingSchema},{key:"epp",valueSchema:new J}]));let ig=class my{constructor(e){this.schema=e.schema,this.keyValue=e.keyValue}getEncodingSchema(){return my.encodingSchema}toEncodingData(){return new Map([["hsch",this.schema.toEncodingData()],["tkv",Nn(this.keyValue,(e,t)=>[e,t.toEncodingData()])]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppLocalState: ${e}`);return new my({schema:Ii.fromEncodingData(e.get("hsch")),keyValue:Nn(e.get("tkv"),(t,r)=>[t,qu.fromEncodingData(r)])})}};ig.encodingSchema=new xe(Mt([{key:"hsch",valueSchema:Ii.encodingSchema},{key:"tkv",valueSchema:new zl(qu.encodingSchema)}]));let og=class yy{constructor(e){this.localState=e.localState,this.deleted=e.deleted}getEncodingSchema(){return yy.encodingSchema}toEncodingData(){return new Map([["LocalState",this.localState?this.localState.toEncodingData():void 0],["Deleted",this.deleted]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppLocalStateDelta: ${e}`);return new yy({localState:e.get("LocalState")?ig.fromEncodingData(e.get("LocalState")):void 0,deleted:e.get("Deleted")})}};og.encodingSchema=new xe(Mt([{key:"LocalState",valueSchema:new $(ig.encodingSchema)},{key:"Deleted",valueSchema:new jt}]));let sg=class wy{constructor(e){this.params=e.params,this.deleted=e.deleted}getEncodingSchema(){return wy.encodingSchema}toEncodingData(){return new Map([["Params",this.params?this.params.toEncodingData():void 0],["Deleted",this.deleted]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppParamsDelta: ${e}`);return new wy({params:e.get("Params")?rg.fromEncodingData(e.get("Params")):void 0,deleted:e.get("Deleted")})}};sg.encodingSchema=new xe(Mt([{key:"Params",valueSchema:new $(rg.encodingSchema)},{key:"Deleted",valueSchema:new jt}]));let ag=class Sy{constructor(e){this.id=e.id,this.address=e.address,this.params=e.params,this.state=e.state}getEncodingSchema(){return Sy.encodingSchema}toEncodingData(){return new Map([["Aidx",this.id],["Addr",this.address],["Params",this.params.toEncodingData()],["State",this.state.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppResourceRecord: ${e}`);return new Sy({id:e.get("Aidx"),address:e.get("Addr"),params:sg.fromEncodingData(e.get("Params")),state:og.fromEncodingData(e.get("State"))})}};ag.encodingSchema=new xe(Mt([{key:"Aidx",valueSchema:new J},{key:"Addr",valueSchema:new gn},{key:"Params",valueSchema:sg.encodingSchema},{key:"State",valueSchema:og.encodingSchema}]));let cg=class vy{constructor(e){this.amount=e.amount,this.frozen=e.frozen}getEncodingSchema(){return vy.encodingSchema}toEncodingData(){return new Map([["a",this.amount],["f",this.frozen]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHolding: ${e}`);return new vy({amount:e.get("a"),frozen:e.get("f")})}};cg.encodingSchema=new xe(Mt([{key:"a",valueSchema:new J},{key:"f",valueSchema:new jt}]));let ug=class xy{constructor(e){this.holding=e.holding,this.deleted=e.deleted}getEncodingSchema(){return xy.encodingSchema}toEncodingData(){return new Map([["Holding",this.holding?this.holding.toEncodingData():void 0],["Deleted",this.deleted]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHoldingDelta: ${e}`);return new xy({holding:e.get("Holding")?cg.fromEncodingData(e.get("Holding")):void 0,deleted:e.get("Deleted")})}};ug.encodingSchema=new xe(Mt([{key:"Holding",valueSchema:new $(cg.encodingSchema)},{key:"Deleted",valueSchema:new jt}]));let lg=class Ey{constructor(e){this.total=e.total,this.decimals=e.decimals,this.defaultFrozen=e.defaultFrozen,this.unitName=e.unitName,this.assetName=e.assetName,this.url=e.url,this.metadataHash=e.metadataHash,this.manager=e.manager,this.reserve=e.reserve,this.freeze=e.freeze,this.clawback=e.clawback}getEncodingSchema(){return Ey.encodingSchema}toEncodingData(){return new Map([["t",this.total],["dc",this.decimals],["df",this.defaultFrozen],["un",this.unitName],["an",this.assetName],["au",this.url],["am",this.metadataHash],["m",this.manager],["r",this.reserve],["f",this.freeze],["c",this.clawback]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetParams: ${e}`);return new Ey({total:e.get("t"),decimals:e.get("dc"),defaultFrozen:e.get("df"),unitName:e.get("un"),assetName:e.get("an"),url:e.get("au"),metadataHash:e.get("am"),manager:e.get("m"),reserve:e.get("r"),freeze:e.get("f"),clawback:e.get("c")})}};lg.encodingSchema=new xe(Mt([{key:"t",valueSchema:new J},{key:"dc",valueSchema:new J},{key:"df",valueSchema:new jt},{key:"un",valueSchema:new $(new uc)},{key:"an",valueSchema:new $(new uc)},{key:"au",valueSchema:new $(new uc)},{key:"am",valueSchema:new vn(32)},{key:"m",valueSchema:new $(new gn)},{key:"r",valueSchema:new $(new gn)},{key:"f",valueSchema:new $(new gn)},{key:"c",valueSchema:new $(new gn)}]));let hg=class by{constructor(e){this.params=e.params,this.deleted=e.deleted}getEncodingSchema(){return by.encodingSchema}toEncodingData(){return new Map([["Params",this.params?this.params.toEncodingData():void 0],["Deleted",this.deleted]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetParamsDelta: ${e}`);return new by({params:e.get("Params")?lg.fromEncodingData(e.get("Params")):void 0,deleted:e.get("Deleted")})}};hg.encodingSchema=new xe(Mt([{key:"Params",valueSchema:new $(lg.encodingSchema)},{key:"Deleted",valueSchema:new jt}]));let dg=class ky{constructor(e){this.id=e.id,this.address=e.address,this.params=e.params,this.holding=e.holding}getEncodingSchema(){return ky.encodingSchema}toEncodingData(){return new Map([["Aidx",this.id],["Addr",this.address],["Params",this.params.toEncodingData()],["Holding",this.holding.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetResourceRecord: ${e}`);return new ky({id:e.get("Aidx"),address:e.get("Addr"),params:hg.fromEncodingData(e.get("Params")),holding:ug.fromEncodingData(e.get("Holding"))})}};dg.encodingSchema=new xe(Mt([{key:"Aidx",valueSchema:new J},{key:"Addr",valueSchema:new gn},{key:"Params",valueSchema:hg.encodingSchema},{key:"Holding",valueSchema:ug.encodingSchema}]));let fg=class Ay{constructor(e){this.voteID=e.voteID,this.selectionID=e.selectionID,this.stateProofID=e.stateProofID,this.voteFirstValid=e.voteFirstValid,this.voteLastValid=e.voteLastValid,this.voteKeyDilution=e.voteKeyDilution}getEncodingSchema(){return Ay.encodingSchema}toEncodingData(){return new Map([["VoteID",this.voteID],["SelectionID",this.selectionID],["StateProofID",this.stateProofID],["VoteFirstValid",this.voteFirstValid],["VoteLastValid",this.voteLastValid],["VoteKeyDilution",this.voteKeyDilution]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded VotingData: ${e}`);return new Ay({voteID:e.get("VoteID"),selectionID:e.get("SelectionID"),stateProofID:e.get("StateProofID"),voteFirstValid:e.get("VoteFirstValid"),voteLastValid:e.get("VoteLastValid"),voteKeyDilution:e.get("VoteKeyDilution")})}};fg.encodingSchema=new xe(Mt([{key:"VoteID",valueSchema:new vn(32)},{key:"SelectionID",valueSchema:new vn(32)},{key:"StateProofID",valueSchema:new vn(64)},{key:"VoteFirstValid",valueSchema:new J},{key:"VoteLastValid",valueSchema:new J},{key:"VoteKeyDilution",valueSchema:new J}]));let gg=class Dy{constructor(e){this.status=e.status,this.microAlgos=e.microAlgos,this.rewardsBase=e.rewardsBase,this.rewardedMicroAlgos=e.rewardedMicroAlgos,this.authAddr=e.authAddr,this.incentiveEligible=e.incentiveEligible,this.totalAppSchema=e.totalAppSchema,this.totalExtraAppPages=e.totalExtraAppPages,this.totalAppParams=e.totalAppParams,this.totalAppLocalStates=e.totalAppLocalStates,this.totalAssetParams=e.totalAssetParams,this.totalAssets=e.totalAssets,this.totalBoxes=e.totalBoxes,this.totalBoxBytes=e.totalBoxBytes,this.lastProposed=e.lastProposed,this.lastHeartbeat=e.lastHeartbeat}getEncodingSchema(){return Dy.encodingSchema}toEncodingData(){return new Map([["Status",this.status],["MicroAlgos",this.microAlgos],["RewardsBase",this.rewardsBase],["RewardedMicroAlgos",this.rewardedMicroAlgos],["AuthAddr",this.authAddr],["IncentiveEligible",this.incentiveEligible],["TotalAppSchema",this.totalAppSchema.toEncodingData()],["TotalExtraAppPages",this.totalExtraAppPages],["TotalAppParams",this.totalAppParams],["TotalAppLocalStates",this.totalAppLocalStates],["TotalAssetParams",this.totalAssetParams],["TotalAssets",this.totalAssets],["TotalBoxes",this.totalBoxes],["TotalBoxBytes",this.totalBoxBytes],["LastProposed",this.lastProposed],["LastHeartbeat",this.lastHeartbeat]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountBaseData: ${e}`);return new Dy({status:Number(e.get("Status")),microAlgos:e.get("MicroAlgos"),rewardsBase:e.get("RewardsBase"),rewardedMicroAlgos:e.get("RewardedMicroAlgos"),authAddr:e.get("AuthAddr"),incentiveEligible:e.get("IncentiveEligible"),totalAppSchema:Ii.fromEncodingData(e.get("TotalAppSchema")),totalExtraAppPages:Number(e.get("TotalExtraAppPages")),totalAppParams:e.get("TotalAppParams"),totalAppLocalStates:e.get("TotalAppLocalStates"),totalAssetParams:e.get("TotalAssetParams"),totalAssets:e.get("TotalAssets"),totalBoxes:e.get("TotalBoxes"),totalBoxBytes:e.get("TotalBoxBytes"),lastProposed:e.get("LastProposed"),lastHeartbeat:e.get("LastHeartbeat")})}};gg.encodingSchema=new xe(Mt([{key:"Status",valueSchema:new J},{key:"MicroAlgos",valueSchema:new J},{key:"RewardsBase",valueSchema:new J},{key:"RewardedMicroAlgos",valueSchema:new J},{key:"AuthAddr",valueSchema:new gn},{key:"IncentiveEligible",valueSchema:new jt},{key:"TotalAppSchema",valueSchema:Ii.encodingSchema},{key:"TotalExtraAppPages",valueSchema:new J},{key:"TotalAppParams",valueSchema:new J},{key:"TotalAppLocalStates",valueSchema:new J},{key:"TotalAssetParams",valueSchema:new J},{key:"TotalAssets",valueSchema:new J},{key:"TotalBoxes",valueSchema:new J},{key:"TotalBoxBytes",valueSchema:new J},{key:"LastProposed",valueSchema:new J},{key:"LastHeartbeat",valueSchema:new J}]));let pg=class Fy{constructor(e){this.accountBaseData=e.accountBaseData,this.votingData=e.votingData}getEncodingSchema(){return Fy.encodingSchema}toEncodingData(){return ju(this.accountBaseData.toEncodingData(),this.votingData.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountData: ${e}`);return new Fy({accountBaseData:gg.fromEncodingData(e),votingData:fg.fromEncodingData(e)})}};pg.encodingSchema=new xe(Mt([{key:"",valueSchema:gg.encodingSchema,embedded:!0},{key:"",valueSchema:fg.encodingSchema,embedded:!0}]));let mg=class Ty{constructor(e){this.addr=e.addr,this.accountData=e.accountData}getEncodingSchema(){return Ty.encodingSchema}toEncodingData(){return ju(new Map([["Addr",this.addr]]),this.accountData.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BalanceRecord: ${e}`);return new Ty({addr:e.get("Addr"),accountData:pg.fromEncodingData(e)})}};mg.encodingSchema=new xe(Mt([{key:"Addr",valueSchema:new gn},{key:"",valueSchema:pg.encodingSchema,embedded:!0}]));let yg=class Iy{constructor(e){this.accounts=e.accounts,this.appResources=e.appResources,this.assetResources=e.assetResources}getEncodingSchema(){return Iy.encodingSchema}toEncodingData(){return new Map([["Accts",this.accounts.map(e=>e.toEncodingData())],["AppResources",this.appResources.length===0?void 0:this.appResources.map(e=>e.toEncodingData())],["AssetResources",this.assetResources.length===0?void 0:this.assetResources.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountDeltas: ${e}`);return new Iy({accounts:(e.get("Accts")??[]).map(mg.fromEncodingData),appResources:(e.get("AppResources")??[]).map(ag.fromEncodingData),assetResources:(e.get("AssetResources")??[]).map(dg.fromEncodingData)})}};yg.encodingSchema=new xe(Mt([{key:"Accts",valueSchema:new qe(mg.encodingSchema)},{key:"AppResources",valueSchema:new $(new qe(ag.encodingSchema))},{key:"AssetResources",valueSchema:new $(new qe(dg.encodingSchema))}]));let wg=class My{constructor(e){this.data=e.data,this.oldData=e.oldData}getEncodingSchema(){return My.encodingSchema}toEncodingData(){return new Map([["Data",this.data],["OldData",this.oldData]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded KvValueDelta: ${e}`);return new My({data:e.get("Data"),oldData:e.get("OldData")})}};wg.encodingSchema=new xe(Mt([{key:"Data",valueSchema:new $(new We)},{key:"OldData",valueSchema:new $(new We)}]));let Sg=class Ry{constructor(e){this.lastValid=e.lastValid,this.intra=e.intra}getEncodingSchema(){return Ry.encodingSchema}toEncodingData(){return new Map([["LastValid",this.lastValid],["Intra",this.intra]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded IncludedTransactions: ${e}`);return new Ry({lastValid:e.get("LastValid"),intra:Number(e.get("Intra"))})}};Sg.encodingSchema=new xe(Mt([{key:"LastValid",valueSchema:new J},{key:"Intra",valueSchema:new J}]));let vg=class Cy{constructor(e){this.creatableType=e.creatableType,this.created=e.created,this.creator=e.creator,this.ndeltas=e.ndeltas}getEncodingSchema(){return Cy.encodingSchema}toEncodingData(){return new Map([["Ctype",this.creatableType],["Created",this.created],["Creator",this.creator],["Ndeltas",this.ndeltas]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ModifiedCreatable: ${e}`);return new Cy({creatableType:Number(e.get("Ctype")),created:e.get("Created"),creator:e.get("Creator"),ndeltas:Number(e.get("Ndeltas"))})}};vg.encodingSchema=new xe(Mt([{key:"Ctype",valueSchema:new J},{key:"Created",valueSchema:new jt},{key:"Creator",valueSchema:new gn},{key:"Ndeltas",valueSchema:new J}]));let jo=class Py{constructor(e){this.money=e.money,this.rewardUnits=e.rewardUnits}getEncodingSchema(){return Py.encodingSchema}toEncodingData(){return new Map([["mon",this.money],["rwd",this.rewardUnits]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AlgoCount: ${e}`);return new Py({money:e.get("mon"),rewardUnits:e.get("rwd")})}};jo.encodingSchema=new xe(Mt([{key:"mon",valueSchema:new J},{key:"rwd",valueSchema:new J}]));let xg=class $y{constructor(e){this.online=e.online,this.offline=e.offline,this.notParticipating=e.notParticipating,this.rewardsLevel=e.rewardsLevel}getEncodingSchema(){return $y.encodingSchema}toEncodingData(){return new Map([["online",this.online.toEncodingData()],["offline",this.offline.toEncodingData()],["notpart",this.notParticipating.toEncodingData()],["rwdlvl",this.rewardsLevel]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountTotals: ${e}`);return new $y({online:jo.fromEncodingData(e.get("online")),offline:jo.fromEncodingData(e.get("offline")),notParticipating:jo.fromEncodingData(e.get("notpart")),rewardsLevel:e.get("rwdlvl")})}};xg.encodingSchema=new xe(Mt([{key:"online",valueSchema:jo.encodingSchema},{key:"offline",valueSchema:jo.encodingSchema},{key:"notpart",valueSchema:jo.encodingSchema},{key:"rwdlvl",valueSchema:new J}]));let Ic=class By{constructor(e){this.accounts=e.accounts,this.kvMods=e.kvMods,this.txids=e.txids,this.txleases=e.txleases,this.creatables=e.creatables,this.blockHeader=e.blockHeader,this.stateProofNext=e.stateProofNext,this.prevTimestamp=e.prevTimestamp,this.totals=e.totals}getEncodingSchema(){return By.encodingSchema}toEncodingData(){return new Map([["Accts",this.accounts.toEncodingData()],["KvMods",this.kvMods.size===0?void 0:Nn(this.kvMods,(e,t)=>[e,t.toEncodingData()])],["Txids",Nn(this.txids,(e,t)=>[e,t.toEncodingData()])],["Txleases",this.txleases.toEncodingData()],["Creatables",this.creatables.size===0?void 0:Nn(this.creatables,(e,t)=>[e,t.toEncodingData()])],["Hdr",this.blockHeader.toEncodingData()],["StateProofNext",this.stateProofNext],["PrevTimestamp",this.prevTimestamp],["Totals",this.totals.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded LedgerStateDelta: ${e}`);return new By({accounts:yg.fromEncodingData(e.get("Accts")),kvMods:Nn(e.get("KvMods")??new Map,(t,r)=>[t,wg.fromEncodingData(r)]),txids:Nn(e.get("Txids"),(t,r)=>[t,Sg.fromEncodingData(r)]),txleases:pr.fromEncodingData(e.get("Txleases")),creatables:Nn(e.get("Creatables")??new Map,(t,r)=>[t,vg.fromEncodingData(r)]),blockHeader:zu.fromEncodingData(e.get("Hdr")),stateProofNext:e.get("StateProofNext"),prevTimestamp:e.get("PrevTimestamp"),totals:xg.fromEncodingData(e.get("Totals"))})}};Ic.encodingSchema=new xe(Mt([{key:"Accts",valueSchema:yg.encodingSchema},{key:"KvMods",valueSchema:new $(new zl(wg.encodingSchema))},{key:"Txids",valueSchema:new VR(Sg.encodingSchema)},{key:"Txleases",valueSchema:new $(new YA)},{key:"Creatables",valueSchema:new $(new Uf(vg.encodingSchema))},{key:"Hdr",valueSchema:zu.encodingSchema},{key:"StateProofNext",valueSchema:new J},{key:"PrevTimestamp",valueSchema:new J},{key:"Totals",valueSchema:xg.encodingSchema}]));let nf=class Vy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Ne,omitEmpty:!0},{key:"amount",valueSchema:new J,omitEmpty:!0},{key:"amount-without-pending-rewards",valueSchema:new J,omitEmpty:!0},{key:"min-balance",valueSchema:new J,omitEmpty:!0},{key:"pending-rewards",valueSchema:new J,omitEmpty:!0},{key:"rewards",valueSchema:new J,omitEmpty:!0},{key:"round",valueSchema:new J,omitEmpty:!0},{key:"status",valueSchema:new Ne,omitEmpty:!0},{key:"total-apps-opted-in",valueSchema:new J,omitEmpty:!0},{key:"total-assets-opted-in",valueSchema:new J,omitEmpty:!0},{key:"total-created-apps",valueSchema:new J,omitEmpty:!0},{key:"total-created-assets",valueSchema:new J,omitEmpty:!0},{key:"apps-local-state",valueSchema:new $(new qe(Gl.encodingSchema)),omitEmpty:!0},{key:"apps-total-extra-pages",valueSchema:new $(new J),omitEmpty:!0},{key:"apps-total-schema",valueSchema:new $(ii.encodingSchema),omitEmpty:!0},{key:"assets",valueSchema:new $(new qe(Zs.encodingSchema)),omitEmpty:!0},{key:"auth-addr",valueSchema:new $(new Ne),omitEmpty:!0},{key:"created-apps",valueSchema:new $(new qe(Qs.encodingSchema)),omitEmpty:!0},{key:"created-assets",valueSchema:new $(new qe(rf.encodingSchema)),omitEmpty:!0},{key:"incentive-eligible",valueSchema:new $(new jt),omitEmpty:!0},{key:"last-heartbeat",valueSchema:new $(new J),omitEmpty:!0},{key:"last-proposed",valueSchema:new $(new J),omitEmpty:!0},{key:"participation",valueSchema:new $(_y.encodingSchema),omitEmpty:!0},{key:"reward-base",valueSchema:new $(new J),omitEmpty:!0},{key:"sig-type",valueSchema:new $(new Ne),omitEmpty:!0},{key:"total-box-bytes",valueSchema:new $(new J),omitEmpty:!0},{key:"total-boxes",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,amount:t,amountWithoutPendingRewards:r,minBalance:i,pendingRewards:o,rewards:s,round:a,status:l,totalAppsOptedIn:c,totalAssetsOptedIn:d,totalCreatedApps:f,totalCreatedAssets:m,appsLocalState:w,appsTotalExtraPages:k,appsTotalSchema:I,assets:x,authAddr:T,createdApps:b,createdAssets:R,incentiveEligible:L,lastHeartbeat:G,lastProposed:E,participation:N,rewardBase:p,sigType:F,totalBoxBytes:v,totalBoxes:O}){this.address=e,this.amount=Ce(t),this.amountWithoutPendingRewards=Ce(r),this.minBalance=Ce(i),this.pendingRewards=Ce(o),this.rewards=Ce(s),this.round=Ce(a),this.status=l,this.totalAppsOptedIn=Ye(c),this.totalAssetsOptedIn=Ye(d),this.totalCreatedApps=Ye(f),this.totalCreatedAssets=Ye(m),this.appsLocalState=w,this.appsTotalExtraPages=typeof k>"u"?void 0:Ye(k),this.appsTotalSchema=I,this.assets=x,this.authAddr=typeof T=="string"?Ot.fromString(T):T,this.createdApps=b,this.createdAssets=R,this.incentiveEligible=L,this.lastHeartbeat=typeof G>"u"?void 0:Ye(G),this.lastProposed=typeof E>"u"?void 0:Ye(E),this.participation=N,this.rewardBase=typeof p>"u"?void 0:Ce(p),this.sigType=F,this.totalBoxBytes=typeof v>"u"?void 0:Ye(v),this.totalBoxes=typeof O>"u"?void 0:Ye(O)}getEncodingSchema(){return Vy.encodingSchema}toEncodingData(){return new Map([["address",this.address],["amount",this.amount],["amount-without-pending-rewards",this.amountWithoutPendingRewards],["min-balance",this.minBalance],["pending-rewards",this.pendingRewards],["rewards",this.rewards],["round",this.round],["status",this.status],["total-apps-opted-in",this.totalAppsOptedIn],["total-assets-opted-in",this.totalAssetsOptedIn],["total-created-apps",this.totalCreatedApps],["total-created-assets",this.totalCreatedAssets],["apps-local-state",typeof this.appsLocalState<"u"?this.appsLocalState.map(e=>e.toEncodingData()):void 0],["apps-total-extra-pages",this.appsTotalExtraPages],["apps-total-schema",typeof this.appsTotalSchema<"u"?this.appsTotalSchema.toEncodingData():void 0],["assets",typeof this.assets<"u"?this.assets.map(e=>e.toEncodingData()):void 0],["auth-addr",typeof this.authAddr<"u"?this.authAddr.toString():void 0],["created-apps",typeof this.createdApps<"u"?this.createdApps.map(e=>e.toEncodingData()):void 0],["created-assets",typeof this.createdAssets<"u"?this.createdAssets.map(e=>e.toEncodingData()):void 0],["incentive-eligible",this.incentiveEligible],["last-heartbeat",this.lastHeartbeat],["last-proposed",this.lastProposed],["participation",typeof this.participation<"u"?this.participation.toEncodingData():void 0],["reward-base",this.rewardBase],["sig-type",this.sigType],["total-box-bytes",this.totalBoxBytes],["total-boxes",this.totalBoxes]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Account: ${e}`);return new Vy({address:e.get("address"),amount:e.get("amount"),amountWithoutPendingRewards:e.get("amount-without-pending-rewards"),minBalance:e.get("min-balance"),pendingRewards:e.get("pending-rewards"),rewards:e.get("rewards"),round:e.get("round"),status:e.get("status"),totalAppsOptedIn:e.get("total-apps-opted-in"),totalAssetsOptedIn:e.get("total-assets-opted-in"),totalCreatedApps:e.get("total-created-apps"),totalCreatedAssets:e.get("total-created-assets"),appsLocalState:typeof e.get("apps-local-state")<"u"?e.get("apps-local-state").map(t=>Gl.fromEncodingData(t)):void 0,appsTotalExtraPages:e.get("apps-total-extra-pages"),appsTotalSchema:typeof e.get("apps-total-schema")<"u"?ii.fromEncodingData(e.get("apps-total-schema")):void 0,assets:typeof e.get("assets")<"u"?e.get("assets").map(t=>Zs.fromEncodingData(t)):void 0,authAddr:e.get("auth-addr"),createdApps:typeof e.get("created-apps")<"u"?e.get("created-apps").map(t=>Qs.fromEncodingData(t)):void 0,createdAssets:typeof e.get("created-assets")<"u"?e.get("created-assets").map(t=>rf.fromEncodingData(t)):void 0,incentiveEligible:e.get("incentive-eligible"),lastHeartbeat:e.get("last-heartbeat"),lastProposed:e.get("last-proposed"),participation:typeof e.get("participation")<"u"?_y.fromEncodingData(e.get("participation")):void 0,rewardBase:e.get("reward-base"),sigType:e.get("sig-type"),totalBoxBytes:e.get("total-box-bytes"),totalBoxes:e.get("total-boxes")})}},aD=class Oy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"round",valueSchema:new J,omitEmpty:!0},{key:"app-local-state",valueSchema:new $(Gl.encodingSchema),omitEmpty:!0},{key:"created-app",valueSchema:new $(Mc.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({round:e,appLocalState:t,createdApp:r}){this.round=Ce(e),this.appLocalState=t,this.createdApp=r}getEncodingSchema(){return Oy.encodingSchema}toEncodingData(){return new Map([["round",this.round],["app-local-state",typeof this.appLocalState<"u"?this.appLocalState.toEncodingData():void 0],["created-app",typeof this.createdApp<"u"?this.createdApp.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountApplicationResponse: ${e}`);return new Oy({round:e.get("round"),appLocalState:typeof e.get("app-local-state")<"u"?Gl.fromEncodingData(e.get("app-local-state")):void 0,createdApp:typeof e.get("created-app")<"u"?Mc.fromEncodingData(e.get("created-app")):void 0})}},Ny=class Ly{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"asset-holding",valueSchema:Zs.encodingSchema,omitEmpty:!0},{key:"asset-params",valueSchema:new $(ea.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({assetHolding:e,assetParams:t}){this.assetHolding=e,this.assetParams=t}getEncodingSchema(){return Ly.encodingSchema}toEncodingData(){return new Map([["asset-holding",this.assetHolding.toEncodingData()],["asset-params",typeof this.assetParams<"u"?this.assetParams.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountAssetHolding: ${e}`);return new Ly({assetHolding:Zs.fromEncodingData(e.get("asset-holding")??new Map),assetParams:typeof e.get("asset-params")<"u"?ea.fromEncodingData(e.get("asset-params")):void 0})}},cD=class Uy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"round",valueSchema:new J,omitEmpty:!0},{key:"asset-holding",valueSchema:new $(Zs.encodingSchema),omitEmpty:!0},{key:"created-asset",valueSchema:new $(ea.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({round:e,assetHolding:t,createdAsset:r}){this.round=Ce(e),this.assetHolding=t,this.createdAsset=r}getEncodingSchema(){return Uy.encodingSchema}toEncodingData(){return new Map([["round",this.round],["asset-holding",typeof this.assetHolding<"u"?this.assetHolding.toEncodingData():void 0],["created-asset",typeof this.createdAsset<"u"?this.createdAsset.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountAssetResponse: ${e}`);return new Uy({round:e.get("round"),assetHolding:typeof e.get("asset-holding")<"u"?Zs.fromEncodingData(e.get("asset-holding")):void 0,createdAsset:typeof e.get("created-asset")<"u"?ea.fromEncodingData(e.get("created-asset")):void 0})}},dC=class jy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"round",valueSchema:new J,omitEmpty:!0},{key:"asset-holdings",valueSchema:new $(new qe(Ny.encodingSchema)),omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({round:e,assetHoldings:t,nextToken:r}){this.round=Ye(e),this.assetHoldings=t,this.nextToken=r}getEncodingSchema(){return jy.encodingSchema}toEncodingData(){return new Map([["round",this.round],["asset-holdings",typeof this.assetHoldings<"u"?this.assetHoldings.map(e=>e.toEncodingData()):void 0],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountAssetsInformationResponse: ${e}`);return new jy({round:e.get("round"),assetHoldings:typeof e.get("asset-holdings")<"u"?e.get("asset-holdings").map(t=>Ny.fromEncodingData(t)):void 0,nextToken:e.get("next-token")})}},_y=class zy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"selection-participation-key",valueSchema:new We,omitEmpty:!0},{key:"vote-first-valid",valueSchema:new J,omitEmpty:!0},{key:"vote-key-dilution",valueSchema:new J,omitEmpty:!0},{key:"vote-last-valid",valueSchema:new J,omitEmpty:!0},{key:"vote-participation-key",valueSchema:new We,omitEmpty:!0},{key:"state-proof-key",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({selectionParticipationKey:e,voteFirstValid:t,voteKeyDilution:r,voteLastValid:i,voteParticipationKey:o,stateProofKey:s}){this.selectionParticipationKey=typeof e=="string"?ut(e):e,this.voteFirstValid=Ce(t),this.voteKeyDilution=Ce(r),this.voteLastValid=Ce(i),this.voteParticipationKey=typeof o=="string"?ut(o):o,this.stateProofKey=typeof s=="string"?ut(s):s}getEncodingSchema(){return zy.encodingSchema}toEncodingData(){return new Map([["selection-participation-key",this.selectionParticipationKey],["vote-first-valid",this.voteFirstValid],["vote-key-dilution",this.voteKeyDilution],["vote-last-valid",this.voteLastValid],["vote-participation-key",this.voteParticipationKey],["state-proof-key",this.stateProofKey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountParticipation: ${e}`);return new zy({selectionParticipationKey:e.get("selection-participation-key"),voteFirstValid:e.get("vote-first-valid"),voteKeyDilution:e.get("vote-key-dilution"),voteLastValid:e.get("vote-last-valid"),voteParticipationKey:e.get("vote-participation-key"),stateProofKey:e.get("state-proof-key")})}},Hl=class qy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Ne,omitEmpty:!0},{key:"delta",valueSchema:new qe(ta.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,delta:t}){this.address=e,this.delta=t}getEncodingSchema(){return qy.encodingSchema}toEncodingData(){return new Map([["address",this.address],["delta",this.delta.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountStateDelta: ${e}`);return new qy({address:e.get("address"),delta:(e.get("delta")??[]).map(t=>ta.fromEncodingData(t))})}},Hy=class Gy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"application-index",valueSchema:new J,omitEmpty:!0},{key:"logs",valueSchema:new qe(new We),omitEmpty:!0},{key:"txId",valueSchema:new Ne,omitEmpty:!0})),this.encodingSchemaValue}constructor({applicationIndex:e,logs:t,txid:r}){this.applicationIndex=Ye(e),this.logs=t,this.txid=r}getEncodingSchema(){return Gy.encodingSchema}toEncodingData(){return new Map([["application-index",this.applicationIndex],["logs",this.logs],["txId",this.txid]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppCallLogs: ${e}`);return new Gy({applicationIndex:e.get("application-index"),logs:e.get("logs"),txid:e.get("txId")})}},Qs=class Ky{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"id",valueSchema:new J,omitEmpty:!0},{key:"params",valueSchema:Mc.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({id:e,params:t}){this.id=Ce(e),this.params=t}getEncodingSchema(){return Ky.encodingSchema}toEncodingData(){return new Map([["id",this.id],["params",this.params.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Application: ${e}`);return new Ky({id:e.get("id"),params:Mc.fromEncodingData(e.get("params")??new Map)})}},Wy=class Jy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"id",valueSchema:new J,omitEmpty:!0},{key:"app-boxes",valueSchema:new $(ws.encodingSchema),omitEmpty:!0},{key:"app-globals",valueSchema:new $(ws.encodingSchema),omitEmpty:!0},{key:"app-locals",valueSchema:new $(new qe(ws.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({id:e,appBoxes:t,appGlobals:r,appLocals:i}){this.id=Ce(e),this.appBoxes=t,this.appGlobals=r,this.appLocals=i}getEncodingSchema(){return Jy.encodingSchema}toEncodingData(){return new Map([["id",this.id],["app-boxes",typeof this.appBoxes<"u"?this.appBoxes.toEncodingData():void 0],["app-globals",typeof this.appGlobals<"u"?this.appGlobals.toEncodingData():void 0],["app-locals",typeof this.appLocals<"u"?this.appLocals.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationInitialStates: ${e}`);return new Jy({id:e.get("id"),appBoxes:typeof e.get("app-boxes")<"u"?ws.fromEncodingData(e.get("app-boxes")):void 0,appGlobals:typeof e.get("app-globals")<"u"?ws.fromEncodingData(e.get("app-globals")):void 0,appLocals:typeof e.get("app-locals")<"u"?e.get("app-locals").map(t=>ws.fromEncodingData(t)):void 0})}},ws=class Yy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"kvs",valueSchema:new qe(uw.encodingSchema),omitEmpty:!0},{key:"account",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({kvs:e,account:t}){this.kvs=e,this.account=typeof t=="string"?Ot.fromString(t):t}getEncodingSchema(){return Yy.encodingSchema}toEncodingData(){return new Map([["kvs",this.kvs.map(e=>e.toEncodingData())],["account",typeof this.account<"u"?this.account.toString():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationKVStorage: ${e}`);return new Yy({kvs:(e.get("kvs")??[]).map(t=>uw.fromEncodingData(t)),account:e.get("account")})}},Xy=class Qy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"account",valueSchema:new Ne,omitEmpty:!0},{key:"app",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({account:e,app:t}){this.account=typeof e=="string"?Ot.fromString(e):e,this.app=Ce(t)}getEncodingSchema(){return Qy.encodingSchema}toEncodingData(){return new Map([["account",this.account.toString()],["app",this.app]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLocalReference: ${e}`);return new Qy({account:e.get("account"),app:e.get("app")})}},Gl=class Zy{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"id",valueSchema:new J,omitEmpty:!0},{key:"schema",valueSchema:ii.encodingSchema,omitEmpty:!0},{key:"key-value",valueSchema:new $(new qe(Yl.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({id:e,schema:t,keyValue:r}){this.id=Ce(e),this.schema=t,this.keyValue=r}getEncodingSchema(){return Zy.encodingSchema}toEncodingData(){return new Map([["id",this.id],["schema",this.schema.toEncodingData()],["key-value",typeof this.keyValue<"u"?this.keyValue.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLocalState: ${e}`);return new Zy({id:e.get("id"),schema:ii.fromEncodingData(e.get("schema")??new Map),keyValue:typeof e.get("key-value")<"u"?e.get("key-value").map(t=>Yl.fromEncodingData(t)):void 0})}},Mc=class ew{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"approval-program",valueSchema:new We,omitEmpty:!0},{key:"clear-state-program",valueSchema:new We,omitEmpty:!0},{key:"creator",valueSchema:new Ne,omitEmpty:!0},{key:"extra-program-pages",valueSchema:new $(new J),omitEmpty:!0},{key:"global-state",valueSchema:new $(new qe(Yl.encodingSchema)),omitEmpty:!0},{key:"global-state-schema",valueSchema:new $(ii.encodingSchema),omitEmpty:!0},{key:"local-state-schema",valueSchema:new $(ii.encodingSchema),omitEmpty:!0},{key:"version",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({approvalProgram:e,clearStateProgram:t,creator:r,extraProgramPages:i,globalState:o,globalStateSchema:s,localStateSchema:a,version:l}){this.approvalProgram=typeof e=="string"?ut(e):e,this.clearStateProgram=typeof t=="string"?ut(t):t,this.creator=typeof r=="string"?Ot.fromString(r):r,this.extraProgramPages=typeof i>"u"?void 0:Ye(i),this.globalState=o,this.globalStateSchema=s,this.localStateSchema=a,this.version=typeof l>"u"?void 0:Ye(l)}getEncodingSchema(){return ew.encodingSchema}toEncodingData(){return new Map([["approval-program",this.approvalProgram],["clear-state-program",this.clearStateProgram],["creator",this.creator.toString()],["extra-program-pages",this.extraProgramPages],["global-state",typeof this.globalState<"u"?this.globalState.map(e=>e.toEncodingData()):void 0],["global-state-schema",typeof this.globalStateSchema<"u"?this.globalStateSchema.toEncodingData():void 0],["local-state-schema",typeof this.localStateSchema<"u"?this.localStateSchema.toEncodingData():void 0],["version",this.version]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationParams: ${e}`);return new ew({approvalProgram:e.get("approval-program"),clearStateProgram:e.get("clear-state-program"),creator:e.get("creator"),extraProgramPages:e.get("extra-program-pages"),globalState:typeof e.get("global-state")<"u"?e.get("global-state").map(t=>Yl.fromEncodingData(t)):void 0,globalStateSchema:typeof e.get("global-state-schema")<"u"?ii.fromEncodingData(e.get("global-state-schema")):void 0,localStateSchema:typeof e.get("local-state-schema")<"u"?ii.fromEncodingData(e.get("local-state-schema")):void 0,version:e.get("version")})}},tw=class nw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"app-state-type",valueSchema:new Ne,omitEmpty:!0},{key:"key",valueSchema:new We,omitEmpty:!0},{key:"operation",valueSchema:new Ne,omitEmpty:!0},{key:"account",valueSchema:new $(new Ne),omitEmpty:!0},{key:"new-value",valueSchema:new $(no.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({appStateType:e,key:t,operation:r,account:i,newValue:o}){this.appStateType=e,this.key=typeof t=="string"?ut(t):t,this.operation=r,this.account=typeof i=="string"?Ot.fromString(i):i,this.newValue=o}getEncodingSchema(){return nw.encodingSchema}toEncodingData(){return new Map([["app-state-type",this.appStateType],["key",this.key],["operation",this.operation],["account",typeof this.account<"u"?this.account.toString():void 0],["new-value",typeof this.newValue<"u"?this.newValue.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationStateOperation: ${e}`);return new nw({appStateType:e.get("app-state-type"),key:e.get("key"),operation:e.get("operation"),account:e.get("account"),newValue:typeof e.get("new-value")<"u"?no.fromEncodingData(e.get("new-value")):void 0})}},ii=class rw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"num-byte-slice",valueSchema:new J,omitEmpty:!0},{key:"num-uint",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({numByteSlice:e,numUint:t}){this.numByteSlice=Ye(e),this.numUint=Ye(t)}getEncodingSchema(){return rw.encodingSchema}toEncodingData(){return new Map([["num-byte-slice",this.numByteSlice],["num-uint",this.numUint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationStateSchema: ${e}`);return new rw({numByteSlice:e.get("num-byte-slice"),numUint:e.get("num-uint")})}},rf=class iw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"index",valueSchema:new J,omitEmpty:!0},{key:"params",valueSchema:ea.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({index:e,params:t}){this.index=Ce(e),this.params=t}getEncodingSchema(){return iw.encodingSchema}toEncodingData(){return new Map([["index",this.index],["params",this.params.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Asset: ${e}`);return new iw({index:e.get("index"),params:ea.fromEncodingData(e.get("params")??new Map)})}},Zs=class ow{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"amount",valueSchema:new J,omitEmpty:!0},{key:"asset-id",valueSchema:new J,omitEmpty:!0},{key:"is-frozen",valueSchema:new jt,omitEmpty:!0})),this.encodingSchemaValue}constructor({amount:e,assetId:t,isFrozen:r}){this.amount=Ce(e),this.assetId=Ce(t),this.isFrozen=r}getEncodingSchema(){return ow.encodingSchema}toEncodingData(){return new Map([["amount",this.amount],["asset-id",this.assetId],["is-frozen",this.isFrozen]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHolding: ${e}`);return new ow({amount:e.get("amount"),assetId:e.get("asset-id"),isFrozen:e.get("is-frozen")})}},sw=class aw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"account",valueSchema:new Ne,omitEmpty:!0},{key:"asset",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({account:e,asset:t}){this.account=typeof e=="string"?Ot.fromString(e):e,this.asset=Ce(t)}getEncodingSchema(){return aw.encodingSchema}toEncodingData(){return new Map([["account",this.account.toString()],["asset",this.asset]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHoldingReference: ${e}`);return new aw({account:e.get("account"),asset:e.get("asset")})}},ea=class cw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"creator",valueSchema:new Ne,omitEmpty:!0},{key:"decimals",valueSchema:new J,omitEmpty:!0},{key:"total",valueSchema:new J,omitEmpty:!0},{key:"clawback",valueSchema:new $(new Ne),omitEmpty:!0},{key:"default-frozen",valueSchema:new $(new jt),omitEmpty:!0},{key:"freeze",valueSchema:new $(new Ne),omitEmpty:!0},{key:"manager",valueSchema:new $(new Ne),omitEmpty:!0},{key:"metadata-hash",valueSchema:new $(new We),omitEmpty:!0},{key:"name",valueSchema:new $(new Ne),omitEmpty:!0},{key:"name-b64",valueSchema:new $(new We),omitEmpty:!0},{key:"reserve",valueSchema:new $(new Ne),omitEmpty:!0},{key:"unit-name",valueSchema:new $(new Ne),omitEmpty:!0},{key:"unit-name-b64",valueSchema:new $(new We),omitEmpty:!0},{key:"url",valueSchema:new $(new Ne),omitEmpty:!0},{key:"url-b64",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({creator:e,decimals:t,total:r,clawback:i,defaultFrozen:o,freeze:s,manager:a,metadataHash:l,name:c,nameB64:d,reserve:f,unitName:m,unitNameB64:w,url:k,urlB64:I}){this.creator=e,this.decimals=Ye(t),this.total=Ce(r),this.clawback=i,this.defaultFrozen=o,this.freeze=s,this.manager=a,this.metadataHash=typeof l=="string"?ut(l):l,this.name=c,this.nameB64=typeof d=="string"?ut(d):d,this.reserve=f,this.unitName=m,this.unitNameB64=typeof w=="string"?ut(w):w,this.url=k,this.urlB64=typeof I=="string"?ut(I):I}getEncodingSchema(){return cw.encodingSchema}toEncodingData(){return new Map([["creator",this.creator],["decimals",this.decimals],["total",this.total],["clawback",this.clawback],["default-frozen",this.defaultFrozen],["freeze",this.freeze],["manager",this.manager],["metadata-hash",this.metadataHash],["name",this.name],["name-b64",this.nameB64],["reserve",this.reserve],["unit-name",this.unitName],["unit-name-b64",this.unitNameB64],["url",this.url],["url-b64",this.urlB64]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetParams: ${e}`);return new cw({creator:e.get("creator"),decimals:e.get("decimals"),total:e.get("total"),clawback:e.get("clawback"),defaultFrozen:e.get("default-frozen"),freeze:e.get("freeze"),manager:e.get("manager"),metadataHash:e.get("metadata-hash"),name:e.get("name"),nameB64:e.get("name-b64"),reserve:e.get("reserve"),unitName:e.get("unit-name"),unitNameB64:e.get("unit-name-b64"),url:e.get("url"),urlB64:e.get("url-b64")})}},uw=class lw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"key",valueSchema:new We,omitEmpty:!0},{key:"value",valueSchema:no.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({key:e,value:t}){this.key=typeof e=="string"?ut(e):e,this.value=t}getEncodingSchema(){return lw.encodingSchema}toEncodingData(){return new Map([["key",this.key],["value",this.value.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AvmKeyValue: ${e}`);return new lw({key:e.get("key"),value:no.fromEncodingData(e.get("value")??new Map)})}},no=class hw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"type",valueSchema:new J,omitEmpty:!0},{key:"bytes",valueSchema:new $(new We),omitEmpty:!0},{key:"uint",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({type:e,bytes:t,uint:r}){this.type=Ye(e),this.bytes=typeof t=="string"?ut(t):t,this.uint=typeof r>"u"?void 0:Ce(r)}getEncodingSchema(){return hw.encodingSchema}toEncodingData(){return new Map([["type",this.type],["bytes",this.bytes],["uint",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AvmValue: ${e}`);return new hw({type:e.get("type"),bytes:e.get("bytes"),uint:e.get("uint")})}},uD=class dw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"blockHash",valueSchema:new Ne,omitEmpty:!0})),this.encodingSchemaValue}constructor({blockhash:e}){this.blockhash=e}getEncodingSchema(){return dw.encodingSchema}toEncodingData(){return new Map([["blockHash",this.blockhash]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockHashResponse: ${e}`);return new dw({blockhash:e.get("blockHash")})}},fC=class fw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"logs",valueSchema:new qe(Hy.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({logs:e}){this.logs=e}getEncodingSchema(){return fw.encodingSchema}toEncodingData(){return new Map([["logs",this.logs.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockLogsResponse: ${e}`);return new fw({logs:(e.get("logs")??[]).map(t=>Hy.fromEncodingData(t))})}},lD=class gw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"block",valueSchema:tf.encodingSchema,omitEmpty:!0},{key:"cert",valueSchema:new $(pr.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({block:e,cert:t}){this.block=e,this.cert=t}getEncodingSchema(){return gw.encodingSchema}toEncodingData(){return new Map([["block",this.block.toEncodingData()],["cert",typeof this.cert<"u"?this.cert.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockResponse: ${e}`);return new gw({block:tf.fromEncodingData(e.get("block")??new Map),cert:typeof e.get("cert")<"u"?pr.fromEncodingData(e.get("cert")):void 0})}},hD=class pw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"blockTxids",valueSchema:new qe(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({blocktxids:e}){this.blocktxids=e}getEncodingSchema(){return pw.encodingSchema}toEncodingData(){return new Map([["blockTxids",this.blocktxids]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockTxidsResponse: ${e}`);return new pw({blocktxids:e.get("blockTxids")})}},dD=class mw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"name",valueSchema:new We,omitEmpty:!0},{key:"round",valueSchema:new J,omitEmpty:!0},{key:"value",valueSchema:new We,omitEmpty:!0})),this.encodingSchemaValue}constructor({name:e,round:t,value:r}){this.name=typeof e=="string"?ut(e):e,this.round=Ce(t),this.value=typeof r=="string"?ut(r):r}getEncodingSchema(){return mw.encodingSchema}toEncodingData(){return new Map([["name",this.name],["round",this.round],["value",this.value]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Box: ${e}`);return new mw({name:e.get("name"),round:e.get("round"),value:e.get("value")})}},yw=class ww{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"name",valueSchema:new We,omitEmpty:!0})),this.encodingSchemaValue}constructor({name:e}){this.name=typeof e=="string"?ut(e):e}getEncodingSchema(){return ww.encodingSchema}toEncodingData(){return new Map([["name",this.name]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxDescriptor: ${e}`);return new ww({name:e.get("name")})}},Sw=class vw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"app",valueSchema:new J,omitEmpty:!0},{key:"name",valueSchema:new We,omitEmpty:!0})),this.encodingSchemaValue}constructor({app:e,name:t}){this.app=Ce(e),this.name=typeof t=="string"?ut(t):t}getEncodingSchema(){return vw.encodingSchema}toEncodingData(){return new Map([["app",this.app],["name",this.name]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxReference: ${e}`);return new vw({app:e.get("app"),name:e.get("name")})}},fD=class xw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"boxes",valueSchema:new qe(yw.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({boxes:e}){this.boxes=e}getEncodingSchema(){return xw.encodingSchema}toEncodingData(){return new Map([["boxes",this.boxes.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxesResponse: ${e}`);return new xw({boxes:(e.get("boxes")??[]).map(t=>yw.fromEncodingData(t))})}},Ew=class bw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"branch",valueSchema:new Ne,omitEmpty:!0},{key:"build_number",valueSchema:new J,omitEmpty:!0},{key:"channel",valueSchema:new Ne,omitEmpty:!0},{key:"commit_hash",valueSchema:new Ne,omitEmpty:!0},{key:"major",valueSchema:new J,omitEmpty:!0},{key:"minor",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({branch:e,buildNumber:t,channel:r,commitHash:i,major:o,minor:s}){this.branch=e,this.buildNumber=Ye(t),this.channel=r,this.commitHash=i,this.major=Ye(o),this.minor=Ye(s)}getEncodingSchema(){return bw.encodingSchema}toEncodingData(){return new Map([["branch",this.branch],["build_number",this.buildNumber],["channel",this.channel],["commit_hash",this.commitHash],["major",this.major],["minor",this.minor]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BuildVersion: ${e}`);return new bw({branch:e.get("branch"),buildNumber:e.get("build_number"),channel:e.get("channel"),commitHash:e.get("commit_hash"),major:e.get("major"),minor:e.get("minor")})}},gD=class kw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"hash",valueSchema:new Ne,omitEmpty:!0},{key:"result",valueSchema:new Ne,omitEmpty:!0},{key:"sourcemap",valueSchema:new $(pr.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({hash:e,result:t,sourcemap:r}){this.hash=e,this.result=t,this.sourcemap=r}getEncodingSchema(){return kw.encodingSchema}toEncodingData(){return new Map([["hash",this.hash],["result",this.result],["sourcemap",typeof this.sourcemap<"u"?this.sourcemap.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded CompileResponse: ${e}`);return new kw({hash:e.get("hash"),result:e.get("result"),sourcemap:typeof e.get("sourcemap")<"u"?pr.fromEncodingData(e.get("sourcemap")):void 0})}},pD=class Aw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"result",valueSchema:new Ne,omitEmpty:!0})),this.encodingSchemaValue}constructor({result:e}){this.result=e}getEncodingSchema(){return Aw.encodingSchema}toEncodingData(){return new Map([["result",this.result]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DisassembleResponse: ${e}`);return new Aw({result:e.get("result")})}},mD=class Dw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"accounts",valueSchema:new qe(nf.encodingSchema),omitEmpty:!0},{key:"apps",valueSchema:new qe(Qs.encodingSchema),omitEmpty:!0},{key:"latest-timestamp",valueSchema:new J,omitEmpty:!0},{key:"protocol-version",valueSchema:new Ne,omitEmpty:!0},{key:"round",valueSchema:new J,omitEmpty:!0},{key:"sources",valueSchema:new qe(Tw.encodingSchema),omitEmpty:!0},{key:"txns",valueSchema:new qe(kn.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({accounts:e,apps:t,latestTimestamp:r,protocolVersion:i,round:o,sources:s,txns:a}){this.accounts=e,this.apps=t,this.latestTimestamp=Ye(r),this.protocolVersion=i,this.round=Ce(o),this.sources=s,this.txns=a}getEncodingSchema(){return Dw.encodingSchema}toEncodingData(){return new Map([["accounts",this.accounts.map(e=>e.toEncodingData())],["apps",this.apps.map(e=>e.toEncodingData())],["latest-timestamp",this.latestTimestamp],["protocol-version",this.protocolVersion],["round",this.round],["sources",this.sources.map(e=>e.toEncodingData())],["txns",this.txns.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DryrunRequest: ${e}`);return new Dw({accounts:(e.get("accounts")??[]).map(t=>nf.fromEncodingData(t)),apps:(e.get("apps")??[]).map(t=>Qs.fromEncodingData(t)),latestTimestamp:e.get("latest-timestamp"),protocolVersion:e.get("protocol-version"),round:e.get("round"),sources:(e.get("sources")??[]).map(t=>Tw.fromEncodingData(t)),txns:(e.get("txns")??[]).map(t=>kn.fromEncodingData(t))})}},yD=class Fw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"error",valueSchema:new Ne,omitEmpty:!0},{key:"protocol-version",valueSchema:new Ne,omitEmpty:!0},{key:"txns",valueSchema:new qe(Rw.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({error:e,protocolVersion:t,txns:r}){this.error=e,this.protocolVersion=t,this.txns=r}getEncodingSchema(){return Fw.encodingSchema}toEncodingData(){return new Map([["error",this.error],["protocol-version",this.protocolVersion],["txns",this.txns.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DryrunResponse: ${e}`);return new Fw({error:e.get("error"),protocolVersion:e.get("protocol-version"),txns:(e.get("txns")??[]).map(t=>Rw.fromEncodingData(t))})}},Tw=class Iw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"app-index",valueSchema:new J,omitEmpty:!0},{key:"field-name",valueSchema:new Ne,omitEmpty:!0},{key:"source",valueSchema:new Ne,omitEmpty:!0},{key:"txn-index",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({appIndex:e,fieldName:t,source:r,txnIndex:i}){this.appIndex=Ce(e),this.fieldName=t,this.source=r,this.txnIndex=Ye(i)}getEncodingSchema(){return Iw.encodingSchema}toEncodingData(){return new Map([["app-index",this.appIndex],["field-name",this.fieldName],["source",this.source],["txn-index",this.txnIndex]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DryrunSource: ${e}`);return new Iw({appIndex:e.get("app-index"),fieldName:e.get("field-name"),source:e.get("source"),txnIndex:e.get("txn-index")})}},wl=class Mw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"line",valueSchema:new J,omitEmpty:!0},{key:"pc",valueSchema:new J,omitEmpty:!0},{key:"stack",valueSchema:new qe(As.encodingSchema),omitEmpty:!0},{key:"error",valueSchema:new $(new Ne),omitEmpty:!0},{key:"scratch",valueSchema:new $(new qe(As.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({line:e,pc:t,stack:r,error:i,scratch:o}){this.line=Ye(e),this.pc=Ye(t),this.stack=r,this.error=i,this.scratch=o}getEncodingSchema(){return Mw.encodingSchema}toEncodingData(){return new Map([["line",this.line],["pc",this.pc],["stack",this.stack.map(e=>e.toEncodingData())],["error",this.error],["scratch",typeof this.scratch<"u"?this.scratch.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DryrunState: ${e}`);return new Mw({line:e.get("line"),pc:e.get("pc"),stack:(e.get("stack")??[]).map(t=>As.fromEncodingData(t)),error:e.get("error"),scratch:typeof e.get("scratch")<"u"?e.get("scratch").map(t=>As.fromEncodingData(t)):void 0})}},Rw=class Cw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"disassembly",valueSchema:new qe(new Ne),omitEmpty:!0},{key:"app-call-messages",valueSchema:new $(new qe(new Ne)),omitEmpty:!0},{key:"app-call-trace",valueSchema:new $(new qe(wl.encodingSchema)),omitEmpty:!0},{key:"budget-added",valueSchema:new $(new J),omitEmpty:!0},{key:"budget-consumed",valueSchema:new $(new J),omitEmpty:!0},{key:"global-delta",valueSchema:new $(new qe(ta.encodingSchema)),omitEmpty:!0},{key:"local-deltas",valueSchema:new $(new qe(Hl.encodingSchema)),omitEmpty:!0},{key:"logic-sig-disassembly",valueSchema:new $(new qe(new Ne)),omitEmpty:!0},{key:"logic-sig-messages",valueSchema:new $(new qe(new Ne)),omitEmpty:!0},{key:"logic-sig-trace",valueSchema:new $(new qe(wl.encodingSchema)),omitEmpty:!0},{key:"logs",valueSchema:new $(new qe(new We)),omitEmpty:!0})),this.encodingSchemaValue}constructor({disassembly:e,appCallMessages:t,appCallTrace:r,budgetAdded:i,budgetConsumed:o,globalDelta:s,localDeltas:a,logicSigDisassembly:l,logicSigMessages:c,logicSigTrace:d,logs:f}){this.disassembly=e,this.appCallMessages=t,this.appCallTrace=r,this.budgetAdded=typeof i>"u"?void 0:Ye(i),this.budgetConsumed=typeof o>"u"?void 0:Ye(o),this.globalDelta=s,this.localDeltas=a,this.logicSigDisassembly=l,this.logicSigMessages=c,this.logicSigTrace=d,this.logs=f}getEncodingSchema(){return Cw.encodingSchema}toEncodingData(){return new Map([["disassembly",this.disassembly],["app-call-messages",this.appCallMessages],["app-call-trace",typeof this.appCallTrace<"u"?this.appCallTrace.map(e=>e.toEncodingData()):void 0],["budget-added",this.budgetAdded],["budget-consumed",this.budgetConsumed],["global-delta",typeof this.globalDelta<"u"?this.globalDelta.map(e=>e.toEncodingData()):void 0],["local-deltas",typeof this.localDeltas<"u"?this.localDeltas.map(e=>e.toEncodingData()):void 0],["logic-sig-disassembly",this.logicSigDisassembly],["logic-sig-messages",this.logicSigMessages],["logic-sig-trace",typeof this.logicSigTrace<"u"?this.logicSigTrace.map(e=>e.toEncodingData()):void 0],["logs",this.logs]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DryrunTxnResult: ${e}`);return new Cw({disassembly:e.get("disassembly"),appCallMessages:e.get("app-call-messages"),appCallTrace:typeof e.get("app-call-trace")<"u"?e.get("app-call-trace").map(t=>wl.fromEncodingData(t)):void 0,budgetAdded:e.get("budget-added"),budgetConsumed:e.get("budget-consumed"),globalDelta:typeof e.get("global-delta")<"u"?e.get("global-delta").map(t=>ta.fromEncodingData(t)):void 0,localDeltas:typeof e.get("local-deltas")<"u"?e.get("local-deltas").map(t=>Hl.fromEncodingData(t)):void 0,logicSigDisassembly:e.get("logic-sig-disassembly"),logicSigMessages:e.get("logic-sig-messages"),logicSigTrace:typeof e.get("logic-sig-trace")<"u"?e.get("logic-sig-trace").map(t=>wl.fromEncodingData(t)):void 0,logs:e.get("logs")})}},gC=class Pw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"message",valueSchema:new Ne,omitEmpty:!0},{key:"data",valueSchema:new $(pr.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({message:e,data:t}){this.message=e,this.data=t}getEncodingSchema(){return Pw.encodingSchema}toEncodingData(){return new Map([["message",this.message],["data",typeof this.data<"u"?this.data.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ErrorResponse: ${e}`);return new Pw({message:e.get("message"),data:typeof e.get("data")<"u"?pr.fromEncodingData(e.get("data")):void 0})}},$w=class Bw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"action",valueSchema:new J,omitEmpty:!0},{key:"bytes",valueSchema:new $(new Ne),omitEmpty:!0},{key:"uint",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({action:e,bytes:t,uint:r}){this.action=Ye(e),this.bytes=t,this.uint=typeof r>"u"?void 0:Ce(r)}getEncodingSchema(){return Bw.encodingSchema}toEncodingData(){return new Map([["action",this.action],["bytes",this.bytes],["uint",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded EvalDelta: ${e}`);return new Bw({action:e.get("action"),bytes:e.get("bytes"),uint:e.get("uint")})}},ta=class Vw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"key",valueSchema:new Ne,omitEmpty:!0},{key:"value",valueSchema:$w.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({key:e,value:t}){this.key=e,this.value=t}getEncodingSchema(){return Vw.encodingSchema}toEncodingData(){return new Map([["key",this.key],["value",this.value.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded EvalDeltaKeyValue: ${e}`);return new Vw({key:e.get("key"),value:$w.fromEncodingData(e.get("value")??new Map)})}},pC=class Ow{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"alloc",valueSchema:new qe(Nw.encodingSchema),omitEmpty:!0},{key:"fees",valueSchema:new Ne,omitEmpty:!0},{key:"id",valueSchema:new Ne,omitEmpty:!0},{key:"network",valueSchema:new Ne,omitEmpty:!0},{key:"proto",valueSchema:new Ne,omitEmpty:!0},{key:"rwd",valueSchema:new Ne,omitEmpty:!0},{key:"timestamp",valueSchema:new J,omitEmpty:!0},{key:"comment",valueSchema:new $(new Ne),omitEmpty:!0},{key:"devmode",valueSchema:new $(new jt),omitEmpty:!0})),this.encodingSchemaValue}constructor({alloc:e,fees:t,id:r,network:i,proto:o,rwd:s,timestamp:a,comment:l,devmode:c}){this.alloc=e,this.fees=t,this.id=r,this.network=i,this.proto=o,this.rwd=s,this.timestamp=Ye(a),this.comment=l,this.devmode=c}getEncodingSchema(){return Ow.encodingSchema}toEncodingData(){return new Map([["alloc",this.alloc.map(e=>e.toEncodingData())],["fees",this.fees],["id",this.id],["network",this.network],["proto",this.proto],["rwd",this.rwd],["timestamp",this.timestamp],["comment",this.comment],["devmode",this.devmode]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Genesis: ${e}`);return new Ow({alloc:(e.get("alloc")??[]).map(t=>Nw.fromEncodingData(t)),fees:e.get("fees"),id:e.get("id"),network:e.get("network"),proto:e.get("proto"),rwd:e.get("rwd"),timestamp:e.get("timestamp"),comment:e.get("comment"),devmode:e.get("devmode")})}},Nw=class Lw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"addr",valueSchema:new Ne,omitEmpty:!0},{key:"comment",valueSchema:new Ne,omitEmpty:!0},{key:"state",valueSchema:pr.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({addr:e,comment:t,state:r}){this.addr=e,this.comment=t,this.state=r}getEncodingSchema(){return Lw.encodingSchema}toEncodingData(){return new Map([["addr",this.addr],["comment",this.comment],["state",this.state.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded GenesisAllocation: ${e}`);return new Lw({addr:e.get("addr"),comment:e.get("comment"),state:pr.fromEncodingData(e.get("state")??new Map)})}},wD=class Uw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"offset",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({offset:e}){this.offset=Ye(e)}getEncodingSchema(){return Uw.encodingSchema}toEncodingData(){return new Map([["offset",this.offset]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded GetBlockTimeStampOffsetResponse: ${e}`);return new Uw({offset:e.get("offset")})}},SD=class jw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"round",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({round:e}){this.round=Ce(e)}getEncodingSchema(){return jw.encodingSchema}toEncodingData(){return new Map([["round",this.round]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded GetSyncRoundResponse: ${e}`);return new jw({round:e.get("round")})}},_w=class zw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"Delta",valueSchema:Ic.encodingSchema,omitEmpty:!0},{key:"Ids",valueSchema:new qe(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({delta:e,ids:t}){this.delta=e,this.ids=t}getEncodingSchema(){return zw.encodingSchema}toEncodingData(){return new Map([["Delta",this.delta.toEncodingData()],["Ids",this.ids]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded LedgerStateDeltaForTransactionGroup: ${e}`);return new zw({delta:Ic.fromEncodingData(e.get("Delta")??new Map),ids:e.get("Ids")})}},vD=class qw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"index",valueSchema:new J,omitEmpty:!0},{key:"proof",valueSchema:new We,omitEmpty:!0},{key:"treedepth",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({index:e,proof:t,treedepth:r}){this.index=Ye(e),this.proof=typeof t=="string"?ut(t):t,this.treedepth=Ye(r)}getEncodingSchema(){return qw.encodingSchema}toEncodingData(){return new Map([["index",this.index],["proof",this.proof],["treedepth",this.treedepth]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded LightBlockHeaderProof: ${e}`);return new qw({index:e.get("index"),proof:e.get("proof"),treedepth:e.get("treedepth")})}},Kx=class Hw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"catchup-time",valueSchema:new J,omitEmpty:!0},{key:"last-round",valueSchema:new J,omitEmpty:!0},{key:"last-version",valueSchema:new Ne,omitEmpty:!0},{key:"next-version",valueSchema:new Ne,omitEmpty:!0},{key:"next-version-round",valueSchema:new J,omitEmpty:!0},{key:"next-version-supported",valueSchema:new jt,omitEmpty:!0},{key:"stopped-at-unsupported-round",valueSchema:new jt,omitEmpty:!0},{key:"time-since-last-round",valueSchema:new J,omitEmpty:!0},{key:"catchpoint",valueSchema:new $(new Ne),omitEmpty:!0},{key:"catchpoint-acquired-blocks",valueSchema:new $(new J),omitEmpty:!0},{key:"catchpoint-processed-accounts",valueSchema:new $(new J),omitEmpty:!0},{key:"catchpoint-processed-kvs",valueSchema:new $(new J),omitEmpty:!0},{key:"catchpoint-total-accounts",valueSchema:new $(new J),omitEmpty:!0},{key:"catchpoint-total-blocks",valueSchema:new $(new J),omitEmpty:!0},{key:"catchpoint-total-kvs",valueSchema:new $(new J),omitEmpty:!0},{key:"catchpoint-verified-accounts",valueSchema:new $(new J),omitEmpty:!0},{key:"catchpoint-verified-kvs",valueSchema:new $(new J),omitEmpty:!0},{key:"last-catchpoint",valueSchema:new $(new Ne),omitEmpty:!0},{key:"upgrade-delay",valueSchema:new $(new J),omitEmpty:!0},{key:"upgrade-next-protocol-vote-before",valueSchema:new $(new J),omitEmpty:!0},{key:"upgrade-no-votes",valueSchema:new $(new J),omitEmpty:!0},{key:"upgrade-node-vote",valueSchema:new $(new jt),omitEmpty:!0},{key:"upgrade-vote-rounds",valueSchema:new $(new J),omitEmpty:!0},{key:"upgrade-votes",valueSchema:new $(new J),omitEmpty:!0},{key:"upgrade-votes-required",valueSchema:new $(new J),omitEmpty:!0},{key:"upgrade-yes-votes",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({catchupTime:e,lastRound:t,lastVersion:r,nextVersion:i,nextVersionRound:o,nextVersionSupported:s,stoppedAtUnsupportedRound:a,timeSinceLastRound:l,catchpoint:c,catchpointAcquiredBlocks:d,catchpointProcessedAccounts:f,catchpointProcessedKvs:m,catchpointTotalAccounts:w,catchpointTotalBlocks:k,catchpointTotalKvs:I,catchpointVerifiedAccounts:x,catchpointVerifiedKvs:T,lastCatchpoint:b,upgradeDelay:R,upgradeNextProtocolVoteBefore:L,upgradeNoVotes:G,upgradeNodeVote:E,upgradeVoteRounds:N,upgradeVotes:p,upgradeVotesRequired:F,upgradeYesVotes:v}){this.catchupTime=Ce(e),this.lastRound=Ce(t),this.lastVersion=r,this.nextVersion=i,this.nextVersionRound=Ce(o),this.nextVersionSupported=s,this.stoppedAtUnsupportedRound=a,this.timeSinceLastRound=Ce(l),this.catchpoint=c,this.catchpointAcquiredBlocks=typeof d>"u"?void 0:Ye(d),this.catchpointProcessedAccounts=typeof f>"u"?void 0:Ye(f),this.catchpointProcessedKvs=typeof m>"u"?void 0:Ye(m),this.catchpointTotalAccounts=typeof w>"u"?void 0:Ye(w),this.catchpointTotalBlocks=typeof k>"u"?void 0:Ye(k),this.catchpointTotalKvs=typeof I>"u"?void 0:Ye(I),this.catchpointVerifiedAccounts=typeof x>"u"?void 0:Ye(x),this.catchpointVerifiedKvs=typeof T>"u"?void 0:Ye(T),this.lastCatchpoint=b,this.upgradeDelay=typeof R>"u"?void 0:Ce(R),this.upgradeNextProtocolVoteBefore=typeof L>"u"?void 0:Ce(L),this.upgradeNoVotes=typeof G>"u"?void 0:Ye(G),this.upgradeNodeVote=E,this.upgradeVoteRounds=typeof N>"u"?void 0:Ye(N),this.upgradeVotes=typeof p>"u"?void 0:Ye(p),this.upgradeVotesRequired=typeof F>"u"?void 0:Ye(F),this.upgradeYesVotes=typeof v>"u"?void 0:Ye(v)}getEncodingSchema(){return Hw.encodingSchema}toEncodingData(){return new Map([["catchup-time",this.catchupTime],["last-round",this.lastRound],["last-version",this.lastVersion],["next-version",this.nextVersion],["next-version-round",this.nextVersionRound],["next-version-supported",this.nextVersionSupported],["stopped-at-unsupported-round",this.stoppedAtUnsupportedRound],["time-since-last-round",this.timeSinceLastRound],["catchpoint",this.catchpoint],["catchpoint-acquired-blocks",this.catchpointAcquiredBlocks],["catchpoint-processed-accounts",this.catchpointProcessedAccounts],["catchpoint-processed-kvs",this.catchpointProcessedKvs],["catchpoint-total-accounts",this.catchpointTotalAccounts],["catchpoint-total-blocks",this.catchpointTotalBlocks],["catchpoint-total-kvs",this.catchpointTotalKvs],["catchpoint-verified-accounts",this.catchpointVerifiedAccounts],["catchpoint-verified-kvs",this.catchpointVerifiedKvs],["last-catchpoint",this.lastCatchpoint],["upgrade-delay",this.upgradeDelay],["upgrade-next-protocol-vote-before",this.upgradeNextProtocolVoteBefore],["upgrade-no-votes",this.upgradeNoVotes],["upgrade-node-vote",this.upgradeNodeVote],["upgrade-vote-rounds",this.upgradeVoteRounds],["upgrade-votes",this.upgradeVotes],["upgrade-votes-required",this.upgradeVotesRequired],["upgrade-yes-votes",this.upgradeYesVotes]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded NodeStatusResponse: ${e}`);return new Hw({catchupTime:e.get("catchup-time"),lastRound:e.get("last-round"),lastVersion:e.get("last-version"),nextVersion:e.get("next-version"),nextVersionRound:e.get("next-version-round"),nextVersionSupported:e.get("next-version-supported"),stoppedAtUnsupportedRound:e.get("stopped-at-unsupported-round"),timeSinceLastRound:e.get("time-since-last-round"),catchpoint:e.get("catchpoint"),catchpointAcquiredBlocks:e.get("catchpoint-acquired-blocks"),catchpointProcessedAccounts:e.get("catchpoint-processed-accounts"),catchpointProcessedKvs:e.get("catchpoint-processed-kvs"),catchpointTotalAccounts:e.get("catchpoint-total-accounts"),catchpointTotalBlocks:e.get("catchpoint-total-blocks"),catchpointTotalKvs:e.get("catchpoint-total-kvs"),catchpointVerifiedAccounts:e.get("catchpoint-verified-accounts"),catchpointVerifiedKvs:e.get("catchpoint-verified-kvs"),lastCatchpoint:e.get("last-catchpoint"),upgradeDelay:e.get("upgrade-delay"),upgradeNextProtocolVoteBefore:e.get("upgrade-next-protocol-vote-before"),upgradeNoVotes:e.get("upgrade-no-votes"),upgradeNodeVote:e.get("upgrade-node-vote"),upgradeVoteRounds:e.get("upgrade-vote-rounds"),upgradeVotes:e.get("upgrade-votes"),upgradeVotesRequired:e.get("upgrade-votes-required"),upgradeYesVotes:e.get("upgrade-yes-votes")})}},of=class Sl{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"pool-error",valueSchema:new Ne,omitEmpty:!0},{key:"txn",valueSchema:kn.encodingSchema,omitEmpty:!0},{key:"application-index",valueSchema:new $(new J),omitEmpty:!0},{key:"asset-closing-amount",valueSchema:new $(new J),omitEmpty:!0},{key:"asset-index",valueSchema:new $(new J),omitEmpty:!0},{key:"close-rewards",valueSchema:new $(new J),omitEmpty:!0},{key:"closing-amount",valueSchema:new $(new J),omitEmpty:!0},{key:"confirmed-round",valueSchema:new $(new J),omitEmpty:!0},{key:"global-state-delta",valueSchema:new $(new qe(ta.encodingSchema)),omitEmpty:!0},{key:"inner-txns",valueSchema:new $(new qe(Sl.encodingSchema)),omitEmpty:!0},{key:"local-state-delta",valueSchema:new $(new qe(Hl.encodingSchema)),omitEmpty:!0},{key:"logs",valueSchema:new $(new qe(new We)),omitEmpty:!0},{key:"receiver-rewards",valueSchema:new $(new J),omitEmpty:!0},{key:"sender-rewards",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({poolError:e,txn:t,applicationIndex:r,assetClosingAmount:i,assetIndex:o,closeRewards:s,closingAmount:a,confirmedRound:l,globalStateDelta:c,innerTxns:d,localStateDelta:f,logs:m,receiverRewards:w,senderRewards:k}){this.poolError=e,this.txn=t,this.applicationIndex=typeof r>"u"?void 0:Ce(r),this.assetClosingAmount=typeof i>"u"?void 0:Ce(i),this.assetIndex=typeof o>"u"?void 0:Ce(o),this.closeRewards=typeof s>"u"?void 0:Ce(s),this.closingAmount=typeof a>"u"?void 0:Ce(a),this.confirmedRound=typeof l>"u"?void 0:Ce(l),this.globalStateDelta=c,this.innerTxns=d,this.localStateDelta=f,this.logs=m,this.receiverRewards=typeof w>"u"?void 0:Ce(w),this.senderRewards=typeof k>"u"?void 0:Ce(k)}getEncodingSchema(){return Sl.encodingSchema}toEncodingData(){return new Map([["pool-error",this.poolError],["txn",this.txn.toEncodingData()],["application-index",this.applicationIndex],["asset-closing-amount",this.assetClosingAmount],["asset-index",this.assetIndex],["close-rewards",this.closeRewards],["closing-amount",this.closingAmount],["confirmed-round",this.confirmedRound],["global-state-delta",typeof this.globalStateDelta<"u"?this.globalStateDelta.map(e=>e.toEncodingData()):void 0],["inner-txns",typeof this.innerTxns<"u"?this.innerTxns.map(e=>e.toEncodingData()):void 0],["local-state-delta",typeof this.localStateDelta<"u"?this.localStateDelta.map(e=>e.toEncodingData()):void 0],["logs",this.logs],["receiver-rewards",this.receiverRewards],["sender-rewards",this.senderRewards]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded PendingTransactionResponse: ${e}`);return new Sl({poolError:e.get("pool-error"),txn:kn.fromEncodingData(e.get("txn")??new Map),applicationIndex:e.get("application-index"),assetClosingAmount:e.get("asset-closing-amount"),assetIndex:e.get("asset-index"),closeRewards:e.get("close-rewards"),closingAmount:e.get("closing-amount"),confirmedRound:e.get("confirmed-round"),globalStateDelta:typeof e.get("global-state-delta")<"u"?e.get("global-state-delta").map(t=>ta.fromEncodingData(t)):void 0,innerTxns:typeof e.get("inner-txns")<"u"?e.get("inner-txns").map(t=>Sl.fromEncodingData(t)):void 0,localStateDelta:typeof e.get("local-state-delta")<"u"?e.get("local-state-delta").map(t=>Hl.fromEncodingData(t)):void 0,logs:e.get("logs"),receiverRewards:e.get("receiver-rewards"),senderRewards:e.get("sender-rewards")})}},Wx=class Gw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"top-transactions",valueSchema:new qe(kn.encodingSchema),omitEmpty:!0},{key:"total-transactions",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({topTransactions:e,totalTransactions:t}){this.topTransactions=e,this.totalTransactions=Ye(t)}getEncodingSchema(){return Gw.encodingSchema}toEncodingData(){return new Map([["top-transactions",this.topTransactions.map(e=>e.toEncodingData())],["total-transactions",this.totalTransactions]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded PendingTransactionsResponse: ${e}`);return new Gw({topTransactions:(e.get("top-transactions")??[]).map(t=>kn.fromEncodingData(t)),totalTransactions:e.get("total-transactions")})}},xD=class Kw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"txId",valueSchema:new Ne,omitEmpty:!0})),this.encodingSchemaValue}constructor({txid:e}){this.txid=e}getEncodingSchema(){return Kw.encodingSchema}toEncodingData(){return new Map([["txId",this.txid]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded PostTransactionsResponse: ${e}`);return new Kw({txid:e.get("txId")})}},Ww=class Jw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"new-value",valueSchema:no.encodingSchema,omitEmpty:!0},{key:"slot",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({newValue:e,slot:t}){this.newValue=e,this.slot=Ye(t)}getEncodingSchema(){return Jw.encodingSchema}toEncodingData(){return new Map([["new-value",this.newValue.toEncodingData()],["slot",this.slot]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ScratchChange: ${e}`);return new Jw({newValue:no.fromEncodingData(e.get("new-value")??new Map),slot:e.get("slot")})}},Yw=class Xw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"app-initial-states",valueSchema:new $(new qe(Wy.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({appInitialStates:e}){this.appInitialStates=e}getEncodingSchema(){return Xw.encodingSchema}toEncodingData(){return new Map([["app-initial-states",typeof this.appInitialStates<"u"?this.appInitialStates.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateInitialStates: ${e}`);return new Xw({appInitialStates:typeof e.get("app-initial-states")<"u"?e.get("app-initial-states").map(t=>Wy.fromEncodingData(t)):void 0})}},Jx=class Qw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"txn-groups",valueSchema:new qe(Kl.encodingSchema),omitEmpty:!0},{key:"allow-empty-signatures",valueSchema:new $(new jt),omitEmpty:!0},{key:"allow-more-logging",valueSchema:new $(new jt),omitEmpty:!0},{key:"allow-unnamed-resources",valueSchema:new $(new jt),omitEmpty:!0},{key:"exec-trace-config",valueSchema:new $(Wl.encodingSchema),omitEmpty:!0},{key:"extra-opcode-budget",valueSchema:new $(new J),omitEmpty:!0},{key:"fix-signers",valueSchema:new $(new jt),omitEmpty:!0},{key:"round",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({txnGroups:e,allowEmptySignatures:t,allowMoreLogging:r,allowUnnamedResources:i,execTraceConfig:o,extraOpcodeBudget:s,fixSigners:a,round:l}){this.txnGroups=e,this.allowEmptySignatures=t,this.allowMoreLogging=r,this.allowUnnamedResources=i,this.execTraceConfig=o,this.extraOpcodeBudget=typeof s>"u"?void 0:Ye(s),this.fixSigners=a,this.round=typeof l>"u"?void 0:Ce(l)}getEncodingSchema(){return Qw.encodingSchema}toEncodingData(){return new Map([["txn-groups",this.txnGroups.map(e=>e.toEncodingData())],["allow-empty-signatures",this.allowEmptySignatures],["allow-more-logging",this.allowMoreLogging],["allow-unnamed-resources",this.allowUnnamedResources],["exec-trace-config",typeof this.execTraceConfig<"u"?this.execTraceConfig.toEncodingData():void 0],["extra-opcode-budget",this.extraOpcodeBudget],["fix-signers",this.fixSigners],["round",this.round]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateRequest: ${e}`);return new Qw({txnGroups:(e.get("txn-groups")??[]).map(t=>Kl.fromEncodingData(t)),allowEmptySignatures:e.get("allow-empty-signatures"),allowMoreLogging:e.get("allow-more-logging"),allowUnnamedResources:e.get("allow-unnamed-resources"),execTraceConfig:typeof e.get("exec-trace-config")<"u"?Wl.fromEncodingData(e.get("exec-trace-config")):void 0,extraOpcodeBudget:e.get("extra-opcode-budget"),fixSigners:e.get("fix-signers"),round:e.get("round")})}},Kl=class Zw{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"txns",valueSchema:new qe(kn.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({txns:e}){this.txns=e}getEncodingSchema(){return Zw.encodingSchema}toEncodingData(){return new Map([["txns",this.txns.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateRequestTransactionGroup: ${e}`);return new Zw({txns:(e.get("txns")??[]).map(t=>kn.fromEncodingData(t))})}},ED=class e0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"last-round",valueSchema:new J,omitEmpty:!0},{key:"txn-groups",valueSchema:new qe(n0.encodingSchema),omitEmpty:!0},{key:"version",valueSchema:new J,omitEmpty:!0},{key:"eval-overrides",valueSchema:new $(a0.encodingSchema),omitEmpty:!0},{key:"exec-trace-config",valueSchema:new $(Wl.encodingSchema),omitEmpty:!0},{key:"initial-states",valueSchema:new $(Yw.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({lastRound:e,txnGroups:t,version:r,evalOverrides:i,execTraceConfig:o,initialStates:s}){this.lastRound=Ce(e),this.txnGroups=t,this.version=Ye(r),this.evalOverrides=i,this.execTraceConfig=o,this.initialStates=s}getEncodingSchema(){return e0.encodingSchema}toEncodingData(){return new Map([["last-round",this.lastRound],["txn-groups",this.txnGroups.map(e=>e.toEncodingData())],["version",this.version],["eval-overrides",typeof this.evalOverrides<"u"?this.evalOverrides.toEncodingData():void 0],["exec-trace-config",typeof this.execTraceConfig<"u"?this.execTraceConfig.toEncodingData():void 0],["initial-states",typeof this.initialStates<"u"?this.initialStates.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateResponse: ${e}`);return new e0({lastRound:e.get("last-round"),txnGroups:(e.get("txn-groups")??[]).map(t=>n0.fromEncodingData(t)),version:e.get("version"),evalOverrides:typeof e.get("eval-overrides")<"u"?a0.fromEncodingData(e.get("eval-overrides")):void 0,execTraceConfig:typeof e.get("exec-trace-config")<"u"?Wl.fromEncodingData(e.get("exec-trace-config")):void 0,initialStates:typeof e.get("initial-states")<"u"?Yw.fromEncodingData(e.get("initial-states")):void 0})}},Wl=class t0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"enable",valueSchema:new $(new jt),omitEmpty:!0},{key:"scratch-change",valueSchema:new $(new jt),omitEmpty:!0},{key:"stack-change",valueSchema:new $(new jt),omitEmpty:!0},{key:"state-change",valueSchema:new $(new jt),omitEmpty:!0})),this.encodingSchemaValue}constructor({enable:e,scratchChange:t,stackChange:r,stateChange:i}){this.enable=e,this.scratchChange=t,this.stackChange=r,this.stateChange=i}getEncodingSchema(){return t0.encodingSchema}toEncodingData(){return new Map([["enable",this.enable],["scratch-change",this.scratchChange],["stack-change",this.stackChange],["state-change",this.stateChange]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateTraceConfig: ${e}`);return new t0({enable:e.get("enable"),scratchChange:e.get("scratch-change"),stackChange:e.get("stack-change"),stateChange:e.get("state-change")})}},n0=class r0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"txn-results",valueSchema:new qe(i0.encodingSchema),omitEmpty:!0},{key:"app-budget-added",valueSchema:new $(new J),omitEmpty:!0},{key:"app-budget-consumed",valueSchema:new $(new J),omitEmpty:!0},{key:"failed-at",valueSchema:new $(new qe(new J)),omitEmpty:!0},{key:"failure-message",valueSchema:new $(new Ne),omitEmpty:!0},{key:"unnamed-resources-accessed",valueSchema:new $(Jl.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({txnResults:e,appBudgetAdded:t,appBudgetConsumed:r,failedAt:i,failureMessage:o,unnamedResourcesAccessed:s}){this.txnResults=e,this.appBudgetAdded=typeof t>"u"?void 0:Ye(t),this.appBudgetConsumed=typeof r>"u"?void 0:Ye(r),this.failedAt=typeof i>"u"?void 0:i.map(Ye),this.failureMessage=o,this.unnamedResourcesAccessed=s}getEncodingSchema(){return r0.encodingSchema}toEncodingData(){return new Map([["txn-results",this.txnResults.map(e=>e.toEncodingData())],["app-budget-added",this.appBudgetAdded],["app-budget-consumed",this.appBudgetConsumed],["failed-at",this.failedAt],["failure-message",this.failureMessage],["unnamed-resources-accessed",typeof this.unnamedResourcesAccessed<"u"?this.unnamedResourcesAccessed.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateTransactionGroupResult: ${e}`);return new r0({txnResults:(e.get("txn-results")??[]).map(t=>i0.fromEncodingData(t)),appBudgetAdded:e.get("app-budget-added"),appBudgetConsumed:e.get("app-budget-consumed"),failedAt:e.get("failed-at"),failureMessage:e.get("failure-message"),unnamedResourcesAccessed:typeof e.get("unnamed-resources-accessed")<"u"?Jl.fromEncodingData(e.get("unnamed-resources-accessed")):void 0})}},i0=class o0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"txn-result",valueSchema:of.encodingSchema,omitEmpty:!0},{key:"app-budget-consumed",valueSchema:new $(new J),omitEmpty:!0},{key:"exec-trace",valueSchema:new $(l0.encodingSchema),omitEmpty:!0},{key:"fixed-signer",valueSchema:new $(new Ne),omitEmpty:!0},{key:"logic-sig-budget-consumed",valueSchema:new $(new J),omitEmpty:!0},{key:"unnamed-resources-accessed",valueSchema:new $(Jl.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({txnResult:e,appBudgetConsumed:t,execTrace:r,fixedSigner:i,logicSigBudgetConsumed:o,unnamedResourcesAccessed:s}){this.txnResult=e,this.appBudgetConsumed=typeof t>"u"?void 0:Ye(t),this.execTrace=r,this.fixedSigner=typeof i=="string"?Ot.fromString(i):i,this.logicSigBudgetConsumed=typeof o>"u"?void 0:Ye(o),this.unnamedResourcesAccessed=s}getEncodingSchema(){return o0.encodingSchema}toEncodingData(){return new Map([["txn-result",this.txnResult.toEncodingData()],["app-budget-consumed",this.appBudgetConsumed],["exec-trace",typeof this.execTrace<"u"?this.execTrace.toEncodingData():void 0],["fixed-signer",typeof this.fixedSigner<"u"?this.fixedSigner.toString():void 0],["logic-sig-budget-consumed",this.logicSigBudgetConsumed],["unnamed-resources-accessed",typeof this.unnamedResourcesAccessed<"u"?this.unnamedResourcesAccessed.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateTransactionResult: ${e}`);return new o0({txnResult:of.fromEncodingData(e.get("txn-result")??new Map),appBudgetConsumed:e.get("app-budget-consumed"),execTrace:typeof e.get("exec-trace")<"u"?l0.fromEncodingData(e.get("exec-trace")):void 0,fixedSigner:e.get("fixed-signer"),logicSigBudgetConsumed:e.get("logic-sig-budget-consumed"),unnamedResourcesAccessed:typeof e.get("unnamed-resources-accessed")<"u"?Jl.fromEncodingData(e.get("unnamed-resources-accessed")):void 0})}},Jl=class s0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"accounts",valueSchema:new $(new qe(new Ne)),omitEmpty:!0},{key:"app-locals",valueSchema:new $(new qe(Xy.encodingSchema)),omitEmpty:!0},{key:"apps",valueSchema:new $(new qe(new J)),omitEmpty:!0},{key:"asset-holdings",valueSchema:new $(new qe(sw.encodingSchema)),omitEmpty:!0},{key:"assets",valueSchema:new $(new qe(new J)),omitEmpty:!0},{key:"boxes",valueSchema:new $(new qe(Sw.encodingSchema)),omitEmpty:!0},{key:"extra-box-refs",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({accounts:e,appLocals:t,apps:r,assetHoldings:i,assets:o,boxes:s,extraBoxRefs:a}){this.accounts=typeof e<"u"?e.map(l=>typeof l=="string"?Ot.fromString(l):l):void 0,this.appLocals=t,this.apps=typeof r>"u"?void 0:r.map(Ce),this.assetHoldings=i,this.assets=typeof o>"u"?void 0:o.map(Ce),this.boxes=s,this.extraBoxRefs=typeof a>"u"?void 0:Ye(a)}getEncodingSchema(){return s0.encodingSchema}toEncodingData(){return new Map([["accounts",typeof this.accounts<"u"?this.accounts.map(e=>e.toString()):void 0],["app-locals",typeof this.appLocals<"u"?this.appLocals.map(e=>e.toEncodingData()):void 0],["apps",this.apps],["asset-holdings",typeof this.assetHoldings<"u"?this.assetHoldings.map(e=>e.toEncodingData()):void 0],["assets",this.assets],["boxes",typeof this.boxes<"u"?this.boxes.map(e=>e.toEncodingData()):void 0],["extra-box-refs",this.extraBoxRefs]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateUnnamedResourcesAccessed: ${e}`);return new s0({accounts:e.get("accounts"),appLocals:typeof e.get("app-locals")<"u"?e.get("app-locals").map(t=>Xy.fromEncodingData(t)):void 0,apps:e.get("apps"),assetHoldings:typeof e.get("asset-holdings")<"u"?e.get("asset-holdings").map(t=>sw.fromEncodingData(t)):void 0,assets:e.get("assets"),boxes:typeof e.get("boxes")<"u"?e.get("boxes").map(t=>Sw.fromEncodingData(t)):void 0,extraBoxRefs:e.get("extra-box-refs")})}},a0=class c0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"allow-empty-signatures",valueSchema:new $(new jt),omitEmpty:!0},{key:"allow-unnamed-resources",valueSchema:new $(new jt),omitEmpty:!0},{key:"extra-opcode-budget",valueSchema:new $(new J),omitEmpty:!0},{key:"fix-signers",valueSchema:new $(new jt),omitEmpty:!0},{key:"max-log-calls",valueSchema:new $(new J),omitEmpty:!0},{key:"max-log-size",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({allowEmptySignatures:e,allowUnnamedResources:t,extraOpcodeBudget:r,fixSigners:i,maxLogCalls:o,maxLogSize:s}){this.allowEmptySignatures=e,this.allowUnnamedResources=t,this.extraOpcodeBudget=typeof r>"u"?void 0:Ye(r),this.fixSigners=i,this.maxLogCalls=typeof o>"u"?void 0:Ye(o),this.maxLogSize=typeof s>"u"?void 0:Ye(s)}getEncodingSchema(){return c0.encodingSchema}toEncodingData(){return new Map([["allow-empty-signatures",this.allowEmptySignatures],["allow-unnamed-resources",this.allowUnnamedResources],["extra-opcode-budget",this.extraOpcodeBudget],["fix-signers",this.fixSigners],["max-log-calls",this.maxLogCalls],["max-log-size",this.maxLogSize]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulationEvalOverrides: ${e}`);return new c0({allowEmptySignatures:e.get("allow-empty-signatures"),allowUnnamedResources:e.get("allow-unnamed-resources"),extraOpcodeBudget:e.get("extra-opcode-budget"),fixSigners:e.get("fix-signers"),maxLogCalls:e.get("max-log-calls"),maxLogSize:e.get("max-log-size")})}},Ss=class u0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"pc",valueSchema:new J,omitEmpty:!0},{key:"scratch-changes",valueSchema:new $(new qe(Ww.encodingSchema)),omitEmpty:!0},{key:"spawned-inners",valueSchema:new $(new qe(new J)),omitEmpty:!0},{key:"stack-additions",valueSchema:new $(new qe(no.encodingSchema)),omitEmpty:!0},{key:"stack-pop-count",valueSchema:new $(new J),omitEmpty:!0},{key:"state-changes",valueSchema:new $(new qe(tw.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({pc:e,scratchChanges:t,spawnedInners:r,stackAdditions:i,stackPopCount:o,stateChanges:s}){this.pc=Ye(e),this.scratchChanges=t,this.spawnedInners=typeof r>"u"?void 0:r.map(Ye),this.stackAdditions=i,this.stackPopCount=typeof o>"u"?void 0:Ye(o),this.stateChanges=s}getEncodingSchema(){return u0.encodingSchema}toEncodingData(){return new Map([["pc",this.pc],["scratch-changes",typeof this.scratchChanges<"u"?this.scratchChanges.map(e=>e.toEncodingData()):void 0],["spawned-inners",this.spawnedInners],["stack-additions",typeof this.stackAdditions<"u"?this.stackAdditions.map(e=>e.toEncodingData()):void 0],["stack-pop-count",this.stackPopCount],["state-changes",typeof this.stateChanges<"u"?this.stateChanges.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulationOpcodeTraceUnit: ${e}`);return new u0({pc:e.get("pc"),scratchChanges:typeof e.get("scratch-changes")<"u"?e.get("scratch-changes").map(t=>Ww.fromEncodingData(t)):void 0,spawnedInners:e.get("spawned-inners"),stackAdditions:typeof e.get("stack-additions")<"u"?e.get("stack-additions").map(t=>no.fromEncodingData(t)):void 0,stackPopCount:e.get("stack-pop-count"),stateChanges:typeof e.get("state-changes")<"u"?e.get("state-changes").map(t=>tw.fromEncodingData(t)):void 0})}},l0=class vl{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"approval-program-hash",valueSchema:new $(new We),omitEmpty:!0},{key:"approval-program-trace",valueSchema:new $(new qe(Ss.encodingSchema)),omitEmpty:!0},{key:"clear-state-program-hash",valueSchema:new $(new We),omitEmpty:!0},{key:"clear-state-program-trace",valueSchema:new $(new qe(Ss.encodingSchema)),omitEmpty:!0},{key:"clear-state-rollback",valueSchema:new $(new jt),omitEmpty:!0},{key:"clear-state-rollback-error",valueSchema:new $(new Ne),omitEmpty:!0},{key:"inner-trace",valueSchema:new $(new qe(vl.encodingSchema)),omitEmpty:!0},{key:"logic-sig-hash",valueSchema:new $(new We),omitEmpty:!0},{key:"logic-sig-trace",valueSchema:new $(new qe(Ss.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({approvalProgramHash:e,approvalProgramTrace:t,clearStateProgramHash:r,clearStateProgramTrace:i,clearStateRollback:o,clearStateRollbackError:s,innerTrace:a,logicSigHash:l,logicSigTrace:c}){this.approvalProgramHash=typeof e=="string"?ut(e):e,this.approvalProgramTrace=t,this.clearStateProgramHash=typeof r=="string"?ut(r):r,this.clearStateProgramTrace=i,this.clearStateRollback=o,this.clearStateRollbackError=s,this.innerTrace=a,this.logicSigHash=typeof l=="string"?ut(l):l,this.logicSigTrace=c}getEncodingSchema(){return vl.encodingSchema}toEncodingData(){return new Map([["approval-program-hash",this.approvalProgramHash],["approval-program-trace",typeof this.approvalProgramTrace<"u"?this.approvalProgramTrace.map(e=>e.toEncodingData()):void 0],["clear-state-program-hash",this.clearStateProgramHash],["clear-state-program-trace",typeof this.clearStateProgramTrace<"u"?this.clearStateProgramTrace.map(e=>e.toEncodingData()):void 0],["clear-state-rollback",this.clearStateRollback],["clear-state-rollback-error",this.clearStateRollbackError],["inner-trace",typeof this.innerTrace<"u"?this.innerTrace.map(e=>e.toEncodingData()):void 0],["logic-sig-hash",this.logicSigHash],["logic-sig-trace",typeof this.logicSigTrace<"u"?this.logicSigTrace.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulationTransactionExecTrace: ${e}`);return new vl({approvalProgramHash:e.get("approval-program-hash"),approvalProgramTrace:typeof e.get("approval-program-trace")<"u"?e.get("approval-program-trace").map(t=>Ss.fromEncodingData(t)):void 0,clearStateProgramHash:e.get("clear-state-program-hash"),clearStateProgramTrace:typeof e.get("clear-state-program-trace")<"u"?e.get("clear-state-program-trace").map(t=>Ss.fromEncodingData(t)):void 0,clearStateRollback:e.get("clear-state-rollback"),clearStateRollbackError:e.get("clear-state-rollback-error"),innerTrace:typeof e.get("inner-trace")<"u"?e.get("inner-trace").map(t=>vl.fromEncodingData(t)):void 0,logicSigHash:e.get("logic-sig-hash"),logicSigTrace:typeof e.get("logic-sig-trace")<"u"?e.get("logic-sig-trace").map(t=>Ss.fromEncodingData(t)):void 0})}},bD=class h0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"Message",valueSchema:d0.encodingSchema,omitEmpty:!0},{key:"StateProof",valueSchema:new We,omitEmpty:!0})),this.encodingSchemaValue}constructor({message:e,stateproof:t}){this.message=e,this.stateproof=typeof t=="string"?ut(t):t}getEncodingSchema(){return h0.encodingSchema}toEncodingData(){return new Map([["Message",this.message.toEncodingData()],["StateProof",this.stateproof]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProof: ${e}`);return new h0({message:d0.fromEncodingData(e.get("Message")??new Map),stateproof:e.get("StateProof")})}},d0=class f0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"BlockHeadersCommitment",valueSchema:new We,omitEmpty:!0},{key:"FirstAttestedRound",valueSchema:new J,omitEmpty:!0},{key:"LastAttestedRound",valueSchema:new J,omitEmpty:!0},{key:"LnProvenWeight",valueSchema:new J,omitEmpty:!0},{key:"VotersCommitment",valueSchema:new We,omitEmpty:!0})),this.encodingSchemaValue}constructor({blockheaderscommitment:e,firstattestedround:t,lastattestedround:r,lnprovenweight:i,voterscommitment:o}){this.blockheaderscommitment=typeof e=="string"?ut(e):e,this.firstattestedround=Ce(t),this.lastattestedround=Ce(r),this.lnprovenweight=Ce(i),this.voterscommitment=typeof o=="string"?ut(o):o}getEncodingSchema(){return f0.encodingSchema}toEncodingData(){return new Map([["BlockHeadersCommitment",this.blockheaderscommitment],["FirstAttestedRound",this.firstattestedround],["LastAttestedRound",this.lastattestedround],["LnProvenWeight",this.lnprovenweight],["VotersCommitment",this.voterscommitment]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofMessage: ${e}`);return new f0({blockheaderscommitment:e.get("BlockHeadersCommitment"),firstattestedround:e.get("FirstAttestedRound"),lastattestedround:e.get("LastAttestedRound"),lnprovenweight:e.get("LnProvenWeight"),voterscommitment:e.get("VotersCommitment")})}},kD=class g0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"current_round",valueSchema:new J,omitEmpty:!0},{key:"online-money",valueSchema:new J,omitEmpty:!0},{key:"total-money",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({currentRound:e,onlineMoney:t,totalMoney:r}){this.currentRound=Ce(e),this.onlineMoney=Ce(t),this.totalMoney=Ce(r)}getEncodingSchema(){return g0.encodingSchema}toEncodingData(){return new Map([["current_round",this.currentRound],["online-money",this.onlineMoney],["total-money",this.totalMoney]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SupplyResponse: ${e}`);return new g0({currentRound:e.get("current_round"),onlineMoney:e.get("online-money"),totalMoney:e.get("total-money")})}},Yl=class p0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"key",valueSchema:new We,omitEmpty:!0},{key:"value",valueSchema:As.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({key:e,value:t}){this.key=typeof e=="string"?ut(e):e,this.value=t}getEncodingSchema(){return p0.encodingSchema}toEncodingData(){return new Map([["key",this.key],["value",this.value.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TealKeyValue: ${e}`);return new p0({key:e.get("key"),value:As.fromEncodingData(e.get("value")??new Map)})}},As=class m0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"bytes",valueSchema:new We,omitEmpty:!0},{key:"type",valueSchema:new J,omitEmpty:!0},{key:"uint",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({bytes:e,type:t,uint:r}){this.bytes=typeof e=="string"?ut(e):e,this.type=Ye(t),this.uint=Ce(r)}getEncodingSchema(){return m0.encodingSchema}toEncodingData(){return new Map([["bytes",this.bytes],["type",this.type],["uint",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TealValue: ${e}`);return new m0({bytes:e.get("bytes"),type:e.get("type"),uint:e.get("uint")})}},AD=class y0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"Deltas",valueSchema:new qe(_w.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({deltas:e}){this.deltas=e}getEncodingSchema(){return y0.encodingSchema}toEncodingData(){return new Map([["Deltas",this.deltas.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionGroupLedgerStateDeltasForRoundResponse: ${e}`);return new y0({deltas:(e.get("Deltas")??[]).map(t=>_w.fromEncodingData(t))})}},DD=class w0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"consensus-version",valueSchema:new Ne,omitEmpty:!0},{key:"fee",valueSchema:new J,omitEmpty:!0},{key:"genesis-hash",valueSchema:new We,omitEmpty:!0},{key:"genesis-id",valueSchema:new Ne,omitEmpty:!0},{key:"last-round",valueSchema:new J,omitEmpty:!0},{key:"min-fee",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({consensusVersion:e,fee:t,genesisHash:r,genesisId:i,lastRound:o,minFee:s}){this.consensusVersion=e,this.fee=Ce(t),this.genesisHash=typeof r=="string"?ut(r):r,this.genesisId=i,this.lastRound=Ce(o),this.minFee=Ce(s)}getEncodingSchema(){return w0.encodingSchema}toEncodingData(){return new Map([["consensus-version",this.consensusVersion],["fee",this.fee],["genesis-hash",this.genesisHash],["genesis-id",this.genesisId],["last-round",this.lastRound],["min-fee",this.minFee]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionParametersResponse: ${e}`);return new w0({consensusVersion:e.get("consensus-version"),fee:e.get("fee"),genesisHash:e.get("genesis-hash"),genesisId:e.get("genesis-id"),lastRound:e.get("last-round"),minFee:e.get("min-fee")})}},FD=class S0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"idx",valueSchema:new J,omitEmpty:!0},{key:"proof",valueSchema:new We,omitEmpty:!0},{key:"stibhash",valueSchema:new We,omitEmpty:!0},{key:"treedepth",valueSchema:new J,omitEmpty:!0},{key:"hashtype",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({idx:e,proof:t,stibhash:r,treedepth:i,hashtype:o}){this.idx=Ye(e),this.proof=typeof t=="string"?ut(t):t,this.stibhash=typeof r=="string"?ut(r):r,this.treedepth=Ye(i),this.hashtype=o}getEncodingSchema(){return S0.encodingSchema}toEncodingData(){return new Map([["idx",this.idx],["proof",this.proof],["stibhash",this.stibhash],["treedepth",this.treedepth],["hashtype",this.hashtype]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionProof: ${e}`);return new S0({idx:e.get("idx"),proof:e.get("proof"),stibhash:e.get("stibhash"),treedepth:e.get("treedepth"),hashtype:e.get("hashtype")})}},TD=class v0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"build",valueSchema:Ew.encodingSchema,omitEmpty:!0},{key:"genesis_hash_b64",valueSchema:new We,omitEmpty:!0},{key:"genesis_id",valueSchema:new Ne,omitEmpty:!0},{key:"versions",valueSchema:new qe(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({build:e,genesisHashB64:t,genesisId:r,versions:i}){this.build=e,this.genesisHashB64=typeof t=="string"?ut(t):t,this.genesisId=r,this.versions=i}getEncodingSchema(){return v0.encodingSchema}toEncodingData(){return new Map([["build",this.build.toEncodingData()],["genesis_hash_b64",this.genesisHashB64],["genesis_id",this.genesisId],["versions",this.versions]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Version: ${e}`);return new v0({build:Ew.fromEncodingData(e.get("build")??new Map),genesisHashB64:e.get("genesis_hash_b64"),genesisId:e.get("genesis_id"),versions:e.get("versions")})}};const mC=Object.freeze(Object.defineProperty({__proto__:null,Account:nf,AccountApplicationResponse:aD,AccountAssetHolding:Ny,AccountAssetResponse:cD,AccountAssetsInformationResponse:dC,AccountParticipation:_y,AccountStateDelta:Hl,AppCallLogs:Hy,Application:Qs,ApplicationInitialStates:Wy,ApplicationKVStorage:ws,ApplicationLocalReference:Xy,ApplicationLocalState:Gl,ApplicationParams:Mc,ApplicationStateOperation:tw,ApplicationStateSchema:ii,Asset:rf,AssetHolding:Zs,AssetHoldingReference:sw,AssetParams:ea,AvmKeyValue:uw,AvmValue:no,BlockHashResponse:uD,BlockLogsResponse:fC,BlockResponse:lD,BlockTxidsResponse:hD,Box:dD,BoxDescriptor:yw,BoxReference:Sw,BoxesResponse:fD,BuildVersion:Ew,CompileResponse:gD,DisassembleResponse:pD,DryrunRequest:mD,DryrunResponse:yD,DryrunSource:Tw,DryrunState:wl,DryrunTxnResult:Rw,ErrorResponse:gC,EvalDelta:$w,EvalDeltaKeyValue:ta,Genesis:pC,GenesisAllocation:Nw,GetBlockTimeStampOffsetResponse:wD,GetSyncRoundResponse:SD,LedgerStateDeltaForTransactionGroup:_w,LightBlockHeaderProof:vD,NodeStatusResponse:Kx,PendingTransactionResponse:of,PendingTransactionsResponse:Wx,PostTransactionsResponse:xD,ScratchChange:Ww,SimulateInitialStates:Yw,SimulateRequest:Jx,SimulateRequestTransactionGroup:Kl,SimulateResponse:ED,SimulateTraceConfig:Wl,SimulateTransactionGroupResult:n0,SimulateTransactionResult:i0,SimulateUnnamedResourcesAccessed:Jl,SimulationEvalOverrides:a0,SimulationOpcodeTraceUnit:Ss,SimulationTransactionExecTrace:l0,StateProof:bD,StateProofMessage:d0,SupplyResponse:kD,TealKeyValue:Yl,TealValue:As,TransactionGroupLedgerStateDeltasForRoundResponse:AD,TransactionParametersResponse:DD,TransactionProof:FD,Version:TD},Symbol.toStringTag,{value:"Module"}));let Bt=class{constructor(e){this.c=e,this.query={}}executeRequest(e,t){return this.c.get({relativePath:this.path(),query:this.query,requestHeaders:e,customOptions:t})}async do(e,t){const r=await this.executeRequest(e,t);return this.prepare(r)}async doRaw(e,t){return(await this.executeRequest(e,t)).body}},yC=class extends Bt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}`}exclude(e){return this.query.exclude=e,this}prepare(e){return Wt(e.getJSONText(),nf)}},wC=class extends Bt{constructor(e,t,r){super(e),this.account=t.toString(),this.assetID=BigInt(r)}path(){return`/v2/accounts/${this.account}/assets/${this.assetID}`}prepare(e){return Wt(e.getJSONText(),cD)}},SC=class extends Bt{constructor(e,t,r){super(e),this.account=t.toString(),this.applicationID=BigInt(r)}path(){return`/v2/accounts/${this.account}/applications/${this.applicationID}`}prepare(e){return Wt(e.getJSONText(),aD)}},vC=class extends Bt{constructor(e,t){super(e),this.round=BigInt(t),this.query={format:"msgpack"}}path(){return`/v2/blocks/${this.round}`}headerOnly(e){return this.query["header-only"]=e,this}prepare(e){return Fn(e.body,lD)}};function ID(n={}){let e=n;return Object.keys(e).every(t=>t.toLowerCase()!=="content-type")&&(e={...n},e["Content-Type"]="text/plain"),e}let xC=class extends Bt{constructor(e,t){super(e),this.source=t}path(){return"/v2/teal/compile"}sourcemap(e=!0){return this.query.sourcemap=e,this}executeRequest(e,t){const r=ID(e);return this.c.post({relativePath:this.path(),data:Ti(this.source),query:this.query,requestHeaders:r,customOptions:t})}prepare(e){return Wt(e.getJSONText(),gD)}},EC=class extends Bt{constructor(e,t){super(e),this.blob=Wr(t)}path(){return"/v2/teal/dryrun"}executeRequest(e,t){const r=ID(e);return this.c.post({relativePath:this.path(),data:this.blob,requestHeaders:r,customOptions:t})}prepare(e){return Wt(e.getJSONText(),yD)}},bC=class extends Bt{path(){return"/genesis"}prepare(e){return e.getJSONText()}},kC=class extends Bt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/assets/${this.index}`}prepare(e){return Wt(e.getJSONText(),rf)}},AC=class extends Bt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/applications/${this.index}`}prepare(e){return Wt(e.getJSONText(),Qs)}},DC=class extends Bt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/blocks/${this.round}/hash`}prepare(e){return Wt(e.getJSONText(),uD)}},FC=class extends Bt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/blocks/${this.round}/txids`}prepare(e){return Wt(e.getJSONText(),hD)}},TC=class extends Bt{constructor(e,t,r){super(e),this.index=BigInt(t);const i=Qn(r);this.query.name=encodeURI(`b64:${i}`)}path(){return`/v2/applications/${this.index}/box`}prepare(e){return Wt(e.getJSONText(),dD)}},IC=class extends Bt{constructor(e,t){super(e),this.index=BigInt(t),this.query.max=0}path(){return`/v2/applications/${this.index}/boxes`}max(e){return this.query.max=e,this}prepare(e){return Wt(e.getJSONText(),fD)}},MC=class extends Bt{path(){return"/health"}prepare(e){}},RC=class extends Bt{constructor(e,t){super(e),this.txid=t,this.query.format="msgpack"}prepare(e){return Fn(e.body,of)}path(){return`/v2/transactions/pending/${this.txid}`}max(e){return this.query.max=e,this}},CC=class extends Bt{constructor(e){super(e),this.query.format="msgpack"}path(){return"/v2/transactions/pending"}prepare(e){return Fn(e.body,Wx)}max(e){return this.query.max=e,this}},PC=class extends Bt{constructor(e,t){super(e),this.address=t.toString(),this.query.format="msgpack"}prepare(e){return Fn(e.body,Wx)}path(){return`/v2/accounts/${this.address}/transactions/pending`}max(e){return this.query.max=e,this}},$C=class extends Bt{constructor(e,t,r){super(e),this.txID=r,this.round=BigInt(t)}path(){return`/v2/blocks/${this.round}/transactions/${this.txID}/proof`}hashType(e){return this.query.hashtype=e,this}prepare(e){return Wt(e.getJSONText(),FD)}};function BC(n={}){let e=n;return Object.keys(e).every(t=>t.toLowerCase()!=="content-type")&&(e={...n},e["Content-Type"]="application/x-binary"),e}function G1(n){return n&&n.byteLength!==void 0}let VC=class extends Bt{constructor(e,t){super(e);let r=t;if(Array.isArray(t)){if(!t.every(G1))throw new TypeError("Array elements must be byte arrays");r=Un(...t)}else if(!G1(r))throw new TypeError("Argument must be byte array");this.txnBytesToPost=r}path(){return"/v2/transactions"}executeRequest(e,t){const r=BC(e);return this.c.post({relativePath:this.path(),data:this.txnBytesToPost,requestHeaders:r,customOptions:t})}prepare(e){return Wt(e.getJSONText(),xD)}},OC=class extends Bt{path(){return"/v2/status"}prepare(e){return Wt(e.getJSONText(),Kx)}},NC=class extends Bt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/status/wait-for-block-after/${this.round}`}prepare(e){return Wt(e.getJSONText(),Kx)}},LC=class extends Bt{path(){return"/v2/transactions/params"}prepare(e){const t=Wt(e.getJSONText(),DD);return{flatFee:!1,fee:t.fee,firstValid:t.lastRound,lastValid:t.lastRound+BigInt(1e3),genesisID:t.genesisId,genesisHash:t.genesisHash,minFee:t.minFee,consensusVersion:t.consensusVersion}}},UC=class extends Bt{path(){return"/v2/ledger/supply"}prepare(e){return Wt(e.getJSONText(),kD)}},jC=class extends Bt{path(){return"/versions"}prepare(e){return Wt(e.getJSONText(),TD)}},_C=class extends Bt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/blocks/${this.round}/lightheader/proof`}prepare(e){return Wt(e.getJSONText(),vD)}},zC=class extends Bt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/stateproofs/${this.round}`}prepare(e){return Wt(e.getJSONText(),bD)}},qC=class extends Bt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/ledger/sync/${this.round}`}executeRequest(e,t){return this.c.post({relativePath:this.path(),data:null,requestHeaders:e,customOptions:t})}prepare(e){}},HC=class extends Bt{path(){return"/v2/ledger/sync"}prepare(e){return Wt(e.getJSONText(),SD)}},GC=class extends Bt{constructor(e,t){super(e),this.offset=BigInt(t)}path(){return`/v2/devmode/blocks/offset/${this.offset}`}executeRequest(e,t){return this.c.post({relativePath:this.path(),data:null,requestHeaders:e,customOptions:t})}prepare(e){}},KC=class extends Bt{path(){return"/v2/devmode/blocks/offset"}prepare(e){return Wt(e.getJSONText(),wD)}};function WC(n={}){let e=n;return Object.keys(e).every(t=>t.toLowerCase()!=="content-type")&&(e={...n},e["Content-Type"]="text/plain"),e}let JC=class extends Bt{constructor(e,t){super(e),this.source=t}path(){return"/v2/teal/disassemble"}executeRequest(e,t){const r=WC(e);return this.c.post({relativePath:this.path(),data:Ti(this.source),query:this.query,requestHeaders:r,customOptions:t})}prepare(e){return Wt(e.getJSONText(),pD)}};function YC(n={}){let e=n;return Object.keys(e).every(t=>t.toLowerCase()!=="content-type")&&(e={...n},e["Content-Type"]="application/msgpack"),e}let XC=class extends Bt{constructor(e,t){super(e),this.query.format="msgpack",this.requestBytes=Wr(t)}path(){return"/v2/transactions/simulate"}executeRequest(e,t){const r=YC(e);return this.c.post({relativePath:this.path(),data:this.requestBytes,query:this.query,requestHeaders:r,customOptions:t})}prepare(e){return Fn(e.body,ED)}},QC=class extends Bt{path(){return"/ready"}prepare(e){}},ZC=class extends Bt{path(){return"/v2/ledger/sync"}executeRequest(e,t){return this.c.delete({relativePath:this.path(),data:void 0,requestHeaders:e,customOptions:t})}prepare(e){}},e4=class extends Bt{constructor(e,t){super(e),this.id=t,this.query={format:"msgpack"}}path(){return`/v2/deltas/txn/group/${this.id}`}prepare(e){return Fn(e.body,Ic)}},t4=class extends Bt{constructor(e,t){super(e),this.round=BigInt(t),this.query={format:"msgpack"}}path(){return`/v2/deltas/${this.round}`}prepare(e){return Fn(e.body,Ic)}},n4=class extends Bt{constructor(e,t){super(e),this.round=BigInt(t),this.query={format:"msgpack"}}path(){return`/v2/deltas/${this.round}/txn/group`}prepare(e){return Fn(e.body,AD)}},r4=class extends _x{constructor(e,t,r,i={}){super("X-Algo-API-Token",e,t,r,i)}healthCheck(){return new MC(this.c)}versionsCheck(){return new jC(this.c)}sendRawTransaction(e){return new VC(this.c,e)}accountInformation(e){return new yC(this.c,e)}accountAssetInformation(e,t){return new wC(this.c,e,t)}accountApplicationInformation(e,t){return new SC(this.c,e,t)}block(e){return new vC(this.c,e)}getBlockHash(e){return new DC(this.c,e)}getBlockTxids(e){return new FC(this.c,e)}pendingTransactionInformation(e){return new RC(this.c,e)}pendingTransactionsInformation(){return new CC(this.c)}pendingTransactionByAddress(e){return new PC(this.c,e)}status(){return new OC(this.c)}statusAfterBlock(e){return new NC(this.c,e)}getTransactionParams(){return new LC(this.c)}supply(){return new UC(this.c)}compile(e){return new xC(this.c,e)}disassemble(e){return new JC(this.c,e)}dryrun(e){return new EC(this.c,e)}getAssetByID(e){return new kC(this.c,e)}getApplicationByID(e){return new AC(this.c,e)}getApplicationBoxByName(e,t){return new TC(this.c,e,t)}getApplicationBoxes(e){return new IC(this.c,e)}genesis(){return new bC(this.c)}getTransactionProof(e,t){return new $C(this.c,e,t)}getLightBlockHeaderProof(e){return new _C(this.c,e)}getStateProof(e){return new zC(this.c,e)}simulateRawTransactions(e){const t=[];if(Array.isArray(e))for(const i of e)t.push(Fn(i,kn));else t.push(Fn(e,kn));const r=new Jx({txnGroups:[new Kl({txns:t})]});return this.simulateTransactions(r)}simulateTransactions(e){return new XC(this.c,e)}setBlockOffsetTimestamp(e){return new GC(this.c,e)}getBlockOffsetTimestamp(){return new KC(this.c)}setSyncRound(e){return new qC(this.c,e)}unsetSyncRound(){return new ZC(this.c)}getSyncRound(){return new HC(this.c)}ready(){return new QC(this.c)}getLedgerStateDeltaForTransactionGroup(e){return new e4(this.c,e)}getLedgerStateDelta(e){return new t4(this.c,e)}getTransactionGroupLedgerStateDeltasForRound(e){return new n4(this.c,e)}},i4=class extends _x{constructor(e,t="http://127.0.0.1",r=7833,i={}){super("X-KMD-API-Token",e,t,r,i)}async get(e){return(await this.c.get({relativePath:e})).parseBodyAsJSON({intDecoding:Bn.SAFE})}async delete(e,t){return(await this.c.delete({relativePath:e,data:t})).parseBodyAsJSON({intDecoding:Bn.SAFE})}async post(e,t){return(await this.c.post({relativePath:e,data:t})).parseBodyAsJSON({intDecoding:Bn.SAFE})}async versions(){return this.get("/versions")}async listWallets(){return this.get("/v1/wallets")}async createWallet(e,t,r=new Uint8Array,i="sqlite"){const o={wallet_name:e,wallet_driver_name:i,wallet_password:t,master_derivation_key:Qn(r)};return this.post("/v1/wallet",o)}async initWalletHandle(e,t){const r={wallet_id:e,wallet_password:t};return this.post("/v1/wallet/init",r)}async releaseWalletHandle(e){const t={wallet_handle_token:e};return this.post("/v1/wallet/release",t)}async renewWalletHandle(e){const t={wallet_handle_token:e};return this.post("/v1/wallet/renew",t)}async renameWallet(e,t,r){const i={wallet_id:e,wallet_password:t,wallet_name:r};return this.post("/v1/wallet/rename",i)}async getWallet(e){const t={wallet_handle_token:e};return this.post("/v1/wallet/info",t)}async exportMasterDerivationKey(e,t){const r={wallet_handle_token:e,wallet_password:t},i=await this.post("/v1/master-key/export",r);return{master_derivation_key:ut(i.master_derivation_key)}}async importKey(e,t){const r={wallet_handle_token:e,private_key:Qn(t)};return this.post("/v1/key/import",r)}async exportKey(e,t,r){const i={wallet_handle_token:e,address:r,wallet_password:t},o=await this.post("/v1/key/export",i);return{private_key:ut(o.private_key)}}async generateKey(e){const t={wallet_handle_token:e,display_mnemonic:!1};return this.post("/v1/key",t)}async deleteKey(e,t,r){const i={wallet_handle_token:e,address:r,wallet_password:t};return this.delete("/v1/key",i)}async listKeys(e){const t={wallet_handle_token:e};return this.post("/v1/key/list",t)}async signTransaction(e,t,r){const i={wallet_handle_token:e,wallet_password:t,transaction:Qn(r.toByte())},o=await this.post("/v1/transaction/sign",i);return ut(o.signed_transaction)}async signTransactionWithSpecificPublicKey(e,t,r,i){const o=Ti(i),s={wallet_handle_token:e,wallet_password:t,transaction:Qn(r.toByte()),public_key:Qn(o)},a=await this.post("/v1/transaction/sign",s);return ut(a.signed_transaction)}async listMultisig(e){const t={wallet_handle_token:e};return this.post("/v1/multisig/list",t)}async importMultisig(e,t,r,i){const o={wallet_handle_token:e,multisig_version:t,threshold:r,pks:i};return this.post("/v1/multisig/import",o)}async exportMultisig(e,t){const r={wallet_handle_token:e,address:t};return this.post("/v1/multisig/export",r)}async signMultisigTransaction(e,t,r,i,o){const s=Ti(i),a={wallet_handle_token:e,transaction:Qn(r.toByte()),public_key:Qn(s),partial_multisig:o,wallet_password:t};return this.post("/v1/multisig/sign",a)}async deleteMultisig(e,t,r){const i={wallet_handle_token:e,address:r,wallet_password:t};return this.delete("/v1/multisig",i)}},Xl=class x0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Ne,omitEmpty:!0},{key:"amount",valueSchema:new J,omitEmpty:!0},{key:"amount-without-pending-rewards",valueSchema:new J,omitEmpty:!0},{key:"min-balance",valueSchema:new J,omitEmpty:!0},{key:"pending-rewards",valueSchema:new J,omitEmpty:!0},{key:"rewards",valueSchema:new J,omitEmpty:!0},{key:"round",valueSchema:new J,omitEmpty:!0},{key:"status",valueSchema:new Ne,omitEmpty:!0},{key:"total-apps-opted-in",valueSchema:new J,omitEmpty:!0},{key:"total-assets-opted-in",valueSchema:new J,omitEmpty:!0},{key:"total-box-bytes",valueSchema:new J,omitEmpty:!0},{key:"total-boxes",valueSchema:new J,omitEmpty:!0},{key:"total-created-apps",valueSchema:new J,omitEmpty:!0},{key:"total-created-assets",valueSchema:new J,omitEmpty:!0},{key:"apps-local-state",valueSchema:new $(new qe(Ql.encodingSchema)),omitEmpty:!0},{key:"apps-total-extra-pages",valueSchema:new $(new J),omitEmpty:!0},{key:"apps-total-schema",valueSchema:new $(Gi.encodingSchema),omitEmpty:!0},{key:"assets",valueSchema:new $(new qe(Zl.encodingSchema)),omitEmpty:!0},{key:"auth-addr",valueSchema:new $(new Ne),omitEmpty:!0},{key:"closed-at-round",valueSchema:new $(new J),omitEmpty:!0},{key:"created-apps",valueSchema:new $(new qe(na.encodingSchema)),omitEmpty:!0},{key:"created-assets",valueSchema:new $(new qe(ra.encodingSchema)),omitEmpty:!0},{key:"created-at-round",valueSchema:new $(new J),omitEmpty:!0},{key:"deleted",valueSchema:new $(new jt),omitEmpty:!0},{key:"incentive-eligible",valueSchema:new $(new jt),omitEmpty:!0},{key:"last-heartbeat",valueSchema:new $(new J),omitEmpty:!0},{key:"last-proposed",valueSchema:new $(new J),omitEmpty:!0},{key:"participation",valueSchema:new $(E0.encodingSchema),omitEmpty:!0},{key:"reward-base",valueSchema:new $(new J),omitEmpty:!0},{key:"sig-type",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,amount:t,amountWithoutPendingRewards:r,minBalance:i,pendingRewards:o,rewards:s,round:a,status:l,totalAppsOptedIn:c,totalAssetsOptedIn:d,totalBoxBytes:f,totalBoxes:m,totalCreatedApps:w,totalCreatedAssets:k,appsLocalState:I,appsTotalExtraPages:x,appsTotalSchema:T,assets:b,authAddr:R,closedAtRound:L,createdApps:G,createdAssets:E,createdAtRound:N,deleted:p,incentiveEligible:F,lastHeartbeat:v,lastProposed:O,participation:C,rewardBase:V,sigType:H}){this.address=e,this.amount=Ce(t),this.amountWithoutPendingRewards=Ce(r),this.minBalance=Ye(i),this.pendingRewards=Ce(o),this.rewards=Ce(s),this.round=Ce(a),this.status=l,this.totalAppsOptedIn=Ye(c),this.totalAssetsOptedIn=Ye(d),this.totalBoxBytes=Ye(f),this.totalBoxes=Ye(m),this.totalCreatedApps=Ye(w),this.totalCreatedAssets=Ye(k),this.appsLocalState=I,this.appsTotalExtraPages=typeof x>"u"?void 0:Ye(x),this.appsTotalSchema=T,this.assets=b,this.authAddr=typeof R=="string"?Ot.fromString(R):R,this.closedAtRound=typeof L>"u"?void 0:Ce(L),this.createdApps=G,this.createdAssets=E,this.createdAtRound=typeof N>"u"?void 0:Ce(N),this.deleted=p,this.incentiveEligible=F,this.lastHeartbeat=typeof v>"u"?void 0:Ye(v),this.lastProposed=typeof O>"u"?void 0:Ye(O),this.participation=C,this.rewardBase=typeof V>"u"?void 0:Ce(V),this.sigType=H}getEncodingSchema(){return x0.encodingSchema}toEncodingData(){return new Map([["address",this.address],["amount",this.amount],["amount-without-pending-rewards",this.amountWithoutPendingRewards],["min-balance",this.minBalance],["pending-rewards",this.pendingRewards],["rewards",this.rewards],["round",this.round],["status",this.status],["total-apps-opted-in",this.totalAppsOptedIn],["total-assets-opted-in",this.totalAssetsOptedIn],["total-box-bytes",this.totalBoxBytes],["total-boxes",this.totalBoxes],["total-created-apps",this.totalCreatedApps],["total-created-assets",this.totalCreatedAssets],["apps-local-state",typeof this.appsLocalState<"u"?this.appsLocalState.map(e=>e.toEncodingData()):void 0],["apps-total-extra-pages",this.appsTotalExtraPages],["apps-total-schema",typeof this.appsTotalSchema<"u"?this.appsTotalSchema.toEncodingData():void 0],["assets",typeof this.assets<"u"?this.assets.map(e=>e.toEncodingData()):void 0],["auth-addr",typeof this.authAddr<"u"?this.authAddr.toString():void 0],["closed-at-round",this.closedAtRound],["created-apps",typeof this.createdApps<"u"?this.createdApps.map(e=>e.toEncodingData()):void 0],["created-assets",typeof this.createdAssets<"u"?this.createdAssets.map(e=>e.toEncodingData()):void 0],["created-at-round",this.createdAtRound],["deleted",this.deleted],["incentive-eligible",this.incentiveEligible],["last-heartbeat",this.lastHeartbeat],["last-proposed",this.lastProposed],["participation",typeof this.participation<"u"?this.participation.toEncodingData():void 0],["reward-base",this.rewardBase],["sig-type",this.sigType]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Account: ${e}`);return new x0({address:e.get("address"),amount:e.get("amount"),amountWithoutPendingRewards:e.get("amount-without-pending-rewards"),minBalance:e.get("min-balance"),pendingRewards:e.get("pending-rewards"),rewards:e.get("rewards"),round:e.get("round"),status:e.get("status"),totalAppsOptedIn:e.get("total-apps-opted-in"),totalAssetsOptedIn:e.get("total-assets-opted-in"),totalBoxBytes:e.get("total-box-bytes"),totalBoxes:e.get("total-boxes"),totalCreatedApps:e.get("total-created-apps"),totalCreatedAssets:e.get("total-created-assets"),appsLocalState:typeof e.get("apps-local-state")<"u"?e.get("apps-local-state").map(t=>Ql.fromEncodingData(t)):void 0,appsTotalExtraPages:e.get("apps-total-extra-pages"),appsTotalSchema:typeof e.get("apps-total-schema")<"u"?Gi.fromEncodingData(e.get("apps-total-schema")):void 0,assets:typeof e.get("assets")<"u"?e.get("assets").map(t=>Zl.fromEncodingData(t)):void 0,authAddr:e.get("auth-addr"),closedAtRound:e.get("closed-at-round"),createdApps:typeof e.get("created-apps")<"u"?e.get("created-apps").map(t=>na.fromEncodingData(t)):void 0,createdAssets:typeof e.get("created-assets")<"u"?e.get("created-assets").map(t=>ra.fromEncodingData(t)):void 0,createdAtRound:e.get("created-at-round"),deleted:e.get("deleted"),incentiveEligible:e.get("incentive-eligible"),lastHeartbeat:e.get("last-heartbeat"),lastProposed:e.get("last-proposed"),participation:typeof e.get("participation")<"u"?E0.fromEncodingData(e.get("participation")):void 0,rewardBase:e.get("reward-base"),sigType:e.get("sig-type")})}},E0=class b0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"selection-participation-key",valueSchema:new We,omitEmpty:!0},{key:"vote-first-valid",valueSchema:new J,omitEmpty:!0},{key:"vote-key-dilution",valueSchema:new J,omitEmpty:!0},{key:"vote-last-valid",valueSchema:new J,omitEmpty:!0},{key:"vote-participation-key",valueSchema:new We,omitEmpty:!0},{key:"state-proof-key",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({selectionParticipationKey:e,voteFirstValid:t,voteKeyDilution:r,voteLastValid:i,voteParticipationKey:o,stateProofKey:s}){this.selectionParticipationKey=typeof e=="string"?ut(e):e,this.voteFirstValid=Ce(t),this.voteKeyDilution=Ce(r),this.voteLastValid=Ce(i),this.voteParticipationKey=typeof o=="string"?ut(o):o,this.stateProofKey=typeof s=="string"?ut(s):s}getEncodingSchema(){return b0.encodingSchema}toEncodingData(){return new Map([["selection-participation-key",this.selectionParticipationKey],["vote-first-valid",this.voteFirstValid],["vote-key-dilution",this.voteKeyDilution],["vote-last-valid",this.voteLastValid],["vote-participation-key",this.voteParticipationKey],["state-proof-key",this.stateProofKey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountParticipation: ${e}`);return new b0({selectionParticipationKey:e.get("selection-participation-key"),voteFirstValid:e.get("vote-first-valid"),voteKeyDilution:e.get("vote-key-dilution"),voteLastValid:e.get("vote-last-valid"),voteParticipationKey:e.get("vote-participation-key"),stateProofKey:e.get("state-proof-key")})}},MD=class k0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"account",valueSchema:Xl.encodingSchema,omitEmpty:!0},{key:"current-round",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({account:e,currentRound:t}){this.account=e,this.currentRound=Ce(t)}getEncodingSchema(){return k0.encodingSchema}toEncodingData(){return new Map([["account",this.account.toEncodingData()],["current-round",this.currentRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountResponse: ${e}`);return new k0({account:Xl.fromEncodingData(e.get("account")??new Map),currentRound:e.get("current-round")})}},A0=class D0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Ne,omitEmpty:!0},{key:"delta",valueSchema:new qe(nh.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,delta:t}){this.address=e,this.delta=t}getEncodingSchema(){return D0.encodingSchema}toEncodingData(){return new Map([["address",this.address],["delta",this.delta.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountStateDelta: ${e}`);return new D0({address:e.get("address"),delta:(e.get("delta")??[]).map(t=>nh.fromEncodingData(t))})}},RD=class F0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"accounts",valueSchema:new qe(Xl.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({accounts:e,currentRound:t,nextToken:r}){this.accounts=e,this.currentRound=Ce(t),this.nextToken=r}getEncodingSchema(){return F0.encodingSchema}toEncodingData(){return new Map([["accounts",this.accounts.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountsResponse: ${e}`);return new F0({accounts:(e.get("accounts")??[]).map(t=>Xl.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}},na=class T0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"id",valueSchema:new J,omitEmpty:!0},{key:"params",valueSchema:$0.encodingSchema,omitEmpty:!0},{key:"created-at-round",valueSchema:new $(new J),omitEmpty:!0},{key:"deleted",valueSchema:new $(new jt),omitEmpty:!0},{key:"deleted-at-round",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({id:e,params:t,createdAtRound:r,deleted:i,deletedAtRound:o}){this.id=Ce(e),this.params=t,this.createdAtRound=typeof r>"u"?void 0:Ce(r),this.deleted=i,this.deletedAtRound=typeof o>"u"?void 0:Ce(o)}getEncodingSchema(){return T0.encodingSchema}toEncodingData(){return new Map([["id",this.id],["params",this.params.toEncodingData()],["created-at-round",this.createdAtRound],["deleted",this.deleted],["deleted-at-round",this.deletedAtRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Application: ${e}`);return new T0({id:e.get("id"),params:$0.fromEncodingData(e.get("params")??new Map),createdAtRound:e.get("created-at-round"),deleted:e.get("deleted"),deletedAtRound:e.get("deleted-at-round")})}},Ql=class I0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"id",valueSchema:new J,omitEmpty:!0},{key:"schema",valueSchema:Gi.encodingSchema,omitEmpty:!0},{key:"closed-out-at-round",valueSchema:new $(new J),omitEmpty:!0},{key:"deleted",valueSchema:new $(new jt),omitEmpty:!0},{key:"key-value",valueSchema:new $(new qe(rh.encodingSchema)),omitEmpty:!0},{key:"opted-in-at-round",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({id:e,schema:t,closedOutAtRound:r,deleted:i,keyValue:o,optedInAtRound:s}){this.id=Ce(e),this.schema=t,this.closedOutAtRound=typeof r>"u"?void 0:Ce(r),this.deleted=i,this.keyValue=o,this.optedInAtRound=typeof s>"u"?void 0:Ce(s)}getEncodingSchema(){return I0.encodingSchema}toEncodingData(){return new Map([["id",this.id],["schema",this.schema.toEncodingData()],["closed-out-at-round",this.closedOutAtRound],["deleted",this.deleted],["key-value",typeof this.keyValue<"u"?this.keyValue.map(e=>e.toEncodingData()):void 0],["opted-in-at-round",this.optedInAtRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLocalState: ${e}`);return new I0({id:e.get("id"),schema:Gi.fromEncodingData(e.get("schema")??new Map),closedOutAtRound:e.get("closed-out-at-round"),deleted:e.get("deleted"),keyValue:typeof e.get("key-value")<"u"?e.get("key-value").map(t=>rh.fromEncodingData(t)):void 0,optedInAtRound:e.get("opted-in-at-round")})}},CD=class M0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"apps-local-states",valueSchema:new qe(Ql.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({appsLocalStates:e,currentRound:t,nextToken:r}){this.appsLocalStates=e,this.currentRound=Ce(t),this.nextToken=r}getEncodingSchema(){return M0.encodingSchema}toEncodingData(){return new Map([["apps-local-states",this.appsLocalStates.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLocalStatesResponse: ${e}`);return new M0({appsLocalStates:(e.get("apps-local-states")??[]).map(t=>Ql.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}},R0=class C0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"logs",valueSchema:new qe(new We),omitEmpty:!0},{key:"txid",valueSchema:new Ne,omitEmpty:!0})),this.encodingSchemaValue}constructor({logs:e,txid:t}){this.logs=e,this.txid=t}getEncodingSchema(){return C0.encodingSchema}toEncodingData(){return new Map([["logs",this.logs],["txid",this.txid]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLogData: ${e}`);return new C0({logs:e.get("logs"),txid:e.get("txid")})}},PD=class P0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"application-id",valueSchema:new J,omitEmpty:!0},{key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"log-data",valueSchema:new $(new qe(R0.encodingSchema)),omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({applicationId:e,currentRound:t,logData:r,nextToken:i}){this.applicationId=Ce(e),this.currentRound=Ce(t),this.logData=r,this.nextToken=i}getEncodingSchema(){return P0.encodingSchema}toEncodingData(){return new Map([["application-id",this.applicationId],["current-round",this.currentRound],["log-data",typeof this.logData<"u"?this.logData.map(e=>e.toEncodingData()):void 0],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLogsResponse: ${e}`);return new P0({applicationId:e.get("application-id"),currentRound:e.get("current-round"),logData:typeof e.get("log-data")<"u"?e.get("log-data").map(t=>R0.fromEncodingData(t)):void 0,nextToken:e.get("next-token")})}},$0=class B0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"approval-program",valueSchema:new We,omitEmpty:!0},{key:"clear-state-program",valueSchema:new We,omitEmpty:!0},{key:"creator",valueSchema:new $(new Ne),omitEmpty:!0},{key:"extra-program-pages",valueSchema:new $(new J),omitEmpty:!0},{key:"global-state",valueSchema:new $(new qe(rh.encodingSchema)),omitEmpty:!0},{key:"global-state-schema",valueSchema:new $(Gi.encodingSchema),omitEmpty:!0},{key:"local-state-schema",valueSchema:new $(Gi.encodingSchema),omitEmpty:!0},{key:"version",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({approvalProgram:e,clearStateProgram:t,creator:r,extraProgramPages:i,globalState:o,globalStateSchema:s,localStateSchema:a,version:l}){this.approvalProgram=typeof e=="string"?ut(e):e,this.clearStateProgram=typeof t=="string"?ut(t):t,this.creator=typeof r=="string"?Ot.fromString(r):r,this.extraProgramPages=typeof i>"u"?void 0:Ye(i),this.globalState=o,this.globalStateSchema=s,this.localStateSchema=a,this.version=typeof l>"u"?void 0:Ye(l)}getEncodingSchema(){return B0.encodingSchema}toEncodingData(){return new Map([["approval-program",this.approvalProgram],["clear-state-program",this.clearStateProgram],["creator",typeof this.creator<"u"?this.creator.toString():void 0],["extra-program-pages",this.extraProgramPages],["global-state",typeof this.globalState<"u"?this.globalState.map(e=>e.toEncodingData()):void 0],["global-state-schema",typeof this.globalStateSchema<"u"?this.globalStateSchema.toEncodingData():void 0],["local-state-schema",typeof this.localStateSchema<"u"?this.localStateSchema.toEncodingData():void 0],["version",this.version]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationParams: ${e}`);return new B0({approvalProgram:e.get("approval-program"),clearStateProgram:e.get("clear-state-program"),creator:e.get("creator"),extraProgramPages:e.get("extra-program-pages"),globalState:typeof e.get("global-state")<"u"?e.get("global-state").map(t=>rh.fromEncodingData(t)):void 0,globalStateSchema:typeof e.get("global-state-schema")<"u"?Gi.fromEncodingData(e.get("global-state-schema")):void 0,localStateSchema:typeof e.get("local-state-schema")<"u"?Gi.fromEncodingData(e.get("local-state-schema")):void 0,version:e.get("version")})}},$D=class V0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"application",valueSchema:new $(na.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({currentRound:e,application:t}){this.currentRound=Ce(e),this.application=t}getEncodingSchema(){return V0.encodingSchema}toEncodingData(){return new Map([["current-round",this.currentRound],["application",typeof this.application<"u"?this.application.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationResponse: ${e}`);return new V0({currentRound:e.get("current-round"),application:typeof e.get("application")<"u"?na.fromEncodingData(e.get("application")):void 0})}},Gi=class O0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"num-byte-slice",valueSchema:new J,omitEmpty:!0},{key:"num-uint",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({numByteSlice:e,numUint:t}){this.numByteSlice=Ye(e),this.numUint=Ye(t)}getEncodingSchema(){return O0.encodingSchema}toEncodingData(){return new Map([["num-byte-slice",this.numByteSlice],["num-uint",this.numUint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationStateSchema: ${e}`);return new O0({numByteSlice:e.get("num-byte-slice"),numUint:e.get("num-uint")})}},Yx=class N0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"applications",valueSchema:new qe(na.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({applications:e,currentRound:t,nextToken:r}){this.applications=e,this.currentRound=Ce(t),this.nextToken=r}getEncodingSchema(){return N0.encodingSchema}toEncodingData(){return new Map([["applications",this.applications.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationsResponse: ${e}`);return new N0({applications:(e.get("applications")??[]).map(t=>na.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}},ra=class L0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"index",valueSchema:new J,omitEmpty:!0},{key:"params",valueSchema:eh.encodingSchema,omitEmpty:!0},{key:"created-at-round",valueSchema:new $(new J),omitEmpty:!0},{key:"deleted",valueSchema:new $(new jt),omitEmpty:!0},{key:"destroyed-at-round",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({index:e,params:t,createdAtRound:r,deleted:i,destroyedAtRound:o}){this.index=Ce(e),this.params=t,this.createdAtRound=typeof r>"u"?void 0:Ce(r),this.deleted=i,this.destroyedAtRound=typeof o>"u"?void 0:Ce(o)}getEncodingSchema(){return L0.encodingSchema}toEncodingData(){return new Map([["index",this.index],["params",this.params.toEncodingData()],["created-at-round",this.createdAtRound],["deleted",this.deleted],["destroyed-at-round",this.destroyedAtRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Asset: ${e}`);return new L0({index:e.get("index"),params:eh.fromEncodingData(e.get("params")??new Map),createdAtRound:e.get("created-at-round"),deleted:e.get("deleted"),destroyedAtRound:e.get("destroyed-at-round")})}},BD=class U0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"balances",valueSchema:new qe(xS.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({balances:e,currentRound:t,nextToken:r}){this.balances=e,this.currentRound=Ce(t),this.nextToken=r}getEncodingSchema(){return U0.encodingSchema}toEncodingData(){return new Map([["balances",this.balances.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetBalancesResponse: ${e}`);return new U0({balances:(e.get("balances")??[]).map(t=>xS.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}},Zl=class j0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"amount",valueSchema:new J,omitEmpty:!0},{key:"asset-id",valueSchema:new J,omitEmpty:!0},{key:"is-frozen",valueSchema:new jt,omitEmpty:!0},{key:"deleted",valueSchema:new $(new jt),omitEmpty:!0},{key:"opted-in-at-round",valueSchema:new $(new J),omitEmpty:!0},{key:"opted-out-at-round",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({amount:e,assetId:t,isFrozen:r,deleted:i,optedInAtRound:o,optedOutAtRound:s}){this.amount=Ce(e),this.assetId=Ce(t),this.isFrozen=r,this.deleted=i,this.optedInAtRound=typeof o>"u"?void 0:Ce(o),this.optedOutAtRound=typeof s>"u"?void 0:Ce(s)}getEncodingSchema(){return j0.encodingSchema}toEncodingData(){return new Map([["amount",this.amount],["asset-id",this.assetId],["is-frozen",this.isFrozen],["deleted",this.deleted],["opted-in-at-round",this.optedInAtRound],["opted-out-at-round",this.optedOutAtRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHolding: ${e}`);return new j0({amount:e.get("amount"),assetId:e.get("asset-id"),isFrozen:e.get("is-frozen"),deleted:e.get("deleted"),optedInAtRound:e.get("opted-in-at-round"),optedOutAtRound:e.get("opted-out-at-round")})}},VD=class _0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"assets",valueSchema:new qe(Zl.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({assets:e,currentRound:t,nextToken:r}){this.assets=e,this.currentRound=Ce(t),this.nextToken=r}getEncodingSchema(){return _0.encodingSchema}toEncodingData(){return new Map([["assets",this.assets.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHoldingsResponse: ${e}`);return new _0({assets:(e.get("assets")??[]).map(t=>Zl.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}},eh=class z0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"creator",valueSchema:new Ne,omitEmpty:!0},{key:"decimals",valueSchema:new J,omitEmpty:!0},{key:"total",valueSchema:new J,omitEmpty:!0},{key:"clawback",valueSchema:new $(new Ne),omitEmpty:!0},{key:"default-frozen",valueSchema:new $(new jt),omitEmpty:!0},{key:"freeze",valueSchema:new $(new Ne),omitEmpty:!0},{key:"manager",valueSchema:new $(new Ne),omitEmpty:!0},{key:"metadata-hash",valueSchema:new $(new We),omitEmpty:!0},{key:"name",valueSchema:new $(new Ne),omitEmpty:!0},{key:"name-b64",valueSchema:new $(new We),omitEmpty:!0},{key:"reserve",valueSchema:new $(new Ne),omitEmpty:!0},{key:"unit-name",valueSchema:new $(new Ne),omitEmpty:!0},{key:"unit-name-b64",valueSchema:new $(new We),omitEmpty:!0},{key:"url",valueSchema:new $(new Ne),omitEmpty:!0},{key:"url-b64",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({creator:e,decimals:t,total:r,clawback:i,defaultFrozen:o,freeze:s,manager:a,metadataHash:l,name:c,nameB64:d,reserve:f,unitName:m,unitNameB64:w,url:k,urlB64:I}){this.creator=e,this.decimals=Ye(t),this.total=Ce(r),this.clawback=i,this.defaultFrozen=o,this.freeze=s,this.manager=a,this.metadataHash=typeof l=="string"?ut(l):l,this.name=c,this.nameB64=typeof d=="string"?ut(d):d,this.reserve=f,this.unitName=m,this.unitNameB64=typeof w=="string"?ut(w):w,this.url=k,this.urlB64=typeof I=="string"?ut(I):I}getEncodingSchema(){return z0.encodingSchema}toEncodingData(){return new Map([["creator",this.creator],["decimals",this.decimals],["total",this.total],["clawback",this.clawback],["default-frozen",this.defaultFrozen],["freeze",this.freeze],["manager",this.manager],["metadata-hash",this.metadataHash],["name",this.name],["name-b64",this.nameB64],["reserve",this.reserve],["unit-name",this.unitName],["unit-name-b64",this.unitNameB64],["url",this.url],["url-b64",this.urlB64]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetParams: ${e}`);return new z0({creator:e.get("creator"),decimals:e.get("decimals"),total:e.get("total"),clawback:e.get("clawback"),defaultFrozen:e.get("default-frozen"),freeze:e.get("freeze"),manager:e.get("manager"),metadataHash:e.get("metadata-hash"),name:e.get("name"),nameB64:e.get("name-b64"),reserve:e.get("reserve"),unitName:e.get("unit-name"),unitNameB64:e.get("unit-name-b64"),url:e.get("url"),urlB64:e.get("url-b64")})}},OD=class q0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"asset",valueSchema:ra.encodingSchema,omitEmpty:!0},{key:"current-round",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({asset:e,currentRound:t}){this.asset=e,this.currentRound=Ce(t)}getEncodingSchema(){return q0.encodingSchema}toEncodingData(){return new Map([["asset",this.asset.toEncodingData()],["current-round",this.currentRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetResponse: ${e}`);return new q0({asset:ra.fromEncodingData(e.get("asset")??new Map),currentRound:e.get("current-round")})}},Xx=class H0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"assets",valueSchema:new qe(ra.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({assets:e,currentRound:t,nextToken:r}){this.assets=e,this.currentRound=Ce(t),this.nextToken=r}getEncodingSchema(){return H0.encodingSchema}toEncodingData(){return new Map([["assets",this.assets.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetsResponse: ${e}`);return new H0({assets:(e.get("assets")??[]).map(t=>ra.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}},sf=class G0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"genesis-hash",valueSchema:new We,omitEmpty:!0},{key:"genesis-id",valueSchema:new Ne,omitEmpty:!0},{key:"previous-block-hash",valueSchema:new We,omitEmpty:!0},{key:"round",valueSchema:new J,omitEmpty:!0},{key:"seed",valueSchema:new We,omitEmpty:!0},{key:"timestamp",valueSchema:new J,omitEmpty:!0},{key:"transactions-root",valueSchema:new We,omitEmpty:!0},{key:"transactions-root-sha256",valueSchema:new We,omitEmpty:!0},{key:"bonus",valueSchema:new $(new J),omitEmpty:!0},{key:"fees-collected",valueSchema:new $(new J),omitEmpty:!0},{key:"participation-updates",valueSchema:new $(bS.encodingSchema),omitEmpty:!0},{key:"previous-block-hash-512",valueSchema:new $(new We),omitEmpty:!0},{key:"proposer",valueSchema:new $(new Ne),omitEmpty:!0},{key:"proposer-payout",valueSchema:new $(new J),omitEmpty:!0},{key:"rewards",valueSchema:new $(W0.encodingSchema),omitEmpty:!0},{key:"state-proof-tracking",valueSchema:new $(new qe(OS.encodingSchema)),omitEmpty:!0},{key:"transactions",valueSchema:new $(new qe(ia.encodingSchema)),omitEmpty:!0},{key:"transactions-root-sha512",valueSchema:new $(new We),omitEmpty:!0},{key:"txn-counter",valueSchema:new $(new J),omitEmpty:!0},{key:"upgrade-state",valueSchema:new $(Y0.encodingSchema),omitEmpty:!0},{key:"upgrade-vote",valueSchema:new $(Q0.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({genesisHash:e,genesisId:t,previousBlockHash:r,round:i,seed:o,timestamp:s,transactionsRoot:a,transactionsRootSha256:l,bonus:c,feesCollected:d,participationUpdates:f,previousBlockHash512:m,proposer:w,proposerPayout:k,rewards:I,stateProofTracking:x,transactions:T,transactionsRootSha512:b,txnCounter:R,upgradeState:L,upgradeVote:G}){this.genesisHash=typeof e=="string"?ut(e):e,this.genesisId=t,this.previousBlockHash=typeof r=="string"?ut(r):r,this.round=Ce(i),this.seed=typeof o=="string"?ut(o):o,this.timestamp=Ye(s),this.transactionsRoot=typeof a=="string"?ut(a):a,this.transactionsRootSha256=typeof l=="string"?ut(l):l,this.bonus=typeof c>"u"?void 0:Ye(c),this.feesCollected=typeof d>"u"?void 0:Ye(d),this.participationUpdates=f,this.previousBlockHash512=typeof m=="string"?ut(m):m,this.proposer=typeof w=="string"?Ot.fromString(w):w,this.proposerPayout=typeof k>"u"?void 0:Ye(k),this.rewards=I,this.stateProofTracking=x,this.transactions=T,this.transactionsRootSha512=typeof b=="string"?ut(b):b,this.txnCounter=typeof R>"u"?void 0:Ye(R),this.upgradeState=L,this.upgradeVote=G}getEncodingSchema(){return G0.encodingSchema}toEncodingData(){return new Map([["genesis-hash",this.genesisHash],["genesis-id",this.genesisId],["previous-block-hash",this.previousBlockHash],["round",this.round],["seed",this.seed],["timestamp",this.timestamp],["transactions-root",this.transactionsRoot],["transactions-root-sha256",this.transactionsRootSha256],["bonus",this.bonus],["fees-collected",this.feesCollected],["participation-updates",typeof this.participationUpdates<"u"?this.participationUpdates.toEncodingData():void 0],["previous-block-hash-512",this.previousBlockHash512],["proposer",typeof this.proposer<"u"?this.proposer.toString():void 0],["proposer-payout",this.proposerPayout],["rewards",typeof this.rewards<"u"?this.rewards.toEncodingData():void 0],["state-proof-tracking",typeof this.stateProofTracking<"u"?this.stateProofTracking.map(e=>e.toEncodingData()):void 0],["transactions",typeof this.transactions<"u"?this.transactions.map(e=>e.toEncodingData()):void 0],["transactions-root-sha512",this.transactionsRootSha512],["txn-counter",this.txnCounter],["upgrade-state",typeof this.upgradeState<"u"?this.upgradeState.toEncodingData():void 0],["upgrade-vote",typeof this.upgradeVote<"u"?this.upgradeVote.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Block: ${e}`);return new G0({genesisHash:e.get("genesis-hash"),genesisId:e.get("genesis-id"),previousBlockHash:e.get("previous-block-hash"),round:e.get("round"),seed:e.get("seed"),timestamp:e.get("timestamp"),transactionsRoot:e.get("transactions-root"),transactionsRootSha256:e.get("transactions-root-sha256"),bonus:e.get("bonus"),feesCollected:e.get("fees-collected"),participationUpdates:typeof e.get("participation-updates")<"u"?bS.fromEncodingData(e.get("participation-updates")):void 0,previousBlockHash512:e.get("previous-block-hash-512"),proposer:e.get("proposer"),proposerPayout:e.get("proposer-payout"),rewards:typeof e.get("rewards")<"u"?W0.fromEncodingData(e.get("rewards")):void 0,stateProofTracking:typeof e.get("state-proof-tracking")<"u"?e.get("state-proof-tracking").map(t=>OS.fromEncodingData(t)):void 0,transactions:typeof e.get("transactions")<"u"?e.get("transactions").map(t=>ia.fromEncodingData(t)):void 0,transactionsRootSha512:e.get("transactions-root-sha512"),txnCounter:e.get("txn-counter"),upgradeState:typeof e.get("upgrade-state")<"u"?Y0.fromEncodingData(e.get("upgrade-state")):void 0,upgradeVote:typeof e.get("upgrade-vote")<"u"?Q0.fromEncodingData(e.get("upgrade-vote")):void 0})}},ND=class K0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"blocks",valueSchema:new qe(sf.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({blocks:e,currentRound:t,nextToken:r}){this.blocks=e,this.currentRound=Ce(t),this.nextToken=r}getEncodingSchema(){return K0.encodingSchema}toEncodingData(){return new Map([["blocks",this.blocks.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockHeadersResponse: ${e}`);return new K0({blocks:(e.get("blocks")??[]).map(t=>sf.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}},W0=class J0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"fee-sink",valueSchema:new Ne,omitEmpty:!0},{key:"rewards-calculation-round",valueSchema:new J,omitEmpty:!0},{key:"rewards-level",valueSchema:new J,omitEmpty:!0},{key:"rewards-pool",valueSchema:new Ne,omitEmpty:!0},{key:"rewards-rate",valueSchema:new J,omitEmpty:!0},{key:"rewards-residue",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({feeSink:e,rewardsCalculationRound:t,rewardsLevel:r,rewardsPool:i,rewardsRate:o,rewardsResidue:s}){this.feeSink=e,this.rewardsCalculationRound=Ce(t),this.rewardsLevel=Ce(r),this.rewardsPool=i,this.rewardsRate=Ce(o),this.rewardsResidue=Ce(s)}getEncodingSchema(){return J0.encodingSchema}toEncodingData(){return new Map([["fee-sink",this.feeSink],["rewards-calculation-round",this.rewardsCalculationRound],["rewards-level",this.rewardsLevel],["rewards-pool",this.rewardsPool],["rewards-rate",this.rewardsRate],["rewards-residue",this.rewardsResidue]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockRewards: ${e}`);return new J0({feeSink:e.get("fee-sink"),rewardsCalculationRound:e.get("rewards-calculation-round"),rewardsLevel:e.get("rewards-level"),rewardsPool:e.get("rewards-pool"),rewardsRate:e.get("rewards-rate"),rewardsResidue:e.get("rewards-residue")})}},Y0=class X0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"current-protocol",valueSchema:new Ne,omitEmpty:!0},{key:"next-protocol",valueSchema:new $(new Ne),omitEmpty:!0},{key:"next-protocol-approvals",valueSchema:new $(new J),omitEmpty:!0},{key:"next-protocol-switch-on",valueSchema:new $(new J),omitEmpty:!0},{key:"next-protocol-vote-before",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({currentProtocol:e,nextProtocol:t,nextProtocolApprovals:r,nextProtocolSwitchOn:i,nextProtocolVoteBefore:o}){this.currentProtocol=e,this.nextProtocol=t,this.nextProtocolApprovals=typeof r>"u"?void 0:Ye(r),this.nextProtocolSwitchOn=typeof i>"u"?void 0:Ce(i),this.nextProtocolVoteBefore=typeof o>"u"?void 0:Ce(o)}getEncodingSchema(){return X0.encodingSchema}toEncodingData(){return new Map([["current-protocol",this.currentProtocol],["next-protocol",this.nextProtocol],["next-protocol-approvals",this.nextProtocolApprovals],["next-protocol-switch-on",this.nextProtocolSwitchOn],["next-protocol-vote-before",this.nextProtocolVoteBefore]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockUpgradeState: ${e}`);return new X0({currentProtocol:e.get("current-protocol"),nextProtocol:e.get("next-protocol"),nextProtocolApprovals:e.get("next-protocol-approvals"),nextProtocolSwitchOn:e.get("next-protocol-switch-on"),nextProtocolVoteBefore:e.get("next-protocol-vote-before")})}},Q0=class Z0{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"upgrade-approve",valueSchema:new $(new jt),omitEmpty:!0},{key:"upgrade-delay",valueSchema:new $(new J),omitEmpty:!0},{key:"upgrade-propose",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({upgradeApprove:e,upgradeDelay:t,upgradePropose:r}){this.upgradeApprove=e,this.upgradeDelay=typeof t>"u"?void 0:Ce(t),this.upgradePropose=r}getEncodingSchema(){return Z0.encodingSchema}toEncodingData(){return new Map([["upgrade-approve",this.upgradeApprove],["upgrade-delay",this.upgradeDelay],["upgrade-propose",this.upgradePropose]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockUpgradeVote: ${e}`);return new Z0({upgradeApprove:e.get("upgrade-approve"),upgradeDelay:e.get("upgrade-delay"),upgradePropose:e.get("upgrade-propose")})}},LD=class eS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"name",valueSchema:new We,omitEmpty:!0},{key:"round",valueSchema:new J,omitEmpty:!0},{key:"value",valueSchema:new We,omitEmpty:!0})),this.encodingSchemaValue}constructor({name:e,round:t,value:r}){this.name=typeof e=="string"?ut(e):e,this.round=Ce(t),this.value=typeof r=="string"?ut(r):r}getEncodingSchema(){return eS.encodingSchema}toEncodingData(){return new Map([["name",this.name],["round",this.round],["value",this.value]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Box: ${e}`);return new eS({name:e.get("name"),round:e.get("round"),value:e.get("value")})}},tS=class nS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"name",valueSchema:new We,omitEmpty:!0})),this.encodingSchemaValue}constructor({name:e}){this.name=typeof e=="string"?ut(e):e}getEncodingSchema(){return nS.encodingSchema}toEncodingData(){return new Map([["name",this.name]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxDescriptor: ${e}`);return new nS({name:e.get("name")})}},th=class rS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"app",valueSchema:new J,omitEmpty:!0},{key:"name",valueSchema:new We,omitEmpty:!0})),this.encodingSchemaValue}constructor({app:e,name:t}){this.app=Ye(e),this.name=typeof t=="string"?ut(t):t}getEncodingSchema(){return rS.encodingSchema}toEncodingData(){return new Map([["app",this.app],["name",this.name]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxReference: ${e}`);return new rS({app:e.get("app"),name:e.get("name")})}},UD=class iS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"application-id",valueSchema:new J,omitEmpty:!0},{key:"boxes",valueSchema:new qe(tS.encodingSchema),omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({applicationId:e,boxes:t,nextToken:r}){this.applicationId=Ce(e),this.boxes=t,this.nextToken=r}getEncodingSchema(){return iS.encodingSchema}toEncodingData(){return new Map([["application-id",this.applicationId],["boxes",this.boxes.map(e=>e.toEncodingData())],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxesResponse: ${e}`);return new iS({applicationId:e.get("application-id"),boxes:(e.get("boxes")??[]).map(t=>tS.fromEncodingData(t)),nextToken:e.get("next-token")})}},o4=class oS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"message",valueSchema:new Ne,omitEmpty:!0},{key:"data",valueSchema:new $(pr.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({message:e,data:t}){this.message=e,this.data=t}getEncodingSchema(){return oS.encodingSchema}toEncodingData(){return new Map([["message",this.message],["data",typeof this.data<"u"?this.data.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ErrorResponse: ${e}`);return new oS({message:e.get("message"),data:typeof e.get("data")<"u"?pr.fromEncodingData(e.get("data")):void 0})}},sS=class aS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"action",valueSchema:new J,omitEmpty:!0},{key:"bytes",valueSchema:new $(new Ne),omitEmpty:!0},{key:"uint",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({action:e,bytes:t,uint:r}){this.action=Ye(e),this.bytes=t,this.uint=typeof r>"u"?void 0:Ce(r)}getEncodingSchema(){return aS.encodingSchema}toEncodingData(){return new Map([["action",this.action],["bytes",this.bytes],["uint",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded EvalDelta: ${e}`);return new aS({action:e.get("action"),bytes:e.get("bytes"),uint:e.get("uint")})}},nh=class cS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"key",valueSchema:new Ne,omitEmpty:!0},{key:"value",valueSchema:sS.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({key:e,value:t}){this.key=e,this.value=t}getEncodingSchema(){return cS.encodingSchema}toEncodingData(){return new Map([["key",this.key],["value",this.value.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded EvalDeltaKeyValue: ${e}`);return new cS({key:e.get("key"),value:sS.fromEncodingData(e.get("value")??new Map)})}},uS=class lS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"hash-type",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({hashType:e}){this.hashType=typeof e>"u"?void 0:Ye(e)}getEncodingSchema(){return lS.encodingSchema}toEncodingData(){return new Map([["hash-type",this.hashType]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HashFactory: ${e}`);return new lS({hashType:e.get("hash-type")})}},hS=class dS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"hb-pk",valueSchema:new $(new We),omitEmpty:!0},{key:"hb-pk1sig",valueSchema:new $(new We),omitEmpty:!0},{key:"hb-pk2",valueSchema:new $(new We),omitEmpty:!0},{key:"hb-pk2sig",valueSchema:new $(new We),omitEmpty:!0},{key:"hb-sig",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({hbPk:e,hbPk1sig:t,hbPk2:r,hbPk2sig:i,hbSig:o}){this.hbPk=typeof e=="string"?ut(e):e,this.hbPk1sig=typeof t=="string"?ut(t):t,this.hbPk2=typeof r=="string"?ut(r):r,this.hbPk2sig=typeof i=="string"?ut(i):i,this.hbSig=typeof o=="string"?ut(o):o}getEncodingSchema(){return dS.encodingSchema}toEncodingData(){return new Map([["hb-pk",this.hbPk],["hb-pk1sig",this.hbPk1sig],["hb-pk2",this.hbPk2],["hb-pk2sig",this.hbPk2sig],["hb-sig",this.hbSig]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HbProofFields: ${e}`);return new dS({hbPk:e.get("hb-pk"),hbPk1sig:e.get("hb-pk1sig"),hbPk2:e.get("hb-pk2"),hbPk2sig:e.get("hb-pk2sig"),hbSig:e.get("hb-sig")})}},jD=class fS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"db-available",valueSchema:new jt,omitEmpty:!0},{key:"is-migrating",valueSchema:new jt,omitEmpty:!0},{key:"message",valueSchema:new Ne,omitEmpty:!0},{key:"round",valueSchema:new J,omitEmpty:!0},{key:"version",valueSchema:new Ne,omitEmpty:!0},{key:"data",valueSchema:new $(pr.encodingSchema),omitEmpty:!0},{key:"errors",valueSchema:new $(new qe(new Ne)),omitEmpty:!0})),this.encodingSchemaValue}constructor({dbAvailable:e,isMigrating:t,message:r,round:i,version:o,data:s,errors:a}){this.dbAvailable=e,this.isMigrating=t,this.message=r,this.round=Ce(i),this.version=o,this.data=s,this.errors=a}getEncodingSchema(){return fS.encodingSchema}toEncodingData(){return new Map([["db-available",this.dbAvailable],["is-migrating",this.isMigrating],["message",this.message],["round",this.round],["version",this.version],["data",typeof this.data<"u"?this.data.toEncodingData():void 0],["errors",this.errors]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HealthCheck: ${e}`);return new fS({dbAvailable:e.get("db-available"),isMigrating:e.get("is-migrating"),message:e.get("message"),round:e.get("round"),version:e.get("version"),data:typeof e.get("data")<"u"?pr.fromEncodingData(e.get("data")):void 0,errors:e.get("errors")})}},gS=class pS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Ne,omitEmpty:!0},{key:"asset",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,asset:t}){this.address=typeof e=="string"?Ot.fromString(e):e,this.asset=Ye(t)}getEncodingSchema(){return pS.encodingSchema}toEncodingData(){return new Map([["address",this.address.toString()],["asset",this.asset]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HoldingRef: ${e}`);return new pS({address:e.get("address"),asset:e.get("asset")})}},mS=class yS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"block-headers-commitment",valueSchema:new $(new We),omitEmpty:!0},{key:"first-attested-round",valueSchema:new $(new J),omitEmpty:!0},{key:"latest-attested-round",valueSchema:new $(new J),omitEmpty:!0},{key:"ln-proven-weight",valueSchema:new $(new J),omitEmpty:!0},{key:"voters-commitment",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({blockHeadersCommitment:e,firstAttestedRound:t,latestAttestedRound:r,lnProvenWeight:i,votersCommitment:o}){this.blockHeadersCommitment=typeof e=="string"?ut(e):e,this.firstAttestedRound=typeof t>"u"?void 0:Ce(t),this.latestAttestedRound=typeof r>"u"?void 0:Ce(r),this.lnProvenWeight=typeof i>"u"?void 0:Ce(i),this.votersCommitment=typeof o=="string"?ut(o):o}getEncodingSchema(){return yS.encodingSchema}toEncodingData(){return new Map([["block-headers-commitment",this.blockHeadersCommitment],["first-attested-round",this.firstAttestedRound],["latest-attested-round",this.latestAttestedRound],["ln-proven-weight",this.lnProvenWeight],["voters-commitment",this.votersCommitment]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded IndexerStateProofMessage: ${e}`);return new yS({blockHeadersCommitment:e.get("block-headers-commitment"),firstAttestedRound:e.get("first-attested-round"),latestAttestedRound:e.get("latest-attested-round"),lnProvenWeight:e.get("ln-proven-weight"),votersCommitment:e.get("voters-commitment")})}},wS=class SS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Ne,omitEmpty:!0},{key:"app",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,app:t}){this.address=typeof e=="string"?Ot.fromString(e):e,this.app=Ye(t)}getEncodingSchema(){return SS.encodingSchema}toEncodingData(){return new Map([["address",this.address.toString()],["app",this.app]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded LocalsRef: ${e}`);return new SS({address:e.get("address"),app:e.get("app")})}},Ds=class vS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"hash-factory",valueSchema:new $(uS.encodingSchema),omitEmpty:!0},{key:"path",valueSchema:new $(new qe(new We)),omitEmpty:!0},{key:"tree-depth",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({hashFactory:e,path:t,treeDepth:r}){this.hashFactory=e,this.path=t,this.treeDepth=typeof r>"u"?void 0:Ye(r)}getEncodingSchema(){return vS.encodingSchema}toEncodingData(){return new Map([["hash-factory",typeof this.hashFactory<"u"?this.hashFactory.toEncodingData():void 0],["path",this.path],["tree-depth",this.treeDepth]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded MerkleArrayProof: ${e}`);return new vS({hashFactory:typeof e.get("hash-factory")<"u"?uS.fromEncodingData(e.get("hash-factory")):void 0,path:e.get("path"),treeDepth:e.get("tree-depth")})}},xS=class ES{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Ne,omitEmpty:!0},{key:"amount",valueSchema:new J,omitEmpty:!0},{key:"is-frozen",valueSchema:new jt,omitEmpty:!0},{key:"deleted",valueSchema:new $(new jt),omitEmpty:!0},{key:"opted-in-at-round",valueSchema:new $(new J),omitEmpty:!0},{key:"opted-out-at-round",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,amount:t,isFrozen:r,deleted:i,optedInAtRound:o,optedOutAtRound:s}){this.address=e,this.amount=Ce(t),this.isFrozen=r,this.deleted=i,this.optedInAtRound=typeof o>"u"?void 0:Ce(o),this.optedOutAtRound=typeof s>"u"?void 0:Ce(s)}getEncodingSchema(){return ES.encodingSchema}toEncodingData(){return new Map([["address",this.address],["amount",this.amount],["is-frozen",this.isFrozen],["deleted",this.deleted],["opted-in-at-round",this.optedInAtRound],["opted-out-at-round",this.optedOutAtRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded MiniAssetHolding: ${e}`);return new ES({address:e.get("address"),amount:e.get("amount"),isFrozen:e.get("is-frozen"),deleted:e.get("deleted"),optedInAtRound:e.get("opted-in-at-round"),optedOutAtRound:e.get("opted-out-at-round")})}},bS=class kS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"absent-participation-accounts",valueSchema:new $(new qe(new Ne)),omitEmpty:!0},{key:"expired-participation-accounts",valueSchema:new $(new qe(new Ne)),omitEmpty:!0})),this.encodingSchemaValue}constructor({absentParticipationAccounts:e,expiredParticipationAccounts:t}){this.absentParticipationAccounts=e,this.expiredParticipationAccounts=t}getEncodingSchema(){return kS.encodingSchema}toEncodingData(){return new Map([["absent-participation-accounts",this.absentParticipationAccounts],["expired-participation-accounts",this.expiredParticipationAccounts]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ParticipationUpdates: ${e}`);return new kS({absentParticipationAccounts:e.get("absent-participation-accounts"),expiredParticipationAccounts:e.get("expired-participation-accounts")})}},AS=class DS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new $(new Ne),omitEmpty:!0},{key:"application-id",valueSchema:new $(new J),omitEmpty:!0},{key:"asset-id",valueSchema:new $(new J),omitEmpty:!0},{key:"box",valueSchema:new $(th.encodingSchema),omitEmpty:!0},{key:"holding",valueSchema:new $(gS.encodingSchema),omitEmpty:!0},{key:"local",valueSchema:new $(wS.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,applicationId:t,assetId:r,box:i,holding:o,local:s}){this.address=typeof e=="string"?Ot.fromString(e):e,this.applicationId=typeof t>"u"?void 0:Ye(t),this.assetId=typeof r>"u"?void 0:Ye(r),this.box=i,this.holding=o,this.local=s}getEncodingSchema(){return DS.encodingSchema}toEncodingData(){return new Map([["address",typeof this.address<"u"?this.address.toString():void 0],["application-id",this.applicationId],["asset-id",this.assetId],["box",typeof this.box<"u"?this.box.toEncodingData():void 0],["holding",typeof this.holding<"u"?this.holding.toEncodingData():void 0],["local",typeof this.local<"u"?this.local.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ResourceRef: ${e}`);return new DS({address:e.get("address"),applicationId:e.get("application-id"),assetId:e.get("asset-id"),box:typeof e.get("box")<"u"?th.fromEncodingData(e.get("box")):void 0,holding:typeof e.get("holding")<"u"?gS.fromEncodingData(e.get("holding")):void 0,local:typeof e.get("local")<"u"?wS.fromEncodingData(e.get("local")):void 0})}},FS=class TS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"part-proofs",valueSchema:new $(Ds.encodingSchema),omitEmpty:!0},{key:"positions-to-reveal",valueSchema:new $(new qe(new J)),omitEmpty:!0},{key:"reveals",valueSchema:new $(new qe(RS.encodingSchema)),omitEmpty:!0},{key:"salt-version",valueSchema:new $(new J),omitEmpty:!0},{key:"sig-commit",valueSchema:new $(new We),omitEmpty:!0},{key:"sig-proofs",valueSchema:new $(Ds.encodingSchema),omitEmpty:!0},{key:"signed-weight",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({partProofs:e,positionsToReveal:t,reveals:r,saltVersion:i,sigCommit:o,sigProofs:s,signedWeight:a}){this.partProofs=e,this.positionsToReveal=typeof t>"u"?void 0:t.map(Ce),this.reveals=r,this.saltVersion=typeof i>"u"?void 0:Ye(i),this.sigCommit=typeof o=="string"?ut(o):o,this.sigProofs=s,this.signedWeight=typeof a>"u"?void 0:Ce(a)}getEncodingSchema(){return TS.encodingSchema}toEncodingData(){return new Map([["part-proofs",typeof this.partProofs<"u"?this.partProofs.toEncodingData():void 0],["positions-to-reveal",this.positionsToReveal],["reveals",typeof this.reveals<"u"?this.reveals.map(e=>e.toEncodingData()):void 0],["salt-version",this.saltVersion],["sig-commit",this.sigCommit],["sig-proofs",typeof this.sigProofs<"u"?this.sigProofs.toEncodingData():void 0],["signed-weight",this.signedWeight]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofFields: ${e}`);return new TS({partProofs:typeof e.get("part-proofs")<"u"?Ds.fromEncodingData(e.get("part-proofs")):void 0,positionsToReveal:e.get("positions-to-reveal"),reveals:typeof e.get("reveals")<"u"?e.get("reveals").map(t=>RS.fromEncodingData(t)):void 0,saltVersion:e.get("salt-version"),sigCommit:e.get("sig-commit"),sigProofs:typeof e.get("sig-proofs")<"u"?Ds.fromEncodingData(e.get("sig-proofs")):void 0,signedWeight:e.get("signed-weight")})}},IS=class MS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"verifier",valueSchema:new $(LS.encodingSchema),omitEmpty:!0},{key:"weight",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({verifier:e,weight:t}){this.verifier=e,this.weight=typeof t>"u"?void 0:Ce(t)}getEncodingSchema(){return MS.encodingSchema}toEncodingData(){return new Map([["verifier",typeof this.verifier<"u"?this.verifier.toEncodingData():void 0],["weight",this.weight]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofParticipant: ${e}`);return new MS({verifier:typeof e.get("verifier")<"u"?LS.fromEncodingData(e.get("verifier")):void 0,weight:e.get("weight")})}},RS=class CS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"participant",valueSchema:new $(IS.encodingSchema),omitEmpty:!0},{key:"position",valueSchema:new $(new J),omitEmpty:!0},{key:"sig-slot",valueSchema:new $(PS.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({participant:e,position:t,sigSlot:r}){this.participant=e,this.position=typeof t>"u"?void 0:Ce(t),this.sigSlot=r}getEncodingSchema(){return CS.encodingSchema}toEncodingData(){return new Map([["participant",typeof this.participant<"u"?this.participant.toEncodingData():void 0],["position",this.position],["sig-slot",typeof this.sigSlot<"u"?this.sigSlot.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofReveal: ${e}`);return new CS({participant:typeof e.get("participant")<"u"?IS.fromEncodingData(e.get("participant")):void 0,position:e.get("position"),sigSlot:typeof e.get("sig-slot")<"u"?PS.fromEncodingData(e.get("sig-slot")):void 0})}},PS=class $S{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"lower-sig-weight",valueSchema:new $(new J),omitEmpty:!0},{key:"signature",valueSchema:new $(BS.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({lowerSigWeight:e,signature:t}){this.lowerSigWeight=typeof e>"u"?void 0:Ce(e),this.signature=t}getEncodingSchema(){return $S.encodingSchema}toEncodingData(){return new Map([["lower-sig-weight",this.lowerSigWeight],["signature",typeof this.signature<"u"?this.signature.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofSigSlot: ${e}`);return new $S({lowerSigWeight:e.get("lower-sig-weight"),signature:typeof e.get("signature")<"u"?BS.fromEncodingData(e.get("signature")):void 0})}},BS=class VS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"falcon-signature",valueSchema:new $(new We),omitEmpty:!0},{key:"merkle-array-index",valueSchema:new $(new J),omitEmpty:!0},{key:"proof",valueSchema:new $(Ds.encodingSchema),omitEmpty:!0},{key:"verifying-key",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({falconSignature:e,merkleArrayIndex:t,proof:r,verifyingKey:i}){this.falconSignature=typeof e=="string"?ut(e):e,this.merkleArrayIndex=typeof t>"u"?void 0:Ye(t),this.proof=r,this.verifyingKey=typeof i=="string"?ut(i):i}getEncodingSchema(){return VS.encodingSchema}toEncodingData(){return new Map([["falcon-signature",this.falconSignature],["merkle-array-index",this.merkleArrayIndex],["proof",typeof this.proof<"u"?this.proof.toEncodingData():void 0],["verifying-key",this.verifyingKey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofSignature: ${e}`);return new VS({falconSignature:e.get("falcon-signature"),merkleArrayIndex:e.get("merkle-array-index"),proof:typeof e.get("proof")<"u"?Ds.fromEncodingData(e.get("proof")):void 0,verifyingKey:e.get("verifying-key")})}},OS=class NS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"next-round",valueSchema:new $(new J),omitEmpty:!0},{key:"online-total-weight",valueSchema:new $(new J),omitEmpty:!0},{key:"type",valueSchema:new $(new J),omitEmpty:!0},{key:"voters-commitment",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({nextRound:e,onlineTotalWeight:t,type:r,votersCommitment:i}){this.nextRound=typeof e>"u"?void 0:Ce(e),this.onlineTotalWeight=typeof t>"u"?void 0:Ce(t),this.type=typeof r>"u"?void 0:Ye(r),this.votersCommitment=typeof i=="string"?ut(i):i}getEncodingSchema(){return NS.encodingSchema}toEncodingData(){return new Map([["next-round",this.nextRound],["online-total-weight",this.onlineTotalWeight],["type",this.type],["voters-commitment",this.votersCommitment]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofTracking: ${e}`);return new NS({nextRound:e.get("next-round"),onlineTotalWeight:e.get("online-total-weight"),type:e.get("type"),votersCommitment:e.get("voters-commitment")})}},LS=class US{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"commitment",valueSchema:new $(new We),omitEmpty:!0},{key:"key-lifetime",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({commitment:e,keyLifetime:t}){this.commitment=typeof e=="string"?ut(e):e,this.keyLifetime=typeof t>"u"?void 0:Ce(t)}getEncodingSchema(){return US.encodingSchema}toEncodingData(){return new Map([["commitment",this.commitment],["key-lifetime",this.keyLifetime]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofVerifier: ${e}`);return new US({commitment:e.get("commitment"),keyLifetime:e.get("key-lifetime")})}},xl=class jS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"num-byte-slice",valueSchema:new J,omitEmpty:!0},{key:"num-uint",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({numByteSlice:e,numUint:t}){this.numByteSlice=Ye(e),this.numUint=Ye(t)}getEncodingSchema(){return jS.encodingSchema}toEncodingData(){return new Map([["num-byte-slice",this.numByteSlice],["num-uint",this.numUint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateSchema: ${e}`);return new jS({numByteSlice:e.get("num-byte-slice"),numUint:e.get("num-uint")})}},rh=class _S{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"key",valueSchema:new We,omitEmpty:!0},{key:"value",valueSchema:zS.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({key:e,value:t}){this.key=typeof e=="string"?ut(e):e,this.value=t}getEncodingSchema(){return _S.encodingSchema}toEncodingData(){return new Map([["key",this.key],["value",this.value.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TealKeyValue: ${e}`);return new _S({key:e.get("key"),value:zS.fromEncodingData(e.get("value")??new Map)})}},zS=class qS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"bytes",valueSchema:new We,omitEmpty:!0},{key:"type",valueSchema:new J,omitEmpty:!0},{key:"uint",valueSchema:new J,omitEmpty:!0})),this.encodingSchemaValue}constructor({bytes:e,type:t,uint:r}){this.bytes=typeof e=="string"?ut(e):e,this.type=Ye(t),this.uint=Ce(r)}getEncodingSchema(){return qS.encodingSchema}toEncodingData(){return new Map([["bytes",this.bytes],["type",this.type],["uint",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TealValue: ${e}`);return new qS({bytes:e.get("bytes"),type:e.get("type"),uint:e.get("uint")})}},ia=class El{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"fee",valueSchema:new J,omitEmpty:!0},{key:"first-valid",valueSchema:new J,omitEmpty:!0},{key:"last-valid",valueSchema:new J,omitEmpty:!0},{key:"sender",valueSchema:new Ne,omitEmpty:!0},{key:"application-transaction",valueSchema:new $(HS.encodingSchema),omitEmpty:!0},{key:"asset-config-transaction",valueSchema:new $(KS.encodingSchema),omitEmpty:!0},{key:"asset-freeze-transaction",valueSchema:new $(JS.encodingSchema),omitEmpty:!0},{key:"asset-transfer-transaction",valueSchema:new $(XS.encodingSchema),omitEmpty:!0},{key:"auth-addr",valueSchema:new $(new Ne),omitEmpty:!0},{key:"close-rewards",valueSchema:new $(new J),omitEmpty:!0},{key:"closing-amount",valueSchema:new $(new J),omitEmpty:!0},{key:"confirmed-round",valueSchema:new $(new J),omitEmpty:!0},{key:"created-application-index",valueSchema:new $(new J),omitEmpty:!0},{key:"created-asset-index",valueSchema:new $(new J),omitEmpty:!0},{key:"genesis-hash",valueSchema:new $(new We),omitEmpty:!0},{key:"genesis-id",valueSchema:new $(new Ne),omitEmpty:!0},{key:"global-state-delta",valueSchema:new $(new qe(nh.encodingSchema)),omitEmpty:!0},{key:"group",valueSchema:new $(new We),omitEmpty:!0},{key:"heartbeat-transaction",valueSchema:new $(ZS.encodingSchema),omitEmpty:!0},{key:"id",valueSchema:new $(new Ne),omitEmpty:!0},{key:"inner-txns",valueSchema:new $(new qe(El.encodingSchema)),omitEmpty:!0},{key:"intra-round-offset",valueSchema:new $(new J),omitEmpty:!0},{key:"keyreg-transaction",valueSchema:new $(tv.encodingSchema),omitEmpty:!0},{key:"lease",valueSchema:new $(new We),omitEmpty:!0},{key:"local-state-delta",valueSchema:new $(new qe(A0.encodingSchema)),omitEmpty:!0},{key:"logs",valueSchema:new $(new qe(new We)),omitEmpty:!0},{key:"note",valueSchema:new $(new We),omitEmpty:!0},{key:"payment-transaction",valueSchema:new $(rv.encodingSchema),omitEmpty:!0},{key:"receiver-rewards",valueSchema:new $(new J),omitEmpty:!0},{key:"rekey-to",valueSchema:new $(new Ne),omitEmpty:!0},{key:"round-time",valueSchema:new $(new J),omitEmpty:!0},{key:"sender-rewards",valueSchema:new $(new J),omitEmpty:!0},{key:"signature",valueSchema:new $(sv.encodingSchema),omitEmpty:!0},{key:"state-proof-transaction",valueSchema:new $(fv.encodingSchema),omitEmpty:!0},{key:"tx-type",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({fee:e,firstValid:t,lastValid:r,sender:i,applicationTransaction:o,assetConfigTransaction:s,assetFreezeTransaction:a,assetTransferTransaction:l,authAddr:c,closeRewards:d,closingAmount:f,confirmedRound:m,createdApplicationIndex:w,createdAssetIndex:k,genesisHash:I,genesisId:x,globalStateDelta:T,group:b,heartbeatTransaction:R,id:L,innerTxns:G,intraRoundOffset:E,keyregTransaction:N,lease:p,localStateDelta:F,logs:v,note:O,paymentTransaction:C,receiverRewards:V,rekeyTo:H,roundTime:_,senderRewards:ee,signature:oe,stateProofTransaction:z,txType:ue}){this.fee=Ce(e),this.firstValid=Ce(t),this.lastValid=Ce(r),this.sender=i,this.applicationTransaction=o,this.assetConfigTransaction=s,this.assetFreezeTransaction=a,this.assetTransferTransaction=l,this.authAddr=typeof c=="string"?Ot.fromString(c):c,this.closeRewards=typeof d>"u"?void 0:Ce(d),this.closingAmount=typeof f>"u"?void 0:Ce(f),this.confirmedRound=typeof m>"u"?void 0:Ce(m),this.createdApplicationIndex=typeof w>"u"?void 0:Ce(w),this.createdAssetIndex=typeof k>"u"?void 0:Ce(k),this.genesisHash=typeof I=="string"?ut(I):I,this.genesisId=x,this.globalStateDelta=T,this.group=typeof b=="string"?ut(b):b,this.heartbeatTransaction=R,this.id=L,this.innerTxns=G,this.intraRoundOffset=typeof E>"u"?void 0:Ye(E),this.keyregTransaction=N,this.lease=typeof p=="string"?ut(p):p,this.localStateDelta=F,this.logs=v,this.note=typeof O=="string"?ut(O):O,this.paymentTransaction=C,this.receiverRewards=typeof V>"u"?void 0:Ce(V),this.rekeyTo=typeof H=="string"?Ot.fromString(H):H,this.roundTime=typeof _>"u"?void 0:Ye(_),this.senderRewards=typeof ee>"u"?void 0:Ce(ee),this.signature=oe,this.stateProofTransaction=z,this.txType=ue}getEncodingSchema(){return El.encodingSchema}toEncodingData(){return new Map([["fee",this.fee],["first-valid",this.firstValid],["last-valid",this.lastValid],["sender",this.sender],["application-transaction",typeof this.applicationTransaction<"u"?this.applicationTransaction.toEncodingData():void 0],["asset-config-transaction",typeof this.assetConfigTransaction<"u"?this.assetConfigTransaction.toEncodingData():void 0],["asset-freeze-transaction",typeof this.assetFreezeTransaction<"u"?this.assetFreezeTransaction.toEncodingData():void 0],["asset-transfer-transaction",typeof this.assetTransferTransaction<"u"?this.assetTransferTransaction.toEncodingData():void 0],["auth-addr",typeof this.authAddr<"u"?this.authAddr.toString():void 0],["close-rewards",this.closeRewards],["closing-amount",this.closingAmount],["confirmed-round",this.confirmedRound],["created-application-index",this.createdApplicationIndex],["created-asset-index",this.createdAssetIndex],["genesis-hash",this.genesisHash],["genesis-id",this.genesisId],["global-state-delta",typeof this.globalStateDelta<"u"?this.globalStateDelta.map(e=>e.toEncodingData()):void 0],["group",this.group],["heartbeat-transaction",typeof this.heartbeatTransaction<"u"?this.heartbeatTransaction.toEncodingData():void 0],["id",this.id],["inner-txns",typeof this.innerTxns<"u"?this.innerTxns.map(e=>e.toEncodingData()):void 0],["intra-round-offset",this.intraRoundOffset],["keyreg-transaction",typeof this.keyregTransaction<"u"?this.keyregTransaction.toEncodingData():void 0],["lease",this.lease],["local-state-delta",typeof this.localStateDelta<"u"?this.localStateDelta.map(e=>e.toEncodingData()):void 0],["logs",this.logs],["note",this.note],["payment-transaction",typeof this.paymentTransaction<"u"?this.paymentTransaction.toEncodingData():void 0],["receiver-rewards",this.receiverRewards],["rekey-to",typeof this.rekeyTo<"u"?this.rekeyTo.toString():void 0],["round-time",this.roundTime],["sender-rewards",this.senderRewards],["signature",typeof this.signature<"u"?this.signature.toEncodingData():void 0],["state-proof-transaction",typeof this.stateProofTransaction<"u"?this.stateProofTransaction.toEncodingData():void 0],["tx-type",this.txType]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Transaction: ${e}`);return new El({fee:e.get("fee"),firstValid:e.get("first-valid"),lastValid:e.get("last-valid"),sender:e.get("sender"),applicationTransaction:typeof e.get("application-transaction")<"u"?HS.fromEncodingData(e.get("application-transaction")):void 0,assetConfigTransaction:typeof e.get("asset-config-transaction")<"u"?KS.fromEncodingData(e.get("asset-config-transaction")):void 0,assetFreezeTransaction:typeof e.get("asset-freeze-transaction")<"u"?JS.fromEncodingData(e.get("asset-freeze-transaction")):void 0,assetTransferTransaction:typeof e.get("asset-transfer-transaction")<"u"?XS.fromEncodingData(e.get("asset-transfer-transaction")):void 0,authAddr:e.get("auth-addr"),closeRewards:e.get("close-rewards"),closingAmount:e.get("closing-amount"),confirmedRound:e.get("confirmed-round"),createdApplicationIndex:e.get("created-application-index"),createdAssetIndex:e.get("created-asset-index"),genesisHash:e.get("genesis-hash"),genesisId:e.get("genesis-id"),globalStateDelta:typeof e.get("global-state-delta")<"u"?e.get("global-state-delta").map(t=>nh.fromEncodingData(t)):void 0,group:e.get("group"),heartbeatTransaction:typeof e.get("heartbeat-transaction")<"u"?ZS.fromEncodingData(e.get("heartbeat-transaction")):void 0,id:e.get("id"),innerTxns:typeof e.get("inner-txns")<"u"?e.get("inner-txns").map(t=>El.fromEncodingData(t)):void 0,intraRoundOffset:e.get("intra-round-offset"),keyregTransaction:typeof e.get("keyreg-transaction")<"u"?tv.fromEncodingData(e.get("keyreg-transaction")):void 0,lease:e.get("lease"),localStateDelta:typeof e.get("local-state-delta")<"u"?e.get("local-state-delta").map(t=>A0.fromEncodingData(t)):void 0,logs:e.get("logs"),note:e.get("note"),paymentTransaction:typeof e.get("payment-transaction")<"u"?rv.fromEncodingData(e.get("payment-transaction")):void 0,receiverRewards:e.get("receiver-rewards"),rekeyTo:e.get("rekey-to"),roundTime:e.get("round-time"),senderRewards:e.get("sender-rewards"),signature:typeof e.get("signature")<"u"?sv.fromEncodingData(e.get("signature")):void 0,stateProofTransaction:typeof e.get("state-proof-transaction")<"u"?fv.fromEncodingData(e.get("state-proof-transaction")):void 0,txType:e.get("tx-type")})}},HS=class GS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"application-id",valueSchema:new J,omitEmpty:!0},{key:"access",valueSchema:new $(new qe(AS.encodingSchema)),omitEmpty:!0},{key:"accounts",valueSchema:new $(new qe(new Ne)),omitEmpty:!0},{key:"application-args",valueSchema:new $(new qe(new We)),omitEmpty:!0},{key:"approval-program",valueSchema:new $(new We),omitEmpty:!0},{key:"box-references",valueSchema:new $(new qe(th.encodingSchema)),omitEmpty:!0},{key:"clear-state-program",valueSchema:new $(new We),omitEmpty:!0},{key:"extra-program-pages",valueSchema:new $(new J),omitEmpty:!0},{key:"foreign-apps",valueSchema:new $(new qe(new J)),omitEmpty:!0},{key:"foreign-assets",valueSchema:new $(new qe(new J)),omitEmpty:!0},{key:"global-state-schema",valueSchema:new $(xl.encodingSchema),omitEmpty:!0},{key:"local-state-schema",valueSchema:new $(xl.encodingSchema),omitEmpty:!0},{key:"on-completion",valueSchema:new $(new Ne),omitEmpty:!0},{key:"reject-version",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({applicationId:e,access:t,accounts:r,applicationArgs:i,approvalProgram:o,boxReferences:s,clearStateProgram:a,extraProgramPages:l,foreignApps:c,foreignAssets:d,globalStateSchema:f,localStateSchema:m,onCompletion:w,rejectVersion:k}){this.applicationId=Ce(e),this.access=t,this.accounts=typeof r<"u"?r.map(I=>typeof I=="string"?Ot.fromString(I):I):void 0,this.applicationArgs=i,this.approvalProgram=typeof o=="string"?ut(o):o,this.boxReferences=s,this.clearStateProgram=typeof a=="string"?ut(a):a,this.extraProgramPages=typeof l>"u"?void 0:Ye(l),this.foreignApps=typeof c>"u"?void 0:c.map(Ce),this.foreignAssets=typeof d>"u"?void 0:d.map(Ce),this.globalStateSchema=f,this.localStateSchema=m,this.onCompletion=w,this.rejectVersion=typeof k>"u"?void 0:Ye(k)}getEncodingSchema(){return GS.encodingSchema}toEncodingData(){return new Map([["application-id",this.applicationId],["access",typeof this.access<"u"?this.access.map(e=>e.toEncodingData()):void 0],["accounts",typeof this.accounts<"u"?this.accounts.map(e=>e.toString()):void 0],["application-args",this.applicationArgs],["approval-program",this.approvalProgram],["box-references",typeof this.boxReferences<"u"?this.boxReferences.map(e=>e.toEncodingData()):void 0],["clear-state-program",this.clearStateProgram],["extra-program-pages",this.extraProgramPages],["foreign-apps",this.foreignApps],["foreign-assets",this.foreignAssets],["global-state-schema",typeof this.globalStateSchema<"u"?this.globalStateSchema.toEncodingData():void 0],["local-state-schema",typeof this.localStateSchema<"u"?this.localStateSchema.toEncodingData():void 0],["on-completion",this.onCompletion],["reject-version",this.rejectVersion]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionApplication: ${e}`);return new GS({applicationId:e.get("application-id"),access:typeof e.get("access")<"u"?e.get("access").map(t=>AS.fromEncodingData(t)):void 0,accounts:e.get("accounts"),applicationArgs:e.get("application-args"),approvalProgram:e.get("approval-program"),boxReferences:typeof e.get("box-references")<"u"?e.get("box-references").map(t=>th.fromEncodingData(t)):void 0,clearStateProgram:e.get("clear-state-program"),extraProgramPages:e.get("extra-program-pages"),foreignApps:e.get("foreign-apps"),foreignAssets:e.get("foreign-assets"),globalStateSchema:typeof e.get("global-state-schema")<"u"?xl.fromEncodingData(e.get("global-state-schema")):void 0,localStateSchema:typeof e.get("local-state-schema")<"u"?xl.fromEncodingData(e.get("local-state-schema")):void 0,onCompletion:e.get("on-completion"),rejectVersion:e.get("reject-version")})}},KS=class WS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"asset-id",valueSchema:new $(new J),omitEmpty:!0},{key:"params",valueSchema:new $(eh.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({assetId:e,params:t}){this.assetId=typeof e>"u"?void 0:Ce(e),this.params=t}getEncodingSchema(){return WS.encodingSchema}toEncodingData(){return new Map([["asset-id",this.assetId],["params",typeof this.params<"u"?this.params.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionAssetConfig: ${e}`);return new WS({assetId:e.get("asset-id"),params:typeof e.get("params")<"u"?eh.fromEncodingData(e.get("params")):void 0})}},JS=class YS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Ne,omitEmpty:!0},{key:"asset-id",valueSchema:new J,omitEmpty:!0},{key:"new-freeze-status",valueSchema:new jt,omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,assetId:t,newFreezeStatus:r}){this.address=e,this.assetId=Ce(t),this.newFreezeStatus=r}getEncodingSchema(){return YS.encodingSchema}toEncodingData(){return new Map([["address",this.address],["asset-id",this.assetId],["new-freeze-status",this.newFreezeStatus]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionAssetFreeze: ${e}`);return new YS({address:e.get("address"),assetId:e.get("asset-id"),newFreezeStatus:e.get("new-freeze-status")})}},XS=class QS{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"amount",valueSchema:new J,omitEmpty:!0},{key:"asset-id",valueSchema:new J,omitEmpty:!0},{key:"receiver",valueSchema:new Ne,omitEmpty:!0},{key:"close-amount",valueSchema:new $(new J),omitEmpty:!0},{key:"close-to",valueSchema:new $(new Ne),omitEmpty:!0},{key:"sender",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({amount:e,assetId:t,receiver:r,closeAmount:i,closeTo:o,sender:s}){this.amount=Ce(e),this.assetId=Ce(t),this.receiver=r,this.closeAmount=typeof i>"u"?void 0:Ce(i),this.closeTo=o,this.sender=s}getEncodingSchema(){return QS.encodingSchema}toEncodingData(){return new Map([["amount",this.amount],["asset-id",this.assetId],["receiver",this.receiver],["close-amount",this.closeAmount],["close-to",this.closeTo],["sender",this.sender]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionAssetTransfer: ${e}`);return new QS({amount:e.get("amount"),assetId:e.get("asset-id"),receiver:e.get("receiver"),closeAmount:e.get("close-amount"),closeTo:e.get("close-to"),sender:e.get("sender")})}},ZS=class ev{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"hb-address",valueSchema:new Ne,omitEmpty:!0},{key:"hb-key-dilution",valueSchema:new J,omitEmpty:!0},{key:"hb-proof",valueSchema:hS.encodingSchema,omitEmpty:!0},{key:"hb-seed",valueSchema:new We,omitEmpty:!0},{key:"hb-vote-id",valueSchema:new We,omitEmpty:!0})),this.encodingSchemaValue}constructor({hbAddress:e,hbKeyDilution:t,hbProof:r,hbSeed:i,hbVoteId:o}){this.hbAddress=e,this.hbKeyDilution=Ce(t),this.hbProof=r,this.hbSeed=typeof i=="string"?ut(i):i,this.hbVoteId=typeof o=="string"?ut(o):o}getEncodingSchema(){return ev.encodingSchema}toEncodingData(){return new Map([["hb-address",this.hbAddress],["hb-key-dilution",this.hbKeyDilution],["hb-proof",this.hbProof.toEncodingData()],["hb-seed",this.hbSeed],["hb-vote-id",this.hbVoteId]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionHeartbeat: ${e}`);return new ev({hbAddress:e.get("hb-address"),hbKeyDilution:e.get("hb-key-dilution"),hbProof:hS.fromEncodingData(e.get("hb-proof")??new Map),hbSeed:e.get("hb-seed"),hbVoteId:e.get("hb-vote-id")})}},tv=class nv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"non-participation",valueSchema:new $(new jt),omitEmpty:!0},{key:"selection-participation-key",valueSchema:new $(new We),omitEmpty:!0},{key:"state-proof-key",valueSchema:new $(new We),omitEmpty:!0},{key:"vote-first-valid",valueSchema:new $(new J),omitEmpty:!0},{key:"vote-key-dilution",valueSchema:new $(new J),omitEmpty:!0},{key:"vote-last-valid",valueSchema:new $(new J),omitEmpty:!0},{key:"vote-participation-key",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({nonParticipation:e,selectionParticipationKey:t,stateProofKey:r,voteFirstValid:i,voteKeyDilution:o,voteLastValid:s,voteParticipationKey:a}){this.nonParticipation=e,this.selectionParticipationKey=typeof t=="string"?ut(t):t,this.stateProofKey=typeof r=="string"?ut(r):r,this.voteFirstValid=typeof i>"u"?void 0:Ce(i),this.voteKeyDilution=typeof o>"u"?void 0:Ce(o),this.voteLastValid=typeof s>"u"?void 0:Ce(s),this.voteParticipationKey=typeof a=="string"?ut(a):a}getEncodingSchema(){return nv.encodingSchema}toEncodingData(){return new Map([["non-participation",this.nonParticipation],["selection-participation-key",this.selectionParticipationKey],["state-proof-key",this.stateProofKey],["vote-first-valid",this.voteFirstValid],["vote-key-dilution",this.voteKeyDilution],["vote-last-valid",this.voteLastValid],["vote-participation-key",this.voteParticipationKey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionKeyreg: ${e}`);return new nv({nonParticipation:e.get("non-participation"),selectionParticipationKey:e.get("selection-participation-key"),stateProofKey:e.get("state-proof-key"),voteFirstValid:e.get("vote-first-valid"),voteKeyDilution:e.get("vote-key-dilution"),voteLastValid:e.get("vote-last-valid"),voteParticipationKey:e.get("vote-participation-key")})}},rv=class iv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"amount",valueSchema:new J,omitEmpty:!0},{key:"receiver",valueSchema:new Ne,omitEmpty:!0},{key:"close-amount",valueSchema:new $(new J),omitEmpty:!0},{key:"close-remainder-to",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({amount:e,receiver:t,closeAmount:r,closeRemainderTo:i}){this.amount=Ce(e),this.receiver=t,this.closeAmount=typeof r>"u"?void 0:Ce(r),this.closeRemainderTo=i}getEncodingSchema(){return iv.encodingSchema}toEncodingData(){return new Map([["amount",this.amount],["receiver",this.receiver],["close-amount",this.closeAmount],["close-remainder-to",this.closeRemainderTo]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionPayment: ${e}`);return new iv({amount:e.get("amount"),receiver:e.get("receiver"),closeAmount:e.get("close-amount"),closeRemainderTo:e.get("close-remainder-to")})}},_D=class ov{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"transaction",valueSchema:ia.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({currentRound:e,transaction:t}){this.currentRound=Ce(e),this.transaction=t}getEncodingSchema(){return ov.encodingSchema}toEncodingData(){return new Map([["current-round",this.currentRound],["transaction",this.transaction.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionResponse: ${e}`);return new ov({currentRound:e.get("current-round"),transaction:ia.fromEncodingData(e.get("transaction")??new Map)})}},sv=class av{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"logicsig",valueSchema:new $(cv.encodingSchema),omitEmpty:!0},{key:"multisig",valueSchema:new $(Fs.encodingSchema),omitEmpty:!0},{key:"sig",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({logicsig:e,multisig:t,sig:r}){this.logicsig=e,this.multisig=t,this.sig=typeof r=="string"?ut(r):r}getEncodingSchema(){return av.encodingSchema}toEncodingData(){return new Map([["logicsig",typeof this.logicsig<"u"?this.logicsig.toEncodingData():void 0],["multisig",typeof this.multisig<"u"?this.multisig.toEncodingData():void 0],["sig",this.sig]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionSignature: ${e}`);return new av({logicsig:typeof e.get("logicsig")<"u"?cv.fromEncodingData(e.get("logicsig")):void 0,multisig:typeof e.get("multisig")<"u"?Fs.fromEncodingData(e.get("multisig")):void 0,sig:e.get("sig")})}},cv=class uv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"logic",valueSchema:new We,omitEmpty:!0},{key:"args",valueSchema:new $(new qe(new We)),omitEmpty:!0},{key:"logic-multisig-signature",valueSchema:new $(Fs.encodingSchema),omitEmpty:!0},{key:"multisig-signature",valueSchema:new $(Fs.encodingSchema),omitEmpty:!0},{key:"signature",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({logic:e,args:t,logicMultisigSignature:r,multisigSignature:i,signature:o}){this.logic=typeof e=="string"?ut(e):e,this.args=t,this.logicMultisigSignature=r,this.multisigSignature=i,this.signature=typeof o=="string"?ut(o):o}getEncodingSchema(){return uv.encodingSchema}toEncodingData(){return new Map([["logic",this.logic],["args",this.args],["logic-multisig-signature",typeof this.logicMultisigSignature<"u"?this.logicMultisigSignature.toEncodingData():void 0],["multisig-signature",typeof this.multisigSignature<"u"?this.multisigSignature.toEncodingData():void 0],["signature",this.signature]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionSignatureLogicsig: ${e}`);return new uv({logic:e.get("logic"),args:e.get("args"),logicMultisigSignature:typeof e.get("logic-multisig-signature")<"u"?Fs.fromEncodingData(e.get("logic-multisig-signature")):void 0,multisigSignature:typeof e.get("multisig-signature")<"u"?Fs.fromEncodingData(e.get("multisig-signature")):void 0,signature:e.get("signature")})}},Fs=class lv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"subsignature",valueSchema:new $(new qe(hv.encodingSchema)),omitEmpty:!0},{key:"threshold",valueSchema:new $(new J),omitEmpty:!0},{key:"version",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({subsignature:e,threshold:t,version:r}){this.subsignature=e,this.threshold=typeof t>"u"?void 0:Ye(t),this.version=typeof r>"u"?void 0:Ye(r)}getEncodingSchema(){return lv.encodingSchema}toEncodingData(){return new Map([["subsignature",typeof this.subsignature<"u"?this.subsignature.map(e=>e.toEncodingData()):void 0],["threshold",this.threshold],["version",this.version]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionSignatureMultisig: ${e}`);return new lv({subsignature:typeof e.get("subsignature")<"u"?e.get("subsignature").map(t=>hv.fromEncodingData(t)):void 0,threshold:e.get("threshold"),version:e.get("version")})}},hv=class dv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"public-key",valueSchema:new $(new We),omitEmpty:!0},{key:"signature",valueSchema:new $(new We),omitEmpty:!0})),this.encodingSchemaValue}constructor({publicKey:e,signature:t}){this.publicKey=typeof e=="string"?ut(e):e,this.signature=typeof t=="string"?ut(t):t}getEncodingSchema(){return dv.encodingSchema}toEncodingData(){return new Map([["public-key",this.publicKey],["signature",this.signature]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionSignatureMultisigSubsignature: ${e}`);return new dv({publicKey:e.get("public-key"),signature:e.get("signature")})}},fv=class gv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"message",valueSchema:new $(mS.encodingSchema),omitEmpty:!0},{key:"state-proof",valueSchema:new $(FS.encodingSchema),omitEmpty:!0},{key:"state-proof-type",valueSchema:new $(new J),omitEmpty:!0})),this.encodingSchemaValue}constructor({message:e,stateProof:t,stateProofType:r}){this.message=e,this.stateProof=t,this.stateProofType=typeof r>"u"?void 0:Ye(r)}getEncodingSchema(){return gv.encodingSchema}toEncodingData(){return new Map([["message",typeof this.message<"u"?this.message.toEncodingData():void 0],["state-proof",typeof this.stateProof<"u"?this.stateProof.toEncodingData():void 0],["state-proof-type",this.stateProofType]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionStateProof: ${e}`);return new gv({message:typeof e.get("message")<"u"?mS.fromEncodingData(e.get("message")):void 0,stateProof:typeof e.get("state-proof")<"u"?FS.fromEncodingData(e.get("state-proof")):void 0,stateProofType:e.get("state-proof-type")})}},Eg=class pv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new xe([]),this.encodingSchemaValue.pushEntries({key:"current-round",valueSchema:new J,omitEmpty:!0},{key:"transactions",valueSchema:new qe(ia.encodingSchema),omitEmpty:!0},{key:"next-token",valueSchema:new $(new Ne),omitEmpty:!0})),this.encodingSchemaValue}constructor({currentRound:e,transactions:t,nextToken:r}){this.currentRound=Ce(e),this.transactions=t,this.nextToken=r}getEncodingSchema(){return pv.encodingSchema}toEncodingData(){return new Map([["current-round",this.currentRound],["transactions",this.transactions.map(e=>e.toEncodingData())],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionsResponse: ${e}`);return new pv({currentRound:e.get("current-round"),transactions:(e.get("transactions")??[]).map(t=>ia.fromEncodingData(t)),nextToken:e.get("next-token")})}};const s4=Object.freeze(Object.defineProperty({__proto__:null,Account:Xl,AccountParticipation:E0,AccountResponse:MD,AccountStateDelta:A0,AccountsResponse:RD,Application:na,ApplicationLocalState:Ql,ApplicationLocalStatesResponse:CD,ApplicationLogData:R0,ApplicationLogsResponse:PD,ApplicationParams:$0,ApplicationResponse:$D,ApplicationStateSchema:Gi,ApplicationsResponse:Yx,Asset:ra,AssetBalancesResponse:BD,AssetHolding:Zl,AssetHoldingsResponse:VD,AssetParams:eh,AssetResponse:OD,AssetsResponse:Xx,Block:sf,BlockHeadersResponse:ND,BlockRewards:W0,BlockUpgradeState:Y0,BlockUpgradeVote:Q0,Box:LD,BoxDescriptor:tS,BoxReference:th,BoxesResponse:UD,ErrorResponse:o4,EvalDelta:sS,EvalDeltaKeyValue:nh,HashFactory:uS,HbProofFields:hS,HealthCheck:jD,HoldingRef:gS,IndexerStateProofMessage:mS,LocalsRef:wS,MerkleArrayProof:Ds,MiniAssetHolding:xS,ParticipationUpdates:bS,ResourceRef:AS,StateProofFields:FS,StateProofParticipant:IS,StateProofReveal:RS,StateProofSigSlot:PS,StateProofSignature:BS,StateProofTracking:OS,StateProofVerifier:LS,StateSchema:xl,TealKeyValue:rh,TealValue:zS,Transaction:ia,TransactionApplication:HS,TransactionAssetConfig:KS,TransactionAssetFreeze:JS,TransactionAssetTransfer:XS,TransactionHeartbeat:ZS,TransactionKeyreg:tv,TransactionPayment:rv,TransactionResponse:_D,TransactionSignature:sv,TransactionSignatureLogicsig:cv,TransactionSignatureMultisig:Fs,TransactionSignatureMultisigSubsignature:hv,TransactionStateProof:fv,TransactionsResponse:Eg},Symbol.toStringTag,{value:"Module"}));let a4=class extends Bt{path(){return"/health"}prepare(e){return Wt(e.getJSONText(),jD)}},c4=class extends Bt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/assets/${this.index}/balances`}limit(e){return this.query.limit=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}prepare(e){return Wt(e.getJSONText(),BD)}};function af(n){return typeof n=="string"?n:Qn(n)}let u4=class extends Bt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}/transactions`}notePrefix(e){return this.query["note-prefix"]=af(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}assetID(e){return this.query["asset-id"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e instanceof Date?e.toISOString():e,this}afterTime(e){return this.query["after-time"]=e instanceof Date?e.toISOString():e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}prepare(e){return Wt(e.getJSONText(),Eg)}},l4=class extends Bt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/assets/${this.index}/transactions`}notePrefix(e){return this.query["note-prefix"]=af(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e instanceof Date?e.toISOString():e,this}afterTime(e){return this.query["after-time"]=e instanceof Date?e.toISOString():e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}addressRole(e){return this.query["address-role"]=e,this}address(e){return this.query.address=e.toString(),this}excludeCloseTo(e){return this.query["exclude-close-to"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}prepare(e){return Wt(e.getJSONText(),Eg)}},h4=class extends Bt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/blocks/${this.round}`}headerOnly(e){return this.query["header-only"]=e,this}prepare(e){return Wt(e.getJSONText(),sf)}},d4=class extends Bt{constructor(e,t){super(e),this.txID=t}path(){return`/v2/transactions/${this.txID}`}prepare(e){return Wt(e.getJSONText(),_D)}},f4=class extends Bt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}`}round(e){return this.query.round=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}exclude(e){return this.query.exclude=e,this}prepare(e){return Wt(e.getJSONText(),MD)}},g4=class extends Bt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}/assets`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}assetId(e){return this.query["asset-id"]=e,this}prepare(e){return Wt(e.getJSONText(),VD)}},p4=class extends Bt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}/created-assets`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}assetID(e){return this.query["asset-id"]=e,this}prepare(e){return Wt(e.getJSONText(),Xx)}},m4=class extends Bt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}/apps-local-state`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}applicationID(e){return this.query["application-id"]=e,this}prepare(e){return Wt(e.getJSONText(),CD)}},y4=class extends Bt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}/created-applications`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}applicationID(e){return this.query["application-id"]=e,this}prepare(e){return Wt(e.getJSONText(),Yx)}},w4=class extends Bt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/assets/${this.index}`}includeAll(e=!0){return this.query["include-all"]=e,this}prepare(e){return Wt(e.getJSONText(),OD)}},S4=class extends Bt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/applications/${this.index}`}includeAll(e=!0){return this.query["include-all"]=e,this}prepare(e){return Wt(e.getJSONText(),$D)}},v4=class extends Bt{constructor(e,t){super(e),this.appID=BigInt(t)}path(){return`/v2/applications/${this.appID}/logs`}limit(e){return this.query.limit=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}nextToken(e){return this.query.next=e,this}sender(e){return this.query["sender-address"]=e,this}txid(e){return this.query.txid=e,this}prepare(e){return Wt(e.getJSONText(),PD)}},x4=class extends Bt{constructor(e,t,r){super(e),this.index=BigInt(t);const i=Qn(r);this.query.name=encodeURI(`b64:${i}`)}path(){return`/v2/applications/${this.index}/box`}prepare(e){return Wt(e.getJSONText(),LD)}},E4=class extends Bt{path(){return"/v2/accounts"}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}limit(e){return this.query.limit=e,this}assetID(e){return this.query["asset-id"]=e,this}nextToken(e){return this.query.next=e,this}round(e){return this.query.round=e,this}authAddr(e){return this.query["auth-addr"]=e.toString(),this}applicationID(e){return this.query["application-id"]=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}exclude(e){return this.query.exclude=e,this}onlineOnly(e){return this.query["online-only"]=e,this}prepare(e){return Wt(e.getJSONText(),RD)}},b4=class extends Bt{path(){return"/v2/block-headers"}absent(e){return this.query.absent=e,this}afterTime(e){return this.query["after-time"]=e instanceof Date?e.toISOString():e,this}beforeTime(e){return this.query["before-time"]=e instanceof Date?e.toISOString():e,this}expired(e){return this.query.expired=e,this}limit(e){return this.query.limit=e,this}maxRound(e){return this.query["max-round"]=e,this}minRound(e){return this.query["min-round"]=e,this}nextToken(e){return this.query.next=e,this}proposers(e){return this.query.proposers=e,this}prepare(e){return Wt(e.getJSONText(),ND)}},k4=class extends Bt{path(){return"/v2/transactions"}notePrefix(e){return this.query["note-prefix"]=af(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}groupid(e){return this.query["group-id"]=af(e),this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}assetID(e){return this.query["asset-id"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e instanceof Date?e.toISOString():e,this}afterTime(e){return this.query["after-time"]=e instanceof Date?e.toISOString():e,this}addressRole(e){return this.query["address-role"]=e,this}address(e){return this.query.address=e.toString(),this}excludeCloseTo(e){return this.query["exclude-close-to"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}applicationID(e){return this.query["application-id"]=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}prepare(e){return Wt(e.getJSONText(),Eg)}},A4=class extends Bt{path(){return"/v2/assets"}limit(e){return this.query.limit=e,this}creator(e){return this.query.creator=e.toString(),this}name(e){return this.query.name=e,this}unit(e){return this.query.unit=e,this}index(e){return this.query["asset-id"]=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}prepare(e){return Wt(e.getJSONText(),Xx)}},D4=class extends Bt{path(){return"/v2/applications"}index(e){return this.query["application-id"]=e,this}creator(e){return this.query.creator=e.toString(),this}nextToken(e){return this.query.next=e,this}limit(e){return this.query.limit=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}prepare(e){return Wt(e.getJSONText(),Yx)}},F4=class extends Bt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/applications/${this.index}/boxes`}nextToken(e){return this.query.next=e,this}limit(e){return this.query.limit=e,this}prepare(e){return Wt(e.getJSONText(),UD)}},T4=class extends _x{constructor(e,t="http://127.0.0.1",r=8080,i={}){super("X-Indexer-API-Token",e,t,r,i)}makeHealthCheck(){return new a4(this.c)}lookupAssetBalances(e){return new c4(this.c,e)}lookupAssetTransactions(e){return new l4(this.c,e)}lookupAccountTransactions(e){return new u4(this.c,e)}lookupBlock(e){return new h4(this.c,e)}lookupTransactionByID(e){return new d4(this.c,e)}lookupAccountByID(e){return new f4(this.c,e)}lookupAccountAssets(e){return new g4(this.c,e)}lookupAccountCreatedAssets(e){return new p4(this.c,e)}lookupAccountAppLocalStates(e){return new m4(this.c,e)}lookupAccountCreatedApplications(e){return new y4(this.c,e)}lookupAssetByID(e){return new w4(this.c,e)}lookupApplications(e){return new S4(this.c,e)}lookupApplicationLogs(e){return new v4(this.c,e)}searchAccounts(){return new E4(this.c)}searchForBlockHeaders(){return new b4(this.c)}searchForTransactions(){return new k4(this.c)}searchForAssets(){return new A4(this.c)}searchForApplications(){return new D4(this.c)}searchForApplicationBoxes(e){return new F4(this.c,e)}lookupApplicationBoxByIDandName(e,t){return new x4(this.c,e,t)}};async function zD(n,e,t){const r=await n.status().do();if(typeof r>"u")throw new Error("Unable to get node status");const i=r.lastRound+BigInt(1),o=i+BigInt(t);let s=i;for(;s<o;){let a=!1;try{const l=await n.pendingTransactionInformation(e).do();if(l.confirmedRound)return l;if(l.poolError)throw a=!0,new Error(`Transaction Rejected: ${l.poolError}`)}catch(l){if(a)throw l}await n.statusAfterBlock(s).do(),s+=BigInt(1)}throw new Error(`Transaction not confirmed after ${t} rounds`)}function oa(n,e){let t=n.toString(16);t.length!==e*2&&(t=t.padStart(e*2,"0"));const r=new Uint8Array(t.length/2);for(let i=0,o=0;i<t.length/2;i++,o+=2)r[i]=parseInt(t.slice(o,o+2),16);return r}function Qx(n){let e=BigInt(0);const t=new DataView(n.buffer,n.byteOffset);for(let r=0;r<n.length;r++)e=BigInt(Number(t.getUint8(r)))+e*BigInt(256);return e}function I4(){const n=DM();return{addr:new Ot(n.publicKey),sk:n.secretKey}}const mv=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"],Ep="failed to decode mnemonic",M4="the mnemonic contains a word that is not in the wordlist";function qD(n){const e=[];let t=0,r=0;function i(s){t|=s<<r,r+=8,r>=11&&(e.push(t&2047),t>>=11,r-=11)}function o(){r&&e.push(t)}return n.forEach(i),o(),e}function HD(n){return n.map(e=>mv[e])}function GD(n){const e=Zi(n),t=qD(e);return HD(t)[0]}function Zx(n){if(n.length!==Mm)throw new RangeError(`Seed length must be ${Mm}`);const e=qD(n),t=HD(e),r=GD(n);return`${t.join(" ")} ${r}`}function R4(n){const e=[];let t=0,r=0;function i(s){for(t|=s<<r,r+=11;r>=8;)e.push(t&255),t>>=8,r-=8}function o(){r&&e.push(t)}return n.forEach(i),o(),new Uint8Array(e)}function eE(n){const e=n.split(" "),t=e.slice(0,24);for(const a of t)if(mv.indexOf(a)===-1)throw new Error(M4);const r=e[e.length-1],i=t.map(a=>mv.indexOf(a));let o=R4(i);if(o.length!==33)throw new Error(Ep);if(o[o.length-1]!==0)throw new Error(Ep);if(o=o.slice(0,o.length-1),GD(o)===r)return o;throw new Error(Ep)}function C4(n){const e=eE(n),t=CA(e);return{addr:new Ot(t.publicKey),sk:t.secretKey}}function P4(n){const e=n.slice(0,Mm);return Zx(e)}function $4(n){return eE(n)}function B4(n){return Zx(n)}const K1=16,V4=new TextEncoder().encode("TG");function O4(n){if(n.length>K1)throw new Error(`${n.length} transactions grouped together but max group size is ${K1}`);if(n.length===0)throw new Error("Cannot compute group ID of zero transactions");const e=td({txlist:n});return Un(V4,e)}function KD(n){const e=[];for(const i of n)e.push(i.rawTxID());const t=O4(e),r=Zi(t);return Uint8Array.from(r)}function WD(n){const e=KD(n);for(const t of n)t.group=e;return n}function N4(n,e,t){if(!e.verify(t.publicKey))throw new Error("Logic signature verification failed. Ensure the program and signature are valid.");let r;$A(t.publicKey,n.sender.publicKey)||(r=t);const i=new kn({lsig:e,txn:n,sgnr:r});return{txID:n.txID(),blob:Wr(i)}}function tE(n,e){let t,r;if(e instanceof Gx)t=e.lsig,r=e.address();else if(t=e,t.sig)r=new Ot(n.sender.publicKey);else if(t.lmsig){const i={version:t.lmsig.v,threshold:t.lmsig.thr,pks:t.lmsig.subsig.map(o=>o.pk)};r=eo(i)}else r=t.address();return N4(n,t,r)}function L4(n,e){return tE(n,e)}const U4="Not enough multisig transactions to merge. Need at least two",j4="Cannot merge txs. txIDs differ",_4="Cannot merge txs. Auth addrs differ",W1="Cannot merge txs. Multisig preimages differ",z4="Cannot merge txs. subsigs are mismatched.",q4="Cannot add multisig signature. Signature is not of the correct length.",H4="Key does not exist";function JD(n,{version:e,threshold:t,addrs:r}){const i=_u(r),o=i.map(d=>({pk:d})),s={v:e,thr:t,subsig:o},a=eo({version:e,threshold:t,pks:i});let l;n.sender.equals(a)||(l=a);const c=new kn({txn:n,msig:s,sgnr:l});return Wr(c)}function YD(n,{rawSig:e,myPk:t},{version:r,threshold:i,pks:o}){const s=JD(n,{version:r,threshold:i,addrs:o.map(c=>new Ot(c))}),a=Fn(s,kn);let l=!1;if(a.msig.subsig.forEach((c,d)=>{$A(c.pk,t)&&(l=!0,a.msig.subsig[d].s=e)}),!l)throw new Error(H4);return Wr(a)}function XD(n,{version:e,threshold:t,pks:r},i){const o=Vf(i).publicKey;return YD(n,{rawSig:n.rawSignTxn(i),myPk:o},{version:e,threshold:t,pks:r})}function G4(n,e,t,r){if(!PA(r.length))throw new Error(q4);const i=typeof t=="string"?Ot.fromString(t):t;return YD(n,{rawSig:r,myPk:i.publicKey},e)}function bg(n){if(n.length<2)throw new Error(U4);const e=Fn(n[0],kn);if(!e.msig)throw new Error("Invalid multisig transaction, multisig structure missing at index 0");const t=e.txn.txID(),r=e.sgnr?e.sgnr.toString():void 0,i={version:e.msig.v,threshold:e.msig.thr,pks:e.msig.subsig.map(d=>d.pk)},o=eo(i),s=e.msig.subsig.map(d=>({...d}));for(let d=1;d<n.length;d++){const f=Fn(n[d],kn);if(!f.msig)throw new Error(`Invalid multisig transaction, multisig structure missing at index ${d}`);if(f.txn.txID()!==t)throw new Error(j4);const m=f.sgnr?f.sgnr.toString():void 0;if(r!==m)throw new Error(_4);if(f.msig.subsig.length!==e.msig.subsig.length)throw new Error(W1);const w={version:f.msig.v,threshold:f.msig.thr,pks:f.msig.subsig.map(I=>I.pk)},k=eo(w);if(!o.equals(k))throw new Error(W1);f.msig.subsig.forEach((I,x)=>{if(!I.s)return;const T=s[x];if(T.s&&!Fi(I.s,T.s))throw new Error(z4);T.s=I.s})}const a={v:e.msig.v,thr:e.msig.thr,subsig:s},l=typeof r<"u"?e.sgnr:void 0,c=new kn({msig:a,txn:e.txn,sgnr:l});return Wr(c)}function QD(n,{version:e,threshold:t,addrs:r},i){const o=_u(r),s=XD(n,{version:e,threshold:t,pks:o},i);return{txID:n.txID(),blob:s}}function K4(n,{version:e,threshold:t,addrs:r},i){const o=_u(r),s=Fn(n,kn),a=XD(s.txn,{version:e,threshold:t,pks:o},i);return{txID:s.txn.txID(),blob:bg([n,a])}}function W4(n,{version:e,threshold:t,addrs:r},i,o){const s=_u(r),a=Fn(n,kn),l=G4(a.txn,{version:e,threshold:t,pks:s},i,o);return{txID:a.txn.txID(),blob:bg([n,l])}}let ZD={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split("").forEach(function(n,e){ZD[n]=e});function J4(n){let e=[],t=0,r=0;for(let i=0;i<n.length;i+=1){let o=ZD[n[i]];if(o===void 0)throw new Error("Invalid character ("+n[i]+")");const s=o&32;if(o&=31,r+=o<<t,s)t+=5;else{const a=r&1;r>>>=1,a?e.push(r===0?-2147483648:-r):e.push(r),r=t=0}}return e}let Y4=class{constructor({version:e,sources:t,names:r,mappings:i}){if(this.version=e,this.sources=t,this.names=r,this.mappings=i,this.version!==3)throw new Error(`Only version 3 is supported, got ${this.version}`);if(this.mappings===void 0)throw new Error("mapping undefined, cannot build source map without `mapping`");const o=this.mappings.split(";").map(J4);this.pcToLocation=new Map,this.sourceAndLineToPc=new Map;const s={line:0,column:0,sourceIndex:0,nameIndex:0};for(const[a,l]of o.entries()){if(l.length<4)continue;const c=l.length>4?l[4]:void 0,[,d,f,m]=l;s.sourceIndex+=d,s.line+=f,s.column+=m,typeof c<"u"&&(s.nameIndex+=c);const w=`${s.sourceIndex}:${s.line}`;let k=this.sourceAndLineToPc.get(w);k===void 0&&(k=[],this.sourceAndLineToPc.set(w,k));const I={pc:a,column:s.column},x={line:s.line,column:s.column,sourceIndex:s.sourceIndex};typeof c<"u"&&(I.nameIndex=s.nameIndex,x.nameIndex=s.nameIndex),k.push(I),this.pcToLocation.set(a,x)}}getPcs(){return Array.from(this.pcToLocation.keys())}getLocationForPc(e){return this.pcToLocation.get(e)}getPcsOnSourceLine(e,t){const r=this.sourceAndLineToPc.get(`${e}:${t}`);return r===void 0?[]:r}};const X4=1380011588,nE=30;async function Q4({client:n,txns:e,protocolVersion:t,latestTimestamp:r,round:i,sources:o}){const s=[],a=[],l=[],c=[],d=[];for(const k of e)if(k.txn.type===un.appl)if(d.push(k.txn.sender.toString()),d.push(...k.txn.applicationCall.accounts.map(I=>I.toString())),l.push(...k.txn.applicationCall.foreignApps),d.push(...k.txn.applicationCall.foreignApps.map(Xd).map(I=>I.toString())),c.push(...k.txn.applicationCall.foreignAssets),k.txn.applicationCall.appIndex===BigInt(0))s.push(new Qs({id:X4,params:new Mc({creator:k.txn.sender.toString(),approvalProgram:k.txn.applicationCall.approvalProgram,clearStateProgram:k.txn.applicationCall.clearProgram,localStateSchema:new ii({numUint:k.txn.applicationCall.numLocalInts,numByteSlice:k.txn.applicationCall.numLocalByteSlices}),globalStateSchema:new ii({numUint:k.txn.applicationCall.numGlobalInts,numByteSlice:k.txn.applicationCall.numGlobalByteSlices})})}));else{const{appIndex:I}=k.txn.applicationCall;l.push(I),d.push(Xd(I).toString())}const f=[];for(const k of new Set(c))f.push(n.getAssetByID(k).do().then(I=>{d.push(I.params.creator)}));await Promise.all(f);const m=[];for(const k of new Set(l))m.push(n.getApplicationByID(k).do().then(I=>{s.push(I),d.push(I.params.creator.toString())}));await Promise.all(m);const w=[];for(const k of new Set(d))w.push(n.accountInformation(k).do().then(I=>{a.push(I)}));return await Promise.all(w),new mD({txns:e.slice(),accounts:a,apps:s,latestTimestamp:r??0,round:i??0,protocolVersion:t??"",sources:o??[]})}function bp(n,e){return n.length>e&&e>0?`${n.slice(0,e)}...`:n}function Z4(n,e){if(e.length===0)return"";let t=null;for(let i=0;i<e.length;i++){if(i>n.length){t=i;continue}Xs(n[i])!==Xs(e[i])&&(t=i)}if(t==null)return"";const r=e[t];return r.bytes.length>0?`${t} = 0x${Lf(r.bytes)}`:`${t} = ${r.uint.toString()}`}function eP(n,e){return`[${(e?n.reverse():n).map(r=>{switch(r.type){case 1:return`0x${Lf(r.bytes)}`;case 2:return r.uint.toString();default:return""}}).join(", ")}]`}function e2(n,e,t){const r=t.maxValueWidth||nE,i=[["pc#","ln#","source","scratch","stack"]];for(let s=0;s<n.length;s++){const{line:a,error:l,pc:c,scratch:d,stack:f}=n[s],m=d!==void 0?d:[],w=s>0&&n[s-1].scratch!==void 0?n[s-1].scratch:[],k=l?`!! ${l} !!`:e[a];i.push([c.toString().padEnd(3," "),a.toString().padEnd(3," "),bp(k,r),bp(Z4(w,m),r),bp(eP(f,t.topOfStackFirst),r)])}const o=i.reduce((s,a)=>{const l=new Array(i[0].length).fill(0);for(let c=0;c<s.length;c++)l[c]=a[c].length>s[c]?a[c].length:s[c];return l},new Array(i[0].length).fill(0));return`${i.map(s=>s.map((a,l)=>a.padEnd(o[l]+1," ")).join("|").trim()).join(`
|
|
38
|
+
`)}
|
|
39
|
+
`}function tP(n,e){if(!n.appCallTrace||!n.disassembly)return"";let t=e;return e!==void 0?t=e:t={maxValueWidth:nE,topOfStackFirst:!1},e2(n.appCallTrace,n.disassembly,t)}function nP(n,e){if(!n.logicSigTrace||!n.logicSigDisassembly)return"";let t;return e!==void 0?t=e:t={maxValueWidth:nE,topOfStackFirst:!0},e2(n.logicSigTrace,n.logicSigDisassembly,t)}function rP({sender:n,receiver:e,amount:t,closeRemainderTo:r,suggestedParams:i,note:o,lease:s,rekeyTo:a}){return new Jr({type:un.pay,sender:n,note:o,lease:s,rekeyTo:a,suggestedParams:i,paymentParams:{receiver:e,amount:t,closeRemainderTo:r}})}function iP({sender:n,voteKey:e,selectionKey:t,stateProofKey:r,voteFirst:i,voteLast:o,voteKeyDilution:s,nonParticipation:a,suggestedParams:l,note:c,lease:d,rekeyTo:f}){return new Jr({type:un.keyreg,sender:n,note:c,lease:d,rekeyTo:f,suggestedParams:l,keyregParams:{voteKey:e,selectionKey:t,stateProofKey:r,voteFirst:i,voteLast:o,voteKeyDilution:s,nonParticipation:a}})}function kg({sender:n,assetIndex:e,total:t,decimals:r,defaultFrozen:i,manager:o,reserve:s,freeze:a,clawback:l,unitName:c,assetName:d,assetURL:f,assetMetadataHash:m,note:w,lease:k,rekeyTo:I,suggestedParams:x}){return new Jr({type:un.acfg,sender:n,note:w,lease:k,rekeyTo:I,suggestedParams:x,assetConfigParams:{assetIndex:e,total:t,decimals:r,defaultFrozen:i,manager:o,reserve:s,freeze:a,clawback:l,unitName:c,assetName:d,assetURL:f,assetMetadataHash:m}})}function oP({sender:n,total:e,decimals:t,defaultFrozen:r,manager:i,reserve:o,freeze:s,clawback:a,unitName:l,assetName:c,assetURL:d,assetMetadataHash:f,note:m,lease:w,rekeyTo:k,suggestedParams:I}){return kg({sender:n,total:e,decimals:t,defaultFrozen:r,manager:i,reserve:o,freeze:s,clawback:a,unitName:l,assetName:c,assetURL:d,assetMetadataHash:f,note:m,lease:w,rekeyTo:k,suggestedParams:I})}function sP({sender:n,assetIndex:e,manager:t,reserve:r,freeze:i,clawback:o,strictEmptyAddressChecking:s,note:a,lease:l,rekeyTo:c,suggestedParams:d}){if(!e)throw Error("assetIndex must be provided");if((s??!0)&&(t==null||r==null||i==null||o==null))throw Error("strictEmptyAddressChecking is enabled, but an address is empty. If this is intentional, set strictEmptyAddressChecking to false.");return kg({sender:n,assetIndex:e,manager:t,reserve:r,freeze:i,clawback:o,note:a,lease:l,rekeyTo:c,suggestedParams:d})}function aP({sender:n,assetIndex:e,note:t,lease:r,rekeyTo:i,suggestedParams:o}){if(!e)throw Error("assetIndex must be provided");return kg({sender:n,assetIndex:e,note:t,lease:r,rekeyTo:i,suggestedParams:o})}function cP({sender:n,assetIndex:e,freezeTarget:t,frozen:r,suggestedParams:i,note:o,lease:s,rekeyTo:a}){return new Jr({type:un.afrz,sender:n,note:o,lease:s,rekeyTo:a,suggestedParams:i,assetFreezeParams:{assetIndex:e,freezeTarget:t,frozen:r}})}function uP({sender:n,receiver:e,amount:t,closeRemainderTo:r,assetSender:i,note:o,assetIndex:s,suggestedParams:a,rekeyTo:l,lease:c}){if(!s)throw Error("assetIndex must be provided");return new Jr({type:un.axfer,sender:n,note:o,lease:c,rekeyTo:l,suggestedParams:a,assetTransferParams:{assetIndex:s,receiver:e,amount:t,assetSender:i,closeRemainderTo:r}})}function uo({sender:n,appIndex:e,onComplete:t,appArgs:r,accounts:i,foreignApps:o,foreignAssets:s,boxes:a,convertToAccess:l,holdings:c,locals:d,access:f,approvalProgram:m,clearProgram:w,numLocalInts:k,numLocalByteSlices:I,numGlobalInts:x,numGlobalByteSlices:T,extraPages:b,rejectVersion:R,note:L,lease:G,rekeyTo:E,suggestedParams:N}){if(t==null)throw Error("onComplete must be provided");if(f&&(i||o||s||a||c||d))throw Error("cannot specify both access and other access fields");let p=f;return l&&(p=jR({appIndex:e,accounts:i,foreignApps:o,foreignAssets:s,holdings:c,locals:d,boxes:a})),new Jr({type:un.appl,sender:n,note:L,lease:G,rekeyTo:E,suggestedParams:N,appCallParams:{appIndex:e,onComplete:t,appArgs:r,accounts:p?void 0:i,foreignAssets:p?void 0:s,foreignApps:p?void 0:o,boxes:p?void 0:a,access:p,approvalProgram:m,clearProgram:w,numLocalInts:k,numLocalByteSlices:I,numGlobalInts:x,numGlobalByteSlices:T,extraPages:b,rejectVersion:R}})}function lP({sender:n,onComplete:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,approvalProgram:f,clearProgram:m,numLocalInts:w,numLocalByteSlices:k,numGlobalInts:I,numGlobalByteSlices:x,extraPages:T,note:b,lease:R,rekeyTo:L,suggestedParams:G}){if(!f||!m)throw Error("approvalProgram and clearProgram must be provided");if(e==null)throw Error("onComplete must be provided");return uo({sender:n,appIndex:0,onComplete:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,approvalProgram:f,clearProgram:m,numLocalInts:w,numLocalByteSlices:k,numGlobalInts:I,numGlobalByteSlices:x,extraPages:T,note:b,lease:R,rekeyTo:L,suggestedParams:G})}function hP({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,approvalProgram:f,clearProgram:m,note:w,lease:k,rekeyTo:I,suggestedParams:x}){if(!e)throw Error("appIndex must be provided");if(!f||!m)throw Error("approvalProgram and clearProgram must be provided");return uo({sender:n,appIndex:e,onComplete:er.UpdateApplicationOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,approvalProgram:f,clearProgram:m,note:w,lease:k,rekeyTo:I,suggestedParams:x})}function dP({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k}){if(!e)throw Error("appIndex must be provided");return uo({sender:n,appIndex:e,onComplete:er.DeleteApplicationOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k})}function fP({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k}){if(!e)throw Error("appIndex must be provided");return uo({sender:n,appIndex:e,onComplete:er.OptInOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,note:f,convertToAccess:a,holdings:l,locals:c,access:d,lease:m,rekeyTo:w,suggestedParams:k})}function gP({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k}){if(!e)throw Error("appIndex must be provided");return uo({sender:n,appIndex:e,onComplete:er.CloseOutOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k})}function pP({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k}){if(!e)throw Error("appIndex must be provided");return uo({sender:n,appIndex:e,onComplete:er.ClearStateOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k})}function mP({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k}){if(!e)throw Error("appIndex must be provided");return uo({sender:n,appIndex:e,onComplete:er.NoOpOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k})}function yP(n){return(e,t)=>{const r=[];for(const i of t)r.push(e[i].signTxn(n.sk));return Promise.resolve(r)}}function wP(n){return(e,t)=>{const r=[];for(const i of t){const{blob:o}=tE(e[i],n);r.push(o)}return Promise.resolve(r)}}function SP(n,e){return(t,r)=>{const i=[];for(const o of r){const s=t[o],a=[];for(const l of e){const{blob:c}=QD(s,n,l);a.push(c)}a.length>1?i.push(bg(a)):i.push(a[0])}return Promise.resolve(i)}}function vP(){return(n,e)=>{const t=[];for(const r of e)t.push(sD(n[r]));return Promise.resolve(t)}}function yv(n){return typeof n=="object"&&Object.keys(n).length===2&&typeof n.txn=="object"&&typeof n.signer=="function"}const _s=2**16-1,t2=32,n2=1,r2=1,xr=2,xP=/^([a-z\d[\](),]+)\[(0|[1-9][\d]*)]$/,EP=/^ufixed([1-9][\d]*)x([1-9][\d]*)$/;let Gr=class Rd{static from(e){if(e.endsWith("[]")){const t=Rd.from(e.slice(0,e.length-2));return new p2(t)}if(e.endsWith("]")){const t=e.match(xP);if(!t||t.length!==3)throw new Error(`malformed static array string: ${e}`);const r=t[2],i=parseInt(r,10);if(i>_s)throw new Error(`array length exceeds limit ${_s}`);const o=Rd.from(t[1]);return new f2(o,i)}if(e.startsWith("uint")){const t=o=>[...o].every(s=>"0123456789".includes(s)),r=e.slice(4,e.length);if(!t(r))throw new Error(`malformed uint string: ${r}`);const i=parseInt(r,10);if(i>_s)throw new Error(`malformed uint string: ${i}`);return new Il(i)}if(e==="byte")return new u2;if(e.startsWith("ufixed")){const t=e.match(EP);if(!t||t.length!==3)throw new Error(`malformed ufixed type: ${e}`);const r=parseInt(t[1],10),i=parseInt(t[2],10);return new o2(r,i)}if(e==="bool")return new zs;if(e==="address")return new rE;if(e==="string")return new h2;if(e.length>=2&&e[0]==="("&&e[e.length-1]===")"){const t=sa.parseTupleContent(e.slice(1,e.length-1)),r=[];for(let i=0;i<t.length;i++){const o=Rd.from(t[i]);r.push(o)}return new sa(r)}throw new Error(`cannot convert a string ${e} to an ABI type`)}},Il=class i2 extends Gr{constructor(e){if(super(),e%8!==0||e<8||e>512)throw new Error(`unsupported uint type bitSize: ${e}`);this.bitSize=e}toString(){return`uint${this.bitSize}`}equals(e){return e instanceof i2&&this.bitSize===e.bitSize}isDynamic(){return!1}byteLen(){return this.bitSize/8}encode(e){if(typeof e!="bigint"&&typeof e!="number")throw new Error(`Cannot encode value as uint${this.bitSize}: ${e}`);if(e>=BigInt(2**this.bitSize)||e<BigInt(0))throw new Error(`${e} is not a non-negative int or too big to fit in size uint${this.bitSize}`);if(typeof e=="number"&&!Number.isSafeInteger(e))throw new Error(`${e} should be converted into a BigInt before it is encoded`);return oa(e,this.bitSize/8)}decode(e){if(e.length!==this.bitSize/8)throw new Error(`byte string must correspond to a uint${this.bitSize}`);return Qx(e)}},o2=class s2 extends Gr{constructor(e,t){if(super(),e%8!==0||e<8||e>512)throw new Error(`unsupported ufixed type bitSize: ${e}`);if(t>160||t<1)throw new Error(`unsupported ufixed type precision: ${t}`);this.bitSize=e,this.precision=t}toString(){return`ufixed${this.bitSize}x${this.precision}`}equals(e){return e instanceof s2&&this.bitSize===e.bitSize&&this.precision===e.precision}isDynamic(){return!1}byteLen(){return this.bitSize/8}encode(e){if(typeof e!="bigint"&&typeof e!="number")throw new Error(`Cannot encode value as ${this.toString()}: ${e}`);if(e>=BigInt(2**this.bitSize)||e<BigInt(0))throw new Error(`${e} is not a non-negative int or too big to fit in size ${this.toString()}`);if(typeof e=="number"&&!Number.isSafeInteger(e))throw new Error(`${e} should be converted into a BigInt before it is encoded`);return oa(e,this.bitSize/8)}decode(e){if(e.length!==this.bitSize/8)throw new Error(`byte string must correspond to a ${this.toString()}`);return Qx(e)}},rE=class a2 extends Gr{toString(){return"address"}equals(e){return e instanceof a2}isDynamic(){return!1}byteLen(){return t2}encode(e){if(typeof e=="string")return OA(e).publicKey;if(e instanceof Ot)return e.publicKey;if(e instanceof Uint8Array){if(e.byteLength!==32)throw new Error("byte string must be 32 bytes long for an address");return e}throw new Error(`Cannot encode value as ${this.toString()}: ${e}`)}decode(e){if(e.byteLength!==32)throw new Error("byte string must be 32 bytes long for an address");return LA(e)}},zs=class c2 extends Gr{toString(){return"bool"}equals(e){return e instanceof c2}isDynamic(){return!1}byteLen(){return r2}encode(e){if(typeof e!="boolean")throw new Error(`Cannot encode value as bool: ${e}`);return e?new Uint8Array([128]):new Uint8Array([0])}decode(e){if(e.byteLength!==1)throw new Error("bool string must be 1 byte long");const t=e[0];if(t===128)return!0;if(t===0)return!1;throw new Error("boolean could not be decoded from the byte string")}},u2=class l2 extends Gr{toString(){return"byte"}equals(e){return e instanceof l2}isDynamic(){return!1}byteLen(){return n2}encode(e){if(typeof e!="number"&&typeof e!="bigint")throw new Error(`Cannot encode value as byte: ${e}`);if(typeof e=="bigint"&&(e=Number(e)),e<0||e>255)throw new Error(`${e} cannot be encoded into a byte`);return new Uint8Array([e])}decode(e){if(e.byteLength!==1)throw new Error("byte string must be 1 byte long");return e[0]}},h2=class d2 extends Gr{toString(){return"string"}equals(e){return e instanceof d2}isDynamic(){return!0}byteLen(){throw new Error(`${this.toString()} is a dynamic type`)}encode(e){if(typeof e!="string"&&!(e instanceof Uint8Array))throw new Error(`Cannot encode value as string: ${e}`);let t;typeof e=="string"?t=new TextEncoder().encode(e):t=e;const r=oa(t.length,xr),i=new Uint8Array(t.length+xr);return i.set(r),i.set(t,xr),i}decode(e){if(e.length<xr)throw new Error(`byte string is too short to be decoded. Actual length is ${e.length}, but expected at least ${xr}`);const r=new DataView(e.buffer,e.byteOffset,xr).getUint16(0),i=e.slice(xr,e.length);if(r!==i.length)throw new Error(`string length bytes do not match the actual length of string. Expected ${r}, got ${i.length}`);return new TextDecoder("utf-8").decode(i)}},f2=class g2 extends Gr{constructor(e,t){if(super(),t<0)throw new Error(`static array must have a non negative length: ${t}`);this.childType=e,this.staticLength=t}toString(){return`${this.childType.toString()}[${this.staticLength}]`}equals(e){return e instanceof g2&&this.staticLength===e.staticLength&&this.childType.equals(e.childType)}isDynamic(){return this.childType.isDynamic()}byteLen(){return this.childType.constructor===zs?Math.ceil(this.staticLength/8):this.staticLength*this.childType.byteLen()}encode(e){if(!Array.isArray(e)&&!(e instanceof Uint8Array))throw new Error(`Cannot encode value as ${this.toString()}: ${e}`);if(e.length!==this.staticLength)throw new Error(`Value array does not match static array length. Expected ${this.staticLength}, got ${e.length}`);return this.toABITupleType().encode(e)}decode(e){return this.toABITupleType().decode(e)}toABITupleType(){return new sa(Array(this.staticLength).fill(this.childType))}},p2=class m2 extends Gr{constructor(e){super(),this.childType=e}toString(){return`${this.childType.toString()}[]`}equals(e){return e instanceof m2&&this.childType.equals(e.childType)}isDynamic(){return!0}byteLen(){throw new Error(`${this.toString()} is a dynamic type`)}encode(e){if(!Array.isArray(e)&&!(e instanceof Uint8Array))throw new Error(`Cannot encode value as ${this.toString()}: ${e}`);const t=this.toABITupleType(e.length),r=t.encode(e),i=oa(t.childTypes.length,xr);return Un(i,r)}decode(e){const r=new DataView(e.buffer,0,xr).getUint16(0);return this.toABITupleType(r).decode(e.slice(xr,e.length))}toABITupleType(e){return new sa(Array(e).fill(this.childType))}},sa=class y2 extends Gr{constructor(e){if(super(),e.length>=_s)throw new Error("tuple type child type number larger than maximum uint16 error");this.childTypes=e}toString(){const e=[];for(let t=0;t<this.childTypes.length;t++)e[t]=this.childTypes[t].toString();return`(${e.join(",")})`}equals(e){return e instanceof y2&&this.childTypes.length===e.childTypes.length&&this.childTypes.every((t,r)=>t.equals(e.childTypes[r]))}isDynamic(){const e=t=>t.isDynamic();return this.childTypes.some(e)}byteLen(){let e=0;for(let t=0;t<this.childTypes.length;t++)if(this.childTypes[t].constructor===zs){const r=al(this.childTypes,t,1),i=r+1;t+=r,e+=Math.trunc((i+7)/8)}else{const r=this.childTypes[t].byteLen();e+=r}return e}encode(e){if(!Array.isArray(e)&&!(e instanceof Uint8Array))throw new Error(`Cannot encode value as ${this.toString()}: ${e}`);const t=Array.from(e);if(e.length>_s)throw new Error("length of tuple array should not exceed a uint16");const r=this.childTypes,i=[],o=[],s=new Map;let a=0;for(;a<r.length;){const d=r[a];if(d.isDynamic())s.set(i.length,!0),i.push(new Uint8Array([0,0])),o.push(d.encode(t[a]));else{if(d.constructor===zs){const f=al(r,a,-1);let m=al(r,a,1);if(f%8!==0)throw new Error("expected before index should have number of bool mod 8 equal 0");m=Math.min(7,m);const w=bP(t.slice(a,a+m+1));i.push(oa(w,1)),a+=m}else{const f=d.encode(t[a]);i.push(f)}s.set(a,!1),o.push(new Uint8Array)}a+=1}let l=0;for(const d of i)l+=d.length;let c=0;for(let d=0;d<i.length;d++){if(s.get(d)){const f=l+c;if(f>_s)throw new Error(`byte length of ${f} should not exceed a uint16`);i[d]=oa(f,xr)}c+=o[d].length}return Un(...i,...o)}decode(e){const t=this.childTypes,r=[],i=[];let o=0,s=0;const a=new DataView(e.buffer);for(;o<t.length;){const d=t[o];if(d.isDynamic()){if(e.slice(s,e.length).length<xr)throw new Error("dynamic type in tuple is too short to be decoded");const f=a.getUint16(s);if(r.length>0&&(r[r.length-1].right=f,f<r[r.length-1].left))throw new Error("dynamic index segment miscalculation: left is greater than right index");const m={left:f,right:-1};r.push(m),i.push(null),s+=xr}else if(d.constructor===zs){const f=al(this.childTypes,o,-1);let m=al(this.childTypes,o,1);if(f%8!==0)throw new Error("expected before bool number mod 8 === 0");m=Math.min(7,m);for(let w=0;w<=m;w++){const k=128>>w;(e[s]&k)>0?i.push(new Uint8Array([128])):i.push(new Uint8Array([0]))}o+=m,s+=1}else{const f=d.byteLen();i.push(e.slice(s,s+f)),s+=f}if(o!==t.length-1&&s>=e.length)throw new Error("input byte not enough to decode");o+=1}if(r.length>0&&(r[r.length-1].right=e.length,s=e.length),s<e.length)throw new Error("input byte not fully consumed");for(let d=0;d<r.length;d++){const f=r[d];if(f.left>f.right)throw new Error("dynamic segment should display a [l, r] space with l <= r");if(d!==r.length-1&&f.right!==r[d+1].left)throw new Error("dynamic segment should be consecutive")}let l=0;for(let d=0;d<t.length;d++)t[d].isDynamic()&&(i[d]=e.slice(r[l].left,r[l].right),l+=1);const c=[];for(let d=0;d<t.length;d++){const f=t[d].decode(i[d]);c.push(f)}return c}static parseTupleContent(e){if(e.length===0)return[];if(e.endsWith(",")||e.startsWith(","))throw new Error("tuple string should not start with comma");if(e.includes(",,"))throw new Error("tuple string should not have consecutive commas");const t=[];let r=0,i="";for(const o of e)i+=o,o==="("?r+=1:o===")"?r-=1:o===","&&r===0&&(t.push(i.slice(0,i.length-1)),i="");if(i.length!==0&&t.push(i),r!==0)throw new Error("tuple string has mismatched parentheses");return t}};function bP(n){let e=0;if(n.length>8)throw new Error("value list passed in should be no greater than length 8");for(let t=0;t<n.length;t++){const r=n[t];if(typeof r!="boolean")throw new Error("non-boolean values cannot be compressed into a byte");r&&(e|=1<<7-t)}return e}function al(n,e,t){let r=0;for(;;){const i=e+t*r;if(n[i].constructor===zs)if(i!==n.length-1&&t===1)r+=1;else if(i>0&&t===-1)r+=1;else break;else{r-=1;break}}return r}var ti;(function(n){n.any="txn",n.pay="pay",n.keyreg="keyreg",n.acfg="acfg",n.axfer="axfer",n.afrz="afrz",n.appl="appl"})(ti||(ti={}));function cf(n){return n===ti.any||n===ti.pay||n===ti.keyreg||n===ti.acfg||n===ti.axfer||n===ti.afrz||n===ti.appl}function w2(n,e){return n===ti.any?!0:e.type?e.type.toString()===n.toString():!1}var Ji;(function(n){n.account="account",n.application="application",n.asset="asset"})(Ji||(Ji={}));function iE(n){return n===Ji.account||n===Ji.application||n===Ji.asset}function kP(n){const e=n.indexOf("(");if(e===-1)throw new Error(`Invalid method signature: ${n}`);let t=-1,r=0;for(let i=e;i<n.length;i++){const o=n[i];if(o==="(")r+=1;else if(o===")"){if(r===0)break;if(r-=1,r===0){t=i;break}}}if(t===-1)throw new Error(`Invalid method signature: ${n}`);return{name:n.slice(0,e),args:sa.parseTupleContent(n.slice(e+1,t)),returns:n.slice(t+1)}}let Ag=class S2{constructor(e){if(typeof e.name!="string"||typeof e.returns!="object"||!Array.isArray(e.args))throw new Error("Invalid ABIMethod parameters");this.name=e.name,this.description=e.desc,this.args=e.args.map(({type:t,name:r,desc:i})=>cf(t)||iE(t)?{type:t,name:r,description:i}:{type:Gr.from(t),name:r,description:i}),this.returns={type:e.returns.type==="void"?e.returns.type:Gr.from(e.returns.type),description:e.returns.desc},this.events=e.events,this.readonly=e.readonly}getSignature(){const e=this.args.map(r=>r.type.toString()).join(","),t=this.returns.type.toString();return`${this.name}(${e})${t}`}getSelector(){const e=Zi(this.getSignature());return new Uint8Array(e.slice(0,4))}txnCount(){let e=1;for(const t of this.args)typeof t.type=="string"&&cf(t.type)&&(e+=1);return e}toJSON(){return{name:this.name,desc:this.description,args:this.args.map(({type:e,name:t,description:r})=>({type:e.toString(),name:t,desc:r})),returns:{type:this.returns.type.toString(),desc:this.returns.description},events:this.events,readonly:this.readonly}}static fromSignature(e){const{name:t,args:r,returns:i}=kP(e);return new S2({name:t,args:r.map(o=>({type:o})),returns:{type:i}})}};function oE(n,e){if(n===null||!Array.isArray(n)||!n.every(r=>r instanceof Ag))throw new Error("Methods list provided is null or not the correct type");const t=n.filter(r=>r.name===e);if(t.length>1)throw new Error(`found ${t.length} methods with the same name ${t.map(r=>r.getSignature()).join(",")}`);if(t.length===0)throw new Error(`found 0 methods with the name ${e}`);return t[0]}let AP=class{constructor(e){if(typeof e.name!="string"||!Array.isArray(e.methods)||e.networks&&typeof e.networks!="object")throw new Error("Invalid ABIContract parameters");this.name=e.name,this.description=e.desc,this.networks=e.networks?{...e.networks}:{},this.methods=e.methods.map(t=>new Ag(t)),this.events=e.events}toJSON(){return{name:this.name,desc:this.description,networks:this.networks,methods:this.methods.map(e=>e.toJSON()),events:this.events}}getMethodByName(e){return oE(this.methods,e)}},DP=class{constructor(e){if(typeof e.name!="string"||!Array.isArray(e.methods))throw new Error("Invalid ABIInterface parameters");this.name=e.name,this.description=e.desc,this.methods=e.methods.map(t=>new Ag(t))}toJSON(){return{name:this.name,desc:this.description,methods:this.methods.map(e=>e.toJSON())}}getMethodByName(e){return oE(this.methods,e)}};const FP=new Uint8Array([21,31,124,117]),cl=16;var rr;(function(n){n[n.BUILDING=0]="BUILDING",n[n.BUILT=1]="BUILT",n[n.SIGNED=2]="SIGNED",n[n.SUBMITTED=3]="SUBMITTED",n[n.COMMITTED=4]="COMMITTED"})(rr||(rr={}));function kp(n,e,t){if(t!=null&&n===t)return 0;const r=t==null?0:1;for(let i=0;i<e.length;i++)if(n===e[i])return i+r;return e.push(n),e.length-1+r}let v2=class vo{constructor(){this.status=rr.BUILDING,this.transactions=[],this.methodCalls=new Map,this.signedTxns=[],this.txIDs=[]}getStatus(){return this.status}count(){return this.transactions.length}clone(){const e=new vo;return e.transactions=this.transactions.map(({txn:t,signer:r})=>{const i=t.toEncodingData();return i.delete("grp"),{txn:Jr.fromEncodingData(i),signer:r}}),e.methodCalls=new Map(this.methodCalls),e}addTransaction(e){if(this.status!==rr.BUILDING)throw new Error("Cannot add transactions when composer status is not BUILDING");if(this.transactions.length===vo.MAX_GROUP_SIZE)throw new Error(`Adding an additional transaction exceeds the maximum atomic group size of ${vo.MAX_GROUP_SIZE}`);if(e.txn.group&&e.txn.group.some(t=>t!==0))throw new Error("Cannot add a transaction with nonzero group ID");this.transactions.push(e)}addMethodCall({appID:e,method:t,methodArgs:r,sender:i,suggestedParams:o,onComplete:s,approvalProgram:a,clearProgram:l,numGlobalInts:c,numGlobalByteSlices:d,numLocalInts:f,numLocalByteSlices:m,extraPages:w,appAccounts:k,appForeignApps:I,appForeignAssets:x,boxes:T,access:b,note:R,lease:L,rekeyTo:G,rejectVersion:E,signer:N}){if(this.status!==rr.BUILDING)throw new Error("Cannot add transactions when composer status is not BUILDING");if(this.transactions.length+t.txnCount()>vo.MAX_GROUP_SIZE)throw new Error(`Adding additional transactions exceeds the maximum atomic group size of ${vo.MAX_GROUP_SIZE}`);if(BigInt(e)===BigInt(0)){if(a==null||l==null||c==null||d==null||f==null||m==null)throw new Error("One of the following required parameters for application creation is missing: approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices")}else if(s===er.UpdateApplicationOC){if(a==null||l==null)throw new Error("One of the following required parameters for OnApplicationComplete.UpdateApplicationOC is missing: approvalProgram, clearProgram");if(c!=null||d!=null||f!=null||m!=null||w!=null)throw new Error("One of the following application creation parameters were set on a non-creation call: numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages")}else if(a!=null||l!=null||c!=null||d!=null||f!=null||m!=null||w!=null)throw new Error("One of the following application creation parameters were set on a non-creation call: approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages");if(b&&(k||I||x||T))throw new Error("Cannot specify both access and legacy foreign arrays (appAccounts, appForeignApps, appForeignAssets, boxes)");if(r==null&&(r=[]),r.length!==t.args.length)throw new Error(`Incorrect number of method arguments. Expected ${t.args.length}, got ${r.length}`);let p=[],F=[];const v=[],O=[],C=[],V=new Map,H=T||[];for(let ve=0;ve<r.length;ve++){let Te=t.args[ve].type;const de=r[ve];if(cf(Te)){if(!yv(de)||!w2(Te,de.txn))throw new Error(`Expected ${Te} TransactionWithSigner for argument at index ${ve}`);if(de.txn.group&&de.txn.group.some(ie=>ie!==0))throw new Error("Cannot add a transaction with nonzero group ID");v.push(de);continue}if(yv(de))throw new Error(`Expected non-transaction value for argument at index ${ve}`);if(iE(Te)&&(V.set(O.length,p.length),O.push(Te),C.push(de),Te=new Il(8)),typeof Te=="string")throw new Error(`Unknown ABI type: ${Te}`);p.push(Te),F.push(de)}const _=[],ee=k==null?[]:k.map(ve=>ve.toString()),oe=I==null?[]:I.map(yn),z=x==null?[]:x.map(yn);for(let ve=0;ve<O.length;ve++){const Te=O[ve],de=C[ve];let ie=0;switch(Te){case Ji.account:{const ke=new rE,Ie=ke.decode(ke.encode(de));ie=kp(Ie,ee,i.toString());break}case Ji.application:{const ke=new Il(64),Ie=ke.decode(ke.encode(de));if(Ie>Number.MAX_SAFE_INTEGER)throw new Error(`Expected safe integer for application value, got ${Ie}`);ie=kp(Ie,oe,yn(e));break}case Ji.asset:{const ke=new Il(64),Ie=ke.decode(ke.encode(de));if(Ie>Number.MAX_SAFE_INTEGER)throw new Error(`Expected safe integer for asset value, got ${Ie}`);ie=kp(Ie,z);break}default:throw new Error(`Unknown reference type: ${Te}`)}_.push(ie)}for(let ve=0;ve<_.length;ve++){const Te=V.get(ve);F[Te]=_[ve]}if(p.length>cl-1){const ve=p.slice(cl-2),Te=F.slice(cl-2);p=p.slice(0,cl-2),F=F.slice(0,cl-2),p.push(new sa(ve)),F.push(Te)}const ue=[t.getSelector()];for(let ve=0;ve<p.length;ve++)ue.push(p[ve].encode(F[ve]));const De={txn:uo({sender:i,appIndex:e,appArgs:ue,accounts:b?void 0:ee,foreignApps:b?void 0:oe,foreignAssets:b?void 0:z,boxes:b?void 0:H,access:b,onComplete:s??er.NoOpOC,approvalProgram:a,clearProgram:l,numGlobalInts:c,numGlobalByteSlices:d,numLocalInts:f,numLocalByteSlices:m,extraPages:w,rejectVersion:E,lease:L,note:R,rekeyTo:G,suggestedParams:o}),signer:N};this.transactions.push(...v,De),this.methodCalls.set(this.transactions.length-1,t)}buildGroup(){if(this.status===rr.BUILDING){if(this.transactions.length===0)throw new Error("Cannot build a group with 0 transactions");this.transactions.length>1&&WD(this.transactions.map(e=>e.txn)),this.status=rr.BUILT}return this.transactions}async gatherSignatures(){if(this.status>=rr.SIGNED)return this.signedTxns;const e=this.buildGroup(),t=e.map(c=>c.txn),r=new Map;for(let c=0;c<e.length;c++){const{signer:d}=e[c];r.has(d)||r.set(d,[]),r.get(d).push(c)}const i=Array.from(r),o=await Promise.all(i.map(([c,d])=>c(t,d))),s=e.map(()=>null);for(let c=0;c<i.length;c++){const d=i[c][1],f=o[c];for(let m=0;m<d.length;m++)s[d[m]]=f[m]}function a(c){return c.every(d=>d!=null)}if(!a(s))throw new Error(`Missing signatures. Got ${s}`);const l=s.map((c,d)=>{try{return Fn(c,kn).txn.txID()}catch(f){throw new Error(`Cannot decode signed transaction at index ${d}. ${f}`)}});return this.signedTxns=s,this.txIDs=l,this.status=rr.SIGNED,s}async submit(e){if(this.status>rr.SUBMITTED)throw new Error("Transaction group cannot be resubmitted");const t=await this.gatherSignatures();return await e.sendRawTransaction(t).do(),this.status=rr.SUBMITTED,this.txIDs}async simulate(e,t){if(this.status>rr.SUBMITTED)throw new Error("Simulated Transaction group has already been submitted to the network");const i=(await this.gatherSignatures()).map(l=>Fn(l,kn)),o=t??new Jx({txnGroups:[]});o.txnGroups=[new Kl({txns:i})];const s=await e.simulateTransactions(o).do(),a=[];for(const[l,c]of this.methodCalls){const d=this.txIDs[l],f=s.txnGroups[0].txnResults[l].txnResult,m={txID:d,rawReturnValue:new Uint8Array,method:c};a.push(vo.parseMethodResponse(c,m,f))}return{methodResults:a,simulateResponse:s}}async execute(e,t){if(this.status===rr.COMMITTED)throw new Error("Transaction group has already been executed successfully");const r=await this.submit(e);this.status=rr.SUBMITTED;const i=this.transactions.findIndex((c,d)=>this.methodCalls.has(d)),s=await zD(e,r[i===-1?0:i],t);this.status=rr.COMMITTED;const a=s.confirmedRound,l=[];for(const[c,d]of this.methodCalls){const f=r[c];let m={txID:f,rawReturnValue:new Uint8Array,method:d};try{const w=c===i?s:await e.pendingTransactionInformation(f).do();m=vo.parseMethodResponse(d,m,w)}catch(w){m.decodeError=w}l.push(m)}return{confirmedRound:a,txIDs:r,methodResults:l}}static parseMethodResponse(e,t,r){const i=t;try{if(i.txInfo=r,e.returns.type!=="void"){const o=r.logs||[];if(o.length===0)throw new Error(`App call transaction did not log a return value ${Xs(r)}`);const s=o[o.length-1];if(s.byteLength<4||!Fi(s.slice(0,4),FP))throw new Error(`App call transaction did not log a ABI return value ${Xs(r)}`);i.rawReturnValue=new Uint8Array(s.slice(4)),i.returnValue=e.returns.type.decode(t.rawReturnValue)}}catch(o){i.decodeError=o}return i}};v2.MAX_GROUP_SIZE=16;const x2=Uint8Array.from([77,88]),E2="The transaction sender address and multisig preimage do not match.";function TP(n,e){return{txID:n.txID(),blob:n.signTxn(e)}}function IP(n,e){const t=Un(x2,n);return jl(t,e)}function MP(n,e,t){const r=Un(x2,n),i=typeof t=="string"?Ot.fromString(t):t;return Of(r,e,i.publicKey)}const RP=new Error(E2),CP=new Error(jx),_o=Object.freeze(Object.defineProperty({__proto__:null,ABIAddressType:rE,ABIArrayDynamicType:p2,ABIArrayStaticType:f2,ABIBoolType:zs,ABIByteType:u2,ABIContract:AP,ABIInterface:DP,ABIMethod:Ag,get ABIReferenceType(){return Ji},ABIStringType:h2,get ABITransactionType(){return ti},ABITupleType:sa,ABIType:Gr,ABIUfixedType:o2,ABIUintType:Il,ADDR_BYTE_SIZE:t2,ALGORAND_ZERO_ADDRESS_STRING:RM,AccountBaseData:gg,AccountData:pg,AccountDeltas:yg,AccountTotals:xg,Address:Ot,AlgoCount:jo,Algodv2:r4,AppLocalState:ig,AppLocalStateDelta:og,AppParams:rg,AppParamsDelta:sg,AppResourceRecord:ag,ApplyData:ay,AssetHolding:cg,AssetHoldingDelta:ug,AssetParams:lg,AssetParamsDelta:hg,AssetResourceRecord:dg,AtomicTransactionComposer:v2,get AtomicTransactionComposerStatus(){return rr},BalanceRecord:mg,Block:tf,BlockHeader:zu,ENCODED_MULTISIG_SCHEMA:Qd,ENCODED_SUBSIG_SCHEMA:tD,ERROR_INVALID_MICROALGOS:CP,ERROR_MULTISIG_BAD_SENDER:RP,EvalDelta:oy,FalconSignatureStruct:Hf,FalconVerifier:qf,HashFactory:jf,INVALID_MICROALGOS_ERROR_MSG:jx,IncludedTransactions:Sg,Indexer:T4,IntDecoding:Bn,Kmd:i4,KvValueDelta:wg,LENGTH_ENCODE_BYTE_SIZE:xr,LedgerStateDelta:Ic,LogicSig:to,LogicSigAccount:Gx,MAX_LEN:_s,MULTISIG_BAD_SENDER_ERROR_MSG:E2,MerkleArrayProof:Ho,MerkleSignatureVerifier:_f,ModifiedCreatable:vg,get OnApplicationComplete(){return er},Participant:zf,ParticipationUpdates:tg,ProgramSourceMap:Y4,Reveal:Kf,RewardState:Qf,SINGLE_BOOL_SIZE:r2,SINGLE_BYTE_SIZE:n2,SignedTransaction:kn,SignedTxnInBlock:ng,SignedTxnWithAD:ql,SigslotCommit:Gf,StateProof:Wf,StateProofMessage:Jf,StateProofTrackingData:Yf,StateSchema:Ii,TealValue:qu,Transaction:Jr,get TransactionType(){return un},TxnCommitments:Xf,UntypedValue:pr,UpgradeState:Zf,UpgradeVote:eg,ValueDelta:nc,VotingData:fg,abiCheckTransactionType:w2,abiTypeIsReference:iE,abiTypeIsTransaction:cf,algosToMicroalgos:BM,appendSignMultisigTransaction:K4,appendSignRawMultisigSignature:W4,assignGroupID:WD,base64ToBytes:ut,bigIntToBytes:oa,bytesToBase64:Qn,bytesToBigInt:Qx,bytesToHex:Lf,bytesToString:Nf,coerceToBytes:Ti,computeGroupID:KD,createDryrun:Q4,createMultisigTransaction:JD,decodeAddress:OA,decodeJSON:Wt,decodeMsgpack:Fn,decodeObj:RR,decodeSignedTransaction:hC,decodeUint64:IM,decodeUnsignedTransaction:eC,dryrunTxnResultAppTrace:tP,dryrunTxnResultLogicSigTrace:nP,encodeAddress:LA,encodeJSON:$R,encodeMsgpack:Wr,encodeObj:MR,encodeUint64:VA,encodeUnsignedSimulateTransaction:sD,encodeUnsignedTransaction:ZR,encodedMultiSigFromEncodingData:Zd,encodedMultiSigToEncodingData:ef,encodedSubsigFromEncodingData:nD,encodedSubsigToEncodingData:rD,generateAccount:I4,getApplicationAddress:Xd,getMethodByName:oE,hexToBytes:MM,indexerModels:s4,isOnApplicationComplete:XA,isTransactionType:Om,isTransactionWithSigner:yv,isValidAddress:NA,logicSigFromByte:cC,makeApplicationCallTxnFromObject:uo,makeApplicationClearStateTxnFromObject:pP,makeApplicationCloseOutTxnFromObject:gP,makeApplicationCreateTxnFromObject:lP,makeApplicationDeleteTxnFromObject:dP,makeApplicationNoOpTxnFromObject:mP,makeApplicationOptInTxnFromObject:fP,makeApplicationUpdateTxnFromObject:hP,makeAssetConfigTxnWithSuggestedParamsFromObject:sP,makeAssetCreateTxnWithSuggestedParamsFromObject:oP,makeAssetDestroyTxnWithSuggestedParamsFromObject:aP,makeAssetFreezeTxnWithSuggestedParamsFromObject:cP,makeAssetTransferTxnWithSuggestedParamsFromObject:uP,makeBaseAssetConfigTxn:kg,makeBasicAccountTransactionSigner:yP,makeEmptyTransactionSigner:vP,makeKeyRegistrationTxnWithSuggestedParamsFromObject:iP,makeLogicSigAccountTransactionSigner:wP,makeMultiSigAccountTransactionSigner:SP,makePaymentTxnWithSuggestedParamsFromObject:rP,masterDerivationKeyToMnemonic:B4,mergeMultisigTransactions:bg,microalgosToAlgos:$M,mnemonicFromSeed:Zx,mnemonicToMasterDerivationKey:$4,mnemonicToSecretKey:C4,modelsv2:mC,msgpackRawDecode:KA,msgpackRawDecodeAsMap:WA,msgpackRawEncode:td,multisigAddress:sC,parseJSON:Ux,secretKeyToMnemonic:P4,seedFromMnemonic:eE,signBytes:IP,signLogicSigTransaction:L4,signLogicSigTransactionObject:tE,signMultisigTransaction:QD,signTransaction:TP,stringifyJSON:Xs,tealSign:oD,tealSignFromProgram:lC,verifyBytes:MP,verifyMultisig:Jm,verifyTealSign:uC,waitForConfirmation:zD},Symbol.toStringTag,{value:"Module"}));function PP(n,e){if(n===void 0)return`0 ${e.unitName}`;const t=typeof n=="bigint"?n:BigInt(n);if(e.decimals===0)return`${t} ${e.unitName}`;const r=10n**BigInt(e.decimals),i=t/r,o=t%r;if(o===0n)return`${i} ${e.unitName}`;const s=o.toString().padStart(e.decimals,"0").replace(/0+$/,"");return`${i}.${s} ${e.unitName}`}function Ap(n,e){return e!=null&&e.unitName?e.unitName:n.assetIndex?`ASA#${n.assetIndex}`:"ASA"}function $P({txn:n,assetInfo:e,appEscrows:t={}}){const r=(a,l)=>a&&t[a]||l,i=(a,l,c,d=!1,f=!1)=>K.jsxs("div",{className:`grid grid-cols-[1fr_auto_1fr] w-full items-center font-mono text-xs ${f?"mt-1":""}`,children:[K.jsx("span",{className:"text-[var(--wui-color-text-secondary)] text-left",children:a}),K.jsxs("span",{className:"flex items-center justify-center gap-1 px-1",children:[K.jsx("span",{className:"text-[var(--wui-color-text-tertiary)]",children:"--["}),K.jsx("span",{className:d?"text-[var(--wui-color-danger-text)] font-bold":"text-[var(--wui-color-primary)] font-medium",children:l}),K.jsx("span",{className:"text-[var(--wui-color-text-tertiary)]",children:"]-->"})]}),K.jsx("span",{className:`text-right ${d?"text-[var(--wui-color-danger-text)] font-bold":"text-[var(--wui-color-text-secondary)]"}`,children:c})]}),o=a=>K.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] w-full items-center font-mono text-xs mt-1",children:[K.jsx("span",{}),K.jsxs("span",{className:"flex items-center justify-center gap-1 px-1",children:[K.jsx("span",{className:"text-[var(--wui-color-text-tertiary)]",children:"--["}),K.jsx("span",{className:"text-[var(--wui-color-danger-text)] font-bold",children:"remainder"}),K.jsx("span",{className:"text-[var(--wui-color-text-tertiary)]",children:"]-->"})]}),K.jsx("span",{className:"text-[var(--wui-color-danger-text)] font-bold text-right",children:a})]}),s=(a,l)=>K.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] w-full items-center font-mono text-xs mt-1",children:[K.jsx("span",{className:"text-[var(--wui-color-text-secondary)] text-left",children:a}),K.jsxs("span",{className:"flex items-center justify-center gap-1 px-1",children:[K.jsx("span",{className:"text-[var(--wui-color-text-tertiary)]",children:"--["}),K.jsx("span",{className:"text-[var(--wui-color-danger-text)] font-bold",children:"REKEY"}),K.jsx("span",{className:"text-[var(--wui-color-text-tertiary)]",children:"]-->"})]}),K.jsx("span",{className:"text-[var(--wui-color-danger-text)] font-bold text-right",children:l})]});return K.jsxs("div",{className:"space-y-0",children:[n.type==="pay"&&n.receiverShort&&K.jsxs(K.Fragment,{children:[i(n.senderShort,n.amount||"0 ALGO",r(n.receiver,n.receiverShort)),n.closeRemainderToShort&&o(n.closeRemainderToShort)]}),n.type==="axfer"&&n.receiverShort&&K.jsxs(K.Fragment,{children:[i(n.senderShort,e?PP(n.rawAmount,e):`${n.amount||"0"} ${Ap(n)}`,r(n.receiver,n.receiverShort)),n.closeRemainderToShort&&o(n.closeRemainderToShort)]}),n.type==="afrz"&&n.freezeTargetShort&&K.jsx(K.Fragment,{children:i(n.senderShort,`${n.isFreezing?"Freeze":"Unfreeze"} ${Ap(n,e)}`,n.freezeTargetShort)}),n.type==="acfg"&&K.jsx(K.Fragment,{children:i(n.senderShort,`Configure ${n.assetIndex?Ap(n,e):"NEW"}`,n.senderShort)}),n.type==="appl"&&K.jsx(K.Fragment,{children:i(n.senderShort,"APP CALL",`App ${n.appIndex||"NEW"}`)}),n.type==="keyreg"&&K.jsx(K.Fragment,{children:i(n.senderShort,"KEY REG",n.senderShort)}),n.rekeyToShort&&s(n.senderShort,n.rekeyToShort)]})}function BP(n,e){const t=cM({queries:n.map(o=>({queryKey:["asset",o],queryFn:async()=>{const s=await e.getAssetByID(Number(o)).do();return{decimals:s.params.decimals,unitName:s.params.unitName||""}},retries:0,enabled:!!e,staleTime:1/0,gcTime:1/0}))}),r=t.some(o=>o.isLoading),i=ce.useMemo(()=>{var s;const o={};for(let a=0;a<n.length;a++){const l=(s=t[a])==null?void 0:s.data;l&&(o[n[a]]=l)}return o},[n,t]);return{loading:r,assets:i}}function VP(n,e){const t=e==null?void 0:e.algodClient,r=e==null?void 0:e.getApplicationAddress,i=ce.useMemo(()=>{const l=new Set;for(const c of n)c.assetIndex&&l.add(c.assetIndex.toString());return Array.from(l)},[n]),{loading:o,assets:s}=BP(i,t),a=ce.useMemo(()=>{if(!r)return{};const l={};for(const c of n)if(c.type==="appl"&&c.appIndex){const d=r(c.appIndex);l[d.toString()]=`App ${c.appIndex}`}return l},[n,r]);return{loading:o,assets:s,appEscrows:a}}function OP({transactions:n,message:e,dangerous:t,algodClient:r,getApplicationAddress:i,onApprove:o,onReject:s,signing:a,walletName:l,origin:c,headerAction:d,payloadVerified:f}){const{loading:m,assets:w,appEscrows:k}=VP(n,{algodClient:r,getApplicationAddress:i});return K.jsxs("div",{className:"flex flex-col",children:[K.jsxs("div",{className:"flex items-center justify-between px-6 pt-5 pb-1",children:[K.jsxs("h2",{className:`text-lg font-bold ${t?"text-[var(--wui-color-danger-text)]":"text-[var(--wui-color-text)]"}`,children:[t?"Review Dangerous ":"Review ","Transaction",n.length>1?"s":""]}),d]}),c&&K.jsx("div",{className:"px-6 text-xs text-[var(--wui-color-text-tertiary)] truncate",children:c}),t?K.jsx("div",{className:"px-6 pb-3 text-sm font-bold text-[var(--wui-color-danger-text)]",children:t==="rekey"?"This transaction will rekey your account, transferring signing authority to a different address. You will no longer be able to sign transactions with your current key.":"This transaction will close your account and transfer all remaining funds to another address. This action is irreversible."}):K.jsx("div",{className:"px-6 pb-3 text-sm text-[var(--wui-color-text-secondary)]",children:n.length===1?"You are about to sign the following transaction:":`You are about to sign ${n.length} transactions:`}),K.jsx("div",{className:"px-4 pb-4 max-h-80 overflow-y-auto",children:m?K.jsxs("div",{className:"flex items-center justify-center py-6 text-sm text-[var(--wui-color-text-secondary)]",children:[K.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[K.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),K.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading asset info..."]}):K.jsx("div",{className:"space-y-2",children:n.map(I=>K.jsx("div",{className:"rounded-sm border p-3 border-[var(--wui-color-primary)] bg-[var(--wui-color-bg-secondary)]",children:K.jsx($P,{txn:I,assetInfo:I.assetIndex?w[I.assetIndex.toString()]:void 0,appEscrows:k})},I.index))})}),f===!1&&K.jsx("div",{className:"px-4 pb-4",children:K.jsx("div",{className:"text-sm font-bold text-[var(--wui-color-danger-text)] border border-[var(--wui-color-danger-text)] rounded-xl p-3 bg-[var(--wui-color-danger-bg)]",children:"Payload verification failed. The provided payload was invalid and has been recalculated from the raw transactions."})}),K.jsx("div",{className:"px-4 pb-4",children:K.jsxs("div",{className:"text-sm flex flex-col gap-2 border border-[var(--wui-color-border)] rounded-xl p-3",children:[K.jsxs("div",{className:"flex items-center gap-2",children:[K.jsx("span",{children:"Transaction ID to sign:"}),f===!0&&K.jsx("span",{className:"text-xs text-green-600 font-medium",children:"Verified"})]}),K.jsx("div",{className:"font-mono break-all text-[var(--wui-color-danger-text)]",children:e}),K.jsx("div",{children:"Ensure the transaction ID is correct before approving."})]})}),a?K.jsx("div",{className:"px-6 py-4 border-t border-[var(--wui-color-border)]",children:K.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--wui-color-text-secondary)]",children:[K.jsxs("svg",{className:"animate-spin h-4 w-4 flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[K.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),K.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Signing..."]})}):t?K.jsxs("div",{className:"px-6 py-4 border-t border-[var(--wui-color-border)] flex gap-3",children:[K.jsx("button",{onClick:s,className:"flex-1 py-2.5 px-4 bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text-secondary)] font-medium rounded-xl hover:brightness-90 transition-all text-sm",children:"Reject"}),K.jsx("button",{onClick:o,className:"flex-1 py-2.5 px-4 bg-[var(--wui-color-danger-text)] text-white font-medium rounded-xl hover:brightness-90 transition-all text-sm",children:"Sign (Dangerous)"})]}):K.jsx("div",{className:"px-6 py-4 border-t border-[var(--wui-color-border)]",children:K.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--wui-color-text-secondary)]",children:[K.jsxs("svg",{className:"animate-spin h-4 w-4 flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[K.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),K.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Review in ",l||"wallet","..."]})})]})}function b2({className:n,scale:e=.85}){return K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:`inline-block align-baseline ${n??""}`,style:{width:`${e}em`,height:`${e}em`},"aria-label":"Algorand",fill:"currentColor",children:K.jsx("path",{d:"M23.98 23.99h-3.75l-2.44-9.07-5.25 9.07H8.34l8.1-14.04-1.3-4.88L4.22 24H.02L13.88 0h3.67l1.61 5.96h3.79l-2.59 4.5 3.62 13.53z"})})}function uf({className:n}){return K.jsxs("svg",{className:`animate-spin h-4 w-4 ${n??""}`,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[K.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),K.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}function k2({status:n,error:e,successMessage:t,onRetry:r}){return n==="idle"?null:n==="signing"?K.jsxs("div",{className:"flex items-center justify-center py-4 text-sm text-[var(--wui-color-text-secondary)]",children:[K.jsx(uf,{className:"h-4 w-4 mr-2"}),"Waiting for signature..."]}):n==="sending"?K.jsxs("div",{className:"flex items-center justify-center py-4 text-sm text-[var(--wui-color-text-secondary)]",children:[K.jsx(uf,{className:"h-4 w-4 mr-2"}),"Sending transaction..."]}):n==="success"?K.jsxs("div",{className:"text-center py-4",children:[K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 mx-auto mb-2 text-green-500",viewBox:"0 0 20 20",fill:"currentColor",children:K.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),K.jsx("p",{className:"text-sm font-medium text-[var(--wui-color-text)]",children:t})]}):K.jsxs("div",{className:"text-center py-3",children:[K.jsx("p",{className:"text-sm text-[var(--wui-color-danger-text)] mb-2",children:e}),K.jsx("button",{onClick:r,className:"text-sm text-[var(--wui-color-primary)] hover:underline",children:"Try again"})]})}function NP({assetIdInput:n,setAssetIdInput:e,assetInfo:t,assetLookupLoading:r,assetLookupError:i,status:o,error:s,handleOptIn:a,reset:l,retry:c,onBack:d}){return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[K.jsx("button",{onClick:d,className:"-ml-1 p-1 rounded-lg hover:bg-[var(--wui-color-bg-secondary)] transition-colors text-[var(--wui-color-text-secondary)] flex items-center justify-center",title:"Back",children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:K.jsx("path",{d:"m15 18-6-6 6-6"})})}),K.jsx("h3",{className:"text-lg font-bold leading-none text-[var(--wui-color-text)] wallet-custom-font",children:"Opt In Asset"})]}),K.jsx("div",{className:"mb-4",children:K.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",placeholder:"Enter Asset ID",value:n,onChange:f=>e(f.target.value.replace(/[^0-9]/g,"")),className:"w-full rounded-lg border border-[var(--wui-color-border)] bg-[var(--wui-color-bg-secondary)] py-2.5 px-3 text-sm text-[var(--wui-color-text)] placeholder:text-[var(--wui-color-text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--wui-color-primary)] focus:border-transparent"})}),r&&K.jsxs("div",{className:"flex items-center justify-center py-4 text-sm text-[var(--wui-color-text-secondary)]",children:[K.jsx(uf,{className:"h-4 w-4 mr-2"}),"Looking up asset..."]}),i&&K.jsx("div",{className:"py-3 text-center text-sm text-[var(--wui-color-danger-text)]",children:i}),t&&o==="idle"&&K.jsxs("div",{className:"bg-[var(--wui-color-bg-secondary)] rounded-lg p-3",children:[K.jsxs("div",{className:"flex justify-between items-start mb-3",children:[K.jsxs("div",{children:[K.jsx("p",{className:"text-sm font-medium text-[var(--wui-color-text)]",children:t.name}),t.unitName&&K.jsx("p",{className:"text-xs text-[var(--wui-color-text-secondary)]",children:t.unitName})]}),K.jsxs("span",{className:"text-xs text-[var(--wui-color-text-tertiary)]",children:["ID: ",t.index]})]}),K.jsx("button",{onClick:a,className:"w-full py-2 px-4 bg-[var(--wui-color-primary)] text-white font-medium rounded-xl hover:brightness-90 transition-all text-sm",children:"Opt In"})]}),K.jsx(k2,{status:o,error:s,successMessage:"Opted in successfully!",onRetry:c})]})}function LP({sendType:n,setSendType:e,receiver:t,setReceiver:r,amount:i,setAmount:o,assetIdInput:s,setAssetIdInput:a,assetInfo:l,assetLookupLoading:c,assetLookupError:d,status:f,error:m,handleSend:w,reset:k,retry:I,onBack:x}){return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[K.jsx("button",{onClick:x,className:"-ml-1 p-1 rounded-lg hover:bg-[var(--wui-color-bg-secondary)] transition-colors text-[var(--wui-color-text-secondary)] flex items-center justify-center",title:"Back",children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:K.jsx("path",{d:"m15 18-6-6 6-6"})})}),K.jsx("h3",{className:"text-lg font-bold leading-none text-[var(--wui-color-text)] wallet-custom-font",children:"Send"})]}),K.jsxs("div",{className:"flex mb-4 bg-[var(--wui-color-bg-secondary)] rounded-lg p-1",children:[K.jsx("button",{onClick:()=>e("algo"),className:`flex-1 py-1.5 text-sm font-medium rounded-md transition-all ${n==="algo"?"bg-[var(--wui-color-bg)] text-[var(--wui-color-text)] shadow-sm":"text-[var(--wui-color-text-secondary)] hover:text-[var(--wui-color-text)]"}`,children:"ALGO"}),K.jsx("button",{onClick:()=>e("asa"),className:`flex-1 py-1.5 text-sm font-medium rounded-md transition-all ${n==="asa"?"bg-[var(--wui-color-bg)] text-[var(--wui-color-text)] shadow-sm":"text-[var(--wui-color-text-secondary)] hover:text-[var(--wui-color-text)]"}`,children:"Asset"})]}),n==="asa"&&K.jsxs("div",{className:"mb-3",children:[K.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",placeholder:"Asset ID",value:s,onChange:T=>a(T.target.value.replace(/[^0-9]/g,"")),className:"w-full rounded-lg border border-[var(--wui-color-border)] bg-[var(--wui-color-bg-secondary)] py-2.5 px-3 text-sm text-[var(--wui-color-text)] placeholder:text-[var(--wui-color-text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--wui-color-primary)] focus:border-transparent"}),c&&K.jsxs("div",{className:"flex items-center mt-2 text-xs text-[var(--wui-color-text-secondary)]",children:[K.jsx(uf,{className:"h-3 w-3 mr-1.5"}),"Looking up asset..."]}),d&&K.jsx("p",{className:"mt-2 text-xs text-[var(--wui-color-danger-text)]",children:d}),l&&K.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-[var(--wui-color-text-secondary)] bg-[var(--wui-color-bg-secondary)] rounded-md px-2 py-1.5",children:[K.jsx("span",{className:"font-medium text-[var(--wui-color-text)]",children:l.name}),l.unitName&&K.jsx("span",{children:l.unitName})]})]}),K.jsx("div",{className:"mb-3",children:K.jsx("input",{type:"text",placeholder:"Receiver address",value:t,onChange:T=>r(T.target.value),className:"w-full rounded-lg border border-[var(--wui-color-border)] bg-[var(--wui-color-bg-secondary)] py-2.5 px-3 text-sm text-[var(--wui-color-text)] placeholder:text-[var(--wui-color-text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--wui-color-primary)] focus:border-transparent"})}),K.jsx("div",{className:"mb-4",children:K.jsx("input",{type:"text",inputMode:"decimal",placeholder:n==="algo"?"Amount (ALGO)":l?`Amount (${l.unitName||l.name})`:"Amount",value:i,onChange:T=>o(T.target.value.replace(/[^0-9.]/g,"")),className:"w-full rounded-lg border border-[var(--wui-color-border)] bg-[var(--wui-color-bg-secondary)] py-2.5 px-3 text-sm text-[var(--wui-color-text)] placeholder:text-[var(--wui-color-text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--wui-color-primary)] focus:border-transparent"})}),f==="idle"&&K.jsxs("button",{onClick:w,disabled:!t||!i||n==="asa"&&!l,className:"w-full py-2.5 px-4 bg-[var(--wui-color-primary)] text-white font-medium rounded-xl hover:brightness-90 transition-all text-sm disabled:opacity-50 disabled:cursor-not-allowed",children:["Send ",n==="algo"?"ALGO":(l==null?void 0:l.unitName)||"Asset"]}),K.jsx(k2,{status:f,error:m,successMessage:"Sent successfully!",onRetry:I})]})}const UP=new Intl.NumberFormat(void 0,{minimumFractionDigits:4,maximumFractionDigits:4});function jP({displayBalance:n,showAvailableBalance:e,onToggleBalance:t,onBack:r,send:i,optIn:o,onBridge:s,onExplore:a}){const[l,c]=ce.useState("main"),d=f=>{c("main"),f==null||f()};return l==="send"&&i?K.jsx(LP,{...i,onBack:()=>d(i.reset)}):l==="opt-in"&&o?K.jsx(NP,{...o,onBack:()=>d(o.reset)}):K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[K.jsx("button",{onClick:r,className:"-ml-1 p-1 rounded-lg hover:bg-[var(--wui-color-bg-secondary)] transition-colors text-[var(--wui-color-text-secondary)] flex items-center justify-center",title:"Back",children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:K.jsx("path",{d:"m15 18-6-6 6-6"})})}),K.jsx("h3",{className:"text-lg font-bold leading-none text-[var(--wui-color-text)] wallet-custom-font",children:"Manage Liquid Account"})]}),K.jsx("div",{className:"mb-4 bg-[var(--wui-color-bg-secondary)] rounded-lg p-3",children:K.jsxs("div",{className:"flex justify-between items-center",children:[n!==null&&K.jsxs("span",{className:"text-base font-medium text-[var(--wui-color-text)] flex items-center gap-1",children:[UP.format(n),K.jsx(b2,{})]}),K.jsxs("button",{onClick:t,className:"flex items-center gap-1 text-sm text-[var(--wui-color-text-secondary)] bg-[var(--wui-color-bg-tertiary)] py-1 pl-2.5 pr-2 rounded-md hover:brightness-90 transition-all focus:outline-none",title:e?"Show total balance":"Show available balance",children:[e?"Available":"Total",K.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"ml-0.5 opacity-80",children:[K.jsx("path",{d:"m17 10-5-5-5 5"}),K.jsx("path",{d:"m17 14-5 5-5-5"})]})]})]})}),K.jsx("div",{className:"border-t border-[var(--wui-color-border)] mb-3"}),K.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[K.jsxs("button",{onClick:()=>c("send"),disabled:!i,className:"py-2.5 px-4 bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text)] font-medium rounded-xl hover:brightness-90 transition-all text-sm flex items-center justify-center disabled:opacity-40 disabled:pointer-events-none",children:[K.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[K.jsx("path",{d:"M5 12h14"}),K.jsx("path",{d:"m12 5 7 7-7 7"})]}),"Send"]}),K.jsxs("button",{onClick:()=>c("opt-in"),disabled:!o,className:"py-2.5 px-4 bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text)] font-medium rounded-xl hover:brightness-90 transition-all text-sm flex items-center justify-center disabled:opacity-40 disabled:pointer-events-none",children:[K.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[K.jsx("path",{d:"M12 5v14"}),K.jsx("path",{d:"M5 12h14"})]}),"Opt In"]}),K.jsxs("button",{onClick:s,disabled:!s,className:"py-2.5 px-4 bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text)] font-medium rounded-xl hover:brightness-90 transition-all text-sm flex items-center justify-center disabled:opacity-40 disabled:pointer-events-none",children:[K.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[K.jsx("path",{d:"M8 3l4 4-4 4"}),K.jsx("path",{d:"M16 3l-4 4 4 4"}),K.jsx("path",{d:"M12 7H4"}),K.jsx("path",{d:"M12 7h8"}),K.jsx("path",{d:"M8 21l4-4-4-4"}),K.jsx("path",{d:"M16 21l-4-4 4-4"}),K.jsx("path",{d:"M12 17H4"}),K.jsx("path",{d:"M12 17h8"})]}),"Bridge"]}),K.jsxs("button",{onClick:a,disabled:!a,className:"py-2.5 px-4 bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text)] font-medium rounded-xl hover:brightness-90 transition-all text-sm flex items-center justify-center disabled:opacity-40 disabled:pointer-events-none",children:[K.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[K.jsx("circle",{cx:"11",cy:"11",r:"8"}),K.jsx("path",{d:"m21 21-4.3-4.3"})]}),"Explore"]})]})]})}function J1(n){return`${n.slice(0,6)}...${n.slice(-6)}`}function _P({algorandAddress:n,evmAddress:e,onClose:t,labelId:r,descriptionId:i}){const[o,s]=ce.useState(null),a=ce.useCallback((d,f)=>{navigator.clipboard.writeText(d),s(f),setTimeout(()=>s(null),1500)},[]),l=J1(n),c=J1(e);return K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"relative flex items-center px-6 pt-5 pb-4",children:[K.jsx("h2",{id:r,className:"text-xl font-bold text-[var(--wui-color-text)] wallet-custom-font",children:"Welcome to Algorand"}),K.jsx("button",{onClick:t,className:"absolute right-4 top-5 w-9 h-9 flex items-center justify-center rounded-full bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text-secondary)] hover:brightness-90 transition-all","aria-label":"Close dialog",children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:K.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),K.jsxs("div",{id:i,className:"px-6 pb-4 space-y-4",children:[K.jsxs("p",{className:"text-sm text-[var(--wui-color-text-secondary)]",children:["You can use Algorand with your very own Liquid EVM account, which wraps your EVM private key, preserving full self-custodial control."," ",K.jsx("a",{className:"text-[var(--wui-color-link)] hover:text-[var(--wui-color-link-hover)]",rel:"noopener noreferrer",href:"#",onClick:()=>(alert("Soon"),!1),children:"Learn more."})]}),K.jsxs("div",{className:"!my-4 rounded-xl border border-[var(--wui-color-border)] bg-[var(--wui-color-bg-secondary)] p-3 space-y-2",children:[K.jsxs("div",{className:"flex justify-between items-center text-xs",children:[K.jsx("span",{className:"text-[var(--wui-color-text-tertiary)]",children:"Your EVM Address"}),K.jsxs("span",{className:"flex items-center gap-1.5",children:[K.jsx("span",{className:"text-[var(--wui-color-text-secondary)] font-mono",children:c}),K.jsx("button",{onClick:()=>a(e,"evm"),className:"text-[var(--wui-color-text-tertiary)] hover:text-[var(--wui-color-text-secondary)] transition-colors","aria-label":"Copy EVM address",children:o==="evm"?K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3.5 w-3.5 text-green-500",viewBox:"0 0 20 20",fill:"currentColor",children:K.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):K.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3.5 w-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:[K.jsx("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),K.jsx("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"})]})})]})]}),K.jsxs("div",{className:"flex justify-between items-center text-xs",children:[K.jsx("span",{className:"text-[var(--wui-color-text-tertiary)]",children:"Your Algorand Address"}),K.jsxs("span",{className:"flex items-center gap-1.5",children:[K.jsx("span",{className:"text-[var(--wui-color-text-secondary)] font-mono",children:l}),K.jsx("button",{onClick:()=>a(n,"algorand"),className:"text-[var(--wui-color-text-tertiary)] hover:text-[var(--wui-color-text-secondary)] transition-colors","aria-label":"Copy Algorand address",children:o==="algorand"?K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3.5 w-3.5 text-green-500",viewBox:"0 0 20 20",fill:"currentColor",children:K.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):K.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3.5 w-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:[K.jsx("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),K.jsx("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"})]})})]})]})]}),K.jsxs("p",{className:"text-sm text-[var(--wui-color-text-secondary)]",children:["To get started,"," ",K.jsx("a",{className:"text-[var(--wui-color-link)] hover:text-[var(--wui-color-link-hover)]",rel:"noopener noreferrer",target:"_blank",href:"https://algorand.co/ecosystem/directory?tags=CEX",children:"fund"})," ","your new Algorand account via CEX, Card onramp, or"," ",K.jsx("a",{className:"text-[var(--wui-color-link)] hover:text-[var(--wui-color-link-hover)]",rel:"noopener noreferrer",target:"_blank",href:"https://core.allbridge.io/?ft=USDC&tt=USDC&f=BAS&t=ALG",children:"bridge USDC"})," ","in 2 minutes."]})]}),K.jsxs("div",{className:"px-6 py-4 border-t border-[var(--wui-color-border)] flex flex gap-2",children:[K.jsx("button",{onClick:()=>{t(),window.open("https://algorand.co/algorand-start-here#hs_cos_wrapper_widget_1769533007886")},className:"w-full py-2.5 px-4 bg-[var(--wui-color-primary)] text-[var(--wui-color-primary-text)] font-medium rounded-xl hover:brightness-90 transition-all text-sm",children:"Get Started"}),K.jsx("button",{onClick:t,className:"w-full py-2.5 px-4 bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text-secondary)] font-medium rounded-xl hover:brightness-90 transition-all text-sm",children:"Close"})]})]})}function zP({transactions:n,message:e,dangerous:t,onApprove:r,onReject:i,onClose:o,signing:s,walletName:a,algodClient:l}){const{theme:c}=Oi(),[d,f]=ce.useState("starting"),m=c==="system"?void 0:c,{refs:w,context:k}=Cf({open:!0,onOpenChange:G=>{G||(f("exiting"),setTimeout(t?()=>i():()=>o(),150))}}),I=Rf(k,{outsidePressEvent:"mousedown"}),x=Px(k,{role:"alertdialog"}),{getFloatingProps:T}=Pf([I,x]),b=Di(),R=Di();d==="starting"&&requestAnimationFrame(()=>f("entered"));const L=K.jsx("button",{onClick:()=>{f("exiting"),setTimeout(()=>{t?i():r()},150)},className:"w-8 h-8 flex-none flex items-center justify-center rounded-full bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text-secondary)] hover:brightness-90 transition-all","aria-label":"Close dialog",children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:K.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})});return K.jsx(ed,{id:"wallet-sign-dialog-portal",children:K.jsx("div",{"data-wallet-theme":!0,"data-wallet-ui":!0,"data-theme":m,children:K.jsx(Cx,{className:"grid place-items-center px-4 z-[100] transition-opacity duration-150 ease-in-out bg-[var(--wui-color-overlay)] data-[state=starting]:opacity-0 data-[state=exiting]:opacity-0 data-[state=entered]:opacity-100","data-state":d,lockScroll:!0,children:K.jsx(Mf,{context:k,modal:!0,children:K.jsx("div",{ref:w.setFloating,...T({"aria-labelledby":b,"aria-describedby":R}),role:"alertdialog","data-state":d,className:"w-full max-w-md rounded-3xl bg-[var(--wui-color-bg)] shadow-xl transform transition-all duration-150 ease-in-out data-[state=starting]:opacity-0 data-[state=starting]:scale-90 data-[state=exiting]:opacity-0 data-[state=exiting]:scale-90 data-[state=entered]:opacity-100 data-[state=entered]:scale-100",style:{marginTop:"-0.5rem"},children:K.jsx(OP,{transactions:n,message:e,dangerous:t,algodClient:l,getApplicationAddress:G=>Xd(BigInt(G)),onApprove:()=>{f("exiting"),setTimeout(()=>r(),150)},onReject:()=>{f("exiting"),setTimeout(()=>i(),150)},signing:s,walletName:a,headerAction:L})})})})})})}function qP({transactionCount:n,dangerous:e,onReject:t}){const{theme:r}=Oi(),i=r==="system"?void 0:r;return K.jsx(ed,{id:"wallet-extension-indicator-portal",children:K.jsx("div",{"data-wallet-theme":!0,"data-wallet-ui":!0,"data-theme":i,children:K.jsxs("div",{className:"fixed bottom-4 right-4 z-[100] flex items-center gap-3 rounded-2xl bg-[var(--wui-color-bg)] shadow-lg border border-[var(--wui-color-border)] px-4 py-3 max-w-sm",children:[K.jsxs("svg",{className:"animate-spin h-5 w-5 text-[var(--wui-color-primary)] flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[K.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),K.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),K.jsxs("div",{className:"flex flex-col min-w-0",children:[K.jsxs("span",{className:`text-sm font-medium ${e?"text-[var(--wui-color-danger-text)]":"text-[var(--wui-color-text)]"}`,children:["Review ",n>1?`${n} transactions`:"transaction"," in extension",e&&" (dangerous)"]}),K.jsx("span",{className:"text-xs text-[var(--wui-color-text-tertiary)]",children:"Open the Liquid Wallet Companion popup"})]}),K.jsx("button",{onClick:t,className:"ml-auto flex-shrink-0 text-xs px-2.5 py-1 rounded-lg bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text-secondary)] hover:brightness-90 transition-all",children:"Cancel"})]})})})}function HP({algorandAddress:n,evmAddress:e,onDismiss:t}){const{theme:r}=Oi(),[i,o]=ce.useState("starting"),s=()=>{o("exiting"),setTimeout(()=>t(),150)},a=r==="system"?void 0:r,{refs:l,context:c}=Cf({open:!0,onOpenChange:I=>{I||s()}}),d=Rf(c,{outsidePressEvent:"mousedown"}),f=Px(c,{role:"dialog"}),{getFloatingProps:m}=Pf([d,f]),w=Di(),k=Di();return i==="starting"&&requestAnimationFrame(()=>o("entered")),K.jsx(ed,{id:"wallet-welcome-dialog-portal",children:K.jsx("div",{"data-wallet-theme":!0,"data-wallet-ui":!0,"data-theme":a,children:K.jsx(Cx,{className:"grid place-items-center px-4 z-[100] transition-opacity duration-150 ease-in-out bg-[var(--wui-color-overlay)] data-[state=starting]:opacity-0 data-[state=exiting]:opacity-0 data-[state=entered]:opacity-100","data-state":i,lockScroll:!0,children:K.jsx(Mf,{context:c,modal:!0,children:K.jsx("div",{ref:l.setFloating,...m({"aria-labelledby":w,"aria-describedby":k}),role:"dialog","data-state":i,className:"w-full max-w-md rounded-3xl bg-[var(--wui-color-bg)] shadow-xl transform transition-all duration-150 ease-in-out data-[state=starting]:opacity-0 data-[state=starting]:scale-90 data-[state=exiting]:opacity-0 data-[state=exiting]:scale-90 data-[state=entered]:opacity-100 data-[state=entered]:scale-100",style:{marginTop:"-0.5rem"},children:K.jsx(_P,{algorandAddress:n,evmAddress:e,onClose:s,labelId:w,descriptionId:k})})})})})})}function A2(n){const[e,t]=ce.useState(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return ce.useEffect(()=>{if(n!=="system")return;const r=window.matchMedia("(prefers-color-scheme: dark)");t(r.matches?"dark":"light");const i=o=>{t(o.matches?"dark":"light")};return r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[n]),n==="system"?e:n}var GP=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Dp=Math.ceil,Or=Math.floor,Sr="[BigNumber Error] ",Y1=Sr+"Number primitive has more than 15 significant digits: ",Qr=1e14,Zt=14,X1=9007199254740991,Fp=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],yo=1e7,Dr=1e9;function D2(n){var e,t,r,i=b.prototype={constructor:b,toString:null,valueOf:null},o=new b(1),s=20,a=4,l=-7,c=21,d=-1e7,f=1e7,m=!1,w=1,k=0,I={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function b(p,F){var v,O,C,V,H,_,ee,oe,z=this;if(!(z instanceof b))return new b(p,F);if(F==null){if(p&&p._isBigNumber===!0){z.s=p.s,!p.c||p.e>f?z.c=z.e=null:p.e<d?z.c=[z.e=0]:(z.e=p.e,z.c=p.c.slice());return}if((_=typeof p=="number")&&p*0==0){if(z.s=1/p<0?(p=-p,-1):1,p===~~p){for(V=0,H=p;H>=10;H/=10,V++);V>f?z.c=z.e=null:(z.e=V,z.c=[p]);return}oe=String(p)}else{if(!GP.test(oe=String(p)))return r(z,oe,_);z.s=oe.charCodeAt(0)==45?(oe=oe.slice(1),-1):1}(V=oe.indexOf("."))>-1&&(oe=oe.replace(".","")),(H=oe.search(/e/i))>0?(V<0&&(V=H),V+=+oe.slice(H+1),oe=oe.substring(0,H)):V<0&&(V=oe.length)}else{if(Dn(F,2,x.length,"Base"),F==10&&T)return z=new b(p),E(z,s+z.e+1,a);if(oe=String(p),_=typeof p=="number"){if(p*0!=0)return r(z,oe,_,F);if(z.s=1/p<0?(oe=oe.slice(1),-1):1,b.DEBUG&&oe.replace(/^0\.0*|\./,"").length>15)throw Error(Y1+p)}else z.s=oe.charCodeAt(0)===45?(oe=oe.slice(1),-1):1;for(v=x.slice(0,F),V=H=0,ee=oe.length;H<ee;H++)if(v.indexOf(O=oe.charAt(H))<0){if(O=="."){if(H>V){V=ee;continue}}else if(!C&&(oe==oe.toUpperCase()&&(oe=oe.toLowerCase())||oe==oe.toLowerCase()&&(oe=oe.toUpperCase()))){C=!0,H=-1,V=0;continue}return r(z,String(p),_,F)}_=!1,oe=t(oe,F,10,z.s),(V=oe.indexOf("."))>-1?oe=oe.replace(".",""):V=oe.length}for(H=0;oe.charCodeAt(H)===48;H++);for(ee=oe.length;oe.charCodeAt(--ee)===48;);if(oe=oe.slice(H,++ee)){if(ee-=H,_&&b.DEBUG&&ee>15&&(p>X1||p!==Or(p)))throw Error(Y1+z.s*p);if((V=V-H-1)>f)z.c=z.e=null;else if(V<d)z.c=[z.e=0];else{if(z.e=V,z.c=[],H=(V+1)%Zt,V<0&&(H+=Zt),H<ee){for(H&&z.c.push(+oe.slice(0,H)),ee-=Zt;H<ee;)z.c.push(+oe.slice(H,H+=Zt));H=Zt-(oe=oe.slice(H)).length}else H-=ee;for(;H--;oe+="0");z.c.push(+oe)}}else z.c=[z.e=0]}b.clone=D2,b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.EUCLID=9,b.config=b.set=function(p){var F,v;if(p!=null)if(typeof p=="object"){if(p.hasOwnProperty(F="DECIMAL_PLACES")&&(v=p[F],Dn(v,0,Dr,F),s=v),p.hasOwnProperty(F="ROUNDING_MODE")&&(v=p[F],Dn(v,0,8,F),a=v),p.hasOwnProperty(F="EXPONENTIAL_AT")&&(v=p[F],v&&v.pop?(Dn(v[0],-1e9,0,F),Dn(v[1],0,Dr,F),l=v[0],c=v[1]):(Dn(v,-1e9,Dr,F),l=-(c=v<0?-v:v))),p.hasOwnProperty(F="RANGE"))if(v=p[F],v&&v.pop)Dn(v[0],-1e9,-1,F),Dn(v[1],1,Dr,F),d=v[0],f=v[1];else if(Dn(v,-1e9,Dr,F),v)d=-(f=v<0?-v:v);else throw Error(Sr+F+" cannot be zero: "+v);if(p.hasOwnProperty(F="CRYPTO"))if(v=p[F],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))m=v;else throw m=!v,Error(Sr+"crypto unavailable");else m=v;else throw Error(Sr+F+" not true or false: "+v);if(p.hasOwnProperty(F="MODULO_MODE")&&(v=p[F],Dn(v,0,9,F),w=v),p.hasOwnProperty(F="POW_PRECISION")&&(v=p[F],Dn(v,0,Dr,F),k=v),p.hasOwnProperty(F="FORMAT"))if(v=p[F],typeof v=="object")I=v;else throw Error(Sr+F+" not an object: "+v);if(p.hasOwnProperty(F="ALPHABET"))if(v=p[F],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))T=v.slice(0,10)=="0123456789",x=v;else throw Error(Sr+F+" invalid: "+v)}else throw Error(Sr+"Object expected: "+p);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[l,c],RANGE:[d,f],CRYPTO:m,MODULO_MODE:w,POW_PRECISION:k,FORMAT:I,ALPHABET:x}},b.isBigNumber=function(p){if(!p||p._isBigNumber!==!0)return!1;if(!b.DEBUG)return!0;var F,v,O=p.c,C=p.e,V=p.s;e:if({}.toString.call(O)=="[object Array]"){if((V===1||V===-1)&&C>=-1e9&&C<=Dr&&C===Or(C)){if(O[0]===0){if(C===0&&O.length===1)return!0;break e}if(F=(C+1)%Zt,F<1&&(F+=Zt),String(O[0]).length==F){for(F=0;F<O.length;F++)if(v=O[F],v<0||v>=Qr||v!==Or(v))break e;if(v!==0)return!0}}}else if(O===null&&C===null&&(V===null||V===1||V===-1))return!0;throw Error(Sr+"Invalid BigNumber: "+p)},b.maximum=b.max=function(){return L(arguments,-1)},b.minimum=b.min=function(){return L(arguments,1)},b.random=(function(){var p=9007199254740992,F=Math.random()*p&2097151?function(){return Or(Math.random()*p)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var O,C,V,H,_,ee=0,oe=[],z=new b(o);if(v==null?v=s:Dn(v,0,Dr),H=Dp(v/Zt),m)if(crypto.getRandomValues){for(O=crypto.getRandomValues(new Uint32Array(H*=2));ee<H;)_=O[ee]*131072+(O[ee+1]>>>11),_>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),O[ee]=C[0],O[ee+1]=C[1]):(oe.push(_%1e14),ee+=2);ee=H/2}else if(crypto.randomBytes){for(O=crypto.randomBytes(H*=7);ee<H;)_=(O[ee]&31)*281474976710656+O[ee+1]*1099511627776+O[ee+2]*4294967296+O[ee+3]*16777216+(O[ee+4]<<16)+(O[ee+5]<<8)+O[ee+6],_>=9e15?crypto.randomBytes(7).copy(O,ee):(oe.push(_%1e14),ee+=7);ee=H/7}else throw m=!1,Error(Sr+"crypto unavailable");if(!m)for(;ee<H;)_=F(),_<9e15&&(oe[ee++]=_%1e14);for(H=oe[--ee],v%=Zt,H&&v&&(_=Fp[Zt-v],oe[ee]=Or(H/_)*_);oe[ee]===0;oe.pop(),ee--);if(ee<0)oe=[V=0];else{for(V=-1;oe[0]===0;oe.splice(0,1),V-=Zt);for(ee=1,_=oe[0];_>=10;_/=10,ee++);ee<Zt&&(V-=Zt-ee)}return z.e=V,z.c=oe,z}})(),b.sum=function(){for(var p=1,F=arguments,v=new b(F[0]);p<F.length;)v=v.plus(F[p++]);return v},t=(function(){var p="0123456789";function F(v,O,C,V){for(var H,_=[0],ee,oe=0,z=v.length;oe<z;){for(ee=_.length;ee--;_[ee]*=O);for(_[0]+=V.indexOf(v.charAt(oe++)),H=0;H<_.length;H++)_[H]>C-1&&(_[H+1]==null&&(_[H+1]=0),_[H+1]+=_[H]/C|0,_[H]%=C)}return _.reverse()}return function(v,O,C,V,H){var _,ee,oe,z,ue,De,ve,Te,de=v.indexOf("."),ie=s,ke=a;for(de>=0&&(z=k,k=0,v=v.replace(".",""),Te=new b(O),De=Te.pow(v.length-de),k=z,Te.c=F(Ui(Br(De.c),De.e,"0"),10,C,p),Te.e=Te.c.length),ve=F(v,O,C,H?(_=x,p):(_=p,x)),oe=z=ve.length;ve[--z]==0;ve.pop());if(!ve[0])return _.charAt(0);if(de<0?--oe:(De.c=ve,De.e=oe,De.s=V,De=e(De,Te,ie,ke,C),ve=De.c,ue=De.r,oe=De.e),ee=oe+ie+1,de=ve[ee],z=C/2,ue=ue||ee<0||ve[ee+1]!=null,ue=ke<4?(de!=null||ue)&&(ke==0||ke==(De.s<0?3:2)):de>z||de==z&&(ke==4||ue||ke==6&&ve[ee-1]&1||ke==(De.s<0?8:7)),ee<1||!ve[0])v=ue?Ui(_.charAt(1),-ie,_.charAt(0)):_.charAt(0);else{if(ve.length=ee,ue)for(--C;++ve[--ee]>C;)ve[ee]=0,ee||(++oe,ve=[1].concat(ve));for(z=ve.length;!ve[--z];);for(de=0,v="";de<=z;v+=_.charAt(ve[de++]));v=Ui(v,oe,_.charAt(0))}return v}})(),e=(function(){function p(O,C,V){var H,_,ee,oe,z=0,ue=O.length,De=C%yo,ve=C/yo|0;for(O=O.slice();ue--;)ee=O[ue]%yo,oe=O[ue]/yo|0,H=ve*ee+oe*De,_=De*ee+H%yo*yo+z,z=(_/V|0)+(H/yo|0)+ve*oe,O[ue]=_%V;return z&&(O=[z].concat(O)),O}function F(O,C,V,H){var _,ee;if(V!=H)ee=V>H?1:-1;else for(_=ee=0;_<V;_++)if(O[_]!=C[_]){ee=O[_]>C[_]?1:-1;break}return ee}function v(O,C,V,H){for(var _=0;V--;)O[V]-=_,_=O[V]<C[V]?1:0,O[V]=_*H+O[V]-C[V];for(;!O[0]&&O.length>1;O.splice(0,1));}return function(O,C,V,H,_){var ee,oe,z,ue,De,ve,Te,de,ie,ke,Ie,Ze,Ee,be,g,A,M,W=O.s==C.s?1:-1,U=O.c,q=C.c;if(!U||!U[0]||!q||!q[0])return new b(!O.s||!C.s||(U?q&&U[0]==q[0]:!q)?NaN:U&&U[0]==0||!q?W*0:W/0);for(de=new b(W),ie=de.c=[],oe=O.e-C.e,W=V+oe+1,_||(_=Qr,oe=Nr(O.e/Zt)-Nr(C.e/Zt),W=W/Zt|0),z=0;q[z]==(U[z]||0);z++);if(q[z]>(U[z]||0)&&oe--,W<0)ie.push(1),ue=!0;else{for(be=U.length,A=q.length,z=0,W+=2,De=Or(_/(q[0]+1)),De>1&&(q=p(q,De,_),U=p(U,De,_),A=q.length,be=U.length),Ee=A,ke=U.slice(0,A),Ie=ke.length;Ie<A;ke[Ie++]=0);M=q.slice(),M=[0].concat(M),g=q[0],q[1]>=_/2&&g++;do{if(De=0,ee=F(q,ke,A,Ie),ee<0){if(Ze=ke[0],A!=Ie&&(Ze=Ze*_+(ke[1]||0)),De=Or(Ze/g),De>1)for(De>=_&&(De=_-1),ve=p(q,De,_),Te=ve.length,Ie=ke.length;F(ve,ke,Te,Ie)==1;)De--,v(ve,A<Te?M:q,Te,_),Te=ve.length,ee=1;else De==0&&(ee=De=1),ve=q.slice(),Te=ve.length;if(Te<Ie&&(ve=[0].concat(ve)),v(ke,ve,Ie,_),Ie=ke.length,ee==-1)for(;F(q,ke,A,Ie)<1;)De++,v(ke,A<Ie?M:q,Ie,_),Ie=ke.length}else ee===0&&(De++,ke=[0]);ie[z++]=De,ke[0]?ke[Ie++]=U[Ee]||0:(ke=[U[Ee]],Ie=1)}while((Ee++<be||ke[0]!=null)&&W--);ue=ke[0]!=null,ie[0]||ie.splice(0,1)}if(_==Qr){for(z=1,W=ie[0];W>=10;W/=10,z++);E(de,V+(de.e=z+oe*Zt-1)+1,H,ue)}else de.e=oe,de.r=+ue;return de}})();function R(p,F,v,O){var C,V,H,_,ee;if(v==null?v=a:Dn(v,0,8),!p.c)return p.toString();if(C=p.c[0],H=p.e,F==null)ee=Br(p.c),ee=O==1||O==2&&(H<=l||H>=c)?md(ee,H):Ui(ee,H,"0");else if(p=E(new b(p),F,v),V=p.e,ee=Br(p.c),_=ee.length,O==1||O==2&&(F<=V||V<=l)){for(;_<F;ee+="0",_++);ee=md(ee,V)}else if(F-=H,ee=Ui(ee,V,"0"),V+1>_){if(--F>0)for(ee+=".";F--;ee+="0");}else if(F+=V-_,F>0)for(V+1==_&&(ee+=".");F--;ee+="0");return p.s<0&&C?"-"+ee:ee}function L(p,F){for(var v,O,C=1,V=new b(p[0]);C<p.length;C++)O=new b(p[C]),(!O.s||(v=fs(V,O))===F||v===0&&V.s===F)&&(V=O);return V}function G(p,F,v){for(var O=1,C=F.length;!F[--C];F.pop());for(C=F[0];C>=10;C/=10,O++);return(v=O+v*Zt-1)>f?p.c=p.e=null:v<d?p.c=[p.e=0]:(p.e=v,p.c=F),p}r=(function(){var p=/^(-?)0([xbo])(?=\w[\w.]*$)/i,F=/^([^.]+)\.$/,v=/^\.([^.]+)$/,O=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(V,H,_,ee){var oe,z=_?H:H.replace(C,"");if(O.test(z))V.s=isNaN(z)?null:z<0?-1:1;else{if(!_&&(z=z.replace(p,function(ue,De,ve){return oe=(ve=ve.toLowerCase())=="x"?16:ve=="b"?2:8,!ee||ee==oe?De:ue}),ee&&(oe=ee,z=z.replace(F,"$1").replace(v,"0.$1")),H!=z))return new b(z,oe);if(b.DEBUG)throw Error(Sr+"Not a"+(ee?" base "+ee:"")+" number: "+H);V.s=null}V.c=V.e=null}})();function E(p,F,v,O){var C,V,H,_,ee,oe,z,ue=p.c,De=Fp;if(ue){e:{for(C=1,_=ue[0];_>=10;_/=10,C++);if(V=F-C,V<0)V+=Zt,H=F,ee=ue[oe=0],z=Or(ee/De[C-H-1]%10);else if(oe=Dp((V+1)/Zt),oe>=ue.length)if(O){for(;ue.length<=oe;ue.push(0));ee=z=0,C=1,V%=Zt,H=V-Zt+1}else break e;else{for(ee=_=ue[oe],C=1;_>=10;_/=10,C++);V%=Zt,H=V-Zt+C,z=H<0?0:Or(ee/De[C-H-1]%10)}if(O=O||F<0||ue[oe+1]!=null||(H<0?ee:ee%De[C-H-1]),O=v<4?(z||O)&&(v==0||v==(p.s<0?3:2)):z>5||z==5&&(v==4||O||v==6&&(V>0?H>0?ee/De[C-H]:0:ue[oe-1])%10&1||v==(p.s<0?8:7)),F<1||!ue[0])return ue.length=0,O?(F-=p.e+1,ue[0]=De[(Zt-F%Zt)%Zt],p.e=-F||0):ue[0]=p.e=0,p;if(V==0?(ue.length=oe,_=1,oe--):(ue.length=oe+1,_=De[Zt-V],ue[oe]=H>0?Or(ee/De[C-H]%De[H])*_:0),O)for(;;)if(oe==0){for(V=1,H=ue[0];H>=10;H/=10,V++);for(H=ue[0]+=_,_=1;H>=10;H/=10,_++);V!=_&&(p.e++,ue[0]==Qr&&(ue[0]=1));break}else{if(ue[oe]+=_,ue[oe]!=Qr)break;ue[oe--]=0,_=1}for(V=ue.length;ue[--V]===0;ue.pop());}p.e>f?p.c=p.e=null:p.e<d&&(p.c=[p.e=0])}return p}function N(p){var F,v=p.e;return v===null?p.toString():(F=Br(p.c),F=v<=l||v>=c?md(F,v):Ui(F,v,"0"),p.s<0?"-"+F:F)}return i.absoluteValue=i.abs=function(){var p=new b(this);return p.s<0&&(p.s=1),p},i.comparedTo=function(p,F){return fs(this,new b(p,F))},i.decimalPlaces=i.dp=function(p,F){var v,O,C,V=this;if(p!=null)return Dn(p,0,Dr),F==null?F=a:Dn(F,0,8),E(new b(V),p+V.e+1,F);if(!(v=V.c))return null;if(O=((C=v.length-1)-Nr(this.e/Zt))*Zt,C=v[C])for(;C%10==0;C/=10,O--);return O<0&&(O=0),O},i.dividedBy=i.div=function(p,F){return e(this,new b(p,F),s,a)},i.dividedToIntegerBy=i.idiv=function(p,F){return e(this,new b(p,F),0,1)},i.exponentiatedBy=i.pow=function(p,F){var v,O,C,V,H,_,ee,oe,z,ue=this;if(p=new b(p),p.c&&!p.isInteger())throw Error(Sr+"Exponent not an integer: "+N(p));if(F!=null&&(F=new b(F)),_=p.e>14,!ue.c||!ue.c[0]||ue.c[0]==1&&!ue.e&&ue.c.length==1||!p.c||!p.c[0])return z=new b(Math.pow(+N(ue),_?p.s*(2-pd(p)):+N(p))),F?z.mod(F):z;if(ee=p.s<0,F){if(F.c?!F.c[0]:!F.s)return new b(NaN);O=!ee&&ue.isInteger()&&F.isInteger(),O&&(ue=ue.mod(F))}else{if(p.e>9&&(ue.e>0||ue.e<-1||(ue.e==0?ue.c[0]>1||_&&ue.c[1]>=24e7:ue.c[0]<8e13||_&&ue.c[0]<=9999975e7)))return V=ue.s<0&&pd(p)?-0:0,ue.e>-1&&(V=1/V),new b(ee?1/V:V);k&&(V=Dp(k/Zt+2))}for(_?(v=new b(.5),ee&&(p.s=1),oe=pd(p)):(C=Math.abs(+N(p)),oe=C%2),z=new b(o);;){if(oe){if(z=z.times(ue),!z.c)break;V?z.c.length>V&&(z.c.length=V):O&&(z=z.mod(F))}if(C){if(C=Or(C/2),C===0)break;oe=C%2}else if(p=p.times(v),E(p,p.e+1,1),p.e>14)oe=pd(p);else{if(C=+N(p),C===0)break;oe=C%2}ue=ue.times(ue),V?ue.c&&ue.c.length>V&&(ue.c.length=V):O&&(ue=ue.mod(F))}return O?z:(ee&&(z=o.div(z)),F?z.mod(F):V?E(z,k,a,H):z)},i.integerValue=function(p){var F=new b(this);return p==null?p=a:Dn(p,0,8),E(F,F.e+1,p)},i.isEqualTo=i.eq=function(p,F){return fs(this,new b(p,F))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(p,F){return fs(this,new b(p,F))>0},i.isGreaterThanOrEqualTo=i.gte=function(p,F){return(F=fs(this,new b(p,F)))===1||F===0},i.isInteger=function(){return!!this.c&&Nr(this.e/Zt)>this.c.length-2},i.isLessThan=i.lt=function(p,F){return fs(this,new b(p,F))<0},i.isLessThanOrEqualTo=i.lte=function(p,F){return(F=fs(this,new b(p,F)))===-1||F===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(p,F){var v,O,C,V,H=this,_=H.s;if(p=new b(p,F),F=p.s,!_||!F)return new b(NaN);if(_!=F)return p.s=-F,H.plus(p);var ee=H.e/Zt,oe=p.e/Zt,z=H.c,ue=p.c;if(!ee||!oe){if(!z||!ue)return z?(p.s=-F,p):new b(ue?H:NaN);if(!z[0]||!ue[0])return ue[0]?(p.s=-F,p):new b(z[0]?H:a==3?-0:0)}if(ee=Nr(ee),oe=Nr(oe),z=z.slice(),_=ee-oe){for((V=_<0)?(_=-_,C=z):(oe=ee,C=ue),C.reverse(),F=_;F--;C.push(0));C.reverse()}else for(O=(V=(_=z.length)<(F=ue.length))?_:F,_=F=0;F<O;F++)if(z[F]!=ue[F]){V=z[F]<ue[F];break}if(V&&(C=z,z=ue,ue=C,p.s=-p.s),F=(O=ue.length)-(v=z.length),F>0)for(;F--;z[v++]=0);for(F=Qr-1;O>_;){if(z[--O]<ue[O]){for(v=O;v&&!z[--v];z[v]=F);--z[v],z[O]+=Qr}z[O]-=ue[O]}for(;z[0]==0;z.splice(0,1),--oe);return z[0]?G(p,z,oe):(p.s=a==3?-1:1,p.c=[p.e=0],p)},i.modulo=i.mod=function(p,F){var v,O,C=this;return p=new b(p,F),!C.c||!p.s||p.c&&!p.c[0]?new b(NaN):!p.c||C.c&&!C.c[0]?new b(C):(w==9?(O=p.s,p.s=1,v=e(C,p,0,3),p.s=O,v.s*=O):v=e(C,p,0,w),p=C.minus(v.times(p)),!p.c[0]&&w==1&&(p.s=C.s),p)},i.multipliedBy=i.times=function(p,F){var v,O,C,V,H,_,ee,oe,z,ue,De,ve,Te,de,ie,ke=this,Ie=ke.c,Ze=(p=new b(p,F)).c;if(!Ie||!Ze||!Ie[0]||!Ze[0])return!ke.s||!p.s||Ie&&!Ie[0]&&!Ze||Ze&&!Ze[0]&&!Ie?p.c=p.e=p.s=null:(p.s*=ke.s,!Ie||!Ze?p.c=p.e=null:(p.c=[0],p.e=0)),p;for(O=Nr(ke.e/Zt)+Nr(p.e/Zt),p.s*=ke.s,ee=Ie.length,ue=Ze.length,ee<ue&&(Te=Ie,Ie=Ze,Ze=Te,C=ee,ee=ue,ue=C),C=ee+ue,Te=[];C--;Te.push(0));for(de=Qr,ie=yo,C=ue;--C>=0;){for(v=0,De=Ze[C]%ie,ve=Ze[C]/ie|0,H=ee,V=C+H;V>C;)oe=Ie[--H]%ie,z=Ie[H]/ie|0,_=ve*oe+z*De,oe=De*oe+_%ie*ie+Te[V]+v,v=(oe/de|0)+(_/ie|0)+ve*z,Te[V--]=oe%de;Te[V]=v}return v?++O:Te.splice(0,1),G(p,Te,O)},i.negated=function(){var p=new b(this);return p.s=-p.s||null,p},i.plus=function(p,F){var v,O=this,C=O.s;if(p=new b(p,F),F=p.s,!C||!F)return new b(NaN);if(C!=F)return p.s=-F,O.minus(p);var V=O.e/Zt,H=p.e/Zt,_=O.c,ee=p.c;if(!V||!H){if(!_||!ee)return new b(C/0);if(!_[0]||!ee[0])return ee[0]?p:new b(_[0]?O:C*0)}if(V=Nr(V),H=Nr(H),_=_.slice(),C=V-H){for(C>0?(H=V,v=ee):(C=-C,v=_),v.reverse();C--;v.push(0));v.reverse()}for(C=_.length,F=ee.length,C-F<0&&(v=ee,ee=_,_=v,F=C),C=0;F;)C=(_[--F]=_[F]+ee[F]+C)/Qr|0,_[F]=Qr===_[F]?0:_[F]%Qr;return C&&(_=[C].concat(_),++H),G(p,_,H)},i.precision=i.sd=function(p,F){var v,O,C,V=this;if(p!=null&&p!==!!p)return Dn(p,1,Dr),F==null?F=a:Dn(F,0,8),E(new b(V),p,F);if(!(v=V.c))return null;if(C=v.length-1,O=C*Zt+1,C=v[C]){for(;C%10==0;C/=10,O--);for(C=v[0];C>=10;C/=10,O++);}return p&&V.e+1>O&&(O=V.e+1),O},i.shiftedBy=function(p){return Dn(p,-9007199254740991,X1),this.times("1e"+p)},i.squareRoot=i.sqrt=function(){var p,F,v,O,C,V=this,H=V.c,_=V.s,ee=V.e,oe=s+4,z=new b("0.5");if(_!==1||!H||!H[0])return new b(!_||_<0&&(!H||H[0])?NaN:H?V:1/0);if(_=Math.sqrt(+N(V)),_==0||_==1/0?(F=Br(H),(F.length+ee)%2==0&&(F+="0"),_=Math.sqrt(+F),ee=Nr((ee+1)/2)-(ee<0||ee%2),_==1/0?F="5e"+ee:(F=_.toExponential(),F=F.slice(0,F.indexOf("e")+1)+ee),v=new b(F)):v=new b(_+""),v.c[0]){for(ee=v.e,_=ee+oe,_<3&&(_=0);;)if(C=v,v=z.times(C.plus(e(V,C,oe,1))),Br(C.c).slice(0,_)===(F=Br(v.c)).slice(0,_))if(v.e<ee&&--_,F=F.slice(_-3,_+1),F=="9999"||!O&&F=="4999"){if(!O&&(E(C,C.e+s+2,0),C.times(C).eq(V))){v=C;break}oe+=4,_+=4,O=1}else{(!+F||!+F.slice(1)&&F.charAt(0)=="5")&&(E(v,v.e+s+2,1),p=!v.times(v).eq(V));break}}return E(v,v.e+s+1,a,p)},i.toExponential=function(p,F){return p!=null&&(Dn(p,0,Dr),p++),R(this,p,F,1)},i.toFixed=function(p,F){return p!=null&&(Dn(p,0,Dr),p=p+this.e+1),R(this,p,F)},i.toFormat=function(p,F,v){var O,C=this;if(v==null)p!=null&&F&&typeof F=="object"?(v=F,F=null):p&&typeof p=="object"?(v=p,p=F=null):v=I;else if(typeof v!="object")throw Error(Sr+"Argument not an object: "+v);if(O=C.toFixed(p,F),C.c){var V,H=O.split("."),_=+v.groupSize,ee=+v.secondaryGroupSize,oe=v.groupSeparator||"",z=H[0],ue=H[1],De=C.s<0,ve=De?z.slice(1):z,Te=ve.length;if(ee&&(V=_,_=ee,ee=V,Te-=V),_>0&&Te>0){for(V=Te%_||_,z=ve.substr(0,V);V<Te;V+=_)z+=oe+ve.substr(V,_);ee>0&&(z+=oe+ve.slice(V)),De&&(z="-"+z)}O=ue?z+(v.decimalSeparator||"")+((ee=+v.fractionGroupSize)?ue.replace(new RegExp("\\d{"+ee+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):ue):z}return(v.prefix||"")+O+(v.suffix||"")},i.toFraction=function(p){var F,v,O,C,V,H,_,ee,oe,z,ue,De,ve=this,Te=ve.c;if(p!=null&&(_=new b(p),!_.isInteger()&&(_.c||_.s!==1)||_.lt(o)))throw Error(Sr+"Argument "+(_.isInteger()?"out of range: ":"not an integer: ")+N(_));if(!Te)return new b(ve);for(F=new b(o),oe=v=new b(o),O=ee=new b(o),De=Br(Te),V=F.e=De.length-ve.e-1,F.c[0]=Fp[(H=V%Zt)<0?Zt+H:H],p=!p||_.comparedTo(F)>0?V>0?F:oe:_,H=f,f=1/0,_=new b(De),ee.c[0]=0;z=e(_,F,0,1),C=v.plus(z.times(O)),C.comparedTo(p)!=1;)v=O,O=C,oe=ee.plus(z.times(C=oe)),ee=C,F=_.minus(z.times(C=F)),_=C;return C=e(p.minus(v),O,0,1),ee=ee.plus(C.times(oe)),v=v.plus(C.times(O)),ee.s=oe.s=ve.s,V=V*2,ue=e(oe,O,V,a).minus(ve).abs().comparedTo(e(ee,v,V,a).minus(ve).abs())<1?[oe,O]:[ee,v],f=H,ue},i.toNumber=function(){return+N(this)},i.toPrecision=function(p,F){return p!=null&&Dn(p,1,Dr),R(this,p,F,2)},i.toString=function(p){var F,v=this,O=v.s,C=v.e;return C===null?O?(F="Infinity",O<0&&(F="-"+F)):F="NaN":(p==null?F=C<=l||C>=c?md(Br(v.c),C):Ui(Br(v.c),C,"0"):p===10&&T?(v=E(new b(v),s+C+1,a),F=Ui(Br(v.c),v.e,"0")):(Dn(p,2,x.length,"Base"),F=t(Ui(Br(v.c),C,"0"),10,p,O,!0)),O<0&&v.c[0]&&(F="-"+F)),F},i.valueOf=i.toJSON=function(){return N(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,n!=null&&b.set(n),b}function Nr(n){var e=n|0;return n>0||n===e?e:e-1}function Br(n){for(var e,t,r=1,i=n.length,o=n[0]+"";r<i;){for(e=n[r++]+"",t=Zt-e.length;t--;e="0"+e);o+=e}for(i=o.length;o.charCodeAt(--i)===48;);return o.slice(0,i+1||1)}function fs(n,e){var t,r,i=n.c,o=e.c,s=n.s,a=e.s,l=n.e,c=e.e;if(!s||!a)return null;if(t=i&&!i[0],r=o&&!o[0],t||r)return t?r?0:-a:s;if(s!=a)return s;if(t=s<0,r=l==c,!i||!o)return r?0:!i^t?1:-1;if(!r)return l>c^t?1:-1;for(a=(l=i.length)<(c=o.length)?l:c,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^t?1:-1;return l==c?0:l>c^t?1:-1}function Dn(n,e,t,r){if(n<e||n>t||n!==Or(n))throw Error(Sr+(r||"Argument")+(typeof n=="number"?n<e||n>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(n))}function pd(n){var e=n.c.length-1;return Nr(n.e/Zt)==e&&n.c[e]%2!=0}function md(n,e){return(n.length>1?n.charAt(0)+"."+n.slice(1):n)+(e<0?"e":"e+")+e}function Ui(n,e,t){var r,i;if(e<0){for(i=t+".";++e;i+=t);n=i+n}else if(r=n.length,++e>r){for(i=t,e-=r;--e;i+=t);n+=i}else e<r&&(n=n.slice(0,e)+"."+n.slice(e));return n}D2();const KP=100000n,WP=(n,e={})=>{const{style:t="decimal",compact:r=!1,fractionDigits:i,adaptiveDecimals:o=!1}=e,s=typeof n=="string"?Number(n):n,a=typeof s=="bigint"?s<0n?-s:s:Math.abs(s),l=r==="auto"?a>=KP:r,c=typeof s=="bigint"?Number(s):s,d=o&&c!==0&&Math.abs(c)<Math.pow(10,-(i??2)),f=new Intl.NumberFormat("en-US",{style:t,...t==="currency"&&{currency:"USD"},maximumFractionDigits:d?20:i??2,minimumFractionDigits:d?0:i??2});if(!l)return d?f.format(Q1(c)):f.format(s);const m=[{threshold:1e12,suffix:"T",divisor:1e12},{threshold:1e9,suffix:"B",divisor:1e9},{threshold:1e6,suffix:"M",divisor:1e6},{threshold:1e3,suffix:"K",divisor:1e3}].find(w=>a>=w.threshold);if(m){const w=new Intl.NumberFormat("en-US",{style:t,...t==="currency"&&{currency:"USD"},maximumFractionDigits:i??1,minimumFractionDigits:i??1}),k=Number(s)/m.divisor;return w.format(k)+m.suffix}return d?f.format(Q1(c)):f.format(s)};function Q1(n){if(n===0)return 0;const e=n.toExponential().split("e"),t=parseInt(e[1]),r=Math.abs(t);return Number(n.toFixed(r))}function _r(n,e=5,t=5){return n?n.length<=e+t?n:`${n.slice(0,e)}...${n.slice(-t)}`:""}const JP={pay:"Payment",keyreg:"Key Registration",acfg:"Asset Config",axfer:"Asset Transfer",afrz:"Asset Freeze",appl:"Application Call",stpf:"State Proof",hb:"Heartbeat"};function YP(n){try{return _o.decodeUnsignedTransaction(n)}catch{try{return _o.decodeSignedTransaction(n).txn}catch{return null}}}function XP(n,e){return`${Number(n)/1e6} ALGO`}function QP(n){const e=[],t=[];let r=!1;for(let i=0;i<n.length;i++){const o=n[i];let s=null;if(o instanceof Uint8Array?s=YP(o):o instanceof _o.Transaction&&(s=o),s!=null&&s.rekeyTo&&(r="rekey"),!s)continue;const a=s.sender.toString(),l={index:i,type:s.type,typeLabel:JP[s.type]||s.type,sender:a,senderShort:_r(a,4,4)};if(s.rekeyTo){const c=s.rekeyTo.toString();l.rekeyTo=c,l.rekeyToShort=_r(c,4,4)}if(s.payment){const c=s.payment.receiver.toString();if(l.receiver=c,l.receiverShort=_r(c,4,4),l.amount=XP(s.payment.amount),s.payment.closeRemainderTo){const d=s.payment.closeRemainderTo.toString();l.closeRemainderTo=d,l.closeRemainderToShort=_r(d,4,4),r="closeTo"}}if(s.assetTransfer){const c=s.assetTransfer.receiver.toString();if(l.receiver=c,l.receiverShort=_r(c,4,4),l.rawAmount=s.assetTransfer.amount,l.amount=s.assetTransfer.amount.toString(),l.assetIndex=Number(s.assetTransfer.assetIndex),s.assetTransfer.closeRemainderTo){const d=s.assetTransfer.closeRemainderTo.toString();l.closeRemainderTo=d,l.closeRemainderToShort=_r(d,4,4),r="closeTo"}}if(s.assetConfig&&(l.assetIndex=Number(s.assetConfig.assetIndex)),s.assetFreeze){l.assetIndex=Number(s.assetFreeze.assetIndex);const c=s.assetFreeze.freezeAccount.toString();l.freezeTarget=c,l.freezeTargetShort=_r(c,4,4),l.isFreezing=s.assetFreeze.frozen}s.applicationCall&&(l.appIndex=Number(s.applicationCall.appIndex)),e.push(l),t.push(s)}return{transactions:t,decodedTransactions:e,dangerous:r}}var Tp={exports:{}},Z1;function ZP(){return Z1||(Z1=1,(function(n){(function(e){var t=function(h){var S,y=new Float64Array(16);if(h)for(S=0;S<h.length;S++)y[S]=h[S];return y},r=function(){throw new Error("no PRNG")},i=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),a=t([1]),l=t([56129,1]),c=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),f=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),m=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),w=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function k(h,S,y,u){h[S]=y>>24&255,h[S+1]=y>>16&255,h[S+2]=y>>8&255,h[S+3]=y&255,h[S+4]=u>>24&255,h[S+5]=u>>16&255,h[S+6]=u>>8&255,h[S+7]=u&255}function I(h,S,y,u,D){var Z,ne=0;for(Z=0;Z<D;Z++)ne|=h[S+Z]^y[u+Z];return(1&ne-1>>>8)-1}function x(h,S,y,u){return I(h,S,y,u,16)}function T(h,S,y,u){return I(h,S,y,u,32)}function b(h,S,y,u){for(var D=u[0]&255|(u[1]&255)<<8|(u[2]&255)<<16|(u[3]&255)<<24,Z=y[0]&255|(y[1]&255)<<8|(y[2]&255)<<16|(y[3]&255)<<24,ne=y[4]&255|(y[5]&255)<<8|(y[6]&255)<<16|(y[7]&255)<<24,pe=y[8]&255|(y[9]&255)<<8|(y[10]&255)<<16|(y[11]&255)<<24,Fe=y[12]&255|(y[13]&255)<<8|(y[14]&255)<<16|(y[15]&255)<<24,ze=u[4]&255|(u[5]&255)<<8|(u[6]&255)<<16|(u[7]&255)<<24,$e=S[0]&255|(S[1]&255)<<8|(S[2]&255)<<16|(S[3]&255)<<24,kt=S[4]&255|(S[5]&255)<<8|(S[6]&255)<<16|(S[7]&255)<<24,Oe=S[8]&255|(S[9]&255)<<8|(S[10]&255)<<16|(S[11]&255)<<24,nt=S[12]&255|(S[13]&255)<<8|(S[14]&255)<<16|(S[15]&255)<<24,rt=u[8]&255|(u[9]&255)<<8|(u[10]&255)<<16|(u[11]&255)<<24,dt=y[16]&255|(y[17]&255)<<8|(y[18]&255)<<16|(y[19]&255)<<24,ct=y[20]&255|(y[21]&255)<<8|(y[22]&255)<<16|(y[23]&255)<<24,it=y[24]&255|(y[25]&255)<<8|(y[26]&255)<<16|(y[27]&255)<<24,st=y[28]&255|(y[29]&255)<<8|(y[30]&255)<<16|(y[31]&255)<<24,ot=u[12]&255|(u[13]&255)<<8|(u[14]&255)<<16|(u[15]&255)<<24,Ue=D,Ge=Z,Be=ne,je=pe,_e=Fe,Re=ze,se=$e,ae=kt,we=Oe,ge=nt,me=rt,Ae=dt,Qe=ct,ft=it,pt=st,gt=ot,P,yt=0;yt<20;yt+=2)P=Ue+Qe|0,_e^=P<<7|P>>>25,P=_e+Ue|0,we^=P<<9|P>>>23,P=we+_e|0,Qe^=P<<13|P>>>19,P=Qe+we|0,Ue^=P<<18|P>>>14,P=Re+Ge|0,ge^=P<<7|P>>>25,P=ge+Re|0,ft^=P<<9|P>>>23,P=ft+ge|0,Ge^=P<<13|P>>>19,P=Ge+ft|0,Re^=P<<18|P>>>14,P=me+se|0,pt^=P<<7|P>>>25,P=pt+me|0,Be^=P<<9|P>>>23,P=Be+pt|0,se^=P<<13|P>>>19,P=se+Be|0,me^=P<<18|P>>>14,P=gt+Ae|0,je^=P<<7|P>>>25,P=je+gt|0,ae^=P<<9|P>>>23,P=ae+je|0,Ae^=P<<13|P>>>19,P=Ae+ae|0,gt^=P<<18|P>>>14,P=Ue+je|0,Ge^=P<<7|P>>>25,P=Ge+Ue|0,Be^=P<<9|P>>>23,P=Be+Ge|0,je^=P<<13|P>>>19,P=je+Be|0,Ue^=P<<18|P>>>14,P=Re+_e|0,se^=P<<7|P>>>25,P=se+Re|0,ae^=P<<9|P>>>23,P=ae+se|0,_e^=P<<13|P>>>19,P=_e+ae|0,Re^=P<<18|P>>>14,P=me+ge|0,Ae^=P<<7|P>>>25,P=Ae+me|0,we^=P<<9|P>>>23,P=we+Ae|0,ge^=P<<13|P>>>19,P=ge+we|0,me^=P<<18|P>>>14,P=gt+pt|0,Qe^=P<<7|P>>>25,P=Qe+gt|0,ft^=P<<9|P>>>23,P=ft+Qe|0,pt^=P<<13|P>>>19,P=pt+ft|0,gt^=P<<18|P>>>14;Ue=Ue+D|0,Ge=Ge+Z|0,Be=Be+ne|0,je=je+pe|0,_e=_e+Fe|0,Re=Re+ze|0,se=se+$e|0,ae=ae+kt|0,we=we+Oe|0,ge=ge+nt|0,me=me+rt|0,Ae=Ae+dt|0,Qe=Qe+ct|0,ft=ft+it|0,pt=pt+st|0,gt=gt+ot|0,h[0]=Ue>>>0&255,h[1]=Ue>>>8&255,h[2]=Ue>>>16&255,h[3]=Ue>>>24&255,h[4]=Ge>>>0&255,h[5]=Ge>>>8&255,h[6]=Ge>>>16&255,h[7]=Ge>>>24&255,h[8]=Be>>>0&255,h[9]=Be>>>8&255,h[10]=Be>>>16&255,h[11]=Be>>>24&255,h[12]=je>>>0&255,h[13]=je>>>8&255,h[14]=je>>>16&255,h[15]=je>>>24&255,h[16]=_e>>>0&255,h[17]=_e>>>8&255,h[18]=_e>>>16&255,h[19]=_e>>>24&255,h[20]=Re>>>0&255,h[21]=Re>>>8&255,h[22]=Re>>>16&255,h[23]=Re>>>24&255,h[24]=se>>>0&255,h[25]=se>>>8&255,h[26]=se>>>16&255,h[27]=se>>>24&255,h[28]=ae>>>0&255,h[29]=ae>>>8&255,h[30]=ae>>>16&255,h[31]=ae>>>24&255,h[32]=we>>>0&255,h[33]=we>>>8&255,h[34]=we>>>16&255,h[35]=we>>>24&255,h[36]=ge>>>0&255,h[37]=ge>>>8&255,h[38]=ge>>>16&255,h[39]=ge>>>24&255,h[40]=me>>>0&255,h[41]=me>>>8&255,h[42]=me>>>16&255,h[43]=me>>>24&255,h[44]=Ae>>>0&255,h[45]=Ae>>>8&255,h[46]=Ae>>>16&255,h[47]=Ae>>>24&255,h[48]=Qe>>>0&255,h[49]=Qe>>>8&255,h[50]=Qe>>>16&255,h[51]=Qe>>>24&255,h[52]=ft>>>0&255,h[53]=ft>>>8&255,h[54]=ft>>>16&255,h[55]=ft>>>24&255,h[56]=pt>>>0&255,h[57]=pt>>>8&255,h[58]=pt>>>16&255,h[59]=pt>>>24&255,h[60]=gt>>>0&255,h[61]=gt>>>8&255,h[62]=gt>>>16&255,h[63]=gt>>>24&255}function R(h,S,y,u){for(var D=u[0]&255|(u[1]&255)<<8|(u[2]&255)<<16|(u[3]&255)<<24,Z=y[0]&255|(y[1]&255)<<8|(y[2]&255)<<16|(y[3]&255)<<24,ne=y[4]&255|(y[5]&255)<<8|(y[6]&255)<<16|(y[7]&255)<<24,pe=y[8]&255|(y[9]&255)<<8|(y[10]&255)<<16|(y[11]&255)<<24,Fe=y[12]&255|(y[13]&255)<<8|(y[14]&255)<<16|(y[15]&255)<<24,ze=u[4]&255|(u[5]&255)<<8|(u[6]&255)<<16|(u[7]&255)<<24,$e=S[0]&255|(S[1]&255)<<8|(S[2]&255)<<16|(S[3]&255)<<24,kt=S[4]&255|(S[5]&255)<<8|(S[6]&255)<<16|(S[7]&255)<<24,Oe=S[8]&255|(S[9]&255)<<8|(S[10]&255)<<16|(S[11]&255)<<24,nt=S[12]&255|(S[13]&255)<<8|(S[14]&255)<<16|(S[15]&255)<<24,rt=u[8]&255|(u[9]&255)<<8|(u[10]&255)<<16|(u[11]&255)<<24,dt=y[16]&255|(y[17]&255)<<8|(y[18]&255)<<16|(y[19]&255)<<24,ct=y[20]&255|(y[21]&255)<<8|(y[22]&255)<<16|(y[23]&255)<<24,it=y[24]&255|(y[25]&255)<<8|(y[26]&255)<<16|(y[27]&255)<<24,st=y[28]&255|(y[29]&255)<<8|(y[30]&255)<<16|(y[31]&255)<<24,ot=u[12]&255|(u[13]&255)<<8|(u[14]&255)<<16|(u[15]&255)<<24,Ue=D,Ge=Z,Be=ne,je=pe,_e=Fe,Re=ze,se=$e,ae=kt,we=Oe,ge=nt,me=rt,Ae=dt,Qe=ct,ft=it,pt=st,gt=ot,P,yt=0;yt<20;yt+=2)P=Ue+Qe|0,_e^=P<<7|P>>>25,P=_e+Ue|0,we^=P<<9|P>>>23,P=we+_e|0,Qe^=P<<13|P>>>19,P=Qe+we|0,Ue^=P<<18|P>>>14,P=Re+Ge|0,ge^=P<<7|P>>>25,P=ge+Re|0,ft^=P<<9|P>>>23,P=ft+ge|0,Ge^=P<<13|P>>>19,P=Ge+ft|0,Re^=P<<18|P>>>14,P=me+se|0,pt^=P<<7|P>>>25,P=pt+me|0,Be^=P<<9|P>>>23,P=Be+pt|0,se^=P<<13|P>>>19,P=se+Be|0,me^=P<<18|P>>>14,P=gt+Ae|0,je^=P<<7|P>>>25,P=je+gt|0,ae^=P<<9|P>>>23,P=ae+je|0,Ae^=P<<13|P>>>19,P=Ae+ae|0,gt^=P<<18|P>>>14,P=Ue+je|0,Ge^=P<<7|P>>>25,P=Ge+Ue|0,Be^=P<<9|P>>>23,P=Be+Ge|0,je^=P<<13|P>>>19,P=je+Be|0,Ue^=P<<18|P>>>14,P=Re+_e|0,se^=P<<7|P>>>25,P=se+Re|0,ae^=P<<9|P>>>23,P=ae+se|0,_e^=P<<13|P>>>19,P=_e+ae|0,Re^=P<<18|P>>>14,P=me+ge|0,Ae^=P<<7|P>>>25,P=Ae+me|0,we^=P<<9|P>>>23,P=we+Ae|0,ge^=P<<13|P>>>19,P=ge+we|0,me^=P<<18|P>>>14,P=gt+pt|0,Qe^=P<<7|P>>>25,P=Qe+gt|0,ft^=P<<9|P>>>23,P=ft+Qe|0,pt^=P<<13|P>>>19,P=pt+ft|0,gt^=P<<18|P>>>14;h[0]=Ue>>>0&255,h[1]=Ue>>>8&255,h[2]=Ue>>>16&255,h[3]=Ue>>>24&255,h[4]=Re>>>0&255,h[5]=Re>>>8&255,h[6]=Re>>>16&255,h[7]=Re>>>24&255,h[8]=me>>>0&255,h[9]=me>>>8&255,h[10]=me>>>16&255,h[11]=me>>>24&255,h[12]=gt>>>0&255,h[13]=gt>>>8&255,h[14]=gt>>>16&255,h[15]=gt>>>24&255,h[16]=se>>>0&255,h[17]=se>>>8&255,h[18]=se>>>16&255,h[19]=se>>>24&255,h[20]=ae>>>0&255,h[21]=ae>>>8&255,h[22]=ae>>>16&255,h[23]=ae>>>24&255,h[24]=we>>>0&255,h[25]=we>>>8&255,h[26]=we>>>16&255,h[27]=we>>>24&255,h[28]=ge>>>0&255,h[29]=ge>>>8&255,h[30]=ge>>>16&255,h[31]=ge>>>24&255}function L(h,S,y,u){b(h,S,y,u)}function G(h,S,y,u){R(h,S,y,u)}var E=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function N(h,S,y,u,D,Z,ne){var pe=new Uint8Array(16),Fe=new Uint8Array(64),ze,$e;for($e=0;$e<16;$e++)pe[$e]=0;for($e=0;$e<8;$e++)pe[$e]=Z[$e];for(;D>=64;){for(L(Fe,pe,ne,E),$e=0;$e<64;$e++)h[S+$e]=y[u+$e]^Fe[$e];for(ze=1,$e=8;$e<16;$e++)ze=ze+(pe[$e]&255)|0,pe[$e]=ze&255,ze>>>=8;D-=64,S+=64,u+=64}if(D>0)for(L(Fe,pe,ne,E),$e=0;$e<D;$e++)h[S+$e]=y[u+$e]^Fe[$e];return 0}function p(h,S,y,u,D){var Z=new Uint8Array(16),ne=new Uint8Array(64),pe,Fe;for(Fe=0;Fe<16;Fe++)Z[Fe]=0;for(Fe=0;Fe<8;Fe++)Z[Fe]=u[Fe];for(;y>=64;){for(L(ne,Z,D,E),Fe=0;Fe<64;Fe++)h[S+Fe]=ne[Fe];for(pe=1,Fe=8;Fe<16;Fe++)pe=pe+(Z[Fe]&255)|0,Z[Fe]=pe&255,pe>>>=8;y-=64,S+=64}if(y>0)for(L(ne,Z,D,E),Fe=0;Fe<y;Fe++)h[S+Fe]=ne[Fe];return 0}function F(h,S,y,u,D){var Z=new Uint8Array(32);G(Z,u,D,E);for(var ne=new Uint8Array(8),pe=0;pe<8;pe++)ne[pe]=u[pe+16];return p(h,S,y,ne,Z)}function v(h,S,y,u,D,Z,ne){var pe=new Uint8Array(32);G(pe,Z,ne,E);for(var Fe=new Uint8Array(8),ze=0;ze<8;ze++)Fe[ze]=Z[ze+16];return N(h,S,y,u,D,Fe,pe)}var O=function(h){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var S,y,u,D,Z,ne,pe,Fe;S=h[0]&255|(h[1]&255)<<8,this.r[0]=S&8191,y=h[2]&255|(h[3]&255)<<8,this.r[1]=(S>>>13|y<<3)&8191,u=h[4]&255|(h[5]&255)<<8,this.r[2]=(y>>>10|u<<6)&7939,D=h[6]&255|(h[7]&255)<<8,this.r[3]=(u>>>7|D<<9)&8191,Z=h[8]&255|(h[9]&255)<<8,this.r[4]=(D>>>4|Z<<12)&255,this.r[5]=Z>>>1&8190,ne=h[10]&255|(h[11]&255)<<8,this.r[6]=(Z>>>14|ne<<2)&8191,pe=h[12]&255|(h[13]&255)<<8,this.r[7]=(ne>>>11|pe<<5)&8065,Fe=h[14]&255|(h[15]&255)<<8,this.r[8]=(pe>>>8|Fe<<8)&8191,this.r[9]=Fe>>>5&127,this.pad[0]=h[16]&255|(h[17]&255)<<8,this.pad[1]=h[18]&255|(h[19]&255)<<8,this.pad[2]=h[20]&255|(h[21]&255)<<8,this.pad[3]=h[22]&255|(h[23]&255)<<8,this.pad[4]=h[24]&255|(h[25]&255)<<8,this.pad[5]=h[26]&255|(h[27]&255)<<8,this.pad[6]=h[28]&255|(h[29]&255)<<8,this.pad[7]=h[30]&255|(h[31]&255)<<8};O.prototype.blocks=function(h,S,y){for(var u=this.fin?0:2048,D,Z,ne,pe,Fe,ze,$e,kt,Oe,nt,rt,dt,ct,it,st,ot,Ue,Ge,Be,je=this.h[0],_e=this.h[1],Re=this.h[2],se=this.h[3],ae=this.h[4],we=this.h[5],ge=this.h[6],me=this.h[7],Ae=this.h[8],Qe=this.h[9],ft=this.r[0],pt=this.r[1],gt=this.r[2],P=this.r[3],yt=this.r[4],At=this.r[5],Dt=this.r[6],mt=this.r[7],Et=this.r[8],bt=this.r[9];y>=16;)D=h[S+0]&255|(h[S+1]&255)<<8,je+=D&8191,Z=h[S+2]&255|(h[S+3]&255)<<8,_e+=(D>>>13|Z<<3)&8191,ne=h[S+4]&255|(h[S+5]&255)<<8,Re+=(Z>>>10|ne<<6)&8191,pe=h[S+6]&255|(h[S+7]&255)<<8,se+=(ne>>>7|pe<<9)&8191,Fe=h[S+8]&255|(h[S+9]&255)<<8,ae+=(pe>>>4|Fe<<12)&8191,we+=Fe>>>1&8191,ze=h[S+10]&255|(h[S+11]&255)<<8,ge+=(Fe>>>14|ze<<2)&8191,$e=h[S+12]&255|(h[S+13]&255)<<8,me+=(ze>>>11|$e<<5)&8191,kt=h[S+14]&255|(h[S+15]&255)<<8,Ae+=($e>>>8|kt<<8)&8191,Qe+=kt>>>5|u,Oe=0,nt=Oe,nt+=je*ft,nt+=_e*(5*bt),nt+=Re*(5*Et),nt+=se*(5*mt),nt+=ae*(5*Dt),Oe=nt>>>13,nt&=8191,nt+=we*(5*At),nt+=ge*(5*yt),nt+=me*(5*P),nt+=Ae*(5*gt),nt+=Qe*(5*pt),Oe+=nt>>>13,nt&=8191,rt=Oe,rt+=je*pt,rt+=_e*ft,rt+=Re*(5*bt),rt+=se*(5*Et),rt+=ae*(5*mt),Oe=rt>>>13,rt&=8191,rt+=we*(5*Dt),rt+=ge*(5*At),rt+=me*(5*yt),rt+=Ae*(5*P),rt+=Qe*(5*gt),Oe+=rt>>>13,rt&=8191,dt=Oe,dt+=je*gt,dt+=_e*pt,dt+=Re*ft,dt+=se*(5*bt),dt+=ae*(5*Et),Oe=dt>>>13,dt&=8191,dt+=we*(5*mt),dt+=ge*(5*Dt),dt+=me*(5*At),dt+=Ae*(5*yt),dt+=Qe*(5*P),Oe+=dt>>>13,dt&=8191,ct=Oe,ct+=je*P,ct+=_e*gt,ct+=Re*pt,ct+=se*ft,ct+=ae*(5*bt),Oe=ct>>>13,ct&=8191,ct+=we*(5*Et),ct+=ge*(5*mt),ct+=me*(5*Dt),ct+=Ae*(5*At),ct+=Qe*(5*yt),Oe+=ct>>>13,ct&=8191,it=Oe,it+=je*yt,it+=_e*P,it+=Re*gt,it+=se*pt,it+=ae*ft,Oe=it>>>13,it&=8191,it+=we*(5*bt),it+=ge*(5*Et),it+=me*(5*mt),it+=Ae*(5*Dt),it+=Qe*(5*At),Oe+=it>>>13,it&=8191,st=Oe,st+=je*At,st+=_e*yt,st+=Re*P,st+=se*gt,st+=ae*pt,Oe=st>>>13,st&=8191,st+=we*ft,st+=ge*(5*bt),st+=me*(5*Et),st+=Ae*(5*mt),st+=Qe*(5*Dt),Oe+=st>>>13,st&=8191,ot=Oe,ot+=je*Dt,ot+=_e*At,ot+=Re*yt,ot+=se*P,ot+=ae*gt,Oe=ot>>>13,ot&=8191,ot+=we*pt,ot+=ge*ft,ot+=me*(5*bt),ot+=Ae*(5*Et),ot+=Qe*(5*mt),Oe+=ot>>>13,ot&=8191,Ue=Oe,Ue+=je*mt,Ue+=_e*Dt,Ue+=Re*At,Ue+=se*yt,Ue+=ae*P,Oe=Ue>>>13,Ue&=8191,Ue+=we*gt,Ue+=ge*pt,Ue+=me*ft,Ue+=Ae*(5*bt),Ue+=Qe*(5*Et),Oe+=Ue>>>13,Ue&=8191,Ge=Oe,Ge+=je*Et,Ge+=_e*mt,Ge+=Re*Dt,Ge+=se*At,Ge+=ae*yt,Oe=Ge>>>13,Ge&=8191,Ge+=we*P,Ge+=ge*gt,Ge+=me*pt,Ge+=Ae*ft,Ge+=Qe*(5*bt),Oe+=Ge>>>13,Ge&=8191,Be=Oe,Be+=je*bt,Be+=_e*Et,Be+=Re*mt,Be+=se*Dt,Be+=ae*At,Oe=Be>>>13,Be&=8191,Be+=we*yt,Be+=ge*P,Be+=me*gt,Be+=Ae*pt,Be+=Qe*ft,Oe+=Be>>>13,Be&=8191,Oe=(Oe<<2)+Oe|0,Oe=Oe+nt|0,nt=Oe&8191,Oe=Oe>>>13,rt+=Oe,je=nt,_e=rt,Re=dt,se=ct,ae=it,we=st,ge=ot,me=Ue,Ae=Ge,Qe=Be,S+=16,y-=16;this.h[0]=je,this.h[1]=_e,this.h[2]=Re,this.h[3]=se,this.h[4]=ae,this.h[5]=we,this.h[6]=ge,this.h[7]=me,this.h[8]=Ae,this.h[9]=Qe},O.prototype.finish=function(h,S){var y=new Uint16Array(10),u,D,Z,ne;if(this.leftover){for(ne=this.leftover,this.buffer[ne++]=1;ne<16;ne++)this.buffer[ne]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(u=this.h[1]>>>13,this.h[1]&=8191,ne=2;ne<10;ne++)this.h[ne]+=u,u=this.h[ne]>>>13,this.h[ne]&=8191;for(this.h[0]+=u*5,u=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=u,u=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=u,y[0]=this.h[0]+5,u=y[0]>>>13,y[0]&=8191,ne=1;ne<10;ne++)y[ne]=this.h[ne]+u,u=y[ne]>>>13,y[ne]&=8191;for(y[9]-=8192,D=(u^1)-1,ne=0;ne<10;ne++)y[ne]&=D;for(D=~D,ne=0;ne<10;ne++)this.h[ne]=this.h[ne]&D|y[ne];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Z=this.h[0]+this.pad[0],this.h[0]=Z&65535,ne=1;ne<8;ne++)Z=(this.h[ne]+this.pad[ne]|0)+(Z>>>16)|0,this.h[ne]=Z&65535;h[S+0]=this.h[0]>>>0&255,h[S+1]=this.h[0]>>>8&255,h[S+2]=this.h[1]>>>0&255,h[S+3]=this.h[1]>>>8&255,h[S+4]=this.h[2]>>>0&255,h[S+5]=this.h[2]>>>8&255,h[S+6]=this.h[3]>>>0&255,h[S+7]=this.h[3]>>>8&255,h[S+8]=this.h[4]>>>0&255,h[S+9]=this.h[4]>>>8&255,h[S+10]=this.h[5]>>>0&255,h[S+11]=this.h[5]>>>8&255,h[S+12]=this.h[6]>>>0&255,h[S+13]=this.h[6]>>>8&255,h[S+14]=this.h[7]>>>0&255,h[S+15]=this.h[7]>>>8&255},O.prototype.update=function(h,S,y){var u,D;if(this.leftover){for(D=16-this.leftover,D>y&&(D=y),u=0;u<D;u++)this.buffer[this.leftover+u]=h[S+u];if(y-=D,S+=D,this.leftover+=D,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(y>=16&&(D=y-y%16,this.blocks(h,S,D),S+=D,y-=D),y){for(u=0;u<y;u++)this.buffer[this.leftover+u]=h[S+u];this.leftover+=y}};function C(h,S,y,u,D,Z){var ne=new O(Z);return ne.update(y,u,D),ne.finish(h,S),0}function V(h,S,y,u,D,Z){var ne=new Uint8Array(16);return C(ne,0,y,u,D,Z),x(h,S,ne,0)}function H(h,S,y,u,D){var Z;if(y<32)return-1;for(v(h,0,S,0,y,u,D),C(h,16,h,32,y-32,h),Z=0;Z<16;Z++)h[Z]=0;return 0}function _(h,S,y,u,D){var Z,ne=new Uint8Array(32);if(y<32||(F(ne,0,32,u,D),V(S,16,S,32,y-32,ne)!==0))return-1;for(v(h,0,S,0,y,u,D),Z=0;Z<32;Z++)h[Z]=0;return 0}function ee(h,S){var y;for(y=0;y<16;y++)h[y]=S[y]|0}function oe(h){var S,y,u=1;for(S=0;S<16;S++)y=h[S]+u+65535,u=Math.floor(y/65536),h[S]=y-u*65536;h[0]+=u-1+37*(u-1)}function z(h,S,y){for(var u,D=~(y-1),Z=0;Z<16;Z++)u=D&(h[Z]^S[Z]),h[Z]^=u,S[Z]^=u}function ue(h,S){var y,u,D,Z=t(),ne=t();for(y=0;y<16;y++)ne[y]=S[y];for(oe(ne),oe(ne),oe(ne),u=0;u<2;u++){for(Z[0]=ne[0]-65517,y=1;y<15;y++)Z[y]=ne[y]-65535-(Z[y-1]>>16&1),Z[y-1]&=65535;Z[15]=ne[15]-32767-(Z[14]>>16&1),D=Z[15]>>16&1,Z[14]&=65535,z(ne,Z,1-D)}for(y=0;y<16;y++)h[2*y]=ne[y]&255,h[2*y+1]=ne[y]>>8}function De(h,S){var y=new Uint8Array(32),u=new Uint8Array(32);return ue(y,h),ue(u,S),T(y,0,u,0)}function ve(h){var S=new Uint8Array(32);return ue(S,h),S[0]&1}function Te(h,S){var y;for(y=0;y<16;y++)h[y]=S[2*y]+(S[2*y+1]<<8);h[15]&=32767}function de(h,S,y){for(var u=0;u<16;u++)h[u]=S[u]+y[u]}function ie(h,S,y){for(var u=0;u<16;u++)h[u]=S[u]-y[u]}function ke(h,S,y){var u,D,Z=0,ne=0,pe=0,Fe=0,ze=0,$e=0,kt=0,Oe=0,nt=0,rt=0,dt=0,ct=0,it=0,st=0,ot=0,Ue=0,Ge=0,Be=0,je=0,_e=0,Re=0,se=0,ae=0,we=0,ge=0,me=0,Ae=0,Qe=0,ft=0,pt=0,gt=0,P=y[0],yt=y[1],At=y[2],Dt=y[3],mt=y[4],Et=y[5],bt=y[6],Qt=y[7],$t=y[8],qt=y[9],Ht=y[10],Gt=y[11],tn=y[12],hn=y[13],dn=y[14],fn=y[15];u=S[0],Z+=u*P,ne+=u*yt,pe+=u*At,Fe+=u*Dt,ze+=u*mt,$e+=u*Et,kt+=u*bt,Oe+=u*Qt,nt+=u*$t,rt+=u*qt,dt+=u*Ht,ct+=u*Gt,it+=u*tn,st+=u*hn,ot+=u*dn,Ue+=u*fn,u=S[1],ne+=u*P,pe+=u*yt,Fe+=u*At,ze+=u*Dt,$e+=u*mt,kt+=u*Et,Oe+=u*bt,nt+=u*Qt,rt+=u*$t,dt+=u*qt,ct+=u*Ht,it+=u*Gt,st+=u*tn,ot+=u*hn,Ue+=u*dn,Ge+=u*fn,u=S[2],pe+=u*P,Fe+=u*yt,ze+=u*At,$e+=u*Dt,kt+=u*mt,Oe+=u*Et,nt+=u*bt,rt+=u*Qt,dt+=u*$t,ct+=u*qt,it+=u*Ht,st+=u*Gt,ot+=u*tn,Ue+=u*hn,Ge+=u*dn,Be+=u*fn,u=S[3],Fe+=u*P,ze+=u*yt,$e+=u*At,kt+=u*Dt,Oe+=u*mt,nt+=u*Et,rt+=u*bt,dt+=u*Qt,ct+=u*$t,it+=u*qt,st+=u*Ht,ot+=u*Gt,Ue+=u*tn,Ge+=u*hn,Be+=u*dn,je+=u*fn,u=S[4],ze+=u*P,$e+=u*yt,kt+=u*At,Oe+=u*Dt,nt+=u*mt,rt+=u*Et,dt+=u*bt,ct+=u*Qt,it+=u*$t,st+=u*qt,ot+=u*Ht,Ue+=u*Gt,Ge+=u*tn,Be+=u*hn,je+=u*dn,_e+=u*fn,u=S[5],$e+=u*P,kt+=u*yt,Oe+=u*At,nt+=u*Dt,rt+=u*mt,dt+=u*Et,ct+=u*bt,it+=u*Qt,st+=u*$t,ot+=u*qt,Ue+=u*Ht,Ge+=u*Gt,Be+=u*tn,je+=u*hn,_e+=u*dn,Re+=u*fn,u=S[6],kt+=u*P,Oe+=u*yt,nt+=u*At,rt+=u*Dt,dt+=u*mt,ct+=u*Et,it+=u*bt,st+=u*Qt,ot+=u*$t,Ue+=u*qt,Ge+=u*Ht,Be+=u*Gt,je+=u*tn,_e+=u*hn,Re+=u*dn,se+=u*fn,u=S[7],Oe+=u*P,nt+=u*yt,rt+=u*At,dt+=u*Dt,ct+=u*mt,it+=u*Et,st+=u*bt,ot+=u*Qt,Ue+=u*$t,Ge+=u*qt,Be+=u*Ht,je+=u*Gt,_e+=u*tn,Re+=u*hn,se+=u*dn,ae+=u*fn,u=S[8],nt+=u*P,rt+=u*yt,dt+=u*At,ct+=u*Dt,it+=u*mt,st+=u*Et,ot+=u*bt,Ue+=u*Qt,Ge+=u*$t,Be+=u*qt,je+=u*Ht,_e+=u*Gt,Re+=u*tn,se+=u*hn,ae+=u*dn,we+=u*fn,u=S[9],rt+=u*P,dt+=u*yt,ct+=u*At,it+=u*Dt,st+=u*mt,ot+=u*Et,Ue+=u*bt,Ge+=u*Qt,Be+=u*$t,je+=u*qt,_e+=u*Ht,Re+=u*Gt,se+=u*tn,ae+=u*hn,we+=u*dn,ge+=u*fn,u=S[10],dt+=u*P,ct+=u*yt,it+=u*At,st+=u*Dt,ot+=u*mt,Ue+=u*Et,Ge+=u*bt,Be+=u*Qt,je+=u*$t,_e+=u*qt,Re+=u*Ht,se+=u*Gt,ae+=u*tn,we+=u*hn,ge+=u*dn,me+=u*fn,u=S[11],ct+=u*P,it+=u*yt,st+=u*At,ot+=u*Dt,Ue+=u*mt,Ge+=u*Et,Be+=u*bt,je+=u*Qt,_e+=u*$t,Re+=u*qt,se+=u*Ht,ae+=u*Gt,we+=u*tn,ge+=u*hn,me+=u*dn,Ae+=u*fn,u=S[12],it+=u*P,st+=u*yt,ot+=u*At,Ue+=u*Dt,Ge+=u*mt,Be+=u*Et,je+=u*bt,_e+=u*Qt,Re+=u*$t,se+=u*qt,ae+=u*Ht,we+=u*Gt,ge+=u*tn,me+=u*hn,Ae+=u*dn,Qe+=u*fn,u=S[13],st+=u*P,ot+=u*yt,Ue+=u*At,Ge+=u*Dt,Be+=u*mt,je+=u*Et,_e+=u*bt,Re+=u*Qt,se+=u*$t,ae+=u*qt,we+=u*Ht,ge+=u*Gt,me+=u*tn,Ae+=u*hn,Qe+=u*dn,ft+=u*fn,u=S[14],ot+=u*P,Ue+=u*yt,Ge+=u*At,Be+=u*Dt,je+=u*mt,_e+=u*Et,Re+=u*bt,se+=u*Qt,ae+=u*$t,we+=u*qt,ge+=u*Ht,me+=u*Gt,Ae+=u*tn,Qe+=u*hn,ft+=u*dn,pt+=u*fn,u=S[15],Ue+=u*P,Ge+=u*yt,Be+=u*At,je+=u*Dt,_e+=u*mt,Re+=u*Et,se+=u*bt,ae+=u*Qt,we+=u*$t,ge+=u*qt,me+=u*Ht,Ae+=u*Gt,Qe+=u*tn,ft+=u*hn,pt+=u*dn,gt+=u*fn,Z+=38*Ge,ne+=38*Be,pe+=38*je,Fe+=38*_e,ze+=38*Re,$e+=38*se,kt+=38*ae,Oe+=38*we,nt+=38*ge,rt+=38*me,dt+=38*Ae,ct+=38*Qe,it+=38*ft,st+=38*pt,ot+=38*gt,D=1,u=Z+D+65535,D=Math.floor(u/65536),Z=u-D*65536,u=ne+D+65535,D=Math.floor(u/65536),ne=u-D*65536,u=pe+D+65535,D=Math.floor(u/65536),pe=u-D*65536,u=Fe+D+65535,D=Math.floor(u/65536),Fe=u-D*65536,u=ze+D+65535,D=Math.floor(u/65536),ze=u-D*65536,u=$e+D+65535,D=Math.floor(u/65536),$e=u-D*65536,u=kt+D+65535,D=Math.floor(u/65536),kt=u-D*65536,u=Oe+D+65535,D=Math.floor(u/65536),Oe=u-D*65536,u=nt+D+65535,D=Math.floor(u/65536),nt=u-D*65536,u=rt+D+65535,D=Math.floor(u/65536),rt=u-D*65536,u=dt+D+65535,D=Math.floor(u/65536),dt=u-D*65536,u=ct+D+65535,D=Math.floor(u/65536),ct=u-D*65536,u=it+D+65535,D=Math.floor(u/65536),it=u-D*65536,u=st+D+65535,D=Math.floor(u/65536),st=u-D*65536,u=ot+D+65535,D=Math.floor(u/65536),ot=u-D*65536,u=Ue+D+65535,D=Math.floor(u/65536),Ue=u-D*65536,Z+=D-1+37*(D-1),D=1,u=Z+D+65535,D=Math.floor(u/65536),Z=u-D*65536,u=ne+D+65535,D=Math.floor(u/65536),ne=u-D*65536,u=pe+D+65535,D=Math.floor(u/65536),pe=u-D*65536,u=Fe+D+65535,D=Math.floor(u/65536),Fe=u-D*65536,u=ze+D+65535,D=Math.floor(u/65536),ze=u-D*65536,u=$e+D+65535,D=Math.floor(u/65536),$e=u-D*65536,u=kt+D+65535,D=Math.floor(u/65536),kt=u-D*65536,u=Oe+D+65535,D=Math.floor(u/65536),Oe=u-D*65536,u=nt+D+65535,D=Math.floor(u/65536),nt=u-D*65536,u=rt+D+65535,D=Math.floor(u/65536),rt=u-D*65536,u=dt+D+65535,D=Math.floor(u/65536),dt=u-D*65536,u=ct+D+65535,D=Math.floor(u/65536),ct=u-D*65536,u=it+D+65535,D=Math.floor(u/65536),it=u-D*65536,u=st+D+65535,D=Math.floor(u/65536),st=u-D*65536,u=ot+D+65535,D=Math.floor(u/65536),ot=u-D*65536,u=Ue+D+65535,D=Math.floor(u/65536),Ue=u-D*65536,Z+=D-1+37*(D-1),h[0]=Z,h[1]=ne,h[2]=pe,h[3]=Fe,h[4]=ze,h[5]=$e,h[6]=kt,h[7]=Oe,h[8]=nt,h[9]=rt,h[10]=dt,h[11]=ct,h[12]=it,h[13]=st,h[14]=ot,h[15]=Ue}function Ie(h,S){ke(h,S,S)}function Ze(h,S){var y=t(),u;for(u=0;u<16;u++)y[u]=S[u];for(u=253;u>=0;u--)Ie(y,y),u!==2&&u!==4&&ke(y,y,S);for(u=0;u<16;u++)h[u]=y[u]}function Ee(h,S){var y=t(),u;for(u=0;u<16;u++)y[u]=S[u];for(u=250;u>=0;u--)Ie(y,y),u!==1&&ke(y,y,S);for(u=0;u<16;u++)h[u]=y[u]}function be(h,S,y){var u=new Uint8Array(32),D=new Float64Array(80),Z,ne,pe=t(),Fe=t(),ze=t(),$e=t(),kt=t(),Oe=t();for(ne=0;ne<31;ne++)u[ne]=S[ne];for(u[31]=S[31]&127|64,u[0]&=248,Te(D,y),ne=0;ne<16;ne++)Fe[ne]=D[ne],$e[ne]=pe[ne]=ze[ne]=0;for(pe[0]=$e[0]=1,ne=254;ne>=0;--ne)Z=u[ne>>>3]>>>(ne&7)&1,z(pe,Fe,Z),z(ze,$e,Z),de(kt,pe,ze),ie(pe,pe,ze),de(ze,Fe,$e),ie(Fe,Fe,$e),Ie($e,kt),Ie(Oe,pe),ke(pe,ze,pe),ke(ze,Fe,kt),de(kt,pe,ze),ie(pe,pe,ze),Ie(Fe,pe),ie(ze,$e,Oe),ke(pe,ze,l),de(pe,pe,$e),ke(ze,ze,pe),ke(pe,$e,Oe),ke($e,Fe,D),Ie(Fe,kt),z(pe,Fe,Z),z(ze,$e,Z);for(ne=0;ne<16;ne++)D[ne+16]=pe[ne],D[ne+32]=ze[ne],D[ne+48]=Fe[ne],D[ne+64]=$e[ne];var nt=D.subarray(32),rt=D.subarray(16);return Ze(nt,nt),ke(rt,rt,nt),ue(h,rt),0}function g(h,S){return be(h,S,o)}function A(h,S){return r(S,32),g(h,S)}function M(h,S,y){var u=new Uint8Array(32);return be(u,y,S),G(h,i,u,E)}var W=H,U=_;function q(h,S,y,u,D,Z){var ne=new Uint8Array(32);return M(ne,D,Z),W(h,S,y,u,ne)}function re(h,S,y,u,D,Z){var ne=new Uint8Array(32);return M(ne,D,Z),U(h,S,y,u,ne)}var j=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function X(h,S,y,u){for(var D=new Int32Array(16),Z=new Int32Array(16),ne,pe,Fe,ze,$e,kt,Oe,nt,rt,dt,ct,it,st,ot,Ue,Ge,Be,je,_e,Re,se,ae,we,ge,me,Ae,Qe=h[0],ft=h[1],pt=h[2],gt=h[3],P=h[4],yt=h[5],At=h[6],Dt=h[7],mt=S[0],Et=S[1],bt=S[2],Qt=S[3],$t=S[4],qt=S[5],Ht=S[6],Gt=S[7],tn=0;u>=128;){for(_e=0;_e<16;_e++)Re=8*_e+tn,D[_e]=y[Re+0]<<24|y[Re+1]<<16|y[Re+2]<<8|y[Re+3],Z[_e]=y[Re+4]<<24|y[Re+5]<<16|y[Re+6]<<8|y[Re+7];for(_e=0;_e<80;_e++)if(ne=Qe,pe=ft,Fe=pt,ze=gt,$e=P,kt=yt,Oe=At,nt=Dt,rt=mt,dt=Et,ct=bt,it=Qt,st=$t,ot=qt,Ue=Ht,Ge=Gt,se=Dt,ae=Gt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=(P>>>14|$t<<18)^(P>>>18|$t<<14)^($t>>>9|P<<23),ae=($t>>>14|P<<18)^($t>>>18|P<<14)^(P>>>9|$t<<23),we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,se=P&yt^~P&At,ae=$t&qt^~$t&Ht,we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,se=j[_e*2],ae=j[_e*2+1],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,se=D[_e%16],ae=Z[_e%16],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,Be=me&65535|Ae<<16,je=we&65535|ge<<16,se=Be,ae=je,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=(Qe>>>28|mt<<4)^(mt>>>2|Qe<<30)^(mt>>>7|Qe<<25),ae=(mt>>>28|Qe<<4)^(Qe>>>2|mt<<30)^(Qe>>>7|mt<<25),we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,se=Qe&ft^Qe&pt^ft&pt,ae=mt&Et^mt&bt^Et&bt,we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,nt=me&65535|Ae<<16,Ge=we&65535|ge<<16,se=ze,ae=it,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=Be,ae=je,we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,ze=me&65535|Ae<<16,it=we&65535|ge<<16,ft=ne,pt=pe,gt=Fe,P=ze,yt=$e,At=kt,Dt=Oe,Qe=nt,Et=rt,bt=dt,Qt=ct,$t=it,qt=st,Ht=ot,Gt=Ue,mt=Ge,_e%16===15)for(Re=0;Re<16;Re++)se=D[Re],ae=Z[Re],we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=D[(Re+9)%16],ae=Z[(Re+9)%16],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,Be=D[(Re+1)%16],je=Z[(Re+1)%16],se=(Be>>>1|je<<31)^(Be>>>8|je<<24)^Be>>>7,ae=(je>>>1|Be<<31)^(je>>>8|Be<<24)^(je>>>7|Be<<25),we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,Be=D[(Re+14)%16],je=Z[(Re+14)%16],se=(Be>>>19|je<<13)^(je>>>29|Be<<3)^Be>>>6,ae=(je>>>19|Be<<13)^(Be>>>29|je<<3)^(je>>>6|Be<<26),we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,D[Re]=me&65535|Ae<<16,Z[Re]=we&65535|ge<<16;se=Qe,ae=mt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[0],ae=S[0],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[0]=Qe=me&65535|Ae<<16,S[0]=mt=we&65535|ge<<16,se=ft,ae=Et,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[1],ae=S[1],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[1]=ft=me&65535|Ae<<16,S[1]=Et=we&65535|ge<<16,se=pt,ae=bt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[2],ae=S[2],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[2]=pt=me&65535|Ae<<16,S[2]=bt=we&65535|ge<<16,se=gt,ae=Qt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[3],ae=S[3],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[3]=gt=me&65535|Ae<<16,S[3]=Qt=we&65535|ge<<16,se=P,ae=$t,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[4],ae=S[4],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[4]=P=me&65535|Ae<<16,S[4]=$t=we&65535|ge<<16,se=yt,ae=qt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[5],ae=S[5],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[5]=yt=me&65535|Ae<<16,S[5]=qt=we&65535|ge<<16,se=At,ae=Ht,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[6],ae=S[6],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[6]=At=me&65535|Ae<<16,S[6]=Ht=we&65535|ge<<16,se=Dt,ae=Gt,we=ae&65535,ge=ae>>>16,me=se&65535,Ae=se>>>16,se=h[7],ae=S[7],we+=ae&65535,ge+=ae>>>16,me+=se&65535,Ae+=se>>>16,ge+=we>>>16,me+=ge>>>16,Ae+=me>>>16,h[7]=Dt=me&65535|Ae<<16,S[7]=Gt=we&65535|ge<<16,tn+=128,u-=128}return u}function te(h,S,y){var u=new Int32Array(8),D=new Int32Array(8),Z=new Uint8Array(256),ne,pe=y;for(u[0]=1779033703,u[1]=3144134277,u[2]=1013904242,u[3]=2773480762,u[4]=1359893119,u[5]=2600822924,u[6]=528734635,u[7]=1541459225,D[0]=4089235720,D[1]=2227873595,D[2]=4271175723,D[3]=1595750129,D[4]=2917565137,D[5]=725511199,D[6]=4215389547,D[7]=327033209,X(u,D,S,y),y%=128,ne=0;ne<y;ne++)Z[ne]=S[pe-y+ne];for(Z[y]=128,y=256-128*(y<112?1:0),Z[y-9]=0,k(Z,y-8,pe/536870912|0,pe<<3),X(u,D,Z,y),ne=0;ne<8;ne++)k(h,8*ne,u[ne],D[ne]);return 0}function Q(h,S){var y=t(),u=t(),D=t(),Z=t(),ne=t(),pe=t(),Fe=t(),ze=t(),$e=t();ie(y,h[1],h[0]),ie($e,S[1],S[0]),ke(y,y,$e),de(u,h[0],h[1]),de($e,S[0],S[1]),ke(u,u,$e),ke(D,h[3],S[3]),ke(D,D,d),ke(Z,h[2],S[2]),de(Z,Z,Z),ie(ne,u,y),ie(pe,Z,D),de(Fe,Z,D),de(ze,u,y),ke(h[0],ne,pe),ke(h[1],ze,Fe),ke(h[2],Fe,pe),ke(h[3],ne,ze)}function le(h,S,y){var u;for(u=0;u<4;u++)z(h[u],S[u],y)}function fe(h,S){var y=t(),u=t(),D=t();Ze(D,S[2]),ke(y,S[0],D),ke(u,S[1],D),ue(h,u),h[31]^=ve(y)<<7}function ye(h,S,y){var u,D;for(ee(h[0],s),ee(h[1],a),ee(h[2],a),ee(h[3],s),D=255;D>=0;--D)u=y[D/8|0]>>(D&7)&1,le(h,S,u),Q(S,h),Q(h,h),le(h,S,u)}function Ve(h,S){var y=[t(),t(),t(),t()];ee(y[0],f),ee(y[1],m),ee(y[2],a),ke(y[3],f,m),ye(h,y,S)}function Ke(h,S,y){var u=new Uint8Array(64),D=[t(),t(),t(),t()],Z;for(y||r(S,32),te(u,S,32),u[0]&=248,u[31]&=127,u[31]|=64,Ve(D,u),fe(h,D),Z=0;Z<32;Z++)S[Z+32]=h[Z];return 0}var wt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function et(h,S){var y,u,D,Z;for(u=63;u>=32;--u){for(y=0,D=u-32,Z=u-12;D<Z;++D)S[D]+=y-16*S[u]*wt[D-(u-32)],y=Math.floor((S[D]+128)/256),S[D]-=y*256;S[D]+=y,S[u]=0}for(y=0,D=0;D<32;D++)S[D]+=y-(S[31]>>4)*wt[D],y=S[D]>>8,S[D]&=255;for(D=0;D<32;D++)S[D]-=y*wt[D];for(u=0;u<32;u++)S[u+1]+=S[u]>>8,h[u]=S[u]&255}function tt(h){var S=new Float64Array(64),y;for(y=0;y<64;y++)S[y]=h[y];for(y=0;y<64;y++)h[y]=0;et(h,S)}function vt(h,S,y,u){var D=new Uint8Array(64),Z=new Uint8Array(64),ne=new Uint8Array(64),pe,Fe,ze=new Float64Array(64),$e=[t(),t(),t(),t()];te(D,u,32),D[0]&=248,D[31]&=127,D[31]|=64;var kt=y+64;for(pe=0;pe<y;pe++)h[64+pe]=S[pe];for(pe=0;pe<32;pe++)h[32+pe]=D[32+pe];for(te(ne,h.subarray(32),y+32),tt(ne),Ve($e,ne),fe(h,$e),pe=32;pe<64;pe++)h[pe]=u[pe];for(te(Z,h,y+64),tt(Z),pe=0;pe<64;pe++)ze[pe]=0;for(pe=0;pe<32;pe++)ze[pe]=ne[pe];for(pe=0;pe<32;pe++)for(Fe=0;Fe<32;Fe++)ze[pe+Fe]+=Z[pe]*D[Fe];return et(h.subarray(32),ze),kt}function zt(h,S){var y=t(),u=t(),D=t(),Z=t(),ne=t(),pe=t(),Fe=t();return ee(h[2],a),Te(h[1],S),Ie(D,h[1]),ke(Z,D,c),ie(D,D,h[2]),de(Z,h[2],Z),Ie(ne,Z),Ie(pe,ne),ke(Fe,pe,ne),ke(y,Fe,D),ke(y,y,Z),Ee(y,y),ke(y,y,D),ke(y,y,Z),ke(y,y,Z),ke(h[0],y,Z),Ie(u,h[0]),ke(u,u,Z),De(u,D)&&ke(h[0],h[0],w),Ie(u,h[0]),ke(u,u,Z),De(u,D)?-1:(ve(h[0])===S[31]>>7&&ie(h[0],s,h[0]),ke(h[3],h[0],h[1]),0)}function Lt(h,S,y,u){var D,Z=new Uint8Array(32),ne=new Uint8Array(64),pe=[t(),t(),t(),t()],Fe=[t(),t(),t(),t()];if(y<64||zt(Fe,u))return-1;for(D=0;D<y;D++)h[D]=S[D];for(D=0;D<32;D++)h[D+32]=u[D];if(te(ne,h,y),tt(ne),ye(pe,Fe,ne),Ve(Fe,S.subarray(32)),Q(pe,Fe),fe(Z,pe),y-=64,T(S,0,Z,0)){for(D=0;D<y;D++)h[D]=0;return-1}for(D=0;D<y;D++)h[D]=S[D+64];return y}var Ut=32,Ft=24,Nt=32,xt=16,St=32,at=32,Yt=32,Xt=32,en=32,rn=Ft,sn=Nt,an=xt,qn=64,lr=32,Ar=64,ls=32,hs=64;e.lowlevel={crypto_core_hsalsa20:G,crypto_stream_xor:v,crypto_stream:F,crypto_stream_salsa20_xor:N,crypto_stream_salsa20:p,crypto_onetimeauth:C,crypto_onetimeauth_verify:V,crypto_verify_16:x,crypto_verify_32:T,crypto_secretbox:H,crypto_secretbox_open:_,crypto_scalarmult:be,crypto_scalarmult_base:g,crypto_box_beforenm:M,crypto_box_afternm:W,crypto_box:q,crypto_box_open:re,crypto_box_keypair:A,crypto_hash:te,crypto_sign:vt,crypto_sign_keypair:Ke,crypto_sign_open:Lt,crypto_secretbox_KEYBYTES:Ut,crypto_secretbox_NONCEBYTES:Ft,crypto_secretbox_ZEROBYTES:Nt,crypto_secretbox_BOXZEROBYTES:xt,crypto_scalarmult_BYTES:St,crypto_scalarmult_SCALARBYTES:at,crypto_box_PUBLICKEYBYTES:Yt,crypto_box_SECRETKEYBYTES:Xt,crypto_box_BEFORENMBYTES:en,crypto_box_NONCEBYTES:rn,crypto_box_ZEROBYTES:sn,crypto_box_BOXZEROBYTES:an,crypto_sign_BYTES:qn,crypto_sign_PUBLICKEYBYTES:lr,crypto_sign_SECRETKEYBYTES:Ar,crypto_sign_SEEDBYTES:ls,crypto_hash_BYTES:hs,gf:t,D:c,L:wt,pack25519:ue,unpack25519:Te,M:ke,A:de,S:Ie,Z:ie,pow2523:Ee,add:Q,set25519:ee,modL:et,scalarmult:ye,scalarbase:Ve};function Qu(h,S){if(h.length!==Ut)throw new Error("bad key size");if(S.length!==Ft)throw new Error("bad nonce size")}function Zg(h,S){if(h.length!==Yt)throw new Error("bad public key size");if(S.length!==Xt)throw new Error("bad secret key size")}function En(){for(var h=0;h<arguments.length;h++)if(!(arguments[h]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Zu(h){for(var S=0;S<h.length;S++)h[S]=0}e.randomBytes=function(h){var S=new Uint8Array(h);return r(S,h),S},e.secretbox=function(h,S,y){En(h,S,y),Qu(y,S);for(var u=new Uint8Array(Nt+h.length),D=new Uint8Array(u.length),Z=0;Z<h.length;Z++)u[Z+Nt]=h[Z];return H(D,u,u.length,S,y),D.subarray(xt)},e.secretbox.open=function(h,S,y){En(h,S,y),Qu(y,S);for(var u=new Uint8Array(xt+h.length),D=new Uint8Array(u.length),Z=0;Z<h.length;Z++)u[Z+xt]=h[Z];return u.length<32||_(D,u,u.length,S,y)!==0?null:D.subarray(Nt)},e.secretbox.keyLength=Ut,e.secretbox.nonceLength=Ft,e.secretbox.overheadLength=xt,e.scalarMult=function(h,S){if(En(h,S),h.length!==at)throw new Error("bad n size");if(S.length!==St)throw new Error("bad p size");var y=new Uint8Array(St);return be(y,h,S),y},e.scalarMult.base=function(h){if(En(h),h.length!==at)throw new Error("bad n size");var S=new Uint8Array(St);return g(S,h),S},e.scalarMult.scalarLength=at,e.scalarMult.groupElementLength=St,e.box=function(h,S,y,u){var D=e.box.before(y,u);return e.secretbox(h,S,D)},e.box.before=function(h,S){En(h,S),Zg(h,S);var y=new Uint8Array(en);return M(y,h,S),y},e.box.after=e.secretbox,e.box.open=function(h,S,y,u){var D=e.box.before(y,u);return e.secretbox.open(h,S,D)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var h=new Uint8Array(Yt),S=new Uint8Array(Xt);return A(h,S),{publicKey:h,secretKey:S}},e.box.keyPair.fromSecretKey=function(h){if(En(h),h.length!==Xt)throw new Error("bad secret key size");var S=new Uint8Array(Yt);return g(S,h),{publicKey:S,secretKey:new Uint8Array(h)}},e.box.publicKeyLength=Yt,e.box.secretKeyLength=Xt,e.box.sharedKeyLength=en,e.box.nonceLength=rn,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(h,S){if(En(h,S),S.length!==Ar)throw new Error("bad secret key size");var y=new Uint8Array(qn+h.length);return vt(y,h,h.length,S),y},e.sign.open=function(h,S){if(En(h,S),S.length!==lr)throw new Error("bad public key size");var y=new Uint8Array(h.length),u=Lt(y,h,h.length,S);if(u<0)return null;for(var D=new Uint8Array(u),Z=0;Z<D.length;Z++)D[Z]=y[Z];return D},e.sign.detached=function(h,S){for(var y=e.sign(h,S),u=new Uint8Array(qn),D=0;D<u.length;D++)u[D]=y[D];return u},e.sign.detached.verify=function(h,S,y){if(En(h,S,y),S.length!==qn)throw new Error("bad signature size");if(y.length!==lr)throw new Error("bad public key size");var u=new Uint8Array(qn+h.length),D=new Uint8Array(qn+h.length),Z;for(Z=0;Z<qn;Z++)u[Z]=S[Z];for(Z=0;Z<h.length;Z++)u[Z+qn]=h[Z];return Lt(D,u,u.length,y)>=0},e.sign.keyPair=function(){var h=new Uint8Array(lr),S=new Uint8Array(Ar);return Ke(h,S),{publicKey:h,secretKey:S}},e.sign.keyPair.fromSecretKey=function(h){if(En(h),h.length!==Ar)throw new Error("bad secret key size");for(var S=new Uint8Array(lr),y=0;y<S.length;y++)S[y]=h[32+y];return{publicKey:S,secretKey:new Uint8Array(h)}},e.sign.keyPair.fromSeed=function(h){if(En(h),h.length!==ls)throw new Error("bad seed size");for(var S=new Uint8Array(lr),y=new Uint8Array(Ar),u=0;u<32;u++)y[u]=h[u];return Ke(S,y,!0),{publicKey:S,secretKey:y}},e.sign.publicKeyLength=lr,e.sign.secretKeyLength=Ar,e.sign.seedLength=ls,e.sign.signatureLength=qn,e.hash=function(h){En(h);var S=new Uint8Array(hs);return te(S,h,h.length),S},e.hash.hashLength=hs,e.verify=function(h,S){return En(h,S),h.length===0||S.length===0||h.length!==S.length?!1:I(h,0,S,0,h.length)===0},e.setPRNG=function(h){r=h},(function(){var h=typeof self<"u"?self.crypto||self.msCrypto:null;if(h&&h.getRandomValues){var S=65536;e.setPRNG(function(y,u){var D,Z=new Uint8Array(u);for(D=0;D<u;D+=S)h.getRandomValues(Z.subarray(D,D+Math.min(u-D,S)));for(D=0;D<u;D++)y[D]=Z[D];Zu(Z)})}else typeof TA<"u"&&(h=IA,h&&h.randomBytes&&e.setPRNG(function(y,u){var D,Z=h.randomBytes(u);for(D=0;D<u;D++)y[D]=Z[D];Zu(Z)}))})()})(n.exports?n.exports:self.nacl=self.nacl||{})})(Tp)),Tp.exports}var e$=ZP();const lo=cs(e$);var Ip={exports:{}};/*
|
|
40
|
+
* [js-sha512]{@link https://github.com/emn178/js-sha512}
|
|
41
|
+
*
|
|
42
|
+
* @version 0.8.0
|
|
43
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
44
|
+
* @copyright Chen, Yi-Cyuan 2014-2018
|
|
45
|
+
* @license MIT
|
|
46
|
+
*/var eb;function t$(){return eb||(eb=1,(function(n){(function(){var e="input is invalid type",t="finalize already called",r=typeof window=="object",i=r?window:{};i.JS_SHA512_NO_WINDOW&&(r=!1);var o=!r&&typeof self=="object",s=!i.JS_SHA512_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=$f:o&&(i=self);var a=!i.JS_SHA512_NO_COMMON_JS&&!0&&n.exports,l=!i.JS_SHA512_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),d=[-2147483648,8388608,32768,128],f=[24,16,8,0],m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],w=["hex","array","digest","arrayBuffer"],k=[];(i.JS_SHA512_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(E){return Object.prototype.toString.call(E)==="[object Array]"}),l&&(i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});var I=function(E,N){return function(p){return new R(N,!0).update(p)[E]()}},x=function(E){var N=I("hex",E);N.create=function(){return new R(E)},N.update=function(v){return N.create().update(v)};for(var p=0;p<w.length;++p){var F=w[p];N[F]=I(F,E)}return N},T=function(E,N){return function(p,F){return new L(p,N,!0).update(F)[E]()}},b=function(E){var N=T("hex",E);N.create=function(v){return new L(v,E)},N.update=function(v,O){return N.create(v).update(O)};for(var p=0;p<w.length;++p){var F=w[p];N[F]=T(F,E)}return N};function R(E,N){N?(k[0]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=k[16]=k[17]=k[18]=k[19]=k[20]=k[21]=k[22]=k[23]=k[24]=k[25]=k[26]=k[27]=k[28]=k[29]=k[30]=k[31]=k[32]=0,this.blocks=k):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],E==384?(this.h0h=3418070365,this.h0l=3238371032,this.h1h=1654270250,this.h1l=914150663,this.h2h=2438529370,this.h2l=812702999,this.h3h=355462360,this.h3l=4144912697,this.h4h=1731405415,this.h4l=4290775857,this.h5h=2394180231,this.h5l=1750603025,this.h6h=3675008525,this.h6l=1694076839,this.h7h=1203062813,this.h7l=3204075428):E==256?(this.h0h=573645204,this.h0l=4230739756,this.h1h=2673172387,this.h1l=3360449730,this.h2h=596883563,this.h2l=1867755857,this.h3h=2520282905,this.h3l=1497426621,this.h4h=2519219938,this.h4l=2827943907,this.h5h=3193839141,this.h5l=1401305490,this.h6h=721525244,this.h6l=746961066,this.h7h=246885852,this.h7l=2177182882):E==224?(this.h0h=2352822216,this.h0l=424955298,this.h1h=1944164710,this.h1l=2312950998,this.h2h=502970286,this.h2l=855612546,this.h3h=1738396948,this.h3l=1479516111,this.h4h=258812777,this.h4l=2077511080,this.h5h=2011393907,this.h5l=79989058,this.h6h=1067287976,this.h6l=1780299464,this.h7h=286451373,this.h7l=2446758561):(this.h0h=1779033703,this.h0l=4089235720,this.h1h=3144134277,this.h1l=2227873595,this.h2h=1013904242,this.h2l=4271175723,this.h3h=2773480762,this.h3l=1595750129,this.h4h=1359893119,this.h4l=2917565137,this.h5h=2600822924,this.h5l=725511199,this.h6h=528734635,this.h6l=4215389547,this.h7h=1541459225,this.h7l=327033209),this.bits=E,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1}R.prototype.update=function(E){if(this.finalized)throw new Error(t);var N,p=typeof E;if(p!=="string"){if(p==="object"){if(E===null)throw new Error(e);if(l&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!l||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);N=!0}for(var F,v=0,O,C=E.length,V=this.blocks;v<C;){if(this.hashed&&(this.hashed=!1,V[0]=this.block,V[1]=V[2]=V[3]=V[4]=V[5]=V[6]=V[7]=V[8]=V[9]=V[10]=V[11]=V[12]=V[13]=V[14]=V[15]=V[16]=V[17]=V[18]=V[19]=V[20]=V[21]=V[22]=V[23]=V[24]=V[25]=V[26]=V[27]=V[28]=V[29]=V[30]=V[31]=V[32]=0),N)for(O=this.start;v<C&&O<128;++v)V[O>>2]|=E[v]<<f[O++&3];else for(O=this.start;v<C&&O<128;++v)F=E.charCodeAt(v),F<128?V[O>>2]|=F<<f[O++&3]:F<2048?(V[O>>2]|=(192|F>>6)<<f[O++&3],V[O>>2]|=(128|F&63)<<f[O++&3]):F<55296||F>=57344?(V[O>>2]|=(224|F>>12)<<f[O++&3],V[O>>2]|=(128|F>>6&63)<<f[O++&3],V[O>>2]|=(128|F&63)<<f[O++&3]):(F=65536+((F&1023)<<10|E.charCodeAt(++v)&1023),V[O>>2]|=(240|F>>18)<<f[O++&3],V[O>>2]|=(128|F>>12&63)<<f[O++&3],V[O>>2]|=(128|F>>6&63)<<f[O++&3],V[O>>2]|=(128|F&63)<<f[O++&3]);this.lastByteIndex=O,this.bytes+=O-this.start,O>=128?(this.block=V[32],this.start=O-128,this.hash(),this.hashed=!0):this.start=O}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},R.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,N=this.lastByteIndex;E[32]=this.block,E[N>>2]|=d[N&3],this.block=E[32],N>=112&&(this.hashed||this.hash(),E[0]=this.block,E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=E[16]=E[17]=E[18]=E[19]=E[20]=E[21]=E[22]=E[23]=E[24]=E[25]=E[26]=E[27]=E[28]=E[29]=E[30]=E[31]=E[32]=0),E[30]=this.hBytes<<3|this.bytes>>>29,E[31]=this.bytes<<3,this.hash()}},R.prototype.hash=function(){var E=this.h0h,N=this.h0l,p=this.h1h,F=this.h1l,v=this.h2h,O=this.h2l,C=this.h3h,V=this.h3l,H=this.h4h,_=this.h4l,ee=this.h5h,oe=this.h5l,z=this.h6h,ue=this.h6l,De=this.h7h,ve=this.h7l,Te=this.blocks,de,ie,ke,Ie,Ze,Ee,be,g,A,M,W,U,q,re,j,X,te,Q,le,fe,ye,Ve,Ke,wt,et;for(de=32;de<160;de+=2)fe=Te[de-30],ye=Te[de-29],ie=(fe>>>1|ye<<31)^(fe>>>8|ye<<24)^fe>>>7,ke=(ye>>>1|fe<<31)^(ye>>>8|fe<<24)^(ye>>>7|fe<<25),fe=Te[de-4],ye=Te[de-3],Ie=(fe>>>19|ye<<13)^(ye>>>29|fe<<3)^fe>>>6,Ze=(ye>>>19|fe<<13)^(fe>>>29|ye<<3)^(ye>>>6|fe<<26),fe=Te[de-32],ye=Te[de-31],Ve=Te[de-14],Ke=Te[de-13],Ee=(Ke&65535)+(ye&65535)+(ke&65535)+(Ze&65535),be=(Ke>>>16)+(ye>>>16)+(ke>>>16)+(Ze>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(ie&65535)+(Ie&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(ie>>>16)+(Ie>>>16)+(g>>>16),Te[de]=A<<16|g&65535,Te[de+1]=be<<16|Ee&65535;var tt=E,vt=N,zt=p,Lt=F,Ut=v,Ft=O,Nt=C,xt=V,St=H,at=_,Yt=ee,Xt=oe,en=z,rn=ue,sn=De,an=ve;for(X=zt&Ut,te=Lt&Ft,de=0;de<160;de+=8)ie=(tt>>>28|vt<<4)^(vt>>>2|tt<<30)^(vt>>>7|tt<<25),ke=(vt>>>28|tt<<4)^(tt>>>2|vt<<30)^(tt>>>7|vt<<25),Ie=(St>>>14|at<<18)^(St>>>18|at<<14)^(at>>>9|St<<23),Ze=(at>>>14|St<<18)^(at>>>18|St<<14)^(St>>>9|at<<23),M=tt&zt,W=vt&Lt,Q=M^tt&Ut^X,le=W^vt&Ft^te,wt=St&Yt^~St&en,et=at&Xt^~at&rn,fe=Te[de],ye=Te[de+1],Ve=m[de],Ke=m[de+1],Ee=(Ke&65535)+(ye&65535)+(et&65535)+(Ze&65535)+(an&65535),be=(Ke>>>16)+(ye>>>16)+(et>>>16)+(Ze>>>16)+(an>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(wt&65535)+(Ie&65535)+(sn&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(wt>>>16)+(Ie>>>16)+(sn>>>16)+(g>>>16),fe=A<<16|g&65535,ye=be<<16|Ee&65535,Ee=(le&65535)+(ke&65535),be=(le>>>16)+(ke>>>16)+(Ee>>>16),g=(Q&65535)+(ie&65535)+(be>>>16),A=(Q>>>16)+(ie>>>16)+(g>>>16),Ve=A<<16|g&65535,Ke=be<<16|Ee&65535,Ee=(xt&65535)+(ye&65535),be=(xt>>>16)+(ye>>>16)+(Ee>>>16),g=(Nt&65535)+(fe&65535)+(be>>>16),A=(Nt>>>16)+(fe>>>16)+(g>>>16),sn=A<<16|g&65535,an=be<<16|Ee&65535,Ee=(Ke&65535)+(ye&65535),be=(Ke>>>16)+(ye>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(g>>>16),Nt=A<<16|g&65535,xt=be<<16|Ee&65535,ie=(Nt>>>28|xt<<4)^(xt>>>2|Nt<<30)^(xt>>>7|Nt<<25),ke=(xt>>>28|Nt<<4)^(Nt>>>2|xt<<30)^(Nt>>>7|xt<<25),Ie=(sn>>>14|an<<18)^(sn>>>18|an<<14)^(an>>>9|sn<<23),Ze=(an>>>14|sn<<18)^(an>>>18|sn<<14)^(sn>>>9|an<<23),U=Nt&tt,q=xt&vt,Q=U^Nt&zt^M,le=q^xt&Lt^W,wt=sn&St^~sn&Yt,et=an&at^~an&Xt,fe=Te[de+2],ye=Te[de+3],Ve=m[de+2],Ke=m[de+3],Ee=(Ke&65535)+(ye&65535)+(et&65535)+(Ze&65535)+(rn&65535),be=(Ke>>>16)+(ye>>>16)+(et>>>16)+(Ze>>>16)+(rn>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(wt&65535)+(Ie&65535)+(en&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(wt>>>16)+(Ie>>>16)+(en>>>16)+(g>>>16),fe=A<<16|g&65535,ye=be<<16|Ee&65535,Ee=(le&65535)+(ke&65535),be=(le>>>16)+(ke>>>16)+(Ee>>>16),g=(Q&65535)+(ie&65535)+(be>>>16),A=(Q>>>16)+(ie>>>16)+(g>>>16),Ve=A<<16|g&65535,Ke=be<<16|Ee&65535,Ee=(Ft&65535)+(ye&65535),be=(Ft>>>16)+(ye>>>16)+(Ee>>>16),g=(Ut&65535)+(fe&65535)+(be>>>16),A=(Ut>>>16)+(fe>>>16)+(g>>>16),en=A<<16|g&65535,rn=be<<16|Ee&65535,Ee=(Ke&65535)+(ye&65535),be=(Ke>>>16)+(ye>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(g>>>16),Ut=A<<16|g&65535,Ft=be<<16|Ee&65535,ie=(Ut>>>28|Ft<<4)^(Ft>>>2|Ut<<30)^(Ft>>>7|Ut<<25),ke=(Ft>>>28|Ut<<4)^(Ut>>>2|Ft<<30)^(Ut>>>7|Ft<<25),Ie=(en>>>14|rn<<18)^(en>>>18|rn<<14)^(rn>>>9|en<<23),Ze=(rn>>>14|en<<18)^(rn>>>18|en<<14)^(en>>>9|rn<<23),re=Ut&Nt,j=Ft&xt,Q=re^Ut&tt^U,le=j^Ft&vt^q,wt=en&sn^~en&St,et=rn&an^~rn&at,fe=Te[de+4],ye=Te[de+5],Ve=m[de+4],Ke=m[de+5],Ee=(Ke&65535)+(ye&65535)+(et&65535)+(Ze&65535)+(Xt&65535),be=(Ke>>>16)+(ye>>>16)+(et>>>16)+(Ze>>>16)+(Xt>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(wt&65535)+(Ie&65535)+(Yt&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(wt>>>16)+(Ie>>>16)+(Yt>>>16)+(g>>>16),fe=A<<16|g&65535,ye=be<<16|Ee&65535,Ee=(le&65535)+(ke&65535),be=(le>>>16)+(ke>>>16)+(Ee>>>16),g=(Q&65535)+(ie&65535)+(be>>>16),A=(Q>>>16)+(ie>>>16)+(g>>>16),Ve=A<<16|g&65535,Ke=be<<16|Ee&65535,Ee=(Lt&65535)+(ye&65535),be=(Lt>>>16)+(ye>>>16)+(Ee>>>16),g=(zt&65535)+(fe&65535)+(be>>>16),A=(zt>>>16)+(fe>>>16)+(g>>>16),Yt=A<<16|g&65535,Xt=be<<16|Ee&65535,Ee=(Ke&65535)+(ye&65535),be=(Ke>>>16)+(ye>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(g>>>16),zt=A<<16|g&65535,Lt=be<<16|Ee&65535,ie=(zt>>>28|Lt<<4)^(Lt>>>2|zt<<30)^(Lt>>>7|zt<<25),ke=(Lt>>>28|zt<<4)^(zt>>>2|Lt<<30)^(zt>>>7|Lt<<25),Ie=(Yt>>>14|Xt<<18)^(Yt>>>18|Xt<<14)^(Xt>>>9|Yt<<23),Ze=(Xt>>>14|Yt<<18)^(Xt>>>18|Yt<<14)^(Yt>>>9|Xt<<23),X=zt&Ut,te=Lt&Ft,Q=X^zt&Nt^re,le=te^Lt&xt^j,wt=Yt&en^~Yt&sn,et=Xt&rn^~Xt&an,fe=Te[de+6],ye=Te[de+7],Ve=m[de+6],Ke=m[de+7],Ee=(Ke&65535)+(ye&65535)+(et&65535)+(Ze&65535)+(at&65535),be=(Ke>>>16)+(ye>>>16)+(et>>>16)+(Ze>>>16)+(at>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(wt&65535)+(Ie&65535)+(St&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(wt>>>16)+(Ie>>>16)+(St>>>16)+(g>>>16),fe=A<<16|g&65535,ye=be<<16|Ee&65535,Ee=(le&65535)+(ke&65535),be=(le>>>16)+(ke>>>16)+(Ee>>>16),g=(Q&65535)+(ie&65535)+(be>>>16),A=(Q>>>16)+(ie>>>16)+(g>>>16),Ve=A<<16|g&65535,Ke=be<<16|Ee&65535,Ee=(vt&65535)+(ye&65535),be=(vt>>>16)+(ye>>>16)+(Ee>>>16),g=(tt&65535)+(fe&65535)+(be>>>16),A=(tt>>>16)+(fe>>>16)+(g>>>16),St=A<<16|g&65535,at=be<<16|Ee&65535,Ee=(Ke&65535)+(ye&65535),be=(Ke>>>16)+(ye>>>16)+(Ee>>>16),g=(Ve&65535)+(fe&65535)+(be>>>16),A=(Ve>>>16)+(fe>>>16)+(g>>>16),tt=A<<16|g&65535,vt=be<<16|Ee&65535;Ee=(N&65535)+(vt&65535),be=(N>>>16)+(vt>>>16)+(Ee>>>16),g=(E&65535)+(tt&65535)+(be>>>16),A=(E>>>16)+(tt>>>16)+(g>>>16),this.h0h=A<<16|g&65535,this.h0l=be<<16|Ee&65535,Ee=(F&65535)+(Lt&65535),be=(F>>>16)+(Lt>>>16)+(Ee>>>16),g=(p&65535)+(zt&65535)+(be>>>16),A=(p>>>16)+(zt>>>16)+(g>>>16),this.h1h=A<<16|g&65535,this.h1l=be<<16|Ee&65535,Ee=(O&65535)+(Ft&65535),be=(O>>>16)+(Ft>>>16)+(Ee>>>16),g=(v&65535)+(Ut&65535)+(be>>>16),A=(v>>>16)+(Ut>>>16)+(g>>>16),this.h2h=A<<16|g&65535,this.h2l=be<<16|Ee&65535,Ee=(V&65535)+(xt&65535),be=(V>>>16)+(xt>>>16)+(Ee>>>16),g=(C&65535)+(Nt&65535)+(be>>>16),A=(C>>>16)+(Nt>>>16)+(g>>>16),this.h3h=A<<16|g&65535,this.h3l=be<<16|Ee&65535,Ee=(_&65535)+(at&65535),be=(_>>>16)+(at>>>16)+(Ee>>>16),g=(H&65535)+(St&65535)+(be>>>16),A=(H>>>16)+(St>>>16)+(g>>>16),this.h4h=A<<16|g&65535,this.h4l=be<<16|Ee&65535,Ee=(oe&65535)+(Xt&65535),be=(oe>>>16)+(Xt>>>16)+(Ee>>>16),g=(ee&65535)+(Yt&65535)+(be>>>16),A=(ee>>>16)+(Yt>>>16)+(g>>>16),this.h5h=A<<16|g&65535,this.h5l=be<<16|Ee&65535,Ee=(ue&65535)+(rn&65535),be=(ue>>>16)+(rn>>>16)+(Ee>>>16),g=(z&65535)+(en&65535)+(be>>>16),A=(z>>>16)+(en>>>16)+(g>>>16),this.h6h=A<<16|g&65535,this.h6l=be<<16|Ee&65535,Ee=(ve&65535)+(an&65535),be=(ve>>>16)+(an>>>16)+(Ee>>>16),g=(De&65535)+(sn&65535)+(be>>>16),A=(De>>>16)+(sn>>>16)+(g>>>16),this.h7h=A<<16|g&65535,this.h7l=be<<16|Ee&65535},R.prototype.hex=function(){this.finalize();var E=this.h0h,N=this.h0l,p=this.h1h,F=this.h1l,v=this.h2h,O=this.h2l,C=this.h3h,V=this.h3l,H=this.h4h,_=this.h4l,ee=this.h5h,oe=this.h5l,z=this.h6h,ue=this.h6l,De=this.h7h,ve=this.h7l,Te=this.bits,de=c[E>>28&15]+c[E>>24&15]+c[E>>20&15]+c[E>>16&15]+c[E>>12&15]+c[E>>8&15]+c[E>>4&15]+c[E&15]+c[N>>28&15]+c[N>>24&15]+c[N>>20&15]+c[N>>16&15]+c[N>>12&15]+c[N>>8&15]+c[N>>4&15]+c[N&15]+c[p>>28&15]+c[p>>24&15]+c[p>>20&15]+c[p>>16&15]+c[p>>12&15]+c[p>>8&15]+c[p>>4&15]+c[p&15]+c[F>>28&15]+c[F>>24&15]+c[F>>20&15]+c[F>>16&15]+c[F>>12&15]+c[F>>8&15]+c[F>>4&15]+c[F&15]+c[v>>28&15]+c[v>>24&15]+c[v>>20&15]+c[v>>16&15]+c[v>>12&15]+c[v>>8&15]+c[v>>4&15]+c[v&15]+c[O>>28&15]+c[O>>24&15]+c[O>>20&15]+c[O>>16&15]+c[O>>12&15]+c[O>>8&15]+c[O>>4&15]+c[O&15]+c[C>>28&15]+c[C>>24&15]+c[C>>20&15]+c[C>>16&15]+c[C>>12&15]+c[C>>8&15]+c[C>>4&15]+c[C&15];return Te>=256&&(de+=c[V>>28&15]+c[V>>24&15]+c[V>>20&15]+c[V>>16&15]+c[V>>12&15]+c[V>>8&15]+c[V>>4&15]+c[V&15]),Te>=384&&(de+=c[H>>28&15]+c[H>>24&15]+c[H>>20&15]+c[H>>16&15]+c[H>>12&15]+c[H>>8&15]+c[H>>4&15]+c[H&15]+c[_>>28&15]+c[_>>24&15]+c[_>>20&15]+c[_>>16&15]+c[_>>12&15]+c[_>>8&15]+c[_>>4&15]+c[_&15]+c[ee>>28&15]+c[ee>>24&15]+c[ee>>20&15]+c[ee>>16&15]+c[ee>>12&15]+c[ee>>8&15]+c[ee>>4&15]+c[ee&15]+c[oe>>28&15]+c[oe>>24&15]+c[oe>>20&15]+c[oe>>16&15]+c[oe>>12&15]+c[oe>>8&15]+c[oe>>4&15]+c[oe&15]),Te==512&&(de+=c[z>>28&15]+c[z>>24&15]+c[z>>20&15]+c[z>>16&15]+c[z>>12&15]+c[z>>8&15]+c[z>>4&15]+c[z&15]+c[ue>>28&15]+c[ue>>24&15]+c[ue>>20&15]+c[ue>>16&15]+c[ue>>12&15]+c[ue>>8&15]+c[ue>>4&15]+c[ue&15]+c[De>>28&15]+c[De>>24&15]+c[De>>20&15]+c[De>>16&15]+c[De>>12&15]+c[De>>8&15]+c[De>>4&15]+c[De&15]+c[ve>>28&15]+c[ve>>24&15]+c[ve>>20&15]+c[ve>>16&15]+c[ve>>12&15]+c[ve>>8&15]+c[ve>>4&15]+c[ve&15]),de},R.prototype.toString=R.prototype.hex,R.prototype.digest=function(){this.finalize();var E=this.h0h,N=this.h0l,p=this.h1h,F=this.h1l,v=this.h2h,O=this.h2l,C=this.h3h,V=this.h3l,H=this.h4h,_=this.h4l,ee=this.h5h,oe=this.h5l,z=this.h6h,ue=this.h6l,De=this.h7h,ve=this.h7l,Te=this.bits,de=[E>>24&255,E>>16&255,E>>8&255,E&255,N>>24&255,N>>16&255,N>>8&255,N&255,p>>24&255,p>>16&255,p>>8&255,p&255,F>>24&255,F>>16&255,F>>8&255,F&255,v>>24&255,v>>16&255,v>>8&255,v&255,O>>24&255,O>>16&255,O>>8&255,O&255,C>>24&255,C>>16&255,C>>8&255,C&255];return Te>=256&&de.push(V>>24&255,V>>16&255,V>>8&255,V&255),Te>=384&&de.push(H>>24&255,H>>16&255,H>>8&255,H&255,_>>24&255,_>>16&255,_>>8&255,_&255,ee>>24&255,ee>>16&255,ee>>8&255,ee&255,oe>>24&255,oe>>16&255,oe>>8&255,oe&255),Te==512&&de.push(z>>24&255,z>>16&255,z>>8&255,z&255,ue>>24&255,ue>>16&255,ue>>8&255,ue&255,De>>24&255,De>>16&255,De>>8&255,De&255,ve>>24&255,ve>>16&255,ve>>8&255,ve&255),de},R.prototype.array=R.prototype.digest,R.prototype.arrayBuffer=function(){this.finalize();var E=this.bits,N=new ArrayBuffer(E/8),p=new DataView(N);return p.setUint32(0,this.h0h),p.setUint32(4,this.h0l),p.setUint32(8,this.h1h),p.setUint32(12,this.h1l),p.setUint32(16,this.h2h),p.setUint32(20,this.h2l),p.setUint32(24,this.h3h),E>=256&&p.setUint32(28,this.h3l),E>=384&&(p.setUint32(32,this.h4h),p.setUint32(36,this.h4l),p.setUint32(40,this.h5h),p.setUint32(44,this.h5l)),E==512&&(p.setUint32(48,this.h6h),p.setUint32(52,this.h6l),p.setUint32(56,this.h7h),p.setUint32(60,this.h7l)),N},R.prototype.clone=function(){var E=new R(this.bits,!1);return this.copyTo(E),E},R.prototype.copyTo=function(E){var N=0,p=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(N=0;N<p.length;++N)E[p[N]]=this[p[N]];for(N=0;N<this.blocks.length;++N)E.blocks[N]=this.blocks[N]};function L(E,N,p){var F,v=typeof E;if(v!=="string"){if(v==="object"){if(E===null)throw new Error(e);if(l&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!l||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);F=!0}var O=E.length;if(!F){for(var C=[],O=E.length,V=0,H,_=0;_<O;++_)H=E.charCodeAt(_),H<128?C[V++]=H:H<2048?(C[V++]=192|H>>6,C[V++]=128|H&63):H<55296||H>=57344?(C[V++]=224|H>>12,C[V++]=128|H>>6&63,C[V++]=128|H&63):(H=65536+((H&1023)<<10|E.charCodeAt(++_)&1023),C[V++]=240|H>>18,C[V++]=128|H>>12&63,C[V++]=128|H>>6&63,C[V++]=128|H&63);E=C}E.length>128&&(E=new R(N,!0).update(E).array());for(var ee=[],oe=[],_=0;_<128;++_){var z=E[_]||0;ee[_]=92^z,oe[_]=54^z}R.call(this,N,p),this.update(oe),this.oKeyPad=ee,this.inner=!0,this.sharedMemory=p}L.prototype=new R,L.prototype.finalize=function(){if(R.prototype.finalize.call(this),this.inner){this.inner=!1;var E=this.array();R.call(this,this.bits,this.sharedMemory),this.update(this.oKeyPad),this.update(E),R.prototype.finalize.call(this)}},L.prototype.clone=function(){var E=new L([],this.bits,!1);this.copyTo(E),E.inner=this.inner;for(var N=0;N<this.oKeyPad.length;++N)E.oKeyPad[N]=this.oKeyPad[N];return E};var G=x(512);G.sha512=G,G.sha384=x(384),G.sha512_256=x(256),G.sha512_224=x(224),G.sha512.hmac=b(512),G.sha384.hmac=b(384),G.sha512_256.hmac=b(256),G.sha512_224.hmac=b(224),a?n.exports=G:(i.sha512=G.sha512,i.sha384=G.sha384,i.sha512_256=G.sha512_256,i.sha512_224=G.sha512_224)})()})(Ip)),Ip.exports}var n$=t$();const r$=cs(n$);var ul={exports:{}},Mp={exports:{}},Cd={exports:{}},i$=Cd.exports,tb;function F2(){return tb||(tb=1,(function(n){(function(e){var t,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,o=Math.floor,s="[BigNumber Error] ",a=s+"Number primitive has more than 15 significant digits: ",l=1e14,c=14,d=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,w=1e9;function k(E){var N,p,F,v=ie.prototype={constructor:ie,toString:null,valueOf:null},O=new ie(1),C=20,V=4,H=-7,_=21,ee=-1e7,oe=1e7,z=!1,ue=1,De=0,ve={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Te="0123456789abcdefghijklmnopqrstuvwxyz",de=!0;function ie(g,A){var M,W,U,q,re,j,X,te,Q=this;if(!(Q instanceof ie))return new ie(g,A);if(A==null){if(g&&g._isBigNumber===!0){Q.s=g.s,!g.c||g.e>oe?Q.c=Q.e=null:g.e<ee?Q.c=[Q.e=0]:(Q.e=g.e,Q.c=g.c.slice());return}if((j=typeof g=="number")&&g*0==0){if(Q.s=1/g<0?(g=-g,-1):1,g===~~g){for(q=0,re=g;re>=10;re/=10,q++);q>oe?Q.c=Q.e=null:(Q.e=q,Q.c=[g]);return}te=String(g)}else{if(!r.test(te=String(g)))return F(Q,te,j);Q.s=te.charCodeAt(0)==45?(te=te.slice(1),-1):1}(q=te.indexOf("."))>-1&&(te=te.replace(".","")),(re=te.search(/e/i))>0?(q<0&&(q=re),q+=+te.slice(re+1),te=te.substring(0,re)):q<0&&(q=te.length)}else{if(b(A,2,Te.length,"Base"),A==10&&de)return Q=new ie(g),Ee(Q,C+Q.e+1,V);if(te=String(g),j=typeof g=="number"){if(g*0!=0)return F(Q,te,j,A);if(Q.s=1/g<0?(te=te.slice(1),-1):1,ie.DEBUG&&te.replace(/^0\.0*|\./,"").length>15)throw Error(a+g)}else Q.s=te.charCodeAt(0)===45?(te=te.slice(1),-1):1;for(M=Te.slice(0,A),q=re=0,X=te.length;re<X;re++)if(M.indexOf(W=te.charAt(re))<0){if(W=="."){if(re>q){q=X;continue}}else if(!U&&(te==te.toUpperCase()&&(te=te.toLowerCase())||te==te.toLowerCase()&&(te=te.toUpperCase()))){U=!0,re=-1,q=0;continue}return F(Q,String(g),j,A)}j=!1,te=p(te,A,10,Q.s),(q=te.indexOf("."))>-1?te=te.replace(".",""):q=te.length}for(re=0;te.charCodeAt(re)===48;re++);for(X=te.length;te.charCodeAt(--X)===48;);if(te=te.slice(re,++X)){if(X-=re,j&&ie.DEBUG&&X>15&&(g>d||g!==o(g)))throw Error(a+Q.s*g);if((q=q-re-1)>oe)Q.c=Q.e=null;else if(q<ee)Q.c=[Q.e=0];else{if(Q.e=q,Q.c=[],re=(q+1)%c,q<0&&(re+=c),re<X){for(re&&Q.c.push(+te.slice(0,re)),X-=c;re<X;)Q.c.push(+te.slice(re,re+=c));re=c-(te=te.slice(re)).length}else re-=X;for(;re--;te+="0");Q.c.push(+te)}}else Q.c=[Q.e=0]}ie.clone=k,ie.ROUND_UP=0,ie.ROUND_DOWN=1,ie.ROUND_CEIL=2,ie.ROUND_FLOOR=3,ie.ROUND_HALF_UP=4,ie.ROUND_HALF_DOWN=5,ie.ROUND_HALF_EVEN=6,ie.ROUND_HALF_CEIL=7,ie.ROUND_HALF_FLOOR=8,ie.EUCLID=9,ie.config=ie.set=function(g){var A,M;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(A="DECIMAL_PLACES")&&(M=g[A],b(M,0,w,A),C=M),g.hasOwnProperty(A="ROUNDING_MODE")&&(M=g[A],b(M,0,8,A),V=M),g.hasOwnProperty(A="EXPONENTIAL_AT")&&(M=g[A],M&&M.pop?(b(M[0],-w,0,A),b(M[1],0,w,A),H=M[0],_=M[1]):(b(M,-w,w,A),H=-(_=M<0?-M:M))),g.hasOwnProperty(A="RANGE"))if(M=g[A],M&&M.pop)b(M[0],-w,-1,A),b(M[1],1,w,A),ee=M[0],oe=M[1];else if(b(M,-w,w,A),M)ee=-(oe=M<0?-M:M);else throw Error(s+A+" cannot be zero: "+M);if(g.hasOwnProperty(A="CRYPTO"))if(M=g[A],M===!!M)if(M)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))z=M;else throw z=!M,Error(s+"crypto unavailable");else z=M;else throw Error(s+A+" not true or false: "+M);if(g.hasOwnProperty(A="MODULO_MODE")&&(M=g[A],b(M,0,9,A),ue=M),g.hasOwnProperty(A="POW_PRECISION")&&(M=g[A],b(M,0,w,A),De=M),g.hasOwnProperty(A="FORMAT"))if(M=g[A],typeof M=="object")ve=M;else throw Error(s+A+" not an object: "+M);if(g.hasOwnProperty(A="ALPHABET"))if(M=g[A],typeof M=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(M))de=M.slice(0,10)=="0123456789",Te=M;else throw Error(s+A+" invalid: "+M)}else throw Error(s+"Object expected: "+g);return{DECIMAL_PLACES:C,ROUNDING_MODE:V,EXPONENTIAL_AT:[H,_],RANGE:[ee,oe],CRYPTO:z,MODULO_MODE:ue,POW_PRECISION:De,FORMAT:ve,ALPHABET:Te}},ie.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!ie.DEBUG)return!0;var A,M,W=g.c,U=g.e,q=g.s;e:if({}.toString.call(W)=="[object Array]"){if((q===1||q===-1)&&U>=-w&&U<=w&&U===o(U)){if(W[0]===0){if(U===0&&W.length===1)return!0;break e}if(A=(U+1)%c,A<1&&(A+=c),String(W[0]).length==A){for(A=0;A<W.length;A++)if(M=W[A],M<0||M>=l||M!==o(M))break e;if(M!==0)return!0}}}else if(W===null&&U===null&&(q===null||q===1||q===-1))return!0;throw Error(s+"Invalid BigNumber: "+g)},ie.maximum=ie.max=function(){return Ie(arguments,-1)},ie.minimum=ie.min=function(){return Ie(arguments,1)},ie.random=(function(){var g=9007199254740992,A=Math.random()*g&2097151?function(){return o(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(M){var W,U,q,re,j,X=0,te=[],Q=new ie(O);if(M==null?M=C:b(M,0,w),re=i(M/c),z)if(crypto.getRandomValues){for(W=crypto.getRandomValues(new Uint32Array(re*=2));X<re;)j=W[X]*131072+(W[X+1]>>>11),j>=9e15?(U=crypto.getRandomValues(new Uint32Array(2)),W[X]=U[0],W[X+1]=U[1]):(te.push(j%1e14),X+=2);X=re/2}else if(crypto.randomBytes){for(W=crypto.randomBytes(re*=7);X<re;)j=(W[X]&31)*281474976710656+W[X+1]*1099511627776+W[X+2]*4294967296+W[X+3]*16777216+(W[X+4]<<16)+(W[X+5]<<8)+W[X+6],j>=9e15?crypto.randomBytes(7).copy(W,X):(te.push(j%1e14),X+=7);X=re/7}else throw z=!1,Error(s+"crypto unavailable");if(!z)for(;X<re;)j=A(),j<9e15&&(te[X++]=j%1e14);for(re=te[--X],M%=c,re&&M&&(j=f[c-M],te[X]=o(re/j)*j);te[X]===0;te.pop(),X--);if(X<0)te=[q=0];else{for(q=-1;te[0]===0;te.splice(0,1),q-=c);for(X=1,j=te[0];j>=10;j/=10,X++);X<c&&(q-=c-X)}return Q.e=q,Q.c=te,Q}})(),ie.sum=function(){for(var g=1,A=arguments,M=new ie(A[0]);g<A.length;)M=M.plus(A[g++]);return M},p=(function(){var g="0123456789";function A(M,W,U,q){for(var re,j=[0],X,te=0,Q=M.length;te<Q;){for(X=j.length;X--;j[X]*=W);for(j[0]+=q.indexOf(M.charAt(te++)),re=0;re<j.length;re++)j[re]>U-1&&(j[re+1]==null&&(j[re+1]=0),j[re+1]+=j[re]/U|0,j[re]%=U)}return j.reverse()}return function(M,W,U,q,re){var j,X,te,Q,le,fe,ye,Ve,Ke=M.indexOf("."),wt=C,et=V;for(Ke>=0&&(Q=De,De=0,M=M.replace(".",""),Ve=new ie(W),fe=Ve.pow(M.length-Ke),De=Q,Ve.c=A(G(x(fe.c),fe.e,"0"),10,U,g),Ve.e=Ve.c.length),ye=A(M,W,U,re?(j=Te,g):(j=g,Te)),te=Q=ye.length;ye[--Q]==0;ye.pop());if(!ye[0])return j.charAt(0);if(Ke<0?--te:(fe.c=ye,fe.e=te,fe.s=q,fe=N(fe,Ve,wt,et,U),ye=fe.c,le=fe.r,te=fe.e),X=te+wt+1,Ke=ye[X],Q=U/2,le=le||X<0||ye[X+1]!=null,le=et<4?(Ke!=null||le)&&(et==0||et==(fe.s<0?3:2)):Ke>Q||Ke==Q&&(et==4||le||et==6&&ye[X-1]&1||et==(fe.s<0?8:7)),X<1||!ye[0])M=le?G(j.charAt(1),-wt,j.charAt(0)):j.charAt(0);else{if(ye.length=X,le)for(--U;++ye[--X]>U;)ye[X]=0,X||(++te,ye=[1].concat(ye));for(Q=ye.length;!ye[--Q];);for(Ke=0,M="";Ke<=Q;M+=j.charAt(ye[Ke++]));M=G(M,te,j.charAt(0))}return M}})(),N=(function(){function g(W,U,q){var re,j,X,te,Q=0,le=W.length,fe=U%m,ye=U/m|0;for(W=W.slice();le--;)X=W[le]%m,te=W[le]/m|0,re=ye*X+te*fe,j=fe*X+re%m*m+Q,Q=(j/q|0)+(re/m|0)+ye*te,W[le]=j%q;return Q&&(W=[Q].concat(W)),W}function A(W,U,q,re){var j,X;if(q!=re)X=q>re?1:-1;else for(j=X=0;j<q;j++)if(W[j]!=U[j]){X=W[j]>U[j]?1:-1;break}return X}function M(W,U,q,re){for(var j=0;q--;)W[q]-=j,j=W[q]<U[q]?1:0,W[q]=j*re+W[q]-U[q];for(;!W[0]&&W.length>1;W.splice(0,1));}return function(W,U,q,re,j){var X,te,Q,le,fe,ye,Ve,Ke,wt,et,tt,vt,zt,Lt,Ut,Ft,Nt,xt=W.s==U.s?1:-1,St=W.c,at=U.c;if(!St||!St[0]||!at||!at[0])return new ie(!W.s||!U.s||(St?at&&St[0]==at[0]:!at)?NaN:St&&St[0]==0||!at?xt*0:xt/0);for(Ke=new ie(xt),wt=Ke.c=[],te=W.e-U.e,xt=q+te+1,j||(j=l,te=I(W.e/c)-I(U.e/c),xt=xt/c|0),Q=0;at[Q]==(St[Q]||0);Q++);if(at[Q]>(St[Q]||0)&&te--,xt<0)wt.push(1),le=!0;else{for(Lt=St.length,Ft=at.length,Q=0,xt+=2,fe=o(j/(at[0]+1)),fe>1&&(at=g(at,fe,j),St=g(St,fe,j),Ft=at.length,Lt=St.length),zt=Ft,et=St.slice(0,Ft),tt=et.length;tt<Ft;et[tt++]=0);Nt=at.slice(),Nt=[0].concat(Nt),Ut=at[0],at[1]>=j/2&&Ut++;do{if(fe=0,X=A(at,et,Ft,tt),X<0){if(vt=et[0],Ft!=tt&&(vt=vt*j+(et[1]||0)),fe=o(vt/Ut),fe>1)for(fe>=j&&(fe=j-1),ye=g(at,fe,j),Ve=ye.length,tt=et.length;A(ye,et,Ve,tt)==1;)fe--,M(ye,Ft<Ve?Nt:at,Ve,j),Ve=ye.length,X=1;else fe==0&&(X=fe=1),ye=at.slice(),Ve=ye.length;if(Ve<tt&&(ye=[0].concat(ye)),M(et,ye,tt,j),tt=et.length,X==-1)for(;A(at,et,Ft,tt)<1;)fe++,M(et,Ft<tt?Nt:at,tt,j),tt=et.length}else X===0&&(fe++,et=[0]);wt[Q++]=fe,et[0]?et[tt++]=St[zt]||0:(et=[St[zt]],tt=1)}while((zt++<Lt||et[0]!=null)&&xt--);le=et[0]!=null,wt[0]||wt.splice(0,1)}if(j==l){for(Q=1,xt=wt[0];xt>=10;xt/=10,Q++);Ee(Ke,q+(Ke.e=Q+te*c-1)+1,re,le)}else Ke.e=te,Ke.r=+le;return Ke}})();function ke(g,A,M,W){var U,q,re,j,X;if(M==null?M=V:b(M,0,8),!g.c)return g.toString();if(U=g.c[0],re=g.e,A==null)X=x(g.c),X=W==1||W==2&&(re<=H||re>=_)?L(X,re):G(X,re,"0");else if(g=Ee(new ie(g),A,M),q=g.e,X=x(g.c),j=X.length,W==1||W==2&&(A<=q||q<=H)){for(;j<A;X+="0",j++);X=L(X,q)}else if(A-=re+(W===2&&q>re),X=G(X,q,"0"),q+1>j){if(--A>0)for(X+=".";A--;X+="0");}else if(A+=q-j,A>0)for(q+1==j&&(X+=".");A--;X+="0");return g.s<0&&U?"-"+X:X}function Ie(g,A){for(var M,W,U=1,q=new ie(g[0]);U<g.length;U++)W=new ie(g[U]),(!W.s||(M=T(q,W))===A||M===0&&q.s===A)&&(q=W);return q}function Ze(g,A,M){for(var W=1,U=A.length;!A[--U];A.pop());for(U=A[0];U>=10;U/=10,W++);return(M=W+M*c-1)>oe?g.c=g.e=null:M<ee?g.c=[g.e=0]:(g.e=M,g.c=A),g}F=(function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,A=/^([^.]+)\.$/,M=/^\.([^.]+)$/,W=/^-?(Infinity|NaN)$/,U=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(q,re,j,X){var te,Q=j?re:re.replace(U,"");if(W.test(Q))q.s=isNaN(Q)?null:Q<0?-1:1;else{if(!j&&(Q=Q.replace(g,function(le,fe,ye){return te=(ye=ye.toLowerCase())=="x"?16:ye=="b"?2:8,!X||X==te?fe:le}),X&&(te=X,Q=Q.replace(A,"$1").replace(M,"0.$1")),re!=Q))return new ie(Q,te);if(ie.DEBUG)throw Error(s+"Not a"+(X?" base "+X:"")+" number: "+re);q.s=null}q.c=q.e=null}})();function Ee(g,A,M,W){var U,q,re,j,X,te,Q,le=g.c,fe=f;if(le){e:{for(U=1,j=le[0];j>=10;j/=10,U++);if(q=A-U,q<0)q+=c,re=A,X=le[te=0],Q=o(X/fe[U-re-1]%10);else if(te=i((q+1)/c),te>=le.length)if(W){for(;le.length<=te;le.push(0));X=Q=0,U=1,q%=c,re=q-c+1}else break e;else{for(X=j=le[te],U=1;j>=10;j/=10,U++);q%=c,re=q-c+U,Q=re<0?0:o(X/fe[U-re-1]%10)}if(W=W||A<0||le[te+1]!=null||(re<0?X:X%fe[U-re-1]),W=M<4?(Q||W)&&(M==0||M==(g.s<0?3:2)):Q>5||Q==5&&(M==4||W||M==6&&(q>0?re>0?X/fe[U-re]:0:le[te-1])%10&1||M==(g.s<0?8:7)),A<1||!le[0])return le.length=0,W?(A-=g.e+1,le[0]=fe[(c-A%c)%c],g.e=-A||0):le[0]=g.e=0,g;if(q==0?(le.length=te,j=1,te--):(le.length=te+1,j=fe[c-q],le[te]=re>0?o(X/fe[U-re]%fe[re])*j:0),W)for(;;)if(te==0){for(q=1,re=le[0];re>=10;re/=10,q++);for(re=le[0]+=j,j=1;re>=10;re/=10,j++);q!=j&&(g.e++,le[0]==l&&(le[0]=1));break}else{if(le[te]+=j,le[te]!=l)break;le[te--]=0,j=1}for(q=le.length;le[--q]===0;le.pop());}g.e>oe?g.c=g.e=null:g.e<ee&&(g.c=[g.e=0])}return g}function be(g){var A,M=g.e;return M===null?g.toString():(A=x(g.c),A=M<=H||M>=_?L(A,M):G(A,M,"0"),g.s<0?"-"+A:A)}return v.absoluteValue=v.abs=function(){var g=new ie(this);return g.s<0&&(g.s=1),g},v.comparedTo=function(g,A){return T(this,new ie(g,A))},v.decimalPlaces=v.dp=function(g,A){var M,W,U,q=this;if(g!=null)return b(g,0,w),A==null?A=V:b(A,0,8),Ee(new ie(q),g+q.e+1,A);if(!(M=q.c))return null;if(W=((U=M.length-1)-I(this.e/c))*c,U=M[U])for(;U%10==0;U/=10,W--);return W<0&&(W=0),W},v.dividedBy=v.div=function(g,A){return N(this,new ie(g,A),C,V)},v.dividedToIntegerBy=v.idiv=function(g,A){return N(this,new ie(g,A),0,1)},v.exponentiatedBy=v.pow=function(g,A){var M,W,U,q,re,j,X,te,Q,le=this;if(g=new ie(g),g.c&&!g.isInteger())throw Error(s+"Exponent not an integer: "+be(g));if(A!=null&&(A=new ie(A)),j=g.e>14,!le.c||!le.c[0]||le.c[0]==1&&!le.e&&le.c.length==1||!g.c||!g.c[0])return Q=new ie(Math.pow(+be(le),j?g.s*(2-R(g)):+be(g))),A?Q.mod(A):Q;if(X=g.s<0,A){if(A.c?!A.c[0]:!A.s)return new ie(NaN);W=!X&&le.isInteger()&&A.isInteger(),W&&(le=le.mod(A))}else{if(g.e>9&&(le.e>0||le.e<-1||(le.e==0?le.c[0]>1||j&&le.c[1]>=24e7:le.c[0]<8e13||j&&le.c[0]<=9999975e7)))return q=le.s<0&&R(g)?-0:0,le.e>-1&&(q=1/q),new ie(X?1/q:q);De&&(q=i(De/c+2))}for(j?(M=new ie(.5),X&&(g.s=1),te=R(g)):(U=Math.abs(+be(g)),te=U%2),Q=new ie(O);;){if(te){if(Q=Q.times(le),!Q.c)break;q?Q.c.length>q&&(Q.c.length=q):W&&(Q=Q.mod(A))}if(U){if(U=o(U/2),U===0)break;te=U%2}else if(g=g.times(M),Ee(g,g.e+1,1),g.e>14)te=R(g);else{if(U=+be(g),U===0)break;te=U%2}le=le.times(le),q?le.c&&le.c.length>q&&(le.c.length=q):W&&(le=le.mod(A))}return W?Q:(X&&(Q=O.div(Q)),A?Q.mod(A):q?Ee(Q,De,V,re):Q)},v.integerValue=function(g){var A=new ie(this);return g==null?g=V:b(g,0,8),Ee(A,A.e+1,g)},v.isEqualTo=v.eq=function(g,A){return T(this,new ie(g,A))===0},v.isFinite=function(){return!!this.c},v.isGreaterThan=v.gt=function(g,A){return T(this,new ie(g,A))>0},v.isGreaterThanOrEqualTo=v.gte=function(g,A){return(A=T(this,new ie(g,A)))===1||A===0},v.isInteger=function(){return!!this.c&&I(this.e/c)>this.c.length-2},v.isLessThan=v.lt=function(g,A){return T(this,new ie(g,A))<0},v.isLessThanOrEqualTo=v.lte=function(g,A){return(A=T(this,new ie(g,A)))===-1||A===0},v.isNaN=function(){return!this.s},v.isNegative=function(){return this.s<0},v.isPositive=function(){return this.s>0},v.isZero=function(){return!!this.c&&this.c[0]==0},v.minus=function(g,A){var M,W,U,q,re=this,j=re.s;if(g=new ie(g,A),A=g.s,!j||!A)return new ie(NaN);if(j!=A)return g.s=-A,re.plus(g);var X=re.e/c,te=g.e/c,Q=re.c,le=g.c;if(!X||!te){if(!Q||!le)return Q?(g.s=-A,g):new ie(le?re:NaN);if(!Q[0]||!le[0])return le[0]?(g.s=-A,g):new ie(Q[0]?re:V==3?-0:0)}if(X=I(X),te=I(te),Q=Q.slice(),j=X-te){for((q=j<0)?(j=-j,U=Q):(te=X,U=le),U.reverse(),A=j;A--;U.push(0));U.reverse()}else for(W=(q=(j=Q.length)<(A=le.length))?j:A,j=A=0;A<W;A++)if(Q[A]!=le[A]){q=Q[A]<le[A];break}if(q&&(U=Q,Q=le,le=U,g.s=-g.s),A=(W=le.length)-(M=Q.length),A>0)for(;A--;Q[M++]=0);for(A=l-1;W>j;){if(Q[--W]<le[W]){for(M=W;M&&!Q[--M];Q[M]=A);--Q[M],Q[W]+=l}Q[W]-=le[W]}for(;Q[0]==0;Q.splice(0,1),--te);return Q[0]?Ze(g,Q,te):(g.s=V==3?-1:1,g.c=[g.e=0],g)},v.modulo=v.mod=function(g,A){var M,W,U=this;return g=new ie(g,A),!U.c||!g.s||g.c&&!g.c[0]?new ie(NaN):!g.c||U.c&&!U.c[0]?new ie(U):(ue==9?(W=g.s,g.s=1,M=N(U,g,0,3),g.s=W,M.s*=W):M=N(U,g,0,ue),g=U.minus(M.times(g)),!g.c[0]&&ue==1&&(g.s=U.s),g)},v.multipliedBy=v.times=function(g,A){var M,W,U,q,re,j,X,te,Q,le,fe,ye,Ve,Ke,wt,et=this,tt=et.c,vt=(g=new ie(g,A)).c;if(!tt||!vt||!tt[0]||!vt[0])return!et.s||!g.s||tt&&!tt[0]&&!vt||vt&&!vt[0]&&!tt?g.c=g.e=g.s=null:(g.s*=et.s,!tt||!vt?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(W=I(et.e/c)+I(g.e/c),g.s*=et.s,X=tt.length,le=vt.length,X<le&&(Ve=tt,tt=vt,vt=Ve,U=X,X=le,le=U),U=X+le,Ve=[];U--;Ve.push(0));for(Ke=l,wt=m,U=le;--U>=0;){for(M=0,fe=vt[U]%wt,ye=vt[U]/wt|0,re=X,q=U+re;q>U;)te=tt[--re]%wt,Q=tt[re]/wt|0,j=ye*te+Q*fe,te=fe*te+j%wt*wt+Ve[q]+M,M=(te/Ke|0)+(j/wt|0)+ye*Q,Ve[q--]=te%Ke;Ve[q]=M}return M?++W:Ve.splice(0,1),Ze(g,Ve,W)},v.negated=function(){var g=new ie(this);return g.s=-g.s||null,g},v.plus=function(g,A){var M,W=this,U=W.s;if(g=new ie(g,A),A=g.s,!U||!A)return new ie(NaN);if(U!=A)return g.s=-A,W.minus(g);var q=W.e/c,re=g.e/c,j=W.c,X=g.c;if(!q||!re){if(!j||!X)return new ie(U/0);if(!j[0]||!X[0])return X[0]?g:new ie(j[0]?W:U*0)}if(q=I(q),re=I(re),j=j.slice(),U=q-re){for(U>0?(re=q,M=X):(U=-U,M=j),M.reverse();U--;M.push(0));M.reverse()}for(U=j.length,A=X.length,U-A<0&&(M=X,X=j,j=M,A=U),U=0;A;)U=(j[--A]=j[A]+X[A]+U)/l|0,j[A]=l===j[A]?0:j[A]%l;return U&&(j=[U].concat(j),++re),Ze(g,j,re)},v.precision=v.sd=function(g,A){var M,W,U,q=this;if(g!=null&&g!==!!g)return b(g,1,w),A==null?A=V:b(A,0,8),Ee(new ie(q),g,A);if(!(M=q.c))return null;if(U=M.length-1,W=U*c+1,U=M[U]){for(;U%10==0;U/=10,W--);for(U=M[0];U>=10;U/=10,W++);}return g&&q.e+1>W&&(W=q.e+1),W},v.shiftedBy=function(g){return b(g,-d,d),this.times("1e"+g)},v.squareRoot=v.sqrt=function(){var g,A,M,W,U,q=this,re=q.c,j=q.s,X=q.e,te=C+4,Q=new ie("0.5");if(j!==1||!re||!re[0])return new ie(!j||j<0&&(!re||re[0])?NaN:re?q:1/0);if(j=Math.sqrt(+be(q)),j==0||j==1/0?(A=x(re),(A.length+X)%2==0&&(A+="0"),j=Math.sqrt(+A),X=I((X+1)/2)-(X<0||X%2),j==1/0?A="5e"+X:(A=j.toExponential(),A=A.slice(0,A.indexOf("e")+1)+X),M=new ie(A)):M=new ie(j+""),M.c[0]){for(X=M.e,j=X+te,j<3&&(j=0);;)if(U=M,M=Q.times(U.plus(N(q,U,te,1))),x(U.c).slice(0,j)===(A=x(M.c)).slice(0,j))if(M.e<X&&--j,A=A.slice(j-3,j+1),A=="9999"||!W&&A=="4999"){if(!W&&(Ee(U,U.e+C+2,0),U.times(U).eq(q))){M=U;break}te+=4,j+=4,W=1}else{(!+A||!+A.slice(1)&&A.charAt(0)=="5")&&(Ee(M,M.e+C+2,1),g=!M.times(M).eq(q));break}}return Ee(M,M.e+C+1,V,g)},v.toExponential=function(g,A){return g!=null&&(b(g,0,w),g++),ke(this,g,A,1)},v.toFixed=function(g,A){return g!=null&&(b(g,0,w),g=g+this.e+1),ke(this,g,A)},v.toFormat=function(g,A,M){var W,U=this;if(M==null)g!=null&&A&&typeof A=="object"?(M=A,A=null):g&&typeof g=="object"?(M=g,g=A=null):M=ve;else if(typeof M!="object")throw Error(s+"Argument not an object: "+M);if(W=U.toFixed(g,A),U.c){var q,re=W.split("."),j=+M.groupSize,X=+M.secondaryGroupSize,te=M.groupSeparator||"",Q=re[0],le=re[1],fe=U.s<0,ye=fe?Q.slice(1):Q,Ve=ye.length;if(X&&(q=j,j=X,X=q,Ve-=q),j>0&&Ve>0){for(q=Ve%j||j,Q=ye.substr(0,q);q<Ve;q+=j)Q+=te+ye.substr(q,j);X>0&&(Q+=te+ye.slice(q)),fe&&(Q="-"+Q)}W=le?Q+(M.decimalSeparator||"")+((X=+M.fractionGroupSize)?le.replace(new RegExp("\\d{"+X+"}\\B","g"),"$&"+(M.fractionGroupSeparator||"")):le):Q}return(M.prefix||"")+W+(M.suffix||"")},v.toFraction=function(g){var A,M,W,U,q,re,j,X,te,Q,le,fe,ye=this,Ve=ye.c;if(g!=null&&(j=new ie(g),!j.isInteger()&&(j.c||j.s!==1)||j.lt(O)))throw Error(s+"Argument "+(j.isInteger()?"out of range: ":"not an integer: ")+be(j));if(!Ve)return new ie(ye);for(A=new ie(O),te=M=new ie(O),W=X=new ie(O),fe=x(Ve),q=A.e=fe.length-ye.e-1,A.c[0]=f[(re=q%c)<0?c+re:re],g=!g||j.comparedTo(A)>0?q>0?A:te:j,re=oe,oe=1/0,j=new ie(fe),X.c[0]=0;Q=N(j,A,0,1),U=M.plus(Q.times(W)),U.comparedTo(g)!=1;)M=W,W=U,te=X.plus(Q.times(U=te)),X=U,A=j.minus(Q.times(U=A)),j=U;return U=N(g.minus(M),W,0,1),X=X.plus(U.times(te)),M=M.plus(U.times(W)),X.s=te.s=ye.s,q=q*2,le=N(te,W,q,V).minus(ye).abs().comparedTo(N(X,M,q,V).minus(ye).abs())<1?[te,W]:[X,M],oe=re,le},v.toNumber=function(){return+be(this)},v.toPrecision=function(g,A){return g!=null&&b(g,1,w),ke(this,g,A,2)},v.toString=function(g){var A,M=this,W=M.s,U=M.e;return U===null?W?(A="Infinity",W<0&&(A="-"+A)):A="NaN":(g==null?A=U<=H||U>=_?L(x(M.c),U):G(x(M.c),U,"0"):g===10&&de?(M=Ee(new ie(M),C+U+1,V),A=G(x(M.c),M.e,"0")):(b(g,2,Te.length,"Base"),A=p(G(x(M.c),U,"0"),10,g,W,!0)),W<0&&M.c[0]&&(A="-"+A)),A},v.valueOf=v.toJSON=function(){return be(this)},v._isBigNumber=!0,E!=null&&ie.set(E),ie}function I(E){var N=E|0;return E>0||E===N?N:N-1}function x(E){for(var N,p,F=1,v=E.length,O=E[0]+"";F<v;){for(N=E[F++]+"",p=c-N.length;p--;N="0"+N);O+=N}for(v=O.length;O.charCodeAt(--v)===48;);return O.slice(0,v+1||1)}function T(E,N){var p,F,v=E.c,O=N.c,C=E.s,V=N.s,H=E.e,_=N.e;if(!C||!V)return null;if(p=v&&!v[0],F=O&&!O[0],p||F)return p?F?0:-V:C;if(C!=V)return C;if(p=C<0,F=H==_,!v||!O)return F?0:!v^p?1:-1;if(!F)return H>_^p?1:-1;for(V=(H=v.length)<(_=O.length)?H:_,C=0;C<V;C++)if(v[C]!=O[C])return v[C]>O[C]^p?1:-1;return H==_?0:H>_^p?1:-1}function b(E,N,p,F){if(E<N||E>p||E!==o(E))throw Error(s+(F||"Argument")+(typeof E=="number"?E<N||E>p?" out of range: ":" not an integer: ":" not a primitive number: ")+String(E))}function R(E){var N=E.c.length-1;return I(E.e/c)==N&&E.c[N]%2!=0}function L(E,N){return(E.length>1?E.charAt(0)+"."+E.slice(1):E)+(N<0?"e":"e+")+N}function G(E,N,p){var F,v;if(N<0){for(v=p+".";++N;v+=p);E=v+E}else if(F=E.length,++N>F){for(v=p,N-=F;--N;v+=p);E+=v}else N<F&&(E=E.slice(0,N)+"."+E.slice(N));return E}t=k(),t.default=t.BigNumber=t,n.exports?n.exports=t:(e||(e=typeof self<"u"&&self?self:window),e.BigNumber=t)})(i$)})(Cd)),Cd.exports}var nb;function o$(){return nb||(nb=1,(function(n){var e=F2(),t=n.exports;(function(){var r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,i,o,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},a;function l(d){return r.lastIndex=0,r.test(d)?'"'+d.replace(r,function(f){var m=s[f];return typeof m=="string"?m:"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+d+'"'}function c(d,f){var m,w,k,I,x=i,T,b=f[d],R=b!=null&&(b instanceof e||e.isBigNumber(b));switch(b&&typeof b=="object"&&typeof b.toJSON=="function"&&(b=b.toJSON(d)),typeof a=="function"&&(b=a.call(f,d,b)),typeof b){case"string":return R?b:l(b);case"number":return isFinite(b)?String(b):"null";case"boolean":case"null":case"bigint":return String(b);case"object":if(!b)return"null";if(i+=o,T=[],Object.prototype.toString.apply(b)==="[object Array]"){for(I=b.length,m=0;m<I;m+=1)T[m]=c(m,b)||"null";return k=T.length===0?"[]":i?`[
|
|
47
|
+
`+i+T.join(`,
|
|
48
|
+
`+i)+`
|
|
49
|
+
`+x+"]":"["+T.join(",")+"]",i=x,k}if(a&&typeof a=="object")for(I=a.length,m=0;m<I;m+=1)typeof a[m]=="string"&&(w=a[m],k=c(w,b),k&&T.push(l(w)+(i?": ":":")+k));else Object.keys(b).forEach(function(L){var G=c(L,b);G&&T.push(l(L)+(i?": ":":")+G)});return k=T.length===0?"{}":i?`{
|
|
50
|
+
`+i+T.join(`,
|
|
51
|
+
`+i)+`
|
|
52
|
+
`+x+"}":"{"+T.join(",")+"}",i=x,k}}typeof t.stringify!="function"&&(t.stringify=function(d,f,m){var w;if(i="",o="",typeof m=="number")for(w=0;w<m;w+=1)o+=" ";else typeof m=="string"&&(o=m);if(a=f,f&&typeof f!="function"&&(typeof f!="object"||typeof f.length!="number"))throw new Error("JSON.stringify");return c("",{"":d})})})()})(Mp)),Mp.exports}var Rp,rb;function s$(){if(rb)return Rp;rb=1;var n=null;const e=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,t=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;var r=function(i){var o={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(i!=null){if(i.strict===!0&&(o.strict=!0),i.storeAsString===!0&&(o.storeAsString=!0),o.alwaysParseAsBig=i.alwaysParseAsBig===!0?i.alwaysParseAsBig:!1,o.useNativeBigInt=i.useNativeBigInt===!0?i.useNativeBigInt:!1,typeof i.constructorAction<"u")if(i.constructorAction==="error"||i.constructorAction==="ignore"||i.constructorAction==="preserve")o.constructorAction=i.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${i.constructorAction}`);if(typeof i.protoAction<"u")if(i.protoAction==="error"||i.protoAction==="ignore"||i.protoAction==="preserve")o.protoAction=i.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${i.protoAction}`)}var s,a,l={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
53
|
+
`,r:"\r",t:" "},c,d=function(R){throw{name:"SyntaxError",message:R,at:s,text:c}},f=function(R){return R&&R!==a&&d("Expected '"+R+"' instead of '"+a+"'"),a=c.charAt(s),s+=1,a},m=function(){var R,L="";for(a==="-"&&(L="-",f("-"));a>="0"&&a<="9";)L+=a,f();if(a===".")for(L+=".";f()&&a>="0"&&a<="9";)L+=a;if(a==="e"||a==="E")for(L+=a,f(),(a==="-"||a==="+")&&(L+=a,f());a>="0"&&a<="9";)L+=a,f();if(R=+L,!isFinite(R))d("Bad number");else return n==null&&(n=F2()),L.length>15?o.storeAsString?L:o.useNativeBigInt?BigInt(L):new n(L):o.alwaysParseAsBig?o.useNativeBigInt?BigInt(R):new n(R):R},w=function(){var R,L,G="",E;if(a==='"')for(var N=s;f();){if(a==='"')return s-1>N&&(G+=c.substring(N,s-1)),f(),G;if(a==="\\"){if(s-1>N&&(G+=c.substring(N,s-1)),f(),a==="u"){for(E=0,L=0;L<4&&(R=parseInt(f(),16),!!isFinite(R));L+=1)E=E*16+R;G+=String.fromCharCode(E)}else if(typeof l[a]=="string")G+=l[a];else break;N=s}}d("Bad string")},k=function(){for(;a&&a<=" ";)f()},I=function(){switch(a){case"t":return f("t"),f("r"),f("u"),f("e"),!0;case"f":return f("f"),f("a"),f("l"),f("s"),f("e"),!1;case"n":return f("n"),f("u"),f("l"),f("l"),null}d("Unexpected '"+a+"'")},x,T=function(){var R=[];if(a==="["){if(f("["),k(),a==="]")return f("]"),R;for(;a;){if(R.push(x()),k(),a==="]")return f("]"),R;f(","),k()}}d("Bad array")},b=function(){var R,L=Object.create(null);if(a==="{"){if(f("{"),k(),a==="}")return f("}"),L;for(;a;){if(R=w(),k(),f(":"),o.strict===!0&&Object.hasOwnProperty.call(L,R)&&d('Duplicate key "'+R+'"'),e.test(R)===!0?o.protoAction==="error"?d("Object contains forbidden prototype property"):o.protoAction==="ignore"?x():L[R]=x():t.test(R)===!0?o.constructorAction==="error"?d("Object contains forbidden constructor property"):o.constructorAction==="ignore"?x():L[R]=x():L[R]=x(),k(),a==="}")return f("}"),L;f(","),k()}}d("Bad object")};return x=function(){switch(k(),a){case"{":return b();case"[":return T();case'"':return w();case"-":return m();default:return a>="0"&&a<="9"?m():I()}},function(R,L){var G;return c=R+"",s=0,a=" ",G=x(),k(),a&&d("Syntax error"),typeof L=="function"?(function E(N,p){var F,v=N[p];return v&&typeof v=="object"&&Object.keys(v).forEach(function(O){F=E(v,O),F!==void 0?v[O]=F:delete v[O]}),L.call(N,p,v)})({"":G},""):G}};return Rp=r,Rp}var ib;function a$(){if(ib)return ul.exports;ib=1;var n=o$().stringify,e=s$();return ul.exports=function(t){return{parse:e(t),stringify:n}},ul.exports.parse=e(),ul.exports.stringify=n,ul.exports}var c$=a$();const u$=cs(c$);var Vn;(function(n){n.UNSAFE="unsafe",n.SAFE="safe",n.MIXED="mixed",n.BIGINT="bigint"})(Vn||(Vn={}));const T2=u$({useNativeBigInt:!0,strict:!0});function sE(n,{intDecoding:e}){if(e!==Vn.SAFE&&e!==Vn.UNSAFE&&e!==Vn.BIGINT&&e!==Vn.MIXED)throw new Error(`Invalid intDecoding option: ${e}`);return T2.parse(n,(t,r)=>{if(r!=null&&typeof r=="object"&&Object.getPrototypeOf(r)==null&&Object.setPrototypeOf(r,Object.prototype),typeof r=="bigint"){if(e===Vn.SAFE&&r>Number.MAX_SAFE_INTEGER)throw new Error(`Integer exceeds maximum safe integer: ${r.toString()}. Try parsing with a different intDecoding option.`);return e===Vn.BIGINT||e===Vn.MIXED&&r>Number.MAX_SAFE_INTEGER?r:Number(r)}return typeof r=="number"&&e===Vn.BIGINT&&Number.isInteger(r)?BigInt(r):r})}function aa(n,e,t){return T2.stringify(n,e,t)}function Mi(n,e){return n.length!==e.length?!1:Array.from(n).every((t,r)=>t===e[r])}function jn(...n){const e=n.reduce((i,o)=>i+o.length,0),t=new Uint8Array(e);let r=0;for(let i=0;i<n.length;i++)t.set(n[i],r),r+=n[i].length;return t}function Dg(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"}function l$(){const{navigator:n}=globalThis;return typeof n=="object"&&n.product==="ReactNative"}function Xe(n){if(typeof n>"u")throw new Error("Value is undefined");if(typeof n=="bigint"){if(n>BigInt(Number.MAX_SAFE_INTEGER)||n<BigInt(Number.MIN_SAFE_INTEGER))throw new Error(`BigInt value ${n} is not a safe integer`);return Number(n)}if(typeof n=="number"){if(Number.isSafeInteger(n))return n;throw new Error(`Value ${n} is not a safe integer`)}throw new Error(`Unexpected type ${typeof n}, ${n}`)}function Xn(n){const e=Xe(n);if(e<0)throw new Error(`Value ${e} is negative`);return e}function Pe(n){if(typeof n>"u")throw new Error("Value is undefined");if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new Error(`Value ${n} is not a safe integer`);return BigInt(n)}throw new Error(`Unexpected type ${typeof n}, ${n}`)}function wn(n){const e=Pe(n);if(e<0||e>BigInt("0xffffffffffffffff"))throw new Error(`Value ${e} is not a uint64`);return e}function ro(n){return r$.sha512_256.array(n)}function h$(n){return l$()&&console.warn("It looks like you're running in react-native. In order to perform common crypto operations you will need to polyfill common operations such as crypto.getRandomValues"),lo.randomBytes(n)}function I2(n){return lo.sign.keyPair.fromSeed(n)}function d$(){const n=h$(lo.box.secretKeyLength);return I2(n)}function M2(n){return n===lo.sign.signatureLength}function Fg(n){return lo.sign.keyPair.fromSecretKey(n)}function ih(n,e){return lo.sign.detached(n,e)}function R2(n,e){return lo.verify(n,e)}function Tg(n,e,t){return lo.sign.detached.verify(n,e,t)}const C2=lo.sign.publicKeyLength,ob=32,wv=32;var Cp={exports:{}};/*
|
|
54
|
+
* [hi-base32]{@link https://github.com/emn178/hi-base32}
|
|
55
|
+
*
|
|
56
|
+
* @version 0.5.0
|
|
57
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
58
|
+
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
59
|
+
* @license MIT
|
|
60
|
+
*/var sb;function f$(){return sb||(sb=1,(function(n){(function(){var e=typeof window=="object"?window:{},t=!e.HI_BASE32_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;t&&(e=$f);var r=!e.HI_BASE32_NO_COMMON_JS&&!0&&n.exports,i="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),o={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},s=[0,0,0,0,0,0,0,0],a=function(x,T){T.length>10&&(T="..."+T.substr(-10));var b=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+x+" bytes: "+T+" <-");throw b.position=x,b},l=function(x){for(var T="",b=x.length,R=0,L=0,G,E;R<b;){if(G=x[R++],G<=127){T+=String.fromCharCode(G);continue}else G>191&&G<=223?(E=G&31,L=1):G<=239?(E=G&15,L=2):G<=247?(E=G&7,L=3):a(R,T);for(var N=0;N<L;++N)G=x[R++],(G<128||G>191)&&a(R,T),E<<=6,E+=G&63;E>=55296&&E<=57343&&a(R,T),E>1114111&&a(R,T),E<=65535?T+=String.fromCharCode(E):(E-=65536,T+=String.fromCharCode((E>>10)+55296),T+=String.fromCharCode((E&1023)+56320))}return T},c=function(x){if(x==="")return[];if(!/^[A-Z2-7=]+$/.test(x))throw new Error("Invalid base32 characters");x=x.replace(/=/g,"");for(var T,b,R,L,G,E,N,p,F=[],v=0,O=x.length,C=0,V=O>>3<<3;C<V;)T=o[x.charAt(C++)],b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],E=o[x.charAt(C++)],N=o[x.charAt(C++)],p=o[x.charAt(C++)],F[v++]=(T<<3|b>>>2)&255,F[v++]=(b<<6|R<<1|L>>>4)&255,F[v++]=(L<<4|G>>>1)&255,F[v++]=(G<<7|E<<2|N>>>3)&255,F[v++]=(N<<5|p)&255;var H=O-V;return H===2?(T=o[x.charAt(C++)],b=o[x.charAt(C++)],F[v++]=(T<<3|b>>>2)&255):H===4?(T=o[x.charAt(C++)],b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],F[v++]=(T<<3|b>>>2)&255,F[v++]=(b<<6|R<<1|L>>>4)&255):H===5?(T=o[x.charAt(C++)],b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],F[v++]=(T<<3|b>>>2)&255,F[v++]=(b<<6|R<<1|L>>>4)&255,F[v++]=(L<<4|G>>>1)&255):H===7&&(T=o[x.charAt(C++)],b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],E=o[x.charAt(C++)],N=o[x.charAt(C++)],F[v++]=(T<<3|b>>>2)&255,F[v++]=(b<<6|R<<1|L>>>4)&255,F[v++]=(L<<4|G>>>1)&255,F[v++]=(G<<7|E<<2|N>>>3)&255),F},d=function(x){for(var T,b,R,L,G,E="",N=x.length,p=0,F=parseInt(N/5)*5;p<F;)T=x.charCodeAt(p++),b=x.charCodeAt(p++),R=x.charCodeAt(p++),L=x.charCodeAt(p++),G=x.charCodeAt(p++),E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[(L<<3|G>>>5)&31]+i[G&31];var v=N-F;return v===1?(T=x.charCodeAt(p),E+=i[T>>>3]+i[T<<2&31]+"======"):v===2?(T=x.charCodeAt(p++),b=x.charCodeAt(p),E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[b<<4&31]+"===="):v===3?(T=x.charCodeAt(p++),b=x.charCodeAt(p++),R=x.charCodeAt(p),E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[R<<1&31]+"==="):v===4&&(T=x.charCodeAt(p++),b=x.charCodeAt(p++),R=x.charCodeAt(p++),L=x.charCodeAt(p),E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[L<<3&31]+"="),E},f=function(x){var T,b,R,L,G,E,N=!1,p="",F=0,v,O=0,C=x.length;if(x==="")return p;do{for(s[0]=s[5],s[1]=s[6],s[2]=s[7],v=O;F<C&&v<5;++F)E=x.charCodeAt(F),E<128?s[v++]=E:E<2048?(s[v++]=192|E>>6,s[v++]=128|E&63):E<55296||E>=57344?(s[v++]=224|E>>12,s[v++]=128|E>>6&63,s[v++]=128|E&63):(E=65536+((E&1023)<<10|x.charCodeAt(++F)&1023),s[v++]=240|E>>18,s[v++]=128|E>>12&63,s[v++]=128|E>>6&63,s[v++]=128|E&63);O=v-5,F===C&&++F,F>C&&v<6&&(N=!0),T=s[0],v>4?(b=s[1],R=s[2],L=s[3],G=s[4],p+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[(L<<3|G>>>5)&31]+i[G&31]):v===1?p+=i[T>>>3]+i[T<<2&31]+"======":v===2?(b=s[1],p+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[b<<4&31]+"===="):v===3?(b=s[1],R=s[2],p+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[R<<1&31]+"==="):(b=s[1],R=s[2],L=s[3],p+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[L<<3&31]+"=")}while(!N);return p},m=function(x){for(var T,b,R,L,G,E="",N=x.length,p=0,F=parseInt(N/5)*5;p<F;)T=x[p++],b=x[p++],R=x[p++],L=x[p++],G=x[p++],E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[(L<<3|G>>>5)&31]+i[G&31];var v=N-F;return v===1?(T=x[p],E+=i[T>>>3]+i[T<<2&31]+"======"):v===2?(T=x[p++],b=x[p],E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[b<<4&31]+"===="):v===3?(T=x[p++],b=x[p++],R=x[p],E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[R<<1&31]+"==="):v===4&&(T=x[p++],b=x[p++],R=x[p++],L=x[p],E+=i[T>>>3]+i[(T<<2|b>>>6)&31]+i[b>>>1&31]+i[(b<<4|R>>>4)&31]+i[(R<<1|L>>>7)&31]+i[L>>>2&31]+i[L<<3&31]+"="),E},w=function(x,T){var b=typeof x!="string";return b&&x.constructor===ArrayBuffer&&(x=new Uint8Array(x)),b?m(x):T?d(x):f(x)},k=function(x,T){if(!T)return l(c(x));if(x==="")return"";if(!/^[A-Z2-7=]+$/.test(x))throw new Error("Invalid base32 characters");var b,R,L,G,E,N,p,F,v="",O=x.indexOf("=");O===-1&&(O=x.length);for(var C=0,V=O>>3<<3;C<V;)b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],E=o[x.charAt(C++)],N=o[x.charAt(C++)],p=o[x.charAt(C++)],F=o[x.charAt(C++)],v+=String.fromCharCode((b<<3|R>>>2)&255)+String.fromCharCode((R<<6|L<<1|G>>>4)&255)+String.fromCharCode((G<<4|E>>>1)&255)+String.fromCharCode((E<<7|N<<2|p>>>3)&255)+String.fromCharCode((p<<5|F)&255);var H=O-V;return H===2?(b=o[x.charAt(C++)],R=o[x.charAt(C++)],v+=String.fromCharCode((b<<3|R>>>2)&255)):H===4?(b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],v+=String.fromCharCode((b<<3|R>>>2)&255)+String.fromCharCode((R<<6|L<<1|G>>>4)&255)):H===5?(b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],E=o[x.charAt(C++)],v+=String.fromCharCode((b<<3|R>>>2)&255)+String.fromCharCode((R<<6|L<<1|G>>>4)&255)+String.fromCharCode((G<<4|E>>>1)&255)):H===7&&(b=o[x.charAt(C++)],R=o[x.charAt(C++)],L=o[x.charAt(C++)],G=o[x.charAt(C++)],E=o[x.charAt(C++)],N=o[x.charAt(C++)],p=o[x.charAt(C++)],v+=String.fromCharCode((b<<3|R>>>2)&255)+String.fromCharCode((R<<6|L<<1|G>>>4)&255)+String.fromCharCode((G<<4|E>>>1)&255)+String.fromCharCode((E<<7|N<<2|p>>>3)&255)),v},I={encode:w,decode:k};k.asBytes=c,r?n.exports=I:e.base32=I})()})(Cp)),Cp.exports}var g$=f$();const oh=cs(g$);function P2(n){if(!(typeof n=="bigint"||Number.isInteger(n))||n<0||n>BigInt("0xffffffffffffffff"))throw new Error("Input is not a 64-bit unsigned integer");const t=new Uint8Array(8);return new DataView(t.buffer).setBigUint64(0,BigInt(n)),t}function p$(n,e="safe"){if(e!=="safe"&&e!=="mixed"&&e!=="bigint")throw new Error(`Unknown decodingMode option: ${e}`);if(n.byteLength===0||n.byteLength>8)throw new Error(`Data has unacceptable length. Expected length is between 1 and 8, got ${n.byteLength}`);const t=new Uint8Array(8-n.byteLength),r=jn(t,n),o=new DataView(r.buffer).getBigUint64(0),s=o>BigInt(Number.MAX_SAFE_INTEGER);if(e==="safe"){if(s)throw new Error(`Integer exceeds maximum safe integer: ${o.toString()}. Try decoding with "mixed" or "safe" decodingMode.`);return Number(o)}return e==="mixed"&&!s?Number(o):o}function lt(n){if(Dg())return new Uint8Array(Buffer.from(n,"base64"));const e=atob(n);return Uint8Array.from(e,t=>t.codePointAt(0))}function Zn(n){if(Dg())return Buffer.from(n).toString("base64");const e=Array.from(n,t=>String.fromCodePoint(t)).join("");return btoa(e)}function Ig(n){return new TextDecoder().decode(n)}function Ri(n){return typeof n=="string"?new TextEncoder().encode(n):n}function Mg(n){return Dg()?Buffer.from(n).toString("hex"):Array.from(n).map(e=>e.toString(16).padStart(2,"0")).join("")}function m$(n){if(Dg())return Buffer.from(n,"hex");let e=n;n.length%2!==0&&(e=n.padStart(1,"0"));const t=new Uint8Array(e.length/2);for(let r=0;r<e.length/2;r++)t[r]=parseInt(e.slice(2*r,2*r+2),16);return t}const vs=36,Ml=4,Pp=58,y$="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ",ll="address seems to be malformed",w$="wrong checksum for address";function ab(n){return Uint8Array.from(ro(n).slice(ob-Ml,ob))}class Pt{constructor(e){if(!(e instanceof Uint8Array))throw new Error(`${ll}: ${e} is not Uint8Array, type ${typeof e}`);if(e.length!==vs-Ml)throw new Error(`${ll}: 0x${Mg(e)}, length ${e.length}`);this.publicKey=e}equals(e){return e instanceof Pt&&Mi(this.publicKey,e.publicKey)}checksum(){return ab(this.publicKey)}toString(){return oh.encode(jn(this.publicKey,this.checksum())).slice(0,Pp)}static fromString(e){if(typeof e!="string")throw new Error(`${ll}: expected string, got ${typeof e}, ${e}`);if(e.length!==Pp)throw new Error(`${ll}: expected length ${Pp}, got ${e.length}: ${e}`);const t=oh.decode.asBytes(e);if(t.length!==vs)throw new Error(`${ll}: expected byte length ${vs}, got ${t.length}`);const r=new Uint8Array(t.slice(0,vs-Ml)),i=new Uint8Array(t.slice(C2,vs)),o=ab(r);if(!Mi(o,i))throw new Error(w$);return new Pt(r)}static zeroAddress(){return new Pt(new Uint8Array(vs-Ml))}}function $2(n){return Pt.fromString(n)}function B2(n){try{Pt.fromString(n)}catch{return!1}return!0}function V2(n){return new Pt(n).toString()}const S$=new TextEncoder().encode("appID");function Sv(n){const e=jn(S$,P2(n)),t=ro(e);return new Pt(Uint8Array.from(t))}const O2=1e6,aE="Microalgos should be positive and less than 2^53 - 1.";function v$(n){if(n<0||!Number.isSafeInteger(n))throw new Error(aE);return n/O2}function x$(n){const e=n*O2;return Math.round(e)}class E$ extends Error{constructor(e,t){super(e),this.response=t,this.name="URLTokenBaseHTTPError",this.response=t}}class bs{constructor(e,t,r,i={}){this.defaultHeaders=i;const o=t.endsWith("/")?t:`${t}/`,s=new URL(o);if(typeof r<"u"&&(s.port=r.toString()),s.protocol.length===0)throw new Error("Invalid base server URL, protocol must be defined.");this.baseURL=s,this.tokenHeader=e}getURL(e,t){let r;e.startsWith("./")?r=e:e.startsWith("/")?r=`.${e}`:r=`./${e}`;const i=new URL(r,this.baseURL);if(t)for(const[o,s]of Object.entries(t))i.searchParams.set(o,s.toString());return i.toString()}static formatFetchResponseHeaders(e){const t={};return e.forEach((r,i)=>{t[r]=i}),t}static async checkHttpError(e){if(e.ok)return;let t,r;try{t=new Uint8Array(await e.arrayBuffer());const o=JSON.parse(new TextDecoder().decode(t));o.message&&(r=o.message)}catch{}let i=`Network request error. Received status ${e.status} (${e.statusText})`;throw r&&(i+=`: ${r}`),new E$(i,{body:t??new Uint8Array,status:e.status,headers:bs.formatFetchResponseHeaders(e.headers)})}static async formatFetchResponse(e){return await this.checkHttpError(e),{body:new Uint8Array(await e.arrayBuffer()),status:e.status,headers:bs.formatFetchResponseHeaders(e.headers)}}async get(e,t,r,i){const o={...this.tokenHeader,...this.defaultHeaders,...r??{}},s=await fetch(this.getURL(e,t),{headers:o,...i??{}});return bs.formatFetchResponse(s)}async post(e,t,r,i,o){const s={...this.tokenHeader,...this.defaultHeaders,...i??{}},a=await fetch(this.getURL(e,r),{method:"POST",body:t,headers:s,...o??{}});return bs.formatFetchResponse(a)}async delete(e,t,r,i,o){const s={...this.tokenHeader,...this.defaultHeaders,...i??{}},a=await fetch(this.getURL(e,r),{method:"DELETE",body:t,headers:s,...o??{}});return bs.formatFetchResponse(a)}}class b${constructor(e){this.body=e.body,this.text=e.text,this.format=e.format,this.headers=e.headers,this.status=e.status,this.ok=e.ok}getJSONText(){if(this.text===void 0)throw new Error(`Response body does not contain JSON data. Format is ${this.format}`);return this.text}parseBodyAsJSON(e){if(this.text===void 0)throw new Error(`Response body does not contain JSON data. Format is ${this.format}`);return Ir.parseJSON(this.text,this.status,e)}}function k$(n){for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(!n[e]||n[e].length===0)&&delete n[e];return n}function cb(n){return Object.keys(n).reduce((e,t)=>(e[t.toLowerCase()]=n[t],e),{})}function A$(n){if(n!==void 0&&Object.prototype.hasOwnProperty.call(n,"format"))switch(n.format){case"msgpack":return"application/msgpack";case"json":default:return"application/json"}else return"application/json"}class Ir{constructor(e,t,r,i={}){t!==void 0?this.bc=new bs(e,t,r,i):this.bc=e}static parseJSON(e,t,r){try{return e?sE(e,r):null}catch(i){const o=i;throw o.rawResponse=e||null,o.statusCode=t,o}}static serializeData(e,t){if(!e)return new Uint8Array(0);if(t["content-type"]==="application/json")return new TextEncoder().encode(aa(e));if(typeof e=="string")return new TextEncoder().encode(e);if(e instanceof Uint8Array)return e;throw new Error("provided data is neither a string nor a Uint8Array and content-type is not application/json")}static prepareResponse(e,t){const{body:r}=e;let i;return t!=="application/msgpack"&&(i=r&&new TextDecoder().decode(r)||""),new b$({...e,format:t,text:i,ok:Math.trunc(e.status/100)===2})}static prepareResponseError(e){return e.response&&(e.response=Ir.prepareResponse(e.response,"application/json"),e.status=e.response.status),e}async get({relativePath:e,query:t,requestHeaders:r,customOptions:i}){const o=A$(t),s={...r??{},accept:o};try{const a=await this.bc.get(e,t?k$(t):void 0,s,i);return Ir.prepareResponse(a,o)}catch(a){throw Ir.prepareResponseError(a)}}async post({relativePath:e,data:t,query:r,requestHeaders:i,customOptions:o}){const s={"content-type":"application/json",...cb(i??{})};try{const a=await this.bc.post(e,Ir.serializeData(t,s),r,s,o);return Ir.prepareResponse(a,"application/json")}catch(a){throw Ir.prepareResponseError(a)}}async delete({relativePath:e,data:t,requestHeaders:r,customOptions:i}){const o={"content-type":"application/json",...cb(r??{})};try{const s=await this.bc.delete(e,typeof t<"u"?Ir.serializeData(t,o):void 0,void 0,o,i);return Ir.prepareResponse(s,"application/json")}catch(s){throw Ir.prepareResponseError(s)}}}function D$(n,e=""){const t={};return e===""||(t[n]=e),t}function F$(n){return typeof n.get=="function"}class cE{constructor(e,t,r,i,o={}){if(F$(t))this.c=new Ir(t);else{let s;typeof t=="string"?s=D$(e,t):s=t,this.c=new Ir(s,r,i,o)}}}function T$(n){for(var e=n.length,t=0,r=0;r<e;){var i=n.charCodeAt(r++);if((i&4294967168)===0){t++;continue}else if((i&4294965248)===0)t+=2;else{if(i>=55296&&i<=56319&&r<e){var o=n.charCodeAt(r);(o&64512)===56320&&(++r,i=((i&1023)<<10)+(o&1023)+65536)}(i&4294901760)===0?t+=3:t+=4}}return t}function I$(n,e,t){for(var r=n.length,i=t,o=0;o<r;){var s=n.charCodeAt(o++);if((s&4294967168)===0){e[i++]=s;continue}else if((s&4294965248)===0)e[i++]=s>>6&31|192;else{if(s>=55296&&s<=56319&&o<r){var a=n.charCodeAt(o);(a&64512)===56320&&(++o,s=((s&1023)<<10)+(a&1023)+65536)}(s&4294901760)===0?(e[i++]=s>>12&15|224,e[i++]=s>>6&63|128):(e[i++]=s>>18&7|240,e[i++]=s>>12&63|128,e[i++]=s>>6&63|128)}e[i++]=s&63|128}}var M$=new TextEncoder,R$=50;function C$(n,e,t){M$.encodeInto(n,e.subarray(t))}function P$(n,e,t){n.length>R$?C$(n,e,t):I$(n,e,t)}var $$=4096;function N2(n,e,t){for(var r=e,i=r+t,o=[],s="";r<i;){var a=n[r++];if((a&128)===0)o.push(a);else if((a&224)===192){var l=n[r++]&63;o.push((a&31)<<6|l)}else if((a&240)===224){var l=n[r++]&63,c=n[r++]&63;o.push((a&31)<<12|l<<6|c)}else if((a&248)===240){var l=n[r++]&63,c=n[r++]&63,d=n[r++]&63,f=(a&7)<<18|l<<12|c<<6|d;f>65535&&(f-=65536,o.push(f>>>10&1023|55296),f=56320|f&1023),o.push(f)}else o.push(a);o.length>=$$&&(s+=String.fromCharCode.apply(String,o),o.length=0)}return o.length>0&&(s+=String.fromCharCode.apply(String,o)),s}var B$=new TextDecoder,V$=200;function O$(n,e,t){var r=n.subarray(e,e+t);return B$.decode(r)}function N$(n,e,t){return t>V$?O$(n,e,t):N2(n,e,t)}var yd=(function(){function n(e,t){this.type=e,this.data=t}return n})(),L$=(function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}})(),fi=(function(n){L$(e,n);function e(t){var r=n.call(this,t)||this,i=Object.create(e.prototype);return Object.setPrototypeOf(r,i),Object.defineProperty(r,"name",{configurable:!0,enumerable:!1,value:e.name}),r}return e})(Error),Pn;(function(n){n[n.UNSAFE_NUMBER=0]="UNSAFE_NUMBER",n[n.SAFE_NUMBER=1]="SAFE_NUMBER",n[n.AS_ENCODED=2]="AS_ENCODED",n[n.MIXED=3]="MIXED",n[n.BIGINT=4]="BIGINT"})(Pn||(Pn={}));var hl=4294967295;function U$(n,e,t){var r=t/4294967296,i=t;n.setUint32(e,r),n.setUint32(e+4,i)}function L2(n,e,t){var r=Math.floor(t/4294967296),i=t;n.setUint32(e,r),n.setUint32(e+4,i)}function U2(n,e,t){if(t===Pn.UNSAFE_NUMBER||t===Pn.SAFE_NUMBER){var r=n.getInt32(e),i=n.getUint32(e+4);if(t===Pn.SAFE_NUMBER&&(r<Math.floor(Number.MIN_SAFE_INTEGER/4294967296)||r===Math.floor(Number.MIN_SAFE_INTEGER/4294967296)&&i===0||r>(Number.MAX_SAFE_INTEGER-i)/4294967296)){var o="".concat(r<0?"-":"","0x").concat(Math.abs(r).toString(16)).concat(i.toString(16).padStart(8,"0"));throw new Error("Mode is IntMode.SAFE_NUMBER and value is not a safe integer: ".concat(o))}return r*4294967296+i}var s=n.getBigInt64(e);return t===Pn.MIXED&&s>=Number.MIN_SAFE_INTEGER&&s<=Number.MAX_SAFE_INTEGER?Number(s):s}function j$(n,e,t){if(t===Pn.UNSAFE_NUMBER||t===Pn.SAFE_NUMBER){var r=n.getUint32(e),i=n.getUint32(e+4);if(t===Pn.SAFE_NUMBER&&r>(Number.MAX_SAFE_INTEGER-i)/4294967296){var o="0x".concat(r.toString(16)).concat(i.toString(16).padStart(8,"0"));throw new Error("Mode is IntMode.SAFE_NUMBER and value is not a safe integer: ".concat(o))}return r*4294967296+i}var s=n.getBigUint64(e);return t===Pn.MIXED&&s<=Number.MAX_SAFE_INTEGER?Number(s):s}function _$(n,e){return e===Pn.BIGINT?BigInt(n):Number(n)}var z$=-1,q$=4294967296-1,H$=17179869184-1;function G$(n){var e=n.sec,t=n.nsec;if(e>=0&&t>=0&&e<=H$)if(t===0&&e<=q$){var r=new Uint8Array(4),i=new DataView(r.buffer);return i.setUint32(0,e),r}else{var o=e/4294967296,s=e&4294967295,r=new Uint8Array(8),i=new DataView(r.buffer);return i.setUint32(0,t<<2|o&3),i.setUint32(4,s),r}else{var r=new Uint8Array(12),i=new DataView(r.buffer);return i.setUint32(0,t),L2(i,4,e),r}}function K$(n){var e=n.getTime(),t=Math.floor(e/1e3),r=(e-t*1e3)*1e6,i=Math.floor(r/1e9);return{sec:t+i,nsec:r-i*1e9}}function W$(n){if(n instanceof Date){var e=K$(n);return G$(e)}else return null}function J$(n){var e=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(n.byteLength){case 4:{var t=e.getUint32(0),r=0;return{sec:t,nsec:r}}case 8:{var i=e.getUint32(0),o=e.getUint32(4),t=(i&3)*4294967296+o,r=i>>>2;return{sec:t,nsec:r}}case 12:{var t=U2(e,4,Pn.UNSAFE_NUMBER),r=e.getUint32(0);return{sec:t,nsec:r}}default:throw new fi("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(n.length))}}function Y$(n){var e=J$(n);return new Date(e.sec*1e3+e.nsec/1e6)}var X$={type:z$,encode:W$,decode:Y$},j2=(function(){function n(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(X$)}return n.prototype.register=function(e){var t=e.type,r=e.encode,i=e.decode;if(t>=0)this.encoders[t]=r,this.decoders[t]=i;else{var o=1+t;this.builtInEncoders[o]=r,this.builtInDecoders[o]=i}},n.prototype.tryToEncode=function(e,t){for(var r=0;r<this.builtInEncoders.length;r++){var i=this.builtInEncoders[r];if(i!=null){var o=i(e,t);if(o!=null){var s=-1-r;return new yd(s,o)}}}for(var r=0;r<this.encoders.length;r++){var i=this.encoders[r];if(i!=null){var o=i(e,t);if(o!=null){var s=r;return new yd(s,o)}}}return e instanceof yd?e:null},n.prototype.decode=function(e,t,r){var i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(e,t,r):new yd(t,e)},n.defaultCodec=new n,n})();function Ao(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n instanceof ArrayBuffer?new Uint8Array(n):Uint8Array.from(n)}function Q$(n){if(n instanceof ArrayBuffer)return new DataView(n);var e=Ao(n);return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ub(n,e){for(var t=Math.min(n.length,e.length),r=0;r<t;r++){var i=n[r]-e[r];if(i!==0)return i}return n.length-e.length}var gr=(function(){function n(e){if(this.rawBinaryValue=e,!ArrayBuffer.isView(e))throw new TypeError("RawBinaryString: rawBinaryValue must be an ArrayBufferView")}return n})(),Z$=100,e8=2048,t8=(function(){function n(e){var t,r,i,o,s,a,l,c;this.extensionCodec=(t=e==null?void 0:e.extensionCodec)!==null&&t!==void 0?t:j2.defaultCodec,this.context=e==null?void 0:e.context,this.forceBigIntToInt64=(r=e==null?void 0:e.forceBigIntToInt64)!==null&&r!==void 0?r:!1,this.maxDepth=(i=e==null?void 0:e.maxDepth)!==null&&i!==void 0?i:Z$,this.initialBufferSize=(o=e==null?void 0:e.initialBufferSize)!==null&&o!==void 0?o:e8,this.sortKeys=(s=e==null?void 0:e.sortKeys)!==null&&s!==void 0?s:!1,this.forceFloat32=(a=e==null?void 0:e.forceFloat32)!==null&&a!==void 0?a:!1,this.ignoreUndefined=(l=e==null?void 0:e.ignoreUndefined)!==null&&l!==void 0?l:!1,this.forceIntegerToFloat=(c=e==null?void 0:e.forceIntegerToFloat)!==null&&c!==void 0?c:!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return n.prototype.reinitializeState=function(){this.pos=0},n.prototype.encodeSharedRef=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)},n.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)},n.prototype.doEncode=function(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth ".concat(t));e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.encodeObject(e,t)},n.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(t*2)},n.prototype.resizeBuffer=function(e){var t=new ArrayBuffer(e),r=new Uint8Array(t),i=new DataView(t);r.set(this.bytes),this.view=i,this.bytes=r},n.prototype.encodeNil=function(){this.writeU8(192)},n.prototype.encodeBoolean=function(e){e===!1?this.writeU8(194):this.writeU8(195)},n.prototype.encodeNumber=function(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)},n.prototype.encodeNumberAsFloat=function(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},n.prototype.encodeBigInt=function(e){if(this.forceBigIntToInt64)this.encodeBigIntAsInt64(e);else if(e>=0)if(e<4294967296||this.forceIntegerToFloat)this.encodeNumber(Number(e));else if(e<BigInt("0x10000000000000000"))this.encodeBigIntAsInt64(e);else throw new Error("Bigint is too large for uint64: ".concat(e));else if(e>=-2147483648||this.forceIntegerToFloat)this.encodeNumber(Number(e));else if(e>=BigInt(-1)*BigInt("0x8000000000000000"))this.encodeBigIntAsInt64(e);else throw new Error("Bigint is too small for int64: ".concat(e))},n.prototype.encodeBigIntAsInt64=function(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))},n.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error("Too long string: ".concat(e," bytes in UTF-8"))},n.prototype.encodeString=function(e){var t=5,r=T$(e);this.ensureBufferSizeToWrite(t+r),this.writeStringHeader(r),P$(e,this.bytes,this.pos),this.pos+=r},n.prototype.encodeObject=function(e,t){var r=this.extensionCodec.tryToEncode(e,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(e instanceof gr)this.encodeBinaryAsString(e);else if(typeof e=="bigint")this.encodeBigInt(e);else if(e instanceof Map)this.encodeMap(e,t);else if(typeof e=="object")this.encodeMapObject(e,t);else throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)))},n.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error("Too large binary: ".concat(t));var r=Ao(e);this.writeU8a(r)},n.prototype.encodeBinaryAsString=function(e){var t=e.rawBinaryValue;this.writeStringHeader(t.byteLength);var r=Ao(t);this.writeU8a(r)},n.prototype.encodeArray=function(e,t){var r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error("Too large array: ".concat(r));for(var i=0,o=e;i<o.length;i++){var s=o[i];this.doEncode(s,t+1)}},n.prototype.countWithoutUndefined=function(e,t){for(var r=0,i=0,o=t;i<o.length;i++){var s=o[i];e.get(s)!==void 0&&r++}return r},n.prototype.sortMapKeys=function(e){for(var t=[],r=[],i=[],o=[],s=0,a=e;s<a.length;s++){var l=a[s];if(typeof l=="number"){if(isNaN(l))throw new Error("Cannot sort map keys with NaN value");t.push(l)}else if(typeof l=="bigint")t.push(l);else if(typeof l=="string")r.push(l);else if(ArrayBuffer.isView(l))o.push(Ao(l));else if(l instanceof gr)i.push(l);else throw new Error("Unsupported map key type: ".concat(Object.prototype.toString.apply(l)))}return t.sort(function(c,d){return c<d?-1:c>d?1:0}),r.sort(),i.sort(function(c,d){return ub(Ao(c.rawBinaryValue),Ao(d.rawBinaryValue))}),o.sort(ub),[].concat(t,r,i,o)},n.prototype.encodeMapObject=function(e,t){this.encodeMap(new Map(Object.entries(e)),t)},n.prototype.encodeMap=function(e,t){var r=Array.from(e.keys());this.sortKeys&&(r=this.sortMapKeys(r));var i=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error("Too large map object: ".concat(i));for(var o=0,s=r;o<s.length;o++){var a=s[o],l=e.get(a);if(!(this.ignoreUndefined&&l===void 0)){if(typeof a=="string")this.encodeString(a);else if(typeof a=="number")this.encodeNumber(a);else if(typeof a=="bigint")this.encodeBigInt(a);else if(ArrayBuffer.isView(a))this.encodeBinary(a);else if(a instanceof gr)this.encodeBinaryAsString(a);else throw new Error("Unsupported map key type: ".concat(Object.prototype.toString.apply(a)));this.doEncode(l,t+1)}}},n.prototype.encodeExtension=function(e){var t=e.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error("Too large extension object: ".concat(t));this.writeI8(e.type),this.writeU8a(e.data)},n.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},n.prototype.writeU8a=function(e){var t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t},n.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},n.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},n.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},n.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},n.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},n.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},n.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},n.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),U$(this.view,this.pos,e),this.pos+=8},n.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),L2(this.view,this.pos,e),this.pos+=8},n.prototype.writeBigUint64=function(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8},n.prototype.writeBigInt64=function(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8},n})();function n8(n,e){var t=new t8(e);return t.encodeSharedRef(n)}function $p(n){return"".concat(n<0?"-":"","0x").concat(Math.abs(n).toString(16).padStart(2,"0"))}var r8=16,i8=16,o8=(function(){function n(e,t){e===void 0&&(e=r8),t===void 0&&(t=i8),this.maxKeyLength=e,this.maxLengthPerKey=t,this.hit=0,this.miss=0,this.caches=[];for(var r=0;r<this.maxKeyLength;r++)this.caches.push([])}return n.prototype.canBeCached=function(e){return e>0&&e<=this.maxKeyLength},n.prototype.find=function(e,t,r){var i=this.caches[r-1];e:for(var o=0,s=i;o<s.length;o++){for(var a=s[o],l=a.bytes,c=0;c<r;c++)if(l[c]!==e[t+c])continue e;return a.str}return null},n.prototype.store=function(e,t){var r=this.caches[e.length-1],i={bytes:e,str:t};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=i:r.push(i)},n.prototype.decode=function(e,t,r){var i=this.find(e,t,r);if(i!=null)return this.hit++,i;this.miss++;var o=N2(e,t,r),s=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(s,o),o},n})(),s8=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(f){s(f)}}function l(d){try{c(r.throw(d))}catch(f){s(f)}}function c(d){d.done?o(d.value):i(d.value).then(a,l)}c((r=r.apply(n,e||[])).next())})},Bp=function(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(d){return l([c,d])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(d){c=[6,d],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},lb=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(a,l){s=n[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}},lc=function(n){return this instanceof lc?(this.v=n,this):new lc(n)},a8=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(m){r[m]&&(i[m]=function(w){return new Promise(function(k,I){o.push([m,w,k,I])>1||a(m,w)})})}function a(m,w){try{l(r[m](w))}catch(k){f(o[0][3],k)}}function l(m){m.value instanceof lc?Promise.resolve(m.value.v).then(c,d):f(o[0][2],m)}function c(m){a("next",m)}function d(m){a("throw",m)}function f(m,w){m(w),o.shift(),o.length&&a(o[0][0],o[0][1])}},vv="array",Rl="map_key",_2="map_value";function c8(n,e,t){return e?typeof n=="string"||typeof n=="number"||typeof n=="bigint"||n instanceof Uint8Array||n instanceof gr:typeof n=="string"||t&&typeof n=="number"}var u8=(function(){function n(e){this.useMap=e,this.stack=[],this.stackHeadPosition=-1}return Object.defineProperty(n.prototype,"length",{get:function(){return this.stackHeadPosition+1},enumerable:!1,configurable:!0}),n.prototype.top=function(){return this.stack[this.stackHeadPosition]},n.prototype.pushArrayState=function(e){var t=this.getUninitializedStateFromPool();t.type=vv,t.position=0,t.size=e,t.array=new Array(e)},n.prototype.pushMapState=function(e){var t=this.getUninitializedStateFromPool();t.type=Rl,t.readCount=0,t.size=e,t.map=this.useMap?new Map:{}},n.prototype.getUninitializedStateFromPool=function(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){var e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]},n.prototype.release=function(e){var t=this.stack[this.stackHeadPosition];if(t!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===vv){var r=e;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(e.type===Rl||e.type===_2){var r=e;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--},n.prototype.reset=function(){this.stack.length=0,this.stackHeadPosition=-1},n})(),dl=-1,uE=new DataView(new ArrayBuffer(0)),l8=new Uint8Array(uE.buffer);try{uE.getInt8(0)}catch(n){if(!(n instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var xv=RangeError,hb=new xv("Insufficient data"),h8=new o8,d8=(function(){function n(e){var t,r,i,o,s,a,l,c,d,f,m,w;if(this.totalPos=0,this.pos=0,this.view=uE,this.bytes=l8,this.headByte=dl,this.extensionCodec=(t=e==null?void 0:e.extensionCodec)!==null&&t!==void 0?t:j2.defaultCodec,this.context=e==null?void 0:e.context,this.intMode=(r=e==null?void 0:e.intMode)!==null&&r!==void 0?r:e!=null&&e.useBigInt64?Pn.AS_ENCODED:Pn.UNSAFE_NUMBER,this.rawBinaryStringValues=(i=e==null?void 0:e.rawBinaryStringValues)!==null&&i!==void 0?i:!1,this.rawBinaryStringKeys=(o=e==null?void 0:e.rawBinaryStringKeys)!==null&&o!==void 0?o:!1,this.useRawBinaryStringClass=(s=e==null?void 0:e.useRawBinaryStringClass)!==null&&s!==void 0?s:!1,this.useMap=(a=e==null?void 0:e.useMap)!==null&&a!==void 0?a:!1,this.supportObjectNumberKeys=(l=e==null?void 0:e.supportObjectNumberKeys)!==null&&l!==void 0?l:!1,this.maxStrLength=(c=e==null?void 0:e.maxStrLength)!==null&&c!==void 0?c:hl,this.maxBinLength=(d=e==null?void 0:e.maxBinLength)!==null&&d!==void 0?d:hl,this.maxArrayLength=(f=e==null?void 0:e.maxArrayLength)!==null&&f!==void 0?f:hl,this.maxMapLength=(m=e==null?void 0:e.maxMapLength)!==null&&m!==void 0?m:hl,this.maxExtLength=(w=e==null?void 0:e.maxExtLength)!==null&&w!==void 0?w:hl,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:h8,this.rawBinaryStringKeys&&!this.useMap)throw new Error("rawBinaryStringKeys is only supported when useMap is true");this.stack=new u8(this.useMap)}return n.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=dl,this.stack.reset()},n.prototype.setBuffer=function(e){this.bytes=Ao(e),this.view=Q$(this.bytes),this.pos=0},n.prototype.appendBuffer=function(e){if(this.headByte===dl&&!this.hasRemaining(1))this.setBuffer(e);else{var t=this.bytes.subarray(this.pos),r=Ao(e),i=new Uint8Array(t.length+r.length);i.set(t),i.set(r,t.length),this.setBuffer(i)}},n.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},n.prototype.createExtraByteError=function(e){var t=this,r=t.view,i=t.pos;return new RangeError("Extra ".concat(r.byteLength-i," of ").concat(r.byteLength," byte(s) found at buffer[").concat(e,"]"))},n.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},n.prototype.decodeMulti=function(e){return Bp(this,function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}})},n.prototype.decodeAsync=function(e){var t,r,i,o,s,a,l;return s8(this,void 0,void 0,function(){var c,d,f,m,w,k,I,x;return Bp(this,function(T){switch(T.label){case 0:c=!1,T.label=1;case 1:T.trys.push([1,6,7,12]),t=!0,r=lb(e),T.label=2;case 2:return[4,r.next()];case 3:if(i=T.sent(),o=i.done,!!o)return[3,5];if(l=i.value,t=!1,f=l,c)throw this.createExtraByteError(this.totalPos);this.appendBuffer(f);try{d=this.doDecodeSync(),c=!0}catch(b){if(!(b instanceof xv))throw b}this.totalPos+=this.pos,T.label=4;case 4:return t=!0,[3,2];case 5:return[3,12];case 6:return m=T.sent(),s={error:m},[3,12];case 7:return T.trys.push([7,,10,11]),!t&&!o&&(a=r.return)?[4,a.call(r)]:[3,9];case 8:T.sent(),T.label=9;case 9:return[3,11];case 10:if(s)throw s.error;return[7];case 11:return[7];case 12:if(c){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,d]}throw w=this,k=w.headByte,I=w.pos,x=w.totalPos,new RangeError("Insufficient data in parsing ".concat($p(k)," at ").concat(x," (").concat(I," in the current buffer)"))}})})},n.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},n.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},n.prototype.decodeMultiAsync=function(e,t){return a8(this,arguments,function(){var i,o,s,a,l,c,d,f,m,w,k,I;return Bp(this,function(x){switch(x.label){case 0:i=t,o=-1,x.label=1;case 1:x.trys.push([1,13,14,19]),s=!0,a=lb(e),x.label=2;case 2:return[4,lc(a.next())];case 3:if(l=x.sent(),m=l.done,!!m)return[3,12];if(I=l.value,s=!1,c=I,t&&o===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(c),i&&(o=this.readArraySize(),i=!1,this.complete()),x.label=4;case 4:x.trys.push([4,9,,10]),x.label=5;case 5:return[4,lc(this.doDecodeSync())];case 6:return[4,x.sent()];case 7:return x.sent(),--o===0?[3,8]:[3,5];case 8:return[3,10];case 9:if(d=x.sent(),!(d instanceof xv))throw d;return[3,10];case 10:this.totalPos+=this.pos,x.label=11;case 11:return s=!0,[3,2];case 12:return[3,19];case 13:return f=x.sent(),w={error:f},[3,19];case 14:return x.trys.push([14,,17,18]),!s&&!m&&(k=a.return)?[4,lc(k.call(a))]:[3,16];case 15:x.sent(),x.label=16;case 16:return[3,18];case 17:if(w)throw w.error;return[7];case 18:return[7];case 19:return[2]}})})},n.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=this.convertNumber(e-256);else if(e<192)if(e<128)t=this.convertNumber(e);else if(e<144){var r=e-128;if(r!==0){this.pushMapState(r),this.complete();continue e}else t=this.useMap?new Map:{}}else if(e<160){var r=e-144;if(r!==0){this.pushArrayState(r),this.complete();continue e}else t=[]}else{var i=e-160;t=this.decodeString(i,0)}else if(e===192)t=null;else if(e===194)t=!1;else if(e===195)t=!0;else if(e===202)t=this.readF32();else if(e===203)t=this.readF64();else if(e===204)t=this.convertNumber(this.readU8());else if(e===205)t=this.convertNumber(this.readU16());else if(e===206)t=this.convertNumber(this.readU32());else if(e===207)t=this.readU64();else if(e===208)t=this.convertNumber(this.readI8());else if(e===209)t=this.convertNumber(this.readI16());else if(e===210)t=this.convertNumber(this.readI32());else if(e===211)t=this.readI64();else if(e===217){var i=this.lookU8();t=this.decodeString(i,1)}else if(e===218){var i=this.lookU16();t=this.decodeString(i,2)}else if(e===219){var i=this.lookU32();t=this.decodeString(i,4)}else if(e===220){var r=this.readU16();if(r!==0){this.pushArrayState(r),this.complete();continue e}else t=[]}else if(e===221){var r=this.readU32();if(r!==0){this.pushArrayState(r),this.complete();continue e}else t=[]}else if(e===222){var r=this.readU16();if(r!==0){this.pushMapState(r),this.complete();continue e}else t={}}else if(e===223){var r=this.readU32();if(r!==0){this.pushMapState(r),this.complete();continue e}else t={}}else if(e===196){var r=this.lookU8();t=this.decodeBinary(r,1)}else if(e===197){var r=this.lookU16();t=this.decodeBinary(r,2)}else if(e===198){var r=this.lookU32();t=this.decodeBinary(r,4)}else if(e===212)t=this.decodeExtension(1,0);else if(e===213)t=this.decodeExtension(2,0);else if(e===214)t=this.decodeExtension(4,0);else if(e===215)t=this.decodeExtension(8,0);else if(e===216)t=this.decodeExtension(16,0);else if(e===199){var r=this.lookU8();t=this.decodeExtension(r,1)}else if(e===200){var r=this.lookU16();t=this.decodeExtension(r,2)}else if(e===201){var r=this.lookU32();t=this.decodeExtension(r,4)}else throw new fi("Unrecognized type byte: ".concat($p(e)));this.complete();for(var o=this.stack;o.length>0;){var s=o.top();if(s.type===vv)if(s.array[s.position]=t,s.position++,s.position===s.size)t=s.array,o.release(s);else continue e;else if(s.type===Rl){if(!c8(t,this.useMap,this.supportObjectNumberKeys)){var a=this.useMap?"string, number, bigint, or Uint8Array":this.supportObjectNumberKeys?"string or number":"string";throw new fi("The type of key must be ".concat(a," but got ").concat(typeof t))}if(!this.useMap&&t==="__proto__")throw new fi("The key __proto__ is not allowed");s.key=t,s.type=_2;continue e}else if(this.useMap?s.map.set(s.key,t):s.map[s.key]=t,s.readCount++,s.readCount===s.size)t=s.map,o.release(s);else{s.key=null,s.type=Rl;continue e}}return t}},n.prototype.readHeadByte=function(){return this.headByte===dl&&(this.headByte=this.readU8()),this.headByte},n.prototype.complete=function(){this.headByte=dl},n.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new fi("Unrecognized array type byte: ".concat($p(e)))}}},n.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new fi("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.pushMapState(e)},n.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new fi("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.pushArrayState(e)},n.prototype.decodeString=function(e,t){if(this.stateIsMapKey()?this.rawBinaryStringKeys:this.rawBinaryStringValues){var r=this.decodeBinary(e,t);return this.useRawBinaryStringClass?new gr(r):r}return this.decodeUtf8String(e,t)},n.prototype.decodeUtf8String=function(e,t){var r;if(e>this.maxStrLength)throw new fi("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLength<this.pos+t+e)throw hb;var i=this.pos+t,o;return this.stateIsMapKey()&&(!((r=this.keyDecoder)===null||r===void 0)&&r.canBeCached(e))?o=this.keyDecoder.decode(this.bytes,i,e):o=N$(this.bytes,i,e),this.pos+=t+e,o},n.prototype.stateIsMapKey=function(){if(this.stack.length>0){var e=this.stack.top();return e.type===Rl}return!1},n.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new fi("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw hb;var r=this.pos+t,i=this.bytes.subarray(r,r+e);return this.pos+=t+e,i},n.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new fi("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var r=this.view.getInt8(this.pos+t),i=this.decodeBinary(e,t+1);return this.extensionCodec.decode(i,r,this.context)},n.prototype.convertNumber=function(e){return _$(e,this.intMode)},n.prototype.lookU8=function(){return this.view.getUint8(this.pos)},n.prototype.lookU16=function(){return this.view.getUint16(this.pos)},n.prototype.lookU32=function(){return this.view.getUint32(this.pos)},n.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},n.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},n.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},n.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},n.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},n.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},n.prototype.readU64=function(){var e=j$(this.view,this.pos,this.intMode);return this.pos+=8,e},n.prototype.readI64=function(){var e=U2(this.view,this.pos,this.intMode);return this.pos+=8,e},n.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},n.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},n})();function lE(n,e){var t=new d8(e);return t.decode(n)}const f8="The object contains empty or 0 values. First empty or 0 value encountered during encoding: ";function g8(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&(!n[e]||n[e].length===0))return{containsEmpty:!0,firstEmptyKey:e};return{containsEmpty:!1,firstEmptyKey:void 0}}function nd(n){return n8(n,{sortKeys:!0})}function p8(n){const e=g8(n);if(e.containsEmpty)throw new Error(f8+e.firstEmptyKey);return nd(n)}function z2(n){switch(n){case Vn.UNSAFE:return Pn.UNSAFE_NUMBER;case Vn.SAFE:return Pn.SAFE_NUMBER;case Vn.MIXED:return Pn.MIXED;case Vn.BIGINT:return Pn.BIGINT;default:throw new Error(`Invalid intDecoding: ${n}`)}}function q2(n,e){const t={intMode:e!=null&&e.intDecoding?z2(e==null?void 0:e.intDecoding):Pn.BIGINT};return lE(n,t)}function m8(n){return q2(n,{intDecoding:Vn.MIXED})}function H2(n,e){const t={intMode:e!=null&&e.intDecoding?z2(e==null?void 0:e.intDecoding):Pn.BIGINT,useMap:!0};return lE(n,t)}function y8(n,e){const t={intMode:Pn.BIGINT,useMap:!0,rawBinaryStringKeys:!0,rawBinaryStringValues:!0,useRawBinaryStringClass:!0};return lE(n,t)}function Ev(n){if(n==null)return n;if(n instanceof Uint8Array)return Zn(n);if(Array.isArray(n))return n.map(Ev);if(n instanceof Map){const e={};for(const[t,r]of n){if(typeof t!="string")throw new Error(`JSON map key must be a string: ${t}`);e[t]=Ev(r)}return e}return n}function bv(n){if(n==null||typeof n=="string"||typeof n=="number"||typeof n=="bigint"||typeof n=="boolean")return n;if(Array.isArray(n))return n.map(bv);if(typeof n=="object"){const e=new Map;for(const[t,r]of Object.entries(n))e.set(t,bv(r));return e}throw new Error(`Invalid JSON encoding data: ${n}`)}var Eo;(function(n){n[n.MAP_VALUE=0]="MAP_VALUE",n[n.ARRAY_ELEMENT=1]="ARRAY_ELEMENT"})(Eo||(Eo={}));class lf{constructor({parent:e,segment:t,baseObjectBytes:r}){this.resolvedCache=null,this.resolvedCachePresent=!1,this.parent=e,this.segment=t,this.baseObjectBytes=r}withMapValue(e){return new lf({parent:this,segment:{kind:Eo.MAP_VALUE,key:e}})}withArrayElement(e){return new lf({parent:this,segment:{kind:Eo.ARRAY_ELEMENT,key:e}})}getRawStringAtCurrentLocation(){const e=this.resolve();if(e instanceof gr)return e.rawBinaryValue;throw new Error(`Invalid type. Expected RawBinaryString, got ${e} (${typeof e})`)}getRawStringKeysAndValuesAtCurrentLocation(){const e=this.resolve();if(!(e instanceof Map))throw new Error(`Invalid type. Expected Map, got ${e} (${typeof e})`);const t=new Map;for(const[r,i]of e)if(r instanceof gr)t.set(r.rawBinaryValue,i);else throw new Error(`Invalid type for map key. Expected RawBinaryString, got ${r} (${typeof r})`);return t}resolve(){if(this.resolvedCachePresent)return this.resolvedCache;let e;if(this.parent?e=this.parent.resolve():e=y8(this.baseObjectBytes),!this.segment)return this.resolvedCache=e,this.resolvedCachePresent=!0,e;if(this.segment.kind===Eo.MAP_VALUE){if(!(e instanceof Map))throw new Error(`Invalid type. Expected Map, got ${e} (${typeof e})`);if(typeof this.segment.key=="string"||this.segment.key instanceof Uint8Array||this.segment.key instanceof gr){const t=this.segment.key instanceof gr?this.segment.key.rawBinaryValue:Ri(this.segment.key),r=typeof this.segment.key=="string"||this.segment.key instanceof gr;for(const[i,o]of e){let s;if(r?i instanceof gr&&(s=i.rawBinaryValue):i instanceof Uint8Array&&(s=i),s&&Mi(t,s)){this.resolvedCache=o;break}}}else this.resolvedCache=e.get(this.segment.key);return this.resolvedCachePresent=!0,this.resolvedCache}if(this.segment.kind===Eo.ARRAY_ELEMENT){if(!Array.isArray(e))throw new Error(`Invalid type. Expected Array, got ${e} (${typeof e})`);return this.resolvedCache=e[this.segment.key],this.resolvedCachePresent=!0,this.resolvedCache}throw new Error(`Invalid segment kind: ${this.segment.kind}`)}getPathString(){const e=this.parent?this.parent.getPathString():"root";return this.segment?this.segment.kind===Eo.MAP_VALUE?`${e} -> map key "${this.segment.key}" (${typeof this.segment.key})`:this.segment.kind===Eo.ARRAY_ELEMENT?`${e} -> array index ${this.segment.key} (${typeof this.segment.key})`:`${e} -> unknown segment kind ${this.segment.kind}`:e}}class wr{}function Tn(n,e){const t=H2(n),r=new lf({baseObjectBytes:n});return e.fromEncodingData(e.encodingSchema.fromPreparedMsgpack(t,r))}function Yr(n){return nd(n.getEncodingSchema().prepareMsgpack(n.toEncodingData()))}function Jt(n,e){const t=sE(n,{intDecoding:Vn.BIGINT});return e.fromEncodingData(e.encodingSchema.fromPreparedJSON(t))}function w8(n,e){const{space:t,...r}=e??{},i=n.getEncodingSchema().prepareJSON(n.toEncodingData(),r);return aa(i,void 0,t)}class _t extends wr{defaultValue(){return!1}isDefaultValue(e){return e===!1}prepareMsgpack(e){if(typeof e=="boolean")return e;throw new Error("Invalid boolean")}fromPreparedMsgpack(e,t){if(typeof e=="boolean")return e;throw new Error("Invalid boolean")}prepareJSON(e,t){if(typeof e=="boolean")return e;throw new Error("Invalid boolean")}fromPreparedJSON(e){if(typeof e=="boolean")return e;throw new Error("Invalid boolean")}}class Le extends wr{defaultValue(){return""}isDefaultValue(e){return e===""}prepareMsgpack(e){if(typeof e=="string")return e;throw new Error(`Invalid string: (${typeof e}) ${e}`)}fromPreparedMsgpack(e,t){if(typeof e=="string")return e;throw new Error(`Invalid string: (${typeof e}) ${e}`)}prepareJSON(e,t){if(typeof e=="string")return e;throw new Error(`Invalid string: (${typeof e}) ${e}`)}fromPreparedJSON(e){if(typeof e=="string")return e;throw new Error(`Invalid string: (${typeof e}) ${e}`)}}class Y extends wr{defaultValue(){return BigInt(0)}isDefaultValue(e){return typeof e=="bigint"?e===BigInt(0):typeof e=="number"?e===0:!1}prepareMsgpack(e){return wn(e)}fromPreparedMsgpack(e,t){return wn(e)}prepareJSON(e,t){return wn(e)}fromPreparedJSON(e){return wn(e)}}class pn extends wr{defaultValue(){return Pt.zeroAddress()}isDefaultValue(e){return Pt.zeroAddress().equals(e)}prepareMsgpack(e){if(e instanceof Pt)return e.publicKey;throw new Error(`Invalid address: (${typeof e}) ${e}`)}fromPreparedMsgpack(e,t){return new Pt(e)}prepareJSON(e,t){if(e instanceof Pt)return e.toString();throw new Error(`Invalid address: (${typeof e}) ${e}`)}fromPreparedJSON(e){return Pt.fromString(e)}}class Je extends wr{defaultValue(){return new Uint8Array}isDefaultValue(e){return e instanceof Uint8Array&&e.byteLength===0}prepareMsgpack(e){if(e instanceof Uint8Array)return e;throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}fromPreparedMsgpack(e,t){if(e instanceof Uint8Array)return e;throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}prepareJSON(e,t){if(e instanceof Uint8Array)return Zn(e);throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}fromPreparedJSON(e){if(e==null)return this.defaultValue();if(typeof e=="string")return lt(e);throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}}class xn extends wr{constructor(e){super(),this.length=e}defaultValue(){return new Uint8Array(this.length)}isDefaultValue(e){return e instanceof Uint8Array&&e.byteLength===this.length&&e.every(t=>t===0)}prepareMsgpack(e){if(e instanceof Uint8Array){if(e.byteLength===this.length)return e;throw new Error(`Invalid byte array length: wanted ${this.length}, got ${e.byteLength}`)}throw new Error("Invalid byte array")}fromPreparedMsgpack(e,t){if(e instanceof Uint8Array){if(e.byteLength===this.length)return e;throw new Error(`Invalid byte array length: wanted ${this.length}, got ${e.byteLength}`)}throw new Error("Invalid byte array")}prepareJSON(e){if(e instanceof Uint8Array){if(e.byteLength===this.length)return Zn(e);throw new Error(`Invalid byte array length: wanted ${this.length}, got ${e.byteLength}`)}throw new Error("Invalid byte array")}fromPreparedJSON(e){if(typeof e=="string"){const t=lt(e);if(t.byteLength===this.length)return t;throw new Error(`Invalid byte array length: wanted ${this.length}, got ${t.byteLength}`)}throw new Error("Invalid base64 byte array")}}const fl=32,db=52;class S8 extends wr{defaultValue(){return new Uint8Array(fl)}isDefaultValue(e){return e instanceof Uint8Array&&e.byteLength===fl&&e.every(t=>t===0)}prepareMsgpack(e){if(e instanceof Uint8Array&&e.byteLength===fl)return e;throw new Error(`Invalid block hash: (${typeof e}) ${e}`)}fromPreparedMsgpack(e,t){if(e instanceof Uint8Array&&e.byteLength===fl)return e;throw new Error(`Invalid block hash: (${typeof e}) ${e}`)}prepareJSON(e,t){if(e instanceof Uint8Array&&e.byteLength===fl)return`blk-${oh.encode(e).slice(0,db)}`;throw new Error(`Invalid block hash: (${typeof e}) ${e}`)}fromPreparedJSON(e){if(typeof e=="string"&&e.length===db+4&&e.startsWith("blk-"))return Uint8Array.from(oh.decode.asBytes(e.slice(4)));throw new Error(`Invalid block hash: (${typeof e}) ${e}`)}}class hc extends wr{defaultValue(){return new Uint8Array}isDefaultValue(e){return e instanceof Uint8Array&&e.byteLength===0}prepareMsgpack(e){if(e instanceof Uint8Array)return new gr(e);throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}fromPreparedMsgpack(e,t){return t.getRawStringAtCurrentLocation()}prepareJSON(e,t){if(e instanceof Uint8Array){const r=Ig(e);if(!t.lossyBinaryStringConversion&&!Mi(Ri(r),e))throw new Error(`Invalid UTF-8 byte array encountered. Encode with lossyBinaryStringConversion enabled to bypass this check. Base64 value: ${Zn(e)}`);return r}throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}fromPreparedJSON(e){if(typeof e=="string")return Ri(e);throw new Error(`Invalid byte array: (${typeof e}) ${e}`)}}class He extends wr{constructor(e){super(),this.itemSchema=e}defaultValue(){return[]}isDefaultValue(e){return Array.isArray(e)&&e.length===0}prepareMsgpack(e){if(Array.isArray(e))return e.map(t=>this.itemSchema.prepareMsgpack(t));throw new Error("ArraySchema data must be an array")}fromPreparedMsgpack(e,t){if(Array.isArray(e))return e.map((r,i)=>this.itemSchema.fromPreparedMsgpack(r,t.withArrayElement(i)));throw new Error(`ArraySchema encoded data must be an array: ${e} (${typeof e})`)}prepareJSON(e,t){if(Array.isArray(e))return e.map(r=>this.itemSchema.prepareJSON(r,t));throw new Error("ArraySchema data must be an array")}fromPreparedJSON(e){if(Array.isArray(e))return e.map(t=>this.itemSchema.fromPreparedJSON(t));throw new Error(`ArraySchema encoded data must be an array: ${e} (${typeof e})`)}}function Rt(n){return n.map(e=>({...e,omitEmpty:!0}))}class Se extends wr{constructor(e){super(),this.entries=e,this.checkEntries()}pushEntries(...e){this.entries.push(...e),this.checkEntries()}checkEntries(){for(const t of this.entries)if(t.embedded){if(t.key!=="")throw new Error("Embedded entries must have an empty key");if(!(t.valueSchema instanceof Se))throw new Error("Embedded entry valueSchema must be a NamedMapSchema")}const e=new Set;for(const t of this.getEntries()){if(e.has(t.key))throw new Error(`Duplicate key: ${t.key}`);e.add(t.key)}}getEntries(){const e=[];for(const t of this.entries)if(t.embedded){const r=t.valueSchema;e.push(...r.getEntries())}else e.push(t);return e}defaultValue(){const e=new Map;for(const t of this.getEntries())e.set(t.key,t.valueSchema.defaultValue());return e}isDefaultValue(e){if(!(e instanceof Map))return!1;for(const t of this.getEntries())if(!t.valueSchema.isDefaultValue(e.get(t.key)))return!1;return!0}prepareMsgpack(e){if(!(e instanceof Map))throw new Error(`NamedMapSchema data must be a Map. Got (${typeof e}) ${e}`);const t=new Map;for(const r of this.getEntries()){const i=e.get(r.key);r.omitEmpty&&r.valueSchema.isDefaultValue(i)||t.set(r.key,r.valueSchema.prepareMsgpack(i))}return t}fromPreparedMsgpack(e,t){if(!(e instanceof Map))throw new Error("NamedMapSchema data must be a Map");const r=new Map;for(const i of this.getEntries())if(e.has(i.key))r.set(i.key,i.valueSchema.fromPreparedMsgpack(e.get(i.key),t.withMapValue(i.key)));else if(i.omitEmpty)r.set(i.key,i.valueSchema.defaultValue());else throw new Error(`Missing key: ${i.key}`);return r}prepareJSON(e,t){if(!(e instanceof Map))throw new Error("NamedMapSchema data must be a Map");const r={};for(const i of this.getEntries()){const o=e.get(i.key);i.omitEmpty&&i.valueSchema.isDefaultValue(o)||(r[i.key]=i.valueSchema.prepareJSON(o,t))}return r}fromPreparedJSON(e){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error("NamedMapSchema data must be an object");const t=new Map;for(const r of this.getEntries())if(Object.prototype.hasOwnProperty.call(e,r.key))t.set(r.key,r.valueSchema.fromPreparedJSON(e[r.key]));else if(r.omitEmpty)t.set(r.key,r.valueSchema.defaultValue());else throw new Error(`Missing key: ${r.key}`);return t}}function Hu(...n){const e=new Map;for(const t of n)for(const[r,i]of t){if(e.has(r))throw new Error(`Duplicate key: ${r}`);e.set(r,i)}return e}function Ln(n,e){const t=new Map;for(const[r,i]of n){const[o,s]=e(r,i);t.set(o,s)}return t}class Rg extends wr{constructor(e){super(),this.valueSchema=e}defaultValue(){return new Map}isDefaultValue(e){return e instanceof Map&&e.size===0}prepareMsgpack(e){if(!(e instanceof Map))throw new Error(`Uint64MapSchema data must be a Map. Got (${typeof e}) ${e}`);const t=new Map;for(const[r,i]of e){const o=wn(r);if(t.has(o))throw new Error(`Duplicate key: ${o}`);t.set(o,this.valueSchema.prepareMsgpack(i))}return t}fromPreparedMsgpack(e,t){if(!(e instanceof Map))throw new Error("Uint64MapSchema data must be a Map");const r=new Map;for(const[i,o]of e){const s=wn(i);if(r.has(s))throw new Error(`Duplicate key: ${s}`);r.set(s,this.valueSchema.fromPreparedMsgpack(o,t.withMapValue(i)))}return r}prepareJSON(e,t){if(!(e instanceof Map))throw new Error(`Uint64MapSchema data must be a Map. Got (${typeof e}) ${e}`);const r=new Map;for(const[o,s]of e){const a=wn(o);if(r.has(a))throw new Error(`Duplicate key: ${a}`);r.set(a,this.valueSchema.prepareJSON(s,t))}const i={};for(const[o,s]of r)i[o.toString()]=s;return i}fromPreparedJSON(e){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error("Uint64MapSchema data must be an object");const t=new Map;for(const[r,i]of Object.entries(e)){const o=BigInt(r);if(t.has(o))throw new Error(`Duplicate key: ${o}`);t.set(o,this.valueSchema.fromPreparedJSON(i))}return t}}class v8 extends wr{constructor(e){super(),this.valueSchema=e}defaultValue(){return new Map}isDefaultValue(e){return e instanceof Map&&e.size===0}prepareMsgpack(e){if(!(e instanceof Map))throw new Error(`ByteArrayMapSchema data must be a Map. Got (${typeof e}) ${e}`);const t=new Map;for(const[r,i]of e){if(!(r instanceof Uint8Array))throw new Error(`Invalid key: ${r} (${typeof r})`);t.set(r,this.valueSchema.prepareMsgpack(i))}return t}fromPreparedMsgpack(e,t){if(!(e instanceof Map))throw new Error("ByteArrayMapSchema data must be a Map");const r=new Map;for(const[i,o]of e){if(!(i instanceof Uint8Array))throw new Error(`Invalid key: ${i} (${typeof i})`);r.set(i,this.valueSchema.fromPreparedMsgpack(o,t.withMapValue(i)))}return r}prepareJSON(e,t){if(!(e instanceof Map))throw new Error(`ByteArrayMapSchema data must be a Map. Got (${typeof e}) ${e}`);const r=new Map;for(const[o,s]of e){if(!(o instanceof Uint8Array))throw new Error(`Invalid key: ${o} (${typeof o})`);const a=Zn(o);if(r.has(a))throw new Error(`Duplicate key (base64): ${a}`);r.set(a,this.valueSchema.prepareJSON(s,t))}const i={};for(const[o,s]of r)i[o]=s;return i}fromPreparedJSON(e){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error("ByteArrayMapSchema data must be an object");const t=new Map;for(const[r,i]of Object.entries(e))t.set(lt(r),this.valueSchema.fromPreparedJSON(i));return t}}function Pd(n){if(n instanceof gr)return Ig(n.rawBinaryValue);if(n instanceof Map){const e=new Map;for(const[t,r]of n)e.set(Pd(t),Pd(r));return e}return Array.isArray(n)?n.map(Pd):n}class sh extends wr{constructor(e){super(),this.valueSchema=e}defaultValue(){return new Map}isDefaultValue(e){return e instanceof Map&&e.size===0}prepareMsgpack(e){if(!(e instanceof Map))throw new Error(`SpecialCaseBinaryStringMapSchema data must be a Map. Got (${typeof e}) ${e}`);const t=new Map;for(const[r,i]of e){if(!(r instanceof Uint8Array))throw new Error(`Invalid key: ${r} (${typeof r})`);t.set(new gr(r),this.valueSchema.prepareMsgpack(i))}return t}fromPreparedMsgpack(e,t){const r=new Map,i=t.getRawStringKeysAndValuesAtCurrentLocation();for(const[o,s]of i)r.set(o,this.valueSchema.fromPreparedMsgpack(Pd(s),t.withMapValue(new gr(o))));return r}prepareJSON(e,t){if(!(e instanceof Map))throw new Error(`SpecialCaseBinaryStringMapSchema data must be a Map. Got (${typeof e}) ${e}`);const r=new Map;for(const[o,s]of e){if(!(o instanceof Uint8Array))throw new Error(`Invalid key: ${o}`);const a=Ig(o);if(!t.lossyBinaryStringConversion&&!Mi(Ri(a),o))throw new Error(`Invalid UTF-8 byte array encountered. Encode with lossyBinaryStringConversion enabled to bypass this check. Base64 value: ${Zn(o)}`);r.set(a,this.valueSchema.prepareJSON(s,t))}const i={};for(const[o,s]of r)i[o]=s;return i}fromPreparedJSON(e){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error("SpecialCaseBinaryStringMapSchema data must be an object");const t=new Map;for(const[r,i]of Object.entries(e))t.set(Ri(r),this.valueSchema.fromPreparedJSON(i));return t}}class B extends wr{constructor(e){super(),this.valueSchema=e}defaultValue(){}isDefaultValue(e){return e===void 0||this.valueSchema.isDefaultValue(e)}prepareMsgpack(e){if(e!==void 0)return this.valueSchema.prepareMsgpack(e)}fromPreparedMsgpack(e,t){if(e!=null)return this.valueSchema.fromPreparedMsgpack(e,t)}prepareJSON(e,t){return e===void 0?null:this.valueSchema.prepareJSON(e,t)}fromPreparedJSON(e){if(e!=null)return this.valueSchema.fromPreparedJSON(e)}}class G2 extends wr{defaultValue(){}isDefaultValue(e){return e===void 0}prepareMsgpack(e){return e}fromPreparedMsgpack(e,t){return e}prepareJSON(e,t){return Ev(e)}fromPreparedJSON(e){return bv(e)}}function x8(n,e,t){const r=BigInt(n.appIndex),i=n.name,o=r===BigInt(0)||r===t,s=e.indexOf(r)+1;if(s===0&&!o)throw new Error(`Box ref with appId ${r} not in foreign-apps`);return new Map([["i",s],["n",i]])}function E8(n,e,t){const r=BigInt(t),i=e.map(BigInt);return n.map(o=>x8(o,i,r))}function b8(n,e){const t=[];function r(o){for(let s=0;s<t.length;s++){const a=t[s],l=a.get("d");if((!o.address&&!l||o.address&&l&&o.address.equals(l))&&a.get("s")===o.assetIndex&&a.get("p")===o.appIndex)return s+1}return o.address&&t.push(new Map([["d",o.address]])),o.assetIndex&&t.push(new Map([["s",o.assetIndex]])),o.appIndex&&t.push(new Map([["p",o.appIndex]])),t.length}const i=Pt.zeroAddress();for(const o of e){if(o.address||o.assetIndex||o.appIndex){r(o);continue}if(o.holding){const s=o.holding;let a=0;s.address&&!s.address.equals(i)&&(a=r({address:s.address}));const l=r({assetIndex:s.assetIndex});t.push(new Map([["h",new Map([["d",a],["s",l]])]]));continue}if(o.locals){const s=o.locals;let a=0;s.address&&!s.address.equals(i)&&(a=r({address:s.address}));let l=0;s.appIndex&&BigInt(s.appIndex)!==n&&(l=r({appIndex:s.appIndex})),t.push(new Map([["l",new Map([["d",a],["p",l]])]]));continue}if(o.box){const s=o.box;let a=0;s.appIndex&&BigInt(s.appIndex)!==n&&(a=r({appIndex:s.appIndex})),t.push(new Map([["b",new Map([["i",a],["n",s.name]])]]))}}return t}function k8(n){const e=[];for(const t of n){const r=t.get("d"),i=t.get("s"),o=t.get("p");if(r){e.push({address:r});continue}if(i){e.push({assetIndex:i});continue}if(o){e.push({appIndex:o});continue}const s=t.get("h");if(s){const c=Xn(s.get("d")??0),d=Xn(s.get("s"));if(!d)throw new Error(`Holding missing asset index: ${s}`);const f=c===0?Pt.zeroAddress():e[c-1].address,m=e[d-1].assetIndex;e.push({holding:{address:f,assetIndex:m}});continue}const a=t.get("l");if(a){const c=Xn(a.get("d")??0),d=Xn(a.get("p")??0),f=c===0?Pt.zeroAddress():e[c-1].address,m=d===0?BigInt(0):e[d-1].appIndex;e.push({locals:{address:f,appIndex:m}});continue}const l=t.get("b");if(l){const c=Xn(l.get("i")??0),d=l.get("n");if(!d)throw new Error(`Box missing name: ${l}`);const f=c===0?BigInt(0):e[c-1].appIndex;e.push({box:{appIndex:f,name:d}})}}return e}function A8({appIndex:n,accounts:e,foreignAssets:t,foreignApps:r,holdings:i,locals:o,boxes:s}){const a=[];function l(f){let m;if(typeof f=="string"){if(f==="")return;m=Pt.fromString(f)}else m=f;if(m.equals(Pt.zeroAddress()))return;let w=!1;for(const k of a){if(!k.address)continue;let I=k.address;if(typeof k.address=="string"&&(I=Pt.fromString(k.address)),I.equals(m)){w=!0;break}}w||a.push({address:f})}function c(f){let m=!1;for(const w of a)if(w.assetIndex===f){m=!0;break}m||a.push({assetIndex:f})}function d(f){let m=!1;for(const w of a)if(w.appIndex===f){m=!0;break}m||a.push({appIndex:f})}for(const f of e??[])l(f);for(const f of t??[])c(f);for(const f of r??[])d(f);for(const f of i??[])f.address&&l(f.address),c(f.assetIndex),a.push({holding:f});for(const f of o??[])f.address&&l(f.address),f.appIndex&&BigInt(f.appIndex)!==n&&d(f.appIndex),a.push({locals:f});for(const f of s??[])f.appIndex&&BigInt(f.appIndex)!==n&&d(f.appIndex),a.push({box:f});return a}var ln;(function(n){n.pay="pay",n.keyreg="keyreg",n.acfg="acfg",n.axfer="axfer",n.afrz="afrz",n.appl="appl",n.stpf="stpf",n.hb="hb"})(ln||(ln={}));function kv(n){return n===ln.pay||n===ln.keyreg||n===ln.acfg||n===ln.axfer||n===ln.afrz||n===ln.appl||n===ln.stpf||n===ln.hb}var tr;(function(n){n[n.NoOpOC=0]="NoOpOC",n[n.OptInOC=1]="OptInOC",n[n.CloseOutOC=2]="CloseOutOC",n[n.ClearStateOC=3]="ClearStateOC",n[n.UpdateApplicationOC=4]="UpdateApplicationOC",n[n.DeleteApplicationOC=5]="DeleteApplicationOC"})(tr||(tr={}));function K2(n){return n===tr.NoOpOC||n===tr.OptInOC||n===tr.CloseOutOC||n===tr.ClearStateOC||n===tr.UpdateApplicationOC||n===tr.DeleteApplicationOC}let Cg=class Av{constructor(e){this.hashType=e.hashType}getEncodingSchema(){return Av.encodingSchema}toEncodingData(){return new Map([["t",this.hashType]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HashFactory: ${e}`);return new Av({hashType:Number(e.get("t"))})}};Cg.encodingSchema=new Se(Rt([{key:"t",valueSchema:new Y}]));let Go=class Dv{constructor(e){this.path=e.path,this.hashFactory=e.hashFactory,this.treeDepth=e.treeDepth}getEncodingSchema(){return Dv.encodingSchema}toEncodingData(){return new Map([["pth",this.path],["hsh",this.hashFactory.toEncodingData()],["td",this.treeDepth]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded MerkleArrayProof: ${e}`);return new Dv({path:e.get("pth"),hashFactory:Cg.fromEncodingData(e.get("hsh")),treeDepth:Number(e.get("td"))})}};Go.encodingSchema=new Se(Rt([{key:"pth",valueSchema:new He(new Je)},{key:"hsh",valueSchema:Cg.encodingSchema},{key:"td",valueSchema:new Y}]));class ca{constructor(e){this.commitment=e.commitment,this.keyLifetime=e.keyLifetime}getEncodingSchema(){return ca.encodingSchema}toEncodingData(){return new Map([["cmt",this.commitment],["lf",this.keyLifetime]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded MerkleSignatureVerifier: ${e}`);return new ca({commitment:e.get("cmt"),keyLifetime:e.get("lf")})}}ca.encodingSchema=new Se(Rt([{key:"cmt",valueSchema:new xn(64)},{key:"lf",valueSchema:new Y}]));class ua{constructor(e){this.pk=e.pk,this.weight=e.weight}getEncodingSchema(){return ua.encodingSchema}toEncodingData(){return new Map([["p",this.pk.toEncodingData()],["w",this.weight]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Participant: ${e}`);return new ua({pk:ca.fromEncodingData(e.get("p")),weight:e.get("w")})}}ua.encodingSchema=new Se(Rt([{key:"p",valueSchema:ca.encodingSchema},{key:"w",valueSchema:new Y}]));class la{constructor(e){this.publicKey=e.publicKey}getEncodingSchema(){return la.encodingSchema}toEncodingData(){return new Map([["k",this.publicKey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded FalconVerifier: ${e}`);return new la({publicKey:e.get("k")})}}la.encodingSchema=new Se(Rt([{key:"k",valueSchema:new xn(1793)}]));class ha{constructor(e){this.signature=e.signature,this.vectorCommitmentIndex=e.index,this.proof=e.proof,this.verifyingKey=e.verifyingKey}getEncodingSchema(){return ha.encodingSchema}toEncodingData(){return new Map([["sig",this.signature],["idx",this.vectorCommitmentIndex],["prf",this.proof.toEncodingData()],["vkey",this.verifyingKey.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded FalconSignatureStruct: ${e}`);return new ha({signature:e.get("sig"),index:e.get("idx"),proof:Go.fromEncodingData(e.get("prf")),verifyingKey:la.fromEncodingData(e.get("vkey"))})}}ha.encodingSchema=new Se(Rt([{key:"sig",valueSchema:new Je},{key:"idx",valueSchema:new Y},{key:"prf",valueSchema:Go.encodingSchema},{key:"vkey",valueSchema:la.encodingSchema}]));class da{constructor(e){this.sig=e.sig,this.l=e.l}getEncodingSchema(){return da.encodingSchema}toEncodingData(){return new Map([["s",this.sig.toEncodingData()],["l",this.l]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SigslotCommit: ${e}`);return new da({sig:ha.fromEncodingData(e.get("s")),l:e.get("l")})}}da.encodingSchema=new Se(Rt([{key:"s",valueSchema:ha.encodingSchema},{key:"l",valueSchema:new Y}]));class fa{constructor(e){this.sigslot=e.sigslot,this.participant=e.participant}getEncodingSchema(){return fa.encodingSchema}toEncodingData(){return new Map([["s",this.sigslot.toEncodingData()],["p",this.participant.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Reveal: ${e}`);return new fa({sigslot:da.fromEncodingData(e.get("s")),participant:ua.fromEncodingData(e.get("p"))})}}fa.encodingSchema=new Se(Rt([{key:"s",valueSchema:da.encodingSchema},{key:"p",valueSchema:ua.encodingSchema}]));let Pg=class Fv{constructor(e){this.sigCommit=e.sigCommit,this.signedWeight=e.signedWeight,this.sigProofs=e.sigProofs,this.partProofs=e.partProofs,this.merkleSignatureSaltVersion=e.merkleSignatureSaltVersion,this.reveals=e.reveals,this.positionsToReveal=e.positionsToReveal}getEncodingSchema(){return Fv.encodingSchema}toEncodingData(){return new Map([["c",this.sigCommit],["w",this.signedWeight],["S",this.sigProofs.toEncodingData()],["P",this.partProofs.toEncodingData()],["v",this.merkleSignatureSaltVersion],["r",Ln(this.reveals,(e,t)=>[e,t.toEncodingData()])],["pr",this.positionsToReveal]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProof: ${e}`);return new Fv({sigCommit:e.get("c"),signedWeight:e.get("w"),sigProofs:Go.fromEncodingData(e.get("S")),partProofs:Go.fromEncodingData(e.get("P")),merkleSignatureSaltVersion:Number(e.get("v")),reveals:Ln(e.get("r"),(t,r)=>[t,fa.fromEncodingData(r)]),positionsToReveal:e.get("pr")})}};Pg.encodingSchema=new Se(Rt([{key:"c",valueSchema:new Je},{key:"w",valueSchema:new Y},{key:"S",valueSchema:Go.encodingSchema},{key:"P",valueSchema:Go.encodingSchema},{key:"v",valueSchema:new Y},{key:"r",valueSchema:new Rg(fa.encodingSchema)},{key:"pr",valueSchema:new He(new Y)}]));let $g=class $d{constructor(e){this.blockHeadersCommitment=e.blockHeadersCommitment,this.votersCommitment=e.votersCommitment,this.lnProvenWeight=e.lnProvenWeight,this.firstAttestedRound=e.firstAttestedRound,this.lastAttestedRound=e.lastAttestedRound}getEncodingSchema(){return $d.encodingSchema}toEncodingData(){return new Map([["b",this.blockHeadersCommitment],["v",this.votersCommitment],["P",this.lnProvenWeight],["f",this.firstAttestedRound],["l",this.lastAttestedRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofMessage: ${e}`);return new $d({blockHeadersCommitment:e.get("b"),votersCommitment:e.get("v"),lnProvenWeight:e.get("P"),firstAttestedRound:e.get("f"),lastAttestedRound:e.get("l")})}static fromMap(e){return new $d({blockHeadersCommitment:e.get("b"),votersCommitment:e.get("v"),lnProvenWeight:e.get("P"),firstAttestedRound:e.get("f"),lastAttestedRound:e.get("l")})}};$g.encodingSchema=new Se(Rt([{key:"b",valueSchema:new Je},{key:"v",valueSchema:new Je},{key:"P",valueSchema:new Y},{key:"f",valueSchema:new Y},{key:"l",valueSchema:new Y}]));class Rc{constructor(e){this.sig=e.sig,this.pk=e.pk,this.pk2=e.pk2,this.pk1Sig=e.pk1Sig,this.pk2Sig=e.pk2Sig}getEncodingSchema(){return Rc.encodingSchema}toEncodingData(){return new Map([["s",this.sig],["p",this.pk],["p2",this.pk2],["p1s",this.pk1Sig],["p2s",this.pk2Sig]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HeartbeatProof: ${e}`);return new Rc({sig:e.get("s"),pk:e.get("p"),pk2:e.get("p2"),pk1Sig:e.get("p1s"),pk2Sig:e.get("p2s")})}}Rc.encodingSchema=new Se(Rt([{key:"s",valueSchema:new xn(64)},{key:"p",valueSchema:new xn(32)},{key:"p2",valueSchema:new xn(32)},{key:"p1s",valueSchema:new xn(64)},{key:"p2s",valueSchema:new xn(64)}]));class zo{constructor(e){this.address=e.address,this.proof=e.proof,this.seed=e.seed,this.voteID=e.voteID,this.keyDilution=e.keyDilution}getEncodingSchema(){return zo.encodingSchema}toEncodingData(){return new Map([["a",this.address],["prf",this.proof.toEncodingData()],["sd",this.seed],["vid",this.voteID],["kd",this.keyDilution]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Heartbeat: ${e}`);return new zo({address:e.get("a"),proof:Rc.fromEncodingData(e.get("prf")),seed:e.get("sd"),voteID:e.get("vid"),keyDilution:e.get("kd")})}}zo.encodingSchema=new Se(Rt([{key:"a",valueSchema:new pn},{key:"prf",valueSchema:Rc.encodingSchema},{key:"sd",valueSchema:new Je},{key:"vid",valueSchema:new xn(32)},{key:"kd",valueSchema:new Y}]));const D8=52,F8=32,T8=75,I8=32,M8=32,R8=32,C8=64,P8=32;function W2(n){return n.every(e=>e===0)}function Vp(n,e,t){if(n==null)return;let r;if(n instanceof Uint8Array&&(r=n),r==null||r.byteLength!==t)throw Error(`${e} must be a ${t} byte Uint8Array`);return r}function zi(n){if(n==null)throw new Error("Address must not be null or undefined");if(typeof n=="string")return Pt.fromString(n);if(n instanceof Pt)return n;throw new Error(`Not an address: ${n}`)}function wo(n){if(n==null)return;let e;if(n instanceof Pt)e=n;else if(typeof n=="string")e=Pt.fromString(n);else throw new Error(`Not an address: ${n}`);if(W2(e.publicKey))throw new Error("Invalid use of the zero address. To omit this value, pass in undefined");return e}function J2(n){if(!(typeof n>"u")){if(n instanceof Uint8Array)return n;throw new Error(`Not a Uint8Array: ${n}`)}}function xs(n){if(n instanceof Uint8Array)return n;throw new Error(`Not a Uint8Array: ${n}`)}function Op(n){if(!(typeof n>"u"))return wn(n)}function wd(n){if(n===!0||n===!1)return n;throw new Error(`Not a boolean: ${n}`)}function Qa(n){if(Array.isArray(n))return n.slice();throw new Error(`Not an array: ${n}`)}function fb(n,e,t){const r=J2(n);if(!(typeof r>"u")){if(r.byteLength!==e)throw new Error(`${t} must be ${e} bytes long, was ${r.byteLength}`);if(!W2(r))return r}}function Y2(n){if(n!=null&&typeof n=="object"){const{appIndex:e,name:t}=n;return{appIndex:wn(e),name:xs(t)}}throw new Error(`Not a box reference: ${n}`)}function $8(n){if(n!=null&&typeof n=="object"){const{assetIndex:e,address:t}=n;return{assetIndex:wn(e),address:zi(t)}}throw new Error(`Not a holding reference: ${n}`)}function B8(n){if(n!=null&&typeof n=="object"){const{appIndex:e,address:t}=n;return{appIndex:wn(e),address:zi(t)}}throw new Error(`Not a locals reference: ${n}`)}function V8(n){if(n!=null&&typeof n=="object"){const{address:e,appIndex:t,assetIndex:r,holding:i,locals:o,box:s}=n;if(e!==void 0)return{address:zi(e)};if(t!==void 0)return{appIndex:wn(t)};if(r!==void 0)return{assetIndex:wn(r)};if(i!==void 0)return{holding:$8(i)};if(o!==void 0)return{locals:B8(o)};if(s!==void 0)return{box:Y2(s)}}throw new Error(`Not a resource reference: ${n}`)}const gb=new TextEncoder().encode("TX");let Xr=class Bd{constructor(e){if(!kv(e.type))throw new Error(`Invalid transaction type: ${e.type}`);if(this.type=e.type,this.sender=zi(e.sender),this.note=xs(e.note??new Uint8Array),this.lease=fb(e.lease,F8,"lease"),this.rekeyTo=wo(e.rekeyTo),this.group=void 0,this.firstValid=wn(e.suggestedParams.firstValid),this.lastValid=wn(e.suggestedParams.lastValid),e.suggestedParams.genesisID){if(typeof e.suggestedParams.genesisID!="string")throw new Error("Genesis ID must be a string if present");this.genesisID=e.suggestedParams.genesisID}this.genesisHash=J2(e.suggestedParams.genesisHash);const t=[];if(e.paymentParams&&t.push(ln.pay),e.keyregParams&&t.push(ln.keyreg),e.assetConfigParams&&t.push(ln.acfg),e.assetTransferParams&&t.push(ln.axfer),e.assetFreezeParams&&t.push(ln.afrz),e.appCallParams&&t.push(ln.appl),e.stateProofParams&&t.push(ln.stpf),e.heartbeatParams&&t.push(ln.hb),t.length!==1)throw new Error(`Transaction has wrong number of type fields present (${t.length}): ${t}`);if(this.type!==t[0])throw new Error(`Transaction has type ${this.type} but fields present for ${t[0]}`);if(e.paymentParams&&(this.payment={receiver:zi(e.paymentParams.receiver),amount:wn(e.paymentParams.amount),closeRemainderTo:wo(e.paymentParams.closeRemainderTo)}),e.keyregParams){if(this.keyreg={voteKey:Vp(e.keyregParams.voteKey,"voteKey",M8),selectionKey:Vp(e.keyregParams.selectionKey,"selectionKey",R8),stateProofKey:Vp(e.keyregParams.stateProofKey,"stateProofKey",C8),voteFirst:Op(e.keyregParams.voteFirst),voteLast:Op(e.keyregParams.voteLast),voteKeyDilution:Op(e.keyregParams.voteKeyDilution),nonParticipation:wd(e.keyregParams.nonParticipation??!1)},this.keyreg.nonParticipation&&(this.keyreg.voteKey||this.keyreg.selectionKey||this.keyreg.stateProofKey||typeof this.keyreg.voteFirst<"u"||typeof this.keyreg.voteLast<"u"||typeof this.keyreg.voteKeyDilution<"u"))throw new Error("nonParticipation is true but participation params are present.");if(!this.keyreg.nonParticipation&&(this.keyreg.voteKey||this.keyreg.selectionKey||this.keyreg.stateProofKey||typeof this.keyreg.voteFirst<"u"||typeof this.keyreg.voteLast<"u"||typeof this.keyreg.voteKeyDilution<"u")&&!(this.keyreg.voteKey&&this.keyreg.selectionKey&&typeof this.keyreg.voteFirst<"u"&&typeof this.keyreg.voteLast<"u"&&typeof this.keyreg.voteKeyDilution<"u"))throw new Error("Online key registration missing at least one of the following fields: voteKey, selectionKey, voteFirst, voteLast, voteKeyDilution")}if(e.assetConfigParams&&(this.assetConfig={assetIndex:wn(e.assetConfigParams.assetIndex??0),total:wn(e.assetConfigParams.total??0),decimals:Xn(e.assetConfigParams.decimals??0),defaultFrozen:wd(e.assetConfigParams.defaultFrozen??!1),manager:wo(e.assetConfigParams.manager),reserve:wo(e.assetConfigParams.reserve),freeze:wo(e.assetConfigParams.freeze),clawback:wo(e.assetConfigParams.clawback),unitName:e.assetConfigParams.unitName,assetName:e.assetConfigParams.assetName,assetURL:e.assetConfigParams.assetURL,assetMetadataHash:fb(e.assetConfigParams.assetMetadataHash,I8,"assetMetadataHash")}),e.assetTransferParams&&(this.assetTransfer={assetIndex:wn(e.assetTransferParams.assetIndex),amount:wn(e.assetTransferParams.amount),assetSender:wo(e.assetTransferParams.assetSender),receiver:zi(e.assetTransferParams.receiver),closeRemainderTo:wo(e.assetTransferParams.closeRemainderTo)}),e.assetFreezeParams&&(this.assetFreeze={assetIndex:wn(e.assetFreezeParams.assetIndex),freezeAccount:zi(e.assetFreezeParams.freezeTarget),frozen:wd(e.assetFreezeParams.frozen)}),e.appCallParams){const{onComplete:i}=e.appCallParams;if(!K2(i))throw new Error(`Invalid onCompletion value: ${i}`);this.applicationCall={appIndex:wn(e.appCallParams.appIndex),onComplete:i,numLocalInts:Xn(e.appCallParams.numLocalInts??0),numLocalByteSlices:Xn(e.appCallParams.numLocalByteSlices??0),numGlobalInts:Xn(e.appCallParams.numGlobalInts??0),numGlobalByteSlices:Xn(e.appCallParams.numGlobalByteSlices??0),extraPages:Xn(e.appCallParams.extraPages??0),approvalProgram:xs(e.appCallParams.approvalProgram??new Uint8Array),clearProgram:xs(e.appCallParams.clearProgram??new Uint8Array),appArgs:Qa(e.appCallParams.appArgs??[]).map(xs),accounts:Qa(e.appCallParams.accounts??[]).map(zi),foreignApps:Qa(e.appCallParams.foreignApps??[]).map(wn),foreignAssets:Qa(e.appCallParams.foreignAssets??[]).map(wn),boxes:Qa(e.appCallParams.boxes??[]).map(Y2),access:Qa(e.appCallParams.access??[]).map(V8),rejectVersion:Xn(e.appCallParams.rejectVersion??0)}}if(e.stateProofParams&&(this.stateProof={stateProofType:Xn(e.stateProofParams.stateProofType??0),stateProof:e.stateProofParams.stateProof,message:e.stateProofParams.message}),e.heartbeatParams&&(this.heartbeat=new zo({address:e.heartbeatParams.address,proof:e.heartbeatParams.proof,seed:e.heartbeatParams.seed,voteID:e.heartbeatParams.voteID,keyDilution:e.heartbeatParams.keyDilution})),this.fee=wn(e.suggestedParams.fee),!wd(e.suggestedParams.flatFee??!1)){const i=wn(e.suggestedParams.minFee);this.fee*=BigInt(this.estimateSize()),this.fee<i&&(this.fee=i)}}getEncodingSchema(){return Bd.encodingSchema}toEncodingData(){const e=new Map([["type",this.type],["fv",this.firstValid],["lv",this.lastValid],["snd",this.sender],["gen",this.genesisID],["gh",this.genesisHash],["fee",this.fee],["note",this.note],["lx",this.lease],["rekey",this.rekeyTo],["grp",this.group]]);if(this.payment)return e.set("amt",this.payment.amount),e.set("rcv",this.payment.receiver),e.set("close",this.payment.closeRemainderTo),e;if(this.keyreg)return e.set("votekey",this.keyreg.voteKey),e.set("selkey",this.keyreg.selectionKey),e.set("sprfkey",this.keyreg.stateProofKey),e.set("votefst",this.keyreg.voteFirst),e.set("votelst",this.keyreg.voteLast),e.set("votekd",this.keyreg.voteKeyDilution),e.set("nonpart",this.keyreg.nonParticipation),e;if(this.assetConfig){e.set("caid",this.assetConfig.assetIndex);const t=new Map([["t",this.assetConfig.total],["dc",this.assetConfig.decimals],["df",this.assetConfig.defaultFrozen],["m",this.assetConfig.manager],["r",this.assetConfig.reserve],["f",this.assetConfig.freeze],["c",this.assetConfig.clawback],["un",this.assetConfig.unitName],["an",this.assetConfig.assetName],["au",this.assetConfig.assetURL],["am",this.assetConfig.assetMetadataHash]]);return e.set("apar",t),e}if(this.assetTransfer)return e.set("xaid",this.assetTransfer.assetIndex),e.set("aamt",this.assetTransfer.amount),e.set("arcv",this.assetTransfer.receiver),e.set("aclose",this.assetTransfer.closeRemainderTo),e.set("asnd",this.assetTransfer.assetSender),e;if(this.assetFreeze)return e.set("faid",this.assetFreeze.assetIndex),e.set("afrz",this.assetFreeze.frozen),e.set("fadd",this.assetFreeze.freezeAccount),e;if(this.applicationCall)return e.set("apid",this.applicationCall.appIndex),e.set("apan",this.applicationCall.onComplete),e.set("apaa",this.applicationCall.appArgs),e.set("apat",this.applicationCall.accounts),e.set("apas",this.applicationCall.foreignAssets),e.set("apfa",this.applicationCall.foreignApps),e.set("apbx",E8(this.applicationCall.boxes,this.applicationCall.foreignApps,this.applicationCall.appIndex)),e.set("al",b8(this.applicationCall.appIndex,this.applicationCall.access)),e.set("apap",this.applicationCall.approvalProgram),e.set("apsu",this.applicationCall.clearProgram),e.set("apls",new Map([["nui",this.applicationCall.numLocalInts],["nbs",this.applicationCall.numLocalByteSlices]])),e.set("apgs",new Map([["nui",this.applicationCall.numGlobalInts],["nbs",this.applicationCall.numGlobalByteSlices]])),e.set("apep",this.applicationCall.extraPages),e.set("aprv",this.applicationCall.rejectVersion),e;if(this.stateProof)return e.set("sptype",this.stateProof.stateProofType),e.set("sp",this.stateProof.stateProof?this.stateProof.stateProof.toEncodingData():void 0),e.set("spmsg",this.stateProof.message?this.stateProof.message.toEncodingData():void 0),e;if(this.heartbeat){const t=new zo({address:this.heartbeat.address,proof:this.heartbeat.proof,seed:this.heartbeat.seed,voteID:this.heartbeat.voteID,keyDilution:this.heartbeat.keyDilution});return e.set("hb",t.toEncodingData()),e}throw new Error(`Unexpected transaction type: ${this.type}`)}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded logic sig account: ${e}`);const t={minFee:BigInt(0),flatFee:!0,fee:e.get("fee")??0,firstValid:e.get("fv")??0,lastValid:e.get("lv")??0,genesisHash:e.get("gh"),genesisID:e.get("gen")},r=e.get("type");if(!kv(r))throw new Error(`Unrecognized transaction type: ${r}`);const i={type:r,sender:e.get("snd")??Pt.zeroAddress(),note:e.get("note"),lease:e.get("lx"),suggestedParams:t};if(e.get("rekey")&&(i.rekeyTo=e.get("rekey")),i.type===ln.pay){const s={amount:e.get("amt")??0,receiver:e.get("rcv")??Pt.zeroAddress()};e.get("close")&&(s.closeRemainderTo=e.get("close")),i.paymentParams=s}else if(i.type===ln.keyreg){const s={voteKey:e.get("votekey"),selectionKey:e.get("selkey"),stateProofKey:e.get("sprfkey"),voteFirst:e.get("votefst"),voteLast:e.get("votelst"),voteKeyDilution:e.get("votekd"),nonParticipation:e.get("nonpart")};i.keyregParams=s}else if(i.type===ln.acfg){const s={assetIndex:e.get("caid")};if(e.get("apar")){const a=e.get("apar");s.total=a.get("t"),s.decimals=a.get("dc"),s.defaultFrozen=a.get("df"),s.unitName=a.get("un"),s.assetName=a.get("an"),s.assetURL=a.get("au"),s.assetMetadataHash=a.get("am"),a.get("m")&&(s.manager=a.get("m")),a.get("r")&&(s.reserve=a.get("r")),a.get("f")&&(s.freeze=a.get("f")),a.get("c")&&(s.clawback=a.get("c"))}i.assetConfigParams=s}else if(i.type===ln.axfer){const s={assetIndex:e.get("xaid")??0,amount:e.get("aamt")??0,receiver:e.get("arcv")??Pt.zeroAddress()};e.get("aclose")&&(s.closeRemainderTo=e.get("aclose")),e.get("asnd")&&(s.assetSender=e.get("asnd")),i.assetTransferParams=s}else if(i.type===ln.afrz){const s={assetIndex:e.get("faid")??0,freezeTarget:e.get("fadd")??Pt.zeroAddress(),frozen:e.get("afrz")??!1};i.assetFreezeParams=s}else if(i.type===ln.appl){const s={appIndex:e.get("apid")??0,onComplete:Xn(e.get("apan")??0),appArgs:e.get("apaa"),accounts:e.get("apat"),foreignAssets:e.get("apas"),foreignApps:e.get("apfa"),approvalProgram:e.get("apap"),clearProgram:e.get("apsu"),extraPages:e.get("apep"),rejectVersion:e.get("aprv")??0},a=e.get("apls");a&&(s.numLocalInts=a.get("nui"),s.numLocalByteSlices=a.get("nbs"));const l=e.get("apgs");l&&(s.numGlobalInts=l.get("nui"),s.numGlobalByteSlices=l.get("nbs"));const c=e.get("apbx");c&&(s.boxes=c.map(f=>{const m=Xn(f.get("i")??0),w=xs(f.get("n")??new Uint8Array);if(m===0)return{appIndex:0,name:w};if(!s.foreignApps||m>s.foreignApps.length)throw new Error(`Cannot find foreign app index ${m} in ${s.foreignApps}`);return{appIndex:s.foreignApps[m-1],name:w}}));const d=e.get("al");d&&(s.access=k8(d)),i.appCallParams=s}else if(i.type===ln.stpf){const s={stateProofType:e.get("sptype"),stateProof:e.get("sp")?Pg.fromEncodingData(e.get("sp")):void 0,message:e.get("spmsg")?$g.fromEncodingData(e.get("spmsg")):void 0};i.stateProofParams=s}else if(i.type===ln.hb){const s=zo.fromEncodingData(e.get("hb")),a={address:s.address,proof:s.proof,seed:s.seed,voteID:s.voteID,keyDilution:s.keyDilution};i.heartbeatParams=a}else{const s=i.type;throw new Error(`Unexpected transaction type: ${s}`)}const o=new Bd(i);if(e.get("grp")){const s=xs(e.get("grp"));if(s.byteLength!==P8)throw new Error(`Invalid group length: ${s.byteLength}`);o.group=s}return o}estimateSize(){return this.toByte().length+T8}bytesToSign(){const e=this.toByte();return jn(gb,e)}toByte(){return Yr(this)}rawSignTxn(e){const t=this.bytesToSign();return ih(t,e)}signTxn(e){const t=Fg(e),r=new Pt(t.publicKey),i=this.rawSignTxn(e);return this.attachSignature(r,i)}attachSignature(e,t){if(!M2(t.length))throw new Error("Invalid signature length");const r=new Map([["sig",t],["txn",this.toEncodingData()]]),i=zi(e);this.sender.equals(i)||r.set("sgnr",i);const o=new Se(Rt([{key:"txn",valueSchema:Bd.encodingSchema},{key:"sig",valueSchema:new xn(64)},{key:"sgnr",valueSchema:new B(new pn)}]));return nd(o.prepareMsgpack(r))}rawTxID(){const e=this.toByte(),t=jn(gb,e);return Uint8Array.from(ro(t))}txID(){const e=this.rawTxID();return oh.encode(e).slice(0,D8)}};Xr.encodingSchema=new Se(Rt([{key:"type",valueSchema:new Le},{key:"snd",valueSchema:new pn},{key:"lv",valueSchema:new Y},{key:"gen",valueSchema:new B(new Le)},{key:"gh",valueSchema:new B(new xn(32))},{key:"fee",valueSchema:new Y},{key:"fv",valueSchema:new Y},{key:"note",valueSchema:new Je},{key:"lx",valueSchema:new B(new xn(32))},{key:"rekey",valueSchema:new B(new pn)},{key:"grp",valueSchema:new B(new xn(32))},{key:"amt",valueSchema:new B(new Y)},{key:"rcv",valueSchema:new B(new pn)},{key:"close",valueSchema:new B(new pn)},{key:"votekey",valueSchema:new B(new xn(32))},{key:"selkey",valueSchema:new B(new xn(32))},{key:"sprfkey",valueSchema:new B(new xn(64))},{key:"votefst",valueSchema:new B(new Y)},{key:"votelst",valueSchema:new B(new Y)},{key:"votekd",valueSchema:new B(new Y)},{key:"nonpart",valueSchema:new B(new _t)},{key:"caid",valueSchema:new B(new Y)},{key:"apar",valueSchema:new B(new Se(Rt([{key:"t",valueSchema:new Y},{key:"dc",valueSchema:new Y},{key:"df",valueSchema:new _t},{key:"m",valueSchema:new B(new pn)},{key:"r",valueSchema:new B(new pn)},{key:"f",valueSchema:new B(new pn)},{key:"c",valueSchema:new B(new pn)},{key:"un",valueSchema:new B(new Le)},{key:"an",valueSchema:new B(new Le)},{key:"au",valueSchema:new B(new Le)},{key:"am",valueSchema:new B(new xn(32))}])))},{key:"xaid",valueSchema:new B(new Y)},{key:"aamt",valueSchema:new B(new Y)},{key:"arcv",valueSchema:new B(new pn)},{key:"aclose",valueSchema:new B(new pn)},{key:"asnd",valueSchema:new B(new pn)},{key:"faid",valueSchema:new B(new Y)},{key:"afrz",valueSchema:new B(new _t)},{key:"fadd",valueSchema:new B(new pn)},{key:"apid",valueSchema:new B(new Y)},{key:"apan",valueSchema:new B(new Y)},{key:"apaa",valueSchema:new B(new He(new Je))},{key:"apat",valueSchema:new B(new He(new pn))},{key:"apas",valueSchema:new B(new He(new Y))},{key:"apfa",valueSchema:new B(new He(new Y))},{key:"apbx",valueSchema:new B(new He(new Se(Rt([{key:"i",valueSchema:new Y},{key:"n",valueSchema:new Je}]))))},{key:"al",valueSchema:new B(new He(new Se(Rt([{key:"d",valueSchema:new B(new pn)},{key:"s",valueSchema:new B(new Y)},{key:"p",valueSchema:new B(new Y)},{key:"h",valueSchema:new B(new Se(Rt([{key:"d",valueSchema:new Y},{key:"s",valueSchema:new Y}])))},{key:"l",valueSchema:new B(new Se(Rt([{key:"d",valueSchema:new Y},{key:"p",valueSchema:new Y}])))},{key:"b",valueSchema:new B(new Se(Rt([{key:"i",valueSchema:new Y},{key:"n",valueSchema:new Je}])))}]))))},{key:"apap",valueSchema:new B(new Je)},{key:"apsu",valueSchema:new B(new Je)},{key:"apls",valueSchema:new B(new Se(Rt([{key:"nui",valueSchema:new Y},{key:"nbs",valueSchema:new Y}])))},{key:"apgs",valueSchema:new B(new Se(Rt([{key:"nui",valueSchema:new Y},{key:"nbs",valueSchema:new Y}])))},{key:"apep",valueSchema:new B(new Y)},{key:"aprv",valueSchema:new B(new Y)},{key:"sptype",valueSchema:new B(new Y)},{key:"sp",valueSchema:new B(Pg.encodingSchema)},{key:"spmsg",valueSchema:new B($g.encodingSchema)},{key:"hb",valueSchema:new B(zo.encodingSchema)}]));function O8(n){return Yr(n)}function N8(n){return Tn(n,Xr)}const gl=new Uint8Array([77,117,108,116,105,115,105,103,65,100,100,114]),L8="invalid multisig version",U8="bad multisig threshold",j8="bad multisig public key - wrong length",_8="nacl public key length is not 32 bytes";function Gu(n){return n.map(e=>typeof e=="string"?Pt.fromString(e).publicKey:e.publicKey)}function io({version:n,threshold:e,pks:t}){if(n!==1||n>255||n<0)throw new Error(L8);if(e===0||t.length===0||e>t.length||e>255)throw new Error(U8);const r=vs-Ml;if(r!==C2)throw new Error(_8);const i=new Uint8Array(gl.length+2+r*t.length);i.set(gl,0),i.set([n],gl.length),i.set([e],gl.length+1);for(let o=0;o<t.length;o++){if(t[o].length!==r)throw new Error(j8);i.set(t[o],gl.length+2+o*r)}return new Pt(Uint8Array.from(ro(i)))}function z8({version:n,threshold:e,addrs:t}){const r=Gu(t);return io({version:n,threshold:e,pks:r})}function Tv(n,e,t){const r=e.v,i=e.thr,o=e.subsig,s=o.map(d=>d.pk);if(e.subsig.length<i)return!1;let a;try{a=io({version:r,threshold:i,pks:s}).publicKey}catch{return!1}if(!Mi(a,t))return!1;let l=0;for(const d of o)d.s!==void 0&&(l+=1);if(l<i)return!1;let c=0;for(const d of o)d.s!==void 0&&Tg(n,d.s,d.pk)&&(c+=1);return!(c<i)}function q8({version:n,threshold:e,addrs:t}){return z8({version:n,threshold:e,addrs:t})}const X2=new Se(Rt([{key:"pk",valueSchema:new xn(32)},{key:"s",valueSchema:new B(new xn(64))}]));function Q2(n){if(!(n instanceof Map))throw new Error(`Invalid decoded EncodedSubsig: ${n}`);const e={pk:n.get("pk")};return n.get("s")&&(e.s=n.get("s")),e}function Z2(n){const e=new Map([["pk",n.pk]]);return n.s&&e.set("s",n.s),e}const hf=new Se(Rt([{key:"v",valueSchema:new Y},{key:"thr",valueSchema:new Y},{key:"subsig",valueSchema:new He(X2)}]));function df(n){if(!(n instanceof Map))throw new Error(`Invalid decoded EncodedMultiSig: ${n}`);return{v:Xn(n.get("v")),thr:Xn(n.get("thr")),subsig:n.get("subsig").map(Q2)}}function ff(n){return new Map([["v",n.v],["thr",n.thr],["subsig",n.subsig.map(Z2)]])}const H8=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;function pb(n){if(!n||n.length===0)throw new Error("empty program");const e=10,t=32,r=126,i=s=>t<=s&&s<=r;if(n.every(s=>s===e||i(s))){const s=new TextDecoder().decode(n);throw B2(s)?new Error("requesting program bytes, get Algorand address"):H8.test(s)?new Error("program should not be b64 encoded"):new Error("program bytes are all ASCII printable characters, not looking like Teal byte code")}}const Np=new TextEncoder().encode("Program"),mb=new TextEncoder().encode("MsigProgram");class Cr{constructor(e,t){if(t&&(!Array.isArray(t)||!t.every(i=>i.constructor===Uint8Array)))throw new TypeError("Invalid arguments");let r=[];t!=null&&(r=t.map(i=>new Uint8Array(i))),pb(e),this.logic=e,this.args=r,this.sig=void 0,this.msig=void 0,this.lmsig=void 0}getEncodingSchema(){return Cr.encodingSchema}toEncodingData(){const e=new Map([["l",this.logic],["arg",this.args],["sig",this.sig]]);return this.msig&&e.set("msig",ff(this.msig)),this.lmsig&&e.set("lmsig",ff(this.lmsig)),e}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded logic sig: ${e}`);const t=new Cr(e.get("l"),e.get("arg"));return t.sig=e.get("sig"),e.get("msig")&&(t.msig=df(e.get("msig"))),e.get("lmsig")&&(t.lmsig=df(e.get("lmsig"))),t}verify(e){if([this.sig,this.msig,this.lmsig].filter(Boolean).length>1)return!1;try{pb(this.logic)}catch{return!1}const r=jn(Np,this.logic);if(!this.sig&&!this.msig&&!this.lmsig){const i=ro(r);return Mi(i,e)}if(this.sig)return Tg(r,this.sig,e);if(this.lmsig){const i=io({version:this.lmsig.v,threshold:this.lmsig.thr,pks:this.lmsig.subsig.map(s=>s.pk)}),o=jn(mb,i.publicKey,this.logic);return Tv(o,this.lmsig,e)}return this.msig?Tv(r,this.msig,e):!1}address(){const e=jn(Np,this.logic),t=ro(e);return new Pt(Uint8Array.from(t))}sign(e,t){if(t==null)this.sig=this.signProgram(e);else{const r=Gu(t.addrs).map(s=>({pk:s}));this.lmsig={v:t.version,thr:t.threshold,subsig:r};const[i,o]=this.singleSignMultisig(e,this.lmsig);this.lmsig.subsig[o].s=i}}appendToMultisig(e){if(this.lmsig===void 0)throw new Error("no multisig present");const[t,r]=this.singleSignMultisig(e,this.lmsig);this.lmsig.subsig[r].s=t}signProgram(e){const t=jn(Np,this.logic);return ih(t,e)}signProgramMultisig(e,t){const r=io({version:t.v,threshold:t.thr,pks:t.subsig.map(s=>s.pk)}),i=jn(mb,r.publicKey,this.logic);return ih(i,e)}singleSignMultisig(e,t){let r=-1;const i=Fg(e).publicKey;for(let s=0;s<t.subsig.length;s++){const{pk:a}=t.subsig[s];if(Mi(a,i)){r=s;break}}if(r===-1)throw new Error("invalid secret key");return[this.signProgramMultisig(e,t),r]}toByte(){return Yr(this)}static fromByte(e){return Tn(e,Cr)}}Cr.encodingSchema=new Se(Rt([{key:"l",valueSchema:new Je},{key:"arg",valueSchema:new He(new Je)},{key:"sig",valueSchema:new B(new xn(64))},{key:"msig",valueSchema:new B(hf)},{key:"lmsig",valueSchema:new B(hf)}]));class qs{constructor(e,t){this.lsig=new Cr(e,t),this.sigkey=void 0}getEncodingSchema(){return qs.encodingSchema}toEncodingData(){return new Map([["lsig",this.lsig.toEncodingData()],["sigkey",this.sigkey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded logic sig account: ${e}`);const t=e,r=Cr.fromEncodingData(t.get("lsig")),i=new qs(r.logic,r.args);return i.lsig=r,i.sigkey=t.get("sigkey"),i}toByte(){return Yr(this)}static fromByte(e){return Tn(e,qs)}isDelegated(){return!!(this.lsig.sig||this.lsig.msig||this.lsig.lmsig)}verify(){const e=this.address();return this.lsig.verify(e.publicKey)}address(){if([this.lsig.sig,this.lsig.msig,this.lsig.lmsig].filter(Boolean).length>1)throw new Error("LogicSig has too many signatures. At most one of sig, msig, or lmsig may be present");if(this.lsig.sig){if(!this.sigkey)throw new Error("Signing key for delegated account is missing");return new Pt(this.sigkey)}const t=this.lsig.lmsig||this.lsig.msig;if(t){const r={version:t.v,threshold:t.thr,pks:t.subsig.map(i=>i.pk)};return io(r)}return this.lsig.address()}signMultisig(e,t){this.lsig.sign(t,e)}appendToMultisig(e){this.lsig.appendToMultisig(e)}sign(e){this.lsig.sign(e),this.sigkey=Fg(e).publicKey}}qs.encodingSchema=new Se(Rt([{key:"lsig",valueSchema:Cr.encodingSchema},{key:"sigkey",valueSchema:new B(new xn(32))}]));function G8(n){return Tn(n,Cr)}const eF=new TextEncoder().encode("ProgData");function tF(n,e,t){const r=typeof t=="string"?Pt.fromString(t):t,i=jn(r.publicKey,e),o=jn(eF,i);return ih(o,n)}function K8(n,e,t,r){const i=typeof e=="string"?Pt.fromString(e):e,o=jn(i.publicKey,n),s=jn(eF,o);return Tg(s,t,r)}function W8(n,e,t){const i=new Cr(t).address();return tF(n,e,i)}class Sn{constructor({txn:e,sig:t,msig:r,lsig:i,sgnr:o}){this.txn=e,this.sig=t,this.msig=r,this.lsig=i,this.sgnr=o;let s=0;if(t&&(s+=1),r&&(s+=1),i&&(s+=1),s>1)throw new Error(`SignedTransaction must not have more than 1 signature. Got ${s}`)}getEncodingSchema(){return Sn.encodingSchema}toEncodingData(){return new Map([["txn",this.txn.toEncodingData()],["sig",this.sig],["msig",this.msig?ff(this.msig):void 0],["lsig",this.lsig?this.lsig.toEncodingData():void 0],["sgnr",this.sgnr]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SignedTransaction: ${e}`);return new Sn({txn:Xr.fromEncodingData(e.get("txn")),sig:e.get("sig"),msig:e.get("msig")?df(e.get("msig")):void 0,lsig:e.get("lsig")?Cr.fromEncodingData(e.get("lsig")):void 0,sgnr:e.get("sgnr")})}}Sn.encodingSchema=new Se(Rt([{key:"txn",valueSchema:Xr.encodingSchema},{key:"sig",valueSchema:new B(new xn(64))},{key:"msig",valueSchema:new B(hf)},{key:"lsig",valueSchema:new B(Cr.encodingSchema)},{key:"sgnr",valueSchema:new B(new pn)}]));function J8(n){return Tn(n,Sn)}function nF(n){const e=new Sn({txn:n});return Yr(e)}class ga{constructor(e){this.stateProofVotersCommitment=e.stateProofVotersCommitment,this.stateProofOnlineTotalWeight=e.stateProofOnlineTotalWeight,this.stateProofNextRound=e.stateProofNextRound}getEncodingSchema(){return ga.encodingSchema}toEncodingData(){return new Map([["v",this.stateProofVotersCommitment],["t",this.stateProofOnlineTotalWeight],["n",this.stateProofNextRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofTrackingData: ${e}`);return new ga({stateProofVotersCommitment:e.get("v"),stateProofOnlineTotalWeight:e.get("t"),stateProofNextRound:e.get("n")})}}ga.encodingSchema=new Se(Rt([{key:"v",valueSchema:new Je},{key:"t",valueSchema:new Y},{key:"n",valueSchema:new Y}]));class pa{constructor(e){this.nativeSha512_256Commitment=e.nativeSha512_256Commitment,this.sha256Commitment=e.sha256Commitment}getEncodingSchema(){return pa.encodingSchema}toEncodingData(){return new Map([["txn",this.nativeSha512_256Commitment],["txn256",this.sha256Commitment]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TxnCommitments: ${e}`);return new pa({nativeSha512_256Commitment:e.get("txn"),sha256Commitment:e.get("txn256")})}}pa.encodingSchema=new Se(Rt([{key:"txn",valueSchema:new xn(32)},{key:"txn256",valueSchema:new xn(32)}]));class ma{constructor(e){this.feeSink=e.feeSink,this.rewardsPool=e.rewardsPool,this.rewardsLevel=e.rewardsLevel,this.rewardsRate=e.rewardsRate,this.rewardsResidue=e.rewardsResidue,this.rewardsRecalculationRound=e.rewardsRecalculationRound}getEncodingSchema(){return ma.encodingSchema}toEncodingData(){return new Map([["fees",this.feeSink],["rwd",this.rewardsPool],["earn",this.rewardsLevel],["rate",this.rewardsRate],["frac",this.rewardsResidue],["rwcalr",this.rewardsRecalculationRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded RewardState: ${e}`);return new ma({feeSink:e.get("fees"),rewardsPool:e.get("rwd"),rewardsLevel:e.get("earn"),rewardsRate:e.get("rate"),rewardsResidue:e.get("frac"),rewardsRecalculationRound:e.get("rwcalr")})}}ma.encodingSchema=new Se(Rt([{key:"fees",valueSchema:new pn},{key:"rwd",valueSchema:new pn},{key:"earn",valueSchema:new Y},{key:"rate",valueSchema:new Y},{key:"frac",valueSchema:new Y},{key:"rwcalr",valueSchema:new Y}]));class ya{constructor(e){this.currentProtocol=e.currentProtocol,this.nextProtocol=e.nextProtocol,this.nextProtocolApprovals=e.nextProtocolApprovals,this.nextProtocolVoteBefore=e.nextProtocolVoteBefore,this.nextProtocolSwitchOn=e.nextProtocolSwitchOn}getEncodingSchema(){return ya.encodingSchema}toEncodingData(){return new Map([["proto",this.currentProtocol],["nextproto",this.nextProtocol],["nextyes",this.nextProtocolApprovals],["nextbefore",this.nextProtocolVoteBefore],["nextswitch",this.nextProtocolSwitchOn]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded UpgradeState: ${e}`);return new ya({currentProtocol:e.get("proto"),nextProtocol:e.get("nextproto"),nextProtocolApprovals:e.get("nextyes"),nextProtocolVoteBefore:e.get("nextbefore"),nextProtocolSwitchOn:e.get("nextswitch")})}}ya.encodingSchema=new Se(Rt([{key:"proto",valueSchema:new Le},{key:"nextproto",valueSchema:new Le},{key:"nextyes",valueSchema:new Y},{key:"nextbefore",valueSchema:new Y},{key:"nextswitch",valueSchema:new Y}]));class wa{constructor(e){this.upgradePropose=e.upgradePropose,this.upgradeDelay=e.upgradeDelay,this.upgradeApprove=e.upgradeApprove}getEncodingSchema(){return wa.encodingSchema}toEncodingData(){return new Map([["upgradeprop",this.upgradePropose],["upgradedelay",this.upgradeDelay],["upgradeyes",this.upgradeApprove]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded UpgradeVote: ${e}`);return new wa({upgradePropose:e.get("upgradeprop"),upgradeDelay:e.get("upgradedelay"),upgradeApprove:e.get("upgradeyes")})}}wa.encodingSchema=new Se(Rt([{key:"upgradeprop",valueSchema:new Le},{key:"upgradedelay",valueSchema:new Y},{key:"upgradeyes",valueSchema:new _t}]));let Bg=class Iv{constructor(e){this.expiredParticipationAccounts=e.expiredParticipationAccounts,this.absentParticipationAccounts=e.absentParticipationAccounts}getEncodingSchema(){return Iv.encodingSchema}toEncodingData(){return new Map([["partupdrmv",this.expiredParticipationAccounts],["partupdabs",this.absentParticipationAccounts]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ParticipationUpdates: ${e}`);return new Iv({expiredParticipationAccounts:e.get("partupdrmv"),absentParticipationAccounts:e.get("partupdabs")})}};Bg.encodingSchema=new Se(Rt([{key:"partupdrmv",valueSchema:new He(new pn)},{key:"partupdabs",valueSchema:new He(new pn)}]));class oo{constructor(e){this.round=e.round,this.branch=e.branch,this.seed=e.seed,this.txnCommitments=e.txnCommitments,this.timestamp=e.timestamp,this.genesisID=e.genesisID,this.genesisHash=e.genesisHash,this.proposer=e.proposer,this.feesCollected=e.feesCollected,this.bonus=e.bonus,this.proposerPayout=e.proposerPayout,this.rewardState=e.rewardState,this.upgradeState=e.upgradeState,this.upgradeVote=e.upgradeVote,this.txnCounter=e.txnCounter,this.stateproofTracking=e.stateproofTracking,this.participationUpdates=e.participationUpdates}getEncodingSchema(){return oo.encodingSchema}toEncodingData(){const e=new Map([["rnd",this.round],["prev",this.branch],["seed",this.seed],["ts",this.timestamp],["gen",this.genesisID],["gh",this.genesisHash],["prp",this.proposer],["fc",this.feesCollected],["bi",this.bonus],["pp",this.proposerPayout],["tc",this.txnCounter],["spt",Ln(this.stateproofTracking,(t,r)=>[t,r.toEncodingData()])]]);return Hu(e,this.txnCommitments.toEncodingData(),this.rewardState.toEncodingData(),this.upgradeState.toEncodingData(),this.upgradeVote.toEncodingData(),this.participationUpdates.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockHeader: ${e}`);return new oo({round:e.get("rnd"),branch:e.get("prev"),seed:e.get("seed"),txnCommitments:pa.fromEncodingData(e),timestamp:e.get("ts"),genesisID:e.get("gen"),genesisHash:e.get("gh"),proposer:e.get("prp"),feesCollected:e.get("fc"),bonus:e.get("bi"),proposerPayout:e.get("pp"),rewardState:ma.fromEncodingData(e),upgradeState:ya.fromEncodingData(e),upgradeVote:wa.fromEncodingData(e),txnCounter:e.get("tc"),stateproofTracking:Ln(e.get("spt"),(t,r)=>[Number(t),ga.fromEncodingData(r)]),participationUpdates:Bg.fromEncodingData(e)})}}oo.encodingSchema=new Se(Rt([{key:"rnd",valueSchema:new Y},{key:"prev",valueSchema:new S8},{key:"seed",valueSchema:new Je},{key:"",valueSchema:pa.encodingSchema,embedded:!0},{key:"ts",valueSchema:new Y},{key:"gen",valueSchema:new Le},{key:"gh",valueSchema:new xn(32)},{key:"prp",valueSchema:new pn},{key:"fc",valueSchema:new Y},{key:"bi",valueSchema:new Y},{key:"pp",valueSchema:new Y},{key:"",valueSchema:ma.encodingSchema,embedded:!0},{key:"",valueSchema:ya.encodingSchema,embedded:!0},{key:"",valueSchema:wa.encodingSchema,embedded:!0},{key:"tc",valueSchema:new Y},{key:"spt",valueSchema:new Rg(ga.encodingSchema)},{key:"",valueSchema:Bg.encodingSchema,embedded:!0}]));class Ki{constructor(e){this.action=e.action,this.bytes=e.bytes,this.uint=e.uint}getEncodingSchema(){return Ki.encodingSchema}toEncodingData(){return new Map([["at",this.action],["bs",this.bytes],["ui",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ValueDelta: ${e}`);return new Ki({action:Number(e.get("at")),bytes:e.get("bs"),uint:e.get("ui")})}}Ki.encodingSchema=new Se(Rt([{key:"at",valueSchema:new Y},{key:"bs",valueSchema:new hc},{key:"ui",valueSchema:new Y}]));let Mv=class Rv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries(...Rt([{key:"gd",valueSchema:new B(new sh(Ki.encodingSchema))},{key:"ld",valueSchema:new B(new Rg(new sh(Ki.encodingSchema)))},{key:"sa",valueSchema:new B(new He(new pn))},{key:"lg",valueSchema:new B(new He(new hc))},{key:"itx",valueSchema:new B(new He(Ko.encodingSchema))}]))),this.encodingSchemaValue}constructor(e){this.globalDelta=e.globalDelta??new Map,this.localDeltas=e.localDeltas??new Map,this.sharedAccts=e.sharedAccts??[],this.logs=e.logs??[],this.innerTxns=e.innerTxns??[]}getEncodingSchema(){return Rv.encodingSchema}toEncodingData(){return new Map([["gd",Ln(this.globalDelta,(e,t)=>[e,t.toEncodingData()])],["ld",Ln(this.localDeltas,(e,t)=>[e,Ln(t,(r,i)=>[r,i.toEncodingData()])])],["sa",this.sharedAccts],["lg",this.logs],["itx",this.innerTxns.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded EvalDelta: ${e}`);return new Rv({globalDelta:e.get("gd")?Ln(e.get("gd"),(t,r)=>[t,Ki.fromEncodingData(r)]):void 0,localDeltas:e.get("ld")?Ln(e.get("ld"),(t,r)=>[Number(t),Ln(r,(i,o)=>[i,Ki.fromEncodingData(o)])]):void 0,sharedAccts:e.get("sa"),logs:e.get("lg"),innerTxns:(e.get("itx")??[]).map(Ko.fromEncodingData)})}};class Cc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries(...Rt([{key:"ca",valueSchema:new B(new Y)},{key:"aca",valueSchema:new B(new Y)},{key:"rs",valueSchema:new B(new Y)},{key:"rr",valueSchema:new B(new Y)},{key:"rc",valueSchema:new B(new Y)},{key:"dt",valueSchema:new B(Mv.encodingSchema)},{key:"caid",valueSchema:new B(new Y)},{key:"apid",valueSchema:new B(new Y)}]))),this.encodingSchemaValue}constructor(e){this.closingAmount=e.closingAmount,this.assetClosingAmount=e.assetClosingAmount,this.senderRewards=e.senderRewards,this.receiverRewards=e.receiverRewards,this.closeRewards=e.closeRewards,this.evalDelta=e.evalDelta,this.configAsset=e.configAsset,this.applicationID=e.applicationID}getEncodingSchema(){return Cc.encodingSchema}toEncodingData(){return new Map([["ca",this.closingAmount],["aca",this.assetClosingAmount],["rs",this.senderRewards],["rr",this.receiverRewards],["rc",this.closeRewards],["dt",this.evalDelta?this.evalDelta.toEncodingData():void 0],["caid",this.configAsset],["apid",this.applicationID]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplyData: ${e}`);return new Cc({closingAmount:e.get("ca"),assetClosingAmount:e.get("aca"),senderRewards:e.get("rs"),receiverRewards:e.get("rr"),closeRewards:e.get("rc"),evalDelta:e.get("dt")?Mv.fromEncodingData(e.get("dt")):void 0,configAsset:e.get("caid"),applicationID:e.get("apid")})}}class Ko{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries(...Rt([{key:"",valueSchema:Sn.encodingSchema,embedded:!0},{key:"",valueSchema:Cc.encodingSchema,embedded:!0}]))),this.encodingSchemaValue}constructor(e){this.signedTxn=e.signedTxn,this.applyData=e.applyData}getEncodingSchema(){return Ko.encodingSchema}toEncodingData(){return Hu(this.signedTxn.toEncodingData(),this.applyData.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SignedTxnWithAD: ${e}`);return new Ko({signedTxn:Sn.fromEncodingData(e),applyData:Cc.fromEncodingData(e)})}}class Sa{constructor(e){this.signedTxn=e.signedTxn,this.hasGenesisID=e.hasGenesisID,this.hasGenesisHash=e.hasGenesisHash}getEncodingSchema(){return Sa.encodingSchema}toEncodingData(){const e=new Map([["hgi",this.hasGenesisID],["hgh",this.hasGenesisHash]]);return Hu(e,this.signedTxn.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SignedTxnInBlock: ${e}`);return new Sa({signedTxn:Ko.fromEncodingData(e),hasGenesisID:e.get("hgi"),hasGenesisHash:e.get("hgh")})}}Sa.encodingSchema=new Se(Rt([{key:"",valueSchema:Ko.encodingSchema,embedded:!0},{key:"hgi",valueSchema:new _t},{key:"hgh",valueSchema:new _t}]));let gf=class Cv{constructor(e){this.header=e.header,this.payset=e.payset}getEncodingSchema(){return Cv.encodingSchema}toEncodingData(){const e=new Map([["txns",this.payset.map(t=>t.toEncodingData())]]);return Hu(e,this.header.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockHeader: ${e}`);return new Cv({header:oo.fromEncodingData(e),payset:e.get("txns").map(Sa.fromEncodingData)})}};gf.encodingSchema=new Se(Rt([{key:"",valueSchema:oo.encodingSchema,embedded:!0},{key:"txns",valueSchema:new He(Sa.encodingSchema)}]));class Jn{constructor(e){this.data=e}getEncodingSchema(){return Jn.encodingSchema}toEncodingData(){return this.data}static fromEncodingData(e){return new Jn(e)}}Jn.encodingSchema=new G2;let Ku=class Pv{constructor(e){this.type=e.type,this.bytes=e.bytes,this.uint=e.uint}getEncodingSchema(){return Pv.encodingSchema}toEncodingData(){return new Map([["tt",this.type],["tb",this.bytes],["ui",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TealValue: ${e}`);return new Pv({type:Number(e.get("tt")),bytes:e.get("tb"),uint:e.get("ui")})}};Ku.encodingSchema=new Se(Rt([{key:"tt",valueSchema:new Y},{key:"tb",valueSchema:new B(new hc)},{key:"ui",valueSchema:new B(new Y)}]));let Ci=class $v{constructor(e){this.numUints=e.numUints,this.numByteSlices=e.numByteSlices}getEncodingSchema(){return $v.encodingSchema}toEncodingData(){return new Map([["nui",this.numUints],["nbs",this.numByteSlices]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateSchema: ${e}`);return new $v({numUints:Number(e.get("nui")),numByteSlices:Number(e.get("nbs"))})}};Ci.encodingSchema=new Se(Rt([{key:"nui",valueSchema:new Y},{key:"nbs",valueSchema:new Y}]));class va{constructor(e){this.approvalProgram=e.approvalProgram,this.clearStateProgram=e.clearStateProgram,this.globalState=e.globalState,this.localStateSchema=e.localStateSchema,this.globalStateSchema=e.globalStateSchema,this.extraProgramPages=e.extraProgramPages}getEncodingSchema(){return va.encodingSchema}toEncodingData(){return new Map([["approv",this.approvalProgram],["clearp",this.clearStateProgram],["gs",Ln(this.globalState,(e,t)=>[e,t.toEncodingData()])],["lsch",this.localStateSchema.toEncodingData()],["gsch",this.globalStateSchema.toEncodingData()],["epp",this.extraProgramPages]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppParams: ${e}`);return new va({approvalProgram:e.get("approv"),clearStateProgram:e.get("clearp"),globalState:Ln(e.get("gs"),(t,r)=>[t,Ku.fromEncodingData(r)]),localStateSchema:Ci.fromEncodingData(e.get("lsch")),globalStateSchema:Ci.fromEncodingData(e.get("gsch")),extraProgramPages:Number(e.get("epp"))})}}va.encodingSchema=new Se(Rt([{key:"approv",valueSchema:new Je},{key:"clearp",valueSchema:new Je},{key:"gs",valueSchema:new sh(Ku.encodingSchema)},{key:"lsch",valueSchema:Ci.encodingSchema},{key:"gsch",valueSchema:Ci.encodingSchema},{key:"epp",valueSchema:new Y}]));class xa{constructor(e){this.schema=e.schema,this.keyValue=e.keyValue}getEncodingSchema(){return xa.encodingSchema}toEncodingData(){return new Map([["hsch",this.schema.toEncodingData()],["tkv",Ln(this.keyValue,(e,t)=>[e,t.toEncodingData()])]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppLocalState: ${e}`);return new xa({schema:Ci.fromEncodingData(e.get("hsch")),keyValue:Ln(e.get("tkv"),(t,r)=>[t,Ku.fromEncodingData(r)])})}}xa.encodingSchema=new Se(Rt([{key:"hsch",valueSchema:Ci.encodingSchema},{key:"tkv",valueSchema:new sh(Ku.encodingSchema)}]));class Ea{constructor(e){this.localState=e.localState,this.deleted=e.deleted}getEncodingSchema(){return Ea.encodingSchema}toEncodingData(){return new Map([["LocalState",this.localState?this.localState.toEncodingData():void 0],["Deleted",this.deleted]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppLocalStateDelta: ${e}`);return new Ea({localState:e.get("LocalState")?xa.fromEncodingData(e.get("LocalState")):void 0,deleted:e.get("Deleted")})}}Ea.encodingSchema=new Se(Rt([{key:"LocalState",valueSchema:new B(xa.encodingSchema)},{key:"Deleted",valueSchema:new _t}]));class ba{constructor(e){this.params=e.params,this.deleted=e.deleted}getEncodingSchema(){return ba.encodingSchema}toEncodingData(){return new Map([["Params",this.params?this.params.toEncodingData():void 0],["Deleted",this.deleted]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppParamsDelta: ${e}`);return new ba({params:e.get("Params")?va.fromEncodingData(e.get("Params")):void 0,deleted:e.get("Deleted")})}}ba.encodingSchema=new Se(Rt([{key:"Params",valueSchema:new B(va.encodingSchema)},{key:"Deleted",valueSchema:new _t}]));class ka{constructor(e){this.id=e.id,this.address=e.address,this.params=e.params,this.state=e.state}getEncodingSchema(){return ka.encodingSchema}toEncodingData(){return new Map([["Aidx",this.id],["Addr",this.address],["Params",this.params.toEncodingData()],["State",this.state.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppResourceRecord: ${e}`);return new ka({id:e.get("Aidx"),address:e.get("Addr"),params:ba.fromEncodingData(e.get("Params")),state:Ea.fromEncodingData(e.get("State"))})}}ka.encodingSchema=new Se(Rt([{key:"Aidx",valueSchema:new Y},{key:"Addr",valueSchema:new pn},{key:"Params",valueSchema:ba.encodingSchema},{key:"State",valueSchema:Ea.encodingSchema}]));let Vg=class Bv{constructor(e){this.amount=e.amount,this.frozen=e.frozen}getEncodingSchema(){return Bv.encodingSchema}toEncodingData(){return new Map([["a",this.amount],["f",this.frozen]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHolding: ${e}`);return new Bv({amount:e.get("a"),frozen:e.get("f")})}};Vg.encodingSchema=new Se(Rt([{key:"a",valueSchema:new Y},{key:"f",valueSchema:new _t}]));class Aa{constructor(e){this.holding=e.holding,this.deleted=e.deleted}getEncodingSchema(){return Aa.encodingSchema}toEncodingData(){return new Map([["Holding",this.holding?this.holding.toEncodingData():void 0],["Deleted",this.deleted]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHoldingDelta: ${e}`);return new Aa({holding:e.get("Holding")?Vg.fromEncodingData(e.get("Holding")):void 0,deleted:e.get("Deleted")})}}Aa.encodingSchema=new Se(Rt([{key:"Holding",valueSchema:new B(Vg.encodingSchema)},{key:"Deleted",valueSchema:new _t}]));let Og=class Vv{constructor(e){this.total=e.total,this.decimals=e.decimals,this.defaultFrozen=e.defaultFrozen,this.unitName=e.unitName,this.assetName=e.assetName,this.url=e.url,this.metadataHash=e.metadataHash,this.manager=e.manager,this.reserve=e.reserve,this.freeze=e.freeze,this.clawback=e.clawback}getEncodingSchema(){return Vv.encodingSchema}toEncodingData(){return new Map([["t",this.total],["dc",this.decimals],["df",this.defaultFrozen],["un",this.unitName],["an",this.assetName],["au",this.url],["am",this.metadataHash],["m",this.manager],["r",this.reserve],["f",this.freeze],["c",this.clawback]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetParams: ${e}`);return new Vv({total:e.get("t"),decimals:e.get("dc"),defaultFrozen:e.get("df"),unitName:e.get("un"),assetName:e.get("an"),url:e.get("au"),metadataHash:e.get("am"),manager:e.get("m"),reserve:e.get("r"),freeze:e.get("f"),clawback:e.get("c")})}};Og.encodingSchema=new Se(Rt([{key:"t",valueSchema:new Y},{key:"dc",valueSchema:new Y},{key:"df",valueSchema:new _t},{key:"un",valueSchema:new B(new hc)},{key:"an",valueSchema:new B(new hc)},{key:"au",valueSchema:new B(new hc)},{key:"am",valueSchema:new xn(32)},{key:"m",valueSchema:new B(new pn)},{key:"r",valueSchema:new B(new pn)},{key:"f",valueSchema:new B(new pn)},{key:"c",valueSchema:new B(new pn)}]));class Da{constructor(e){this.params=e.params,this.deleted=e.deleted}getEncodingSchema(){return Da.encodingSchema}toEncodingData(){return new Map([["Params",this.params?this.params.toEncodingData():void 0],["Deleted",this.deleted]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetParamsDelta: ${e}`);return new Da({params:e.get("Params")?Og.fromEncodingData(e.get("Params")):void 0,deleted:e.get("Deleted")})}}Da.encodingSchema=new Se(Rt([{key:"Params",valueSchema:new B(Og.encodingSchema)},{key:"Deleted",valueSchema:new _t}]));class Fa{constructor(e){this.id=e.id,this.address=e.address,this.params=e.params,this.holding=e.holding}getEncodingSchema(){return Fa.encodingSchema}toEncodingData(){return new Map([["Aidx",this.id],["Addr",this.address],["Params",this.params.toEncodingData()],["Holding",this.holding.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetResourceRecord: ${e}`);return new Fa({id:e.get("Aidx"),address:e.get("Addr"),params:Da.fromEncodingData(e.get("Params")),holding:Aa.fromEncodingData(e.get("Holding"))})}}Fa.encodingSchema=new Se(Rt([{key:"Aidx",valueSchema:new Y},{key:"Addr",valueSchema:new pn},{key:"Params",valueSchema:Da.encodingSchema},{key:"Holding",valueSchema:Aa.encodingSchema}]));class Ta{constructor(e){this.voteID=e.voteID,this.selectionID=e.selectionID,this.stateProofID=e.stateProofID,this.voteFirstValid=e.voteFirstValid,this.voteLastValid=e.voteLastValid,this.voteKeyDilution=e.voteKeyDilution}getEncodingSchema(){return Ta.encodingSchema}toEncodingData(){return new Map([["VoteID",this.voteID],["SelectionID",this.selectionID],["StateProofID",this.stateProofID],["VoteFirstValid",this.voteFirstValid],["VoteLastValid",this.voteLastValid],["VoteKeyDilution",this.voteKeyDilution]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded VotingData: ${e}`);return new Ta({voteID:e.get("VoteID"),selectionID:e.get("SelectionID"),stateProofID:e.get("StateProofID"),voteFirstValid:e.get("VoteFirstValid"),voteLastValid:e.get("VoteLastValid"),voteKeyDilution:e.get("VoteKeyDilution")})}}Ta.encodingSchema=new Se(Rt([{key:"VoteID",valueSchema:new xn(32)},{key:"SelectionID",valueSchema:new xn(32)},{key:"StateProofID",valueSchema:new xn(64)},{key:"VoteFirstValid",valueSchema:new Y},{key:"VoteLastValid",valueSchema:new Y},{key:"VoteKeyDilution",valueSchema:new Y}]));class Ia{constructor(e){this.status=e.status,this.microAlgos=e.microAlgos,this.rewardsBase=e.rewardsBase,this.rewardedMicroAlgos=e.rewardedMicroAlgos,this.authAddr=e.authAddr,this.incentiveEligible=e.incentiveEligible,this.totalAppSchema=e.totalAppSchema,this.totalExtraAppPages=e.totalExtraAppPages,this.totalAppParams=e.totalAppParams,this.totalAppLocalStates=e.totalAppLocalStates,this.totalAssetParams=e.totalAssetParams,this.totalAssets=e.totalAssets,this.totalBoxes=e.totalBoxes,this.totalBoxBytes=e.totalBoxBytes,this.lastProposed=e.lastProposed,this.lastHeartbeat=e.lastHeartbeat}getEncodingSchema(){return Ia.encodingSchema}toEncodingData(){return new Map([["Status",this.status],["MicroAlgos",this.microAlgos],["RewardsBase",this.rewardsBase],["RewardedMicroAlgos",this.rewardedMicroAlgos],["AuthAddr",this.authAddr],["IncentiveEligible",this.incentiveEligible],["TotalAppSchema",this.totalAppSchema.toEncodingData()],["TotalExtraAppPages",this.totalExtraAppPages],["TotalAppParams",this.totalAppParams],["TotalAppLocalStates",this.totalAppLocalStates],["TotalAssetParams",this.totalAssetParams],["TotalAssets",this.totalAssets],["TotalBoxes",this.totalBoxes],["TotalBoxBytes",this.totalBoxBytes],["LastProposed",this.lastProposed],["LastHeartbeat",this.lastHeartbeat]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountBaseData: ${e}`);return new Ia({status:Number(e.get("Status")),microAlgos:e.get("MicroAlgos"),rewardsBase:e.get("RewardsBase"),rewardedMicroAlgos:e.get("RewardedMicroAlgos"),authAddr:e.get("AuthAddr"),incentiveEligible:e.get("IncentiveEligible"),totalAppSchema:Ci.fromEncodingData(e.get("TotalAppSchema")),totalExtraAppPages:Number(e.get("TotalExtraAppPages")),totalAppParams:e.get("TotalAppParams"),totalAppLocalStates:e.get("TotalAppLocalStates"),totalAssetParams:e.get("TotalAssetParams"),totalAssets:e.get("TotalAssets"),totalBoxes:e.get("TotalBoxes"),totalBoxBytes:e.get("TotalBoxBytes"),lastProposed:e.get("LastProposed"),lastHeartbeat:e.get("LastHeartbeat")})}}Ia.encodingSchema=new Se(Rt([{key:"Status",valueSchema:new Y},{key:"MicroAlgos",valueSchema:new Y},{key:"RewardsBase",valueSchema:new Y},{key:"RewardedMicroAlgos",valueSchema:new Y},{key:"AuthAddr",valueSchema:new pn},{key:"IncentiveEligible",valueSchema:new _t},{key:"TotalAppSchema",valueSchema:Ci.encodingSchema},{key:"TotalExtraAppPages",valueSchema:new Y},{key:"TotalAppParams",valueSchema:new Y},{key:"TotalAppLocalStates",valueSchema:new Y},{key:"TotalAssetParams",valueSchema:new Y},{key:"TotalAssets",valueSchema:new Y},{key:"TotalBoxes",valueSchema:new Y},{key:"TotalBoxBytes",valueSchema:new Y},{key:"LastProposed",valueSchema:new Y},{key:"LastHeartbeat",valueSchema:new Y}]));class Ma{constructor(e){this.accountBaseData=e.accountBaseData,this.votingData=e.votingData}getEncodingSchema(){return Ma.encodingSchema}toEncodingData(){return Hu(this.accountBaseData.toEncodingData(),this.votingData.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountData: ${e}`);return new Ma({accountBaseData:Ia.fromEncodingData(e),votingData:Ta.fromEncodingData(e)})}}Ma.encodingSchema=new Se(Rt([{key:"",valueSchema:Ia.encodingSchema,embedded:!0},{key:"",valueSchema:Ta.encodingSchema,embedded:!0}]));class Ra{constructor(e){this.addr=e.addr,this.accountData=e.accountData}getEncodingSchema(){return Ra.encodingSchema}toEncodingData(){return Hu(new Map([["Addr",this.addr]]),this.accountData.toEncodingData())}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BalanceRecord: ${e}`);return new Ra({addr:e.get("Addr"),accountData:Ma.fromEncodingData(e)})}}Ra.encodingSchema=new Se(Rt([{key:"Addr",valueSchema:new pn},{key:"",valueSchema:Ma.encodingSchema,embedded:!0}]));class Ca{constructor(e){this.accounts=e.accounts,this.appResources=e.appResources,this.assetResources=e.assetResources}getEncodingSchema(){return Ca.encodingSchema}toEncodingData(){return new Map([["Accts",this.accounts.map(e=>e.toEncodingData())],["AppResources",this.appResources.length===0?void 0:this.appResources.map(e=>e.toEncodingData())],["AssetResources",this.assetResources.length===0?void 0:this.assetResources.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountDeltas: ${e}`);return new Ca({accounts:(e.get("Accts")??[]).map(Ra.fromEncodingData),appResources:(e.get("AppResources")??[]).map(ka.fromEncodingData),assetResources:(e.get("AssetResources")??[]).map(Fa.fromEncodingData)})}}Ca.encodingSchema=new Se(Rt([{key:"Accts",valueSchema:new He(Ra.encodingSchema)},{key:"AppResources",valueSchema:new B(new He(ka.encodingSchema))},{key:"AssetResources",valueSchema:new B(new He(Fa.encodingSchema))}]));class Pa{constructor(e){this.data=e.data,this.oldData=e.oldData}getEncodingSchema(){return Pa.encodingSchema}toEncodingData(){return new Map([["Data",this.data],["OldData",this.oldData]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded KvValueDelta: ${e}`);return new Pa({data:e.get("Data"),oldData:e.get("OldData")})}}Pa.encodingSchema=new Se(Rt([{key:"Data",valueSchema:new B(new Je)},{key:"OldData",valueSchema:new B(new Je)}]));class $a{constructor(e){this.lastValid=e.lastValid,this.intra=e.intra}getEncodingSchema(){return $a.encodingSchema}toEncodingData(){return new Map([["LastValid",this.lastValid],["Intra",this.intra]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded IncludedTransactions: ${e}`);return new $a({lastValid:e.get("LastValid"),intra:Number(e.get("Intra"))})}}$a.encodingSchema=new Se(Rt([{key:"LastValid",valueSchema:new Y},{key:"Intra",valueSchema:new Y}]));class Ba{constructor(e){this.creatableType=e.creatableType,this.created=e.created,this.creator=e.creator,this.ndeltas=e.ndeltas}getEncodingSchema(){return Ba.encodingSchema}toEncodingData(){return new Map([["Ctype",this.creatableType],["Created",this.created],["Creator",this.creator],["Ndeltas",this.ndeltas]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ModifiedCreatable: ${e}`);return new Ba({creatableType:Number(e.get("Ctype")),created:e.get("Created"),creator:e.get("Creator"),ndeltas:Number(e.get("Ndeltas"))})}}Ba.encodingSchema=new Se(Rt([{key:"Ctype",valueSchema:new Y},{key:"Created",valueSchema:new _t},{key:"Creator",valueSchema:new pn},{key:"Ndeltas",valueSchema:new Y}]));class ai{constructor(e){this.money=e.money,this.rewardUnits=e.rewardUnits}getEncodingSchema(){return ai.encodingSchema}toEncodingData(){return new Map([["mon",this.money],["rwd",this.rewardUnits]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AlgoCount: ${e}`);return new ai({money:e.get("mon"),rewardUnits:e.get("rwd")})}}ai.encodingSchema=new Se(Rt([{key:"mon",valueSchema:new Y},{key:"rwd",valueSchema:new Y}]));class Va{constructor(e){this.online=e.online,this.offline=e.offline,this.notParticipating=e.notParticipating,this.rewardsLevel=e.rewardsLevel}getEncodingSchema(){return Va.encodingSchema}toEncodingData(){return new Map([["online",this.online.toEncodingData()],["offline",this.offline.toEncodingData()],["notpart",this.notParticipating.toEncodingData()],["rwdlvl",this.rewardsLevel]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountTotals: ${e}`);return new Va({online:ai.fromEncodingData(e.get("online")),offline:ai.fromEncodingData(e.get("offline")),notParticipating:ai.fromEncodingData(e.get("notpart")),rewardsLevel:e.get("rwdlvl")})}}Va.encodingSchema=new Se(Rt([{key:"online",valueSchema:ai.encodingSchema},{key:"offline",valueSchema:ai.encodingSchema},{key:"notpart",valueSchema:ai.encodingSchema},{key:"rwdlvl",valueSchema:new Y}]));class so{constructor(e){this.accounts=e.accounts,this.kvMods=e.kvMods,this.txids=e.txids,this.txleases=e.txleases,this.creatables=e.creatables,this.blockHeader=e.blockHeader,this.stateProofNext=e.stateProofNext,this.prevTimestamp=e.prevTimestamp,this.totals=e.totals}getEncodingSchema(){return so.encodingSchema}toEncodingData(){return new Map([["Accts",this.accounts.toEncodingData()],["KvMods",this.kvMods.size===0?void 0:Ln(this.kvMods,(e,t)=>[e,t.toEncodingData()])],["Txids",Ln(this.txids,(e,t)=>[e,t.toEncodingData()])],["Txleases",this.txleases.toEncodingData()],["Creatables",this.creatables.size===0?void 0:Ln(this.creatables,(e,t)=>[e,t.toEncodingData()])],["Hdr",this.blockHeader.toEncodingData()],["StateProofNext",this.stateProofNext],["PrevTimestamp",this.prevTimestamp],["Totals",this.totals.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded LedgerStateDelta: ${e}`);return new so({accounts:Ca.fromEncodingData(e.get("Accts")),kvMods:Ln(e.get("KvMods")??new Map,(t,r)=>[t,Pa.fromEncodingData(r)]),txids:Ln(e.get("Txids"),(t,r)=>[t,$a.fromEncodingData(r)]),txleases:Jn.fromEncodingData(e.get("Txleases")),creatables:Ln(e.get("Creatables")??new Map,(t,r)=>[t,Ba.fromEncodingData(r)]),blockHeader:oo.fromEncodingData(e.get("Hdr")),stateProofNext:e.get("StateProofNext"),prevTimestamp:e.get("PrevTimestamp"),totals:Va.fromEncodingData(e.get("Totals"))})}}so.encodingSchema=new Se(Rt([{key:"Accts",valueSchema:Ca.encodingSchema},{key:"KvMods",valueSchema:new B(new sh(Pa.encodingSchema))},{key:"Txids",valueSchema:new v8($a.encodingSchema)},{key:"Txleases",valueSchema:new B(new G2)},{key:"Creatables",valueSchema:new B(new Rg(Ba.encodingSchema))},{key:"Hdr",valueSchema:oo.encodingSchema},{key:"StateProofNext",valueSchema:new Y},{key:"PrevTimestamp",valueSchema:new Y},{key:"Totals",valueSchema:Va.encodingSchema}]));let pf=class Ov{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Le,omitEmpty:!0},{key:"amount",valueSchema:new Y,omitEmpty:!0},{key:"amount-without-pending-rewards",valueSchema:new Y,omitEmpty:!0},{key:"min-balance",valueSchema:new Y,omitEmpty:!0},{key:"pending-rewards",valueSchema:new Y,omitEmpty:!0},{key:"rewards",valueSchema:new Y,omitEmpty:!0},{key:"round",valueSchema:new Y,omitEmpty:!0},{key:"status",valueSchema:new Le,omitEmpty:!0},{key:"total-apps-opted-in",valueSchema:new Y,omitEmpty:!0},{key:"total-assets-opted-in",valueSchema:new Y,omitEmpty:!0},{key:"total-created-apps",valueSchema:new Y,omitEmpty:!0},{key:"total-created-assets",valueSchema:new Y,omitEmpty:!0},{key:"apps-local-state",valueSchema:new B(new He(lh.encodingSchema)),omitEmpty:!0},{key:"apps-total-extra-pages",valueSchema:new B(new Y),omitEmpty:!0},{key:"apps-total-schema",valueSchema:new B(oi.encodingSchema),omitEmpty:!0},{key:"assets",valueSchema:new B(new He(Na.encodingSchema)),omitEmpty:!0},{key:"auth-addr",valueSchema:new B(new Le),omitEmpty:!0},{key:"created-apps",valueSchema:new B(new He(Oa.encodingSchema)),omitEmpty:!0},{key:"created-assets",valueSchema:new B(new He(yf.encodingSchema)),omitEmpty:!0},{key:"incentive-eligible",valueSchema:new B(new _t),omitEmpty:!0},{key:"last-heartbeat",valueSchema:new B(new Y),omitEmpty:!0},{key:"last-proposed",valueSchema:new B(new Y),omitEmpty:!0},{key:"participation",valueSchema:new B(Nv.encodingSchema),omitEmpty:!0},{key:"reward-base",valueSchema:new B(new Y),omitEmpty:!0},{key:"sig-type",valueSchema:new B(new Le),omitEmpty:!0},{key:"total-box-bytes",valueSchema:new B(new Y),omitEmpty:!0},{key:"total-boxes",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,amount:t,amountWithoutPendingRewards:r,minBalance:i,pendingRewards:o,rewards:s,round:a,status:l,totalAppsOptedIn:c,totalAssetsOptedIn:d,totalCreatedApps:f,totalCreatedAssets:m,appsLocalState:w,appsTotalExtraPages:k,appsTotalSchema:I,assets:x,authAddr:T,createdApps:b,createdAssets:R,incentiveEligible:L,lastHeartbeat:G,lastProposed:E,participation:N,rewardBase:p,sigType:F,totalBoxBytes:v,totalBoxes:O}){this.address=e,this.amount=Pe(t),this.amountWithoutPendingRewards=Pe(r),this.minBalance=Pe(i),this.pendingRewards=Pe(o),this.rewards=Pe(s),this.round=Pe(a),this.status=l,this.totalAppsOptedIn=Xe(c),this.totalAssetsOptedIn=Xe(d),this.totalCreatedApps=Xe(f),this.totalCreatedAssets=Xe(m),this.appsLocalState=w,this.appsTotalExtraPages=typeof k>"u"?void 0:Xe(k),this.appsTotalSchema=I,this.assets=x,this.authAddr=typeof T=="string"?Pt.fromString(T):T,this.createdApps=b,this.createdAssets=R,this.incentiveEligible=L,this.lastHeartbeat=typeof G>"u"?void 0:Xe(G),this.lastProposed=typeof E>"u"?void 0:Xe(E),this.participation=N,this.rewardBase=typeof p>"u"?void 0:Pe(p),this.sigType=F,this.totalBoxBytes=typeof v>"u"?void 0:Xe(v),this.totalBoxes=typeof O>"u"?void 0:Xe(O)}getEncodingSchema(){return Ov.encodingSchema}toEncodingData(){return new Map([["address",this.address],["amount",this.amount],["amount-without-pending-rewards",this.amountWithoutPendingRewards],["min-balance",this.minBalance],["pending-rewards",this.pendingRewards],["rewards",this.rewards],["round",this.round],["status",this.status],["total-apps-opted-in",this.totalAppsOptedIn],["total-assets-opted-in",this.totalAssetsOptedIn],["total-created-apps",this.totalCreatedApps],["total-created-assets",this.totalCreatedAssets],["apps-local-state",typeof this.appsLocalState<"u"?this.appsLocalState.map(e=>e.toEncodingData()):void 0],["apps-total-extra-pages",this.appsTotalExtraPages],["apps-total-schema",typeof this.appsTotalSchema<"u"?this.appsTotalSchema.toEncodingData():void 0],["assets",typeof this.assets<"u"?this.assets.map(e=>e.toEncodingData()):void 0],["auth-addr",typeof this.authAddr<"u"?this.authAddr.toString():void 0],["created-apps",typeof this.createdApps<"u"?this.createdApps.map(e=>e.toEncodingData()):void 0],["created-assets",typeof this.createdAssets<"u"?this.createdAssets.map(e=>e.toEncodingData()):void 0],["incentive-eligible",this.incentiveEligible],["last-heartbeat",this.lastHeartbeat],["last-proposed",this.lastProposed],["participation",typeof this.participation<"u"?this.participation.toEncodingData():void 0],["reward-base",this.rewardBase],["sig-type",this.sigType],["total-box-bytes",this.totalBoxBytes],["total-boxes",this.totalBoxes]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Account: ${e}`);return new Ov({address:e.get("address"),amount:e.get("amount"),amountWithoutPendingRewards:e.get("amount-without-pending-rewards"),minBalance:e.get("min-balance"),pendingRewards:e.get("pending-rewards"),rewards:e.get("rewards"),round:e.get("round"),status:e.get("status"),totalAppsOptedIn:e.get("total-apps-opted-in"),totalAssetsOptedIn:e.get("total-assets-opted-in"),totalCreatedApps:e.get("total-created-apps"),totalCreatedAssets:e.get("total-created-assets"),appsLocalState:typeof e.get("apps-local-state")<"u"?e.get("apps-local-state").map(t=>lh.fromEncodingData(t)):void 0,appsTotalExtraPages:e.get("apps-total-extra-pages"),appsTotalSchema:typeof e.get("apps-total-schema")<"u"?oi.fromEncodingData(e.get("apps-total-schema")):void 0,assets:typeof e.get("assets")<"u"?e.get("assets").map(t=>Na.fromEncodingData(t)):void 0,authAddr:e.get("auth-addr"),createdApps:typeof e.get("created-apps")<"u"?e.get("created-apps").map(t=>Oa.fromEncodingData(t)):void 0,createdAssets:typeof e.get("created-assets")<"u"?e.get("created-assets").map(t=>yf.fromEncodingData(t)):void 0,incentiveEligible:e.get("incentive-eligible"),lastHeartbeat:e.get("last-heartbeat"),lastProposed:e.get("last-proposed"),participation:typeof e.get("participation")<"u"?Nv.fromEncodingData(e.get("participation")):void 0,rewardBase:e.get("reward-base"),sigType:e.get("sig-type"),totalBoxBytes:e.get("total-box-bytes"),totalBoxes:e.get("total-boxes")})}};class ah{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"round",valueSchema:new Y,omitEmpty:!0},{key:"app-local-state",valueSchema:new B(lh.encodingSchema),omitEmpty:!0},{key:"created-app",valueSchema:new B(Oc.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({round:e,appLocalState:t,createdApp:r}){this.round=Pe(e),this.appLocalState=t,this.createdApp=r}getEncodingSchema(){return ah.encodingSchema}toEncodingData(){return new Map([["round",this.round],["app-local-state",typeof this.appLocalState<"u"?this.appLocalState.toEncodingData():void 0],["created-app",typeof this.createdApp<"u"?this.createdApp.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountApplicationResponse: ${e}`);return new ah({round:e.get("round"),appLocalState:typeof e.get("app-local-state")<"u"?lh.fromEncodingData(e.get("app-local-state")):void 0,createdApp:typeof e.get("created-app")<"u"?Oc.fromEncodingData(e.get("created-app")):void 0})}}class Pc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"asset-holding",valueSchema:Na.encodingSchema,omitEmpty:!0},{key:"asset-params",valueSchema:new B(La.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({assetHolding:e,assetParams:t}){this.assetHolding=e,this.assetParams=t}getEncodingSchema(){return Pc.encodingSchema}toEncodingData(){return new Map([["asset-holding",this.assetHolding.toEncodingData()],["asset-params",typeof this.assetParams<"u"?this.assetParams.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountAssetHolding: ${e}`);return new Pc({assetHolding:Na.fromEncodingData(e.get("asset-holding")??new Map),assetParams:typeof e.get("asset-params")<"u"?La.fromEncodingData(e.get("asset-params")):void 0})}}class ch{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"round",valueSchema:new Y,omitEmpty:!0},{key:"asset-holding",valueSchema:new B(Na.encodingSchema),omitEmpty:!0},{key:"created-asset",valueSchema:new B(La.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({round:e,assetHolding:t,createdAsset:r}){this.round=Pe(e),this.assetHolding=t,this.createdAsset=r}getEncodingSchema(){return ch.encodingSchema}toEncodingData(){return new Map([["round",this.round],["asset-holding",typeof this.assetHolding<"u"?this.assetHolding.toEncodingData():void 0],["created-asset",typeof this.createdAsset<"u"?this.createdAsset.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountAssetResponse: ${e}`);return new ch({round:e.get("round"),assetHolding:typeof e.get("asset-holding")<"u"?Na.fromEncodingData(e.get("asset-holding")):void 0,createdAsset:typeof e.get("created-asset")<"u"?La.fromEncodingData(e.get("created-asset")):void 0})}}class mf{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"round",valueSchema:new Y,omitEmpty:!0},{key:"asset-holdings",valueSchema:new B(new He(Pc.encodingSchema)),omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({round:e,assetHoldings:t,nextToken:r}){this.round=Xe(e),this.assetHoldings=t,this.nextToken=r}getEncodingSchema(){return mf.encodingSchema}toEncodingData(){return new Map([["round",this.round],["asset-holdings",typeof this.assetHoldings<"u"?this.assetHoldings.map(e=>e.toEncodingData()):void 0],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountAssetsInformationResponse: ${e}`);return new mf({round:e.get("round"),assetHoldings:typeof e.get("asset-holdings")<"u"?e.get("asset-holdings").map(t=>Pc.fromEncodingData(t)):void 0,nextToken:e.get("next-token")})}}let Nv=class Lv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"selection-participation-key",valueSchema:new Je,omitEmpty:!0},{key:"vote-first-valid",valueSchema:new Y,omitEmpty:!0},{key:"vote-key-dilution",valueSchema:new Y,omitEmpty:!0},{key:"vote-last-valid",valueSchema:new Y,omitEmpty:!0},{key:"vote-participation-key",valueSchema:new Je,omitEmpty:!0},{key:"state-proof-key",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({selectionParticipationKey:e,voteFirstValid:t,voteKeyDilution:r,voteLastValid:i,voteParticipationKey:o,stateProofKey:s}){this.selectionParticipationKey=typeof e=="string"?lt(e):e,this.voteFirstValid=Pe(t),this.voteKeyDilution=Pe(r),this.voteLastValid=Pe(i),this.voteParticipationKey=typeof o=="string"?lt(o):o,this.stateProofKey=typeof s=="string"?lt(s):s}getEncodingSchema(){return Lv.encodingSchema}toEncodingData(){return new Map([["selection-participation-key",this.selectionParticipationKey],["vote-first-valid",this.voteFirstValid],["vote-key-dilution",this.voteKeyDilution],["vote-last-valid",this.voteLastValid],["vote-participation-key",this.voteParticipationKey],["state-proof-key",this.stateProofKey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountParticipation: ${e}`);return new Lv({selectionParticipationKey:e.get("selection-participation-key"),voteFirstValid:e.get("vote-first-valid"),voteKeyDilution:e.get("vote-key-dilution"),voteLastValid:e.get("vote-last-valid"),voteParticipationKey:e.get("vote-participation-key"),stateProofKey:e.get("state-proof-key")})}},uh=class Uv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Le,omitEmpty:!0},{key:"delta",valueSchema:new He(Ua.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,delta:t}){this.address=e,this.delta=t}getEncodingSchema(){return Uv.encodingSchema}toEncodingData(){return new Map([["address",this.address],["delta",this.delta.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountStateDelta: ${e}`);return new Uv({address:e.get("address"),delta:(e.get("delta")??[]).map(t=>Ua.fromEncodingData(t))})}};class $c{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"application-index",valueSchema:new Y,omitEmpty:!0},{key:"logs",valueSchema:new He(new Je),omitEmpty:!0},{key:"txId",valueSchema:new Le,omitEmpty:!0})),this.encodingSchemaValue}constructor({applicationIndex:e,logs:t,txid:r}){this.applicationIndex=Xe(e),this.logs=t,this.txid=r}getEncodingSchema(){return $c.encodingSchema}toEncodingData(){return new Map([["application-index",this.applicationIndex],["logs",this.logs],["txId",this.txid]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AppCallLogs: ${e}`);return new $c({applicationIndex:e.get("application-index"),logs:e.get("logs"),txid:e.get("txId")})}}let Oa=class jv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"id",valueSchema:new Y,omitEmpty:!0},{key:"params",valueSchema:Oc.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({id:e,params:t}){this.id=Pe(e),this.params=t}getEncodingSchema(){return jv.encodingSchema}toEncodingData(){return new Map([["id",this.id],["params",this.params.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Application: ${e}`);return new jv({id:e.get("id"),params:Oc.fromEncodingData(e.get("params")??new Map)})}};class Bc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"id",valueSchema:new Y,omitEmpty:!0},{key:"app-boxes",valueSchema:new B(vi.encodingSchema),omitEmpty:!0},{key:"app-globals",valueSchema:new B(vi.encodingSchema),omitEmpty:!0},{key:"app-locals",valueSchema:new B(new He(vi.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({id:e,appBoxes:t,appGlobals:r,appLocals:i}){this.id=Pe(e),this.appBoxes=t,this.appGlobals=r,this.appLocals=i}getEncodingSchema(){return Bc.encodingSchema}toEncodingData(){return new Map([["id",this.id],["app-boxes",typeof this.appBoxes<"u"?this.appBoxes.toEncodingData():void 0],["app-globals",typeof this.appGlobals<"u"?this.appGlobals.toEncodingData():void 0],["app-locals",typeof this.appLocals<"u"?this.appLocals.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationInitialStates: ${e}`);return new Bc({id:e.get("id"),appBoxes:typeof e.get("app-boxes")<"u"?vi.fromEncodingData(e.get("app-boxes")):void 0,appGlobals:typeof e.get("app-globals")<"u"?vi.fromEncodingData(e.get("app-globals")):void 0,appLocals:typeof e.get("app-locals")<"u"?e.get("app-locals").map(t=>vi.fromEncodingData(t)):void 0})}}class vi{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"kvs",valueSchema:new He(Uc.encodingSchema),omitEmpty:!0},{key:"account",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({kvs:e,account:t}){this.kvs=e,this.account=typeof t=="string"?Pt.fromString(t):t}getEncodingSchema(){return vi.encodingSchema}toEncodingData(){return new Map([["kvs",this.kvs.map(e=>e.toEncodingData())],["account",typeof this.account<"u"?this.account.toString():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationKVStorage: ${e}`);return new vi({kvs:(e.get("kvs")??[]).map(t=>Uc.fromEncodingData(t)),account:e.get("account")})}}class Vc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"account",valueSchema:new Le,omitEmpty:!0},{key:"app",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({account:e,app:t}){this.account=typeof e=="string"?Pt.fromString(e):e,this.app=Pe(t)}getEncodingSchema(){return Vc.encodingSchema}toEncodingData(){return new Map([["account",this.account.toString()],["app",this.app]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLocalReference: ${e}`);return new Vc({account:e.get("account"),app:e.get("app")})}}let lh=class _v{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"id",valueSchema:new Y,omitEmpty:!0},{key:"schema",valueSchema:oi.encodingSchema,omitEmpty:!0},{key:"key-value",valueSchema:new B(new He(bh.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({id:e,schema:t,keyValue:r}){this.id=Pe(e),this.schema=t,this.keyValue=r}getEncodingSchema(){return _v.encodingSchema}toEncodingData(){return new Map([["id",this.id],["schema",this.schema.toEncodingData()],["key-value",typeof this.keyValue<"u"?this.keyValue.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLocalState: ${e}`);return new _v({id:e.get("id"),schema:oi.fromEncodingData(e.get("schema")??new Map),keyValue:typeof e.get("key-value")<"u"?e.get("key-value").map(t=>bh.fromEncodingData(t)):void 0})}},Oc=class zv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"approval-program",valueSchema:new Je,omitEmpty:!0},{key:"clear-state-program",valueSchema:new Je,omitEmpty:!0},{key:"creator",valueSchema:new Le,omitEmpty:!0},{key:"extra-program-pages",valueSchema:new B(new Y),omitEmpty:!0},{key:"global-state",valueSchema:new B(new He(bh.encodingSchema)),omitEmpty:!0},{key:"global-state-schema",valueSchema:new B(oi.encodingSchema),omitEmpty:!0},{key:"local-state-schema",valueSchema:new B(oi.encodingSchema),omitEmpty:!0},{key:"version",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({approvalProgram:e,clearStateProgram:t,creator:r,extraProgramPages:i,globalState:o,globalStateSchema:s,localStateSchema:a,version:l}){this.approvalProgram=typeof e=="string"?lt(e):e,this.clearStateProgram=typeof t=="string"?lt(t):t,this.creator=typeof r=="string"?Pt.fromString(r):r,this.extraProgramPages=typeof i>"u"?void 0:Xe(i),this.globalState=o,this.globalStateSchema=s,this.localStateSchema=a,this.version=typeof l>"u"?void 0:Xe(l)}getEncodingSchema(){return zv.encodingSchema}toEncodingData(){return new Map([["approval-program",this.approvalProgram],["clear-state-program",this.clearStateProgram],["creator",this.creator.toString()],["extra-program-pages",this.extraProgramPages],["global-state",typeof this.globalState<"u"?this.globalState.map(e=>e.toEncodingData()):void 0],["global-state-schema",typeof this.globalStateSchema<"u"?this.globalStateSchema.toEncodingData():void 0],["local-state-schema",typeof this.localStateSchema<"u"?this.localStateSchema.toEncodingData():void 0],["version",this.version]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationParams: ${e}`);return new zv({approvalProgram:e.get("approval-program"),clearStateProgram:e.get("clear-state-program"),creator:e.get("creator"),extraProgramPages:e.get("extra-program-pages"),globalState:typeof e.get("global-state")<"u"?e.get("global-state").map(t=>bh.fromEncodingData(t)):void 0,globalStateSchema:typeof e.get("global-state-schema")<"u"?oi.fromEncodingData(e.get("global-state-schema")):void 0,localStateSchema:typeof e.get("local-state-schema")<"u"?oi.fromEncodingData(e.get("local-state-schema")):void 0,version:e.get("version")})}};class Nc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"app-state-type",valueSchema:new Le,omitEmpty:!0},{key:"key",valueSchema:new Je,omitEmpty:!0},{key:"operation",valueSchema:new Le,omitEmpty:!0},{key:"account",valueSchema:new B(new Le),omitEmpty:!0},{key:"new-value",valueSchema:new B(Kr.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({appStateType:e,key:t,operation:r,account:i,newValue:o}){this.appStateType=e,this.key=typeof t=="string"?lt(t):t,this.operation=r,this.account=typeof i=="string"?Pt.fromString(i):i,this.newValue=o}getEncodingSchema(){return Nc.encodingSchema}toEncodingData(){return new Map([["app-state-type",this.appStateType],["key",this.key],["operation",this.operation],["account",typeof this.account<"u"?this.account.toString():void 0],["new-value",typeof this.newValue<"u"?this.newValue.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationStateOperation: ${e}`);return new Nc({appStateType:e.get("app-state-type"),key:e.get("key"),operation:e.get("operation"),account:e.get("account"),newValue:typeof e.get("new-value")<"u"?Kr.fromEncodingData(e.get("new-value")):void 0})}}let oi=class qv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"num-byte-slice",valueSchema:new Y,omitEmpty:!0},{key:"num-uint",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({numByteSlice:e,numUint:t}){this.numByteSlice=Xe(e),this.numUint=Xe(t)}getEncodingSchema(){return qv.encodingSchema}toEncodingData(){return new Map([["num-byte-slice",this.numByteSlice],["num-uint",this.numUint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationStateSchema: ${e}`);return new qv({numByteSlice:e.get("num-byte-slice"),numUint:e.get("num-uint")})}},yf=class Hv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"index",valueSchema:new Y,omitEmpty:!0},{key:"params",valueSchema:La.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({index:e,params:t}){this.index=Pe(e),this.params=t}getEncodingSchema(){return Hv.encodingSchema}toEncodingData(){return new Map([["index",this.index],["params",this.params.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Asset: ${e}`);return new Hv({index:e.get("index"),params:La.fromEncodingData(e.get("params")??new Map)})}},Na=class Gv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"amount",valueSchema:new Y,omitEmpty:!0},{key:"asset-id",valueSchema:new Y,omitEmpty:!0},{key:"is-frozen",valueSchema:new _t,omitEmpty:!0})),this.encodingSchemaValue}constructor({amount:e,assetId:t,isFrozen:r}){this.amount=Pe(e),this.assetId=Pe(t),this.isFrozen=r}getEncodingSchema(){return Gv.encodingSchema}toEncodingData(){return new Map([["amount",this.amount],["asset-id",this.assetId],["is-frozen",this.isFrozen]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHolding: ${e}`);return new Gv({amount:e.get("amount"),assetId:e.get("asset-id"),isFrozen:e.get("is-frozen")})}};class Lc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"account",valueSchema:new Le,omitEmpty:!0},{key:"asset",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({account:e,asset:t}){this.account=typeof e=="string"?Pt.fromString(e):e,this.asset=Pe(t)}getEncodingSchema(){return Lc.encodingSchema}toEncodingData(){return new Map([["account",this.account.toString()],["asset",this.asset]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHoldingReference: ${e}`);return new Lc({account:e.get("account"),asset:e.get("asset")})}}let La=class Kv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"creator",valueSchema:new Le,omitEmpty:!0},{key:"decimals",valueSchema:new Y,omitEmpty:!0},{key:"total",valueSchema:new Y,omitEmpty:!0},{key:"clawback",valueSchema:new B(new Le),omitEmpty:!0},{key:"default-frozen",valueSchema:new B(new _t),omitEmpty:!0},{key:"freeze",valueSchema:new B(new Le),omitEmpty:!0},{key:"manager",valueSchema:new B(new Le),omitEmpty:!0},{key:"metadata-hash",valueSchema:new B(new Je),omitEmpty:!0},{key:"name",valueSchema:new B(new Le),omitEmpty:!0},{key:"name-b64",valueSchema:new B(new Je),omitEmpty:!0},{key:"reserve",valueSchema:new B(new Le),omitEmpty:!0},{key:"unit-name",valueSchema:new B(new Le),omitEmpty:!0},{key:"unit-name-b64",valueSchema:new B(new Je),omitEmpty:!0},{key:"url",valueSchema:new B(new Le),omitEmpty:!0},{key:"url-b64",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({creator:e,decimals:t,total:r,clawback:i,defaultFrozen:o,freeze:s,manager:a,metadataHash:l,name:c,nameB64:d,reserve:f,unitName:m,unitNameB64:w,url:k,urlB64:I}){this.creator=e,this.decimals=Xe(t),this.total=Pe(r),this.clawback=i,this.defaultFrozen=o,this.freeze=s,this.manager=a,this.metadataHash=typeof l=="string"?lt(l):l,this.name=c,this.nameB64=typeof d=="string"?lt(d):d,this.reserve=f,this.unitName=m,this.unitNameB64=typeof w=="string"?lt(w):w,this.url=k,this.urlB64=typeof I=="string"?lt(I):I}getEncodingSchema(){return Kv.encodingSchema}toEncodingData(){return new Map([["creator",this.creator],["decimals",this.decimals],["total",this.total],["clawback",this.clawback],["default-frozen",this.defaultFrozen],["freeze",this.freeze],["manager",this.manager],["metadata-hash",this.metadataHash],["name",this.name],["name-b64",this.nameB64],["reserve",this.reserve],["unit-name",this.unitName],["unit-name-b64",this.unitNameB64],["url",this.url],["url-b64",this.urlB64]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetParams: ${e}`);return new Kv({creator:e.get("creator"),decimals:e.get("decimals"),total:e.get("total"),clawback:e.get("clawback"),defaultFrozen:e.get("default-frozen"),freeze:e.get("freeze"),manager:e.get("manager"),metadataHash:e.get("metadata-hash"),name:e.get("name"),nameB64:e.get("name-b64"),reserve:e.get("reserve"),unitName:e.get("unit-name"),unitNameB64:e.get("unit-name-b64"),url:e.get("url"),urlB64:e.get("url-b64")})}};class Uc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"key",valueSchema:new Je,omitEmpty:!0},{key:"value",valueSchema:Kr.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({key:e,value:t}){this.key=typeof e=="string"?lt(e):e,this.value=t}getEncodingSchema(){return Uc.encodingSchema}toEncodingData(){return new Map([["key",this.key],["value",this.value.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AvmKeyValue: ${e}`);return new Uc({key:e.get("key"),value:Kr.fromEncodingData(e.get("value")??new Map)})}}class Kr{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"type",valueSchema:new Y,omitEmpty:!0},{key:"bytes",valueSchema:new B(new Je),omitEmpty:!0},{key:"uint",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({type:e,bytes:t,uint:r}){this.type=Xe(e),this.bytes=typeof t=="string"?lt(t):t,this.uint=typeof r>"u"?void 0:Pe(r)}getEncodingSchema(){return Kr.encodingSchema}toEncodingData(){return new Map([["type",this.type],["bytes",this.bytes],["uint",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AvmValue: ${e}`);return new Kr({type:e.get("type"),bytes:e.get("bytes"),uint:e.get("uint")})}}class hh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"blockHash",valueSchema:new Le,omitEmpty:!0})),this.encodingSchemaValue}constructor({blockhash:e}){this.blockhash=e}getEncodingSchema(){return hh.encodingSchema}toEncodingData(){return new Map([["blockHash",this.blockhash]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockHashResponse: ${e}`);return new hh({blockhash:e.get("blockHash")})}}class wf{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"logs",valueSchema:new He($c.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({logs:e}){this.logs=e}getEncodingSchema(){return wf.encodingSchema}toEncodingData(){return new Map([["logs",this.logs.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockLogsResponse: ${e}`);return new wf({logs:(e.get("logs")??[]).map(t=>$c.fromEncodingData(t))})}}class dh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"block",valueSchema:gf.encodingSchema,omitEmpty:!0},{key:"cert",valueSchema:new B(Jn.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({block:e,cert:t}){this.block=e,this.cert=t}getEncodingSchema(){return dh.encodingSchema}toEncodingData(){return new Map([["block",this.block.toEncodingData()],["cert",typeof this.cert<"u"?this.cert.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockResponse: ${e}`);return new dh({block:gf.fromEncodingData(e.get("block")??new Map),cert:typeof e.get("cert")<"u"?Jn.fromEncodingData(e.get("cert")):void 0})}}class fh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"blockTxids",valueSchema:new He(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({blocktxids:e}){this.blocktxids=e}getEncodingSchema(){return fh.encodingSchema}toEncodingData(){return new Map([["blockTxids",this.blocktxids]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockTxidsResponse: ${e}`);return new fh({blocktxids:e.get("blockTxids")})}}let rF=class Wv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"name",valueSchema:new Je,omitEmpty:!0},{key:"round",valueSchema:new Y,omitEmpty:!0},{key:"value",valueSchema:new Je,omitEmpty:!0})),this.encodingSchemaValue}constructor({name:e,round:t,value:r}){this.name=typeof e=="string"?lt(e):e,this.round=Pe(t),this.value=typeof r=="string"?lt(r):r}getEncodingSchema(){return Wv.encodingSchema}toEncodingData(){return new Map([["name",this.name],["round",this.round],["value",this.value]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Box: ${e}`);return new Wv({name:e.get("name"),round:e.get("round"),value:e.get("value")})}},Jv=class Yv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"name",valueSchema:new Je,omitEmpty:!0})),this.encodingSchemaValue}constructor({name:e}){this.name=typeof e=="string"?lt(e):e}getEncodingSchema(){return Yv.encodingSchema}toEncodingData(){return new Map([["name",this.name]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxDescriptor: ${e}`);return new Yv({name:e.get("name")})}},Xv=class Qv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"app",valueSchema:new Y,omitEmpty:!0},{key:"name",valueSchema:new Je,omitEmpty:!0})),this.encodingSchemaValue}constructor({app:e,name:t}){this.app=Pe(e),this.name=typeof t=="string"?lt(t):t}getEncodingSchema(){return Qv.encodingSchema}toEncodingData(){return new Map([["app",this.app],["name",this.name]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxReference: ${e}`);return new Qv({app:e.get("app"),name:e.get("name")})}},iF=class Zv{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"boxes",valueSchema:new He(Jv.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({boxes:e}){this.boxes=e}getEncodingSchema(){return Zv.encodingSchema}toEncodingData(){return new Map([["boxes",this.boxes.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxesResponse: ${e}`);return new Zv({boxes:(e.get("boxes")??[]).map(t=>Jv.fromEncodingData(t))})}};class jc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"branch",valueSchema:new Le,omitEmpty:!0},{key:"build_number",valueSchema:new Y,omitEmpty:!0},{key:"channel",valueSchema:new Le,omitEmpty:!0},{key:"commit_hash",valueSchema:new Le,omitEmpty:!0},{key:"major",valueSchema:new Y,omitEmpty:!0},{key:"minor",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({branch:e,buildNumber:t,channel:r,commitHash:i,major:o,minor:s}){this.branch=e,this.buildNumber=Xe(t),this.channel=r,this.commitHash=i,this.major=Xe(o),this.minor=Xe(s)}getEncodingSchema(){return jc.encodingSchema}toEncodingData(){return new Map([["branch",this.branch],["build_number",this.buildNumber],["channel",this.channel],["commit_hash",this.commitHash],["major",this.major],["minor",this.minor]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BuildVersion: ${e}`);return new jc({branch:e.get("branch"),buildNumber:e.get("build_number"),channel:e.get("channel"),commitHash:e.get("commit_hash"),major:e.get("major"),minor:e.get("minor")})}}class gh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"hash",valueSchema:new Le,omitEmpty:!0},{key:"result",valueSchema:new Le,omitEmpty:!0},{key:"sourcemap",valueSchema:new B(Jn.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({hash:e,result:t,sourcemap:r}){this.hash=e,this.result=t,this.sourcemap=r}getEncodingSchema(){return gh.encodingSchema}toEncodingData(){return new Map([["hash",this.hash],["result",this.result],["sourcemap",typeof this.sourcemap<"u"?this.sourcemap.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded CompileResponse: ${e}`);return new gh({hash:e.get("hash"),result:e.get("result"),sourcemap:typeof e.get("sourcemap")<"u"?Jn.fromEncodingData(e.get("sourcemap")):void 0})}}class ph{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"result",valueSchema:new Le,omitEmpty:!0})),this.encodingSchemaValue}constructor({result:e}){this.result=e}getEncodingSchema(){return ph.encodingSchema}toEncodingData(){return new Map([["result",this.result]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DisassembleResponse: ${e}`);return new ph({result:e.get("result")})}}class mh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"accounts",valueSchema:new He(pf.encodingSchema),omitEmpty:!0},{key:"apps",valueSchema:new He(Oa.encodingSchema),omitEmpty:!0},{key:"latest-timestamp",valueSchema:new Y,omitEmpty:!0},{key:"protocol-version",valueSchema:new Le,omitEmpty:!0},{key:"round",valueSchema:new Y,omitEmpty:!0},{key:"sources",valueSchema:new He(_c.encodingSchema),omitEmpty:!0},{key:"txns",valueSchema:new He(Sn.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({accounts:e,apps:t,latestTimestamp:r,protocolVersion:i,round:o,sources:s,txns:a}){this.accounts=e,this.apps=t,this.latestTimestamp=Xe(r),this.protocolVersion=i,this.round=Pe(o),this.sources=s,this.txns=a}getEncodingSchema(){return mh.encodingSchema}toEncodingData(){return new Map([["accounts",this.accounts.map(e=>e.toEncodingData())],["apps",this.apps.map(e=>e.toEncodingData())],["latest-timestamp",this.latestTimestamp],["protocol-version",this.protocolVersion],["round",this.round],["sources",this.sources.map(e=>e.toEncodingData())],["txns",this.txns.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DryrunRequest: ${e}`);return new mh({accounts:(e.get("accounts")??[]).map(t=>pf.fromEncodingData(t)),apps:(e.get("apps")??[]).map(t=>Oa.fromEncodingData(t)),latestTimestamp:e.get("latest-timestamp"),protocolVersion:e.get("protocol-version"),round:e.get("round"),sources:(e.get("sources")??[]).map(t=>_c.fromEncodingData(t)),txns:(e.get("txns")??[]).map(t=>Sn.fromEncodingData(t))})}}class yh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"error",valueSchema:new Le,omitEmpty:!0},{key:"protocol-version",valueSchema:new Le,omitEmpty:!0},{key:"txns",valueSchema:new He(zc.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({error:e,protocolVersion:t,txns:r}){this.error=e,this.protocolVersion=t,this.txns=r}getEncodingSchema(){return yh.encodingSchema}toEncodingData(){return new Map([["error",this.error],["protocol-version",this.protocolVersion],["txns",this.txns.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DryrunResponse: ${e}`);return new yh({error:e.get("error"),protocolVersion:e.get("protocol-version"),txns:(e.get("txns")??[]).map(t=>zc.fromEncodingData(t))})}}class _c{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"app-index",valueSchema:new Y,omitEmpty:!0},{key:"field-name",valueSchema:new Le,omitEmpty:!0},{key:"source",valueSchema:new Le,omitEmpty:!0},{key:"txn-index",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({appIndex:e,fieldName:t,source:r,txnIndex:i}){this.appIndex=Pe(e),this.fieldName=t,this.source=r,this.txnIndex=Xe(i)}getEncodingSchema(){return _c.encodingSchema}toEncodingData(){return new Map([["app-index",this.appIndex],["field-name",this.fieldName],["source",this.source],["txn-index",this.txnIndex]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DryrunSource: ${e}`);return new _c({appIndex:e.get("app-index"),fieldName:e.get("field-name"),source:e.get("source"),txnIndex:e.get("txn-index")})}}class Vo{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"line",valueSchema:new Y,omitEmpty:!0},{key:"pc",valueSchema:new Y,omitEmpty:!0},{key:"stack",valueSchema:new He(Ts.encodingSchema),omitEmpty:!0},{key:"error",valueSchema:new B(new Le),omitEmpty:!0},{key:"scratch",valueSchema:new B(new He(Ts.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({line:e,pc:t,stack:r,error:i,scratch:o}){this.line=Xe(e),this.pc=Xe(t),this.stack=r,this.error=i,this.scratch=o}getEncodingSchema(){return Vo.encodingSchema}toEncodingData(){return new Map([["line",this.line],["pc",this.pc],["stack",this.stack.map(e=>e.toEncodingData())],["error",this.error],["scratch",typeof this.scratch<"u"?this.scratch.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DryrunState: ${e}`);return new Vo({line:e.get("line"),pc:e.get("pc"),stack:(e.get("stack")??[]).map(t=>Ts.fromEncodingData(t)),error:e.get("error"),scratch:typeof e.get("scratch")<"u"?e.get("scratch").map(t=>Ts.fromEncodingData(t)):void 0})}}class zc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"disassembly",valueSchema:new He(new Le),omitEmpty:!0},{key:"app-call-messages",valueSchema:new B(new He(new Le)),omitEmpty:!0},{key:"app-call-trace",valueSchema:new B(new He(Vo.encodingSchema)),omitEmpty:!0},{key:"budget-added",valueSchema:new B(new Y),omitEmpty:!0},{key:"budget-consumed",valueSchema:new B(new Y),omitEmpty:!0},{key:"global-delta",valueSchema:new B(new He(Ua.encodingSchema)),omitEmpty:!0},{key:"local-deltas",valueSchema:new B(new He(uh.encodingSchema)),omitEmpty:!0},{key:"logic-sig-disassembly",valueSchema:new B(new He(new Le)),omitEmpty:!0},{key:"logic-sig-messages",valueSchema:new B(new He(new Le)),omitEmpty:!0},{key:"logic-sig-trace",valueSchema:new B(new He(Vo.encodingSchema)),omitEmpty:!0},{key:"logs",valueSchema:new B(new He(new Je)),omitEmpty:!0})),this.encodingSchemaValue}constructor({disassembly:e,appCallMessages:t,appCallTrace:r,budgetAdded:i,budgetConsumed:o,globalDelta:s,localDeltas:a,logicSigDisassembly:l,logicSigMessages:c,logicSigTrace:d,logs:f}){this.disassembly=e,this.appCallMessages=t,this.appCallTrace=r,this.budgetAdded=typeof i>"u"?void 0:Xe(i),this.budgetConsumed=typeof o>"u"?void 0:Xe(o),this.globalDelta=s,this.localDeltas=a,this.logicSigDisassembly=l,this.logicSigMessages=c,this.logicSigTrace=d,this.logs=f}getEncodingSchema(){return zc.encodingSchema}toEncodingData(){return new Map([["disassembly",this.disassembly],["app-call-messages",this.appCallMessages],["app-call-trace",typeof this.appCallTrace<"u"?this.appCallTrace.map(e=>e.toEncodingData()):void 0],["budget-added",this.budgetAdded],["budget-consumed",this.budgetConsumed],["global-delta",typeof this.globalDelta<"u"?this.globalDelta.map(e=>e.toEncodingData()):void 0],["local-deltas",typeof this.localDeltas<"u"?this.localDeltas.map(e=>e.toEncodingData()):void 0],["logic-sig-disassembly",this.logicSigDisassembly],["logic-sig-messages",this.logicSigMessages],["logic-sig-trace",typeof this.logicSigTrace<"u"?this.logicSigTrace.map(e=>e.toEncodingData()):void 0],["logs",this.logs]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded DryrunTxnResult: ${e}`);return new zc({disassembly:e.get("disassembly"),appCallMessages:e.get("app-call-messages"),appCallTrace:typeof e.get("app-call-trace")<"u"?e.get("app-call-trace").map(t=>Vo.fromEncodingData(t)):void 0,budgetAdded:e.get("budget-added"),budgetConsumed:e.get("budget-consumed"),globalDelta:typeof e.get("global-delta")<"u"?e.get("global-delta").map(t=>Ua.fromEncodingData(t)):void 0,localDeltas:typeof e.get("local-deltas")<"u"?e.get("local-deltas").map(t=>uh.fromEncodingData(t)):void 0,logicSigDisassembly:e.get("logic-sig-disassembly"),logicSigMessages:e.get("logic-sig-messages"),logicSigTrace:typeof e.get("logic-sig-trace")<"u"?e.get("logic-sig-trace").map(t=>Vo.fromEncodingData(t)):void 0,logs:e.get("logs")})}}let Y8=class ex{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"message",valueSchema:new Le,omitEmpty:!0},{key:"data",valueSchema:new B(Jn.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({message:e,data:t}){this.message=e,this.data=t}getEncodingSchema(){return ex.encodingSchema}toEncodingData(){return new Map([["message",this.message],["data",typeof this.data<"u"?this.data.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ErrorResponse: ${e}`);return new ex({message:e.get("message"),data:typeof e.get("data")<"u"?Jn.fromEncodingData(e.get("data")):void 0})}},tx=class nx{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"action",valueSchema:new Y,omitEmpty:!0},{key:"bytes",valueSchema:new B(new Le),omitEmpty:!0},{key:"uint",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({action:e,bytes:t,uint:r}){this.action=Xe(e),this.bytes=t,this.uint=typeof r>"u"?void 0:Pe(r)}getEncodingSchema(){return nx.encodingSchema}toEncodingData(){return new Map([["action",this.action],["bytes",this.bytes],["uint",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded EvalDelta: ${e}`);return new nx({action:e.get("action"),bytes:e.get("bytes"),uint:e.get("uint")})}},Ua=class rx{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"key",valueSchema:new Le,omitEmpty:!0},{key:"value",valueSchema:tx.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({key:e,value:t}){this.key=e,this.value=t}getEncodingSchema(){return rx.encodingSchema}toEncodingData(){return new Map([["key",this.key],["value",this.value.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded EvalDeltaKeyValue: ${e}`);return new rx({key:e.get("key"),value:tx.fromEncodingData(e.get("value")??new Map)})}},X8=class ix{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"alloc",valueSchema:new He(qc.encodingSchema),omitEmpty:!0},{key:"fees",valueSchema:new Le,omitEmpty:!0},{key:"id",valueSchema:new Le,omitEmpty:!0},{key:"network",valueSchema:new Le,omitEmpty:!0},{key:"proto",valueSchema:new Le,omitEmpty:!0},{key:"rwd",valueSchema:new Le,omitEmpty:!0},{key:"timestamp",valueSchema:new Y,omitEmpty:!0},{key:"comment",valueSchema:new B(new Le),omitEmpty:!0},{key:"devmode",valueSchema:new B(new _t),omitEmpty:!0})),this.encodingSchemaValue}constructor({alloc:e,fees:t,id:r,network:i,proto:o,rwd:s,timestamp:a,comment:l,devmode:c}){this.alloc=e,this.fees=t,this.id=r,this.network=i,this.proto=o,this.rwd=s,this.timestamp=Xe(a),this.comment=l,this.devmode=c}getEncodingSchema(){return ix.encodingSchema}toEncodingData(){return new Map([["alloc",this.alloc.map(e=>e.toEncodingData())],["fees",this.fees],["id",this.id],["network",this.network],["proto",this.proto],["rwd",this.rwd],["timestamp",this.timestamp],["comment",this.comment],["devmode",this.devmode]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Genesis: ${e}`);return new ix({alloc:(e.get("alloc")??[]).map(t=>qc.fromEncodingData(t)),fees:e.get("fees"),id:e.get("id"),network:e.get("network"),proto:e.get("proto"),rwd:e.get("rwd"),timestamp:e.get("timestamp"),comment:e.get("comment"),devmode:e.get("devmode")})}};class qc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"addr",valueSchema:new Le,omitEmpty:!0},{key:"comment",valueSchema:new Le,omitEmpty:!0},{key:"state",valueSchema:Jn.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({addr:e,comment:t,state:r}){this.addr=e,this.comment=t,this.state=r}getEncodingSchema(){return qc.encodingSchema}toEncodingData(){return new Map([["addr",this.addr],["comment",this.comment],["state",this.state.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded GenesisAllocation: ${e}`);return new qc({addr:e.get("addr"),comment:e.get("comment"),state:Jn.fromEncodingData(e.get("state")??new Map)})}}class wh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"offset",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({offset:e}){this.offset=Xe(e)}getEncodingSchema(){return wh.encodingSchema}toEncodingData(){return new Map([["offset",this.offset]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded GetBlockTimeStampOffsetResponse: ${e}`);return new wh({offset:e.get("offset")})}}class Sh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"round",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({round:e}){this.round=Pe(e)}getEncodingSchema(){return Sh.encodingSchema}toEncodingData(){return new Map([["round",this.round]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded GetSyncRoundResponse: ${e}`);return new Sh({round:e.get("round")})}}class Hc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"Delta",valueSchema:so.encodingSchema,omitEmpty:!0},{key:"Ids",valueSchema:new He(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({delta:e,ids:t}){this.delta=e,this.ids=t}getEncodingSchema(){return Hc.encodingSchema}toEncodingData(){return new Map([["Delta",this.delta.toEncodingData()],["Ids",this.ids]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded LedgerStateDeltaForTransactionGroup: ${e}`);return new Hc({delta:so.fromEncodingData(e.get("Delta")??new Map),ids:e.get("Ids")})}}let oF=class ox{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"index",valueSchema:new Y,omitEmpty:!0},{key:"proof",valueSchema:new Je,omitEmpty:!0},{key:"treedepth",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({index:e,proof:t,treedepth:r}){this.index=Xe(e),this.proof=typeof t=="string"?lt(t):t,this.treedepth=Xe(r)}getEncodingSchema(){return ox.encodingSchema}toEncodingData(){return new Map([["index",this.index],["proof",this.proof],["treedepth",this.treedepth]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded LightBlockHeaderProof: ${e}`);return new ox({index:e.get("index"),proof:e.get("proof"),treedepth:e.get("treedepth")})}};class Gc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"catchup-time",valueSchema:new Y,omitEmpty:!0},{key:"last-round",valueSchema:new Y,omitEmpty:!0},{key:"last-version",valueSchema:new Le,omitEmpty:!0},{key:"next-version",valueSchema:new Le,omitEmpty:!0},{key:"next-version-round",valueSchema:new Y,omitEmpty:!0},{key:"next-version-supported",valueSchema:new _t,omitEmpty:!0},{key:"stopped-at-unsupported-round",valueSchema:new _t,omitEmpty:!0},{key:"time-since-last-round",valueSchema:new Y,omitEmpty:!0},{key:"catchpoint",valueSchema:new B(new Le),omitEmpty:!0},{key:"catchpoint-acquired-blocks",valueSchema:new B(new Y),omitEmpty:!0},{key:"catchpoint-processed-accounts",valueSchema:new B(new Y),omitEmpty:!0},{key:"catchpoint-processed-kvs",valueSchema:new B(new Y),omitEmpty:!0},{key:"catchpoint-total-accounts",valueSchema:new B(new Y),omitEmpty:!0},{key:"catchpoint-total-blocks",valueSchema:new B(new Y),omitEmpty:!0},{key:"catchpoint-total-kvs",valueSchema:new B(new Y),omitEmpty:!0},{key:"catchpoint-verified-accounts",valueSchema:new B(new Y),omitEmpty:!0},{key:"catchpoint-verified-kvs",valueSchema:new B(new Y),omitEmpty:!0},{key:"last-catchpoint",valueSchema:new B(new Le),omitEmpty:!0},{key:"upgrade-delay",valueSchema:new B(new Y),omitEmpty:!0},{key:"upgrade-next-protocol-vote-before",valueSchema:new B(new Y),omitEmpty:!0},{key:"upgrade-no-votes",valueSchema:new B(new Y),omitEmpty:!0},{key:"upgrade-node-vote",valueSchema:new B(new _t),omitEmpty:!0},{key:"upgrade-vote-rounds",valueSchema:new B(new Y),omitEmpty:!0},{key:"upgrade-votes",valueSchema:new B(new Y),omitEmpty:!0},{key:"upgrade-votes-required",valueSchema:new B(new Y),omitEmpty:!0},{key:"upgrade-yes-votes",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({catchupTime:e,lastRound:t,lastVersion:r,nextVersion:i,nextVersionRound:o,nextVersionSupported:s,stoppedAtUnsupportedRound:a,timeSinceLastRound:l,catchpoint:c,catchpointAcquiredBlocks:d,catchpointProcessedAccounts:f,catchpointProcessedKvs:m,catchpointTotalAccounts:w,catchpointTotalBlocks:k,catchpointTotalKvs:I,catchpointVerifiedAccounts:x,catchpointVerifiedKvs:T,lastCatchpoint:b,upgradeDelay:R,upgradeNextProtocolVoteBefore:L,upgradeNoVotes:G,upgradeNodeVote:E,upgradeVoteRounds:N,upgradeVotes:p,upgradeVotesRequired:F,upgradeYesVotes:v}){this.catchupTime=Pe(e),this.lastRound=Pe(t),this.lastVersion=r,this.nextVersion=i,this.nextVersionRound=Pe(o),this.nextVersionSupported=s,this.stoppedAtUnsupportedRound=a,this.timeSinceLastRound=Pe(l),this.catchpoint=c,this.catchpointAcquiredBlocks=typeof d>"u"?void 0:Xe(d),this.catchpointProcessedAccounts=typeof f>"u"?void 0:Xe(f),this.catchpointProcessedKvs=typeof m>"u"?void 0:Xe(m),this.catchpointTotalAccounts=typeof w>"u"?void 0:Xe(w),this.catchpointTotalBlocks=typeof k>"u"?void 0:Xe(k),this.catchpointTotalKvs=typeof I>"u"?void 0:Xe(I),this.catchpointVerifiedAccounts=typeof x>"u"?void 0:Xe(x),this.catchpointVerifiedKvs=typeof T>"u"?void 0:Xe(T),this.lastCatchpoint=b,this.upgradeDelay=typeof R>"u"?void 0:Pe(R),this.upgradeNextProtocolVoteBefore=typeof L>"u"?void 0:Pe(L),this.upgradeNoVotes=typeof G>"u"?void 0:Xe(G),this.upgradeNodeVote=E,this.upgradeVoteRounds=typeof N>"u"?void 0:Xe(N),this.upgradeVotes=typeof p>"u"?void 0:Xe(p),this.upgradeVotesRequired=typeof F>"u"?void 0:Xe(F),this.upgradeYesVotes=typeof v>"u"?void 0:Xe(v)}getEncodingSchema(){return Gc.encodingSchema}toEncodingData(){return new Map([["catchup-time",this.catchupTime],["last-round",this.lastRound],["last-version",this.lastVersion],["next-version",this.nextVersion],["next-version-round",this.nextVersionRound],["next-version-supported",this.nextVersionSupported],["stopped-at-unsupported-round",this.stoppedAtUnsupportedRound],["time-since-last-round",this.timeSinceLastRound],["catchpoint",this.catchpoint],["catchpoint-acquired-blocks",this.catchpointAcquiredBlocks],["catchpoint-processed-accounts",this.catchpointProcessedAccounts],["catchpoint-processed-kvs",this.catchpointProcessedKvs],["catchpoint-total-accounts",this.catchpointTotalAccounts],["catchpoint-total-blocks",this.catchpointTotalBlocks],["catchpoint-total-kvs",this.catchpointTotalKvs],["catchpoint-verified-accounts",this.catchpointVerifiedAccounts],["catchpoint-verified-kvs",this.catchpointVerifiedKvs],["last-catchpoint",this.lastCatchpoint],["upgrade-delay",this.upgradeDelay],["upgrade-next-protocol-vote-before",this.upgradeNextProtocolVoteBefore],["upgrade-no-votes",this.upgradeNoVotes],["upgrade-node-vote",this.upgradeNodeVote],["upgrade-vote-rounds",this.upgradeVoteRounds],["upgrade-votes",this.upgradeVotes],["upgrade-votes-required",this.upgradeVotesRequired],["upgrade-yes-votes",this.upgradeYesVotes]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded NodeStatusResponse: ${e}`);return new Gc({catchupTime:e.get("catchup-time"),lastRound:e.get("last-round"),lastVersion:e.get("last-version"),nextVersion:e.get("next-version"),nextVersionRound:e.get("next-version-round"),nextVersionSupported:e.get("next-version-supported"),stoppedAtUnsupportedRound:e.get("stopped-at-unsupported-round"),timeSinceLastRound:e.get("time-since-last-round"),catchpoint:e.get("catchpoint"),catchpointAcquiredBlocks:e.get("catchpoint-acquired-blocks"),catchpointProcessedAccounts:e.get("catchpoint-processed-accounts"),catchpointProcessedKvs:e.get("catchpoint-processed-kvs"),catchpointTotalAccounts:e.get("catchpoint-total-accounts"),catchpointTotalBlocks:e.get("catchpoint-total-blocks"),catchpointTotalKvs:e.get("catchpoint-total-kvs"),catchpointVerifiedAccounts:e.get("catchpoint-verified-accounts"),catchpointVerifiedKvs:e.get("catchpoint-verified-kvs"),lastCatchpoint:e.get("last-catchpoint"),upgradeDelay:e.get("upgrade-delay"),upgradeNextProtocolVoteBefore:e.get("upgrade-next-protocol-vote-before"),upgradeNoVotes:e.get("upgrade-no-votes"),upgradeNodeVote:e.get("upgrade-node-vote"),upgradeVoteRounds:e.get("upgrade-vote-rounds"),upgradeVotes:e.get("upgrade-votes"),upgradeVotesRequired:e.get("upgrade-votes-required"),upgradeYesVotes:e.get("upgrade-yes-votes")})}}class Wi{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"pool-error",valueSchema:new Le,omitEmpty:!0},{key:"txn",valueSchema:Sn.encodingSchema,omitEmpty:!0},{key:"application-index",valueSchema:new B(new Y),omitEmpty:!0},{key:"asset-closing-amount",valueSchema:new B(new Y),omitEmpty:!0},{key:"asset-index",valueSchema:new B(new Y),omitEmpty:!0},{key:"close-rewards",valueSchema:new B(new Y),omitEmpty:!0},{key:"closing-amount",valueSchema:new B(new Y),omitEmpty:!0},{key:"confirmed-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"global-state-delta",valueSchema:new B(new He(Ua.encodingSchema)),omitEmpty:!0},{key:"inner-txns",valueSchema:new B(new He(Wi.encodingSchema)),omitEmpty:!0},{key:"local-state-delta",valueSchema:new B(new He(uh.encodingSchema)),omitEmpty:!0},{key:"logs",valueSchema:new B(new He(new Je)),omitEmpty:!0},{key:"receiver-rewards",valueSchema:new B(new Y),omitEmpty:!0},{key:"sender-rewards",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({poolError:e,txn:t,applicationIndex:r,assetClosingAmount:i,assetIndex:o,closeRewards:s,closingAmount:a,confirmedRound:l,globalStateDelta:c,innerTxns:d,localStateDelta:f,logs:m,receiverRewards:w,senderRewards:k}){this.poolError=e,this.txn=t,this.applicationIndex=typeof r>"u"?void 0:Pe(r),this.assetClosingAmount=typeof i>"u"?void 0:Pe(i),this.assetIndex=typeof o>"u"?void 0:Pe(o),this.closeRewards=typeof s>"u"?void 0:Pe(s),this.closingAmount=typeof a>"u"?void 0:Pe(a),this.confirmedRound=typeof l>"u"?void 0:Pe(l),this.globalStateDelta=c,this.innerTxns=d,this.localStateDelta=f,this.logs=m,this.receiverRewards=typeof w>"u"?void 0:Pe(w),this.senderRewards=typeof k>"u"?void 0:Pe(k)}getEncodingSchema(){return Wi.encodingSchema}toEncodingData(){return new Map([["pool-error",this.poolError],["txn",this.txn.toEncodingData()],["application-index",this.applicationIndex],["asset-closing-amount",this.assetClosingAmount],["asset-index",this.assetIndex],["close-rewards",this.closeRewards],["closing-amount",this.closingAmount],["confirmed-round",this.confirmedRound],["global-state-delta",typeof this.globalStateDelta<"u"?this.globalStateDelta.map(e=>e.toEncodingData()):void 0],["inner-txns",typeof this.innerTxns<"u"?this.innerTxns.map(e=>e.toEncodingData()):void 0],["local-state-delta",typeof this.localStateDelta<"u"?this.localStateDelta.map(e=>e.toEncodingData()):void 0],["logs",this.logs],["receiver-rewards",this.receiverRewards],["sender-rewards",this.senderRewards]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded PendingTransactionResponse: ${e}`);return new Wi({poolError:e.get("pool-error"),txn:Sn.fromEncodingData(e.get("txn")??new Map),applicationIndex:e.get("application-index"),assetClosingAmount:e.get("asset-closing-amount"),assetIndex:e.get("asset-index"),closeRewards:e.get("close-rewards"),closingAmount:e.get("closing-amount"),confirmedRound:e.get("confirmed-round"),globalStateDelta:typeof e.get("global-state-delta")<"u"?e.get("global-state-delta").map(t=>Ua.fromEncodingData(t)):void 0,innerTxns:typeof e.get("inner-txns")<"u"?e.get("inner-txns").map(t=>Wi.fromEncodingData(t)):void 0,localStateDelta:typeof e.get("local-state-delta")<"u"?e.get("local-state-delta").map(t=>uh.fromEncodingData(t)):void 0,logs:e.get("logs"),receiverRewards:e.get("receiver-rewards"),senderRewards:e.get("sender-rewards")})}}class Kc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"top-transactions",valueSchema:new He(Sn.encodingSchema),omitEmpty:!0},{key:"total-transactions",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({topTransactions:e,totalTransactions:t}){this.topTransactions=e,this.totalTransactions=Xe(t)}getEncodingSchema(){return Kc.encodingSchema}toEncodingData(){return new Map([["top-transactions",this.topTransactions.map(e=>e.toEncodingData())],["total-transactions",this.totalTransactions]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded PendingTransactionsResponse: ${e}`);return new Kc({topTransactions:(e.get("top-transactions")??[]).map(t=>Sn.fromEncodingData(t)),totalTransactions:e.get("total-transactions")})}}class vh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"txId",valueSchema:new Le,omitEmpty:!0})),this.encodingSchemaValue}constructor({txid:e}){this.txid=e}getEncodingSchema(){return vh.encodingSchema}toEncodingData(){return new Map([["txId",this.txid]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded PostTransactionsResponse: ${e}`);return new vh({txid:e.get("txId")})}}class Wc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"new-value",valueSchema:Kr.encodingSchema,omitEmpty:!0},{key:"slot",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({newValue:e,slot:t}){this.newValue=e,this.slot=Xe(t)}getEncodingSchema(){return Wc.encodingSchema}toEncodingData(){return new Map([["new-value",this.newValue.toEncodingData()],["slot",this.slot]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ScratchChange: ${e}`);return new Wc({newValue:Kr.fromEncodingData(e.get("new-value")??new Map),slot:e.get("slot")})}}class Jc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"app-initial-states",valueSchema:new B(new He(Bc.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({appInitialStates:e}){this.appInitialStates=e}getEncodingSchema(){return Jc.encodingSchema}toEncodingData(){return new Map([["app-initial-states",typeof this.appInitialStates<"u"?this.appInitialStates.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateInitialStates: ${e}`);return new Jc({appInitialStates:typeof e.get("app-initial-states")<"u"?e.get("app-initial-states").map(t=>Bc.fromEncodingData(t)):void 0})}}class Yc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"txn-groups",valueSchema:new He(Wo.encodingSchema),omitEmpty:!0},{key:"allow-empty-signatures",valueSchema:new B(new _t),omitEmpty:!0},{key:"allow-more-logging",valueSchema:new B(new _t),omitEmpty:!0},{key:"allow-unnamed-resources",valueSchema:new B(new _t),omitEmpty:!0},{key:"exec-trace-config",valueSchema:new B(Jo.encodingSchema),omitEmpty:!0},{key:"extra-opcode-budget",valueSchema:new B(new Y),omitEmpty:!0},{key:"fix-signers",valueSchema:new B(new _t),omitEmpty:!0},{key:"round",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({txnGroups:e,allowEmptySignatures:t,allowMoreLogging:r,allowUnnamedResources:i,execTraceConfig:o,extraOpcodeBudget:s,fixSigners:a,round:l}){this.txnGroups=e,this.allowEmptySignatures=t,this.allowMoreLogging=r,this.allowUnnamedResources=i,this.execTraceConfig=o,this.extraOpcodeBudget=typeof s>"u"?void 0:Xe(s),this.fixSigners=a,this.round=typeof l>"u"?void 0:Pe(l)}getEncodingSchema(){return Yc.encodingSchema}toEncodingData(){return new Map([["txn-groups",this.txnGroups.map(e=>e.toEncodingData())],["allow-empty-signatures",this.allowEmptySignatures],["allow-more-logging",this.allowMoreLogging],["allow-unnamed-resources",this.allowUnnamedResources],["exec-trace-config",typeof this.execTraceConfig<"u"?this.execTraceConfig.toEncodingData():void 0],["extra-opcode-budget",this.extraOpcodeBudget],["fix-signers",this.fixSigners],["round",this.round]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateRequest: ${e}`);return new Yc({txnGroups:(e.get("txn-groups")??[]).map(t=>Wo.fromEncodingData(t)),allowEmptySignatures:e.get("allow-empty-signatures"),allowMoreLogging:e.get("allow-more-logging"),allowUnnamedResources:e.get("allow-unnamed-resources"),execTraceConfig:typeof e.get("exec-trace-config")<"u"?Jo.fromEncodingData(e.get("exec-trace-config")):void 0,extraOpcodeBudget:e.get("extra-opcode-budget"),fixSigners:e.get("fix-signers"),round:e.get("round")})}}class Wo{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"txns",valueSchema:new He(Sn.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({txns:e}){this.txns=e}getEncodingSchema(){return Wo.encodingSchema}toEncodingData(){return new Map([["txns",this.txns.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateRequestTransactionGroup: ${e}`);return new Wo({txns:(e.get("txns")??[]).map(t=>Sn.fromEncodingData(t))})}}class xh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"last-round",valueSchema:new Y,omitEmpty:!0},{key:"txn-groups",valueSchema:new He(Xc.encodingSchema),omitEmpty:!0},{key:"version",valueSchema:new Y,omitEmpty:!0},{key:"eval-overrides",valueSchema:new B(Zc.encodingSchema),omitEmpty:!0},{key:"exec-trace-config",valueSchema:new B(Jo.encodingSchema),omitEmpty:!0},{key:"initial-states",valueSchema:new B(Jc.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({lastRound:e,txnGroups:t,version:r,evalOverrides:i,execTraceConfig:o,initialStates:s}){this.lastRound=Pe(e),this.txnGroups=t,this.version=Xe(r),this.evalOverrides=i,this.execTraceConfig=o,this.initialStates=s}getEncodingSchema(){return xh.encodingSchema}toEncodingData(){return new Map([["last-round",this.lastRound],["txn-groups",this.txnGroups.map(e=>e.toEncodingData())],["version",this.version],["eval-overrides",typeof this.evalOverrides<"u"?this.evalOverrides.toEncodingData():void 0],["exec-trace-config",typeof this.execTraceConfig<"u"?this.execTraceConfig.toEncodingData():void 0],["initial-states",typeof this.initialStates<"u"?this.initialStates.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateResponse: ${e}`);return new xh({lastRound:e.get("last-round"),txnGroups:(e.get("txn-groups")??[]).map(t=>Xc.fromEncodingData(t)),version:e.get("version"),evalOverrides:typeof e.get("eval-overrides")<"u"?Zc.fromEncodingData(e.get("eval-overrides")):void 0,execTraceConfig:typeof e.get("exec-trace-config")<"u"?Jo.fromEncodingData(e.get("exec-trace-config")):void 0,initialStates:typeof e.get("initial-states")<"u"?Jc.fromEncodingData(e.get("initial-states")):void 0})}}class Jo{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"enable",valueSchema:new B(new _t),omitEmpty:!0},{key:"scratch-change",valueSchema:new B(new _t),omitEmpty:!0},{key:"stack-change",valueSchema:new B(new _t),omitEmpty:!0},{key:"state-change",valueSchema:new B(new _t),omitEmpty:!0})),this.encodingSchemaValue}constructor({enable:e,scratchChange:t,stackChange:r,stateChange:i}){this.enable=e,this.scratchChange=t,this.stackChange=r,this.stateChange=i}getEncodingSchema(){return Jo.encodingSchema}toEncodingData(){return new Map([["enable",this.enable],["scratch-change",this.scratchChange],["stack-change",this.stackChange],["state-change",this.stateChange]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateTraceConfig: ${e}`);return new Jo({enable:e.get("enable"),scratchChange:e.get("scratch-change"),stackChange:e.get("stack-change"),stateChange:e.get("state-change")})}}class Xc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"txn-results",valueSchema:new He(Qc.encodingSchema),omitEmpty:!0},{key:"app-budget-added",valueSchema:new B(new Y),omitEmpty:!0},{key:"app-budget-consumed",valueSchema:new B(new Y),omitEmpty:!0},{key:"failed-at",valueSchema:new B(new He(new Y)),omitEmpty:!0},{key:"failure-message",valueSchema:new B(new Le),omitEmpty:!0},{key:"unnamed-resources-accessed",valueSchema:new B(Yo.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({txnResults:e,appBudgetAdded:t,appBudgetConsumed:r,failedAt:i,failureMessage:o,unnamedResourcesAccessed:s}){this.txnResults=e,this.appBudgetAdded=typeof t>"u"?void 0:Xe(t),this.appBudgetConsumed=typeof r>"u"?void 0:Xe(r),this.failedAt=typeof i>"u"?void 0:i.map(Xe),this.failureMessage=o,this.unnamedResourcesAccessed=s}getEncodingSchema(){return Xc.encodingSchema}toEncodingData(){return new Map([["txn-results",this.txnResults.map(e=>e.toEncodingData())],["app-budget-added",this.appBudgetAdded],["app-budget-consumed",this.appBudgetConsumed],["failed-at",this.failedAt],["failure-message",this.failureMessage],["unnamed-resources-accessed",typeof this.unnamedResourcesAccessed<"u"?this.unnamedResourcesAccessed.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateTransactionGroupResult: ${e}`);return new Xc({txnResults:(e.get("txn-results")??[]).map(t=>Qc.fromEncodingData(t)),appBudgetAdded:e.get("app-budget-added"),appBudgetConsumed:e.get("app-budget-consumed"),failedAt:e.get("failed-at"),failureMessage:e.get("failure-message"),unnamedResourcesAccessed:typeof e.get("unnamed-resources-accessed")<"u"?Yo.fromEncodingData(e.get("unnamed-resources-accessed")):void 0})}}class Qc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"txn-result",valueSchema:Wi.encodingSchema,omitEmpty:!0},{key:"app-budget-consumed",valueSchema:new B(new Y),omitEmpty:!0},{key:"exec-trace",valueSchema:new B(Oo.encodingSchema),omitEmpty:!0},{key:"fixed-signer",valueSchema:new B(new Le),omitEmpty:!0},{key:"logic-sig-budget-consumed",valueSchema:new B(new Y),omitEmpty:!0},{key:"unnamed-resources-accessed",valueSchema:new B(Yo.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({txnResult:e,appBudgetConsumed:t,execTrace:r,fixedSigner:i,logicSigBudgetConsumed:o,unnamedResourcesAccessed:s}){this.txnResult=e,this.appBudgetConsumed=typeof t>"u"?void 0:Xe(t),this.execTrace=r,this.fixedSigner=typeof i=="string"?Pt.fromString(i):i,this.logicSigBudgetConsumed=typeof o>"u"?void 0:Xe(o),this.unnamedResourcesAccessed=s}getEncodingSchema(){return Qc.encodingSchema}toEncodingData(){return new Map([["txn-result",this.txnResult.toEncodingData()],["app-budget-consumed",this.appBudgetConsumed],["exec-trace",typeof this.execTrace<"u"?this.execTrace.toEncodingData():void 0],["fixed-signer",typeof this.fixedSigner<"u"?this.fixedSigner.toString():void 0],["logic-sig-budget-consumed",this.logicSigBudgetConsumed],["unnamed-resources-accessed",typeof this.unnamedResourcesAccessed<"u"?this.unnamedResourcesAccessed.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateTransactionResult: ${e}`);return new Qc({txnResult:Wi.fromEncodingData(e.get("txn-result")??new Map),appBudgetConsumed:e.get("app-budget-consumed"),execTrace:typeof e.get("exec-trace")<"u"?Oo.fromEncodingData(e.get("exec-trace")):void 0,fixedSigner:e.get("fixed-signer"),logicSigBudgetConsumed:e.get("logic-sig-budget-consumed"),unnamedResourcesAccessed:typeof e.get("unnamed-resources-accessed")<"u"?Yo.fromEncodingData(e.get("unnamed-resources-accessed")):void 0})}}class Yo{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"accounts",valueSchema:new B(new He(new Le)),omitEmpty:!0},{key:"app-locals",valueSchema:new B(new He(Vc.encodingSchema)),omitEmpty:!0},{key:"apps",valueSchema:new B(new He(new Y)),omitEmpty:!0},{key:"asset-holdings",valueSchema:new B(new He(Lc.encodingSchema)),omitEmpty:!0},{key:"assets",valueSchema:new B(new He(new Y)),omitEmpty:!0},{key:"boxes",valueSchema:new B(new He(Xv.encodingSchema)),omitEmpty:!0},{key:"extra-box-refs",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({accounts:e,appLocals:t,apps:r,assetHoldings:i,assets:o,boxes:s,extraBoxRefs:a}){this.accounts=typeof e<"u"?e.map(l=>typeof l=="string"?Pt.fromString(l):l):void 0,this.appLocals=t,this.apps=typeof r>"u"?void 0:r.map(Pe),this.assetHoldings=i,this.assets=typeof o>"u"?void 0:o.map(Pe),this.boxes=s,this.extraBoxRefs=typeof a>"u"?void 0:Xe(a)}getEncodingSchema(){return Yo.encodingSchema}toEncodingData(){return new Map([["accounts",typeof this.accounts<"u"?this.accounts.map(e=>e.toString()):void 0],["app-locals",typeof this.appLocals<"u"?this.appLocals.map(e=>e.toEncodingData()):void 0],["apps",this.apps],["asset-holdings",typeof this.assetHoldings<"u"?this.assetHoldings.map(e=>e.toEncodingData()):void 0],["assets",this.assets],["boxes",typeof this.boxes<"u"?this.boxes.map(e=>e.toEncodingData()):void 0],["extra-box-refs",this.extraBoxRefs]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulateUnnamedResourcesAccessed: ${e}`);return new Yo({accounts:e.get("accounts"),appLocals:typeof e.get("app-locals")<"u"?e.get("app-locals").map(t=>Vc.fromEncodingData(t)):void 0,apps:e.get("apps"),assetHoldings:typeof e.get("asset-holdings")<"u"?e.get("asset-holdings").map(t=>Lc.fromEncodingData(t)):void 0,assets:e.get("assets"),boxes:typeof e.get("boxes")<"u"?e.get("boxes").map(t=>Xv.fromEncodingData(t)):void 0,extraBoxRefs:e.get("extra-box-refs")})}}class Zc{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"allow-empty-signatures",valueSchema:new B(new _t),omitEmpty:!0},{key:"allow-unnamed-resources",valueSchema:new B(new _t),omitEmpty:!0},{key:"extra-opcode-budget",valueSchema:new B(new Y),omitEmpty:!0},{key:"fix-signers",valueSchema:new B(new _t),omitEmpty:!0},{key:"max-log-calls",valueSchema:new B(new Y),omitEmpty:!0},{key:"max-log-size",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({allowEmptySignatures:e,allowUnnamedResources:t,extraOpcodeBudget:r,fixSigners:i,maxLogCalls:o,maxLogSize:s}){this.allowEmptySignatures=e,this.allowUnnamedResources=t,this.extraOpcodeBudget=typeof r>"u"?void 0:Xe(r),this.fixSigners=i,this.maxLogCalls=typeof o>"u"?void 0:Xe(o),this.maxLogSize=typeof s>"u"?void 0:Xe(s)}getEncodingSchema(){return Zc.encodingSchema}toEncodingData(){return new Map([["allow-empty-signatures",this.allowEmptySignatures],["allow-unnamed-resources",this.allowUnnamedResources],["extra-opcode-budget",this.extraOpcodeBudget],["fix-signers",this.fixSigners],["max-log-calls",this.maxLogCalls],["max-log-size",this.maxLogSize]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulationEvalOverrides: ${e}`);return new Zc({allowEmptySignatures:e.get("allow-empty-signatures"),allowUnnamedResources:e.get("allow-unnamed-resources"),extraOpcodeBudget:e.get("extra-opcode-budget"),fixSigners:e.get("fix-signers"),maxLogCalls:e.get("max-log-calls"),maxLogSize:e.get("max-log-size")})}}class xi{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"pc",valueSchema:new Y,omitEmpty:!0},{key:"scratch-changes",valueSchema:new B(new He(Wc.encodingSchema)),omitEmpty:!0},{key:"spawned-inners",valueSchema:new B(new He(new Y)),omitEmpty:!0},{key:"stack-additions",valueSchema:new B(new He(Kr.encodingSchema)),omitEmpty:!0},{key:"stack-pop-count",valueSchema:new B(new Y),omitEmpty:!0},{key:"state-changes",valueSchema:new B(new He(Nc.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({pc:e,scratchChanges:t,spawnedInners:r,stackAdditions:i,stackPopCount:o,stateChanges:s}){this.pc=Xe(e),this.scratchChanges=t,this.spawnedInners=typeof r>"u"?void 0:r.map(Xe),this.stackAdditions=i,this.stackPopCount=typeof o>"u"?void 0:Xe(o),this.stateChanges=s}getEncodingSchema(){return xi.encodingSchema}toEncodingData(){return new Map([["pc",this.pc],["scratch-changes",typeof this.scratchChanges<"u"?this.scratchChanges.map(e=>e.toEncodingData()):void 0],["spawned-inners",this.spawnedInners],["stack-additions",typeof this.stackAdditions<"u"?this.stackAdditions.map(e=>e.toEncodingData()):void 0],["stack-pop-count",this.stackPopCount],["state-changes",typeof this.stateChanges<"u"?this.stateChanges.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulationOpcodeTraceUnit: ${e}`);return new xi({pc:e.get("pc"),scratchChanges:typeof e.get("scratch-changes")<"u"?e.get("scratch-changes").map(t=>Wc.fromEncodingData(t)):void 0,spawnedInners:e.get("spawned-inners"),stackAdditions:typeof e.get("stack-additions")<"u"?e.get("stack-additions").map(t=>Kr.fromEncodingData(t)):void 0,stackPopCount:e.get("stack-pop-count"),stateChanges:typeof e.get("state-changes")<"u"?e.get("state-changes").map(t=>Nc.fromEncodingData(t)):void 0})}}class Oo{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"approval-program-hash",valueSchema:new B(new Je),omitEmpty:!0},{key:"approval-program-trace",valueSchema:new B(new He(xi.encodingSchema)),omitEmpty:!0},{key:"clear-state-program-hash",valueSchema:new B(new Je),omitEmpty:!0},{key:"clear-state-program-trace",valueSchema:new B(new He(xi.encodingSchema)),omitEmpty:!0},{key:"clear-state-rollback",valueSchema:new B(new _t),omitEmpty:!0},{key:"clear-state-rollback-error",valueSchema:new B(new Le),omitEmpty:!0},{key:"inner-trace",valueSchema:new B(new He(Oo.encodingSchema)),omitEmpty:!0},{key:"logic-sig-hash",valueSchema:new B(new Je),omitEmpty:!0},{key:"logic-sig-trace",valueSchema:new B(new He(xi.encodingSchema)),omitEmpty:!0})),this.encodingSchemaValue}constructor({approvalProgramHash:e,approvalProgramTrace:t,clearStateProgramHash:r,clearStateProgramTrace:i,clearStateRollback:o,clearStateRollbackError:s,innerTrace:a,logicSigHash:l,logicSigTrace:c}){this.approvalProgramHash=typeof e=="string"?lt(e):e,this.approvalProgramTrace=t,this.clearStateProgramHash=typeof r=="string"?lt(r):r,this.clearStateProgramTrace=i,this.clearStateRollback=o,this.clearStateRollbackError=s,this.innerTrace=a,this.logicSigHash=typeof l=="string"?lt(l):l,this.logicSigTrace=c}getEncodingSchema(){return Oo.encodingSchema}toEncodingData(){return new Map([["approval-program-hash",this.approvalProgramHash],["approval-program-trace",typeof this.approvalProgramTrace<"u"?this.approvalProgramTrace.map(e=>e.toEncodingData()):void 0],["clear-state-program-hash",this.clearStateProgramHash],["clear-state-program-trace",typeof this.clearStateProgramTrace<"u"?this.clearStateProgramTrace.map(e=>e.toEncodingData()):void 0],["clear-state-rollback",this.clearStateRollback],["clear-state-rollback-error",this.clearStateRollbackError],["inner-trace",typeof this.innerTrace<"u"?this.innerTrace.map(e=>e.toEncodingData()):void 0],["logic-sig-hash",this.logicSigHash],["logic-sig-trace",typeof this.logicSigTrace<"u"?this.logicSigTrace.map(e=>e.toEncodingData()):void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SimulationTransactionExecTrace: ${e}`);return new Oo({approvalProgramHash:e.get("approval-program-hash"),approvalProgramTrace:typeof e.get("approval-program-trace")<"u"?e.get("approval-program-trace").map(t=>xi.fromEncodingData(t)):void 0,clearStateProgramHash:e.get("clear-state-program-hash"),clearStateProgramTrace:typeof e.get("clear-state-program-trace")<"u"?e.get("clear-state-program-trace").map(t=>xi.fromEncodingData(t)):void 0,clearStateRollback:e.get("clear-state-rollback"),clearStateRollbackError:e.get("clear-state-rollback-error"),innerTrace:typeof e.get("inner-trace")<"u"?e.get("inner-trace").map(t=>Oo.fromEncodingData(t)):void 0,logicSigHash:e.get("logic-sig-hash"),logicSigTrace:typeof e.get("logic-sig-trace")<"u"?e.get("logic-sig-trace").map(t=>xi.fromEncodingData(t)):void 0})}}let sF=class sx{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"Message",valueSchema:eu.encodingSchema,omitEmpty:!0},{key:"StateProof",valueSchema:new Je,omitEmpty:!0})),this.encodingSchemaValue}constructor({message:e,stateproof:t}){this.message=e,this.stateproof=typeof t=="string"?lt(t):t}getEncodingSchema(){return sx.encodingSchema}toEncodingData(){return new Map([["Message",this.message.toEncodingData()],["StateProof",this.stateproof]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProof: ${e}`);return new sx({message:eu.fromEncodingData(e.get("Message")??new Map),stateproof:e.get("StateProof")})}};class eu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"BlockHeadersCommitment",valueSchema:new Je,omitEmpty:!0},{key:"FirstAttestedRound",valueSchema:new Y,omitEmpty:!0},{key:"LastAttestedRound",valueSchema:new Y,omitEmpty:!0},{key:"LnProvenWeight",valueSchema:new Y,omitEmpty:!0},{key:"VotersCommitment",valueSchema:new Je,omitEmpty:!0})),this.encodingSchemaValue}constructor({blockheaderscommitment:e,firstattestedround:t,lastattestedround:r,lnprovenweight:i,voterscommitment:o}){this.blockheaderscommitment=typeof e=="string"?lt(e):e,this.firstattestedround=Pe(t),this.lastattestedround=Pe(r),this.lnprovenweight=Pe(i),this.voterscommitment=typeof o=="string"?lt(o):o}getEncodingSchema(){return eu.encodingSchema}toEncodingData(){return new Map([["BlockHeadersCommitment",this.blockheaderscommitment],["FirstAttestedRound",this.firstattestedround],["LastAttestedRound",this.lastattestedround],["LnProvenWeight",this.lnprovenweight],["VotersCommitment",this.voterscommitment]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofMessage: ${e}`);return new eu({blockheaderscommitment:e.get("BlockHeadersCommitment"),firstattestedround:e.get("FirstAttestedRound"),lastattestedround:e.get("LastAttestedRound"),lnprovenweight:e.get("LnProvenWeight"),voterscommitment:e.get("VotersCommitment")})}}class Eh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"current_round",valueSchema:new Y,omitEmpty:!0},{key:"online-money",valueSchema:new Y,omitEmpty:!0},{key:"total-money",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({currentRound:e,onlineMoney:t,totalMoney:r}){this.currentRound=Pe(e),this.onlineMoney=Pe(t),this.totalMoney=Pe(r)}getEncodingSchema(){return Eh.encodingSchema}toEncodingData(){return new Map([["current_round",this.currentRound],["online-money",this.onlineMoney],["total-money",this.totalMoney]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded SupplyResponse: ${e}`);return new Eh({currentRound:e.get("current_round"),onlineMoney:e.get("online-money"),totalMoney:e.get("total-money")})}}let bh=class ax{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"key",valueSchema:new Je,omitEmpty:!0},{key:"value",valueSchema:Ts.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({key:e,value:t}){this.key=typeof e=="string"?lt(e):e,this.value=t}getEncodingSchema(){return ax.encodingSchema}toEncodingData(){return new Map([["key",this.key],["value",this.value.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TealKeyValue: ${e}`);return new ax({key:e.get("key"),value:Ts.fromEncodingData(e.get("value")??new Map)})}},Ts=class cx{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"bytes",valueSchema:new Je,omitEmpty:!0},{key:"type",valueSchema:new Y,omitEmpty:!0},{key:"uint",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({bytes:e,type:t,uint:r}){this.bytes=typeof e=="string"?lt(e):e,this.type=Xe(t),this.uint=Pe(r)}getEncodingSchema(){return cx.encodingSchema}toEncodingData(){return new Map([["bytes",this.bytes],["type",this.type],["uint",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TealValue: ${e}`);return new cx({bytes:e.get("bytes"),type:e.get("type"),uint:e.get("uint")})}};class kh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"Deltas",valueSchema:new He(Hc.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({deltas:e}){this.deltas=e}getEncodingSchema(){return kh.encodingSchema}toEncodingData(){return new Map([["Deltas",this.deltas.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionGroupLedgerStateDeltasForRoundResponse: ${e}`);return new kh({deltas:(e.get("Deltas")??[]).map(t=>Hc.fromEncodingData(t))})}}class Ah{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"consensus-version",valueSchema:new Le,omitEmpty:!0},{key:"fee",valueSchema:new Y,omitEmpty:!0},{key:"genesis-hash",valueSchema:new Je,omitEmpty:!0},{key:"genesis-id",valueSchema:new Le,omitEmpty:!0},{key:"last-round",valueSchema:new Y,omitEmpty:!0},{key:"min-fee",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({consensusVersion:e,fee:t,genesisHash:r,genesisId:i,lastRound:o,minFee:s}){this.consensusVersion=e,this.fee=Pe(t),this.genesisHash=typeof r=="string"?lt(r):r,this.genesisId=i,this.lastRound=Pe(o),this.minFee=Pe(s)}getEncodingSchema(){return Ah.encodingSchema}toEncodingData(){return new Map([["consensus-version",this.consensusVersion],["fee",this.fee],["genesis-hash",this.genesisHash],["genesis-id",this.genesisId],["last-round",this.lastRound],["min-fee",this.minFee]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionParametersResponse: ${e}`);return new Ah({consensusVersion:e.get("consensus-version"),fee:e.get("fee"),genesisHash:e.get("genesis-hash"),genesisId:e.get("genesis-id"),lastRound:e.get("last-round"),minFee:e.get("min-fee")})}}class Dh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"idx",valueSchema:new Y,omitEmpty:!0},{key:"proof",valueSchema:new Je,omitEmpty:!0},{key:"stibhash",valueSchema:new Je,omitEmpty:!0},{key:"treedepth",valueSchema:new Y,omitEmpty:!0},{key:"hashtype",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({idx:e,proof:t,stibhash:r,treedepth:i,hashtype:o}){this.idx=Xe(e),this.proof=typeof t=="string"?lt(t):t,this.stibhash=typeof r=="string"?lt(r):r,this.treedepth=Xe(i),this.hashtype=o}getEncodingSchema(){return Dh.encodingSchema}toEncodingData(){return new Map([["idx",this.idx],["proof",this.proof],["stibhash",this.stibhash],["treedepth",this.treedepth],["hashtype",this.hashtype]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionProof: ${e}`);return new Dh({idx:e.get("idx"),proof:e.get("proof"),stibhash:e.get("stibhash"),treedepth:e.get("treedepth"),hashtype:e.get("hashtype")})}}class Fh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"build",valueSchema:jc.encodingSchema,omitEmpty:!0},{key:"genesis_hash_b64",valueSchema:new Je,omitEmpty:!0},{key:"genesis_id",valueSchema:new Le,omitEmpty:!0},{key:"versions",valueSchema:new He(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({build:e,genesisHashB64:t,genesisId:r,versions:i}){this.build=e,this.genesisHashB64=typeof t=="string"?lt(t):t,this.genesisId=r,this.versions=i}getEncodingSchema(){return Fh.encodingSchema}toEncodingData(){return new Map([["build",this.build.toEncodingData()],["genesis_hash_b64",this.genesisHashB64],["genesis_id",this.genesisId],["versions",this.versions]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Version: ${e}`);return new Fh({build:jc.fromEncodingData(e.get("build")??new Map),genesisHashB64:e.get("genesis_hash_b64"),genesisId:e.get("genesis_id"),versions:e.get("versions")})}}const Q8=Object.freeze(Object.defineProperty({__proto__:null,Account:pf,AccountApplicationResponse:ah,AccountAssetHolding:Pc,AccountAssetResponse:ch,AccountAssetsInformationResponse:mf,AccountParticipation:Nv,AccountStateDelta:uh,AppCallLogs:$c,Application:Oa,ApplicationInitialStates:Bc,ApplicationKVStorage:vi,ApplicationLocalReference:Vc,ApplicationLocalState:lh,ApplicationParams:Oc,ApplicationStateOperation:Nc,ApplicationStateSchema:oi,Asset:yf,AssetHolding:Na,AssetHoldingReference:Lc,AssetParams:La,AvmKeyValue:Uc,AvmValue:Kr,BlockHashResponse:hh,BlockLogsResponse:wf,BlockResponse:dh,BlockTxidsResponse:fh,Box:rF,BoxDescriptor:Jv,BoxReference:Xv,BoxesResponse:iF,BuildVersion:jc,CompileResponse:gh,DisassembleResponse:ph,DryrunRequest:mh,DryrunResponse:yh,DryrunSource:_c,DryrunState:Vo,DryrunTxnResult:zc,ErrorResponse:Y8,EvalDelta:tx,EvalDeltaKeyValue:Ua,Genesis:X8,GenesisAllocation:qc,GetBlockTimeStampOffsetResponse:wh,GetSyncRoundResponse:Sh,LedgerStateDeltaForTransactionGroup:Hc,LightBlockHeaderProof:oF,NodeStatusResponse:Gc,PendingTransactionResponse:Wi,PendingTransactionsResponse:Kc,PostTransactionsResponse:vh,ScratchChange:Wc,SimulateInitialStates:Jc,SimulateRequest:Yc,SimulateRequestTransactionGroup:Wo,SimulateResponse:xh,SimulateTraceConfig:Jo,SimulateTransactionGroupResult:Xc,SimulateTransactionResult:Qc,SimulateUnnamedResourcesAccessed:Yo,SimulationEvalOverrides:Zc,SimulationOpcodeTraceUnit:xi,SimulationTransactionExecTrace:Oo,StateProof:sF,StateProofMessage:eu,SupplyResponse:Eh,TealKeyValue:bh,TealValue:Ts,TransactionGroupLedgerStateDeltasForRoundResponse:kh,TransactionParametersResponse:Ah,TransactionProof:Dh,Version:Fh},Symbol.toStringTag,{value:"Module"}));class Vt{constructor(e){this.c=e,this.query={}}executeRequest(e,t){return this.c.get({relativePath:this.path(),query:this.query,requestHeaders:e,customOptions:t})}async do(e,t){const r=await this.executeRequest(e,t);return this.prepare(r)}async doRaw(e,t){return(await this.executeRequest(e,t)).body}}class Z8 extends Vt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}`}exclude(e){return this.query.exclude=e,this}prepare(e){return Jt(e.getJSONText(),pf)}}class e5 extends Vt{constructor(e,t,r){super(e),this.account=t.toString(),this.assetID=BigInt(r)}path(){return`/v2/accounts/${this.account}/assets/${this.assetID}`}prepare(e){return Jt(e.getJSONText(),ch)}}class t5 extends Vt{constructor(e,t,r){super(e),this.account=t.toString(),this.applicationID=BigInt(r)}path(){return`/v2/accounts/${this.account}/applications/${this.applicationID}`}prepare(e){return Jt(e.getJSONText(),ah)}}let n5=class extends Vt{constructor(e,t){super(e),this.round=BigInt(t),this.query={format:"msgpack"}}path(){return`/v2/blocks/${this.round}`}headerOnly(e){return this.query["header-only"]=e,this}prepare(e){return Tn(e.body,dh)}};function aF(n={}){let e=n;return Object.keys(e).every(t=>t.toLowerCase()!=="content-type")&&(e={...n},e["Content-Type"]="text/plain"),e}class r5 extends Vt{constructor(e,t){super(e),this.source=t}path(){return"/v2/teal/compile"}sourcemap(e=!0){return this.query.sourcemap=e,this}executeRequest(e,t){const r=aF(e);return this.c.post({relativePath:this.path(),data:Ri(this.source),query:this.query,requestHeaders:r,customOptions:t})}prepare(e){return Jt(e.getJSONText(),gh)}}class i5 extends Vt{constructor(e,t){super(e),this.blob=Yr(t)}path(){return"/v2/teal/dryrun"}executeRequest(e,t){const r=aF(e);return this.c.post({relativePath:this.path(),data:this.blob,requestHeaders:r,customOptions:t})}prepare(e){return Jt(e.getJSONText(),yh)}}class o5 extends Vt{path(){return"/genesis"}prepare(e){return e.getJSONText()}}class s5 extends Vt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/assets/${this.index}`}prepare(e){return Jt(e.getJSONText(),yf)}}class a5 extends Vt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/applications/${this.index}`}prepare(e){return Jt(e.getJSONText(),Oa)}}class c5 extends Vt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/blocks/${this.round}/hash`}prepare(e){return Jt(e.getJSONText(),hh)}}class u5 extends Vt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/blocks/${this.round}/txids`}prepare(e){return Jt(e.getJSONText(),fh)}}class l5 extends Vt{constructor(e,t,r){super(e),this.index=BigInt(t);const i=Zn(r);this.query.name=encodeURI(`b64:${i}`)}path(){return`/v2/applications/${this.index}/box`}prepare(e){return Jt(e.getJSONText(),rF)}}class h5 extends Vt{constructor(e,t){super(e),this.index=BigInt(t),this.query.max=0}path(){return`/v2/applications/${this.index}/boxes`}max(e){return this.query.max=e,this}prepare(e){return Jt(e.getJSONText(),iF)}}let d5=class extends Vt{path(){return"/health"}prepare(e){}};class f5 extends Vt{constructor(e,t){super(e),this.txid=t,this.query.format="msgpack"}prepare(e){return Tn(e.body,Wi)}path(){return`/v2/transactions/pending/${this.txid}`}max(e){return this.query.max=e,this}}class g5 extends Vt{constructor(e){super(e),this.query.format="msgpack"}path(){return"/v2/transactions/pending"}prepare(e){return Tn(e.body,Kc)}max(e){return this.query.max=e,this}}class p5 extends Vt{constructor(e,t){super(e),this.address=t.toString(),this.query.format="msgpack"}prepare(e){return Tn(e.body,Kc)}path(){return`/v2/accounts/${this.address}/transactions/pending`}max(e){return this.query.max=e,this}}class m5 extends Vt{constructor(e,t,r){super(e),this.txID=r,this.round=BigInt(t)}path(){return`/v2/blocks/${this.round}/transactions/${this.txID}/proof`}hashType(e){return this.query.hashtype=e,this}prepare(e){return Jt(e.getJSONText(),Dh)}}function y5(n={}){let e=n;return Object.keys(e).every(t=>t.toLowerCase()!=="content-type")&&(e={...n},e["Content-Type"]="application/x-binary"),e}function yb(n){return n&&n.byteLength!==void 0}class w5 extends Vt{constructor(e,t){super(e);let r=t;if(Array.isArray(t)){if(!t.every(yb))throw new TypeError("Array elements must be byte arrays");r=jn(...t)}else if(!yb(r))throw new TypeError("Argument must be byte array");this.txnBytesToPost=r}path(){return"/v2/transactions"}executeRequest(e,t){const r=y5(e);return this.c.post({relativePath:this.path(),data:this.txnBytesToPost,requestHeaders:r,customOptions:t})}prepare(e){return Jt(e.getJSONText(),vh)}}class S5 extends Vt{path(){return"/v2/status"}prepare(e){return Jt(e.getJSONText(),Gc)}}class v5 extends Vt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/status/wait-for-block-after/${this.round}`}prepare(e){return Jt(e.getJSONText(),Gc)}}class x5 extends Vt{path(){return"/v2/transactions/params"}prepare(e){const t=Jt(e.getJSONText(),Ah);return{flatFee:!1,fee:t.fee,firstValid:t.lastRound,lastValid:t.lastRound+BigInt(1e3),genesisID:t.genesisId,genesisHash:t.genesisHash,minFee:t.minFee,consensusVersion:t.consensusVersion}}}class E5 extends Vt{path(){return"/v2/ledger/supply"}prepare(e){return Jt(e.getJSONText(),Eh)}}class b5 extends Vt{path(){return"/versions"}prepare(e){return Jt(e.getJSONText(),Fh)}}class k5 extends Vt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/blocks/${this.round}/lightheader/proof`}prepare(e){return Jt(e.getJSONText(),oF)}}class A5 extends Vt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/stateproofs/${this.round}`}prepare(e){return Jt(e.getJSONText(),sF)}}class D5 extends Vt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/ledger/sync/${this.round}`}executeRequest(e,t){return this.c.post({relativePath:this.path(),data:null,requestHeaders:e,customOptions:t})}prepare(e){}}class F5 extends Vt{path(){return"/v2/ledger/sync"}prepare(e){return Jt(e.getJSONText(),Sh)}}class T5 extends Vt{constructor(e,t){super(e),this.offset=BigInt(t)}path(){return`/v2/devmode/blocks/offset/${this.offset}`}executeRequest(e,t){return this.c.post({relativePath:this.path(),data:null,requestHeaders:e,customOptions:t})}prepare(e){}}class I5 extends Vt{path(){return"/v2/devmode/blocks/offset"}prepare(e){return Jt(e.getJSONText(),wh)}}function M5(n={}){let e=n;return Object.keys(e).every(t=>t.toLowerCase()!=="content-type")&&(e={...n},e["Content-Type"]="text/plain"),e}class R5 extends Vt{constructor(e,t){super(e),this.source=t}path(){return"/v2/teal/disassemble"}executeRequest(e,t){const r=M5(e);return this.c.post({relativePath:this.path(),data:Ri(this.source),query:this.query,requestHeaders:r,customOptions:t})}prepare(e){return Jt(e.getJSONText(),ph)}}function C5(n={}){let e=n;return Object.keys(e).every(t=>t.toLowerCase()!=="content-type")&&(e={...n},e["Content-Type"]="application/msgpack"),e}class P5 extends Vt{constructor(e,t){super(e),this.query.format="msgpack",this.requestBytes=Yr(t)}path(){return"/v2/transactions/simulate"}executeRequest(e,t){const r=C5(e);return this.c.post({relativePath:this.path(),data:this.requestBytes,query:this.query,requestHeaders:r,customOptions:t})}prepare(e){return Tn(e.body,xh)}}class $5 extends Vt{path(){return"/ready"}prepare(e){}}class B5 extends Vt{path(){return"/v2/ledger/sync"}executeRequest(e,t){return this.c.delete({relativePath:this.path(),data:void 0,requestHeaders:e,customOptions:t})}prepare(e){}}class V5 extends Vt{constructor(e,t){super(e),this.id=t,this.query={format:"msgpack"}}path(){return`/v2/deltas/txn/group/${this.id}`}prepare(e){return Tn(e.body,so)}}class O5 extends Vt{constructor(e,t){super(e),this.round=BigInt(t),this.query={format:"msgpack"}}path(){return`/v2/deltas/${this.round}`}prepare(e){return Tn(e.body,so)}}class N5 extends Vt{constructor(e,t){super(e),this.round=BigInt(t),this.query={format:"msgpack"}}path(){return`/v2/deltas/${this.round}/txn/group`}prepare(e){return Tn(e.body,kh)}}class L5 extends cE{constructor(e,t,r,i={}){super("X-Algo-API-Token",e,t,r,i)}healthCheck(){return new d5(this.c)}versionsCheck(){return new b5(this.c)}sendRawTransaction(e){return new w5(this.c,e)}accountInformation(e){return new Z8(this.c,e)}accountAssetInformation(e,t){return new e5(this.c,e,t)}accountApplicationInformation(e,t){return new t5(this.c,e,t)}block(e){return new n5(this.c,e)}getBlockHash(e){return new c5(this.c,e)}getBlockTxids(e){return new u5(this.c,e)}pendingTransactionInformation(e){return new f5(this.c,e)}pendingTransactionsInformation(){return new g5(this.c)}pendingTransactionByAddress(e){return new p5(this.c,e)}status(){return new S5(this.c)}statusAfterBlock(e){return new v5(this.c,e)}getTransactionParams(){return new x5(this.c)}supply(){return new E5(this.c)}compile(e){return new r5(this.c,e)}disassemble(e){return new R5(this.c,e)}dryrun(e){return new i5(this.c,e)}getAssetByID(e){return new s5(this.c,e)}getApplicationByID(e){return new a5(this.c,e)}getApplicationBoxByName(e,t){return new l5(this.c,e,t)}getApplicationBoxes(e){return new h5(this.c,e)}genesis(){return new o5(this.c)}getTransactionProof(e,t){return new m5(this.c,e,t)}getLightBlockHeaderProof(e){return new k5(this.c,e)}getStateProof(e){return new A5(this.c,e)}simulateRawTransactions(e){const t=[];if(Array.isArray(e))for(const i of e)t.push(Tn(i,Sn));else t.push(Tn(e,Sn));const r=new Yc({txnGroups:[new Wo({txns:t})]});return this.simulateTransactions(r)}simulateTransactions(e){return new P5(this.c,e)}setBlockOffsetTimestamp(e){return new T5(this.c,e)}getBlockOffsetTimestamp(){return new I5(this.c)}setSyncRound(e){return new D5(this.c,e)}unsetSyncRound(){return new B5(this.c)}getSyncRound(){return new F5(this.c)}ready(){return new $5(this.c)}getLedgerStateDeltaForTransactionGroup(e){return new V5(this.c,e)}getLedgerStateDelta(e){return new O5(this.c,e)}getTransactionGroupLedgerStateDeltasForRound(e){return new N5(this.c,e)}}class U5 extends cE{constructor(e,t="http://127.0.0.1",r=7833,i={}){super("X-KMD-API-Token",e,t,r,i)}async get(e){return(await this.c.get({relativePath:e})).parseBodyAsJSON({intDecoding:Vn.SAFE})}async delete(e,t){return(await this.c.delete({relativePath:e,data:t})).parseBodyAsJSON({intDecoding:Vn.SAFE})}async post(e,t){return(await this.c.post({relativePath:e,data:t})).parseBodyAsJSON({intDecoding:Vn.SAFE})}async versions(){return this.get("/versions")}async listWallets(){return this.get("/v1/wallets")}async createWallet(e,t,r=new Uint8Array,i="sqlite"){const o={wallet_name:e,wallet_driver_name:i,wallet_password:t,master_derivation_key:Zn(r)};return this.post("/v1/wallet",o)}async initWalletHandle(e,t){const r={wallet_id:e,wallet_password:t};return this.post("/v1/wallet/init",r)}async releaseWalletHandle(e){const t={wallet_handle_token:e};return this.post("/v1/wallet/release",t)}async renewWalletHandle(e){const t={wallet_handle_token:e};return this.post("/v1/wallet/renew",t)}async renameWallet(e,t,r){const i={wallet_id:e,wallet_password:t,wallet_name:r};return this.post("/v1/wallet/rename",i)}async getWallet(e){const t={wallet_handle_token:e};return this.post("/v1/wallet/info",t)}async exportMasterDerivationKey(e,t){const r={wallet_handle_token:e,wallet_password:t},i=await this.post("/v1/master-key/export",r);return{master_derivation_key:lt(i.master_derivation_key)}}async importKey(e,t){const r={wallet_handle_token:e,private_key:Zn(t)};return this.post("/v1/key/import",r)}async exportKey(e,t,r){const i={wallet_handle_token:e,address:r,wallet_password:t},o=await this.post("/v1/key/export",i);return{private_key:lt(o.private_key)}}async generateKey(e){const t={wallet_handle_token:e,display_mnemonic:!1};return this.post("/v1/key",t)}async deleteKey(e,t,r){const i={wallet_handle_token:e,address:r,wallet_password:t};return this.delete("/v1/key",i)}async listKeys(e){const t={wallet_handle_token:e};return this.post("/v1/key/list",t)}async signTransaction(e,t,r){const i={wallet_handle_token:e,wallet_password:t,transaction:Zn(r.toByte())},o=await this.post("/v1/transaction/sign",i);return lt(o.signed_transaction)}async signTransactionWithSpecificPublicKey(e,t,r,i){const o=Ri(i),s={wallet_handle_token:e,wallet_password:t,transaction:Zn(r.toByte()),public_key:Zn(o)},a=await this.post("/v1/transaction/sign",s);return lt(a.signed_transaction)}async listMultisig(e){const t={wallet_handle_token:e};return this.post("/v1/multisig/list",t)}async importMultisig(e,t,r,i){const o={wallet_handle_token:e,multisig_version:t,threshold:r,pks:i};return this.post("/v1/multisig/import",o)}async exportMultisig(e,t){const r={wallet_handle_token:e,address:t};return this.post("/v1/multisig/export",r)}async signMultisigTransaction(e,t,r,i,o){const s=Ri(i),a={wallet_handle_token:e,transaction:Zn(r.toByte()),public_key:Zn(s),partial_multisig:o,wallet_password:t};return this.post("/v1/multisig/sign",a)}async deleteMultisig(e,t,r){const i={wallet_handle_token:e,address:r,wallet_password:t};return this.delete("/v1/multisig",i)}}class Xo{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Le,omitEmpty:!0},{key:"amount",valueSchema:new Y,omitEmpty:!0},{key:"amount-without-pending-rewards",valueSchema:new Y,omitEmpty:!0},{key:"min-balance",valueSchema:new Y,omitEmpty:!0},{key:"pending-rewards",valueSchema:new Y,omitEmpty:!0},{key:"rewards",valueSchema:new Y,omitEmpty:!0},{key:"round",valueSchema:new Y,omitEmpty:!0},{key:"status",valueSchema:new Le,omitEmpty:!0},{key:"total-apps-opted-in",valueSchema:new Y,omitEmpty:!0},{key:"total-assets-opted-in",valueSchema:new Y,omitEmpty:!0},{key:"total-box-bytes",valueSchema:new Y,omitEmpty:!0},{key:"total-boxes",valueSchema:new Y,omitEmpty:!0},{key:"total-created-apps",valueSchema:new Y,omitEmpty:!0},{key:"total-created-assets",valueSchema:new Y,omitEmpty:!0},{key:"apps-local-state",valueSchema:new B(new He(Qo.encodingSchema)),omitEmpty:!0},{key:"apps-total-extra-pages",valueSchema:new B(new Y),omitEmpty:!0},{key:"apps-total-schema",valueSchema:new B(qr.encodingSchema),omitEmpty:!0},{key:"assets",valueSchema:new B(new He(Zo.encodingSchema)),omitEmpty:!0},{key:"auth-addr",valueSchema:new B(new Le),omitEmpty:!0},{key:"closed-at-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"created-apps",valueSchema:new B(new He(Pi.encodingSchema)),omitEmpty:!0},{key:"created-assets",valueSchema:new B(new He($i.encodingSchema)),omitEmpty:!0},{key:"created-at-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"deleted",valueSchema:new B(new _t),omitEmpty:!0},{key:"incentive-eligible",valueSchema:new B(new _t),omitEmpty:!0},{key:"last-heartbeat",valueSchema:new B(new Y),omitEmpty:!0},{key:"last-proposed",valueSchema:new B(new Y),omitEmpty:!0},{key:"participation",valueSchema:new B(tu.encodingSchema),omitEmpty:!0},{key:"reward-base",valueSchema:new B(new Y),omitEmpty:!0},{key:"sig-type",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,amount:t,amountWithoutPendingRewards:r,minBalance:i,pendingRewards:o,rewards:s,round:a,status:l,totalAppsOptedIn:c,totalAssetsOptedIn:d,totalBoxBytes:f,totalBoxes:m,totalCreatedApps:w,totalCreatedAssets:k,appsLocalState:I,appsTotalExtraPages:x,appsTotalSchema:T,assets:b,authAddr:R,closedAtRound:L,createdApps:G,createdAssets:E,createdAtRound:N,deleted:p,incentiveEligible:F,lastHeartbeat:v,lastProposed:O,participation:C,rewardBase:V,sigType:H}){this.address=e,this.amount=Pe(t),this.amountWithoutPendingRewards=Pe(r),this.minBalance=Xe(i),this.pendingRewards=Pe(o),this.rewards=Pe(s),this.round=Pe(a),this.status=l,this.totalAppsOptedIn=Xe(c),this.totalAssetsOptedIn=Xe(d),this.totalBoxBytes=Xe(f),this.totalBoxes=Xe(m),this.totalCreatedApps=Xe(w),this.totalCreatedAssets=Xe(k),this.appsLocalState=I,this.appsTotalExtraPages=typeof x>"u"?void 0:Xe(x),this.appsTotalSchema=T,this.assets=b,this.authAddr=typeof R=="string"?Pt.fromString(R):R,this.closedAtRound=typeof L>"u"?void 0:Pe(L),this.createdApps=G,this.createdAssets=E,this.createdAtRound=typeof N>"u"?void 0:Pe(N),this.deleted=p,this.incentiveEligible=F,this.lastHeartbeat=typeof v>"u"?void 0:Xe(v),this.lastProposed=typeof O>"u"?void 0:Xe(O),this.participation=C,this.rewardBase=typeof V>"u"?void 0:Pe(V),this.sigType=H}getEncodingSchema(){return Xo.encodingSchema}toEncodingData(){return new Map([["address",this.address],["amount",this.amount],["amount-without-pending-rewards",this.amountWithoutPendingRewards],["min-balance",this.minBalance],["pending-rewards",this.pendingRewards],["rewards",this.rewards],["round",this.round],["status",this.status],["total-apps-opted-in",this.totalAppsOptedIn],["total-assets-opted-in",this.totalAssetsOptedIn],["total-box-bytes",this.totalBoxBytes],["total-boxes",this.totalBoxes],["total-created-apps",this.totalCreatedApps],["total-created-assets",this.totalCreatedAssets],["apps-local-state",typeof this.appsLocalState<"u"?this.appsLocalState.map(e=>e.toEncodingData()):void 0],["apps-total-extra-pages",this.appsTotalExtraPages],["apps-total-schema",typeof this.appsTotalSchema<"u"?this.appsTotalSchema.toEncodingData():void 0],["assets",typeof this.assets<"u"?this.assets.map(e=>e.toEncodingData()):void 0],["auth-addr",typeof this.authAddr<"u"?this.authAddr.toString():void 0],["closed-at-round",this.closedAtRound],["created-apps",typeof this.createdApps<"u"?this.createdApps.map(e=>e.toEncodingData()):void 0],["created-assets",typeof this.createdAssets<"u"?this.createdAssets.map(e=>e.toEncodingData()):void 0],["created-at-round",this.createdAtRound],["deleted",this.deleted],["incentive-eligible",this.incentiveEligible],["last-heartbeat",this.lastHeartbeat],["last-proposed",this.lastProposed],["participation",typeof this.participation<"u"?this.participation.toEncodingData():void 0],["reward-base",this.rewardBase],["sig-type",this.sigType]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Account: ${e}`);return new Xo({address:e.get("address"),amount:e.get("amount"),amountWithoutPendingRewards:e.get("amount-without-pending-rewards"),minBalance:e.get("min-balance"),pendingRewards:e.get("pending-rewards"),rewards:e.get("rewards"),round:e.get("round"),status:e.get("status"),totalAppsOptedIn:e.get("total-apps-opted-in"),totalAssetsOptedIn:e.get("total-assets-opted-in"),totalBoxBytes:e.get("total-box-bytes"),totalBoxes:e.get("total-boxes"),totalCreatedApps:e.get("total-created-apps"),totalCreatedAssets:e.get("total-created-assets"),appsLocalState:typeof e.get("apps-local-state")<"u"?e.get("apps-local-state").map(t=>Qo.fromEncodingData(t)):void 0,appsTotalExtraPages:e.get("apps-total-extra-pages"),appsTotalSchema:typeof e.get("apps-total-schema")<"u"?qr.fromEncodingData(e.get("apps-total-schema")):void 0,assets:typeof e.get("assets")<"u"?e.get("assets").map(t=>Zo.fromEncodingData(t)):void 0,authAddr:e.get("auth-addr"),closedAtRound:e.get("closed-at-round"),createdApps:typeof e.get("created-apps")<"u"?e.get("created-apps").map(t=>Pi.fromEncodingData(t)):void 0,createdAssets:typeof e.get("created-assets")<"u"?e.get("created-assets").map(t=>$i.fromEncodingData(t)):void 0,createdAtRound:e.get("created-at-round"),deleted:e.get("deleted"),incentiveEligible:e.get("incentive-eligible"),lastHeartbeat:e.get("last-heartbeat"),lastProposed:e.get("last-proposed"),participation:typeof e.get("participation")<"u"?tu.fromEncodingData(e.get("participation")):void 0,rewardBase:e.get("reward-base"),sigType:e.get("sig-type")})}}class tu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"selection-participation-key",valueSchema:new Je,omitEmpty:!0},{key:"vote-first-valid",valueSchema:new Y,omitEmpty:!0},{key:"vote-key-dilution",valueSchema:new Y,omitEmpty:!0},{key:"vote-last-valid",valueSchema:new Y,omitEmpty:!0},{key:"vote-participation-key",valueSchema:new Je,omitEmpty:!0},{key:"state-proof-key",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({selectionParticipationKey:e,voteFirstValid:t,voteKeyDilution:r,voteLastValid:i,voteParticipationKey:o,stateProofKey:s}){this.selectionParticipationKey=typeof e=="string"?lt(e):e,this.voteFirstValid=Pe(t),this.voteKeyDilution=Pe(r),this.voteLastValid=Pe(i),this.voteParticipationKey=typeof o=="string"?lt(o):o,this.stateProofKey=typeof s=="string"?lt(s):s}getEncodingSchema(){return tu.encodingSchema}toEncodingData(){return new Map([["selection-participation-key",this.selectionParticipationKey],["vote-first-valid",this.voteFirstValid],["vote-key-dilution",this.voteKeyDilution],["vote-last-valid",this.voteLastValid],["vote-participation-key",this.voteParticipationKey],["state-proof-key",this.stateProofKey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountParticipation: ${e}`);return new tu({selectionParticipationKey:e.get("selection-participation-key"),voteFirstValid:e.get("vote-first-valid"),voteKeyDilution:e.get("vote-key-dilution"),voteLastValid:e.get("vote-last-valid"),voteParticipationKey:e.get("vote-participation-key"),stateProofKey:e.get("state-proof-key")})}}class Th{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"account",valueSchema:Xo.encodingSchema,omitEmpty:!0},{key:"current-round",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({account:e,currentRound:t}){this.account=e,this.currentRound=Pe(t)}getEncodingSchema(){return Th.encodingSchema}toEncodingData(){return new Map([["account",this.account.toEncodingData()],["current-round",this.currentRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountResponse: ${e}`);return new Th({account:Xo.fromEncodingData(e.get("account")??new Map),currentRound:e.get("current-round")})}}class nu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Le,omitEmpty:!0},{key:"delta",valueSchema:new He(ns.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,delta:t}){this.address=e,this.delta=t}getEncodingSchema(){return nu.encodingSchema}toEncodingData(){return new Map([["address",this.address],["delta",this.delta.map(e=>e.toEncodingData())]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountStateDelta: ${e}`);return new nu({address:e.get("address"),delta:(e.get("delta")??[]).map(t=>ns.fromEncodingData(t))})}}class Ih{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"accounts",valueSchema:new He(Xo.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({accounts:e,currentRound:t,nextToken:r}){this.accounts=e,this.currentRound=Pe(t),this.nextToken=r}getEncodingSchema(){return Ih.encodingSchema}toEncodingData(){return new Map([["accounts",this.accounts.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AccountsResponse: ${e}`);return new Ih({accounts:(e.get("accounts")??[]).map(t=>Xo.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}}class Pi{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"id",valueSchema:new Y,omitEmpty:!0},{key:"params",valueSchema:iu.encodingSchema,omitEmpty:!0},{key:"created-at-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"deleted",valueSchema:new B(new _t),omitEmpty:!0},{key:"deleted-at-round",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({id:e,params:t,createdAtRound:r,deleted:i,deletedAtRound:o}){this.id=Pe(e),this.params=t,this.createdAtRound=typeof r>"u"?void 0:Pe(r),this.deleted=i,this.deletedAtRound=typeof o>"u"?void 0:Pe(o)}getEncodingSchema(){return Pi.encodingSchema}toEncodingData(){return new Map([["id",this.id],["params",this.params.toEncodingData()],["created-at-round",this.createdAtRound],["deleted",this.deleted],["deleted-at-round",this.deletedAtRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Application: ${e}`);return new Pi({id:e.get("id"),params:iu.fromEncodingData(e.get("params")??new Map),createdAtRound:e.get("created-at-round"),deleted:e.get("deleted"),deletedAtRound:e.get("deleted-at-round")})}}class Qo{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"id",valueSchema:new Y,omitEmpty:!0},{key:"schema",valueSchema:qr.encodingSchema,omitEmpty:!0},{key:"closed-out-at-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"deleted",valueSchema:new B(new _t),omitEmpty:!0},{key:"key-value",valueSchema:new B(new He(rs.encodingSchema)),omitEmpty:!0},{key:"opted-in-at-round",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({id:e,schema:t,closedOutAtRound:r,deleted:i,keyValue:o,optedInAtRound:s}){this.id=Pe(e),this.schema=t,this.closedOutAtRound=typeof r>"u"?void 0:Pe(r),this.deleted=i,this.keyValue=o,this.optedInAtRound=typeof s>"u"?void 0:Pe(s)}getEncodingSchema(){return Qo.encodingSchema}toEncodingData(){return new Map([["id",this.id],["schema",this.schema.toEncodingData()],["closed-out-at-round",this.closedOutAtRound],["deleted",this.deleted],["key-value",typeof this.keyValue<"u"?this.keyValue.map(e=>e.toEncodingData()):void 0],["opted-in-at-round",this.optedInAtRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLocalState: ${e}`);return new Qo({id:e.get("id"),schema:qr.fromEncodingData(e.get("schema")??new Map),closedOutAtRound:e.get("closed-out-at-round"),deleted:e.get("deleted"),keyValue:typeof e.get("key-value")<"u"?e.get("key-value").map(t=>rs.fromEncodingData(t)):void 0,optedInAtRound:e.get("opted-in-at-round")})}}class Mh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"apps-local-states",valueSchema:new He(Qo.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({appsLocalStates:e,currentRound:t,nextToken:r}){this.appsLocalStates=e,this.currentRound=Pe(t),this.nextToken=r}getEncodingSchema(){return Mh.encodingSchema}toEncodingData(){return new Map([["apps-local-states",this.appsLocalStates.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLocalStatesResponse: ${e}`);return new Mh({appsLocalStates:(e.get("apps-local-states")??[]).map(t=>Qo.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}}class ru{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"logs",valueSchema:new He(new Je),omitEmpty:!0},{key:"txid",valueSchema:new Le,omitEmpty:!0})),this.encodingSchemaValue}constructor({logs:e,txid:t}){this.logs=e,this.txid=t}getEncodingSchema(){return ru.encodingSchema}toEncodingData(){return new Map([["logs",this.logs],["txid",this.txid]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLogData: ${e}`);return new ru({logs:e.get("logs"),txid:e.get("txid")})}}class Rh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"application-id",valueSchema:new Y,omitEmpty:!0},{key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"log-data",valueSchema:new B(new He(ru.encodingSchema)),omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({applicationId:e,currentRound:t,logData:r,nextToken:i}){this.applicationId=Pe(e),this.currentRound=Pe(t),this.logData=r,this.nextToken=i}getEncodingSchema(){return Rh.encodingSchema}toEncodingData(){return new Map([["application-id",this.applicationId],["current-round",this.currentRound],["log-data",typeof this.logData<"u"?this.logData.map(e=>e.toEncodingData()):void 0],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationLogsResponse: ${e}`);return new Rh({applicationId:e.get("application-id"),currentRound:e.get("current-round"),logData:typeof e.get("log-data")<"u"?e.get("log-data").map(t=>ru.fromEncodingData(t)):void 0,nextToken:e.get("next-token")})}}class iu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"approval-program",valueSchema:new Je,omitEmpty:!0},{key:"clear-state-program",valueSchema:new Je,omitEmpty:!0},{key:"creator",valueSchema:new B(new Le),omitEmpty:!0},{key:"extra-program-pages",valueSchema:new B(new Y),omitEmpty:!0},{key:"global-state",valueSchema:new B(new He(rs.encodingSchema)),omitEmpty:!0},{key:"global-state-schema",valueSchema:new B(qr.encodingSchema),omitEmpty:!0},{key:"local-state-schema",valueSchema:new B(qr.encodingSchema),omitEmpty:!0},{key:"version",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({approvalProgram:e,clearStateProgram:t,creator:r,extraProgramPages:i,globalState:o,globalStateSchema:s,localStateSchema:a,version:l}){this.approvalProgram=typeof e=="string"?lt(e):e,this.clearStateProgram=typeof t=="string"?lt(t):t,this.creator=typeof r=="string"?Pt.fromString(r):r,this.extraProgramPages=typeof i>"u"?void 0:Xe(i),this.globalState=o,this.globalStateSchema=s,this.localStateSchema=a,this.version=typeof l>"u"?void 0:Xe(l)}getEncodingSchema(){return iu.encodingSchema}toEncodingData(){return new Map([["approval-program",this.approvalProgram],["clear-state-program",this.clearStateProgram],["creator",typeof this.creator<"u"?this.creator.toString():void 0],["extra-program-pages",this.extraProgramPages],["global-state",typeof this.globalState<"u"?this.globalState.map(e=>e.toEncodingData()):void 0],["global-state-schema",typeof this.globalStateSchema<"u"?this.globalStateSchema.toEncodingData():void 0],["local-state-schema",typeof this.localStateSchema<"u"?this.localStateSchema.toEncodingData():void 0],["version",this.version]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationParams: ${e}`);return new iu({approvalProgram:e.get("approval-program"),clearStateProgram:e.get("clear-state-program"),creator:e.get("creator"),extraProgramPages:e.get("extra-program-pages"),globalState:typeof e.get("global-state")<"u"?e.get("global-state").map(t=>rs.fromEncodingData(t)):void 0,globalStateSchema:typeof e.get("global-state-schema")<"u"?qr.fromEncodingData(e.get("global-state-schema")):void 0,localStateSchema:typeof e.get("local-state-schema")<"u"?qr.fromEncodingData(e.get("local-state-schema")):void 0,version:e.get("version")})}}class Ch{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"application",valueSchema:new B(Pi.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({currentRound:e,application:t}){this.currentRound=Pe(e),this.application=t}getEncodingSchema(){return Ch.encodingSchema}toEncodingData(){return new Map([["current-round",this.currentRound],["application",typeof this.application<"u"?this.application.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationResponse: ${e}`);return new Ch({currentRound:e.get("current-round"),application:typeof e.get("application")<"u"?Pi.fromEncodingData(e.get("application")):void 0})}}class qr{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"num-byte-slice",valueSchema:new Y,omitEmpty:!0},{key:"num-uint",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({numByteSlice:e,numUint:t}){this.numByteSlice=Xe(e),this.numUint=Xe(t)}getEncodingSchema(){return qr.encodingSchema}toEncodingData(){return new Map([["num-byte-slice",this.numByteSlice],["num-uint",this.numUint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationStateSchema: ${e}`);return new qr({numByteSlice:e.get("num-byte-slice"),numUint:e.get("num-uint")})}}class ou{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"applications",valueSchema:new He(Pi.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({applications:e,currentRound:t,nextToken:r}){this.applications=e,this.currentRound=Pe(t),this.nextToken=r}getEncodingSchema(){return ou.encodingSchema}toEncodingData(){return new Map([["applications",this.applications.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ApplicationsResponse: ${e}`);return new ou({applications:(e.get("applications")??[]).map(t=>Pi.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}}class $i{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"index",valueSchema:new Y,omitEmpty:!0},{key:"params",valueSchema:es.encodingSchema,omitEmpty:!0},{key:"created-at-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"deleted",valueSchema:new B(new _t),omitEmpty:!0},{key:"destroyed-at-round",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({index:e,params:t,createdAtRound:r,deleted:i,destroyedAtRound:o}){this.index=Pe(e),this.params=t,this.createdAtRound=typeof r>"u"?void 0:Pe(r),this.deleted=i,this.destroyedAtRound=typeof o>"u"?void 0:Pe(o)}getEncodingSchema(){return $i.encodingSchema}toEncodingData(){return new Map([["index",this.index],["params",this.params.toEncodingData()],["created-at-round",this.createdAtRound],["deleted",this.deleted],["destroyed-at-round",this.destroyedAtRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Asset: ${e}`);return new $i({index:e.get("index"),params:es.fromEncodingData(e.get("params")??new Map),createdAtRound:e.get("created-at-round"),deleted:e.get("deleted"),destroyedAtRound:e.get("destroyed-at-round")})}}class Ph{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"balances",valueSchema:new He(yu.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({balances:e,currentRound:t,nextToken:r}){this.balances=e,this.currentRound=Pe(t),this.nextToken=r}getEncodingSchema(){return Ph.encodingSchema}toEncodingData(){return new Map([["balances",this.balances.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetBalancesResponse: ${e}`);return new Ph({balances:(e.get("balances")??[]).map(t=>yu.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}}class Zo{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"amount",valueSchema:new Y,omitEmpty:!0},{key:"asset-id",valueSchema:new Y,omitEmpty:!0},{key:"is-frozen",valueSchema:new _t,omitEmpty:!0},{key:"deleted",valueSchema:new B(new _t),omitEmpty:!0},{key:"opted-in-at-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"opted-out-at-round",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({amount:e,assetId:t,isFrozen:r,deleted:i,optedInAtRound:o,optedOutAtRound:s}){this.amount=Pe(e),this.assetId=Pe(t),this.isFrozen=r,this.deleted=i,this.optedInAtRound=typeof o>"u"?void 0:Pe(o),this.optedOutAtRound=typeof s>"u"?void 0:Pe(s)}getEncodingSchema(){return Zo.encodingSchema}toEncodingData(){return new Map([["amount",this.amount],["asset-id",this.assetId],["is-frozen",this.isFrozen],["deleted",this.deleted],["opted-in-at-round",this.optedInAtRound],["opted-out-at-round",this.optedOutAtRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHolding: ${e}`);return new Zo({amount:e.get("amount"),assetId:e.get("asset-id"),isFrozen:e.get("is-frozen"),deleted:e.get("deleted"),optedInAtRound:e.get("opted-in-at-round"),optedOutAtRound:e.get("opted-out-at-round")})}}class $h{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"assets",valueSchema:new He(Zo.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({assets:e,currentRound:t,nextToken:r}){this.assets=e,this.currentRound=Pe(t),this.nextToken=r}getEncodingSchema(){return $h.encodingSchema}toEncodingData(){return new Map([["assets",this.assets.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetHoldingsResponse: ${e}`);return new $h({assets:(e.get("assets")??[]).map(t=>Zo.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}}class es{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"creator",valueSchema:new Le,omitEmpty:!0},{key:"decimals",valueSchema:new Y,omitEmpty:!0},{key:"total",valueSchema:new Y,omitEmpty:!0},{key:"clawback",valueSchema:new B(new Le),omitEmpty:!0},{key:"default-frozen",valueSchema:new B(new _t),omitEmpty:!0},{key:"freeze",valueSchema:new B(new Le),omitEmpty:!0},{key:"manager",valueSchema:new B(new Le),omitEmpty:!0},{key:"metadata-hash",valueSchema:new B(new Je),omitEmpty:!0},{key:"name",valueSchema:new B(new Le),omitEmpty:!0},{key:"name-b64",valueSchema:new B(new Je),omitEmpty:!0},{key:"reserve",valueSchema:new B(new Le),omitEmpty:!0},{key:"unit-name",valueSchema:new B(new Le),omitEmpty:!0},{key:"unit-name-b64",valueSchema:new B(new Je),omitEmpty:!0},{key:"url",valueSchema:new B(new Le),omitEmpty:!0},{key:"url-b64",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({creator:e,decimals:t,total:r,clawback:i,defaultFrozen:o,freeze:s,manager:a,metadataHash:l,name:c,nameB64:d,reserve:f,unitName:m,unitNameB64:w,url:k,urlB64:I}){this.creator=e,this.decimals=Xe(t),this.total=Pe(r),this.clawback=i,this.defaultFrozen=o,this.freeze=s,this.manager=a,this.metadataHash=typeof l=="string"?lt(l):l,this.name=c,this.nameB64=typeof d=="string"?lt(d):d,this.reserve=f,this.unitName=m,this.unitNameB64=typeof w=="string"?lt(w):w,this.url=k,this.urlB64=typeof I=="string"?lt(I):I}getEncodingSchema(){return es.encodingSchema}toEncodingData(){return new Map([["creator",this.creator],["decimals",this.decimals],["total",this.total],["clawback",this.clawback],["default-frozen",this.defaultFrozen],["freeze",this.freeze],["manager",this.manager],["metadata-hash",this.metadataHash],["name",this.name],["name-b64",this.nameB64],["reserve",this.reserve],["unit-name",this.unitName],["unit-name-b64",this.unitNameB64],["url",this.url],["url-b64",this.urlB64]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetParams: ${e}`);return new es({creator:e.get("creator"),decimals:e.get("decimals"),total:e.get("total"),clawback:e.get("clawback"),defaultFrozen:e.get("default-frozen"),freeze:e.get("freeze"),manager:e.get("manager"),metadataHash:e.get("metadata-hash"),name:e.get("name"),nameB64:e.get("name-b64"),reserve:e.get("reserve"),unitName:e.get("unit-name"),unitNameB64:e.get("unit-name-b64"),url:e.get("url"),urlB64:e.get("url-b64")})}}class Bh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"asset",valueSchema:$i.encodingSchema,omitEmpty:!0},{key:"current-round",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({asset:e,currentRound:t}){this.asset=e,this.currentRound=Pe(t)}getEncodingSchema(){return Bh.encodingSchema}toEncodingData(){return new Map([["asset",this.asset.toEncodingData()],["current-round",this.currentRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetResponse: ${e}`);return new Bh({asset:$i.fromEncodingData(e.get("asset")??new Map),currentRound:e.get("current-round")})}}class su{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"assets",valueSchema:new He($i.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({assets:e,currentRound:t,nextToken:r}){this.assets=e,this.currentRound=Pe(t),this.nextToken=r}getEncodingSchema(){return su.encodingSchema}toEncodingData(){return new Map([["assets",this.assets.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded AssetsResponse: ${e}`);return new su({assets:(e.get("assets")??[]).map(t=>$i.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}}class ja{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"genesis-hash",valueSchema:new Je,omitEmpty:!0},{key:"genesis-id",valueSchema:new Le,omitEmpty:!0},{key:"previous-block-hash",valueSchema:new Je,omitEmpty:!0},{key:"round",valueSchema:new Y,omitEmpty:!0},{key:"seed",valueSchema:new Je,omitEmpty:!0},{key:"timestamp",valueSchema:new Y,omitEmpty:!0},{key:"transactions-root",valueSchema:new Je,omitEmpty:!0},{key:"transactions-root-sha256",valueSchema:new Je,omitEmpty:!0},{key:"bonus",valueSchema:new B(new Y),omitEmpty:!0},{key:"fees-collected",valueSchema:new B(new Y),omitEmpty:!0},{key:"participation-updates",valueSchema:new B(wu.encodingSchema),omitEmpty:!0},{key:"previous-block-hash-512",valueSchema:new B(new Je),omitEmpty:!0},{key:"proposer",valueSchema:new B(new Le),omitEmpty:!0},{key:"proposer-payout",valueSchema:new B(new Y),omitEmpty:!0},{key:"rewards",valueSchema:new B(au.encodingSchema),omitEmpty:!0},{key:"state-proof-tracking",valueSchema:new B(new He(Au.encodingSchema)),omitEmpty:!0},{key:"transactions",valueSchema:new B(new He(Hr.encodingSchema)),omitEmpty:!0},{key:"transactions-root-sha512",valueSchema:new B(new Je),omitEmpty:!0},{key:"txn-counter",valueSchema:new B(new Y),omitEmpty:!0},{key:"upgrade-state",valueSchema:new B(cu.encodingSchema),omitEmpty:!0},{key:"upgrade-vote",valueSchema:new B(uu.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({genesisHash:e,genesisId:t,previousBlockHash:r,round:i,seed:o,timestamp:s,transactionsRoot:a,transactionsRootSha256:l,bonus:c,feesCollected:d,participationUpdates:f,previousBlockHash512:m,proposer:w,proposerPayout:k,rewards:I,stateProofTracking:x,transactions:T,transactionsRootSha512:b,txnCounter:R,upgradeState:L,upgradeVote:G}){this.genesisHash=typeof e=="string"?lt(e):e,this.genesisId=t,this.previousBlockHash=typeof r=="string"?lt(r):r,this.round=Pe(i),this.seed=typeof o=="string"?lt(o):o,this.timestamp=Xe(s),this.transactionsRoot=typeof a=="string"?lt(a):a,this.transactionsRootSha256=typeof l=="string"?lt(l):l,this.bonus=typeof c>"u"?void 0:Xe(c),this.feesCollected=typeof d>"u"?void 0:Xe(d),this.participationUpdates=f,this.previousBlockHash512=typeof m=="string"?lt(m):m,this.proposer=typeof w=="string"?Pt.fromString(w):w,this.proposerPayout=typeof k>"u"?void 0:Xe(k),this.rewards=I,this.stateProofTracking=x,this.transactions=T,this.transactionsRootSha512=typeof b=="string"?lt(b):b,this.txnCounter=typeof R>"u"?void 0:Xe(R),this.upgradeState=L,this.upgradeVote=G}getEncodingSchema(){return ja.encodingSchema}toEncodingData(){return new Map([["genesis-hash",this.genesisHash],["genesis-id",this.genesisId],["previous-block-hash",this.previousBlockHash],["round",this.round],["seed",this.seed],["timestamp",this.timestamp],["transactions-root",this.transactionsRoot],["transactions-root-sha256",this.transactionsRootSha256],["bonus",this.bonus],["fees-collected",this.feesCollected],["participation-updates",typeof this.participationUpdates<"u"?this.participationUpdates.toEncodingData():void 0],["previous-block-hash-512",this.previousBlockHash512],["proposer",typeof this.proposer<"u"?this.proposer.toString():void 0],["proposer-payout",this.proposerPayout],["rewards",typeof this.rewards<"u"?this.rewards.toEncodingData():void 0],["state-proof-tracking",typeof this.stateProofTracking<"u"?this.stateProofTracking.map(e=>e.toEncodingData()):void 0],["transactions",typeof this.transactions<"u"?this.transactions.map(e=>e.toEncodingData()):void 0],["transactions-root-sha512",this.transactionsRootSha512],["txn-counter",this.txnCounter],["upgrade-state",typeof this.upgradeState<"u"?this.upgradeState.toEncodingData():void 0],["upgrade-vote",typeof this.upgradeVote<"u"?this.upgradeVote.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Block: ${e}`);return new ja({genesisHash:e.get("genesis-hash"),genesisId:e.get("genesis-id"),previousBlockHash:e.get("previous-block-hash"),round:e.get("round"),seed:e.get("seed"),timestamp:e.get("timestamp"),transactionsRoot:e.get("transactions-root"),transactionsRootSha256:e.get("transactions-root-sha256"),bonus:e.get("bonus"),feesCollected:e.get("fees-collected"),participationUpdates:typeof e.get("participation-updates")<"u"?wu.fromEncodingData(e.get("participation-updates")):void 0,previousBlockHash512:e.get("previous-block-hash-512"),proposer:e.get("proposer"),proposerPayout:e.get("proposer-payout"),rewards:typeof e.get("rewards")<"u"?au.fromEncodingData(e.get("rewards")):void 0,stateProofTracking:typeof e.get("state-proof-tracking")<"u"?e.get("state-proof-tracking").map(t=>Au.fromEncodingData(t)):void 0,transactions:typeof e.get("transactions")<"u"?e.get("transactions").map(t=>Hr.fromEncodingData(t)):void 0,transactionsRootSha512:e.get("transactions-root-sha512"),txnCounter:e.get("txn-counter"),upgradeState:typeof e.get("upgrade-state")<"u"?cu.fromEncodingData(e.get("upgrade-state")):void 0,upgradeVote:typeof e.get("upgrade-vote")<"u"?uu.fromEncodingData(e.get("upgrade-vote")):void 0})}}class Vh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"blocks",valueSchema:new He(ja.encodingSchema),omitEmpty:!0},{key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({blocks:e,currentRound:t,nextToken:r}){this.blocks=e,this.currentRound=Pe(t),this.nextToken=r}getEncodingSchema(){return Vh.encodingSchema}toEncodingData(){return new Map([["blocks",this.blocks.map(e=>e.toEncodingData())],["current-round",this.currentRound],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockHeadersResponse: ${e}`);return new Vh({blocks:(e.get("blocks")??[]).map(t=>ja.fromEncodingData(t)),currentRound:e.get("current-round"),nextToken:e.get("next-token")})}}class au{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"fee-sink",valueSchema:new Le,omitEmpty:!0},{key:"rewards-calculation-round",valueSchema:new Y,omitEmpty:!0},{key:"rewards-level",valueSchema:new Y,omitEmpty:!0},{key:"rewards-pool",valueSchema:new Le,omitEmpty:!0},{key:"rewards-rate",valueSchema:new Y,omitEmpty:!0},{key:"rewards-residue",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({feeSink:e,rewardsCalculationRound:t,rewardsLevel:r,rewardsPool:i,rewardsRate:o,rewardsResidue:s}){this.feeSink=e,this.rewardsCalculationRound=Pe(t),this.rewardsLevel=Pe(r),this.rewardsPool=i,this.rewardsRate=Pe(o),this.rewardsResidue=Pe(s)}getEncodingSchema(){return au.encodingSchema}toEncodingData(){return new Map([["fee-sink",this.feeSink],["rewards-calculation-round",this.rewardsCalculationRound],["rewards-level",this.rewardsLevel],["rewards-pool",this.rewardsPool],["rewards-rate",this.rewardsRate],["rewards-residue",this.rewardsResidue]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockRewards: ${e}`);return new au({feeSink:e.get("fee-sink"),rewardsCalculationRound:e.get("rewards-calculation-round"),rewardsLevel:e.get("rewards-level"),rewardsPool:e.get("rewards-pool"),rewardsRate:e.get("rewards-rate"),rewardsResidue:e.get("rewards-residue")})}}class cu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"current-protocol",valueSchema:new Le,omitEmpty:!0},{key:"next-protocol",valueSchema:new B(new Le),omitEmpty:!0},{key:"next-protocol-approvals",valueSchema:new B(new Y),omitEmpty:!0},{key:"next-protocol-switch-on",valueSchema:new B(new Y),omitEmpty:!0},{key:"next-protocol-vote-before",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({currentProtocol:e,nextProtocol:t,nextProtocolApprovals:r,nextProtocolSwitchOn:i,nextProtocolVoteBefore:o}){this.currentProtocol=e,this.nextProtocol=t,this.nextProtocolApprovals=typeof r>"u"?void 0:Xe(r),this.nextProtocolSwitchOn=typeof i>"u"?void 0:Pe(i),this.nextProtocolVoteBefore=typeof o>"u"?void 0:Pe(o)}getEncodingSchema(){return cu.encodingSchema}toEncodingData(){return new Map([["current-protocol",this.currentProtocol],["next-protocol",this.nextProtocol],["next-protocol-approvals",this.nextProtocolApprovals],["next-protocol-switch-on",this.nextProtocolSwitchOn],["next-protocol-vote-before",this.nextProtocolVoteBefore]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockUpgradeState: ${e}`);return new cu({currentProtocol:e.get("current-protocol"),nextProtocol:e.get("next-protocol"),nextProtocolApprovals:e.get("next-protocol-approvals"),nextProtocolSwitchOn:e.get("next-protocol-switch-on"),nextProtocolVoteBefore:e.get("next-protocol-vote-before")})}}class uu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"upgrade-approve",valueSchema:new B(new _t),omitEmpty:!0},{key:"upgrade-delay",valueSchema:new B(new Y),omitEmpty:!0},{key:"upgrade-propose",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({upgradeApprove:e,upgradeDelay:t,upgradePropose:r}){this.upgradeApprove=e,this.upgradeDelay=typeof t>"u"?void 0:Pe(t),this.upgradePropose=r}getEncodingSchema(){return uu.encodingSchema}toEncodingData(){return new Map([["upgrade-approve",this.upgradeApprove],["upgrade-delay",this.upgradeDelay],["upgrade-propose",this.upgradePropose]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BlockUpgradeVote: ${e}`);return new uu({upgradeApprove:e.get("upgrade-approve"),upgradeDelay:e.get("upgrade-delay"),upgradePropose:e.get("upgrade-propose")})}}class Oh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"name",valueSchema:new Je,omitEmpty:!0},{key:"round",valueSchema:new Y,omitEmpty:!0},{key:"value",valueSchema:new Je,omitEmpty:!0})),this.encodingSchemaValue}constructor({name:e,round:t,value:r}){this.name=typeof e=="string"?lt(e):e,this.round=Pe(t),this.value=typeof r=="string"?lt(r):r}getEncodingSchema(){return Oh.encodingSchema}toEncodingData(){return new Map([["name",this.name],["round",this.round],["value",this.value]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Box: ${e}`);return new Oh({name:e.get("name"),round:e.get("round"),value:e.get("value")})}}class lu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"name",valueSchema:new Je,omitEmpty:!0})),this.encodingSchemaValue}constructor({name:e}){this.name=typeof e=="string"?lt(e):e}getEncodingSchema(){return lu.encodingSchema}toEncodingData(){return new Map([["name",this.name]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxDescriptor: ${e}`);return new lu({name:e.get("name")})}}class ts{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"app",valueSchema:new Y,omitEmpty:!0},{key:"name",valueSchema:new Je,omitEmpty:!0})),this.encodingSchemaValue}constructor({app:e,name:t}){this.app=Xe(e),this.name=typeof t=="string"?lt(t):t}getEncodingSchema(){return ts.encodingSchema}toEncodingData(){return new Map([["app",this.app],["name",this.name]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxReference: ${e}`);return new ts({app:e.get("app"),name:e.get("name")})}}class Nh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"application-id",valueSchema:new Y,omitEmpty:!0},{key:"boxes",valueSchema:new He(lu.encodingSchema),omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({applicationId:e,boxes:t,nextToken:r}){this.applicationId=Pe(e),this.boxes=t,this.nextToken=r}getEncodingSchema(){return Nh.encodingSchema}toEncodingData(){return new Map([["application-id",this.applicationId],["boxes",this.boxes.map(e=>e.toEncodingData())],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded BoxesResponse: ${e}`);return new Nh({applicationId:e.get("application-id"),boxes:(e.get("boxes")??[]).map(t=>lu.fromEncodingData(t)),nextToken:e.get("next-token")})}}class Sf{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"message",valueSchema:new Le,omitEmpty:!0},{key:"data",valueSchema:new B(Jn.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({message:e,data:t}){this.message=e,this.data=t}getEncodingSchema(){return Sf.encodingSchema}toEncodingData(){return new Map([["message",this.message],["data",typeof this.data<"u"?this.data.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ErrorResponse: ${e}`);return new Sf({message:e.get("message"),data:typeof e.get("data")<"u"?Jn.fromEncodingData(e.get("data")):void 0})}}class hu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"action",valueSchema:new Y,omitEmpty:!0},{key:"bytes",valueSchema:new B(new Le),omitEmpty:!0},{key:"uint",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({action:e,bytes:t,uint:r}){this.action=Xe(e),this.bytes=t,this.uint=typeof r>"u"?void 0:Pe(r)}getEncodingSchema(){return hu.encodingSchema}toEncodingData(){return new Map([["action",this.action],["bytes",this.bytes],["uint",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded EvalDelta: ${e}`);return new hu({action:e.get("action"),bytes:e.get("bytes"),uint:e.get("uint")})}}class ns{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"key",valueSchema:new Le,omitEmpty:!0},{key:"value",valueSchema:hu.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({key:e,value:t}){this.key=e,this.value=t}getEncodingSchema(){return ns.encodingSchema}toEncodingData(){return new Map([["key",this.key],["value",this.value.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded EvalDeltaKeyValue: ${e}`);return new ns({key:e.get("key"),value:hu.fromEncodingData(e.get("value")??new Map)})}}class du{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"hash-type",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({hashType:e}){this.hashType=typeof e>"u"?void 0:Xe(e)}getEncodingSchema(){return du.encodingSchema}toEncodingData(){return new Map([["hash-type",this.hashType]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HashFactory: ${e}`);return new du({hashType:e.get("hash-type")})}}class fu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"hb-pk",valueSchema:new B(new Je),omitEmpty:!0},{key:"hb-pk1sig",valueSchema:new B(new Je),omitEmpty:!0},{key:"hb-pk2",valueSchema:new B(new Je),omitEmpty:!0},{key:"hb-pk2sig",valueSchema:new B(new Je),omitEmpty:!0},{key:"hb-sig",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({hbPk:e,hbPk1sig:t,hbPk2:r,hbPk2sig:i,hbSig:o}){this.hbPk=typeof e=="string"?lt(e):e,this.hbPk1sig=typeof t=="string"?lt(t):t,this.hbPk2=typeof r=="string"?lt(r):r,this.hbPk2sig=typeof i=="string"?lt(i):i,this.hbSig=typeof o=="string"?lt(o):o}getEncodingSchema(){return fu.encodingSchema}toEncodingData(){return new Map([["hb-pk",this.hbPk],["hb-pk1sig",this.hbPk1sig],["hb-pk2",this.hbPk2],["hb-pk2sig",this.hbPk2sig],["hb-sig",this.hbSig]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HbProofFields: ${e}`);return new fu({hbPk:e.get("hb-pk"),hbPk1sig:e.get("hb-pk1sig"),hbPk2:e.get("hb-pk2"),hbPk2sig:e.get("hb-pk2sig"),hbSig:e.get("hb-sig")})}}class Lh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"db-available",valueSchema:new _t,omitEmpty:!0},{key:"is-migrating",valueSchema:new _t,omitEmpty:!0},{key:"message",valueSchema:new Le,omitEmpty:!0},{key:"round",valueSchema:new Y,omitEmpty:!0},{key:"version",valueSchema:new Le,omitEmpty:!0},{key:"data",valueSchema:new B(Jn.encodingSchema),omitEmpty:!0},{key:"errors",valueSchema:new B(new He(new Le)),omitEmpty:!0})),this.encodingSchemaValue}constructor({dbAvailable:e,isMigrating:t,message:r,round:i,version:o,data:s,errors:a}){this.dbAvailable=e,this.isMigrating=t,this.message=r,this.round=Pe(i),this.version=o,this.data=s,this.errors=a}getEncodingSchema(){return Lh.encodingSchema}toEncodingData(){return new Map([["db-available",this.dbAvailable],["is-migrating",this.isMigrating],["message",this.message],["round",this.round],["version",this.version],["data",typeof this.data<"u"?this.data.toEncodingData():void 0],["errors",this.errors]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HealthCheck: ${e}`);return new Lh({dbAvailable:e.get("db-available"),isMigrating:e.get("is-migrating"),message:e.get("message"),round:e.get("round"),version:e.get("version"),data:typeof e.get("data")<"u"?Jn.fromEncodingData(e.get("data")):void 0,errors:e.get("errors")})}}class gu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Le,omitEmpty:!0},{key:"asset",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,asset:t}){this.address=typeof e=="string"?Pt.fromString(e):e,this.asset=Xe(t)}getEncodingSchema(){return gu.encodingSchema}toEncodingData(){return new Map([["address",this.address.toString()],["asset",this.asset]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded HoldingRef: ${e}`);return new gu({address:e.get("address"),asset:e.get("asset")})}}class pu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"block-headers-commitment",valueSchema:new B(new Je),omitEmpty:!0},{key:"first-attested-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"latest-attested-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"ln-proven-weight",valueSchema:new B(new Y),omitEmpty:!0},{key:"voters-commitment",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({blockHeadersCommitment:e,firstAttestedRound:t,latestAttestedRound:r,lnProvenWeight:i,votersCommitment:o}){this.blockHeadersCommitment=typeof e=="string"?lt(e):e,this.firstAttestedRound=typeof t>"u"?void 0:Pe(t),this.latestAttestedRound=typeof r>"u"?void 0:Pe(r),this.lnProvenWeight=typeof i>"u"?void 0:Pe(i),this.votersCommitment=typeof o=="string"?lt(o):o}getEncodingSchema(){return pu.encodingSchema}toEncodingData(){return new Map([["block-headers-commitment",this.blockHeadersCommitment],["first-attested-round",this.firstAttestedRound],["latest-attested-round",this.latestAttestedRound],["ln-proven-weight",this.lnProvenWeight],["voters-commitment",this.votersCommitment]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded IndexerStateProofMessage: ${e}`);return new pu({blockHeadersCommitment:e.get("block-headers-commitment"),firstAttestedRound:e.get("first-attested-round"),latestAttestedRound:e.get("latest-attested-round"),lnProvenWeight:e.get("ln-proven-weight"),votersCommitment:e.get("voters-commitment")})}}class mu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Le,omitEmpty:!0},{key:"app",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,app:t}){this.address=typeof e=="string"?Pt.fromString(e):e,this.app=Xe(t)}getEncodingSchema(){return mu.encodingSchema}toEncodingData(){return new Map([["address",this.address.toString()],["app",this.app]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded LocalsRef: ${e}`);return new mu({address:e.get("address"),app:e.get("app")})}}class bi{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"hash-factory",valueSchema:new B(du.encodingSchema),omitEmpty:!0},{key:"path",valueSchema:new B(new He(new Je)),omitEmpty:!0},{key:"tree-depth",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({hashFactory:e,path:t,treeDepth:r}){this.hashFactory=e,this.path=t,this.treeDepth=typeof r>"u"?void 0:Xe(r)}getEncodingSchema(){return bi.encodingSchema}toEncodingData(){return new Map([["hash-factory",typeof this.hashFactory<"u"?this.hashFactory.toEncodingData():void 0],["path",this.path],["tree-depth",this.treeDepth]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded MerkleArrayProof: ${e}`);return new bi({hashFactory:typeof e.get("hash-factory")<"u"?du.fromEncodingData(e.get("hash-factory")):void 0,path:e.get("path"),treeDepth:e.get("tree-depth")})}}class yu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Le,omitEmpty:!0},{key:"amount",valueSchema:new Y,omitEmpty:!0},{key:"is-frozen",valueSchema:new _t,omitEmpty:!0},{key:"deleted",valueSchema:new B(new _t),omitEmpty:!0},{key:"opted-in-at-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"opted-out-at-round",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,amount:t,isFrozen:r,deleted:i,optedInAtRound:o,optedOutAtRound:s}){this.address=e,this.amount=Pe(t),this.isFrozen=r,this.deleted=i,this.optedInAtRound=typeof o>"u"?void 0:Pe(o),this.optedOutAtRound=typeof s>"u"?void 0:Pe(s)}getEncodingSchema(){return yu.encodingSchema}toEncodingData(){return new Map([["address",this.address],["amount",this.amount],["is-frozen",this.isFrozen],["deleted",this.deleted],["opted-in-at-round",this.optedInAtRound],["opted-out-at-round",this.optedOutAtRound]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded MiniAssetHolding: ${e}`);return new yu({address:e.get("address"),amount:e.get("amount"),isFrozen:e.get("is-frozen"),deleted:e.get("deleted"),optedInAtRound:e.get("opted-in-at-round"),optedOutAtRound:e.get("opted-out-at-round")})}}class wu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"absent-participation-accounts",valueSchema:new B(new He(new Le)),omitEmpty:!0},{key:"expired-participation-accounts",valueSchema:new B(new He(new Le)),omitEmpty:!0})),this.encodingSchemaValue}constructor({absentParticipationAccounts:e,expiredParticipationAccounts:t}){this.absentParticipationAccounts=e,this.expiredParticipationAccounts=t}getEncodingSchema(){return wu.encodingSchema}toEncodingData(){return new Map([["absent-participation-accounts",this.absentParticipationAccounts],["expired-participation-accounts",this.expiredParticipationAccounts]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ParticipationUpdates: ${e}`);return new wu({absentParticipationAccounts:e.get("absent-participation-accounts"),expiredParticipationAccounts:e.get("expired-participation-accounts")})}}class Su{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new B(new Le),omitEmpty:!0},{key:"application-id",valueSchema:new B(new Y),omitEmpty:!0},{key:"asset-id",valueSchema:new B(new Y),omitEmpty:!0},{key:"box",valueSchema:new B(ts.encodingSchema),omitEmpty:!0},{key:"holding",valueSchema:new B(gu.encodingSchema),omitEmpty:!0},{key:"local",valueSchema:new B(mu.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,applicationId:t,assetId:r,box:i,holding:o,local:s}){this.address=typeof e=="string"?Pt.fromString(e):e,this.applicationId=typeof t>"u"?void 0:Xe(t),this.assetId=typeof r>"u"?void 0:Xe(r),this.box=i,this.holding=o,this.local=s}getEncodingSchema(){return Su.encodingSchema}toEncodingData(){return new Map([["address",typeof this.address<"u"?this.address.toString():void 0],["application-id",this.applicationId],["asset-id",this.assetId],["box",typeof this.box<"u"?this.box.toEncodingData():void 0],["holding",typeof this.holding<"u"?this.holding.toEncodingData():void 0],["local",typeof this.local<"u"?this.local.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded ResourceRef: ${e}`);return new Su({address:e.get("address"),applicationId:e.get("application-id"),assetId:e.get("asset-id"),box:typeof e.get("box")<"u"?ts.fromEncodingData(e.get("box")):void 0,holding:typeof e.get("holding")<"u"?gu.fromEncodingData(e.get("holding")):void 0,local:typeof e.get("local")<"u"?mu.fromEncodingData(e.get("local")):void 0})}}class vu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"part-proofs",valueSchema:new B(bi.encodingSchema),omitEmpty:!0},{key:"positions-to-reveal",valueSchema:new B(new He(new Y)),omitEmpty:!0},{key:"reveals",valueSchema:new B(new He(Eu.encodingSchema)),omitEmpty:!0},{key:"salt-version",valueSchema:new B(new Y),omitEmpty:!0},{key:"sig-commit",valueSchema:new B(new Je),omitEmpty:!0},{key:"sig-proofs",valueSchema:new B(bi.encodingSchema),omitEmpty:!0},{key:"signed-weight",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({partProofs:e,positionsToReveal:t,reveals:r,saltVersion:i,sigCommit:o,sigProofs:s,signedWeight:a}){this.partProofs=e,this.positionsToReveal=typeof t>"u"?void 0:t.map(Pe),this.reveals=r,this.saltVersion=typeof i>"u"?void 0:Xe(i),this.sigCommit=typeof o=="string"?lt(o):o,this.sigProofs=s,this.signedWeight=typeof a>"u"?void 0:Pe(a)}getEncodingSchema(){return vu.encodingSchema}toEncodingData(){return new Map([["part-proofs",typeof this.partProofs<"u"?this.partProofs.toEncodingData():void 0],["positions-to-reveal",this.positionsToReveal],["reveals",typeof this.reveals<"u"?this.reveals.map(e=>e.toEncodingData()):void 0],["salt-version",this.saltVersion],["sig-commit",this.sigCommit],["sig-proofs",typeof this.sigProofs<"u"?this.sigProofs.toEncodingData():void 0],["signed-weight",this.signedWeight]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofFields: ${e}`);return new vu({partProofs:typeof e.get("part-proofs")<"u"?bi.fromEncodingData(e.get("part-proofs")):void 0,positionsToReveal:e.get("positions-to-reveal"),reveals:typeof e.get("reveals")<"u"?e.get("reveals").map(t=>Eu.fromEncodingData(t)):void 0,saltVersion:e.get("salt-version"),sigCommit:e.get("sig-commit"),sigProofs:typeof e.get("sig-proofs")<"u"?bi.fromEncodingData(e.get("sig-proofs")):void 0,signedWeight:e.get("signed-weight")})}}class xu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"verifier",valueSchema:new B(Du.encodingSchema),omitEmpty:!0},{key:"weight",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({verifier:e,weight:t}){this.verifier=e,this.weight=typeof t>"u"?void 0:Pe(t)}getEncodingSchema(){return xu.encodingSchema}toEncodingData(){return new Map([["verifier",typeof this.verifier<"u"?this.verifier.toEncodingData():void 0],["weight",this.weight]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofParticipant: ${e}`);return new xu({verifier:typeof e.get("verifier")<"u"?Du.fromEncodingData(e.get("verifier")):void 0,weight:e.get("weight")})}}class Eu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"participant",valueSchema:new B(xu.encodingSchema),omitEmpty:!0},{key:"position",valueSchema:new B(new Y),omitEmpty:!0},{key:"sig-slot",valueSchema:new B(bu.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({participant:e,position:t,sigSlot:r}){this.participant=e,this.position=typeof t>"u"?void 0:Pe(t),this.sigSlot=r}getEncodingSchema(){return Eu.encodingSchema}toEncodingData(){return new Map([["participant",typeof this.participant<"u"?this.participant.toEncodingData():void 0],["position",this.position],["sig-slot",typeof this.sigSlot<"u"?this.sigSlot.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofReveal: ${e}`);return new Eu({participant:typeof e.get("participant")<"u"?xu.fromEncodingData(e.get("participant")):void 0,position:e.get("position"),sigSlot:typeof e.get("sig-slot")<"u"?bu.fromEncodingData(e.get("sig-slot")):void 0})}}class bu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"lower-sig-weight",valueSchema:new B(new Y),omitEmpty:!0},{key:"signature",valueSchema:new B(ku.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({lowerSigWeight:e,signature:t}){this.lowerSigWeight=typeof e>"u"?void 0:Pe(e),this.signature=t}getEncodingSchema(){return bu.encodingSchema}toEncodingData(){return new Map([["lower-sig-weight",this.lowerSigWeight],["signature",typeof this.signature<"u"?this.signature.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofSigSlot: ${e}`);return new bu({lowerSigWeight:e.get("lower-sig-weight"),signature:typeof e.get("signature")<"u"?ku.fromEncodingData(e.get("signature")):void 0})}}class ku{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"falcon-signature",valueSchema:new B(new Je),omitEmpty:!0},{key:"merkle-array-index",valueSchema:new B(new Y),omitEmpty:!0},{key:"proof",valueSchema:new B(bi.encodingSchema),omitEmpty:!0},{key:"verifying-key",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({falconSignature:e,merkleArrayIndex:t,proof:r,verifyingKey:i}){this.falconSignature=typeof e=="string"?lt(e):e,this.merkleArrayIndex=typeof t>"u"?void 0:Xe(t),this.proof=r,this.verifyingKey=typeof i=="string"?lt(i):i}getEncodingSchema(){return ku.encodingSchema}toEncodingData(){return new Map([["falcon-signature",this.falconSignature],["merkle-array-index",this.merkleArrayIndex],["proof",typeof this.proof<"u"?this.proof.toEncodingData():void 0],["verifying-key",this.verifyingKey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofSignature: ${e}`);return new ku({falconSignature:e.get("falcon-signature"),merkleArrayIndex:e.get("merkle-array-index"),proof:typeof e.get("proof")<"u"?bi.fromEncodingData(e.get("proof")):void 0,verifyingKey:e.get("verifying-key")})}}class Au{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"next-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"online-total-weight",valueSchema:new B(new Y),omitEmpty:!0},{key:"type",valueSchema:new B(new Y),omitEmpty:!0},{key:"voters-commitment",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({nextRound:e,onlineTotalWeight:t,type:r,votersCommitment:i}){this.nextRound=typeof e>"u"?void 0:Pe(e),this.onlineTotalWeight=typeof t>"u"?void 0:Pe(t),this.type=typeof r>"u"?void 0:Xe(r),this.votersCommitment=typeof i=="string"?lt(i):i}getEncodingSchema(){return Au.encodingSchema}toEncodingData(){return new Map([["next-round",this.nextRound],["online-total-weight",this.onlineTotalWeight],["type",this.type],["voters-commitment",this.votersCommitment]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofTracking: ${e}`);return new Au({nextRound:e.get("next-round"),onlineTotalWeight:e.get("online-total-weight"),type:e.get("type"),votersCommitment:e.get("voters-commitment")})}}class Du{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"commitment",valueSchema:new B(new Je),omitEmpty:!0},{key:"key-lifetime",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({commitment:e,keyLifetime:t}){this.commitment=typeof e=="string"?lt(e):e,this.keyLifetime=typeof t>"u"?void 0:Pe(t)}getEncodingSchema(){return Du.encodingSchema}toEncodingData(){return new Map([["commitment",this.commitment],["key-lifetime",this.keyLifetime]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateProofVerifier: ${e}`);return new Du({commitment:e.get("commitment"),keyLifetime:e.get("key-lifetime")})}}class No{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"num-byte-slice",valueSchema:new Y,omitEmpty:!0},{key:"num-uint",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({numByteSlice:e,numUint:t}){this.numByteSlice=Xe(e),this.numUint=Xe(t)}getEncodingSchema(){return No.encodingSchema}toEncodingData(){return new Map([["num-byte-slice",this.numByteSlice],["num-uint",this.numUint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded StateSchema: ${e}`);return new No({numByteSlice:e.get("num-byte-slice"),numUint:e.get("num-uint")})}}class rs{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"key",valueSchema:new Je,omitEmpty:!0},{key:"value",valueSchema:Fu.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({key:e,value:t}){this.key=typeof e=="string"?lt(e):e,this.value=t}getEncodingSchema(){return rs.encodingSchema}toEncodingData(){return new Map([["key",this.key],["value",this.value.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TealKeyValue: ${e}`);return new rs({key:e.get("key"),value:Fu.fromEncodingData(e.get("value")??new Map)})}}class Fu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"bytes",valueSchema:new Je,omitEmpty:!0},{key:"type",valueSchema:new Y,omitEmpty:!0},{key:"uint",valueSchema:new Y,omitEmpty:!0})),this.encodingSchemaValue}constructor({bytes:e,type:t,uint:r}){this.bytes=typeof e=="string"?lt(e):e,this.type=Xe(t),this.uint=Pe(r)}getEncodingSchema(){return Fu.encodingSchema}toEncodingData(){return new Map([["bytes",this.bytes],["type",this.type],["uint",this.uint]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TealValue: ${e}`);return new Fu({bytes:e.get("bytes"),type:e.get("type"),uint:e.get("uint")})}}class Hr{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"fee",valueSchema:new Y,omitEmpty:!0},{key:"first-valid",valueSchema:new Y,omitEmpty:!0},{key:"last-valid",valueSchema:new Y,omitEmpty:!0},{key:"sender",valueSchema:new Le,omitEmpty:!0},{key:"application-transaction",valueSchema:new B(Tu.encodingSchema),omitEmpty:!0},{key:"asset-config-transaction",valueSchema:new B(Iu.encodingSchema),omitEmpty:!0},{key:"asset-freeze-transaction",valueSchema:new B(Mu.encodingSchema),omitEmpty:!0},{key:"asset-transfer-transaction",valueSchema:new B(Ru.encodingSchema),omitEmpty:!0},{key:"auth-addr",valueSchema:new B(new Le),omitEmpty:!0},{key:"close-rewards",valueSchema:new B(new Y),omitEmpty:!0},{key:"closing-amount",valueSchema:new B(new Y),omitEmpty:!0},{key:"confirmed-round",valueSchema:new B(new Y),omitEmpty:!0},{key:"created-application-index",valueSchema:new B(new Y),omitEmpty:!0},{key:"created-asset-index",valueSchema:new B(new Y),omitEmpty:!0},{key:"genesis-hash",valueSchema:new B(new Je),omitEmpty:!0},{key:"genesis-id",valueSchema:new B(new Le),omitEmpty:!0},{key:"global-state-delta",valueSchema:new B(new He(ns.encodingSchema)),omitEmpty:!0},{key:"group",valueSchema:new B(new Je),omitEmpty:!0},{key:"heartbeat-transaction",valueSchema:new B(Cu.encodingSchema),omitEmpty:!0},{key:"id",valueSchema:new B(new Le),omitEmpty:!0},{key:"inner-txns",valueSchema:new B(new He(Hr.encodingSchema)),omitEmpty:!0},{key:"intra-round-offset",valueSchema:new B(new Y),omitEmpty:!0},{key:"keyreg-transaction",valueSchema:new B(Pu.encodingSchema),omitEmpty:!0},{key:"lease",valueSchema:new B(new Je),omitEmpty:!0},{key:"local-state-delta",valueSchema:new B(new He(nu.encodingSchema)),omitEmpty:!0},{key:"logs",valueSchema:new B(new He(new Je)),omitEmpty:!0},{key:"note",valueSchema:new B(new Je),omitEmpty:!0},{key:"payment-transaction",valueSchema:new B($u.encodingSchema),omitEmpty:!0},{key:"receiver-rewards",valueSchema:new B(new Y),omitEmpty:!0},{key:"rekey-to",valueSchema:new B(new Le),omitEmpty:!0},{key:"round-time",valueSchema:new B(new Y),omitEmpty:!0},{key:"sender-rewards",valueSchema:new B(new Y),omitEmpty:!0},{key:"signature",valueSchema:new B(Bu.encodingSchema),omitEmpty:!0},{key:"state-proof-transaction",valueSchema:new B(Nu.encodingSchema),omitEmpty:!0},{key:"tx-type",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({fee:e,firstValid:t,lastValid:r,sender:i,applicationTransaction:o,assetConfigTransaction:s,assetFreezeTransaction:a,assetTransferTransaction:l,authAddr:c,closeRewards:d,closingAmount:f,confirmedRound:m,createdApplicationIndex:w,createdAssetIndex:k,genesisHash:I,genesisId:x,globalStateDelta:T,group:b,heartbeatTransaction:R,id:L,innerTxns:G,intraRoundOffset:E,keyregTransaction:N,lease:p,localStateDelta:F,logs:v,note:O,paymentTransaction:C,receiverRewards:V,rekeyTo:H,roundTime:_,senderRewards:ee,signature:oe,stateProofTransaction:z,txType:ue}){this.fee=Pe(e),this.firstValid=Pe(t),this.lastValid=Pe(r),this.sender=i,this.applicationTransaction=o,this.assetConfigTransaction=s,this.assetFreezeTransaction=a,this.assetTransferTransaction=l,this.authAddr=typeof c=="string"?Pt.fromString(c):c,this.closeRewards=typeof d>"u"?void 0:Pe(d),this.closingAmount=typeof f>"u"?void 0:Pe(f),this.confirmedRound=typeof m>"u"?void 0:Pe(m),this.createdApplicationIndex=typeof w>"u"?void 0:Pe(w),this.createdAssetIndex=typeof k>"u"?void 0:Pe(k),this.genesisHash=typeof I=="string"?lt(I):I,this.genesisId=x,this.globalStateDelta=T,this.group=typeof b=="string"?lt(b):b,this.heartbeatTransaction=R,this.id=L,this.innerTxns=G,this.intraRoundOffset=typeof E>"u"?void 0:Xe(E),this.keyregTransaction=N,this.lease=typeof p=="string"?lt(p):p,this.localStateDelta=F,this.logs=v,this.note=typeof O=="string"?lt(O):O,this.paymentTransaction=C,this.receiverRewards=typeof V>"u"?void 0:Pe(V),this.rekeyTo=typeof H=="string"?Pt.fromString(H):H,this.roundTime=typeof _>"u"?void 0:Xe(_),this.senderRewards=typeof ee>"u"?void 0:Pe(ee),this.signature=oe,this.stateProofTransaction=z,this.txType=ue}getEncodingSchema(){return Hr.encodingSchema}toEncodingData(){return new Map([["fee",this.fee],["first-valid",this.firstValid],["last-valid",this.lastValid],["sender",this.sender],["application-transaction",typeof this.applicationTransaction<"u"?this.applicationTransaction.toEncodingData():void 0],["asset-config-transaction",typeof this.assetConfigTransaction<"u"?this.assetConfigTransaction.toEncodingData():void 0],["asset-freeze-transaction",typeof this.assetFreezeTransaction<"u"?this.assetFreezeTransaction.toEncodingData():void 0],["asset-transfer-transaction",typeof this.assetTransferTransaction<"u"?this.assetTransferTransaction.toEncodingData():void 0],["auth-addr",typeof this.authAddr<"u"?this.authAddr.toString():void 0],["close-rewards",this.closeRewards],["closing-amount",this.closingAmount],["confirmed-round",this.confirmedRound],["created-application-index",this.createdApplicationIndex],["created-asset-index",this.createdAssetIndex],["genesis-hash",this.genesisHash],["genesis-id",this.genesisId],["global-state-delta",typeof this.globalStateDelta<"u"?this.globalStateDelta.map(e=>e.toEncodingData()):void 0],["group",this.group],["heartbeat-transaction",typeof this.heartbeatTransaction<"u"?this.heartbeatTransaction.toEncodingData():void 0],["id",this.id],["inner-txns",typeof this.innerTxns<"u"?this.innerTxns.map(e=>e.toEncodingData()):void 0],["intra-round-offset",this.intraRoundOffset],["keyreg-transaction",typeof this.keyregTransaction<"u"?this.keyregTransaction.toEncodingData():void 0],["lease",this.lease],["local-state-delta",typeof this.localStateDelta<"u"?this.localStateDelta.map(e=>e.toEncodingData()):void 0],["logs",this.logs],["note",this.note],["payment-transaction",typeof this.paymentTransaction<"u"?this.paymentTransaction.toEncodingData():void 0],["receiver-rewards",this.receiverRewards],["rekey-to",typeof this.rekeyTo<"u"?this.rekeyTo.toString():void 0],["round-time",this.roundTime],["sender-rewards",this.senderRewards],["signature",typeof this.signature<"u"?this.signature.toEncodingData():void 0],["state-proof-transaction",typeof this.stateProofTransaction<"u"?this.stateProofTransaction.toEncodingData():void 0],["tx-type",this.txType]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded Transaction: ${e}`);return new Hr({fee:e.get("fee"),firstValid:e.get("first-valid"),lastValid:e.get("last-valid"),sender:e.get("sender"),applicationTransaction:typeof e.get("application-transaction")<"u"?Tu.fromEncodingData(e.get("application-transaction")):void 0,assetConfigTransaction:typeof e.get("asset-config-transaction")<"u"?Iu.fromEncodingData(e.get("asset-config-transaction")):void 0,assetFreezeTransaction:typeof e.get("asset-freeze-transaction")<"u"?Mu.fromEncodingData(e.get("asset-freeze-transaction")):void 0,assetTransferTransaction:typeof e.get("asset-transfer-transaction")<"u"?Ru.fromEncodingData(e.get("asset-transfer-transaction")):void 0,authAddr:e.get("auth-addr"),closeRewards:e.get("close-rewards"),closingAmount:e.get("closing-amount"),confirmedRound:e.get("confirmed-round"),createdApplicationIndex:e.get("created-application-index"),createdAssetIndex:e.get("created-asset-index"),genesisHash:e.get("genesis-hash"),genesisId:e.get("genesis-id"),globalStateDelta:typeof e.get("global-state-delta")<"u"?e.get("global-state-delta").map(t=>ns.fromEncodingData(t)):void 0,group:e.get("group"),heartbeatTransaction:typeof e.get("heartbeat-transaction")<"u"?Cu.fromEncodingData(e.get("heartbeat-transaction")):void 0,id:e.get("id"),innerTxns:typeof e.get("inner-txns")<"u"?e.get("inner-txns").map(t=>Hr.fromEncodingData(t)):void 0,intraRoundOffset:e.get("intra-round-offset"),keyregTransaction:typeof e.get("keyreg-transaction")<"u"?Pu.fromEncodingData(e.get("keyreg-transaction")):void 0,lease:e.get("lease"),localStateDelta:typeof e.get("local-state-delta")<"u"?e.get("local-state-delta").map(t=>nu.fromEncodingData(t)):void 0,logs:e.get("logs"),note:e.get("note"),paymentTransaction:typeof e.get("payment-transaction")<"u"?$u.fromEncodingData(e.get("payment-transaction")):void 0,receiverRewards:e.get("receiver-rewards"),rekeyTo:e.get("rekey-to"),roundTime:e.get("round-time"),senderRewards:e.get("sender-rewards"),signature:typeof e.get("signature")<"u"?Bu.fromEncodingData(e.get("signature")):void 0,stateProofTransaction:typeof e.get("state-proof-transaction")<"u"?Nu.fromEncodingData(e.get("state-proof-transaction")):void 0,txType:e.get("tx-type")})}}class Tu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"application-id",valueSchema:new Y,omitEmpty:!0},{key:"access",valueSchema:new B(new He(Su.encodingSchema)),omitEmpty:!0},{key:"accounts",valueSchema:new B(new He(new Le)),omitEmpty:!0},{key:"application-args",valueSchema:new B(new He(new Je)),omitEmpty:!0},{key:"approval-program",valueSchema:new B(new Je),omitEmpty:!0},{key:"box-references",valueSchema:new B(new He(ts.encodingSchema)),omitEmpty:!0},{key:"clear-state-program",valueSchema:new B(new Je),omitEmpty:!0},{key:"extra-program-pages",valueSchema:new B(new Y),omitEmpty:!0},{key:"foreign-apps",valueSchema:new B(new He(new Y)),omitEmpty:!0},{key:"foreign-assets",valueSchema:new B(new He(new Y)),omitEmpty:!0},{key:"global-state-schema",valueSchema:new B(No.encodingSchema),omitEmpty:!0},{key:"local-state-schema",valueSchema:new B(No.encodingSchema),omitEmpty:!0},{key:"on-completion",valueSchema:new B(new Le),omitEmpty:!0},{key:"reject-version",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({applicationId:e,access:t,accounts:r,applicationArgs:i,approvalProgram:o,boxReferences:s,clearStateProgram:a,extraProgramPages:l,foreignApps:c,foreignAssets:d,globalStateSchema:f,localStateSchema:m,onCompletion:w,rejectVersion:k}){this.applicationId=Pe(e),this.access=t,this.accounts=typeof r<"u"?r.map(I=>typeof I=="string"?Pt.fromString(I):I):void 0,this.applicationArgs=i,this.approvalProgram=typeof o=="string"?lt(o):o,this.boxReferences=s,this.clearStateProgram=typeof a=="string"?lt(a):a,this.extraProgramPages=typeof l>"u"?void 0:Xe(l),this.foreignApps=typeof c>"u"?void 0:c.map(Pe),this.foreignAssets=typeof d>"u"?void 0:d.map(Pe),this.globalStateSchema=f,this.localStateSchema=m,this.onCompletion=w,this.rejectVersion=typeof k>"u"?void 0:Xe(k)}getEncodingSchema(){return Tu.encodingSchema}toEncodingData(){return new Map([["application-id",this.applicationId],["access",typeof this.access<"u"?this.access.map(e=>e.toEncodingData()):void 0],["accounts",typeof this.accounts<"u"?this.accounts.map(e=>e.toString()):void 0],["application-args",this.applicationArgs],["approval-program",this.approvalProgram],["box-references",typeof this.boxReferences<"u"?this.boxReferences.map(e=>e.toEncodingData()):void 0],["clear-state-program",this.clearStateProgram],["extra-program-pages",this.extraProgramPages],["foreign-apps",this.foreignApps],["foreign-assets",this.foreignAssets],["global-state-schema",typeof this.globalStateSchema<"u"?this.globalStateSchema.toEncodingData():void 0],["local-state-schema",typeof this.localStateSchema<"u"?this.localStateSchema.toEncodingData():void 0],["on-completion",this.onCompletion],["reject-version",this.rejectVersion]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionApplication: ${e}`);return new Tu({applicationId:e.get("application-id"),access:typeof e.get("access")<"u"?e.get("access").map(t=>Su.fromEncodingData(t)):void 0,accounts:e.get("accounts"),applicationArgs:e.get("application-args"),approvalProgram:e.get("approval-program"),boxReferences:typeof e.get("box-references")<"u"?e.get("box-references").map(t=>ts.fromEncodingData(t)):void 0,clearStateProgram:e.get("clear-state-program"),extraProgramPages:e.get("extra-program-pages"),foreignApps:e.get("foreign-apps"),foreignAssets:e.get("foreign-assets"),globalStateSchema:typeof e.get("global-state-schema")<"u"?No.fromEncodingData(e.get("global-state-schema")):void 0,localStateSchema:typeof e.get("local-state-schema")<"u"?No.fromEncodingData(e.get("local-state-schema")):void 0,onCompletion:e.get("on-completion"),rejectVersion:e.get("reject-version")})}}class Iu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"asset-id",valueSchema:new B(new Y),omitEmpty:!0},{key:"params",valueSchema:new B(es.encodingSchema),omitEmpty:!0})),this.encodingSchemaValue}constructor({assetId:e,params:t}){this.assetId=typeof e>"u"?void 0:Pe(e),this.params=t}getEncodingSchema(){return Iu.encodingSchema}toEncodingData(){return new Map([["asset-id",this.assetId],["params",typeof this.params<"u"?this.params.toEncodingData():void 0]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionAssetConfig: ${e}`);return new Iu({assetId:e.get("asset-id"),params:typeof e.get("params")<"u"?es.fromEncodingData(e.get("params")):void 0})}}class Mu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"address",valueSchema:new Le,omitEmpty:!0},{key:"asset-id",valueSchema:new Y,omitEmpty:!0},{key:"new-freeze-status",valueSchema:new _t,omitEmpty:!0})),this.encodingSchemaValue}constructor({address:e,assetId:t,newFreezeStatus:r}){this.address=e,this.assetId=Pe(t),this.newFreezeStatus=r}getEncodingSchema(){return Mu.encodingSchema}toEncodingData(){return new Map([["address",this.address],["asset-id",this.assetId],["new-freeze-status",this.newFreezeStatus]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionAssetFreeze: ${e}`);return new Mu({address:e.get("address"),assetId:e.get("asset-id"),newFreezeStatus:e.get("new-freeze-status")})}}class Ru{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"amount",valueSchema:new Y,omitEmpty:!0},{key:"asset-id",valueSchema:new Y,omitEmpty:!0},{key:"receiver",valueSchema:new Le,omitEmpty:!0},{key:"close-amount",valueSchema:new B(new Y),omitEmpty:!0},{key:"close-to",valueSchema:new B(new Le),omitEmpty:!0},{key:"sender",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({amount:e,assetId:t,receiver:r,closeAmount:i,closeTo:o,sender:s}){this.amount=Pe(e),this.assetId=Pe(t),this.receiver=r,this.closeAmount=typeof i>"u"?void 0:Pe(i),this.closeTo=o,this.sender=s}getEncodingSchema(){return Ru.encodingSchema}toEncodingData(){return new Map([["amount",this.amount],["asset-id",this.assetId],["receiver",this.receiver],["close-amount",this.closeAmount],["close-to",this.closeTo],["sender",this.sender]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionAssetTransfer: ${e}`);return new Ru({amount:e.get("amount"),assetId:e.get("asset-id"),receiver:e.get("receiver"),closeAmount:e.get("close-amount"),closeTo:e.get("close-to"),sender:e.get("sender")})}}class Cu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"hb-address",valueSchema:new Le,omitEmpty:!0},{key:"hb-key-dilution",valueSchema:new Y,omitEmpty:!0},{key:"hb-proof",valueSchema:fu.encodingSchema,omitEmpty:!0},{key:"hb-seed",valueSchema:new Je,omitEmpty:!0},{key:"hb-vote-id",valueSchema:new Je,omitEmpty:!0})),this.encodingSchemaValue}constructor({hbAddress:e,hbKeyDilution:t,hbProof:r,hbSeed:i,hbVoteId:o}){this.hbAddress=e,this.hbKeyDilution=Pe(t),this.hbProof=r,this.hbSeed=typeof i=="string"?lt(i):i,this.hbVoteId=typeof o=="string"?lt(o):o}getEncodingSchema(){return Cu.encodingSchema}toEncodingData(){return new Map([["hb-address",this.hbAddress],["hb-key-dilution",this.hbKeyDilution],["hb-proof",this.hbProof.toEncodingData()],["hb-seed",this.hbSeed],["hb-vote-id",this.hbVoteId]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionHeartbeat: ${e}`);return new Cu({hbAddress:e.get("hb-address"),hbKeyDilution:e.get("hb-key-dilution"),hbProof:fu.fromEncodingData(e.get("hb-proof")??new Map),hbSeed:e.get("hb-seed"),hbVoteId:e.get("hb-vote-id")})}}class Pu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"non-participation",valueSchema:new B(new _t),omitEmpty:!0},{key:"selection-participation-key",valueSchema:new B(new Je),omitEmpty:!0},{key:"state-proof-key",valueSchema:new B(new Je),omitEmpty:!0},{key:"vote-first-valid",valueSchema:new B(new Y),omitEmpty:!0},{key:"vote-key-dilution",valueSchema:new B(new Y),omitEmpty:!0},{key:"vote-last-valid",valueSchema:new B(new Y),omitEmpty:!0},{key:"vote-participation-key",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({nonParticipation:e,selectionParticipationKey:t,stateProofKey:r,voteFirstValid:i,voteKeyDilution:o,voteLastValid:s,voteParticipationKey:a}){this.nonParticipation=e,this.selectionParticipationKey=typeof t=="string"?lt(t):t,this.stateProofKey=typeof r=="string"?lt(r):r,this.voteFirstValid=typeof i>"u"?void 0:Pe(i),this.voteKeyDilution=typeof o>"u"?void 0:Pe(o),this.voteLastValid=typeof s>"u"?void 0:Pe(s),this.voteParticipationKey=typeof a=="string"?lt(a):a}getEncodingSchema(){return Pu.encodingSchema}toEncodingData(){return new Map([["non-participation",this.nonParticipation],["selection-participation-key",this.selectionParticipationKey],["state-proof-key",this.stateProofKey],["vote-first-valid",this.voteFirstValid],["vote-key-dilution",this.voteKeyDilution],["vote-last-valid",this.voteLastValid],["vote-participation-key",this.voteParticipationKey]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionKeyreg: ${e}`);return new Pu({nonParticipation:e.get("non-participation"),selectionParticipationKey:e.get("selection-participation-key"),stateProofKey:e.get("state-proof-key"),voteFirstValid:e.get("vote-first-valid"),voteKeyDilution:e.get("vote-key-dilution"),voteLastValid:e.get("vote-last-valid"),voteParticipationKey:e.get("vote-participation-key")})}}class $u{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"amount",valueSchema:new Y,omitEmpty:!0},{key:"receiver",valueSchema:new Le,omitEmpty:!0},{key:"close-amount",valueSchema:new B(new Y),omitEmpty:!0},{key:"close-remainder-to",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({amount:e,receiver:t,closeAmount:r,closeRemainderTo:i}){this.amount=Pe(e),this.receiver=t,this.closeAmount=typeof r>"u"?void 0:Pe(r),this.closeRemainderTo=i}getEncodingSchema(){return $u.encodingSchema}toEncodingData(){return new Map([["amount",this.amount],["receiver",this.receiver],["close-amount",this.closeAmount],["close-remainder-to",this.closeRemainderTo]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionPayment: ${e}`);return new $u({amount:e.get("amount"),receiver:e.get("receiver"),closeAmount:e.get("close-amount"),closeRemainderTo:e.get("close-remainder-to")})}}class Uh{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"transaction",valueSchema:Hr.encodingSchema,omitEmpty:!0})),this.encodingSchemaValue}constructor({currentRound:e,transaction:t}){this.currentRound=Pe(e),this.transaction=t}getEncodingSchema(){return Uh.encodingSchema}toEncodingData(){return new Map([["current-round",this.currentRound],["transaction",this.transaction.toEncodingData()]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionResponse: ${e}`);return new Uh({currentRound:e.get("current-round"),transaction:Hr.fromEncodingData(e.get("transaction")??new Map)})}}class Bu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"logicsig",valueSchema:new B(Vu.encodingSchema),omitEmpty:!0},{key:"multisig",valueSchema:new B(ki.encodingSchema),omitEmpty:!0},{key:"sig",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({logicsig:e,multisig:t,sig:r}){this.logicsig=e,this.multisig=t,this.sig=typeof r=="string"?lt(r):r}getEncodingSchema(){return Bu.encodingSchema}toEncodingData(){return new Map([["logicsig",typeof this.logicsig<"u"?this.logicsig.toEncodingData():void 0],["multisig",typeof this.multisig<"u"?this.multisig.toEncodingData():void 0],["sig",this.sig]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionSignature: ${e}`);return new Bu({logicsig:typeof e.get("logicsig")<"u"?Vu.fromEncodingData(e.get("logicsig")):void 0,multisig:typeof e.get("multisig")<"u"?ki.fromEncodingData(e.get("multisig")):void 0,sig:e.get("sig")})}}class Vu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"logic",valueSchema:new Je,omitEmpty:!0},{key:"args",valueSchema:new B(new He(new Je)),omitEmpty:!0},{key:"logic-multisig-signature",valueSchema:new B(ki.encodingSchema),omitEmpty:!0},{key:"multisig-signature",valueSchema:new B(ki.encodingSchema),omitEmpty:!0},{key:"signature",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({logic:e,args:t,logicMultisigSignature:r,multisigSignature:i,signature:o}){this.logic=typeof e=="string"?lt(e):e,this.args=t,this.logicMultisigSignature=r,this.multisigSignature=i,this.signature=typeof o=="string"?lt(o):o}getEncodingSchema(){return Vu.encodingSchema}toEncodingData(){return new Map([["logic",this.logic],["args",this.args],["logic-multisig-signature",typeof this.logicMultisigSignature<"u"?this.logicMultisigSignature.toEncodingData():void 0],["multisig-signature",typeof this.multisigSignature<"u"?this.multisigSignature.toEncodingData():void 0],["signature",this.signature]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionSignatureLogicsig: ${e}`);return new Vu({logic:e.get("logic"),args:e.get("args"),logicMultisigSignature:typeof e.get("logic-multisig-signature")<"u"?ki.fromEncodingData(e.get("logic-multisig-signature")):void 0,multisigSignature:typeof e.get("multisig-signature")<"u"?ki.fromEncodingData(e.get("multisig-signature")):void 0,signature:e.get("signature")})}}class ki{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"subsignature",valueSchema:new B(new He(Ou.encodingSchema)),omitEmpty:!0},{key:"threshold",valueSchema:new B(new Y),omitEmpty:!0},{key:"version",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({subsignature:e,threshold:t,version:r}){this.subsignature=e,this.threshold=typeof t>"u"?void 0:Xe(t),this.version=typeof r>"u"?void 0:Xe(r)}getEncodingSchema(){return ki.encodingSchema}toEncodingData(){return new Map([["subsignature",typeof this.subsignature<"u"?this.subsignature.map(e=>e.toEncodingData()):void 0],["threshold",this.threshold],["version",this.version]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionSignatureMultisig: ${e}`);return new ki({subsignature:typeof e.get("subsignature")<"u"?e.get("subsignature").map(t=>Ou.fromEncodingData(t)):void 0,threshold:e.get("threshold"),version:e.get("version")})}}class Ou{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"public-key",valueSchema:new B(new Je),omitEmpty:!0},{key:"signature",valueSchema:new B(new Je),omitEmpty:!0})),this.encodingSchemaValue}constructor({publicKey:e,signature:t}){this.publicKey=typeof e=="string"?lt(e):e,this.signature=typeof t=="string"?lt(t):t}getEncodingSchema(){return Ou.encodingSchema}toEncodingData(){return new Map([["public-key",this.publicKey],["signature",this.signature]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionSignatureMultisigSubsignature: ${e}`);return new Ou({publicKey:e.get("public-key"),signature:e.get("signature")})}}class Nu{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"message",valueSchema:new B(pu.encodingSchema),omitEmpty:!0},{key:"state-proof",valueSchema:new B(vu.encodingSchema),omitEmpty:!0},{key:"state-proof-type",valueSchema:new B(new Y),omitEmpty:!0})),this.encodingSchemaValue}constructor({message:e,stateProof:t,stateProofType:r}){this.message=e,this.stateProof=t,this.stateProofType=typeof r>"u"?void 0:Xe(r)}getEncodingSchema(){return Nu.encodingSchema}toEncodingData(){return new Map([["message",typeof this.message<"u"?this.message.toEncodingData():void 0],["state-proof",typeof this.stateProof<"u"?this.stateProof.toEncodingData():void 0],["state-proof-type",this.stateProofType]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionStateProof: ${e}`);return new Nu({message:typeof e.get("message")<"u"?pu.fromEncodingData(e.get("message")):void 0,stateProof:typeof e.get("state-proof")<"u"?vu.fromEncodingData(e.get("state-proof")):void 0,stateProofType:e.get("state-proof-type")})}}class _a{static get encodingSchema(){return this.encodingSchemaValue||(this.encodingSchemaValue=new Se([]),this.encodingSchemaValue.pushEntries({key:"current-round",valueSchema:new Y,omitEmpty:!0},{key:"transactions",valueSchema:new He(Hr.encodingSchema),omitEmpty:!0},{key:"next-token",valueSchema:new B(new Le),omitEmpty:!0})),this.encodingSchemaValue}constructor({currentRound:e,transactions:t,nextToken:r}){this.currentRound=Pe(e),this.transactions=t,this.nextToken=r}getEncodingSchema(){return _a.encodingSchema}toEncodingData(){return new Map([["current-round",this.currentRound],["transactions",this.transactions.map(e=>e.toEncodingData())],["next-token",this.nextToken]])}static fromEncodingData(e){if(!(e instanceof Map))throw new Error(`Invalid decoded TransactionsResponse: ${e}`);return new _a({currentRound:e.get("current-round"),transactions:(e.get("transactions")??[]).map(t=>Hr.fromEncodingData(t)),nextToken:e.get("next-token")})}}const j5=Object.freeze(Object.defineProperty({__proto__:null,Account:Xo,AccountParticipation:tu,AccountResponse:Th,AccountStateDelta:nu,AccountsResponse:Ih,Application:Pi,ApplicationLocalState:Qo,ApplicationLocalStatesResponse:Mh,ApplicationLogData:ru,ApplicationLogsResponse:Rh,ApplicationParams:iu,ApplicationResponse:Ch,ApplicationStateSchema:qr,ApplicationsResponse:ou,Asset:$i,AssetBalancesResponse:Ph,AssetHolding:Zo,AssetHoldingsResponse:$h,AssetParams:es,AssetResponse:Bh,AssetsResponse:su,Block:ja,BlockHeadersResponse:Vh,BlockRewards:au,BlockUpgradeState:cu,BlockUpgradeVote:uu,Box:Oh,BoxDescriptor:lu,BoxReference:ts,BoxesResponse:Nh,ErrorResponse:Sf,EvalDelta:hu,EvalDeltaKeyValue:ns,HashFactory:du,HbProofFields:fu,HealthCheck:Lh,HoldingRef:gu,IndexerStateProofMessage:pu,LocalsRef:mu,MerkleArrayProof:bi,MiniAssetHolding:yu,ParticipationUpdates:wu,ResourceRef:Su,StateProofFields:vu,StateProofParticipant:xu,StateProofReveal:Eu,StateProofSigSlot:bu,StateProofSignature:ku,StateProofTracking:Au,StateProofVerifier:Du,StateSchema:No,TealKeyValue:rs,TealValue:Fu,Transaction:Hr,TransactionApplication:Tu,TransactionAssetConfig:Iu,TransactionAssetFreeze:Mu,TransactionAssetTransfer:Ru,TransactionHeartbeat:Cu,TransactionKeyreg:Pu,TransactionPayment:$u,TransactionResponse:Uh,TransactionSignature:Bu,TransactionSignatureLogicsig:Vu,TransactionSignatureMultisig:ki,TransactionSignatureMultisigSubsignature:Ou,TransactionStateProof:Nu,TransactionsResponse:_a},Symbol.toStringTag,{value:"Module"}));class _5 extends Vt{path(){return"/health"}prepare(e){return Jt(e.getJSONText(),Lh)}}class z5 extends Vt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/assets/${this.index}/balances`}limit(e){return this.query.limit=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}prepare(e){return Jt(e.getJSONText(),Ph)}}function vf(n){return typeof n=="string"?n:Zn(n)}class q5 extends Vt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}/transactions`}notePrefix(e){return this.query["note-prefix"]=vf(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}assetID(e){return this.query["asset-id"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e instanceof Date?e.toISOString():e,this}afterTime(e){return this.query["after-time"]=e instanceof Date?e.toISOString():e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}prepare(e){return Jt(e.getJSONText(),_a)}}class H5 extends Vt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/assets/${this.index}/transactions`}notePrefix(e){return this.query["note-prefix"]=vf(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e instanceof Date?e.toISOString():e,this}afterTime(e){return this.query["after-time"]=e instanceof Date?e.toISOString():e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}addressRole(e){return this.query["address-role"]=e,this}address(e){return this.query.address=e.toString(),this}excludeCloseTo(e){return this.query["exclude-close-to"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}prepare(e){return Jt(e.getJSONText(),_a)}}class G5 extends Vt{constructor(e,t){super(e),this.round=BigInt(t)}path(){return`/v2/blocks/${this.round}`}headerOnly(e){return this.query["header-only"]=e,this}prepare(e){return Jt(e.getJSONText(),ja)}}class K5 extends Vt{constructor(e,t){super(e),this.txID=t}path(){return`/v2/transactions/${this.txID}`}prepare(e){return Jt(e.getJSONText(),Uh)}}class W5 extends Vt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}`}round(e){return this.query.round=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}exclude(e){return this.query.exclude=e,this}prepare(e){return Jt(e.getJSONText(),Th)}}class J5 extends Vt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}/assets`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}assetId(e){return this.query["asset-id"]=e,this}prepare(e){return Jt(e.getJSONText(),$h)}}class Y5 extends Vt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}/created-assets`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}assetID(e){return this.query["asset-id"]=e,this}prepare(e){return Jt(e.getJSONText(),su)}}class X5 extends Vt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}/apps-local-state`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}applicationID(e){return this.query["application-id"]=e,this}prepare(e){return Jt(e.getJSONText(),Mh)}}class Q5 extends Vt{constructor(e,t){super(e),this.account=t.toString()}path(){return`/v2/accounts/${this.account}/created-applications`}limit(e){return this.query.limit=e,this}round(e){return this.query.round=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}applicationID(e){return this.query["application-id"]=e,this}prepare(e){return Jt(e.getJSONText(),ou)}}class Z5 extends Vt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/assets/${this.index}`}includeAll(e=!0){return this.query["include-all"]=e,this}prepare(e){return Jt(e.getJSONText(),Bh)}}class eB extends Vt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/applications/${this.index}`}includeAll(e=!0){return this.query["include-all"]=e,this}prepare(e){return Jt(e.getJSONText(),Ch)}}class tB extends Vt{constructor(e,t){super(e),this.appID=BigInt(t)}path(){return`/v2/applications/${this.appID}/logs`}limit(e){return this.query.limit=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}nextToken(e){return this.query.next=e,this}sender(e){return this.query["sender-address"]=e,this}txid(e){return this.query.txid=e,this}prepare(e){return Jt(e.getJSONText(),Rh)}}class nB extends Vt{constructor(e,t,r){super(e),this.index=BigInt(t);const i=Zn(r);this.query.name=encodeURI(`b64:${i}`)}path(){return`/v2/applications/${this.index}/box`}prepare(e){return Jt(e.getJSONText(),Oh)}}class rB extends Vt{path(){return"/v2/accounts"}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}limit(e){return this.query.limit=e,this}assetID(e){return this.query["asset-id"]=e,this}nextToken(e){return this.query.next=e,this}round(e){return this.query.round=e,this}authAddr(e){return this.query["auth-addr"]=e.toString(),this}applicationID(e){return this.query["application-id"]=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}exclude(e){return this.query.exclude=e,this}onlineOnly(e){return this.query["online-only"]=e,this}prepare(e){return Jt(e.getJSONText(),Ih)}}class iB extends Vt{path(){return"/v2/block-headers"}absent(e){return this.query.absent=e,this}afterTime(e){return this.query["after-time"]=e instanceof Date?e.toISOString():e,this}beforeTime(e){return this.query["before-time"]=e instanceof Date?e.toISOString():e,this}expired(e){return this.query.expired=e,this}limit(e){return this.query.limit=e,this}maxRound(e){return this.query["max-round"]=e,this}minRound(e){return this.query["min-round"]=e,this}nextToken(e){return this.query.next=e,this}proposers(e){return this.query.proposers=e,this}prepare(e){return Jt(e.getJSONText(),Vh)}}class oB extends Vt{path(){return"/v2/transactions"}notePrefix(e){return this.query["note-prefix"]=vf(e),this}txType(e){return this.query["tx-type"]=e,this}sigType(e){return this.query["sig-type"]=e,this}txid(e){return this.query.txid=e,this}groupid(e){return this.query["group-id"]=vf(e),this}round(e){return this.query.round=e,this}minRound(e){return this.query["min-round"]=e,this}maxRound(e){return this.query["max-round"]=e,this}assetID(e){return this.query["asset-id"]=e,this}limit(e){return this.query.limit=e,this}beforeTime(e){return this.query["before-time"]=e instanceof Date?e.toISOString():e,this}afterTime(e){return this.query["after-time"]=e instanceof Date?e.toISOString():e,this}addressRole(e){return this.query["address-role"]=e,this}address(e){return this.query.address=e.toString(),this}excludeCloseTo(e){return this.query["exclude-close-to"]=e,this}nextToken(e){return this.query.next=e,this}rekeyTo(e){return this.query["rekey-to"]=e,this}applicationID(e){return this.query["application-id"]=e,this}currencyGreaterThan(e){return this.query["currency-greater-than"]=e.toString(),this}currencyLessThan(e){return this.query["currency-less-than"]=e,this}prepare(e){return Jt(e.getJSONText(),_a)}}class sB extends Vt{path(){return"/v2/assets"}limit(e){return this.query.limit=e,this}creator(e){return this.query.creator=e.toString(),this}name(e){return this.query.name=e,this}unit(e){return this.query.unit=e,this}index(e){return this.query["asset-id"]=e,this}nextToken(e){return this.query.next=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}prepare(e){return Jt(e.getJSONText(),su)}}class aB extends Vt{path(){return"/v2/applications"}index(e){return this.query["application-id"]=e,this}creator(e){return this.query.creator=e.toString(),this}nextToken(e){return this.query.next=e,this}limit(e){return this.query.limit=e,this}includeAll(e=!0){return this.query["include-all"]=e,this}prepare(e){return Jt(e.getJSONText(),ou)}}class cB extends Vt{constructor(e,t){super(e),this.index=BigInt(t)}path(){return`/v2/applications/${this.index}/boxes`}nextToken(e){return this.query.next=e,this}limit(e){return this.query.limit=e,this}prepare(e){return Jt(e.getJSONText(),Nh)}}class uB extends cE{constructor(e,t="http://127.0.0.1",r=8080,i={}){super("X-Indexer-API-Token",e,t,r,i)}makeHealthCheck(){return new _5(this.c)}lookupAssetBalances(e){return new z5(this.c,e)}lookupAssetTransactions(e){return new H5(this.c,e)}lookupAccountTransactions(e){return new q5(this.c,e)}lookupBlock(e){return new G5(this.c,e)}lookupTransactionByID(e){return new K5(this.c,e)}lookupAccountByID(e){return new W5(this.c,e)}lookupAccountAssets(e){return new J5(this.c,e)}lookupAccountCreatedAssets(e){return new Y5(this.c,e)}lookupAccountAppLocalStates(e){return new X5(this.c,e)}lookupAccountCreatedApplications(e){return new Q5(this.c,e)}lookupAssetByID(e){return new Z5(this.c,e)}lookupApplications(e){return new eB(this.c,e)}lookupApplicationLogs(e){return new tB(this.c,e)}searchAccounts(){return new rB(this.c)}searchForBlockHeaders(){return new iB(this.c)}searchForTransactions(){return new oB(this.c)}searchForAssets(){return new sB(this.c)}searchForApplications(){return new aB(this.c)}searchForApplicationBoxes(e){return new cB(this.c,e)}lookupApplicationBoxByIDandName(e,t){return new nB(this.c,e,t)}}async function cF(n,e,t){const r=await n.status().do();if(typeof r>"u")throw new Error("Unable to get node status");const i=r.lastRound+BigInt(1),o=i+BigInt(t);let s=i;for(;s<o;){let a=!1;try{const l=await n.pendingTransactionInformation(e).do();if(l.confirmedRound)return l;if(l.poolError)throw a=!0,new Error(`Transaction Rejected: ${l.poolError}`)}catch(l){if(a)throw l}await n.statusAfterBlock(s).do(),s+=BigInt(1)}throw new Error(`Transaction not confirmed after ${t} rounds`)}function za(n,e){let t=n.toString(16);t.length!==e*2&&(t=t.padStart(e*2,"0"));const r=new Uint8Array(t.length/2);for(let i=0,o=0;i<t.length/2;i++,o+=2)r[i]=parseInt(t.slice(o,o+2),16);return r}function hE(n){let e=BigInt(0);const t=new DataView(n.buffer,n.byteOffset);for(let r=0;r<n.length;r++)e=BigInt(Number(t.getUint8(r)))+e*BigInt(256);return e}function lB(){const n=d$();return{addr:new Pt(n.publicKey),sk:n.secretKey}}const ux=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"],Lp="failed to decode mnemonic",hB="the mnemonic contains a word that is not in the wordlist";function uF(n){const e=[];let t=0,r=0;function i(s){t|=s<<r,r+=8,r>=11&&(e.push(t&2047),t>>=11,r-=11)}function o(){r&&e.push(t)}return n.forEach(i),o(),e}function lF(n){return n.map(e=>ux[e])}function hF(n){const e=ro(n),t=uF(e);return lF(t)[0]}function dE(n){if(n.length!==wv)throw new RangeError(`Seed length must be ${wv}`);const e=uF(n),t=lF(e),r=hF(n);return`${t.join(" ")} ${r}`}function dB(n){const e=[];let t=0,r=0;function i(s){for(t|=s<<r,r+=11;r>=8;)e.push(t&255),t>>=8,r-=8}function o(){r&&e.push(t)}return n.forEach(i),o(),new Uint8Array(e)}function fE(n){const e=n.split(" "),t=e.slice(0,24);for(const a of t)if(ux.indexOf(a)===-1)throw new Error(hB);const r=e[e.length-1],i=t.map(a=>ux.indexOf(a));let o=dB(i);if(o.length!==33)throw new Error(Lp);if(o[o.length-1]!==0)throw new Error(Lp);if(o=o.slice(0,o.length-1),hF(o)===r)return o;throw new Error(Lp)}function fB(n){const e=fE(n),t=I2(e);return{addr:new Pt(t.publicKey),sk:t.secretKey}}function gB(n){const e=n.slice(0,wv);return dE(e)}function pB(n){return fE(n)}function mB(n){return dE(n)}const wb=16,yB=new TextEncoder().encode("TG");function wB(n){if(n.length>wb)throw new Error(`${n.length} transactions grouped together but max group size is ${wb}`);if(n.length===0)throw new Error("Cannot compute group ID of zero transactions");const e=nd({txlist:n});return jn(yB,e)}function dF(n){const e=[];for(const i of n)e.push(i.rawTxID());const t=wB(e),r=ro(t);return Uint8Array.from(r)}function fF(n){const e=dF(n);for(const t of n)t.group=e;return n}function SB(n,e,t){if(!e.verify(t.publicKey))throw new Error("Logic signature verification failed. Ensure the program and signature are valid.");let r;R2(t.publicKey,n.sender.publicKey)||(r=t);const i=new Sn({lsig:e,txn:n,sgnr:r});return{txID:n.txID(),blob:Yr(i)}}function gE(n,e){let t,r;if(e instanceof qs)t=e.lsig,r=e.address();else if(t=e,t.sig)r=new Pt(n.sender.publicKey);else if(t.lmsig){const i={version:t.lmsig.v,threshold:t.lmsig.thr,pks:t.lmsig.subsig.map(o=>o.pk)};r=io(i)}else r=t.address();return SB(n,t,r)}function vB(n,e){return gE(n,e)}const xB="Not enough multisig transactions to merge. Need at least two",EB="Cannot merge txs. txIDs differ",bB="Cannot merge txs. Auth addrs differ",Sb="Cannot merge txs. Multisig preimages differ",kB="Cannot merge txs. subsigs are mismatched.",AB="Cannot add multisig signature. Signature is not of the correct length.",DB="Key does not exist";function gF(n,{version:e,threshold:t,addrs:r}){const i=Gu(r),o=i.map(d=>({pk:d})),s={v:e,thr:t,subsig:o},a=io({version:e,threshold:t,pks:i});let l;n.sender.equals(a)||(l=a);const c=new Sn({txn:n,msig:s,sgnr:l});return Yr(c)}function pF(n,{rawSig:e,myPk:t},{version:r,threshold:i,pks:o}){const s=gF(n,{version:r,threshold:i,addrs:o.map(c=>new Pt(c))}),a=Tn(s,Sn);let l=!1;if(a.msig.subsig.forEach((c,d)=>{R2(c.pk,t)&&(l=!0,a.msig.subsig[d].s=e)}),!l)throw new Error(DB);return Yr(a)}function mF(n,{version:e,threshold:t,pks:r},i){const o=Fg(i).publicKey;return pF(n,{rawSig:n.rawSignTxn(i),myPk:o},{version:e,threshold:t,pks:r})}function FB(n,e,t,r){if(!M2(r.length))throw new Error(AB);const i=typeof t=="string"?Pt.fromString(t):t;return pF(n,{rawSig:r,myPk:i.publicKey},e)}function Ng(n){if(n.length<2)throw new Error(xB);const e=Tn(n[0],Sn);if(!e.msig)throw new Error("Invalid multisig transaction, multisig structure missing at index 0");const t=e.txn.txID(),r=e.sgnr?e.sgnr.toString():void 0,i={version:e.msig.v,threshold:e.msig.thr,pks:e.msig.subsig.map(d=>d.pk)},o=io(i),s=e.msig.subsig.map(d=>({...d}));for(let d=1;d<n.length;d++){const f=Tn(n[d],Sn);if(!f.msig)throw new Error(`Invalid multisig transaction, multisig structure missing at index ${d}`);if(f.txn.txID()!==t)throw new Error(EB);const m=f.sgnr?f.sgnr.toString():void 0;if(r!==m)throw new Error(bB);if(f.msig.subsig.length!==e.msig.subsig.length)throw new Error(Sb);const w={version:f.msig.v,threshold:f.msig.thr,pks:f.msig.subsig.map(I=>I.pk)},k=io(w);if(!o.equals(k))throw new Error(Sb);f.msig.subsig.forEach((I,x)=>{if(!I.s)return;const T=s[x];if(T.s&&!Mi(I.s,T.s))throw new Error(kB);T.s=I.s})}const a={v:e.msig.v,thr:e.msig.thr,subsig:s},l=typeof r<"u"?e.sgnr:void 0,c=new Sn({msig:a,txn:e.txn,sgnr:l});return Yr(c)}function yF(n,{version:e,threshold:t,addrs:r},i){const o=Gu(r),s=mF(n,{version:e,threshold:t,pks:o},i);return{txID:n.txID(),blob:s}}function TB(n,{version:e,threshold:t,addrs:r},i){const o=Gu(r),s=Tn(n,Sn),a=mF(s.txn,{version:e,threshold:t,pks:o},i);return{txID:s.txn.txID(),blob:Ng([n,a])}}function IB(n,{version:e,threshold:t,addrs:r},i,o){const s=Gu(r),a=Tn(n,Sn),l=FB(a.txn,{version:e,threshold:t,pks:s},i,o);return{txID:a.txn.txID(),blob:Ng([n,l])}}let wF={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split("").forEach(function(n,e){wF[n]=e});function MB(n){let e=[],t=0,r=0;for(let i=0;i<n.length;i+=1){let o=wF[n[i]];if(o===void 0)throw new Error("Invalid character ("+n[i]+")");const s=o&32;if(o&=31,r+=o<<t,s)t+=5;else{const a=r&1;r>>>=1,a?e.push(r===0?-2147483648:-r):e.push(r),r=t=0}}return e}class RB{constructor({version:e,sources:t,names:r,mappings:i}){if(this.version=e,this.sources=t,this.names=r,this.mappings=i,this.version!==3)throw new Error(`Only version 3 is supported, got ${this.version}`);if(this.mappings===void 0)throw new Error("mapping undefined, cannot build source map without `mapping`");const o=this.mappings.split(";").map(MB);this.pcToLocation=new Map,this.sourceAndLineToPc=new Map;const s={line:0,column:0,sourceIndex:0,nameIndex:0};for(const[a,l]of o.entries()){if(l.length<4)continue;const c=l.length>4?l[4]:void 0,[,d,f,m]=l;s.sourceIndex+=d,s.line+=f,s.column+=m,typeof c<"u"&&(s.nameIndex+=c);const w=`${s.sourceIndex}:${s.line}`;let k=this.sourceAndLineToPc.get(w);k===void 0&&(k=[],this.sourceAndLineToPc.set(w,k));const I={pc:a,column:s.column},x={line:s.line,column:s.column,sourceIndex:s.sourceIndex};typeof c<"u"&&(I.nameIndex=s.nameIndex,x.nameIndex=s.nameIndex),k.push(I),this.pcToLocation.set(a,x)}}getPcs(){return Array.from(this.pcToLocation.keys())}getLocationForPc(e){return this.pcToLocation.get(e)}getPcsOnSourceLine(e,t){const r=this.sourceAndLineToPc.get(`${e}:${t}`);return r===void 0?[]:r}}const CB=1380011588,pE=30;async function PB({client:n,txns:e,protocolVersion:t,latestTimestamp:r,round:i,sources:o}){const s=[],a=[],l=[],c=[],d=[];for(const k of e)if(k.txn.type===ln.appl)if(d.push(k.txn.sender.toString()),d.push(...k.txn.applicationCall.accounts.map(I=>I.toString())),l.push(...k.txn.applicationCall.foreignApps),d.push(...k.txn.applicationCall.foreignApps.map(Sv).map(I=>I.toString())),c.push(...k.txn.applicationCall.foreignAssets),k.txn.applicationCall.appIndex===BigInt(0))s.push(new Oa({id:CB,params:new Oc({creator:k.txn.sender.toString(),approvalProgram:k.txn.applicationCall.approvalProgram,clearStateProgram:k.txn.applicationCall.clearProgram,localStateSchema:new oi({numUint:k.txn.applicationCall.numLocalInts,numByteSlice:k.txn.applicationCall.numLocalByteSlices}),globalStateSchema:new oi({numUint:k.txn.applicationCall.numGlobalInts,numByteSlice:k.txn.applicationCall.numGlobalByteSlices})})}));else{const{appIndex:I}=k.txn.applicationCall;l.push(I),d.push(Sv(I).toString())}const f=[];for(const k of new Set(c))f.push(n.getAssetByID(k).do().then(I=>{d.push(I.params.creator)}));await Promise.all(f);const m=[];for(const k of new Set(l))m.push(n.getApplicationByID(k).do().then(I=>{s.push(I),d.push(I.params.creator.toString())}));await Promise.all(m);const w=[];for(const k of new Set(d))w.push(n.accountInformation(k).do().then(I=>{a.push(I)}));return await Promise.all(w),new mh({txns:e.slice(),accounts:a,apps:s,latestTimestamp:r??0,round:i??0,protocolVersion:t??"",sources:o??[]})}function Up(n,e){return n.length>e&&e>0?`${n.slice(0,e)}...`:n}function $B(n,e){if(e.length===0)return"";let t=null;for(let i=0;i<e.length;i++){if(i>n.length){t=i;continue}aa(n[i])!==aa(e[i])&&(t=i)}if(t==null)return"";const r=e[t];return r.bytes.length>0?`${t} = 0x${Mg(r.bytes)}`:`${t} = ${r.uint.toString()}`}function BB(n,e){return`[${(e?n.reverse():n).map(r=>{switch(r.type){case 1:return`0x${Mg(r.bytes)}`;case 2:return r.uint.toString();default:return""}}).join(", ")}]`}function SF(n,e,t){const r=t.maxValueWidth||pE,i=[["pc#","ln#","source","scratch","stack"]];for(let s=0;s<n.length;s++){const{line:a,error:l,pc:c,scratch:d,stack:f}=n[s],m=d!==void 0?d:[],w=s>0&&n[s-1].scratch!==void 0?n[s-1].scratch:[],k=l?`!! ${l} !!`:e[a];i.push([c.toString().padEnd(3," "),a.toString().padEnd(3," "),Up(k,r),Up($B(w,m),r),Up(BB(f,t.topOfStackFirst),r)])}const o=i.reduce((s,a)=>{const l=new Array(i[0].length).fill(0);for(let c=0;c<s.length;c++)l[c]=a[c].length>s[c]?a[c].length:s[c];return l},new Array(i[0].length).fill(0));return`${i.map(s=>s.map((a,l)=>a.padEnd(o[l]+1," ")).join("|").trim()).join(`
|
|
61
|
+
`)}
|
|
62
|
+
`}function VB(n,e){if(!n.appCallTrace||!n.disassembly)return"";let t=e;return e!==void 0?t=e:t={maxValueWidth:pE,topOfStackFirst:!1},SF(n.appCallTrace,n.disassembly,t)}function OB(n,e){if(!n.logicSigTrace||!n.logicSigDisassembly)return"";let t;return e!==void 0?t=e:t={maxValueWidth:pE,topOfStackFirst:!0},SF(n.logicSigTrace,n.logicSigDisassembly,t)}function NB({sender:n,receiver:e,amount:t,closeRemainderTo:r,suggestedParams:i,note:o,lease:s,rekeyTo:a}){return new Xr({type:ln.pay,sender:n,note:o,lease:s,rekeyTo:a,suggestedParams:i,paymentParams:{receiver:e,amount:t,closeRemainderTo:r}})}function LB({sender:n,voteKey:e,selectionKey:t,stateProofKey:r,voteFirst:i,voteLast:o,voteKeyDilution:s,nonParticipation:a,suggestedParams:l,note:c,lease:d,rekeyTo:f}){return new Xr({type:ln.keyreg,sender:n,note:c,lease:d,rekeyTo:f,suggestedParams:l,keyregParams:{voteKey:e,selectionKey:t,stateProofKey:r,voteFirst:i,voteLast:o,voteKeyDilution:s,nonParticipation:a}})}function Lg({sender:n,assetIndex:e,total:t,decimals:r,defaultFrozen:i,manager:o,reserve:s,freeze:a,clawback:l,unitName:c,assetName:d,assetURL:f,assetMetadataHash:m,note:w,lease:k,rekeyTo:I,suggestedParams:x}){return new Xr({type:ln.acfg,sender:n,note:w,lease:k,rekeyTo:I,suggestedParams:x,assetConfigParams:{assetIndex:e,total:t,decimals:r,defaultFrozen:i,manager:o,reserve:s,freeze:a,clawback:l,unitName:c,assetName:d,assetURL:f,assetMetadataHash:m}})}function UB({sender:n,total:e,decimals:t,defaultFrozen:r,manager:i,reserve:o,freeze:s,clawback:a,unitName:l,assetName:c,assetURL:d,assetMetadataHash:f,note:m,lease:w,rekeyTo:k,suggestedParams:I}){return Lg({sender:n,total:e,decimals:t,defaultFrozen:r,manager:i,reserve:o,freeze:s,clawback:a,unitName:l,assetName:c,assetURL:d,assetMetadataHash:f,note:m,lease:w,rekeyTo:k,suggestedParams:I})}function jB({sender:n,assetIndex:e,manager:t,reserve:r,freeze:i,clawback:o,strictEmptyAddressChecking:s,note:a,lease:l,rekeyTo:c,suggestedParams:d}){if(!e)throw Error("assetIndex must be provided");if((s??!0)&&(t==null||r==null||i==null||o==null))throw Error("strictEmptyAddressChecking is enabled, but an address is empty. If this is intentional, set strictEmptyAddressChecking to false.");return Lg({sender:n,assetIndex:e,manager:t,reserve:r,freeze:i,clawback:o,note:a,lease:l,rekeyTo:c,suggestedParams:d})}function _B({sender:n,assetIndex:e,note:t,lease:r,rekeyTo:i,suggestedParams:o}){if(!e)throw Error("assetIndex must be provided");return Lg({sender:n,assetIndex:e,note:t,lease:r,rekeyTo:i,suggestedParams:o})}function zB({sender:n,assetIndex:e,freezeTarget:t,frozen:r,suggestedParams:i,note:o,lease:s,rekeyTo:a}){return new Xr({type:ln.afrz,sender:n,note:o,lease:s,rekeyTo:a,suggestedParams:i,assetFreezeParams:{assetIndex:e,freezeTarget:t,frozen:r}})}function qB({sender:n,receiver:e,amount:t,closeRemainderTo:r,assetSender:i,note:o,assetIndex:s,suggestedParams:a,rekeyTo:l,lease:c}){if(!s)throw Error("assetIndex must be provided");return new Xr({type:ln.axfer,sender:n,note:o,lease:c,rekeyTo:l,suggestedParams:a,assetTransferParams:{assetIndex:s,receiver:e,amount:t,assetSender:i,closeRemainderTo:r}})}function ho({sender:n,appIndex:e,onComplete:t,appArgs:r,accounts:i,foreignApps:o,foreignAssets:s,boxes:a,convertToAccess:l,holdings:c,locals:d,access:f,approvalProgram:m,clearProgram:w,numLocalInts:k,numLocalByteSlices:I,numGlobalInts:x,numGlobalByteSlices:T,extraPages:b,rejectVersion:R,note:L,lease:G,rekeyTo:E,suggestedParams:N}){if(t==null)throw Error("onComplete must be provided");if(f&&(i||o||s||a||c||d))throw Error("cannot specify both access and other access fields");let p=f;return l&&(p=A8({appIndex:e,accounts:i,foreignApps:o,foreignAssets:s,holdings:c,locals:d,boxes:a})),new Xr({type:ln.appl,sender:n,note:L,lease:G,rekeyTo:E,suggestedParams:N,appCallParams:{appIndex:e,onComplete:t,appArgs:r,accounts:p?void 0:i,foreignAssets:p?void 0:s,foreignApps:p?void 0:o,boxes:p?void 0:a,access:p,approvalProgram:m,clearProgram:w,numLocalInts:k,numLocalByteSlices:I,numGlobalInts:x,numGlobalByteSlices:T,extraPages:b,rejectVersion:R}})}function HB({sender:n,onComplete:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,approvalProgram:f,clearProgram:m,numLocalInts:w,numLocalByteSlices:k,numGlobalInts:I,numGlobalByteSlices:x,extraPages:T,note:b,lease:R,rekeyTo:L,suggestedParams:G}){if(!f||!m)throw Error("approvalProgram and clearProgram must be provided");if(e==null)throw Error("onComplete must be provided");return ho({sender:n,appIndex:0,onComplete:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,approvalProgram:f,clearProgram:m,numLocalInts:w,numLocalByteSlices:k,numGlobalInts:I,numGlobalByteSlices:x,extraPages:T,note:b,lease:R,rekeyTo:L,suggestedParams:G})}function GB({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,approvalProgram:f,clearProgram:m,note:w,lease:k,rekeyTo:I,suggestedParams:x}){if(!e)throw Error("appIndex must be provided");if(!f||!m)throw Error("approvalProgram and clearProgram must be provided");return ho({sender:n,appIndex:e,onComplete:tr.UpdateApplicationOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,approvalProgram:f,clearProgram:m,note:w,lease:k,rekeyTo:I,suggestedParams:x})}function KB({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k}){if(!e)throw Error("appIndex must be provided");return ho({sender:n,appIndex:e,onComplete:tr.DeleteApplicationOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k})}function WB({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k}){if(!e)throw Error("appIndex must be provided");return ho({sender:n,appIndex:e,onComplete:tr.OptInOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,note:f,convertToAccess:a,holdings:l,locals:c,access:d,lease:m,rekeyTo:w,suggestedParams:k})}function JB({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k}){if(!e)throw Error("appIndex must be provided");return ho({sender:n,appIndex:e,onComplete:tr.CloseOutOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k})}function YB({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k}){if(!e)throw Error("appIndex must be provided");return ho({sender:n,appIndex:e,onComplete:tr.ClearStateOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k})}function XB({sender:n,appIndex:e,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k}){if(!e)throw Error("appIndex must be provided");return ho({sender:n,appIndex:e,onComplete:tr.NoOpOC,appArgs:t,accounts:r,foreignApps:i,foreignAssets:o,boxes:s,convertToAccess:a,holdings:l,locals:c,access:d,note:f,lease:m,rekeyTo:w,suggestedParams:k})}function QB(n){return(e,t)=>{const r=[];for(const i of t)r.push(e[i].signTxn(n.sk));return Promise.resolve(r)}}function ZB(n){return(e,t)=>{const r=[];for(const i of t){const{blob:o}=gE(e[i],n);r.push(o)}return Promise.resolve(r)}}function eV(n,e){return(t,r)=>{const i=[];for(const o of r){const s=t[o],a=[];for(const l of e){const{blob:c}=yF(s,n,l);a.push(c)}a.length>1?i.push(Ng(a)):i.push(a[0])}return Promise.resolve(i)}}function tV(){return(n,e)=>{const t=[];for(const r of e)t.push(nF(n[r]));return Promise.resolve(t)}}function lx(n){return typeof n=="object"&&Object.keys(n).length===2&&typeof n.txn=="object"&&typeof n.signer=="function"}const Hs=2**16-1,vF=32,xF=1,EF=1,Er=2,nV=/^([a-z\d[\](),]+)\[(0|[1-9][\d]*)]$/,rV=/^ufixed([1-9][\d]*)x([1-9][\d]*)$/;class ur{static from(e){if(e.endsWith("[]")){const t=ur.from(e.slice(0,e.length-2));return new qg(t)}if(e.endsWith("]")){const t=e.match(nV);if(!t||t.length!==3)throw new Error(`malformed static array string: ${e}`);const r=t[2],i=parseInt(r,10);if(i>Hs)throw new Error(`array length exceeds limit ${Hs}`);const o=ur.from(t[1]);return new zg(o,i)}if(e.startsWith("uint")){const t=o=>[...o].every(s=>"0123456789".includes(s)),r=e.slice(4,e.length);if(!t(r))throw new Error(`malformed uint string: ${r}`);const i=parseInt(r,10);if(i>Hs)throw new Error(`malformed uint string: ${i}`);return new Gs(i)}if(e==="byte")return new jg;if(e.startsWith("ufixed")){const t=e.match(rV);if(!t||t.length!==3)throw new Error(`malformed ufixed type: ${e}`);const r=parseInt(t[1],10),i=parseInt(t[2],10);return new Ug(r,i)}if(e==="bool")return new Yi;if(e==="address")return new rd;if(e==="string")return new _g;if(e.length>=2&&e[0]==="("&&e[e.length-1]===")"){const t=ao.parseTupleContent(e.slice(1,e.length-1)),r=[];for(let i=0;i<t.length;i++){const o=ur.from(t[i]);r.push(o)}return new ao(r)}throw new Error(`cannot convert a string ${e} to an ABI type`)}}class Gs extends ur{constructor(e){if(super(),e%8!==0||e<8||e>512)throw new Error(`unsupported uint type bitSize: ${e}`);this.bitSize=e}toString(){return`uint${this.bitSize}`}equals(e){return e instanceof Gs&&this.bitSize===e.bitSize}isDynamic(){return!1}byteLen(){return this.bitSize/8}encode(e){if(typeof e!="bigint"&&typeof e!="number")throw new Error(`Cannot encode value as uint${this.bitSize}: ${e}`);if(e>=BigInt(2**this.bitSize)||e<BigInt(0))throw new Error(`${e} is not a non-negative int or too big to fit in size uint${this.bitSize}`);if(typeof e=="number"&&!Number.isSafeInteger(e))throw new Error(`${e} should be converted into a BigInt before it is encoded`);return za(e,this.bitSize/8)}decode(e){if(e.length!==this.bitSize/8)throw new Error(`byte string must correspond to a uint${this.bitSize}`);return hE(e)}}class Ug extends ur{constructor(e,t){if(super(),e%8!==0||e<8||e>512)throw new Error(`unsupported ufixed type bitSize: ${e}`);if(t>160||t<1)throw new Error(`unsupported ufixed type precision: ${t}`);this.bitSize=e,this.precision=t}toString(){return`ufixed${this.bitSize}x${this.precision}`}equals(e){return e instanceof Ug&&this.bitSize===e.bitSize&&this.precision===e.precision}isDynamic(){return!1}byteLen(){return this.bitSize/8}encode(e){if(typeof e!="bigint"&&typeof e!="number")throw new Error(`Cannot encode value as ${this.toString()}: ${e}`);if(e>=BigInt(2**this.bitSize)||e<BigInt(0))throw new Error(`${e} is not a non-negative int or too big to fit in size ${this.toString()}`);if(typeof e=="number"&&!Number.isSafeInteger(e))throw new Error(`${e} should be converted into a BigInt before it is encoded`);return za(e,this.bitSize/8)}decode(e){if(e.length!==this.bitSize/8)throw new Error(`byte string must correspond to a ${this.toString()}`);return hE(e)}}class rd extends ur{toString(){return"address"}equals(e){return e instanceof rd}isDynamic(){return!1}byteLen(){return vF}encode(e){if(typeof e=="string")return $2(e).publicKey;if(e instanceof Pt)return e.publicKey;if(e instanceof Uint8Array){if(e.byteLength!==32)throw new Error("byte string must be 32 bytes long for an address");return e}throw new Error(`Cannot encode value as ${this.toString()}: ${e}`)}decode(e){if(e.byteLength!==32)throw new Error("byte string must be 32 bytes long for an address");return V2(e)}}class Yi extends ur{toString(){return"bool"}equals(e){return e instanceof Yi}isDynamic(){return!1}byteLen(){return EF}encode(e){if(typeof e!="boolean")throw new Error(`Cannot encode value as bool: ${e}`);return e?new Uint8Array([128]):new Uint8Array([0])}decode(e){if(e.byteLength!==1)throw new Error("bool string must be 1 byte long");const t=e[0];if(t===128)return!0;if(t===0)return!1;throw new Error("boolean could not be decoded from the byte string")}}class jg extends ur{toString(){return"byte"}equals(e){return e instanceof jg}isDynamic(){return!1}byteLen(){return xF}encode(e){if(typeof e!="number"&&typeof e!="bigint")throw new Error(`Cannot encode value as byte: ${e}`);if(typeof e=="bigint"&&(e=Number(e)),e<0||e>255)throw new Error(`${e} cannot be encoded into a byte`);return new Uint8Array([e])}decode(e){if(e.byteLength!==1)throw new Error("byte string must be 1 byte long");return e[0]}}class _g extends ur{toString(){return"string"}equals(e){return e instanceof _g}isDynamic(){return!0}byteLen(){throw new Error(`${this.toString()} is a dynamic type`)}encode(e){if(typeof e!="string"&&!(e instanceof Uint8Array))throw new Error(`Cannot encode value as string: ${e}`);let t;typeof e=="string"?t=new TextEncoder().encode(e):t=e;const r=za(t.length,Er),i=new Uint8Array(t.length+Er);return i.set(r),i.set(t,Er),i}decode(e){if(e.length<Er)throw new Error(`byte string is too short to be decoded. Actual length is ${e.length}, but expected at least ${Er}`);const r=new DataView(e.buffer,e.byteOffset,Er).getUint16(0),i=e.slice(Er,e.length);if(r!==i.length)throw new Error(`string length bytes do not match the actual length of string. Expected ${r}, got ${i.length}`);return new TextDecoder("utf-8").decode(i)}}class zg extends ur{constructor(e,t){if(super(),t<0)throw new Error(`static array must have a non negative length: ${t}`);this.childType=e,this.staticLength=t}toString(){return`${this.childType.toString()}[${this.staticLength}]`}equals(e){return e instanceof zg&&this.staticLength===e.staticLength&&this.childType.equals(e.childType)}isDynamic(){return this.childType.isDynamic()}byteLen(){return this.childType.constructor===Yi?Math.ceil(this.staticLength/8):this.staticLength*this.childType.byteLen()}encode(e){if(!Array.isArray(e)&&!(e instanceof Uint8Array))throw new Error(`Cannot encode value as ${this.toString()}: ${e}`);if(e.length!==this.staticLength)throw new Error(`Value array does not match static array length. Expected ${this.staticLength}, got ${e.length}`);return this.toABITupleType().encode(e)}decode(e){return this.toABITupleType().decode(e)}toABITupleType(){return new ao(Array(this.staticLength).fill(this.childType))}}class qg extends ur{constructor(e){super(),this.childType=e}toString(){return`${this.childType.toString()}[]`}equals(e){return e instanceof qg&&this.childType.equals(e.childType)}isDynamic(){return!0}byteLen(){throw new Error(`${this.toString()} is a dynamic type`)}encode(e){if(!Array.isArray(e)&&!(e instanceof Uint8Array))throw new Error(`Cannot encode value as ${this.toString()}: ${e}`);const t=this.toABITupleType(e.length),r=t.encode(e),i=za(t.childTypes.length,Er);return jn(i,r)}decode(e){const r=new DataView(e.buffer,0,Er).getUint16(0);return this.toABITupleType(r).decode(e.slice(Er,e.length))}toABITupleType(e){return new ao(Array(e).fill(this.childType))}}class ao extends ur{constructor(e){if(super(),e.length>=Hs)throw new Error("tuple type child type number larger than maximum uint16 error");this.childTypes=e}toString(){const e=[];for(let t=0;t<this.childTypes.length;t++)e[t]=this.childTypes[t].toString();return`(${e.join(",")})`}equals(e){return e instanceof ao&&this.childTypes.length===e.childTypes.length&&this.childTypes.every((t,r)=>t.equals(e.childTypes[r]))}isDynamic(){const e=t=>t.isDynamic();return this.childTypes.some(e)}byteLen(){let e=0;for(let t=0;t<this.childTypes.length;t++)if(this.childTypes[t].constructor===Yi){const r=pl(this.childTypes,t,1),i=r+1;t+=r,e+=Math.trunc((i+7)/8)}else{const r=this.childTypes[t].byteLen();e+=r}return e}encode(e){if(!Array.isArray(e)&&!(e instanceof Uint8Array))throw new Error(`Cannot encode value as ${this.toString()}: ${e}`);const t=Array.from(e);if(e.length>Hs)throw new Error("length of tuple array should not exceed a uint16");const r=this.childTypes,i=[],o=[],s=new Map;let a=0;for(;a<r.length;){const d=r[a];if(d.isDynamic())s.set(i.length,!0),i.push(new Uint8Array([0,0])),o.push(d.encode(t[a]));else{if(d.constructor===Yi){const f=pl(r,a,-1);let m=pl(r,a,1);if(f%8!==0)throw new Error("expected before index should have number of bool mod 8 equal 0");m=Math.min(7,m);const w=iV(t.slice(a,a+m+1));i.push(za(w,1)),a+=m}else{const f=d.encode(t[a]);i.push(f)}s.set(a,!1),o.push(new Uint8Array)}a+=1}let l=0;for(const d of i)l+=d.length;let c=0;for(let d=0;d<i.length;d++){if(s.get(d)){const f=l+c;if(f>Hs)throw new Error(`byte length of ${f} should not exceed a uint16`);i[d]=za(f,Er)}c+=o[d].length}return jn(...i,...o)}decode(e){const t=this.childTypes,r=[],i=[];let o=0,s=0;const a=new DataView(e.buffer);for(;o<t.length;){const d=t[o];if(d.isDynamic()){if(e.slice(s,e.length).length<Er)throw new Error("dynamic type in tuple is too short to be decoded");const f=a.getUint16(s);if(r.length>0&&(r[r.length-1].right=f,f<r[r.length-1].left))throw new Error("dynamic index segment miscalculation: left is greater than right index");const m={left:f,right:-1};r.push(m),i.push(null),s+=Er}else if(d.constructor===Yi){const f=pl(this.childTypes,o,-1);let m=pl(this.childTypes,o,1);if(f%8!==0)throw new Error("expected before bool number mod 8 === 0");m=Math.min(7,m);for(let w=0;w<=m;w++){const k=128>>w;(e[s]&k)>0?i.push(new Uint8Array([128])):i.push(new Uint8Array([0]))}o+=m,s+=1}else{const f=d.byteLen();i.push(e.slice(s,s+f)),s+=f}if(o!==t.length-1&&s>=e.length)throw new Error("input byte not enough to decode");o+=1}if(r.length>0&&(r[r.length-1].right=e.length,s=e.length),s<e.length)throw new Error("input byte not fully consumed");for(let d=0;d<r.length;d++){const f=r[d];if(f.left>f.right)throw new Error("dynamic segment should display a [l, r] space with l <= r");if(d!==r.length-1&&f.right!==r[d+1].left)throw new Error("dynamic segment should be consecutive")}let l=0;for(let d=0;d<t.length;d++)t[d].isDynamic()&&(i[d]=e.slice(r[l].left,r[l].right),l+=1);const c=[];for(let d=0;d<t.length;d++){const f=t[d].decode(i[d]);c.push(f)}return c}static parseTupleContent(e){if(e.length===0)return[];if(e.endsWith(",")||e.startsWith(","))throw new Error("tuple string should not start with comma");if(e.includes(",,"))throw new Error("tuple string should not have consecutive commas");const t=[];let r=0,i="";for(const o of e)i+=o,o==="("?r+=1:o===")"?r-=1:o===","&&r===0&&(t.push(i.slice(0,i.length-1)),i="");if(i.length!==0&&t.push(i),r!==0)throw new Error("tuple string has mismatched parentheses");return t}}function iV(n){let e=0;if(n.length>8)throw new Error("value list passed in should be no greater than length 8");for(let t=0;t<n.length;t++){const r=n[t];if(typeof r!="boolean")throw new Error("non-boolean values cannot be compressed into a byte");r&&(e|=1<<7-t)}return e}function pl(n,e,t){let r=0;for(;;){const i=e+t*r;if(n[i].constructor===Yi)if(i!==n.length-1&&t===1)r+=1;else if(i>0&&t===-1)r+=1;else break;else{r-=1;break}}return r}var ni;(function(n){n.any="txn",n.pay="pay",n.keyreg="keyreg",n.acfg="acfg",n.axfer="axfer",n.afrz="afrz",n.appl="appl"})(ni||(ni={}));function xf(n){return n===ni.any||n===ni.pay||n===ni.keyreg||n===ni.acfg||n===ni.axfer||n===ni.afrz||n===ni.appl}function bF(n,e){return n===ni.any?!0:e.type?e.type.toString()===n.toString():!1}var Xi;(function(n){n.account="account",n.application="application",n.asset="asset"})(Xi||(Xi={}));function mE(n){return n===Xi.account||n===Xi.application||n===Xi.asset}function oV(n){const e=n.indexOf("(");if(e===-1)throw new Error(`Invalid method signature: ${n}`);let t=-1,r=0;for(let i=e;i<n.length;i++){const o=n[i];if(o==="(")r+=1;else if(o===")"){if(r===0)break;if(r-=1,r===0){t=i;break}}}if(t===-1)throw new Error(`Invalid method signature: ${n}`);return{name:n.slice(0,e),args:ao.parseTupleContent(n.slice(e+1,t)),returns:n.slice(t+1)}}class Wu{constructor(e){if(typeof e.name!="string"||typeof e.returns!="object"||!Array.isArray(e.args))throw new Error("Invalid ABIMethod parameters");this.name=e.name,this.description=e.desc,this.args=e.args.map(({type:t,name:r,desc:i})=>xf(t)||mE(t)?{type:t,name:r,description:i}:{type:ur.from(t),name:r,description:i}),this.returns={type:e.returns.type==="void"?e.returns.type:ur.from(e.returns.type),description:e.returns.desc},this.events=e.events,this.readonly=e.readonly}getSignature(){const e=this.args.map(r=>r.type.toString()).join(","),t=this.returns.type.toString();return`${this.name}(${e})${t}`}getSelector(){const e=ro(this.getSignature());return new Uint8Array(e.slice(0,4))}txnCount(){let e=1;for(const t of this.args)typeof t.type=="string"&&xf(t.type)&&(e+=1);return e}toJSON(){return{name:this.name,desc:this.description,args:this.args.map(({type:e,name:t,description:r})=>({type:e.toString(),name:t,desc:r})),returns:{type:this.returns.type.toString(),desc:this.returns.description},events:this.events,readonly:this.readonly}}static fromSignature(e){const{name:t,args:r,returns:i}=oV(e);return new Wu({name:t,args:r.map(o=>({type:o})),returns:{type:i}})}}function yE(n,e){if(n===null||!Array.isArray(n)||!n.every(r=>r instanceof Wu))throw new Error("Methods list provided is null or not the correct type");const t=n.filter(r=>r.name===e);if(t.length>1)throw new Error(`found ${t.length} methods with the same name ${t.map(r=>r.getSignature()).join(",")}`);if(t.length===0)throw new Error(`found 0 methods with the name ${e}`);return t[0]}class sV{constructor(e){if(typeof e.name!="string"||!Array.isArray(e.methods)||e.networks&&typeof e.networks!="object")throw new Error("Invalid ABIContract parameters");this.name=e.name,this.description=e.desc,this.networks=e.networks?{...e.networks}:{},this.methods=e.methods.map(t=>new Wu(t)),this.events=e.events}toJSON(){return{name:this.name,desc:this.description,networks:this.networks,methods:this.methods.map(e=>e.toJSON()),events:this.events}}getMethodByName(e){return yE(this.methods,e)}}class aV{constructor(e){if(typeof e.name!="string"||!Array.isArray(e.methods))throw new Error("Invalid ABIInterface parameters");this.name=e.name,this.description=e.desc,this.methods=e.methods.map(t=>new Wu(t))}toJSON(){return{name:this.name,desc:this.description,methods:this.methods.map(e=>e.toJSON())}}getMethodByName(e){return yE(this.methods,e)}}const cV=new Uint8Array([21,31,124,117]),ml=16;var ir;(function(n){n[n.BUILDING=0]="BUILDING",n[n.BUILT=1]="BUILT",n[n.SIGNED=2]="SIGNED",n[n.SUBMITTED=3]="SUBMITTED",n[n.COMMITTED=4]="COMMITTED"})(ir||(ir={}));function jp(n,e,t){if(t!=null&&n===t)return 0;const r=t==null?0:1;for(let i=0;i<e.length;i++)if(n===e[i])return i+r;return e.push(n),e.length-1+r}class pi{constructor(){this.status=ir.BUILDING,this.transactions=[],this.methodCalls=new Map,this.signedTxns=[],this.txIDs=[]}getStatus(){return this.status}count(){return this.transactions.length}clone(){const e=new pi;return e.transactions=this.transactions.map(({txn:t,signer:r})=>{const i=t.toEncodingData();return i.delete("grp"),{txn:Xr.fromEncodingData(i),signer:r}}),e.methodCalls=new Map(this.methodCalls),e}addTransaction(e){if(this.status!==ir.BUILDING)throw new Error("Cannot add transactions when composer status is not BUILDING");if(this.transactions.length===pi.MAX_GROUP_SIZE)throw new Error(`Adding an additional transaction exceeds the maximum atomic group size of ${pi.MAX_GROUP_SIZE}`);if(e.txn.group&&e.txn.group.some(t=>t!==0))throw new Error("Cannot add a transaction with nonzero group ID");this.transactions.push(e)}addMethodCall({appID:e,method:t,methodArgs:r,sender:i,suggestedParams:o,onComplete:s,approvalProgram:a,clearProgram:l,numGlobalInts:c,numGlobalByteSlices:d,numLocalInts:f,numLocalByteSlices:m,extraPages:w,appAccounts:k,appForeignApps:I,appForeignAssets:x,boxes:T,access:b,note:R,lease:L,rekeyTo:G,rejectVersion:E,signer:N}){if(this.status!==ir.BUILDING)throw new Error("Cannot add transactions when composer status is not BUILDING");if(this.transactions.length+t.txnCount()>pi.MAX_GROUP_SIZE)throw new Error(`Adding additional transactions exceeds the maximum atomic group size of ${pi.MAX_GROUP_SIZE}`);if(BigInt(e)===BigInt(0)){if(a==null||l==null||c==null||d==null||f==null||m==null)throw new Error("One of the following required parameters for application creation is missing: approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices")}else if(s===tr.UpdateApplicationOC){if(a==null||l==null)throw new Error("One of the following required parameters for OnApplicationComplete.UpdateApplicationOC is missing: approvalProgram, clearProgram");if(c!=null||d!=null||f!=null||m!=null||w!=null)throw new Error("One of the following application creation parameters were set on a non-creation call: numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages")}else if(a!=null||l!=null||c!=null||d!=null||f!=null||m!=null||w!=null)throw new Error("One of the following application creation parameters were set on a non-creation call: approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages");if(b&&(k||I||x||T))throw new Error("Cannot specify both access and legacy foreign arrays (appAccounts, appForeignApps, appForeignAssets, boxes)");if(r==null&&(r=[]),r.length!==t.args.length)throw new Error(`Incorrect number of method arguments. Expected ${t.args.length}, got ${r.length}`);let p=[],F=[];const v=[],O=[],C=[],V=new Map,H=T||[];for(let ve=0;ve<r.length;ve++){let Te=t.args[ve].type;const de=r[ve];if(xf(Te)){if(!lx(de)||!bF(Te,de.txn))throw new Error(`Expected ${Te} TransactionWithSigner for argument at index ${ve}`);if(de.txn.group&&de.txn.group.some(ie=>ie!==0))throw new Error("Cannot add a transaction with nonzero group ID");v.push(de);continue}if(lx(de))throw new Error(`Expected non-transaction value for argument at index ${ve}`);if(mE(Te)&&(V.set(O.length,p.length),O.push(Te),C.push(de),Te=new Gs(8)),typeof Te=="string")throw new Error(`Unknown ABI type: ${Te}`);p.push(Te),F.push(de)}const _=[],ee=k==null?[]:k.map(ve=>ve.toString()),oe=I==null?[]:I.map(wn),z=x==null?[]:x.map(wn);for(let ve=0;ve<O.length;ve++){const Te=O[ve],de=C[ve];let ie=0;switch(Te){case Xi.account:{const ke=new rd,Ie=ke.decode(ke.encode(de));ie=jp(Ie,ee,i.toString());break}case Xi.application:{const ke=new Gs(64),Ie=ke.decode(ke.encode(de));if(Ie>Number.MAX_SAFE_INTEGER)throw new Error(`Expected safe integer for application value, got ${Ie}`);ie=jp(Ie,oe,wn(e));break}case Xi.asset:{const ke=new Gs(64),Ie=ke.decode(ke.encode(de));if(Ie>Number.MAX_SAFE_INTEGER)throw new Error(`Expected safe integer for asset value, got ${Ie}`);ie=jp(Ie,z);break}default:throw new Error(`Unknown reference type: ${Te}`)}_.push(ie)}for(let ve=0;ve<_.length;ve++){const Te=V.get(ve);F[Te]=_[ve]}if(p.length>ml-1){const ve=p.slice(ml-2),Te=F.slice(ml-2);p=p.slice(0,ml-2),F=F.slice(0,ml-2),p.push(new ao(ve)),F.push(Te)}const ue=[t.getSelector()];for(let ve=0;ve<p.length;ve++)ue.push(p[ve].encode(F[ve]));const De={txn:ho({sender:i,appIndex:e,appArgs:ue,accounts:b?void 0:ee,foreignApps:b?void 0:oe,foreignAssets:b?void 0:z,boxes:b?void 0:H,access:b,onComplete:s??tr.NoOpOC,approvalProgram:a,clearProgram:l,numGlobalInts:c,numGlobalByteSlices:d,numLocalInts:f,numLocalByteSlices:m,extraPages:w,rejectVersion:E,lease:L,note:R,rekeyTo:G,suggestedParams:o}),signer:N};this.transactions.push(...v,De),this.methodCalls.set(this.transactions.length-1,t)}buildGroup(){if(this.status===ir.BUILDING){if(this.transactions.length===0)throw new Error("Cannot build a group with 0 transactions");this.transactions.length>1&&fF(this.transactions.map(e=>e.txn)),this.status=ir.BUILT}return this.transactions}async gatherSignatures(){if(this.status>=ir.SIGNED)return this.signedTxns;const e=this.buildGroup(),t=e.map(c=>c.txn),r=new Map;for(let c=0;c<e.length;c++){const{signer:d}=e[c];r.has(d)||r.set(d,[]),r.get(d).push(c)}const i=Array.from(r),o=await Promise.all(i.map(([c,d])=>c(t,d))),s=e.map(()=>null);for(let c=0;c<i.length;c++){const d=i[c][1],f=o[c];for(let m=0;m<d.length;m++)s[d[m]]=f[m]}function a(c){return c.every(d=>d!=null)}if(!a(s))throw new Error(`Missing signatures. Got ${s}`);const l=s.map((c,d)=>{try{return Tn(c,Sn).txn.txID()}catch(f){throw new Error(`Cannot decode signed transaction at index ${d}. ${f}`)}});return this.signedTxns=s,this.txIDs=l,this.status=ir.SIGNED,s}async submit(e){if(this.status>ir.SUBMITTED)throw new Error("Transaction group cannot be resubmitted");const t=await this.gatherSignatures();return await e.sendRawTransaction(t).do(),this.status=ir.SUBMITTED,this.txIDs}async simulate(e,t){if(this.status>ir.SUBMITTED)throw new Error("Simulated Transaction group has already been submitted to the network");const i=(await this.gatherSignatures()).map(l=>Tn(l,Sn)),o=t??new Yc({txnGroups:[]});o.txnGroups=[new Wo({txns:i})];const s=await e.simulateTransactions(o).do(),a=[];for(const[l,c]of this.methodCalls){const d=this.txIDs[l],f=s.txnGroups[0].txnResults[l].txnResult,m={txID:d,rawReturnValue:new Uint8Array,method:c};a.push(pi.parseMethodResponse(c,m,f))}return{methodResults:a,simulateResponse:s}}async execute(e,t){if(this.status===ir.COMMITTED)throw new Error("Transaction group has already been executed successfully");const r=await this.submit(e);this.status=ir.SUBMITTED;const i=this.transactions.findIndex((c,d)=>this.methodCalls.has(d)),s=await cF(e,r[i===-1?0:i],t);this.status=ir.COMMITTED;const a=s.confirmedRound,l=[];for(const[c,d]of this.methodCalls){const f=r[c];let m={txID:f,rawReturnValue:new Uint8Array,method:d};try{const w=c===i?s:await e.pendingTransactionInformation(f).do();m=pi.parseMethodResponse(d,m,w)}catch(w){m.decodeError=w}l.push(m)}return{confirmedRound:a,txIDs:r,methodResults:l}}static parseMethodResponse(e,t,r){const i=t;try{if(i.txInfo=r,e.returns.type!=="void"){const o=r.logs||[];if(o.length===0)throw new Error(`App call transaction did not log a return value ${aa(r)}`);const s=o[o.length-1];if(s.byteLength<4||!Mi(s.slice(0,4),cV))throw new Error(`App call transaction did not log a ABI return value ${aa(r)}`);i.rawReturnValue=new Uint8Array(s.slice(4)),i.returnValue=e.returns.type.decode(t.rawReturnValue)}}catch(o){i.decodeError=o}return i}}pi.MAX_GROUP_SIZE=16;const kF=Uint8Array.from([77,88]),AF="The transaction sender address and multisig preimage do not match.";function uV(n,e){return{txID:n.txID(),blob:n.signTxn(e)}}function lV(n,e){const t=jn(kF,n);return ih(t,e)}function hV(n,e,t){const r=jn(kF,n),i=typeof t=="string"?Pt.fromString(t):t;return Tg(r,e,i.publicKey)}const dV=new Error(AF),fV=new Error(aE),Za=Object.freeze(Object.defineProperty({__proto__:null,ABIAddressType:rd,ABIArrayDynamicType:qg,ABIArrayStaticType:zg,ABIBoolType:Yi,ABIByteType:jg,ABIContract:sV,ABIInterface:aV,ABIMethod:Wu,get ABIReferenceType(){return Xi},ABIStringType:_g,get ABITransactionType(){return ni},ABITupleType:ao,ABIType:ur,ABIUfixedType:Ug,ABIUintType:Gs,ADDR_BYTE_SIZE:vF,ALGORAND_ZERO_ADDRESS_STRING:y$,AccountBaseData:Ia,AccountData:Ma,AccountDeltas:Ca,AccountTotals:Va,Address:Pt,AlgoCount:ai,Algodv2:L5,AppLocalState:xa,AppLocalStateDelta:Ea,AppParams:va,AppParamsDelta:ba,AppResourceRecord:ka,ApplyData:Cc,AssetHolding:Vg,AssetHoldingDelta:Aa,AssetParams:Og,AssetParamsDelta:Da,AssetResourceRecord:Fa,AtomicTransactionComposer:pi,get AtomicTransactionComposerStatus(){return ir},BalanceRecord:Ra,Block:gf,BlockHeader:oo,ENCODED_MULTISIG_SCHEMA:hf,ENCODED_SUBSIG_SCHEMA:X2,ERROR_INVALID_MICROALGOS:fV,ERROR_MULTISIG_BAD_SENDER:dV,EvalDelta:Mv,FalconSignatureStruct:ha,FalconVerifier:la,HashFactory:Cg,INVALID_MICROALGOS_ERROR_MSG:aE,IncludedTransactions:$a,Indexer:uB,IntDecoding:Vn,Kmd:U5,KvValueDelta:Pa,LENGTH_ENCODE_BYTE_SIZE:Er,LedgerStateDelta:so,LogicSig:Cr,LogicSigAccount:qs,MAX_LEN:Hs,MULTISIG_BAD_SENDER_ERROR_MSG:AF,MerkleArrayProof:Go,MerkleSignatureVerifier:ca,ModifiedCreatable:Ba,get OnApplicationComplete(){return tr},Participant:ua,ParticipationUpdates:Bg,ProgramSourceMap:RB,Reveal:fa,RewardState:ma,SINGLE_BOOL_SIZE:EF,SINGLE_BYTE_SIZE:xF,SignedTransaction:Sn,SignedTxnInBlock:Sa,SignedTxnWithAD:Ko,SigslotCommit:da,StateProof:Pg,StateProofMessage:$g,StateProofTrackingData:ga,StateSchema:Ci,TealValue:Ku,Transaction:Xr,get TransactionType(){return ln},TxnCommitments:pa,UntypedValue:Jn,UpgradeState:ya,UpgradeVote:wa,ValueDelta:Ki,VotingData:Ta,abiCheckTransactionType:bF,abiTypeIsReference:mE,abiTypeIsTransaction:xf,algosToMicroalgos:x$,appendSignMultisigTransaction:TB,appendSignRawMultisigSignature:IB,assignGroupID:fF,base64ToBytes:lt,bigIntToBytes:za,bytesToBase64:Zn,bytesToBigInt:hE,bytesToHex:Mg,bytesToString:Ig,coerceToBytes:Ri,computeGroupID:dF,createDryrun:PB,createMultisigTransaction:gF,decodeAddress:$2,decodeJSON:Jt,decodeMsgpack:Tn,decodeObj:m8,decodeSignedTransaction:J8,decodeUint64:p$,decodeUnsignedTransaction:N8,dryrunTxnResultAppTrace:VB,dryrunTxnResultLogicSigTrace:OB,encodeAddress:V2,encodeJSON:w8,encodeMsgpack:Yr,encodeObj:p8,encodeUint64:P2,encodeUnsignedSimulateTransaction:nF,encodeUnsignedTransaction:O8,encodedMultiSigFromEncodingData:df,encodedMultiSigToEncodingData:ff,encodedSubsigFromEncodingData:Q2,encodedSubsigToEncodingData:Z2,generateAccount:lB,getApplicationAddress:Sv,getMethodByName:yE,hexToBytes:m$,indexerModels:j5,isOnApplicationComplete:K2,isTransactionType:kv,isTransactionWithSigner:lx,isValidAddress:B2,logicSigFromByte:G8,makeApplicationCallTxnFromObject:ho,makeApplicationClearStateTxnFromObject:YB,makeApplicationCloseOutTxnFromObject:JB,makeApplicationCreateTxnFromObject:HB,makeApplicationDeleteTxnFromObject:KB,makeApplicationNoOpTxnFromObject:XB,makeApplicationOptInTxnFromObject:WB,makeApplicationUpdateTxnFromObject:GB,makeAssetConfigTxnWithSuggestedParamsFromObject:jB,makeAssetCreateTxnWithSuggestedParamsFromObject:UB,makeAssetDestroyTxnWithSuggestedParamsFromObject:_B,makeAssetFreezeTxnWithSuggestedParamsFromObject:zB,makeAssetTransferTxnWithSuggestedParamsFromObject:qB,makeBaseAssetConfigTxn:Lg,makeBasicAccountTransactionSigner:QB,makeEmptyTransactionSigner:tV,makeKeyRegistrationTxnWithSuggestedParamsFromObject:LB,makeLogicSigAccountTransactionSigner:ZB,makeMultiSigAccountTransactionSigner:eV,makePaymentTxnWithSuggestedParamsFromObject:NB,masterDerivationKeyToMnemonic:mB,mergeMultisigTransactions:Ng,microalgosToAlgos:v$,mnemonicFromSeed:dE,mnemonicToMasterDerivationKey:pB,mnemonicToSecretKey:fB,modelsv2:Q8,msgpackRawDecode:q2,msgpackRawDecodeAsMap:H2,msgpackRawEncode:nd,multisigAddress:q8,parseJSON:sE,secretKeyToMnemonic:gB,seedFromMnemonic:fE,signBytes:lV,signLogicSigTransaction:vB,signLogicSigTransactionObject:gE,signMultisigTransaction:yF,signTransaction:uV,stringifyJSON:aa,tealSign:tF,tealSignFromProgram:W8,verifyBytes:hV,verifyMultisig:Tv,verifyTealSign:K8,waitForConfirmation:cF},Symbol.toStringTag,{value:"Module"})),gV=`#pragma version 11
|
|
63
|
+
#pragma typetrack false
|
|
64
|
+
|
|
65
|
+
// smart_contracts/liquidevm/logicsig.algo.ts::program() -> uint64:
|
|
66
|
+
main:
|
|
67
|
+
bytecblock TMPL_OWNER
|
|
68
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:33
|
|
69
|
+
// const txnIdPayload = Global.groupSize === 1 ? Txn.txId : Global.groupId
|
|
70
|
+
global GroupSize
|
|
71
|
+
pushint 1 // 1
|
|
72
|
+
==
|
|
73
|
+
bz main_ternary_false@2
|
|
74
|
+
txn TxID
|
|
75
|
+
|
|
76
|
+
main_ternary_merge@3:
|
|
77
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:36
|
|
78
|
+
// const sig = op.arg(0)
|
|
79
|
+
arg_0
|
|
80
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:39
|
|
81
|
+
// assert(op.extract(sig, 0, 1) === Bytes.fromHex('01'))
|
|
82
|
+
dup
|
|
83
|
+
extract 0 1
|
|
84
|
+
pushbytes 0x01
|
|
85
|
+
==
|
|
86
|
+
assert
|
|
87
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:41
|
|
88
|
+
// const r = op.extract(sig, 1, 32)
|
|
89
|
+
dup
|
|
90
|
+
extract 1 32
|
|
91
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:42
|
|
92
|
+
// const s = op.extract(sig, 33, 32)
|
|
93
|
+
dig 1
|
|
94
|
+
extract 33 32
|
|
95
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:43
|
|
96
|
+
// const v = op.btoi(op.extract(sig, 65, 1))
|
|
97
|
+
uncover 2
|
|
98
|
+
pushint 65 // 65
|
|
99
|
+
getbyte
|
|
100
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:44
|
|
101
|
+
// const recoveryId: uint64 = v - 27 // Ethereum uses 27/28, AVM expects 0/1
|
|
102
|
+
pushint 27 // 27
|
|
103
|
+
-
|
|
104
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:61
|
|
105
|
+
// const messageHash = op.keccak256(messageTypeHash.concat(txnIdPayload))
|
|
106
|
+
pushbytes 0xa0d3cab9c111e1025e8e6c24067ada7c8fff46e1696e611a8b2e5049bac4baf6
|
|
107
|
+
uncover 4
|
|
108
|
+
concat
|
|
109
|
+
keccak256
|
|
110
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:66
|
|
111
|
+
// const digest = op.keccak256(Bytes.fromHex('1901').concat(domainSeparator).concat(messageHash))
|
|
112
|
+
pushbytes 0x1901cd2715b67ae987618a9e27b3a29c522b1171fd767b2224547d03747eae76adc6
|
|
113
|
+
swap
|
|
114
|
+
concat
|
|
115
|
+
keccak256
|
|
116
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:69
|
|
117
|
+
// const [pubkeyX, pubkeyY] = op.ecdsaPkRecover(op.Ecdsa.Secp256k1, digest, recoveryId, r, s)
|
|
118
|
+
swap
|
|
119
|
+
uncover 3
|
|
120
|
+
uncover 3
|
|
121
|
+
ecdsa_pk_recover Secp256k1
|
|
122
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:73
|
|
123
|
+
// const recoveredAddress = op.extract(op.keccak256(op.concat(pubkeyX, pubkeyY)), 12, 20)
|
|
124
|
+
concat
|
|
125
|
+
keccak256
|
|
126
|
+
extract 12 20
|
|
127
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:76
|
|
128
|
+
// return recoveredAddress === owner.bytes
|
|
129
|
+
bytec_0 // TMPL_OWNER
|
|
130
|
+
==
|
|
131
|
+
return
|
|
132
|
+
|
|
133
|
+
main_ternary_false@2:
|
|
134
|
+
// smart_contracts/liquidevm/logicsig.algo.ts:33
|
|
135
|
+
// const txnIdPayload = Global.groupSize === 1 ? Txn.txId : Global.groupId
|
|
136
|
+
global GroupID
|
|
137
|
+
b main_ternary_merge@3
|
|
138
|
+
`;function pV(n){const e=new Uint8Array(n.length/2);for(let t=0;t<n.length;t+=2)e[t/2]=parseInt(n.substring(t,t+2),16);return e}const DF=BigInt("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"),mV=DF/2n;function yV(n){if(n.length!==65)throw new Error("Invalid signature length");const e=n.slice(32,64);let t=0n;for(let r=0;r<32;r++)t=t<<8n|BigInt(e[r]);if(t>mV){t=DF-t;const r=new Uint8Array(65);r.set(n.slice(0,32),0);for(let o=31;o>=0;o--)r[32+o]=Number(t&0xffn),t>>=8n;const i=n[64];return r[64]=i===27?28:27,r}return n}const wV=1;function vb(n){const e=n.startsWith("0x")?n.slice(2):n,t=new Uint8Array(65);for(let o=0;o<65;o++)t[o]=parseInt(e.substring(o*2,o*2+2),16);const r=yV(t),i=new Uint8Array(66);return i[0]=wV,i.set(r,1),i}const SV=4160,vV={name:"Liquid Accounts",version:"1",chainId:SV},xV={AlgorandTransaction:[{name:"Transaction ID",type:"bytes32"}]};function EV(n){return{"Transaction ID":"0x"+Buffer.from(n).toString("hex")}}function xb(n){return{domain:vV,types:{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"}],...xV},primaryType:"AlgorandTransaction",message:EV(n)}}class Cl{constructor({algorand:e}){ep(this,"algorand");ep(this,"compiledCache",new Map);this.algorand=e}static normalizeAddress(e){return e.startsWith("0x")?e.slice(2).toLowerCase():e.toLowerCase()}async getCompiled(e){const t=Cl.normalizeAddress(e);if(!this.compiledCache.has(t)){const r=await this.algorand.app.compileTealTemplate(gV,{TMPL_OWNER:pV(t)});this.compiledCache.set(t,r.compiledBase64ToBytes)}return this.compiledCache.get(t)}async getAddress({evmAddress:e}){const t=await this.getCompiled(e);return new Za.LogicSigAccount(t,[]).address().toString()}static getSignPayload(e){return e.length>1?e[0].group:e[0].rawTxID()}async signTxn({evmAddress:e,txns:t,signMessage:r,signature:i}){const o=await this.getCompiled(e);let s;if(i)s=i;else if(r){const c=Cl.getSignPayload(t);s=await r(xb(c))}else throw new Error("Either signMessage or signature must be provided");const a=vb(s),l=new Za.LogicSigAccount(o,[a]);return t.map(c=>Za.signLogicSigTransactionObject(c,l).blob)}async getSigner({evmAddress:e,signMessage:t}){const r=await this.getCompiled(e);return{addr:new Za.LogicSigAccount(r,[]).address().toString(),signer:async(a,l)=>{const c=Cl.getSignPayload(a),d=await t(xb(c)),f=vb(d),m=new Za.LogicSigAccount(r,[f]);return l.map(w=>Za.signLogicSigTransactionObject(a[w],m).blob)}}}}const gs={PING:"LIQUID_WALLET_COMP_EXT_PING",PONG:"LIQUID_WALLET_COMP_EXT_PONG",ANNOUNCE:"LIQUID_WALLET_COMP_EXT_ANNOUNCE",SIGN_REQUEST:"LIQUID_WALLET_COMP_EXT_SIGN_REQUEST",SIGN_RESPONSE:"LIQUID_WALLET_COMP_EXT_SIGN_RESPONSE",SIGN_COMPLETE:"LIQUID_WALLET_COMP_EXT_SIGN_COMPLETE"},ps={PAGE:"use-wallet-ui",CONTENT:"liquid-wallet-companion-content",POPUP:"liquid-wallet-companion-popup"};function bV(n){return{...n,rawAmount:n.rawAmount!==void 0?n.rawAmount.toString():void 0}}const Eb="wallet-ui-theme-styles",kV=`
|
|
139
|
+
--wui-color-primary: #2d2df1;
|
|
140
|
+
--wui-color-primary-hover: #2929d9;
|
|
141
|
+
--wui-color-primary-text: #ffffff;
|
|
142
|
+
--wui-color-bg: #ffffff;
|
|
143
|
+
--wui-color-bg-secondary: #f9fafb;
|
|
144
|
+
--wui-color-bg-tertiary: #f3f4f6;
|
|
145
|
+
--wui-color-bg-hover: #e9e9fd;
|
|
146
|
+
--wui-color-text: #1f2937;
|
|
147
|
+
--wui-color-text-secondary: #6b7280;
|
|
148
|
+
--wui-color-text-tertiary: #9ca3af;
|
|
149
|
+
--wui-color-border: #e5e7eb;
|
|
150
|
+
--wui-color-link: rgba(45, 45, 241, 0.8);
|
|
151
|
+
--wui-color-link-hover: #2d2df1;
|
|
152
|
+
--wui-color-overlay: rgba(0, 0, 0, 0.3);
|
|
153
|
+
--wui-color-danger-bg: #fee2e2;
|
|
154
|
+
--wui-color-danger-bg-hover: #fecaca;
|
|
155
|
+
--wui-color-danger-text: #b91c1c;
|
|
156
|
+
--wui-color-avatar-bg: #e5e7eb;
|
|
157
|
+
--wui-color-avatar-icon: #9ca3af;
|
|
158
|
+
`,_p=`
|
|
159
|
+
--wui-color-primary: #bfbff9;
|
|
160
|
+
--wui-color-primary-hover: #d4d4fa;
|
|
161
|
+
--wui-color-primary-text: #001324;
|
|
162
|
+
--wui-color-bg: #001324;
|
|
163
|
+
--wui-color-bg-secondary: #101b29;
|
|
164
|
+
--wui-color-bg-tertiary: #192a39;
|
|
165
|
+
--wui-color-bg-hover: #192a39;
|
|
166
|
+
--wui-color-text: #e9e9fd;
|
|
167
|
+
--wui-color-text-secondary: #99a1a7;
|
|
168
|
+
--wui-color-text-tertiary: #6b7280;
|
|
169
|
+
--wui-color-border: #192a39;
|
|
170
|
+
--wui-color-link: #6c6cf1;
|
|
171
|
+
--wui-color-link-hover: #8080f3;
|
|
172
|
+
--wui-color-overlay: rgba(0, 0, 0, 0.5);
|
|
173
|
+
--wui-color-danger-bg: rgba(127, 29, 29, 0.4);
|
|
174
|
+
--wui-color-danger-bg-hover: rgba(127, 29, 29, 0.6);
|
|
175
|
+
--wui-color-danger-text: #fca5a5;
|
|
176
|
+
--wui-color-avatar-bg: #192a39;
|
|
177
|
+
--wui-color-avatar-icon: #6b7280;
|
|
178
|
+
`;function AV(){if(document.getElementById(Eb))return;const n=document.createElement("style");n.id=Eb,n.textContent=`
|
|
179
|
+
/* Light mode (default) */
|
|
180
|
+
[data-wallet-theme] {
|
|
181
|
+
${kV}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Dark mode via data-theme attribute (explicit) */
|
|
185
|
+
[data-wallet-theme][data-theme='dark'] {
|
|
186
|
+
${_p}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* Dark mode via .dark class on ancestor (Tailwind convention) */
|
|
190
|
+
.dark [data-wallet-theme]:not([data-theme='light']) {
|
|
191
|
+
${_p}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* Dark mode via system preference (when theme="system" or no explicit theme) */
|
|
195
|
+
@media (prefers-color-scheme: dark) {
|
|
196
|
+
[data-wallet-theme]:not([data-theme='light']):not([data-theme='dark']) {
|
|
197
|
+
${_p}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* Reset global button styles that may leak from the consuming app */
|
|
202
|
+
[data-wallet-ui] button {
|
|
203
|
+
border: none;
|
|
204
|
+
border-radius: unset;
|
|
205
|
+
padding: 0;
|
|
206
|
+
margin: 0;
|
|
207
|
+
background: none;
|
|
208
|
+
font: inherit;
|
|
209
|
+
color: inherit;
|
|
210
|
+
cursor: pointer;
|
|
211
|
+
}
|
|
212
|
+
`,document.head.insertBefore(n,document.head.firstChild)}const DV=()=>new rM({defaultOptions:{queries:{staleTime:300*1e3,gcTime:3600*1e3,refetchOnWindowFocus:!0,refetchInterval:600*1e3,retry:(n,e)=>e instanceof Error&&e.message.includes("404")?!1:n<3}}}),FF=ce.createContext(void 0);function FV({enabled:n,nfdView:e}){const t=Nx(),{activeAddress:r,activeWallet:i,algodClient:o}=cr.useWallet(),{activeNetwork:s,activeNetworkConfig:a}=cr.useNetwork(),l=s==="localnet",c=(a==null?void 0:a.isTestnet)??!1,d=ce.useRef(null);return ce.useEffect(()=>{if(!n){d.current=r;return}const f=d.current===null&&r!==null&&i!==null&&i.accounts!==void 0&&i.accounts.length>0&&o!==void 0;if(d.current=r,!f)return;console.log(`[WalletUI] Prefetching data for all accounts in wallet ${i.id}`);const m=i.accounts.map(w=>w.address);if(m.length>0&&!l){const k=[];for(let I=0;I<m.length;I+=20)k.push(m.slice(I,I+20));k.forEach(async I=>{const x=c?"https://api.testnet.nf.domains":"https://api.nf.domains",T=new URLSearchParams;I.forEach(b=>{T.append("address",b)}),T.append("view",e);try{const b=await fetch(`${x}/nfd/lookup?${T.toString()}`,{method:"GET",headers:{Accept:"application/json"}});if(!b.ok&&b.status!==404)throw new Error(`NFD prefetch lookup failed: ${b.statusText}`);const R=b.status===404?{}:await b.json();I.forEach(L=>{const G=R[L]||null;t.setQueryData(["nfd",L,s,e],G)})}catch(b){console.error("Error prefetching NFD data:",b)}})}m.forEach(w=>{t.prefetchQuery({queryKey:["account-balance",w,s],queryFn:async()=>{try{const k=await o.accountInformation(w).do();return Number(k.amount)}catch(k){throw new Error(`Error fetching account balance: ${k}`)}}})})},[r,i,s,e,o,t,n]),null}function TV({children:n,queryClient:e,enablePrefetching:t=!0,prefetchNfdView:r="thumbnail",theme:i="system"}){var oe,z;const o=ce.useMemo(()=>e||DV(),[e]),s=A2(i);ce.useEffect(()=>{AV()},[]);const[a,l]=ce.useState(!1),c=ce.useRef(null);ce.useEffect(()=>{const ue=De=>{var de;if(De.source!==window||!((de=De.data)!=null&&de.type))return;const{type:ve,source:Te}=De.data;Te===ps.CONTENT&&(ve===gs.PONG||ve===gs.ANNOUNCE)&&l(!0)};return window.addEventListener("message",ue),window.postMessage({type:gs.PING,source:ps.PAGE},"*"),()=>window.removeEventListener("message",ue)},[]);const[d,f]=ce.useState(null),[m,w]=ce.useState(!1),[k,I]=ce.useState(!1);ce.useEffect(()=>{if(!a)return;const ue=De=>{var ve;De.source!==window||!((ve=De.data)!=null&&ve.type)||De.data.type===gs.SIGN_RESPONSE&&(De.data.source!==ps.POPUP&&De.data.source!==ps.CONTENT||!c.current||De.data.requestId!==c.current||(De.data.approved?d==null||d.resolve():(d==null||d.reject(new Error("User rejected signing from extension")),f(null),c.current=null),w(!1)))};return window.addEventListener("message",ue),()=>window.removeEventListener("message",ue)},[a,d]);const x=ce.useRef(void 0),T=ce.useCallback(ue=>new Promise((De,ve)=>{const{decodedTransactions:Te,transactions:de,dangerous:ie}=QP(ue),ke=Cl.getSignPayload(de),Ie=`0x${Buffer.from(ke).toString("hex")}`,Ze=()=>{I(!0),De()};if(f({transactions:Te,message:Ie,dangerous:ie,resolve:Ze,reject:ve}),w(!0),a){const Ee=crypto.randomUUID();c.current=Ee;const be=de.map(M=>{const W=M.toByte();let U="";for(let q=0;q<W.length;q++)U+=String.fromCharCode(W[q]);return btoa(U)}),g=x.current,A=g?{baseServer:g.algod.baseServer,token:typeof g.algod.token=="string"?g.algod.token:"",port:g.algod.port}:void 0;window.postMessage({type:gs.SIGN_REQUEST,source:ps.PAGE,requestId:Ee,transactions:Te.map(bV),message:Ie,dangerous:ie,walletName:v.current,algodConfig:A,rawTransactions:be},"*")}ie||setTimeout(()=>{Ze()},2500)}),[a]),b=ce.useCallback((ue,De)=>{a&&c.current&&(window.postMessage({type:gs.SIGN_COMPLETE,source:ps.PAGE,requestId:c.current},"*"),c.current=null),I(!1),f(null),w(!1)},[a]),[R,L]=ce.useState(null),G=ce.useCallback(ue=>{L(ue)},[]),E=cr.useWalletManager(),{algodClient:N,activeWallet:p}=cr.useWallet(),{activeNetworkConfig:F}=cr.useNetwork(),v=ce.useRef(void 0);v.current=(oe=p==null?void 0:p.metadata)==null?void 0:oe.name,x.current=F;const O=ce.useCallback(ue=>{N&&N.accountInformation(ue.algorandAddress).do().then(De=>{Number(De.amount)===0&&G(ue)}).catch(()=>{G(ue)})},[N,G]);ce.useEffect(()=>(E.registerUIHook("onBeforeSign",T),E.registerUIHook("onAfterSign",b),E.registerUIHook("onConnect",O),()=>{E.unregisterUIHook("onBeforeSign"),E.unregisterUIHook("onAfterSign"),E.unregisterUIHook("onConnect")}),[E,T,b,O]);const C=ce.useCallback(()=>{w(!1),d==null||d.resolve()},[d]),V=ce.useCallback(()=>{a&&c.current&&(window.postMessage({type:gs.SIGN_COMPLETE,source:ps.PAGE,requestId:c.current},"*"),c.current=null),w(!1),d==null||d.reject(new Error("User rejected signing")),f(null)},[d,a]),H=ce.useMemo(()=>({queryClient:o,theme:i,resolvedTheme:s,requestBeforeSign:T,requestAfterSign:b,requestWelcome:G}),[o,i,s,T,b,G]),_=i==="system"?void 0:i,ee=K.jsx(FF.Provider,{value:H,children:K.jsxs("div",{"data-wallet-theme":!0,"data-theme":_,children:[K.jsx(FV,{enabled:t,nfdView:r}),n,m&&a&&K.jsx(qP,{transactionCount:d.transactions.length,dangerous:d.dangerous,onReject:V}),m&&!a&&K.jsx(zP,{transactions:d.transactions,message:d.message,dangerous:d.dangerous,onApprove:C,onReject:V,onClose:()=>w(!1),signing:k,walletName:(z=p==null?void 0:p.metadata)==null?void 0:z.name,algodClient:N}),R&&K.jsx(HP,{algorandAddress:R.algorandAddress,evmAddress:R.evmAddress,onDismiss:()=>L(null)})]})});return e?ee:K.jsx(xA,{client:o,children:ee})}function Oi(){const n=ce.useContext(FF);if(n===void 0)throw new Error("useWalletUI must be used within a WalletUIProvider");return n}function IV(){const{requestBeforeSign:n}=Oi();return{onBeforeSign:n}}function MV(){const{requestAfterSign:n}=Oi();return{onAfterSign:n}}function RV(){const{requestWelcome:n}=Oi();return{showWelcome:n}}function TF({wallets:n,handleWalletClick:e}){return K.jsxs("ul",{className:"space-y-1.5",children:[n.map(t=>K.jsx("li",{children:K.jsxs("button",{onClick:()=>e(t),className:"flex w-full items-center gap-3 py-1.5 px-1.5 text-left text-[var(--wui-color-text)] transition-colors hover:bg-[var(--wui-color-bg-hover)] rounded-xl",children:[K.jsx("div",{className:"shrink-0 h-8 w-8 rounded-md overflow-hidden bg-[var(--wui-color-bg-secondary)] flex items-center justify-center",children:K.jsx("img",{src:t.metadata.icon,alt:`${t.metadata.name} icon`,className:"h-8 w-8 object-contain rounded-md"})}),K.jsx("span",{className:"text-lg font-bold wallet-custom-font",children:t.metadata.name})]})},t.id)),n.length===0&&K.jsx("p",{className:"text-center text-[var(--wui-color-text-secondary)]",children:"No wallets found."})]})}function IF({children:n}){const[e,t]=ce.useState(!1),[r,i]=ce.useState(null),{wallets:o,activeAddress:s}=cr.useWallet(),{theme:a}=Oi(),l=a==="system"?void 0:a,{refs:c,context:d}=Cf({open:e,onOpenChange:p=>{p&&s||(p?(t(!0),i("starting"),requestAnimationFrame(()=>{i("entered")})):(i("exiting"),setTimeout(()=>{t(!1),i(null)},150)))}}),f=hA(d),m=Rf(d,{outsidePressEvent:"mousedown"}),w=Px(d,{role:"dialog"}),{getReferenceProps:k,getFloatingProps:I}=Pf([f,m,w]),x=Di(),T=Di(),b=async p=>{try{await p.connect(),d.onOpenChange(!1)}catch(F){console.error(`Error connecting to ${p.metadata.name}:`,F),d.onOpenChange(!1)}},R=p=>{s||d.onOpenChange(!0)},L=n||K.jsx(Df,{}),G=s3([c.setReference,L.ref||null]),E={...k(),ref:G,onClick:R},N=ce.cloneElement(L,E);return K.jsxs(K.Fragment,{children:[N,K.jsx(ed,{id:"wallet-dialog-portal",children:e&&K.jsx("div",{"data-wallet-theme":!0,"data-wallet-ui":!0,"data-theme":l,children:K.jsx(Cx,{className:"grid place-items-center px-4 z-50 transition-opacity duration-150 ease-in-out bg-[var(--wui-color-overlay)] data-[state=starting]:opacity-0 data-[state=exiting]:opacity-0 data-[state=entered]:opacity-100","data-state":r,lockScroll:!0,children:K.jsx(Mf,{context:d,modal:!0,children:K.jsxs("div",{ref:c.setFloating,...I({"aria-labelledby":x,"aria-describedby":T}),role:"dialog","data-state":r,className:"w-full max-w-sm rounded-3xl bg-[var(--wui-color-bg)] shadow-xl transform transition-all duration-150 ease-in-out data-[state=starting]:opacity-0 data-[state=starting]:scale-90 data-[state=exiting]:opacity-0 data-[state=exiting]:scale-90 data-[state=entered]:opacity-100 data-[state=entered]:scale-100",style:{marginTop:"-0.5rem"},children:[K.jsxs("div",{className:"relative flex items-center px-6 pt-5 pb-4",children:[K.jsx("h2",{id:x,className:"text-xl font-bold text-[var(--wui-color-text)] wallet-custom-font",children:"Connect a Wallet"}),K.jsx("button",{onClick:()=>d.onOpenChange(!1),className:"absolute right-4 rounded-full bg-[var(--wui-color-bg-tertiary)] p-2 text-[var(--wui-color-text-secondary)] hover:brightness-90 transition-all","aria-label":"Close dialog",children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:K.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),K.jsx("div",{className:"px-4 pb-3",children:K.jsx(TF,{wallets:o,handleWalletClick:b})}),K.jsxs("div",{className:"px-6 py-5 border-t border-[var(--wui-color-border)] flex items-center justify-between",children:[K.jsx("span",{className:"text-[var(--wui-color-text-secondary)] text-sm",children:"Need an Algorand wallet?"}),K.jsx("a",{href:"https://algorand.co/wallets",className:"text-[var(--wui-color-link)] font-medium text-sm hover:text-[var(--wui-color-link-hover)]",target:"_blank",rel:"noopener noreferrer",children:"Start here →"})]})]})})})})})]})}function wE(n={}){const{activeAddress:e}=cr.useWallet(),{activeNetwork:t,activeNetworkConfig:r}=cr.useNetwork(),{enabled:i=!0,view:o="thumbnail"}=n,s=t==="localnet",a=(r==null?void 0:r.isTestnet)??!1;return Lx({queryKey:["nfd",e,t,o],queryFn:async({signal:l})=>{if(!e)return null;const d=await fetch(`${a?"https://api.testnet.nf.domains":"https://api.nf.domains"}/nfd/lookup?address=${encodeURIComponent(e)}&view=${o}`,{method:"GET",headers:{Accept:"application/json"},signal:l});if(d.status===404)return null;if(!d.ok)throw new Error(`NFD lookup failed: ${d.statusText}`);return(await d.json())[e]},enabled:i&&!!e&&!s,retry:(l,c)=>c instanceof Error&&c.message.includes("404")?!1:l<3,refetchOnWindowFocus:!0})}const bb="https://ipfs.algonode.dev",CV=async n=>{if(!n.startsWith("ipfs://"))return n;const e=n.replace("ipfs://",""),t=`https://images.nf.domains/ipfs/${e}`,r=`${bb}/ipfs/${e}`,i=o=>o.startsWith("image/");try{const o=await fetch(t,{method:"HEAD"});if(o.ok){const s=o.headers.get("content-type");if(s&&i(s))return t}}catch{console.info(`CID ${e} is not cached on images.nf.domains, trying IPFS gateway...`)}try{const o=await fetch(r,{method:"HEAD"});if(o.ok){const s=o.headers.get("content-type");if(s&&i(s))return r;if(s==="application/json")try{const c=(await(await fetch(r)).json()).image;if(c){if(c.startsWith("ipfs://")){const d=c.replace("ipfs://",""),f=`${bb}/ipfs/${d}`,m=await fetch(f,{method:"HEAD"});if(m.ok){const w=m.headers.get("content-type");if(w&&i(w))return f}}else if(c.startsWith("http"))try{const d=await fetch(c,{method:"HEAD"});if(d.ok){const f=d.headers.get("content-type");if(f&&i(f))return c}}catch{console.error("Error checking HTTP image URL")}}}catch{console.error("Error processing JSON metadata")}}}catch{console.error(`Error checking gateway for CID ${e}`)}return r};function SE({nfd:n,alt:e,className:t,size:r=40,fallback:i,lightOnly:o=!1}){var d,f,m,w;const s=((f=(d=n==null?void 0:n.properties)==null?void 0:d.userDefined)==null?void 0:f.avatar)||((w=(m=n==null?void 0:n.properties)==null?void 0:m.verified)==null?void 0:w.avatar)||null,a=e||(n==null?void 0:n.name)||"NFD Avatar",{data:l,isLoading:c}=Lx({queryKey:["nfd-avatar",s],queryFn:async()=>s?s.startsWith("https://")&&!s.includes("/ipfs/")?s:s.startsWith("ipfs://")||s.includes("/ipfs/")?await CV(s):s:null,enabled:!!s,staleTime:3600*1e3,gcTime:1440*60*1e3});return c||!l?i?K.jsx(K.Fragment,{children:i}):K.jsx("div",{"data-wallet-ui":!0,className:Bl("flex items-center justify-center rounded-full",t),style:{width:`${r}px`,height:`${r}px`,backgroundColor:o?"#e5e7eb":"var(--wui-color-avatar-bg)"},"aria-label":a,role:"img",children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",style:{width:`${Math.max(r/2,12)}px`,height:`${Math.max(r/2,12)}px`,color:o?"#9ca3af":"var(--wui-color-avatar-icon)"},children:K.jsx("path",{fillRule:"evenodd",d:"M7.5 6a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0zM3.751 20.105a8.25 8.25 0 0116.498 0 .75.75 0 01-.437.695A18.683 18.683 0 0112 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 01-.437-.695z",clipRule:"evenodd"})})}):K.jsx("img",{src:l,alt:a,className:Bl("rounded-full",t),style:{width:`${r}px`,height:`${r}px`,objectFit:"cover"},loading:"lazy"})}const PV={sm:"py-1.5 pl-2 md:pl-2.5 pr-2 text-sm rounded-lg",md:"py-2.5 pl-3 md:pl-3.5 pr-3 text-base rounded-xl",lg:"py-3 pl-3.5 md:pl-4 pr-3.5 text-lg rounded-xl"},$V={sm:20,md:24,lg:28},BV={sm:"mr-1 md:mr-1.5 h-5 w-5",md:"mr-1 md:mr-2 h-6 w-6",lg:"mr-1.5 md:mr-2.5 h-7 w-7"},kb={sm:{width:14,height:14},md:{width:18,height:18},lg:{width:20,height:20}},Hg=ce.forwardRef(({className:n="",children:e,style:t,size:r="md",...i},o)=>{var d;const{activeAddress:s}=cr.useWallet(),a=wE({enabled:!!s}),l=((d=a.data)==null?void 0:d.name)??null;return K.jsx("button",{ref:o,"data-wallet-ui":!0,"data-wallet-button":!0,className:Bl("flex items-center bg-[var(--wui-color-primary)] transition-colors hover:bg-[var(--wui-color-primary-hover)] text-[var(--wui-color-primary-text)] cursor-pointer font-bold",PV[r],n),style:t,disabled:!1,...i,type:"button",children:e||K.jsxs("div",{className:"flex items-center",children:[s&&K.jsx("div",{className:Bl("overflow-hidden",BV[r]),children:K.jsx(SE,{nfd:a.data,alt:`${l||s} avatar`,size:$V[r],lightOnly:!0})}),K.jsx("span",{className:"hidden md:block max-w-[160px] truncate",children:l||(s?_r(s,6,4):"Connect")}),s&&K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:kb[r].width,height:kb[r].height,viewBox:"0 0 16 16",fill:"none",className:"ml-1.5 mt-0.5","aria-hidden":"true",children:K.jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})});Hg.displayName="ConnectedWalletButton";const MF=typeof document<"u"?ce.useLayoutEffect:()=>{};function VV(n){const e=ce.useRef(null);return MF(()=>{e.current=n},[n]),ce.useCallback((...t)=>{const r=e.current;return r==null?void 0:r(...t)},[])}const us=n=>{var e;return(e=n==null?void 0:n.ownerDocument)!==null&&e!==void 0?e:document},Is=n=>n&&"window"in n&&n.window===n?n:us(n).defaultView||window;function OV(n){return n!==null&&typeof n=="object"&&"nodeType"in n&&typeof n.nodeType=="number"}function NV(n){return OV(n)&&n.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in n}let LV=!1;function vE(){return LV}function RF(n,e){if(!vE())return e&&n?n.contains(e):!1;if(!n||!e)return!1;let t=e;for(;t!==null;){if(t===n)return!0;t.tagName==="SLOT"&&t.assignedSlot?t=t.assignedSlot.parentNode:NV(t)?t=t.host:t=t.parentNode}return!1}const hx=(n=document)=>{var e;if(!vE())return n.activeElement;let t=n.activeElement;for(;t&&"shadowRoot"in t&&(!((e=t.shadowRoot)===null||e===void 0)&&e.activeElement);)t=t.shadowRoot.activeElement;return t};function CF(n){return vE()&&n.target.shadowRoot&&n.composedPath?n.composedPath()[0]:n.target}function Gg(n){var e;return typeof window>"u"||window.navigator==null?!1:((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands.some(t=>n.test(t.brand)))||n.test(window.navigator.userAgent)}function xE(n){var e;return typeof window<"u"&&window.navigator!=null?n.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function fo(n){if(process.env.NODE_ENV==="test")return n;let e=null;return()=>(e==null&&(e=n()),e)}const EE=fo(function(){return xE(/^Mac/i)}),UV=fo(function(){return xE(/^iPhone/i)}),jV=fo(function(){return xE(/^iPad/i)||EE()&&navigator.maxTouchPoints>1}),_V=fo(function(){return UV()||jV()});fo(function(){return EE()||_V()});fo(function(){return Gg(/AppleWebKit/i)&&!zV()});const zV=fo(function(){return Gg(/Chrome/i)}),qV=fo(function(){return Gg(/Android/i)});fo(function(){return Gg(/Firefox/i)});function PF(){let n=ce.useRef(new Map),e=ce.useCallback((i,o,s,a)=>{let l=a!=null&&a.once?(...c)=>{n.current.delete(s),s(...c)}:s;n.current.set(s,{type:o,eventTarget:i,fn:l,options:a}),i.addEventListener(o,l,a)},[]),t=ce.useCallback((i,o,s,a)=>{var l;let c=((l=n.current.get(s))===null||l===void 0?void 0:l.fn)||s;i.removeEventListener(o,c,a),n.current.delete(s)},[]),r=ce.useCallback(()=>{n.current.forEach((i,o)=>{t(i.eventTarget,i.type,o,i.options)})},[t]);return ce.useEffect(()=>r,[r]),{addGlobalListener:e,removeGlobalListener:t,removeAllGlobalListeners:r}}function HV(n){return n.mozInputSource===0&&n.isTrusted?!0:qV()&&n.pointerType?n.type==="click"&&n.buttons===1:n.detail===0&&!n.pointerType}function $F(n){let e=n;return e.nativeEvent=n,e.isDefaultPrevented=()=>e.defaultPrevented,e.isPropagationStopped=()=>e.cancelBubble,e.persist=()=>{},e}function GV(n,e){Object.defineProperty(n,"target",{value:e}),Object.defineProperty(n,"currentTarget",{value:e})}function BF(n){let e=ce.useRef({isFocused:!1,observer:null});MF(()=>{const r=e.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let t=VV(r=>{n==null||n(r)});return ce.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){e.current.isFocused=!0;let i=r.target,o=s=>{if(e.current.isFocused=!1,i.disabled){let a=$F(s);t(a)}e.current.observer&&(e.current.observer.disconnect(),e.current.observer=null)};i.addEventListener("focusout",o,{once:!0}),e.current.observer=new MutationObserver(()=>{if(e.current.isFocused&&i.disabled){var s;(s=e.current.observer)===null||s===void 0||s.disconnect();let a=i===document.activeElement?null:document.activeElement;i.dispatchEvent(new FocusEvent("blur",{relatedTarget:a})),i.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:a}))}}),e.current.observer.observe(i,{attributes:!0,attributeFilter:["disabled"]})}},[t])}let KV=!1,id=null,dx=new Set,Pl=new Map,qa=!1,fx=!1;const WV={Tab:!0,Escape:!0};function bE(n,e){for(let t of dx)t(n,e)}function JV(n){return!(n.metaKey||!EE()&&n.altKey||n.ctrlKey||n.key==="Control"||n.key==="Shift"||n.key==="Meta")}function Ef(n){qa=!0,JV(n)&&(id="keyboard",bE("keyboard",n))}function zr(n){id="pointer",(n.type==="mousedown"||n.type==="pointerdown")&&(qa=!0,bE("pointer",n))}function VF(n){HV(n)&&(qa=!0,id="virtual")}function OF(n){n.target===window||n.target===document||KV||!n.isTrusted||(!qa&&!fx&&(id="virtual",bE("virtual",n)),qa=!1,fx=!1)}function NF(){qa=!1,fx=!0}function gx(n){if(typeof window>"u"||typeof document>"u"||Pl.get(Is(n)))return;const e=Is(n),t=us(n);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){qa=!0,r.apply(this,arguments)},t.addEventListener("keydown",Ef,!0),t.addEventListener("keyup",Ef,!0),t.addEventListener("click",VF,!0),e.addEventListener("focus",OF,!0),e.addEventListener("blur",NF,!1),typeof PointerEvent<"u"?(t.addEventListener("pointerdown",zr,!0),t.addEventListener("pointermove",zr,!0),t.addEventListener("pointerup",zr,!0)):process.env.NODE_ENV==="test"&&(t.addEventListener("mousedown",zr,!0),t.addEventListener("mousemove",zr,!0),t.addEventListener("mouseup",zr,!0)),e.addEventListener("beforeunload",()=>{LF(n)},{once:!0}),Pl.set(e,{focus:r})}const LF=(n,e)=>{const t=Is(n),r=us(n);e&&r.removeEventListener("DOMContentLoaded",e),Pl.has(t)&&(t.HTMLElement.prototype.focus=Pl.get(t).focus,r.removeEventListener("keydown",Ef,!0),r.removeEventListener("keyup",Ef,!0),r.removeEventListener("click",VF,!0),t.removeEventListener("focus",OF,!0),t.removeEventListener("blur",NF,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",zr,!0),r.removeEventListener("pointermove",zr,!0),r.removeEventListener("pointerup",zr,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",zr,!0),r.removeEventListener("mousemove",zr,!0),r.removeEventListener("mouseup",zr,!0)),Pl.delete(t))};function YV(n){const e=us(n);let t;return e.readyState!=="loading"?gx(n):(t=()=>{gx(n)},e.addEventListener("DOMContentLoaded",t)),()=>LF(n,t)}typeof document<"u"&&YV();function UF(){return id!=="pointer"}const XV=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function QV(n,e,t){let r=us(t==null?void 0:t.target);const i=typeof window<"u"?Is(t==null?void 0:t.target).HTMLInputElement:HTMLInputElement,o=typeof window<"u"?Is(t==null?void 0:t.target).HTMLTextAreaElement:HTMLTextAreaElement,s=typeof window<"u"?Is(t==null?void 0:t.target).HTMLElement:HTMLElement,a=typeof window<"u"?Is(t==null?void 0:t.target).KeyboardEvent:KeyboardEvent;return n=n||r.activeElement instanceof i&&!XV.has(r.activeElement.type)||r.activeElement instanceof o||r.activeElement instanceof s&&r.activeElement.isContentEditable,!(n&&e==="keyboard"&&t instanceof a&&!WV[t.key])}function ZV(n,e,t){gx(),ce.useEffect(()=>{let r=(i,o)=>{QV(!!(t!=null&&t.isTextInput),i,o)&&n(UF())};return dx.add(r),()=>{dx.delete(r)}},e)}function eO(n){let{isDisabled:e,onFocus:t,onBlur:r,onFocusChange:i}=n;const o=ce.useCallback(l=>{if(l.target===l.currentTarget)return r&&r(l),i&&i(!1),!0},[r,i]),s=BF(o),a=ce.useCallback(l=>{const c=us(l.target),d=c?hx(c):hx();l.target===l.currentTarget&&d===CF(l.nativeEvent)&&(t&&t(l),i&&i(!0),s(l))},[i,t,s]);return{focusProps:{onFocus:!e&&(t||i||r)?a:void 0,onBlur:!e&&(r||i)?o:void 0}}}function tO(n){let{isDisabled:e,onBlurWithin:t,onFocusWithin:r,onFocusWithinChange:i}=n,o=ce.useRef({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:a}=PF(),l=ce.useCallback(f=>{f.currentTarget.contains(f.target)&&o.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(o.current.isFocusWithin=!1,a(),t&&t(f),i&&i(!1))},[t,i,o,a]),c=BF(l),d=ce.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const m=us(f.target),w=hx(m);if(!o.current.isFocusWithin&&w===CF(f.nativeEvent)){r&&r(f),i&&i(!0),o.current.isFocusWithin=!0,c(f);let k=f.currentTarget;s(m,"focus",I=>{if(o.current.isFocusWithin&&!RF(k,I.target)){let x=new m.defaultView.FocusEvent("blur",{relatedTarget:I.target});GV(x,k);let T=$F(x);l(T)}},{capture:!0})}},[r,i,c,s,l]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:l}}}let bf=!1,zp=0;function px(){bf=!0,setTimeout(()=>{bf=!1},50)}function Ab(n){n.pointerType==="touch"&&px()}function nO(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",Ab):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",px),zp++,()=>{zp--,!(zp>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Ab):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",px))}}function rO(n){let{onHoverStart:e,onHoverChange:t,onHoverEnd:r,isDisabled:i}=n,[o,s]=ce.useState(!1),a=ce.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;ce.useEffect(nO,[]);let{addGlobalListener:l,removeAllGlobalListeners:c}=PF(),{hoverProps:d,triggerHoverEnd:f}=ce.useMemo(()=>{let m=(I,x)=>{if(a.pointerType=x,i||x==="touch"||a.isHovered||!I.currentTarget.contains(I.target))return;a.isHovered=!0;let T=I.currentTarget;a.target=T,l(us(I.target),"pointerover",b=>{a.isHovered&&a.target&&!RF(a.target,b.target)&&w(b,b.pointerType)},{capture:!0}),e&&e({type:"hoverstart",target:T,pointerType:x}),t&&t(!0),s(!0)},w=(I,x)=>{let T=a.target;a.pointerType="",a.target=null,!(x==="touch"||!a.isHovered||!T)&&(a.isHovered=!1,c(),r&&r({type:"hoverend",target:T,pointerType:x}),t&&t(!1),s(!1))},k={};return typeof PointerEvent<"u"?(k.onPointerEnter=I=>{bf&&I.pointerType==="mouse"||m(I,I.pointerType)},k.onPointerLeave=I=>{!i&&I.currentTarget.contains(I.target)&&w(I,I.pointerType)}):process.env.NODE_ENV==="test"&&(k.onTouchStart=()=>{a.ignoreEmulatedMouseEvents=!0},k.onMouseEnter=I=>{!a.ignoreEmulatedMouseEvents&&!bf&&m(I,"mouse"),a.ignoreEmulatedMouseEvents=!1},k.onMouseLeave=I=>{!i&&I.currentTarget.contains(I.target)&&w(I,"mouse")}),{hoverProps:k,triggerHoverEnd:w}},[e,t,r,i,a,l,c]);return ce.useEffect(()=>{i&&f({currentTarget:a.target},a.pointerType)},[i]),{hoverProps:d,isHovered:o}}function iO(n={}){let{autoFocus:e=!1,isTextInput:t,within:r}=n,i=ce.useRef({isFocused:!1,isFocusVisible:e||UF()}),[o,s]=ce.useState(!1),[a,l]=ce.useState(()=>i.current.isFocused&&i.current.isFocusVisible),c=ce.useCallback(()=>l(i.current.isFocused&&i.current.isFocusVisible),[]),d=ce.useCallback(w=>{i.current.isFocused=w,s(w),c()},[c]);ZV(w=>{i.current.isFocusVisible=w,c()},[],{isTextInput:t});let{focusProps:f}=eO({isDisabled:r,onFocusChange:d}),{focusWithinProps:m}=tO({isDisabled:!r,onFocusWithinChange:d});return{isFocused:o,isFocusVisible:a,focusProps:r?m:f}}var oO=Object.defineProperty,sO=(n,e,t)=>e in n?oO(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,qp=(n,e,t)=>(sO(n,typeof e!="symbol"?e+"":e,t),t);let aO=class{constructor(){qp(this,"current",this.detect()),qp(this,"handoffState","pending"),qp(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Ks=new aO;function Kg(n){var e;return Ks.isServer?null:n==null?document:(e=n==null?void 0:n.ownerDocument)!=null?e:document}function kf(n){var e,t;return Ks.isServer?null:n==null?document:(t=(e=n==null?void 0:n.getRootNode)==null?void 0:e.call(n))!=null?t:document}function jF(n){var e,t;return(t=(e=kf(n))==null?void 0:e.activeElement)!=null?t:null}function cO(n){return jF(n)===n}function _F(n){typeof queueMicrotask=="function"?queueMicrotask(n):Promise.resolve().then(n).catch(e=>setTimeout(()=>{throw e}))}function $r(){let n=[],e={addEventListener(t,r,i,o){return t.addEventListener(r,i,o),e.add(()=>t.removeEventListener(r,i,o))},requestAnimationFrame(...t){let r=requestAnimationFrame(...t);return e.add(()=>cancelAnimationFrame(r))},nextFrame(...t){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...t))},setTimeout(...t){let r=setTimeout(...t);return e.add(()=>clearTimeout(r))},microTask(...t){let r={current:!0};return _F(()=>{r.current&&t[0]()}),e.add(()=>{r.current=!1})},style(t,r,i){let o=t.style.getPropertyValue(r);return Object.assign(t.style,{[r]:i}),this.add(()=>{Object.assign(t.style,{[r]:o})})},group(t){let r=$r();return t(r),this.add(()=>r.dispose())},add(t){return n.includes(t)||n.push(t),()=>{let r=n.indexOf(t);if(r>=0)for(let i of n.splice(r,1))i()}},dispose(){for(let t of n.splice(0))t()}};return e}function Ju(){let[n]=ce.useState($r);return ce.useEffect(()=>()=>n.dispose(),[n]),n}let mr=(n,e)=>{Ks.isServer?ce.useEffect(n,e):ce.useLayoutEffect(n,e)};function Yu(n){let e=ce.useRef(n);return mr(()=>{e.current=n},[n]),e}let An=function(n){let e=Yu(n);return ce.useCallback((...t)=>e.current(...t),[e])};function uO(n){let e=n.width/2,t=n.height/2;return{top:n.clientY-t,right:n.clientX+e,bottom:n.clientY+t,left:n.clientX-e}}function lO(n,e){return!(!n||!e||n.right<e.left||n.left>e.right||n.bottom<e.top||n.top>e.bottom)}function hO({disabled:n=!1}={}){let e=ce.useRef(null),[t,r]=ce.useState(!1),i=Ju(),o=An(()=>{e.current=null,r(!1),i.dispose()}),s=An(a=>{if(i.dispose(),e.current===null){e.current=a.currentTarget,r(!0);{let l=Kg(a.currentTarget);i.addEventListener(l,"pointerup",o,!1),i.addEventListener(l,"pointermove",c=>{if(e.current){let d=uO(c);r(lO(d,e.current.getBoundingClientRect()))}},!1),i.addEventListener(l,"pointercancel",o,!1)}}});return{pressed:t,pressProps:n?{}:{onPointerDown:s,onPointerUp:o,onClick:o}}}function is(n){return ce.useMemo(()=>n,Object.values(n))}let dO=ce.createContext(void 0);function kE(){return ce.useContext(dO)}function Db(...n){return Array.from(new Set(n.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function Bi(n,e,...t){if(n in e){let i=e[n];return typeof i=="function"?i(...t):i}let r=new Error(`Tried to handle "${n}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(i=>`"${i}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Bi),r}var mx=(n=>(n[n.None=0]="None",n[n.RenderStrategy=1]="RenderStrategy",n[n.Static=2]="Static",n))(mx||{}),fO=(n=>(n[n.Unmount=0]="Unmount",n[n.Hidden=1]="Hidden",n))(fO||{});function ui(){let n=pO();return ce.useCallback(e=>gO({mergeRefs:n,...e}),[n])}function gO({ourProps:n,theirProps:e,slot:t,defaultTag:r,features:i,visible:o=!0,name:s,mergeRefs:a}){a=a??mO;let l=zF(e,n);if(o)return Sd(l,t,r,s,a);let c=i??0;if(c&2){let{static:d=!1,...f}=l;if(d)return Sd(f,t,r,s,a)}if(c&1){let{unmount:d=!0,...f}=l;return Bi(d?0:1,{0(){return null},1(){return Sd({...f,hidden:!0,style:{display:"none"}},t,r,s,a)}})}return Sd(l,t,r,s,a)}function Sd(n,e={},t,r,i){let{as:o=t,children:s,refName:a="ref",...l}=Hp(n,["unmount","static"]),c=n.ref!==void 0?{[a]:n.ref}:{},d=typeof s=="function"?s(e):s;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(e)),l["aria-labelledby"]&&l["aria-labelledby"]===l.id&&(l["aria-labelledby"]=void 0);let f={};if(e){let m=!1,w=[];for(let[k,I]of Object.entries(e))typeof I=="boolean"&&(m=!0),I===!0&&w.push(k.replace(/([A-Z])/g,x=>`-${x.toLowerCase()}`));if(m){f["data-headlessui-state"]=w.join(" ");for(let k of w)f[`data-${k}`]=""}}if(Vd(o)&&(Object.keys(Es(l)).length>0||Object.keys(Es(f)).length>0))if(!ce.isValidElement(d)||Array.isArray(d)&&d.length>1||wO(d)){if(Object.keys(Es(l)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Es(l)).concat(Object.keys(Es(f))).map(m=>` - ${m}`).join(`
|
|
213
|
+
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(m=>` - ${m}`).join(`
|
|
214
|
+
`)].join(`
|
|
215
|
+
`))}else{let m=d.props,w=m==null?void 0:m.className,k=typeof w=="function"?(...T)=>Db(w(...T),l.className):Db(w,l.className),I=k?{className:k}:{},x=zF(d.props,Es(Hp(l,["ref"])));for(let T in f)T in x&&delete f[T];return ce.cloneElement(d,Object.assign({},x,f,c,{ref:i(yO(d),c.ref)},I))}return ce.createElement(o,Object.assign({},Hp(l,["ref"]),!Vd(o)&&c,!Vd(o)&&f),d)}function pO(){let n=ce.useRef([]),e=ce.useCallback(t=>{for(let r of n.current)r!=null&&(typeof r=="function"?r(t):r.current=t)},[]);return(...t)=>{if(!t.every(r=>r==null))return n.current=t,e}}function mO(...n){return n.every(e=>e==null)?void 0:e=>{for(let t of n)t!=null&&(typeof t=="function"?t(e):t.current=e)}}function zF(...n){if(n.length===0)return{};if(n.length===1)return n[0];let e={},t={};for(let r of n)for(let i in r)i.startsWith("on")&&typeof r[i]=="function"?(t[i]!=null||(t[i]=[]),t[i].push(r[i])):e[i]=r[i];if(e.disabled||e["aria-disabled"])for(let r in t)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(t[r]=[i=>{var o;return(o=i==null?void 0:i.preventDefault)==null?void 0:o.call(i)}]);for(let r in t)Object.assign(e,{[r](i,...o){let s=t[r];for(let a of s){if((i instanceof Event||(i==null?void 0:i.nativeEvent)instanceof Event)&&i.defaultPrevented)return;a(i,...o)}}});return e}function qF(...n){if(n.length===0)return{};if(n.length===1)return n[0];let e={},t={};for(let r of n)for(let i in r)i.startsWith("on")&&typeof r[i]=="function"?(t[i]!=null||(t[i]=[]),t[i].push(r[i])):e[i]=r[i];for(let r in t)Object.assign(e,{[r](...i){let o=t[r];for(let s of o)s==null||s(...i)}});return e}function li(n){var e;return Object.assign(ce.forwardRef(n),{displayName:(e=n.displayName)!=null?e:n.name})}function Es(n){let e=Object.assign({},n);for(let t in e)e[t]===void 0&&delete e[t];return e}function Hp(n,e=[]){let t=Object.assign({},n);for(let r of e)r in t&&delete t[r];return t}function yO(n){return ce.version.split(".")[0]>="19"?n.props.ref:n.ref}function Vd(n){return n===ce.Fragment||n===Symbol.for("react.fragment")}function wO(n){return Vd(n.type)}function SO(n,e,t){let[r,i]=ce.useState(t),o=n!==void 0,s=ce.useRef(o),a=ce.useRef(!1),l=ce.useRef(!1);return o&&!s.current&&!a.current?(a.current=!0,s.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&s.current&&!l.current&&(l.current=!0,s.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?n:r,An(c=>(o||Ws.flushSync(()=>i(c)),e==null?void 0:e(c)))]}function vO(n){let[e]=ce.useState(n);return e}function HF(n={},e=null,t=[]){for(let[r,i]of Object.entries(n))KF(t,GF(e,r),i);return t}function GF(n,e){return n?n+"["+e+"]":e}function KF(n,e,t){if(Array.isArray(t))for(let[r,i]of t.entries())KF(n,GF(e,r.toString()),i);else t instanceof Date?n.push([e,t.toISOString()]):typeof t=="boolean"?n.push([e,t?"1":"0"]):typeof t=="string"?n.push([e,t]):typeof t=="number"?n.push([e,`${t}`]):t==null?n.push([e,""]):EO(t)&&!ce.isValidElement(t)&&HF(t,e,n)}function xO(n){var e,t;let r=(e=n==null?void 0:n.form)!=null?e:n.closest("form");if(r){for(let i of r.elements)if(i!==n&&(i.tagName==="INPUT"&&i.type==="submit"||i.tagName==="BUTTON"&&i.type==="submit"||i.nodeName==="INPUT"&&i.type==="image")){i.click();return}(t=r.requestSubmit)==null||t.call(r)}}function EO(n){if(Object.prototype.toString.call(n)!=="[object Object]")return!1;let e=Object.getPrototypeOf(n);return e===null||Object.getPrototypeOf(e)===null}let bO="span";var AE=(n=>(n[n.None=1]="None",n[n.Focusable=2]="Focusable",n[n.Hidden=4]="Hidden",n))(AE||{});function kO(n,e){var t;let{features:r=1,...i}=n,o={ref:e,"aria-hidden":(r&2)===2?!0:(t=i["aria-hidden"])!=null?t:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return ui()({ourProps:o,theirProps:i,slot:{},defaultTag:bO,name:"Hidden"})}let WF=li(kO),AO=ce.createContext(null);function DO({children:n}){let e=ce.useContext(AO);if(!e)return ce.createElement(ce.Fragment,null,n);let{target:t}=e;return t?Ws.createPortal(ce.createElement(ce.Fragment,null,n),t):null}function FO({data:n,form:e,disabled:t,onReset:r,overrides:i}){let[o,s]=ce.useState(null),a=Ju();return ce.useEffect(()=>{if(r&&o)return a.addEventListener(o,"reset",r)},[o,e,r]),ce.createElement(DO,null,ce.createElement(TO,{setForm:s,formId:e}),HF(n).map(([l,c])=>ce.createElement(WF,{features:AE.Hidden,...Es({key:l,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:e,disabled:t,name:l,value:c,...i})})))}function TO({setForm:n,formId:e}){return ce.useEffect(()=>{if(e){let t=document.getElementById(e);t&&n(t)}},[n,e]),e?null:ce.createElement(WF,{features:AE.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let r=t.closest("form");r&&n(r)}})}let IO=ce.createContext(void 0);function JF(){return ce.useContext(IO)}function YF(n){return typeof n!="object"||n===null?!1:"nodeType"in n}function Wg(n){return YF(n)&&"tagName"in n}function go(n){return Wg(n)&&"accessKey"in n}function rc(n){return Wg(n)&&"tabIndex"in n}function MO(n){return Wg(n)&&"style"in n}function RO(n){return go(n)&&n.nodeName==="IFRAME"}function XF(n){return go(n)&&n.nodeName==="INPUT"}function Fb(n){return go(n)&&n.nodeName==="LABEL"}function CO(n){return go(n)&&n.nodeName==="FIELDSET"}function QF(n){return go(n)&&n.nodeName==="LEGEND"}function PO(n){return Wg(n)?n.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Tb(n){let e=n.parentElement,t=null;for(;e&&!CO(e);)QF(e)&&(t=e),e=e.parentElement;let r=(e==null?void 0:e.getAttribute("disabled"))==="";return r&&$O(t)?!1:r}function $O(n){if(!n)return!1;let e=n.previousElementSibling;for(;e!==null;){if(QF(e))return!1;e=e.previousElementSibling}return!0}let ZF=Symbol();function BO(n,e=!0){return Object.assign(n,{[ZF]:e})}function Ni(...n){let e=ce.useRef(n);ce.useEffect(()=>{e.current=n},[n]);let t=An(r=>{for(let i of e.current)i!=null&&(typeof i=="function"?i(r):i.current=r)});return n.every(r=>r==null||(r==null?void 0:r[ZF]))?void 0:t}let DE=ce.createContext(null);DE.displayName="DescriptionContext";function e6(){let n=ce.useContext(DE);if(n===null){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,e6),e}return n}function VO(){var n,e;return(e=(n=ce.useContext(DE))==null?void 0:n.value)!=null?e:void 0}let OO="p";function NO(n,e){let t=ce.useId(),r=kE(),{id:i=`headlessui-description-${t}`,...o}=n,s=e6(),a=Ni(e);mr(()=>s.register(i),[i,s.register]);let l=is({...s.slot,disabled:r||!1}),c={ref:a,...s.props,id:i};return ui()({ourProps:c,theirProps:o,slot:l,defaultTag:OO,name:s.name||"Description"})}let LO=li(NO);Object.assign(LO,{});var Wn=(n=>(n.Space=" ",n.Enter="Enter",n.Escape="Escape",n.Backspace="Backspace",n.Delete="Delete",n.ArrowLeft="ArrowLeft",n.ArrowUp="ArrowUp",n.ArrowRight="ArrowRight",n.ArrowDown="ArrowDown",n.Home="Home",n.End="End",n.PageUp="PageUp",n.PageDown="PageDown",n.Tab="Tab",n))(Wn||{});let Jg=ce.createContext(null);Jg.displayName="LabelContext";function t6(){let n=ce.useContext(Jg);if(n===null){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,t6),e}return n}function n6(n){var e,t,r;let i=(t=(e=ce.useContext(Jg))==null?void 0:e.value)!=null?t:void 0;return((r=n==null?void 0:n.length)!=null?r:0)>0?[i,...n].filter(Boolean).join(" "):i}function UO({inherit:n=!1}={}){let e=n6(),[t,r]=ce.useState([]),i=n?[e,...t].filter(Boolean):t;return[i.length>0?i.join(" "):void 0,ce.useMemo(()=>function(o){let s=An(l=>(r(c=>[...c,l]),()=>r(c=>{let d=c.slice(),f=d.indexOf(l);return f!==-1&&d.splice(f,1),d}))),a=ce.useMemo(()=>({register:s,slot:o.slot,name:o.name,props:o.props,value:o.value}),[s,o.slot,o.name,o.props,o.value]);return ce.createElement(Jg.Provider,{value:a},o.children)},[r])]}let jO="label";function _O(n,e){var t;let r=ce.useId(),i=t6(),o=JF(),s=kE(),{id:a=`headlessui-label-${r}`,htmlFor:l=o??((t=i.props)==null?void 0:t.htmlFor),passive:c=!1,...d}=n,f=Ni(e);mr(()=>i.register(a),[a,i.register]);let m=An(I=>{let x=I.currentTarget;if(!(I.target!==I.currentTarget&&PO(I.target))&&(Fb(x)&&I.preventDefault(),i.props&&"onClick"in i.props&&typeof i.props.onClick=="function"&&i.props.onClick(I),Fb(x))){let T=document.getElementById(x.htmlFor);if(T){let b=T.getAttribute("disabled");if(b==="true"||b==="")return;let R=T.getAttribute("aria-disabled");if(R==="true"||R==="")return;(XF(T)&&(T.type==="file"||T.type==="radio"||T.type==="checkbox")||T.role==="radio"||T.role==="checkbox"||T.role==="switch")&&T.click(),T.focus({preventScroll:!0})}}}),w=is({...i.slot,disabled:s||!1}),k={ref:f,...i.props,id:a,htmlFor:l,onClick:m};return c&&("onClick"in k&&(delete k.htmlFor,delete k.onClick),"onClick"in d&&delete d.onClick),ui()({ourProps:k,theirProps:d,slot:w,defaultTag:l?jO:"div",name:i.name||"Label"})}let zO=li(_O),r6=Object.assign(zO,{});function qO(n,e){return n!==null&&e!==null&&typeof n=="object"&&typeof e=="object"&&"id"in n&&"id"in e?n.id===e.id:n===e}function HO(n=qO){return ce.useCallback((e,t)=>{if(typeof n=="string"){let r=n;return(e==null?void 0:e[r])===(t==null?void 0:t[r])}return n(e,t)},[n])}function Ib(n){if(n===null)return{width:0,height:0};let{width:e,height:t}=n.getBoundingClientRect();return{width:e,height:t}}function GO(n,e,t=!1){let[r,i]=ce.useState(()=>Ib(e));return mr(()=>{if(!e||!n)return;let o=$r();return o.requestAnimationFrame(function s(){o.requestAnimationFrame(s),i(a=>{let l=Ib(e);return l.width===a.width&&l.height===a.height?a:l})}),()=>{o.dispose()}},[e,n]),t?{width:`${r.width}px`,height:`${r.height}px`}:r}var i6=(n=>(n[n.Left=0]="Left",n[n.Right=2]="Right",n))(i6||{});function KO(n){let e=ce.useRef(null),t=An(i=>{e.current=i.pointerType,!Tb(i.currentTarget)&&i.pointerType==="mouse"&&i.button===i6.Left&&(i.preventDefault(),n(i))}),r=An(i=>{e.current!=="mouse"&&(Tb(i.currentTarget)||n(i))});return{onPointerDown:t,onClick:r}}let o6=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}};var WO=Object.defineProperty,JO=(n,e,t)=>e in n?WO(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,YO=(n,e,t)=>(JO(n,e+"",t),t),s6=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},Vr=(n,e,t)=>(s6(n,e,"read from private field"),t?t.call(n):e.get(n)),Gp=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},Mb=(n,e,t,r)=>(s6(n,e,"write to private field"),e.set(n,t),t),gi,bl,kl;let a6=class{constructor(e){Gp(this,gi,{}),Gp(this,bl,new o6(()=>new Set)),Gp(this,kl,new Set),YO(this,"disposables",$r()),Mb(this,gi,e),Ks.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Vr(this,gi)}subscribe(e,t){if(Ks.isServer)return()=>{};let r={selector:e,callback:t,current:e(Vr(this,gi))};return Vr(this,kl).add(r),this.disposables.add(()=>{Vr(this,kl).delete(r)})}on(e,t){return Ks.isServer?()=>{}:(Vr(this,bl).get(e).add(t),this.disposables.add(()=>{Vr(this,bl).get(e).delete(t)}))}send(e){let t=this.reduce(Vr(this,gi),e);if(t!==Vr(this,gi)){Mb(this,gi,t);for(let r of Vr(this,kl)){let i=r.selector(Vr(this,gi));c6(r.current,i)||(r.current=i,r.callback(i))}for(let r of Vr(this,bl).get(e.type))r(Vr(this,gi),e)}}};gi=new WeakMap,bl=new WeakMap,kl=new WeakMap;function c6(n,e){return Object.is(n,e)?!0:typeof n!="object"||n===null||typeof e!="object"||e===null?!1:Array.isArray(n)&&Array.isArray(e)?n.length!==e.length?!1:Kp(n[Symbol.iterator](),e[Symbol.iterator]()):n instanceof Map&&e instanceof Map||n instanceof Set&&e instanceof Set?n.size!==e.size?!1:Kp(n.entries(),e.entries()):Rb(n)&&Rb(e)?Kp(Object.entries(n)[Symbol.iterator](),Object.entries(e)[Symbol.iterator]()):!1}function Kp(n,e){do{let t=n.next(),r=e.next();if(t.done&&r.done)return!0;if(t.done||r.done||!Object.is(t.value,r.value))return!1}while(!0)}function Rb(n){if(Object.prototype.toString.call(n)!=="[object Object]")return!1;let e=Object.getPrototypeOf(n);return e===null||Object.getPrototypeOf(e)===null}function Wp(n){let[e,t]=n(),r=$r();return(...i)=>{e(...i),r.dispose(),r.microTask(t)}}var XO=Object.defineProperty,QO=(n,e,t)=>e in n?XO(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Cb=(n,e,t)=>(QO(n,typeof e!="symbol"?e+"":e,t),t),u6=(n=>(n[n.Push=0]="Push",n[n.Pop=1]="Pop",n))(u6||{});let ZO={0(n,e){let t=e.id,r=n.stack,i=n.stack.indexOf(t);if(i!==-1){let o=n.stack.slice();return o.splice(i,1),o.push(t),r=o,{...n,stack:r}}return{...n,stack:[...n.stack,t]}},1(n,e){let t=e.id,r=n.stack.indexOf(t);if(r===-1)return n;let i=n.stack.slice();return i.splice(r,1),{...n,stack:i}}},eN=class l6 extends a6{constructor(){super(...arguments),Cb(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),Cb(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new l6({stack:[]})}reduce(e,t){return Bi(t.type,ZO,e,t)}};const FE=new o6(()=>eN.new());var vd={exports:{}},Jp={};/**
|
|
216
|
+
* @license React
|
|
217
|
+
* use-sync-external-store-with-selector.production.js
|
|
218
|
+
*
|
|
219
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
220
|
+
*
|
|
221
|
+
* This source code is licensed under the MIT license found in the
|
|
222
|
+
* LICENSE file in the root directory of this source tree.
|
|
223
|
+
*/var Pb;function tN(){if(Pb)return Jp;Pb=1;var n=ce;function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var t=typeof Object.is=="function"?Object.is:e,r=n.useSyncExternalStore,i=n.useRef,o=n.useEffect,s=n.useMemo,a=n.useDebugValue;return Jp.useSyncExternalStoreWithSelector=function(l,c,d,f,m){var w=i(null);if(w.current===null){var k={hasValue:!1,value:null};w.current=k}else k=w.current;w=s(function(){function x(G){if(!T){if(T=!0,b=G,G=f(G),m!==void 0&&k.hasValue){var E=k.value;if(m(E,G))return R=E}return R=G}if(E=R,t(b,G))return E;var N=f(G);return m!==void 0&&m(E,N)?(b=G,E):(b=G,R=N)}var T=!1,b,R,L=d===void 0?null:d;return[function(){return x(c())},L===null?void 0:function(){return x(L())}]},[c,d,f,m]);var I=r(l,w[0],w[1]);return o(function(){k.hasValue=!0,k.value=I},[I]),a(I),I},Jp}var Yp={};/**
|
|
224
|
+
* @license React
|
|
225
|
+
* use-sync-external-store-with-selector.development.js
|
|
226
|
+
*
|
|
227
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the MIT license found in the
|
|
230
|
+
* LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/var $b;function nN(){return $b||($b=1,process.env.NODE_ENV!=="production"&&(function(){function n(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=ce,t=typeof Object.is=="function"?Object.is:n,r=e.useSyncExternalStore,i=e.useRef,o=e.useEffect,s=e.useMemo,a=e.useDebugValue;Yp.useSyncExternalStoreWithSelector=function(l,c,d,f,m){var w=i(null);if(w.current===null){var k={hasValue:!1,value:null};w.current=k}else k=w.current;w=s(function(){function x(G){if(!T){if(T=!0,b=G,G=f(G),m!==void 0&&k.hasValue){var E=k.value;if(m(E,G))return R=E}return R=G}if(E=R,t(b,G))return E;var N=f(G);return m!==void 0&&m(E,N)?(b=G,E):(b=G,R=N)}var T=!1,b,R,L=d===void 0?null:d;return[function(){return x(c())},L===null?void 0:function(){return x(L())}]},[c,d,f,m]);var I=r(l,w[0],w[1]);return o(function(){k.hasValue=!0,k.value=I},[I]),a(I),I},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Yp}var Bb;function rN(){return Bb||(Bb=1,process.env.NODE_ENV==="production"?vd.exports=tN():vd.exports=nN()),vd.exports}var iN=rN();function br(n,e,t=c6){return iN.useSyncExternalStoreWithSelector(An(r=>n.subscribe(oN,r)),An(()=>n.state),An(()=>n.state),An(e),t)}function oN(n){return n}function h6(n,e){let t=ce.useId(),r=FE.get(e),[i,o]=br(r,ce.useCallback(s=>[r.selectors.isTop(s,t),r.selectors.inStack(s,t)],[r,t]));return mr(()=>{if(n)return r.actions.push(t),()=>r.actions.pop(t)},[r,n,t]),n?o?i:!0:!1}let yx=new Map,$l=new Map;function Vb(n){var e;let t=(e=$l.get(n))!=null?e:0;return $l.set(n,t+1),t!==0?()=>Ob(n):(yx.set(n,{"aria-hidden":n.getAttribute("aria-hidden"),inert:n.inert}),n.setAttribute("aria-hidden","true"),n.inert=!0,()=>Ob(n))}function Ob(n){var e;let t=(e=$l.get(n))!=null?e:1;if(t===1?$l.delete(n):$l.set(n,t-1),t!==1)return;let r=yx.get(n);r&&(r["aria-hidden"]===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",r["aria-hidden"]),n.inert=r.inert,yx.delete(n))}function sN(n,{allowed:e,disallowed:t}={}){let r=h6(n,"inert-others");mr(()=>{var i,o;if(!r)return;let s=$r();for(let l of(i=t==null?void 0:t())!=null?i:[])l&&s.add(Vb(l));let a=(o=e==null?void 0:e())!=null?o:[];for(let l of a){if(!l)continue;let c=Kg(l);if(!c)continue;let d=l.parentElement;for(;d&&d!==c.body;){for(let f of d.children)a.some(m=>f.contains(m))||s.add(Vb(f));d=d.parentElement}}return s.dispose},[r,e,t])}function aN(n,e,t){let r=Yu(i=>{let o=i.getBoundingClientRect();o.x===0&&o.y===0&&o.width===0&&o.height===0&&t()});ce.useEffect(()=>{if(!n)return;let i=e===null?null:go(e)?e:e.current;if(!i)return;let o=$r();if(typeof ResizeObserver<"u"){let s=new ResizeObserver(()=>r.current(i));s.observe(i),o.add(()=>s.disconnect())}if(typeof IntersectionObserver<"u"){let s=new IntersectionObserver(()=>r.current(i));s.observe(i),o.add(()=>s.disconnect())}return()=>o.dispose()},[e,r,n])}let wx=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(n=>`${n}:not([tabindex='-1'])`).join(","),cN=["[data-autofocus]"].map(n=>`${n}:not([tabindex='-1'])`).join(",");var Sx=(n=>(n[n.First=1]="First",n[n.Previous=2]="Previous",n[n.Next=4]="Next",n[n.Last=8]="Last",n[n.WrapAround=16]="WrapAround",n[n.NoScroll=32]="NoScroll",n[n.AutoFocus=64]="AutoFocus",n))(Sx||{}),uN=(n=>(n[n.Error=0]="Error",n[n.Overflow=1]="Overflow",n[n.Success=2]="Success",n[n.Underflow=3]="Underflow",n))(uN||{}),lN=(n=>(n[n.Previous=-1]="Previous",n[n.Next=1]="Next",n))(lN||{});function d6(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(wx)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}function hN(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(cN)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var TE=(n=>(n[n.Strict=0]="Strict",n[n.Loose=1]="Loose",n))(TE||{});function f6(n,e=0){var t;return n===((t=Kg(n))==null?void 0:t.body)?!1:Bi(e,{0(){return n.matches(wx)},1(){let r=n;for(;r!==null;){if(r.matches(wx))return!0;r=r.parentElement}return!1}})}var dN=(n=>(n[n.Keyboard=0]="Keyboard",n[n.Mouse=1]="Mouse",n))(dN||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",n=>{n.metaKey||n.altKey||n.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",n=>{n.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:n.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let fN=["textarea","input"].join(",");function gN(n){var e,t;return(t=(e=n==null?void 0:n.matches)==null?void 0:e.call(n,fN))!=null?t:!1}function g6(n,e=t=>t){return n.slice().sort((t,r)=>{let i=e(t),o=e(r);if(i===null||o===null)return 0;let s=i.compareDocumentPosition(o);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function pN(n,e,t=n===null?document.body:kf(n)){return mN(d6(t),e,{relativeTo:n})}function mN(n,e,{sorted:t=!0,relativeTo:r=null,skipElements:i=[]}={}){let o=Array.isArray(n)?n.length>0?kf(n[0]):document:kf(n),s=Array.isArray(n)?t?g6(n):n:e&64?hN(n):d6(n);i.length>0&&s.length>1&&(s=s.filter(w=>!i.some(k=>k!=null&&"current"in k?(k==null?void 0:k.current)===w:k===w))),r=r??(o==null?void 0:o.activeElement);let a=(()=>{if(e&5)return 1;if(e&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(e&1)return 0;if(e&2)return Math.max(0,s.indexOf(r))-1;if(e&4)return Math.max(0,s.indexOf(r))+1;if(e&8)return s.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=e&32?{preventScroll:!0}:{},d=0,f=s.length,m;do{if(d>=f||d+f<=0)return 0;let w=l+d;if(e&16)w=(w+f)%f;else{if(w<0)return 3;if(w>=f)return 1}m=s[w],m==null||m.focus(c),d+=a}while(m!==jF(m));return e&6&&gN(m)&&m.select(),2}function p6(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function yN(){return/Android/gi.test(window.navigator.userAgent)}function Nb(){return p6()||yN()}function ic(n,e,t,r){let i=Yu(t);ce.useEffect(()=>{if(!n)return;function o(s){i.current(s)}return document.addEventListener(e,o,r),()=>document.removeEventListener(e,o,r)},[n,e,r])}function wN(n,e,t,r){let i=Yu(t);ce.useEffect(()=>{if(!n)return;function o(s){i.current(s)}return window.addEventListener(e,o,r),()=>window.removeEventListener(e,o,r)},[n,e,r])}const Lb=30;function SN(n,e,t){let r=Yu(t),i=ce.useCallback(function(a,l){if(a.defaultPrevented)return;let c=l(a);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let d=(function f(m){return typeof m=="function"?f(m()):Array.isArray(m)||m instanceof Set?m:[m]})(e);for(let f of d)if(f!==null&&(f.contains(c)||a.composed&&a.composedPath().includes(f)))return;return!f6(c,TE.Loose)&&c.tabIndex!==-1&&a.preventDefault(),r.current(a,c)},[r,e]),o=ce.useRef(null);ic(n,"pointerdown",a=>{var l,c;Nb()||(o.current=((c=(l=a.composedPath)==null?void 0:l.call(a))==null?void 0:c[0])||a.target)},!0),ic(n,"pointerup",a=>{if(Nb()||!o.current)return;let l=o.current;return o.current=null,i(a,()=>l)},!0);let s=ce.useRef({x:0,y:0});ic(n,"touchstart",a=>{s.current.x=a.touches[0].clientX,s.current.y=a.touches[0].clientY},!0),ic(n,"touchend",a=>{let l={x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY};if(!(Math.abs(l.x-s.current.x)>=Lb||Math.abs(l.y-s.current.y)>=Lb))return i(a,()=>rc(a.target)?a.target:null)},!0),wN(n,"blur",a=>i(a,()=>RO(window.document.activeElement)?window.document.activeElement:null),!0)}function vx(...n){return ce.useMemo(()=>Kg(...n),[...n])}var vN=(n=>(n[n.Ignore=0]="Ignore",n[n.Select=1]="Select",n[n.Close=2]="Close",n))(vN||{});const xd={Ignore:{kind:0},Select:n=>({kind:1,target:n}),Close:{kind:2}},xN=200,Ub=5;function EN(n,{trigger:e,action:t,close:r,select:i}){let o=ce.useRef(null),s=ce.useRef(null),a=ce.useRef(null);ic(n&&e!==null,"pointerdown",l=>{YF(l==null?void 0:l.target)&&e!=null&&e.contains(l.target)&&(s.current=l.x,a.current=l.y,o.current=l.timeStamp)}),ic(n&&e!==null,"pointerup",l=>{var c,d;let f=o.current;if(f===null||(o.current=null,!rc(l.target))||Math.abs(l.x-((c=s.current)!=null?c:l.x))<Ub&&Math.abs(l.y-((d=a.current)!=null?d:l.y))<Ub)return;let m=t(l);switch(m.kind){case 0:return;case 1:{l.timeStamp-f>xN&&(i(m.target),r());break}case 2:{r();break}}},{capture:!0})}function bN(n,e){return ce.useMemo(()=>{var t;if(n.type)return n.type;let r=(t=n.as)!=null?t:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(e==null?void 0:e.tagName)==="BUTTON"&&!e.hasAttribute("type"))return"button"},[n.type,n.as,e])}function kN(n){return ce.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)}function AN(n,e){let t=n(),r=new Set;return{getSnapshot(){return t},subscribe(i){return r.add(i),()=>r.delete(i)},dispatch(i,...o){let s=e[i].call(t,...o);s&&(t=s,r.forEach(a=>a()))}}}function DN(){let n;return{before({doc:e}){var t;let r=e.documentElement,i=(t=e.defaultView)!=null?t:window;n=Math.max(0,i.innerWidth-r.clientWidth)},after({doc:e,d:t}){let r=e.documentElement,i=Math.max(0,r.clientWidth-r.offsetWidth),o=Math.max(0,n-i);t.style(r,"paddingRight",`${o}px`)}}}function FN(){return p6()?{before({doc:n,d:e,meta:t}){function r(i){for(let o of t().containers)for(let s of o())if(s.contains(i))return!0;return!1}e.microTask(()=>{var i;if(window.getComputedStyle(n.documentElement).scrollBehavior!=="auto"){let a=$r();a.style(n.documentElement,"scrollBehavior","auto"),e.add(()=>e.microTask(()=>a.dispose()))}let o=(i=window.scrollY)!=null?i:window.pageYOffset,s=null;e.addEventListener(n,"click",a=>{if(rc(a.target))try{let l=a.target.closest("a");if(!l)return;let{hash:c}=new URL(l.href),d=n.querySelector(c);rc(d)&&!r(d)&&(s=d)}catch{}},!0),e.group(a=>{e.addEventListener(n,"touchstart",l=>{if(a.dispose(),rc(l.target)&&MO(l.target))if(r(l.target)){let c=l.target;for(;c.parentElement&&r(c.parentElement);)c=c.parentElement;a.style(c,"overscrollBehavior","contain")}else a.style(l.target,"touchAction","none")})}),e.addEventListener(n,"touchmove",a=>{if(rc(a.target)){if(XF(a.target))return;if(r(a.target)){let l=a.target;for(;l.parentElement&&l.dataset.headlessuiPortal!==""&&!(l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth);)l=l.parentElement;l.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),e.add(()=>{var a;let l=(a=window.scrollY)!=null?a:window.pageYOffset;o!==l&&window.scrollTo(0,o),s&&s.isConnected&&(s.scrollIntoView({block:"nearest"}),s=null)})})}}:{}}function TN(){return{before({doc:n,d:e}){e.style(n.documentElement,"overflow","hidden")}}}function jb(n){let e={};for(let t of n)Object.assign(e,t(e));return e}let Ms=AN(()=>new Map,{PUSH(n,e){var t;let r=(t=this.get(n))!=null?t:{doc:n,count:0,d:$r(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(e),r.computedMeta=jb(r.meta),this.set(n,r),this},POP(n,e){let t=this.get(n);return t&&(t.count--,t.meta.delete(e),t.computedMeta=jb(t.meta)),this},SCROLL_PREVENT(n){let e={doc:n.doc,d:n.d,meta(){return n.computedMeta}},t=[FN(),DN(),TN()];t.forEach(({before:r})=>r==null?void 0:r(e)),t.forEach(({after:r})=>r==null?void 0:r(e))},SCROLL_ALLOW({d:n}){n.dispose()},TEARDOWN({doc:n}){this.delete(n)}});Ms.subscribe(()=>{let n=Ms.getSnapshot(),e=new Map;for(let[t]of n)e.set(t,t.documentElement.style.overflow);for(let t of n.values()){let r=e.get(t.doc)==="hidden",i=t.count!==0;(i&&!r||!i&&r)&&Ms.dispatch(t.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",t),t.count===0&&Ms.dispatch("TEARDOWN",t)}});function IN(n,e,t=()=>({containers:[]})){let r=kN(Ms),i=e?r.get(e):void 0,o=i?i.count>0:!1;return mr(()=>{if(!(!e||!n))return Ms.dispatch("PUSH",e,t),()=>Ms.dispatch("POP",e,t)},[n,e]),o}function MN(n,e,t=()=>[document.body]){let r=h6(n,"scroll-lock");IN(r,e,i=>{var o;return{containers:[...(o=i.containers)!=null?o:[],t]}})}function _b(n){return[n.screenX,n.screenY]}function RN(){let n=ce.useRef([-1,-1]);return{wasMoved(e){let t=_b(e);return n.current[0]===t[0]&&n.current[1]===t[1]?!1:(n.current=t,!0)},update(e){n.current=_b(e)}}}function CN(n=0){let[e,t]=ce.useState(n),r=ce.useCallback(l=>t(l),[]),i=ce.useCallback(l=>t(c=>c|l),[]),o=ce.useCallback(l=>(e&l)===l,[e]),s=ce.useCallback(l=>t(c=>c&~l),[]),a=ce.useCallback(l=>t(c=>c^l),[]);return{flags:e,setFlag:r,addFlag:i,hasFlag:o,removeFlag:s,toggleFlag:a}}var zb,qb;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((zb=process==null?void 0:process.env)==null?void 0:zb.NODE_ENV)==="test"&&typeof((qb=Element==null?void 0:Element.prototype)==null?void 0:qb.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
232
|
+
`)),[]});var PN=(n=>(n[n.None=0]="None",n[n.Closed=1]="Closed",n[n.Enter=2]="Enter",n[n.Leave=4]="Leave",n))(PN||{});function $N(n){let e={};for(let t in n)n[t]===!0&&(e[`data-${t}`]="");return e}function BN(n,e,t,r){let[i,o]=ce.useState(t),{hasFlag:s,addFlag:a,removeFlag:l}=CN(n&&i?3:0),c=ce.useRef(!1),d=ce.useRef(!1),f=Ju();return mr(()=>{var m;if(n){if(t&&o(!0),!e){t&&a(3);return}return(m=void 0)==null||m.call(r,t),VN(e,{inFlight:c,prepare(){d.current?d.current=!1:d.current=c.current,c.current=!0,!d.current&&(t?(a(3),l(4)):(a(4),l(2)))},run(){d.current?t?(l(3),a(4)):(l(4),a(3)):t?l(1):a(1)},done(){var w;d.current&&LN(e)||(c.current=!1,l(7),t||o(!1),(w=void 0)==null||w.call(r,t))}})}},[n,t,e,f]),n?[i,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[t,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function VN(n,{prepare:e,run:t,done:r,inFlight:i}){let o=$r();return NN(n,{prepare:e,inFlight:i}),o.nextFrame(()=>{t(),o.requestAnimationFrame(()=>{o.add(ON(n,r))})}),o.dispose}function ON(n,e){var t,r;let i=$r();if(!n)return i.dispose;let o=!1;i.add(()=>{o=!0});let s=(r=(t=n.getAnimations)==null?void 0:t.call(n).filter(a=>a instanceof CSSTransition))!=null?r:[];return s.length===0?(e(),i.dispose):(Promise.allSettled(s.map(a=>a.finished)).then(()=>{o||e()}),i.dispose)}function NN(n,{inFlight:e,prepare:t}){if(e!=null&&e.current){t();return}let r=n.style.transition;n.style.transition="none",t(),n.style.transition=r}function LN(n){var e,t;return((t=(e=n.getAnimations)==null?void 0:e.call(n))!=null?t:[]).some(r=>r instanceof CSSTransition&&r.playState!=="finished")}function UN(){const n=navigator.userAgentData;return n&&Array.isArray(n.brands)?n.brands.map(e=>{let{brand:t,version:r}=e;return t+"/"+r}).join(" "):navigator.userAgent}function Hb(n,e,t){let{reference:r,floating:i}=n;const o=ar(e),s=Fx(e),a=Dx(s),l=Pr(e),c=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let w;switch(l){case"top":w={x:d,y:r.y-i.height};break;case"bottom":w={x:d,y:r.y+r.height};break;case"right":w={x:r.x+r.width,y:f};break;case"left":w={x:r.x-i.width,y:f};break;default:w={x:r.x,y:r.y}}switch(Wa(e)){case"start":w[s]-=m*(t&&c?-1:1);break;case"end":w[s]+=m*(t&&c?-1:1);break}return w}const jN=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=t,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:f}=Hb(c,r,l),m=r,w={},k=0;for(let I=0;I<a.length;I++){const{name:x,fn:T}=a[I],{x:b,y:R,data:L,reset:G}=await T({x:d,y:f,initialPlacement:r,placement:m,strategy:i,middlewareData:w,rects:c,platform:s,elements:{reference:n,floating:e}});d=b??d,f=R??f,w={...w,[x]:{...w[x],...L}},G&&k<=50&&(k++,typeof G=="object"&&(G.placement&&(m=G.placement),G.rects&&(c=G.rects===!0?await s.getElementRects({reference:n,floating:e,strategy:i}):G.rects),{x:d,y:f}=Hb(c,m,l)),I=-1)}return{x:d,y:f,placement:m,strategy:i,middlewareData:w}};async function Yg(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:w=0}=Vi(e,n),k=Uk(w),x=a[m?f==="floating"?"reference":"floating":f],T=qo(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(x)))==null||t?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),b=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),L=await(o.isElement==null?void 0:o.isElement(R))?await(o.getScale==null?void 0:o.getScale(R))||{x:1,y:1}:{x:1,y:1},G=qo(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:R,strategy:l}):b);return{top:(T.top-G.top+k.top)/L.y,bottom:(G.bottom-T.bottom+k.bottom)/L.y,left:(T.left-G.left+k.left)/L.x,right:(G.right-T.right+k.right)/L.x}}const _N=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:I=!0,...x}=Vi(n,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const T=Pr(i),b=ar(a),R=Pr(a)===a,L=await(l.isRTL==null?void 0:l.isRTL(c.floating)),G=m||(R||!I?[Ol(a)]:Nk(a)),E=k!=="none";!m&&E&&G.push(...Lk(a,I,k,L));const N=[a,...G],p=await Yg(e,x),F=[];let v=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&F.push(p[T]),f){const H=Ok(i,s,L);F.push(p[H[0]],p[H[1]])}if(v=[...v,{placement:i,overflows:F}],!F.every(H=>H<=0)){var O,C;const H=(((O=o.flip)==null?void 0:O.index)||0)+1,_=N[H];if(_&&(!(f==="alignment"?b!==ar(_):!1)||v.every(z=>ar(z.placement)===b?z.overflows[0]>0:!0)))return{data:{index:H,overflows:v},reset:{placement:_}};let ee=(C=v.filter(oe=>oe.overflows[0]<=0).sort((oe,z)=>oe.overflows[1]-z.overflows[1])[0])==null?void 0:C.placement;if(!ee)switch(w){case"bestFit":{var V;const oe=(V=v.filter(z=>{if(E){const ue=ar(z.placement);return ue===b||ue==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(ue=>ue>0).reduce((ue,De)=>ue+De,0)]).sort((z,ue)=>z[1]-ue[1])[0])==null?void 0:V[0];oe&&(ee=oe);break}case"initialPlacement":ee=a;break}if(i!==ee)return{reset:{placement:ee}}}return{}}}},zN=new Set(["left","top"]);async function qN(n,e){const{placement:t,platform:r,elements:i}=n,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Pr(t),a=Wa(t),l=ar(t)==="y",c=zN.has(s)?-1:1,d=o&&l?-1:1,f=Vi(e,n);let{mainAxis:m,crossAxis:w,alignmentAxis:k}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof k=="number"&&(w=a==="end"?k*-1:k),l?{x:w*d,y:m*c}:{x:m*c,y:w*d}}const HN=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:o,placement:s,middlewareData:a}=e,l=await qN(e,n);return s===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},GN=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:T,y:b}=x;return{x:T,y:b}}},...l}=Vi(n,e),c={x:t,y:r},d=await Yg(e,l),f=ar(Pr(i)),m=Ax(f);let w=c[m],k=c[f];if(o){const x=m==="y"?"top":"left",T=m==="y"?"bottom":"right",b=w+d[x],R=w-d[T];w=jd(b,w,R)}if(s){const x=f==="y"?"top":"left",T=f==="y"?"bottom":"right",b=k+d[x],R=k-d[T];k=jd(b,k,R)}const I=a.fn({...e,[m]:w,[f]:k});return{...I,data:{x:I.x-t,y:I.y-r,enabled:{[m]:o,[f]:s}}}}}},KN=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:o,platform:s,elements:a}=e,{apply:l=()=>{},...c}=Vi(n,e),d=await Yg(e,c),f=Pr(i),m=Wa(i),w=ar(i)==="y",{width:k,height:I}=o.floating;let x,T;f==="top"||f==="bottom"?(x=f,T=m===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(T=f,x=m==="end"?"top":"bottom");const b=I-d.top-d.bottom,R=k-d.left-d.right,L=Ai(I-d[x],b),G=Ai(k-d[T],R),E=!e.middlewareData.shift;let N=L,p=G;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(p=R),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(N=b),E&&!m){const v=Rn(d.left,0),O=Rn(d.right,0),C=Rn(d.top,0),V=Rn(d.bottom,0);w?p=k-2*(v!==0||O!==0?v+O:Rn(d.left,d.right)):N=I-2*(C!==0||V!==0?C+V:Rn(d.top,d.bottom))}await l({...e,availableWidth:p,availableHeight:N});const F=await s.getDimensions(a.floating);return k!==F.width||I!==F.height?{reset:{rects:!0}}:{}}}};function m6(n){const e=$n(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=bn(n),o=i?n.offsetWidth:t,s=i?n.offsetHeight:r,a=Qi(t)!==o||Qi(r)!==s;return a&&(t=o,r=s),{width:t,height:r,$:a}}function IE(n){return on(n)?n:n.contextElement}function dc(n){const e=IE(n);if(!bn(e))return zn(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:o}=m6(e);let s=(o?Qi(t.width):t.width)/r,a=(o?Qi(t.height):t.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const WN=zn(0);function y6(n){const e=_n(n);return!Lu()||!e.visualViewport?WN:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function JN(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==_n(n)?!1:e}function Ha(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),o=IE(n);let s=zn(1);e&&(r?on(r)&&(s=dc(r)):s=dc(n));const a=JN(o,t,r)?y6(o):zn(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const m=_n(o),w=r&&on(r)?_n(r):r;let k=m,I=Vl(k);for(;I&&r&&w!==k;){const x=dc(I),T=I.getBoundingClientRect(),b=$n(I),R=T.left+(I.clientLeft+parseFloat(b.paddingLeft))*x.x,L=T.top+(I.clientTop+parseFloat(b.paddingTop))*x.y;l*=x.x,c*=x.y,d*=x.x,f*=x.y,l+=R,c+=L,k=_n(I),I=Vl(k)}}return qo({width:d,height:f,x:l,y:c})}function Xg(n,e){const t=as(n).scrollLeft;return e?e.left+t:Ha(Gn(n)).left+t}function w6(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-Xg(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function YN(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const o=i==="fixed",s=Gn(r),a=e?Ka(e.floating):!1;if(r===s||a&&o)return t;let l={scrollLeft:0,scrollTop:0},c=zn(1);const d=zn(0),f=bn(r);if((f||!f&&!o)&&((ci(r)!=="body"||ss(s))&&(l=as(r)),bn(r))){const w=Ha(r);c=dc(r),d.x=w.x+r.clientLeft,d.y=w.y+r.clientTop}const m=s&&!f&&!o?w6(s,l):zn(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x+m.x,y:t.y*c.y-l.scrollTop*c.y+d.y+m.y}}function XN(n){return Array.from(n.getClientRects())}function QN(n){const e=Gn(n),t=as(n),r=n.ownerDocument.body,i=Rn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Rn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-t.scrollLeft+Xg(n);const a=-t.scrollTop;return $n(r).direction==="rtl"&&(s+=Rn(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}const Gb=25;function ZN(n,e){const t=_n(n),r=Gn(n),i=t.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const d=Lu();(!d||d&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=Xg(r);if(c<=0){const d=r.ownerDocument,f=d.body,m=getComputedStyle(f),w=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,k=Math.abs(r.clientWidth-f.clientWidth-w);k<=Gb&&(o-=k)}else c<=Gb&&(o+=c);return{width:o,height:s,x:a,y:l}}const eL=new Set(["absolute","fixed"]);function tL(n,e){const t=Ha(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,o=bn(n)?dc(n):zn(1),s=n.clientWidth*o.x,a=n.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function Kb(n,e,t){let r;if(e==="viewport")r=ZN(n,t);else if(e==="document")r=QN(Gn(n));else if(on(e))r=tL(e,t);else{const i=y6(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return qo(r)}function S6(n,e){const t=kr(n);return t===e||!on(t)||Rr(t)?!1:$n(t).position==="fixed"||S6(t,e)}function nL(n,e){const t=e.get(n);if(t)return t;let r=si(n,[],!1).filter(a=>on(a)&&ci(a)!=="body"),i=null;const o=$n(n).position==="fixed";let s=o?kr(n):n;for(;on(s)&&!Rr(s);){const a=$n(s),l=Qh(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&eL.has(i.position)||ss(s)&&!l&&S6(n,s))?r=r.filter(d=>d!==s):i=a,s=kr(s)}return e.set(n,r),r}function rL(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const s=[...t==="clippingAncestors"?Ka(e)?[]:nL(e,this._c):[].concat(t),r],a=s[0],l=s.reduce((c,d)=>{const f=Kb(e,d,i);return c.top=Rn(f.top,c.top),c.right=Ai(f.right,c.right),c.bottom=Ai(f.bottom,c.bottom),c.left=Rn(f.left,c.left),c},Kb(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function iL(n){const{width:e,height:t}=m6(n);return{width:e,height:t}}function oL(n,e,t){const r=bn(e),i=Gn(e),o=t==="fixed",s=Ha(n,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=zn(0);function c(){l.x=Xg(i)}if(r||!r&&!o)if((ci(e)!=="body"||ss(i))&&(a=as(e)),r){const w=Ha(e,!0,o,e);l.x=w.x+e.clientLeft,l.y=w.y+e.clientTop}else i&&c();o&&!r&&i&&c();const d=i&&!r&&!o?w6(i,a):zn(0),f=s.left+a.scrollLeft-l.x-d.x,m=s.top+a.scrollTop-l.y-d.y;return{x:f,y:m,width:s.width,height:s.height}}function Xp(n){return $n(n).position==="static"}function Wb(n,e){if(!bn(n)||$n(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Gn(n)===t&&(t=t.ownerDocument.body),t}function v6(n,e){const t=_n(n);if(Ka(n))return t;if(!bn(n)){let i=kr(n);for(;i&&!Rr(i);){if(on(i)&&!Xp(i))return i;i=kr(i)}return t}let r=Wb(n,e);for(;r&&$k(r)&&Xp(r);)r=Wb(r,e);return r&&Rr(r)&&Xp(r)&&!Qh(r)?t:r||Bk(n)||t}const sL=async function(n){const e=this.getOffsetParent||v6,t=this.getDimensions,r=await t(n.floating);return{reference:oL(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function aL(n){return $n(n).direction==="rtl"}const cL={convertOffsetParentRelativeRectToViewportRelativeRect:YN,getDocumentElement:Gn,getClippingRect:rL,getOffsetParent:v6,getElementRects:sL,getClientRects:XN,getDimensions:iL,getScale:dc,isElement:on,isRTL:aL};function x6(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function uL(n,e){let t=null,r;const i=Gn(n);function o(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=n.getBoundingClientRect(),{left:d,top:f,width:m,height:w}=c;if(a||e(),!m||!w)return;const k=$o(f),I=$o(i.clientWidth-(d+m)),x=$o(i.clientHeight-(f+w)),T=$o(d),R={rootMargin:-k+"px "+-I+"px "+-x+"px "+-T+"px",threshold:Rn(0,Ai(1,l))||1};let L=!0;function G(E){const N=E[0].intersectionRatio;if(N!==l){if(!L)return s();N?s(!1,N):r=setTimeout(()=>{s(!1,1e-7)},1e3)}N===1&&!x6(c,n.getBoundingClientRect())&&s(),L=!1}try{t=new IntersectionObserver(G,{...R,root:i.ownerDocument})}catch{t=new IntersectionObserver(G,R)}t.observe(n)}return s(!0),o}function lL(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=IE(n),d=i||o?[...c?si(c):[],...si(e)]:[];d.forEach(T=>{i&&T.addEventListener("scroll",t,{passive:!0}),o&&T.addEventListener("resize",t)});const f=c&&a?uL(c,t):null;let m=-1,w=null;s&&(w=new ResizeObserver(T=>{let[b]=T;b&&b.target===c&&w&&(w.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var R;(R=w)==null||R.observe(e)})),t()}),c&&!l&&w.observe(c),w.observe(e));let k,I=l?Ha(n):null;l&&x();function x(){const T=Ha(n);I&&!x6(I,T)&&t(),I=T,k=requestAnimationFrame(x)}return t(),()=>{var T;d.forEach(b=>{i&&b.removeEventListener("scroll",t),o&&b.removeEventListener("resize",t)}),f==null||f(),(T=w)==null||T.disconnect(),w=null,l&&cancelAnimationFrame(k)}}const Qp=Yg,hL=HN,dL=GN,fL=_N,gL=KN,pL=(n,e,t)=>{const r=new Map,i={platform:cL,...t},o={...i.platform,_c:r};return jN(n,e,{...i,platform:o})};var mL=typeof document<"u",yL=function(){},Od=mL?ce.useLayoutEffect:yL;function Af(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,i;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!Af(n[r],e[r]))return!1;return!0}if(i=Object.keys(n),t=i.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=t;r--!==0;){const o=i[r];if(!(o==="_owner"&&n.$$typeof)&&!Af(n[o],e[o]))return!1}return!0}return n!==n&&e!==e}function E6(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Jb(n,e){const t=E6(n);return Math.round(e*t)/t}function Zp(n){const e=Me.useRef(n);return Od(()=>{e.current=n}),e}function wL(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[d,f]=Me.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[m,w]=Me.useState(r);Af(m,r)||w(r);const[k,I]=Me.useState(null),[x,T]=Me.useState(null),b=Me.useCallback(z=>{z!==E.current&&(E.current=z,I(z))},[]),R=Me.useCallback(z=>{z!==N.current&&(N.current=z,T(z))},[]),L=o||k,G=s||x,E=Me.useRef(null),N=Me.useRef(null),p=Me.useRef(d),F=l!=null,v=Zp(l),O=Zp(i),C=Zp(c),V=Me.useCallback(()=>{if(!E.current||!N.current)return;const z={placement:e,strategy:t,middleware:m};O.current&&(z.platform=O.current),pL(E.current,N.current,z).then(ue=>{const De={...ue,isPositioned:C.current!==!1};H.current&&!Af(p.current,De)&&(p.current=De,Fc.flushSync(()=>{f(De)}))})},[m,e,t,O,C]);Od(()=>{c===!1&&p.current.isPositioned&&(p.current.isPositioned=!1,f(z=>({...z,isPositioned:!1})))},[c]);const H=Me.useRef(!1);Od(()=>(H.current=!0,()=>{H.current=!1}),[]),Od(()=>{if(L&&(E.current=L),G&&(N.current=G),L&&G){if(v.current)return v.current(L,G,V);V()}},[L,G,V,v,F]);const _=Me.useMemo(()=>({reference:E,floating:N,setReference:b,setFloating:R}),[b,R]),ee=Me.useMemo(()=>({reference:L,floating:G}),[L,G]),oe=Me.useMemo(()=>{const z={position:t,left:0,top:0};if(!ee.floating)return z;const ue=Jb(ee.floating,d.x),De=Jb(ee.floating,d.y);return a?{...z,transform:"translate("+ue+"px, "+De+"px)",...E6(ee.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ue,top:De}},[t,a,ee.floating,d.x,d.y]);return Me.useMemo(()=>({...d,update:V,refs:_,elements:ee,floatingStyles:oe}),[d,V,_,ee,oe])}const b6=(n,e)=>({...hL(n),options:[n,e]}),SL=(n,e)=>({...dL(n),options:[n,e]}),vL=(n,e)=>({...fL(n),options:[n,e]}),xL=(n,e)=>({...gL(n),options:[n,e]}),k6={...Me},EL=k6.useInsertionEffect,bL=EL||(n=>n());function A6(n){const e=Me.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return bL(()=>{e.current=n}),Me.useCallback(function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}var xx=typeof document<"u"?ce.useLayoutEffect:ce.useEffect;let Yb=!1,kL=0;const Xb=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+kL++;function AL(){const[n,e]=Me.useState(()=>Yb?Xb():void 0);return xx(()=>{n==null&&e(Xb())},[]),Me.useEffect(()=>{Yb=!0},[]),n}const DL=k6.useId,FL=DL||AL;let jh;process.env.NODE_ENV!=="production"&&(jh=new Set);function TL(){for(var n,e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i="Floating UI: "+t.join(" ");if(!((n=jh)!=null&&n.has(i))){var o;(o=jh)==null||o.add(i),console.warn(i)}}function IL(){for(var n,e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i="Floating UI: "+t.join(" ");if(!((n=jh)!=null&&n.has(i))){var o;(o=jh)==null||o.add(i),console.error(i)}}function ML(){const n=new Map;return{emit(e,t){var r;(r=n.get(e))==null||r.forEach(i=>i(t))},on(e,t){n.set(e,[...n.get(e)||[],t])},off(e,t){var r;n.set(e,((r=n.get(e))==null?void 0:r.filter(i=>i!==t))||[])}}}const RL=Me.createContext(null),CL=Me.createContext(null),PL=()=>{var n;return((n=Me.useContext(RL))==null?void 0:n.id)||null},$L=()=>Me.useContext(CL),BL="data-floating-ui-focusable";function VL(n){const{open:e=!1,onOpenChange:t,elements:r}=n,i=FL(),o=Me.useRef({}),[s]=Me.useState(()=>ML()),a=PL()!=null;if(process.env.NODE_ENV!=="production"){const w=r.reference;w&&!on(w)&&IL("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,c]=Me.useState(r.reference),d=A6((w,k,I)=>{o.current.openEvent=w?k:void 0,s.emit("openchange",{open:w,event:k,reason:I,nested:a}),t==null||t(w,k,I)}),f=Me.useMemo(()=>({setPositionReference:c}),[]),m=Me.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return Me.useMemo(()=>({dataRef:o,open:e,onOpenChange:d,elements:m,events:s,floatingId:i,refs:f}),[e,d,m,s,i,f])}function OL(n){n===void 0&&(n={});const{nodeId:e}=n,t=VL({...n,elements:{reference:null,floating:null,...n.elements}}),r=n.rootContext||t,i=r.elements,[o,s]=Me.useState(null),[a,l]=Me.useState(null),d=(i==null?void 0:i.domReference)||o,f=Me.useRef(null),m=$L();xx(()=>{d&&(f.current=d)},[d]);const w=wL({...n,elements:{...i,...a&&{reference:a}}}),k=Me.useCallback(R=>{const L=on(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),contextElement:R}:R;l(L),w.refs.setReference(L)},[w.refs]),I=Me.useCallback(R=>{(on(R)||R===null)&&(f.current=R,s(R)),(on(w.refs.reference.current)||w.refs.reference.current===null||R!==null&&!on(R))&&w.refs.setReference(R)},[w.refs]),x=Me.useMemo(()=>({...w.refs,setReference:I,setPositionReference:k,domReference:f}),[w.refs,I,k]),T=Me.useMemo(()=>({...w.elements,domReference:d}),[w.elements,d]),b=Me.useMemo(()=>({...w,...r,refs:x,elements:T,nodeId:e}),[w,x,T,e,r]);return xx(()=>{r.dataRef.current.floatingContext=b;const R=m==null?void 0:m.nodesRef.current.find(L=>L.id===e);R&&(R.context=b)}),Me.useMemo(()=>({...w,context:b,refs:x,elements:T}),[w,x,T,b])}const Qb="active",Zb="selected";function em(n,e,t){const r=new Map,i=t==="item";let o=n;if(i&&n){const{[Qb]:s,[Zb]:a,...l}=n;o=l}return{...t==="floating"&&{tabIndex:-1,[BL]:""},...o,...e.map(s=>{const a=s?s[t]:null;return typeof a=="function"?n?a(n):null:a}).concat(n).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(i&&[Qb,Zb].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof d=="function"){var f;(f=r.get(c))==null||f.push(d),s[c]=function(){for(var m,w=arguments.length,k=new Array(w),I=0;I<w;I++)k[I]=arguments[I];return(m=r.get(c))==null?void 0:m.map(x=>x(...k)).find(x=>x!==void 0)}}}else s[c]=d}),s),{})}}function NL(n){n===void 0&&(n=[]);const e=n.map(a=>a==null?void 0:a.reference),t=n.map(a=>a==null?void 0:a.floating),r=n.map(a=>a==null?void 0:a.item),i=Me.useCallback(a=>em(a,n,"reference"),e),o=Me.useCallback(a=>em(a,n,"floating"),t),s=Me.useCallback(a=>em(a,n,"item"),r);return Me.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:s}),[i,o,s])}function ek(n,e){return{...n,rects:{...n.rects,floating:{...n.rects.floating,height:e}}}}const LL=n=>({name:"inner",options:n,async fn(e){const{listRef:t,overflowRef:r,onFallbackChange:i,offset:o=0,index:s=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...d}=Vi(n,e),{rects:f,elements:{floating:m}}=e,w=t.current[s],k=(c==null?void 0:c.current)||m,I=m.clientTop||k.clientTop,x=m.clientTop!==0,T=k.clientTop!==0,b=m===k;if(process.env.NODE_ENV!=="production"&&(e.placement.startsWith("bottom")||TL('`placement` side must be "bottom" when using the `inner`',"middleware.")),!w)return{};const R={...e,...await b6(-w.offsetTop-m.clientTop-f.reference.height/2-w.offsetHeight/2-o).fn(e)},L=await Qp(ek(R,k.scrollHeight+I+m.clientTop),d),G=await Qp(R,{...d,elementContext:"reference"}),E=Rn(0,L.top),N=R.y+E,v=(k.scrollHeight>k.clientHeight?O=>O:Qi)(Rn(0,k.scrollHeight+(x&&b||T?I*2:0)-E-Rn(0,L.bottom)));if(k.style.maxHeight=v+"px",k.scrollTop=E,i){const O=k.offsetHeight<w.offsetHeight*Ai(a,t.current.length)-1||G.top>=-l||G.bottom>=-l;Fc.flushSync(()=>i(O))}return r&&(r.current=await Qp(ek({...R,y:N},k.offsetHeight+I+m.clientTop),d)),{y:N}}});function UL(n,e){const{open:t,elements:r}=n,{enabled:i=!0,overflowRef:o,scrollRef:s,onChange:a}=e,l=A6(a),c=Me.useRef(!1),d=Me.useRef(null),f=Me.useRef(null);Me.useEffect(()=>{if(!i)return;function w(I){if(I.ctrlKey||!k||o.current==null)return;const x=I.deltaY,T=o.current.top>=-.5,b=o.current.bottom>=-.5,R=k.scrollHeight-k.clientHeight,L=x<0?-1:1,G=x<0?"max":"min";k.scrollHeight<=k.clientHeight||(!T&&x>0||!b&&x<0?(I.preventDefault(),Fc.flushSync(()=>{l(E=>E+Math[G](x,R*L))})):/firefox/i.test(UN())&&(k.scrollTop+=x))}const k=(s==null?void 0:s.current)||r.floating;if(t&&k)return k.addEventListener("wheel",w),requestAnimationFrame(()=>{d.current=k.scrollTop,o.current!=null&&(f.current={...o.current})}),()=>{d.current=null,f.current=null,k.removeEventListener("wheel",w)}},[i,t,r.floating,o,s,l]);const m=Me.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const w=(s==null?void 0:s.current)||r.floating;if(!(!o.current||!w||!c.current)){if(d.current!==null){const k=w.scrollTop-d.current;(o.current.bottom<-.5&&k<-1||o.current.top<-.5&&k>1)&&Fc.flushSync(()=>l(I=>I+k))}requestAnimationFrame(()=>{d.current=w.scrollTop})}}}),[r.floating,l,o,s]);return Me.useMemo(()=>i?{floating:m}:{},[i,m])}let Xu=ce.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Xu.displayName="FloatingContext";let ME=ce.createContext(null);ME.displayName="PlacementContext";function jL(n){return ce.useMemo(()=>n?typeof n=="string"?{to:n}:n:null,[n])}function _L(){return ce.useContext(Xu).setReference}function zL(){return ce.useContext(Xu).getReferenceProps}function qL(){let{getFloatingProps:n,slot:e}=ce.useContext(Xu);return ce.useCallback((...t)=>Object.assign({},n(...t),{"data-anchor":e.anchor}),[n,e])}function HL(n=null){n===!1&&(n=null),typeof n=="string"&&(n={to:n});let e=ce.useContext(ME),t=ce.useMemo(()=>n,[JSON.stringify(n,(i,o)=>{var s;return(s=o==null?void 0:o.outerHTML)!=null?s:o})]);mr(()=>{e==null||e(t??null)},[e,t]);let r=ce.useContext(Xu);return ce.useMemo(()=>[r.setFloating,n?r.styles:{}],[r.setFloating,n,r.styles])}let tk=4;function GL({children:n,enabled:e=!0}){let[t,r]=ce.useState(null),[i,o]=ce.useState(0),s=ce.useRef(null),[a,l]=ce.useState(null);KL(a);let c=e&&t!==null&&a!==null,{to:d="bottom",gap:f=0,offset:m=0,padding:w=0,inner:k}=WL(t,a),[I,x="center"]=d.split(" ");mr(()=>{c&&o(0)},[c]);let{refs:T,floatingStyles:b,context:R}=OL({open:c,placement:I==="selection"?x==="center"?"bottom":`bottom-${x}`:x==="center"?`${I}`:`${I}-${x}`,strategy:"absolute",transform:!1,middleware:[b6({mainAxis:I==="selection"?0:f,crossAxis:m}),SL({padding:w}),I!=="selection"&&vL({padding:w}),I==="selection"&&k?LL({...k,padding:w,overflowRef:s,offset:i,minItemsVisible:tk,referenceOverflowThreshold:w,onFallbackChange(O){var C,V;if(!O)return;let H=R.elements.floating;if(!H)return;let _=parseFloat(getComputedStyle(H).scrollPaddingBottom)||0,ee=Math.min(tk,H.childElementCount),oe=0,z=0;for(let ue of(V=(C=R.elements.floating)==null?void 0:C.childNodes)!=null?V:[])if(go(ue)){let De=ue.offsetTop,ve=De+ue.clientHeight+_,Te=H.scrollTop,de=Te+H.clientHeight;if(De>=Te&&ve<=de)ee--;else{z=Math.max(0,Math.min(ve,de)-Math.max(De,Te)),oe=ue.clientHeight;break}}ee>=1&&o(ue=>{let De=oe*ee-z+_;return ue>=De?ue:De})}}):null,xL({padding:w,apply({availableWidth:O,availableHeight:C,elements:V}){Object.assign(V.floating.style,{overflow:"auto",maxWidth:`${O}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${C}px)`})}})].filter(Boolean),whileElementsMounted:lL}),[L=I,G=x]=R.placement.split("-");I==="selection"&&(L="selection");let E=ce.useMemo(()=>({anchor:[L,G].filter(Boolean).join(" ")}),[L,G]),N=UL(R,{overflowRef:s,onChange:o}),{getReferenceProps:p,getFloatingProps:F}=NL([N]),v=An(O=>{l(O),T.setFloating(O)});return Me.createElement(ME.Provider,{value:r},Me.createElement(Xu.Provider,{value:{setFloating:v,setReference:T.setReference,styles:b,getReferenceProps:p,getFloatingProps:F,slot:E}},n))}function KL(n){mr(()=>{if(!n)return;let e=new MutationObserver(()=>{let t=window.getComputedStyle(n).maxHeight,r=parseFloat(t);if(isNaN(r))return;let i=parseInt(t);isNaN(i)||r!==i&&(n.style.maxHeight=`${Math.ceil(r)}px`)});return e.observe(n,{attributes:!0,attributeFilter:["style"]}),()=>{e.disconnect()}},[n])}function WL(n,e){var t,r,i;let o=tm((t=n==null?void 0:n.gap)!=null?t:"var(--anchor-gap, 0)",e),s=tm((r=n==null?void 0:n.offset)!=null?r:"var(--anchor-offset, 0)",e),a=tm((i=n==null?void 0:n.padding)!=null?i:"var(--anchor-padding, 0)",e);return{...n,gap:o,offset:s,padding:a}}function tm(n,e,t=void 0){let r=Ju(),i=An((l,c)=>{if(l==null)return[t,null];if(typeof l=="number")return[l,null];if(typeof l=="string"){if(!c)return[t,null];let d=nk(l,c);return[d,f=>{let m=D6(l);{let w=m.map(k=>window.getComputedStyle(c).getPropertyValue(k));r.requestAnimationFrame(function k(){r.nextFrame(k);let I=!1;for(let[T,b]of m.entries()){let R=window.getComputedStyle(c).getPropertyValue(b);if(w[T]!==R){w[T]=R,I=!0;break}}if(!I)return;let x=nk(l,c);d!==x&&(f(x),d=x)})}return r.dispose}]}return[t,null]}),o=ce.useMemo(()=>i(n,e)[0],[n,e]),[s=o,a]=ce.useState();return mr(()=>{let[l,c]=i(n,e);if(a(l),!!c)return c(a)},[n,e]),s}function D6(n){let e=/var\((.*)\)/.exec(n);if(e){let t=e[1].indexOf(",");if(t===-1)return[e[1]];let r=e[1].slice(0,t).trim(),i=e[1].slice(t+1).trim();return i?[r,...D6(i)]:[r]}return[]}function nk(n,e){let t=document.createElement("div");e.appendChild(t),t.style.setProperty("margin-top","0px","important"),t.style.setProperty("margin-top",n,"important");let r=parseFloat(window.getComputedStyle(t).marginTop)||0;return e.removeChild(t),r}function JL({children:n,freeze:e},t){let r=F6(e,n);return ce.isValidElement(r)?ce.cloneElement(r,{ref:t}):ce.createElement(ce.Fragment,null,r)}ce.forwardRef(JL);function F6(n,e){let[t,r]=ce.useState(e);return!n&&t!==e&&r(e),n?t:e}let RE=ce.createContext(null);RE.displayName="OpenClosedContext";var _h=(n=>(n[n.Open=1]="Open",n[n.Closed=2]="Closed",n[n.Closing=4]="Closing",n[n.Opening=8]="Opening",n))(_h||{});function YL(){return ce.useContext(RE)}function XL({value:n,children:e}){return ce.createElement(RE.Provider,{value:n},e)}function QL(n){throw new Error("Unexpected object: "+n)}var Mn=(n=>(n[n.First=0]="First",n[n.Previous=1]="Previous",n[n.Next=2]="Next",n[n.Last=3]="Last",n[n.Specific=4]="Specific",n[n.Nothing=5]="Nothing",n))(Mn||{});function Ed(n,e){let t=e.resolveItems();if(t.length<=0)return null;let r=e.resolveActiveIndex(),i=r??-1;switch(n.focus){case 0:{for(let o=0;o<t.length;++o)if(!e.resolveDisabled(t[o],o,t))return o;return r}case 1:{i===-1&&(i=t.length);for(let o=i-1;o>=0;--o)if(!e.resolveDisabled(t[o],o,t))return o;return r}case 2:{for(let o=i+1;o<t.length;++o)if(!e.resolveDisabled(t[o],o,t))return o;return r}case 3:{for(let o=t.length-1;o>=0;--o)if(!e.resolveDisabled(t[o],o,t))return o;return r}case 4:{for(let o=0;o<t.length;++o)if(e.resolveId(t[o],o,t)===n.id)return o;return r}case 5:return null;default:QL(n)}}function T6(n){let e=An(n),t=ce.useRef(!1);ce.useEffect(()=>(t.current=!1,()=>{t.current=!0,_F(()=>{t.current&&e()})}),[e])}let ZL=ce.createContext(!1);function eU(){return ce.useContext(ZL)}function tU(n){let e=eU(),t=ce.useContext(M6),[r,i]=ce.useState(()=>{var o;if(!e&&t!==null)return(o=t.current)!=null?o:null;if(Ks.isServer)return null;let s=n==null?void 0:n.getElementById("headlessui-portal-root");if(s)return s;if(n===null)return null;let a=n.createElement("div");return a.setAttribute("id","headlessui-portal-root"),n.body.appendChild(a)});return ce.useEffect(()=>{r!==null&&(n!=null&&n.body.contains(r)||n==null||n.body.appendChild(r))},[r,n]),ce.useEffect(()=>{e||t!==null&&i(t.current)},[t,i,e]),r}let I6=ce.Fragment,nU=li(function(n,e){let{ownerDocument:t=null,...r}=n,i=ce.useRef(null),o=Ni(BO(m=>{i.current=m}),e),s=vx(i.current),a=t??s,l=tU(a),c=ce.useContext(sU),d=Ju(),f=ui();return T6(()=>{var m;l&&l.childNodes.length<=0&&((m=l.parentElement)==null||m.removeChild(l))}),l?Ws.createPortal(ce.createElement("div",{"data-headlessui-portal":"",ref:m=>{d.dispose(),c&&m&&d.add(c.register(m))}},f({ourProps:{ref:o},theirProps:r,slot:{},defaultTag:I6,name:"Portal"})),l):null});function rU(n,e){let t=Ni(e),{enabled:r=!0,ownerDocument:i,...o}=n,s=ui();return r?ce.createElement(nU,{...o,ownerDocument:i,ref:t}):s({ourProps:{ref:t},theirProps:o,slot:{},defaultTag:I6,name:"Portal"})}let iU=ce.Fragment,M6=ce.createContext(null);function oU(n,e){let{target:t,...r}=n,i={ref:Ni(e)},o=ui();return ce.createElement(M6.Provider,{value:t},o({ourProps:i,theirProps:r,defaultTag:iU,name:"Popover.Group"}))}let sU=ce.createContext(null),aU=li(rU),cU=li(oU),uU=Object.assign(aU,{Group:cU});const Nd={Idle:{kind:"Idle"},Tracked:n=>({kind:"Tracked",position:n}),Moved:{kind:"Moved"}};function R6(n){let e=n.getBoundingClientRect();return`${e.x},${e.y}`}function lU(n,e,t){let r=$r();if(e.kind==="Tracked"){let i=function(){o!==R6(n)&&(r.dispose(),t())},{position:o}=e,s=new ResizeObserver(i);s.observe(n),r.add(()=>s.disconnect()),r.addEventListener(window,"scroll",i,{passive:!0}),r.addEventListener(window,"resize",i)}return()=>r.dispose()}let rk=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ik(n){var e,t;let r=(e=n.innerText)!=null?e:"",i=n.cloneNode(!0);if(!go(i))return r;let o=!1;for(let a of i.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),o=!0;let s=o?(t=i.innerText)!=null?t:"":r;return rk.test(s)&&(s=s.replace(rk,"")),s}function hU(n){let e=n.getAttribute("aria-label");if(typeof e=="string")return e.trim();let t=n.getAttribute("aria-labelledby");if(t){let r=t.split(" ").map(i=>{let o=document.getElementById(i);if(o){let s=o.getAttribute("aria-label");return typeof s=="string"?s.trim():ik(o).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ik(n).trim()}function dU(n){let e=ce.useRef(""),t=ce.useRef("");return An(()=>{let r=n.current;if(!r)return"";let i=r.innerText;if(e.current===i)return t.current;let o=hU(r).trim().toLowerCase();return e.current=i,t.current=o,o})}var fU=Object.defineProperty,gU=(n,e,t)=>e in n?fU(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ok=(n,e,t)=>(gU(n,typeof e!="symbol"?e+"":e,t),t),sr=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(sr||{}),Lo=(n=>(n[n.Single=0]="Single",n[n.Multi=1]="Multi",n))(Lo||{}),Ld=(n=>(n[n.Pointer=0]="Pointer",n[n.Other=1]="Other",n))(Ld||{}),C6=(n=>(n[n.OpenListbox=0]="OpenListbox",n[n.CloseListbox=1]="CloseListbox",n[n.GoToOption=2]="GoToOption",n[n.Search=3]="Search",n[n.ClearSearch=4]="ClearSearch",n[n.SelectOption=5]="SelectOption",n[n.RegisterOptions=6]="RegisterOptions",n[n.UnregisterOptions=7]="UnregisterOptions",n[n.SetButtonElement=8]="SetButtonElement",n[n.SetOptionsElement=9]="SetOptionsElement",n[n.SortOptions=10]="SortOptions",n[n.MarkButtonAsMoved=11]="MarkButtonAsMoved",n))(C6||{});function sk(n,e=t=>t){let t=n.activeOptionIndex!==null?n.options[n.activeOptionIndex]:null,r=g6(e(n.options.slice()),o=>o.dataRef.current.domRef.current),i=t?r.indexOf(t):null;return i===-1&&(i=null),{options:r,activeOptionIndex:i}}let pU={1(n){if(n.dataRef.current.disabled||n.listboxState===1)return n;let e=n.buttonElement?Nd.Tracked(R6(n.buttonElement)):n.buttonPositionState;return{...n,activeOptionIndex:null,pendingFocus:{focus:Mn.Nothing},listboxState:1,__demoMode:!1,buttonPositionState:e}},0(n,e){if(n.dataRef.current.disabled||n.listboxState===0)return n;let t=n.activeOptionIndex,{isSelected:r}=n.dataRef.current,i=n.options.findIndex(o=>r(o.dataRef.current.value));return i!==-1&&(t=i),{...n,frozenValue:!1,pendingFocus:e.focus,listboxState:0,activeOptionIndex:t,__demoMode:!1,buttonPositionState:Nd.Idle}},2(n,e){var t,r,i,o,s;if(n.dataRef.current.disabled||n.listboxState===1)return n;let a={...n,searchQuery:"",activationTrigger:(t=e.trigger)!=null?t:1,__demoMode:!1};if(e.focus===Mn.Nothing)return{...a,activeOptionIndex:null};if(e.focus===Mn.Specific)return{...a,activeOptionIndex:n.options.findIndex(d=>d.id===e.id)};if(e.focus===Mn.Previous){let d=n.activeOptionIndex;if(d!==null){let f=n.options[d].dataRef.current.domRef,m=Ed(e,{resolveItems:()=>n.options,resolveActiveIndex:()=>n.activeOptionIndex,resolveId:w=>w.id,resolveDisabled:w=>w.dataRef.current.disabled});if(m!==null){let w=n.options[m].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===w.current||((i=w.current)==null?void 0:i.previousElementSibling)===null)return{...a,activeOptionIndex:m}}}}else if(e.focus===Mn.Next){let d=n.activeOptionIndex;if(d!==null){let f=n.options[d].dataRef.current.domRef,m=Ed(e,{resolveItems:()=>n.options,resolveActiveIndex:()=>n.activeOptionIndex,resolveId:w=>w.id,resolveDisabled:w=>w.dataRef.current.disabled});if(m!==null){let w=n.options[m].dataRef.current.domRef;if(((o=f.current)==null?void 0:o.nextElementSibling)===w.current||((s=w.current)==null?void 0:s.nextElementSibling)===null)return{...a,activeOptionIndex:m}}}}let l=sk(n),c=Ed(e,{resolveItems:()=>l.options,resolveActiveIndex:()=>l.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});return{...a,...l,activeOptionIndex:c}},3:(n,e)=>{if(n.dataRef.current.disabled||n.listboxState===1)return n;let t=n.searchQuery!==""?0:1,r=n.searchQuery+e.value.toLowerCase(),i=(n.activeOptionIndex!==null?n.options.slice(n.activeOptionIndex+t).concat(n.options.slice(0,n.activeOptionIndex+t)):n.options).find(s=>{var a;return!s.dataRef.current.disabled&&((a=s.dataRef.current.textValue)==null?void 0:a.startsWith(r))}),o=i?n.options.indexOf(i):-1;return o===-1||o===n.activeOptionIndex?{...n,searchQuery:r}:{...n,searchQuery:r,activeOptionIndex:o,activationTrigger:1}},4(n){return n.dataRef.current.disabled||n.listboxState===1||n.searchQuery===""?n:{...n,searchQuery:""}},5(n){return n.dataRef.current.mode===0?{...n,frozenValue:!0}:{...n}},6:(n,e)=>{let t=n.options.concat(e.options),r=n.activeOptionIndex;if(n.pendingFocus.focus!==Mn.Nothing&&(r=Ed(n.pendingFocus,{resolveItems:()=>t,resolveActiveIndex:()=>n.activeOptionIndex,resolveId:i=>i.id,resolveDisabled:i=>i.dataRef.current.disabled})),n.activeOptionIndex===null){let{isSelected:i}=n.dataRef.current;if(i){let o=t.findIndex(s=>i==null?void 0:i(s.dataRef.current.value));o!==-1&&(r=o)}}return{...n,options:t,activeOptionIndex:r,pendingFocus:{focus:Mn.Nothing},pendingShouldSort:!0}},7:(n,e)=>{let t=n.options,r=[],i=new Set(e.options);for(let[o,s]of t.entries())if(i.has(s.id)&&(r.push(o),i.delete(s.id),i.size===0))break;if(r.length>0){t=t.slice();for(let o of r.reverse())t.splice(o,1)}return{...n,options:t,activationTrigger:1}},8:(n,e)=>n.buttonElement===e.element?n:{...n,buttonElement:e.element},9:(n,e)=>n.optionsElement===e.element?n:{...n,optionsElement:e.element},10:n=>n.pendingShouldSort?{...n,...sk(n),pendingShouldSort:!1}:n,11(n){return n.buttonPositionState.kind!=="Tracked"?n:{...n,buttonPositionState:Nd.Moved}}};class CE extends a6{constructor(e){super(e),ok(this,"actions",{onChange:t=>{let{onChange:r,compare:i,mode:o,value:s}=this.state.dataRef.current;return Bi(o,{0:()=>r==null?void 0:r(t),1:()=>{let a=s.slice(),l=a.findIndex(c=>i(c,t));return l===-1?a.push(t):a.splice(l,1),r==null?void 0:r(a)}})},registerOption:Wp(()=>{let t=[],r=new Set;return[(i,o)=>{r.has(o)||(r.add(o),t.push({id:i,dataRef:o}))},()=>(r.clear(),this.send({type:6,options:t.splice(0)}))]}),unregisterOption:Wp(()=>{let t=[];return[r=>t.push(r),()=>{this.send({type:7,options:t.splice(0)})}]}),goToOption:Wp(()=>{let t=null;return[(r,i)=>{t={type:2,...r,trigger:i}},()=>t&&this.send(t)]}),closeListbox:()=>{this.send({type:1})},openListbox:t=>{this.send({type:0,focus:t})},selectActiveOption:()=>{var t;if(this.state.activeOptionIndex!==null){let{dataRef:r}=this.state.options[this.state.activeOptionIndex];this.actions.selectOption(r.current.value)}else this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(t=this.state.buttonElement)==null||t.focus({preventScroll:!0}))},selectOption:t=>{this.send({type:5,value:t})},search:t=>{this.send({type:3,value:t})},clearSearch:()=>{this.send({type:4})},setButtonElement:t=>{this.send({type:8,element:t})},setOptionsElement:t=>{this.send({type:9,element:t})}}),ok(this,"selectors",{activeDescendantId(t){var r;let i=t.activeOptionIndex,o=t.options;return i===null||(r=o[i])==null?void 0:r.id},isActive(t,r){var i;let o=t.activeOptionIndex,s=t.options;return o!==null?((i=s[o])==null?void 0:i.id)===r:!1},hasFrozenValue(t){return t.frozenValue},shouldScrollIntoView(t,r){return t.__demoMode||t.listboxState!==0||t.activationTrigger===0?!1:this.isActive(t,r)},didButtonMove(t){return t.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let t=this.state.id,r=FE.get(null);this.disposables.add(r.on(u6.Push,i=>{!r.selectors.isTop(i,t)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(t)),this.on(1,()=>r.actions.pop(t))}this.disposables.group(t=>{this.on(1,r=>{r.buttonElement&&(t.dispose(),t.add(lU(r.buttonElement,r.buttonPositionState,()=>{this.send({type:11})})))})}),this.on(5,(t,r)=>{var i;this.actions.onChange(r.value),this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(i=this.state.buttonElement)==null||i.focus({preventScroll:!0}))})}static new({id:e,__demoMode:t=!1}){return new CE({id:e,dataRef:{current:{}},listboxState:t?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:Mn.Nothing},frozenValue:!1,__demoMode:t,buttonPositionState:Nd.Idle})}reduce(e,t){return Bi(t.type,pU,e,t)}}const P6=ce.createContext(null);function PE(n){let e=ce.useContext(P6);if(e===null){let t=new Error(`<${n} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,$6),t}return e}function $6({id:n,__demoMode:e=!1}){let t=ce.useMemo(()=>CE.new({id:n,__demoMode:e}),[]);return T6(()=>t.dispose()),t}let Qg=ce.createContext(null);Qg.displayName="ListboxDataContext";function od(n){let e=ce.useContext(Qg);if(e===null){let t=new Error(`<${n} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,od),t}return e}let mU=ce.Fragment;function yU(n,e){let t=ce.useId(),r=kE(),{value:i,defaultValue:o,form:s,name:a,onChange:l,by:c,invalid:d=!1,disabled:f=r||!1,horizontal:m=!1,multiple:w=!1,__demoMode:k=!1,...I}=n;const x=m?"horizontal":"vertical";let T=Ni(e),b=vO(o),[R=w?[]:void 0,L]=SO(i,l,b),G=$6({id:t,__demoMode:k}),E=ce.useRef({static:!1,hold:!1}),N=ce.useRef(new Map),p=HO(c),F=ce.useCallback(Te=>Bi(v.mode,{[Lo.Multi]:()=>R.some(de=>p(de,Te)),[Lo.Single]:()=>p(R,Te)}),[R]),v=is({value:R,disabled:f,invalid:d,mode:w?Lo.Multi:Lo.Single,orientation:x,onChange:L,compare:p,isSelected:F,optionsPropsRef:E,listRef:N});mr(()=>{G.state.dataRef.current=v},[v]);let O=br(G,Te=>Te.listboxState),C=FE.get(null),V=br(C,ce.useCallback(Te=>C.selectors.isTop(Te,t),[C,t])),[H,_]=br(G,Te=>[Te.buttonElement,Te.optionsElement]);SN(V,[H,_],(Te,de)=>{G.send({type:C6.CloseListbox}),f6(de,TE.Loose)||(Te.preventDefault(),H==null||H.focus())});let ee=is({open:O===sr.Open,disabled:f,invalid:d,value:R}),[oe,z]=UO({inherit:!0}),ue={ref:T},De=ce.useCallback(()=>{if(b!==void 0)return L==null?void 0:L(b)},[L,b]),ve=ui();return ce.createElement(z,{value:oe,props:{htmlFor:H==null?void 0:H.id},slot:{open:O===sr.Open,disabled:f}},ce.createElement(GL,null,ce.createElement(P6.Provider,{value:G},ce.createElement(Qg.Provider,{value:v},ce.createElement(XL,{value:Bi(O,{[sr.Open]:_h.Open,[sr.Closed]:_h.Closed})},a!=null&&R!=null&&ce.createElement(FO,{disabled:f,data:{[a]:R},form:s,onReset:De}),ve({ourProps:ue,theirProps:I,slot:ee,defaultTag:mU,name:"Listbox"}))))))}let wU="button";function SU(n,e){let t=ce.useId(),r=JF(),i=od("Listbox.Button"),o=PE("Listbox.Button"),{id:s=r||`headlessui-listbox-button-${t}`,disabled:a=i.disabled||!1,autoFocus:l=!1,...c}=n,d=Ni(e,_L(),o.actions.setButtonElement),f=zL(),[m,w,k]=br(o,_=>[_.listboxState,_.buttonElement,_.optionsElement]),I=m===sr.Open;EN(I,{trigger:w,action:ce.useCallback(_=>{if(w!=null&&w.contains(_.target))return xd.Ignore;let ee=_.target.closest('[role="option"]:not([data-disabled])');return go(ee)?xd.Select(ee):k!=null&&k.contains(_.target)?xd.Ignore:xd.Close},[w,k]),close:o.actions.closeListbox,select:o.actions.selectActiveOption});let x=An(_=>{switch(_.key){case Wn.Enter:xO(_.currentTarget);break;case Wn.Space:case Wn.ArrowDown:_.preventDefault(),o.actions.openListbox({focus:i.value?Mn.Nothing:Mn.First});break;case Wn.ArrowUp:_.preventDefault(),o.actions.openListbox({focus:i.value?Mn.Nothing:Mn.Last});break}}),T=An(_=>{switch(_.key){case Wn.Space:_.preventDefault();break}}),b=KO(_=>{var ee;o.state.listboxState===sr.Open?(Ws.flushSync(()=>o.actions.closeListbox()),(ee=o.state.buttonElement)==null||ee.focus({preventScroll:!0})):(_.preventDefault(),o.actions.openListbox({focus:Mn.Nothing}))}),R=An(_=>_.preventDefault()),L=n6([s]),G=VO(),{isFocusVisible:E,focusProps:N}=iO({autoFocus:l}),{isHovered:p,hoverProps:F}=rO({isDisabled:a}),{pressed:v,pressProps:O}=hO({disabled:a}),C=is({open:m===sr.Open,active:v||m===sr.Open,disabled:a,invalid:i.invalid,value:i.value,hover:p,focus:E,autofocus:l}),V=br(o,_=>_.listboxState===sr.Open),H=qF(f(),{ref:d,id:s,type:bN(n,w),"aria-haspopup":"listbox","aria-controls":k==null?void 0:k.id,"aria-expanded":V,"aria-labelledby":L,"aria-describedby":G,disabled:a||void 0,autoFocus:l,onKeyDown:x,onKeyUp:T,onKeyPress:R},b,N,F,O);return ui()({ourProps:H,theirProps:c,slot:C,defaultTag:wU,name:"Listbox.Button"})}let B6=ce.createContext(!1),vU="div",xU=mx.RenderStrategy|mx.Static;function EU(n,e){let t=ce.useId(),{id:r=`headlessui-listbox-options-${t}`,anchor:i,portal:o=!1,modal:s=!0,transition:a=!1,...l}=n,c=jL(i),[d,f]=ce.useState(null);c&&(o=!0);let m=od("Listbox.Options"),w=PE("Listbox.Options"),[k,I,x,T]=br(w,Ie=>[Ie.listboxState,Ie.buttonElement,Ie.optionsElement,Ie.__demoMode]),b=vx(I),R=vx(x),L=YL(),[G,E]=BN(a,d,L!==null?(L&_h.Open)===_h.Open:k===sr.Open);aN(G,I,w.actions.closeListbox);let N=T?!1:s&&k===sr.Open;MN(N,R);let p=T?!1:s&&k===sr.Open;sN(p,{allowed:ce.useCallback(()=>[I,x],[I,x])});let F=br(w,w.selectors.didButtonMove)?!1:G,v=br(w,w.selectors.hasFrozenValue)&&!n.static,O=F6(v,m.value),C=ce.useCallback(Ie=>m.compare(O,Ie),[m.compare,O]),V=br(w,Ie=>{var Ze;if(c==null||!((Ze=c==null?void 0:c.to)!=null&&Ze.includes("selection")))return null;let Ee=Ie.options.findIndex(be=>C(be.dataRef.current.value));return Ee===-1&&(Ee=0),Ee}),H=(()=>{if(c==null)return;if(V===null)return{...c,inner:void 0};let Ie=Array.from(m.listRef.current.values());return{...c,inner:{listRef:{current:Ie},index:V}}})(),[_,ee]=HL(H),oe=qL(),z=Ni(e,c?_:null,w.actions.setOptionsElement,f),ue=Ju();ce.useEffect(()=>{let Ie=x;Ie&&k===sr.Open&&(cO(Ie)||Ie==null||Ie.focus({preventScroll:!0}))},[k,x]);let De=An(Ie=>{var Ze;switch(ue.dispose(),Ie.key){case Wn.Space:if(w.state.searchQuery!=="")return Ie.preventDefault(),Ie.stopPropagation(),w.actions.search(Ie.key);case Wn.Enter:Ie.preventDefault(),Ie.stopPropagation(),w.actions.selectActiveOption();break;case Bi(m.orientation,{vertical:Wn.ArrowDown,horizontal:Wn.ArrowRight}):return Ie.preventDefault(),Ie.stopPropagation(),w.actions.goToOption({focus:Mn.Next});case Bi(m.orientation,{vertical:Wn.ArrowUp,horizontal:Wn.ArrowLeft}):return Ie.preventDefault(),Ie.stopPropagation(),w.actions.goToOption({focus:Mn.Previous});case Wn.Home:case Wn.PageUp:return Ie.preventDefault(),Ie.stopPropagation(),w.actions.goToOption({focus:Mn.First});case Wn.End:case Wn.PageDown:return Ie.preventDefault(),Ie.stopPropagation(),w.actions.goToOption({focus:Mn.Last});case Wn.Escape:Ie.preventDefault(),Ie.stopPropagation(),Ws.flushSync(()=>w.actions.closeListbox()),(Ze=w.state.buttonElement)==null||Ze.focus({preventScroll:!0});return;case Wn.Tab:Ie.preventDefault(),Ie.stopPropagation(),Ws.flushSync(()=>w.actions.closeListbox()),pN(w.state.buttonElement,Ie.shiftKey?Sx.Previous:Sx.Next);break;default:Ie.key.length===1&&(w.actions.search(Ie.key),ue.setTimeout(()=>w.actions.clearSearch(),350));break}}),ve=br(w,Ie=>{var Ze;return(Ze=Ie.buttonElement)==null?void 0:Ze.id}),Te=is({open:k===sr.Open}),de=qF(c?oe():{},{id:r,ref:z,"aria-activedescendant":br(w,w.selectors.activeDescendantId),"aria-multiselectable":m.mode===Lo.Multi?!0:void 0,"aria-labelledby":ve,"aria-orientation":m.orientation,onKeyDown:De,role:"listbox",tabIndex:k===sr.Open?0:void 0,style:{...l.style,...ee,"--button-width":GO(G,I,!0).width},...$N(E)}),ie=ui(),ke=ce.useMemo(()=>m.mode===Lo.Multi?m:{...m,isSelected:C},[m,C]);return ce.createElement(uU,{enabled:o?n.static||G:!1,ownerDocument:b},ce.createElement(Qg.Provider,{value:ke},ie({ourProps:de,theirProps:l,slot:Te,defaultTag:vU,features:xU,visible:F,name:"Listbox.Options"})))}let bU="div";function kU(n,e){let t=ce.useId(),{id:r=`headlessui-listbox-option-${t}`,disabled:i=!1,value:o,...s}=n,a=ce.useContext(B6)===!0,l=od("Listbox.Option"),c=PE("Listbox.Option"),d=br(c,v=>c.selectors.isActive(v,r)),f=l.isSelected(o),m=ce.useRef(null),w=dU(m),k=Yu({disabled:i,value:o,domRef:m,get textValue(){return w()}}),I=Ni(e,m,v=>{v?l.listRef.current.set(r,v):l.listRef.current.delete(r)}),x=br(c,v=>c.selectors.shouldScrollIntoView(v,r));mr(()=>{if(x)return $r().requestAnimationFrame(()=>{var v,O;(O=(v=m.current)==null?void 0:v.scrollIntoView)==null||O.call(v,{block:"nearest"})})},[x,m]),mr(()=>{if(!a)return c.actions.registerOption(r,k),()=>c.actions.unregisterOption(r)},[k,r,a]);let T=An(v=>{if(i)return v.preventDefault();c.actions.selectOption(o)}),b=An(()=>{if(i)return c.actions.goToOption({focus:Mn.Nothing});c.actions.goToOption({focus:Mn.Specific,id:r})}),R=RN(),L=An(v=>R.update(v)),G=An(v=>{R.wasMoved(v)&&(i||d&&c.state.activationTrigger===Ld.Pointer||c.actions.goToOption({focus:Mn.Specific,id:r},Ld.Pointer))}),E=An(v=>{R.wasMoved(v)&&(i||d&&c.state.activationTrigger===Ld.Pointer&&c.actions.goToOption({focus:Mn.Nothing}))}),N=is({active:d,focus:d,selected:f,disabled:i,selectedOption:f&&a}),p=a?{}:{id:r,ref:I,role:"option",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:T,onFocus:b,onPointerEnter:L,onMouseEnter:L,onPointerMove:G,onMouseMove:G,onPointerLeave:E,onMouseLeave:E},F=ui();return!f&&a?null:F({ourProps:p,theirProps:s,slot:N,defaultTag:bU,name:"Listbox.Option"})}let AU=ce.Fragment;function DU(n,e){let{options:t,placeholder:r,...i}=n,o={ref:Ni(e)},s=od("ListboxSelectedOption"),a=is({}),l=s.value===void 0||s.value===null||s.mode===Lo.Multi&&Array.isArray(s.value)&&s.value.length===0,c=ui();return ce.createElement(B6.Provider,{value:!0},c({ourProps:o,theirProps:{...i,children:ce.createElement(ce.Fragment,null,r&&l?r:t)},slot:a,defaultTag:AU,name:"ListboxSelectedOption"}))}let FU=li(yU),V6=li(SU),TU=r6,O6=li(EU),N6=li(kU),IU=li(DU),MU=Object.assign(FU,{Button:V6,Label:TU,Options:O6,Option:N6,SelectedOption:IU});function L6(n={}){const{activeAddress:e,algodClient:t}=cr.useWallet(),{activeNetwork:r}=cr.useNetwork(),{enabled:i=!0}=n;return Lx({queryKey:["account-info",e,r],queryFn:async()=>{if(!e||!t)return null;try{return await t.accountInformation(e).do()}catch(o){throw new Error(`Error fetching account information: ${o}`)}},enabled:i&&!!e&&!!t,refetchOnWindowFocus:!0})}function U6(n={}){const{enabled:e=!0}=n,{algodClient:t}=cr.useWallet(),[r,i]=ce.useState(""),[o,s]=ce.useState(null),[a,l]=ce.useState(!1),[c,d]=ce.useState(null),f=ce.useCallback(()=>{i(""),s(null),l(!1),d(null)},[]);return ce.useEffect(()=>{s(null),d(null);const m=parseInt(r,10);if(!r||isNaN(m)||m<=0||!t||!e){l(!1);return}l(!0);const w=setTimeout(async()=>{try{const k=await t.getAssetByID(m).do();s({index:Number(k.index),name:k.params.name||"Unnamed Asset",unitName:k.params.unitName||"",decimals:k.params.decimals})}catch{d("Asset not found")}finally{l(!1)}},500);return()=>clearTimeout(w)},[r,t,e]),{assetIdInput:r,setAssetIdInput:i,assetInfo:o,isLoading:a,error:c,reset:f}}function RU(){const{activeAddress:n,algodClient:e,signTransactions:t}=cr.useWallet(),r=U6(),[i,o]=ce.useState("idle"),[s,a]=ce.useState(null),l=ce.useCallback(()=>{r.reset(),o("idle"),a(null)},[r]),c=ce.useCallback(()=>{o("idle"),a(null)},[]),d=ce.useCallback(async()=>{if(!(!r.assetInfo||!n||!e)){o("signing"),a(null);try{const f=await e.getTransactionParams().do(),m=_o.makeAssetTransferTxnWithSuggestedParamsFromObject({sender:n,receiver:n,amount:0,assetIndex:r.assetInfo.index,suggestedParams:f}),k=(await t([m.toByte()]))[0];if(!k)throw new Error("Transaction was not signed");o("sending"),await e.sendRawTransaction(k).do(),await _o.waitForConfirmation(e,m.txID(),4),o("success")}catch(f){o("error"),a(f instanceof Error?f.message:"Opt-in failed")}}},[r.assetInfo,n,e,t]);return{assetIdInput:r.assetIdInput,setAssetIdInput:r.setAssetIdInput,assetInfo:r.assetInfo,assetLookupLoading:r.isLoading,assetLookupError:r.error,status:i,error:s,handleOptIn:d,reset:l,retry:c}}function CU(){const{activeAddress:n,algodClient:e,signTransactions:t}=cr.useWallet(),[r,i]=ce.useState("algo"),[o,s]=ce.useState(""),[a,l]=ce.useState(""),[c,d]=ce.useState("idle"),[f,m]=ce.useState(null),w=U6({enabled:r==="asa"}),k=ce.useCallback(()=>{i("algo"),s(""),l(""),w.reset(),d("idle"),m(null)},[w]),I=ce.useCallback(()=>{d("idle"),m(null)},[]),x=ce.useCallback(async()=>{if(!(!n||!e||!o||!a)){d("signing"),m(null);try{const T=await e.getTransactionParams().do();let b;if(r==="algo"){const G=Math.floor(parseFloat(a)*1e6);if(isNaN(G)||G<=0)throw new Error("Invalid amount");b=_o.makePaymentTxnWithSuggestedParamsFromObject({sender:n,receiver:o,amount:G,suggestedParams:T})}else{if(!w.assetInfo)throw new Error("No asset selected");const G=Math.floor(parseFloat(a)*Math.pow(10,w.assetInfo.decimals));if(isNaN(G)||G<=0)throw new Error("Invalid amount");b=_o.makeAssetTransferTxnWithSuggestedParamsFromObject({sender:n,receiver:o,amount:G,assetIndex:w.assetInfo.index,suggestedParams:T})}const L=(await t([b.toByte()]))[0];if(!L)throw new Error("Transaction was not signed");d("sending"),await e.sendRawTransaction(L).do(),await _o.waitForConfirmation(e,b.txID(),4),d("success")}catch(T){d("error"),m(T instanceof Error?T.message:"Send failed")}}},[r,a,o,w.assetInfo,n,e,t]);return{sendType:r,setSendType:i,receiver:o,setReceiver:s,amount:a,setAmount:l,assetIdInput:w.assetIdInput,setAssetIdInput:w.setAssetIdInput,assetInfo:w.assetInfo,assetLookupLoading:w.isLoading,assetLookupError:w.error,status:c,error:f,handleSend:x,reset:k,retry:I}}function PU({children:n}){var De;const{activeAddress:e,activeWallet:t}=cr.useWallet(),{theme:r}=Oi(),[i,o]=ce.useState(!1),[s,a]=ce.useState("main"),[l,c]=ce.useState(!1),d=RU(),f=CU(),[m,w]=ce.useState(()=>{const ve=localStorage.getItem("uwui:balance-preference");return ve?ve==="available":!1}),k=r==="system"?void 0:r,I=wE({enabled:!!e}),x=((De=I.data)==null?void 0:De.name)??null,{data:T}=L6({enabled:!!e}),b=ce.useMemo(()=>!T||T.amount===void 0?null:Number(T.amount)/1e6,[T]),R=ce.useMemo(()=>{if(!T||T.amount===void 0||T.minBalance===void 0)return null;const ve=Number(T.amount)-Number(T.minBalance);return Math.max(0,ve/1e6)},[T]),L=m?R:b,{refs:G,floatingStyles:E,context:N}=Cf({open:i,onOpenChange:ve=>{o(ve),ve||(a("main"),d.reset(),f.reset())},placement:"bottom-end",middleware:[r3(8),o3(),i3()],whileElementsMounted:JI}),p=hA(N),F=Rf(N,{outsidePressEvent:"mousedown"}),{getReferenceProps:v,getFloatingProps:O}=Pf([p,F]),C=Di(),V=()=>{e&&(navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),2e3))},H=async()=>{if(t)try{await t.disconnect(),o(!1)}catch(ve){console.error("Error disconnecting wallet:",ve)}},_=ve=>{t&&t.setActiveAccount&&t.setActiveAccount(ve)},ee=()=>{const ve=!m;w(ve),localStorage.setItem("uwui:balance-preference",ve?"available":"total")},oe=K.jsx("div",{className:"mb-4 bg-[var(--wui-color-bg-secondary)] rounded-lg p-3",children:K.jsxs("div",{className:"flex justify-between items-center",children:[L!==null&&K.jsxs("span",{className:"text-base font-medium text-[var(--wui-color-text)] flex items-center gap-1",children:[WP(L,{fractionDigits:4}),K.jsx(b2,{})]}),K.jsxs("button",{onClick:ee,className:"flex items-center gap-1 text-sm text-[var(--wui-color-text-secondary)] bg-[var(--wui-color-bg-tertiary)] py-1 pl-2.5 pr-2 rounded-md hover:brightness-90 transition-all focus:outline-none",title:m?"Show total balance":"Show available balance",children:[m?"Available":"Total",K.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"ml-0.5 opacity-80",children:[K.jsx("path",{d:"m17 10-5-5-5 5"}),K.jsx("path",{d:"m17 14-5 5-5-5"})]})]})]})}),z=n||K.jsx(Hg,{}),ue=ce.cloneElement(z,v({ref:G.setReference}));return K.jsxs(K.Fragment,{children:[ue,i&&K.jsx(ed,{children:K.jsx(Mf,{context:N,modal:!1,children:K.jsx("div",{"data-wallet-theme":!0,"data-wallet-ui":!0,"data-theme":k,children:K.jsx("div",{ref:G.setFloating,style:{...E,width:s==="main"?320:384},...O(),role:"menu","aria-labelledby":C,className:"z-50 rounded-xl bg-[var(--wui-color-bg)] shadow-xl border border-[var(--wui-color-border)] transition-[width] duration-200 ease-in-out",children:K.jsx("div",{className:"p-4",children:s==="main"?K.jsxs(K.Fragment,{children:[K.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[K.jsx("div",{className:"h-12 w-12 overflow-hidden",children:K.jsx(SE,{nfd:I.data,alt:`${x||e} avatar`,size:48})}),K.jsxs("div",{children:[K.jsx("h3",{id:C,className:"text-lg font-bold text-[var(--wui-color-text)] max-w-[220px] truncate wallet-custom-font",children:x||(e?_r(e,6,4):"My Wallet")}),x&&e&&K.jsx("p",{className:"text-sm text-[var(--wui-color-text-secondary)]",children:_r(e,6,4)})]})]}),oe,t&&t.accounts&&t.accounts.length>1&&K.jsx("div",{className:"mb-4",children:K.jsxs(MU,{value:e||"",onChange:_,children:[K.jsx(r6,{className:"block text-sm font-medium text-[var(--wui-color-text-secondary)] mb-1",children:"Select Account"}),K.jsxs("div",{className:"relative mt-1",children:[K.jsxs(V6,{className:"grid w-full cursor-default grid-cols-1 rounded-lg border border-[var(--wui-color-border)] bg-[var(--wui-color-bg-secondary)] py-2 px-3 text-left text-[var(--wui-color-text)] shadow-sm focus:outline-none focus:ring-2 focus:ring-[var(--wui-color-primary)] focus:border-transparent text-sm",children:[K.jsx("span",{className:"col-start-1 row-start-1 truncate pr-8",children:e?_r(e,6,4):"Select account"}),K.jsx("span",{className:"col-start-1 row-start-1 self-center justify-self-end",children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"text-[var(--wui-color-text-secondary)]","aria-hidden":"true",children:K.jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),K.jsx(O6,{transition:!0,className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-[var(--wui-color-bg-secondary)] py-1 shadow-lg ring-1 ring-black/5 focus:outline-none text-sm data-[closed]:data-[leave]:opacity-0 data-[leave]:transition data-[leave]:duration-100 data-[leave]:ease-in",children:t.accounts.map(ve=>K.jsxs(N6,{value:ve.address,className:"group relative cursor-default select-none py-2 pl-3 pr-9 text-[var(--wui-color-text)] data-[focus]:bg-[var(--wui-color-bg-hover)] data-[focus]:outline-none",children:[K.jsx("span",{className:"block truncate font-normal group-data-[selected]:font-medium",children:_r(ve.address,6,4)}),K.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-3 text-[var(--wui-color-primary)] group-[&:not([data-selected])]:hidden",children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"h-5 w-5","aria-hidden":"true",children:K.jsx("path",{d:"M13.3334 4L6.00008 11.3333L2.66675 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},ve.address))})]})]})}),K.jsx("div",{className:"border-t border-[var(--wui-color-border)] mt-2 mb-2"}),t&&K.jsxs("div",{className:"mb-2 flex justify-between",children:[K.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5",children:[K.jsx("div",{className:"h-5 w-5 overflow-hidden rounded flex items-center justify-center",children:t.metadata.icon?K.jsx("img",{src:t.metadata.icon,alt:`${t.metadata.name} icon`,className:"max-w-full max-h-full"}):K.jsx("div",{className:"h-5 w-5 rounded-full bg-[var(--wui-color-bg-tertiary)] flex items-center justify-center",children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3 w-3 text-[var(--wui-color-text-tertiary)]",viewBox:"0 0 20 20",fill:"currentColor",children:K.jsx("path",{fillRule:"evenodd",d:"M17 9c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v8c0 .55.45 1 1 1h4c.55 0 1-.45 1-1V9zm-1 0v8h-4V9h4zM8 4c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v13c0 .55.45 1 1 1h4c.55 0 1-.45 1-1V4zM3 3h4v14H3V3z",clipRule:"evenodd"})})})}),K.jsx("p",{className:"text-sm text-[var(--wui-color-text-secondary)]",children:t.metadata.name})]}),K.jsx("div",{children:t.metadata.isLiquid&&K.jsxs("button",{onClick:()=>a("manage"),className:"flex-1 py-2 px-4 bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text-secondary)] font-medium rounded-xl hover:brightness-90 transition-all text-sm flex items-center justify-center",title:"Manage Liquid Account",children:[K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:K.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),"Manage"]})})]}),K.jsx("div",{className:"border-t border-[var(--wui-color-border)] mb-3 mt-2"}),K.jsxs("div",{className:"flex gap-2",children:[K.jsx("button",{onClick:V,className:"flex-1 py-2 px-4 bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text-secondary)] font-medium rounded-xl hover:brightness-90 transition-all text-sm flex items-center justify-center",title:"Copy address",children:l?K.jsxs(K.Fragment,{children:[K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-green-500 mr-1.5",viewBox:"0 0 20 20",fill:"currentColor",children:K.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Copied"]}):K.jsxs(K.Fragment,{children:[K.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1.5",viewBox:"0 0 20 20",fill:"currentColor",children:[K.jsx("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),K.jsx("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"})]}),"Copy"]})}),K.jsx("button",{onClick:H,className:"flex-1 py-2 px-4 bg-[var(--wui-color-danger-bg)] text-[var(--wui-color-danger-text)] font-medium rounded-xl hover:bg-[var(--wui-color-danger-bg-hover)] transition-colors text-sm",children:"Disconnect"})]})]}):K.jsx(jP,{displayBalance:L,showAvailableBalance:m,onToggleBalance:ee,onBack:()=>a("main"),send:f,optIn:d})})})})})})]})}function j6(n){const{queryClient:e}=Oi();return K.jsx(xA,{client:e,children:K.jsx(PU,{...n})})}function $U({size:n,className:e,style:t}){const{activeAddress:r}=cr.useWallet();return r?K.jsx(j6,{children:K.jsx(Hg,{size:n,className:e,style:t})}):K.jsx(IF,{children:K.jsx(Df,{size:n,className:e,style:t})})}H6();exports.ConnectWalletButton=Df;exports.ConnectWalletMenu=IF;exports.ConnectedWalletButton=Hg;exports.ConnectedWalletMenu=j6;exports.NfdAvatar=SE;exports.WalletButton=$U;exports.WalletList=TF;exports.WalletUIProvider=TV;exports.useAccountInfo=L6;exports.useAfterSignDialog=MV;exports.useBeforeSignDialog=IV;exports.useNfd=wE;exports.useResolvedTheme=A2;exports.useWalletUI=Oi;exports.useWelcomeDialog=RV;
|
|
233
|
+
//# sourceMappingURL=index.cjs.map
|