@xoxno/sdk-js 1.0.229 → 1.0.231

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/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see index.cjs.LICENSE.txt */
2
- "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{var e={526(e,t){"use strict";t.byteLength=function(e){var t=s(e),r=t[0],o=t[1];return 3*(r+o)/4-o},t.toByteArray=function(e){var t,r,i=s(e),a=i[0],u=i[1],l=new n(function(e,t,r){return 3*(t+r)/4-r}(0,a,u)),d=0,p=u>0?a-4:a;for(r=0;r<p;r+=4)t=o[e.charCodeAt(r)]<<18|o[e.charCodeAt(r+1)]<<12|o[e.charCodeAt(r+2)]<<6|o[e.charCodeAt(r+3)],l[d++]=t>>16&255,l[d++]=t>>8&255,l[d++]=255&t;return 2===u&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,l[d++]=255&t),1===u&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,l[d++]=t>>8&255,l[d++]=255&t),l},t.fromByteArray=function(e){for(var t,o=e.length,n=o%3,i=[],a=16383,s=0,l=o-n;s<l;s+=a)i.push(u(e,s,s+a>l?l:s+a));return 1===n?(t=e[o-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[o-2]<<8)+e[o-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=i[a],o[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,o){for(var n,i,a=[],s=t;s<o;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(i=n)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},287(e,t,r){"use strict";const o=r(526),n=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=u,t.IS=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return p(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let o=s(r);const n=o.write(e,t);return n!==r&&(o=o.slice(0,n)),o}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const o=e.valueOf&&e.valueOf();if(null!=o&&o!==e)return u.from(o,t,r);const n=function(e){if(u.isBuffer(e)){const t=0|h(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?s(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function p(e){return d(e),s(e<0?0:0|h(e))}function c(e){const t=e.length<0?0:0|h(e.length),r=s(t);for(let o=0;o<t;o+=1)r[o]=255&e[o];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let o;return o=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(o,u.prototype),o}function h(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(n)return o?-1:V(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){let o=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return q(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function m(e,t,r){const o=e[t];e[t]=e[r],e[r]=o}function b(e,t,r,o,n){if(0===e.length)return-1;if("string"==typeof r?(o=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=u.from(t,o)),u.isBuffer(t))return 0===t.length?-1:S(e,t,r,o,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):S(e,[t],r,o,n);throw new TypeError("val must be string, number or Buffer")}function S(e,t,r,o,n){let i,a=1,s=e.length,u=t.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){let o=-1;for(i=r;i<s;i++)if(l(e,i)===l(t,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===u)return o*a}else-1!==o&&(i-=i-o),o=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){let r=!0;for(let o=0;o<u;o++)if(l(e,i+o)!==l(t,o)){r=!1;break}if(r)return i}return-1}function w(e,t,r,o){r=Number(r)||0;const n=e.length-r;o?(o=Number(o))>n&&(o=n):o=n;const i=t.length;let a;for(o>i/2&&(o=i/2),a=0;a<o;++a){const o=parseInt(t.substr(2*a,2),16);if(Z(o))return a;e[r+a]=o}return a}function v(e,t,r,o){return j(V(t,e.length-r),e,r,o)}function T(e,t,r,o){return j(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,o)}function A(e,t,r,o){return j(X(t),e,r,o)}function x(e,t,r,o){return j(function(e,t){let r,o,n;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(t,e.length-r),e,r,o)}function I(e,t,r){return 0===t&&r===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,r))}function E(e,t,r){r=Math.min(e.length,r);const o=[];let n=t;for(;n<r;){const t=e[n];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(n+a<=r){let r,o,s,u;switch(a){case 1:t<128&&(i=t);break;case 2:r=e[n+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(i=u));break;case 3:r=e[n+1],o=e[n+2],128==(192&r)&&128==(192&o)&&(u=(15&t)<<12|(63&r)<<6|63&o,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=e[n+1],o=e[n+2],s=e[n+3],128==(192&r)&&128==(192&o)&&128==(192&s)&&(u=(15&t)<<18|(63&r)<<12|(63&o)<<6|63&s,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=a}return function(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let r="",o=0;for(;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=R));return r}(o)}u.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return d(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},u.allocUnsafe=function(e){return p(e)},u.allocUnsafeSlow=function(e){return p(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(K(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,o=t.length;for(let n=0,i=Math.min(r,o);n<i;++n)if(e[n]!==t[n]){r=e[n],o=t[n];break}return r<o?-1:o<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const o=u.allocUnsafe(t);let n=0;for(r=0;r<e.length;++r){let t=e[r];if(K(t,Uint8Array))n+t.length>o.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(o,n)):Uint8Array.prototype.set.call(o,t,n);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(o,n)}n+=t.length}return o},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},u.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},u.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){let e="";const r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(e,t,r,o,n){if(K(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===o&&(o=0),void 0===n&&(n=this.length),t<0||r>e.length||o<0||n>this.length)throw new RangeError("out of range index");if(o>=n&&t>=r)return 0;if(o>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let i=(n>>>=0)-(o>>>=0),a=(r>>>=0)-(t>>>=0);const s=Math.min(i,a),l=this.slice(o,n),d=e.slice(t,r);for(let e=0;e<s;++e)if(l[e]!==d[e]){i=l[e],a=d[e];break}return i<a?-1:a<i?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},u.prototype.write=function(e,t,r,o){if(void 0===t)o="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)o=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===o&&(o="utf8")):(o=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let i=!1;for(;;)switch(o){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":case"latin1":case"binary":return T(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(e,t,r){let o="";r=Math.min(e.length,r);for(let n=t;n<r;++n)o+=String.fromCharCode(127&e[n]);return o}function k(e,t,r){let o="";r=Math.min(e.length,r);for(let n=t;n<r;++n)o+=String.fromCharCode(e[n]);return o}function q(e,t,r){const o=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);let n="";for(let o=t;o<r;++o)n+=Y[e[o]];return n}function B(e,t,r){const o=e.slice(t,r);let n="";for(let e=0;e<o.length-1;e+=2)n+=String.fromCharCode(o[e]+256*o[e+1]);return n}function _(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,r,o,n,i){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<i)throw new RangeError('"value" argument is out of bounds');if(r+o>e.length)throw new RangeError("Index out of range")}function U(e,t,r,o,n){F(t,o,n,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function M(e,t,r,o,n){F(t,o,n,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function C(e,t,r,o,n,i){if(r+o>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,o,i){return t=+t,r>>>=0,i||C(e,0,r,4),n.write(e,t,r,o,23,4),r+4}function D(e,t,r,o,i){return t=+t,r>>>=0,i||C(e,0,r,8),n.write(e,t,r,o,52,8),r+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const o=this.subarray(e,t);return Object.setPrototypeOf(o,u.prototype),o},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return o},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);let o=this[e+--t],n=1;for(;t>0&&(n*=256);)o+=this[e+--t]*n;return o},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(o)+(BigInt(n)<<BigInt(32))})),u.prototype.readBigUInt64BE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(o)<<BigInt(32))+BigInt(n)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*t)),o},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);let o=t,n=1,i=this[e+--o];for(;o>0&&(n*=256);)i+=this[e+--o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||_(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||_(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(o)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),u.prototype.readBigInt64BE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||_(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||_(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||_(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||_(e,8,this.length),n.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||O(this,e,t,r,Math.pow(2,8*r)-1,0);let n=1,i=0;for(this[t]=255&e;++i<r&&(n*=256);)this[t+i]=e/n&255;return t+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||O(this,e,t,r,Math.pow(2,8*r)-1,0);let n=r-1,i=1;for(this[t+n]=255&e;--n>=0&&(i*=256);)this[t+n]=e/i&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=Q((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Q((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);O(this,e,t,r,o-1,-o)}let n=0,i=1,a=0;for(this[t]=255&e;++n<r&&(i*=256);)e<0&&0===a&&0!==this[t+n-1]&&(a=1),this[t+n]=(e/i|0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);O(this,e,t,r,o-1,-o)}let n=r-1,i=1,a=0;for(this[t+n]=255&e;--n>=0&&(i*=256);)e<0&&0===a&&0!==this[t+n+1]&&(a=1),this[t+n]=(e/i|0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=Q((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Q((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,o){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),o||0===o||(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<r&&(o=r),o===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-r&&(o=e.length-t+r);const n=o-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,o):Uint8Array.prototype.set.call(e,this.subarray(r,o),t),n},u.prototype.fill=function(e,t,r,o){if("string"==typeof e){if("string"==typeof t?(o=t,t=0,r=this.length):"string"==typeof r&&(o=r,r=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===e.length){const t=e.charCodeAt(0);("utf8"===o&&t<128||"latin1"===o)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{const i=u.isBuffer(e)?e:u.from(e,o),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=i[n%a]}return this};const $={};function N(e,t,r){$[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function W(e){let t="",r=e.length;const o="-"===e[0]?1:0;for(;r>=o+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function F(e,t,r,o,n,i){if(e>r||e<t){const o="bigint"==typeof t?"n":"";let n;throw n=i>3?0===t||t===BigInt(0)?`>= 0${o} and < 2${o} ** ${8*(i+1)}${o}`:`>= -(2${o} ** ${8*(i+1)-1}${o}) and < 2 ** ${8*(i+1)-1}${o}`:`>= ${t}${o} and <= ${r}${o}`,new $.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(o,n,i)}function G(e,t){if("number"!=typeof e)throw new $.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new $.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}N("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),N("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),N("ERR_OUT_OF_RANGE",(function(e,t,r){let o=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=W(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=W(n)),n+="n"),o+=` It must be ${t}. Received ${n}`,o}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function V(e,t){let r;t=t||1/0;const o=e.length;let n=null;const i=[];for(let a=0;a<o;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===o){(t-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function X(e){return o.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,r,o){let n;for(n=0;n<o&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const o=16*r;for(let n=0;n<16;++n)t[o+n]=e[r]+e[n]}return t}();function Q(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,r,o,n){var i,a,s=8*n-o-1,u=(1<<s)-1,l=u>>1,d=-7,p=r?n-1:0,c=r?-1:1,f=e[t+p];for(p+=c,i=f&(1<<-d)-1,f>>=-d,d+=s;d>0;i=256*i+e[t+p],p+=c,d-=8);for(a=i&(1<<-d)-1,i>>=-d,d+=o;d>0;a=256*a+e[t+p],p+=c,d-=8);if(0===i)i=1-l;else{if(i===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,o),i-=l}return(f?-1:1)*a*Math.pow(2,i-o)},t.write=function(e,t,r,o,n,i){var a,s,u,l=8*i-n-1,d=(1<<l)-1,p=d>>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:i-1,h=o?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+p>=1?c/u:c*Math.pow(2,1-p))*u>=2&&(a++,u/=2),a+p>=d?(s=0,a=d):a+p>=1?(s=(t*u-1)*Math.pow(2,n),a+=p):(s=t*Math.pow(2,p-1)*Math.pow(2,n),a=0));n>=8;e[r+f]=255&s,f+=h,s/=256,n-=8);for(a=a<<n|s,l+=n;l>0;e[r+f]=255&a,f+=h,a/=256,l-=8);e[r+f-h]|=128*g}},999(e,t,r){"use strict";r.d(t,{BPS:()=>Xo,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>Rn,LIQUIDATION_BUFFER_BPS:()=>zn,RAY:()=>zo,RAY_DECIMALS:()=>jo,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>qt,STELLAR_LENDING_TOPICS:()=>jr,STELLAR_NETWORKS:()=>o,STELLAR_NETWORK_PASSPHRASE:()=>a,STELLAR_ROUTE_MAX_BYTES:()=>uo,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Zr,StellarAuthPolicyError:()=>To,StellarRouteVerificationError:()=>lo,WAD:()=>Vo,WAD_DECIMALS:()=>Ko,aggregateAccountRisk:()=>Gn,annualBorrowRateRay:()=>An,assertStellarAuthEntries:()=>qo,assertStellarPreparedTxAuth:()=>Lo,baseToRay:()=>cn,baseToShort:()=>mn,baseValueWad:()=>hn,buildLiveSnapshot:()=>On,buildSameTokenRepaySwapSteps:()=>Fo,buildStellarAcceptOwnershipTx:()=>ct,buildStellarAddRewardsTx:()=>Pt,buildStellarApproveBlendPoolTx:()=>mt,buildStellarBorrowBatchTx:()=>N,buildStellarBorrowTx:()=>W,buildStellarCctpForwardTx:()=>Ho,buildStellarClaimRevenueTx:()=>Rt,buildStellarCreateLiquidityPoolTx:()=>It,buildStellarExecuteCancellerResetTx:()=>xr,buildStellarExecuteStrategyTx:()=>mo,buildStellarFlashLoanTx:()=>j,buildStellarGovernanceAddSpokeImmediateTx:()=>Pr,buildStellarGovernanceCreateHubImmediateTx:()=>Rr,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>mr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Sr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>wr,buildStellarGovernanceExecuteTransferGovOwnTx:()=>vr,buildStellarGovernanceExecuteTx:()=>yr,buildStellarGovernanceExecuteUpdateDelayTx:()=>br,buildStellarGovernancePauseTx:()=>qr,buildStellarGovernanceRevokeRoleImmediateTx:()=>kr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>Er,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>Ir,buildStellarGrantRoleTx:()=>lt,buildStellarLendingIdentifier:()=>Yr,buildStellarLiquidateTx:()=>V,buildStellarMigrateFromBlendTx:()=>K,buildStellarMigrateTx:()=>at,buildStellarMultiplyTx:()=>Z,buildStellarPauseTx:()=>st,buildStellarProposeAddAssetToSpokeTx:()=>Vt,buildStellarProposeAddSpokeTx:()=>Ht,buildStellarProposeApproveBlendPoolTx:()=>er,buildStellarProposeApproveTokenTx:()=>Qt,buildStellarProposeCancellerResetTx:()=>Ar,buildStellarProposeConfigureAssetOracleTx:()=>lr,buildStellarProposeCreateHubTx:()=>Gt,buildStellarProposeCreateLiquidityPoolTx:()=>rr,buildStellarProposeDeployPoolTx:()=>nr,buildStellarProposeEditAssetInSpokeTx:()=>Xt,buildStellarProposeEditOracleToleranceTx:()=>dr,buildStellarProposeGovernanceUpgradeTx:()=>pr,buildStellarProposeGrantGovernanceRoleTx:()=>fr,buildStellarProposeMigrateControllerTx:()=>sr,buildStellarProposeRemoveAssetFromSpokeTx:()=>jt,buildStellarProposeRemoveSpokeTx:()=>zt,buildStellarProposeRevokeBlendPoolTx:()=>tr,buildStellarProposeRevokeGovernanceRoleTx:()=>hr,buildStellarProposeRevokeTokenTx:()=>Jt,buildStellarProposeSetAccumulatorTx:()=>Wt,buildStellarProposeSetMinBorrowCollatTx:()=>Yt,buildStellarProposeSetPositionLimitsTx:()=>Ft,buildStellarProposeSetPositionManagerTx:()=>Zt,buildStellarProposeSetPriceAggregatorTx:()=>Nt,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Kt,buildStellarProposeSetSwapAggregatorTx:()=>$t,buildStellarProposeTransferCtrlOwnershipTx:()=>ur,buildStellarProposeTransferGovOwnTx:()=>gr,buildStellarProposeUnpauseTx:()=>Br,buildStellarProposeUpdateDelayTx:()=>cr,buildStellarProposeUpgradeControllerTx:()=>ar,buildStellarProposeUpgradePoolParamsTx:()=>or,buildStellarProposeUpgradePoolTx:()=>ir,buildStellarRenewAccountTx:()=>xt,buildStellarRepayBatchTx:()=>H,buildStellarRepayDebtWithCollateralTx:()=>J,buildStellarRepayTx:()=>z,buildStellarRevokeBlendPoolTx:()=>bt,buildStellarRevokeRoleTx:()=>dt,buildStellarSetAccumulatorTx:()=>gt,buildStellarSetOracleSanityBoundsTx:()=>Tt,buildStellarSetOracleToleranceTx:()=>wt,buildStellarSetOracleTx:()=>St,buildStellarSetPositionLimitsTx:()=>yt,buildStellarSetPriceAggregatorTx:()=>ht,buildStellarSetSpokeAssetFlagsTx:()=>vt,buildStellarSetSwapAggregatorTx:()=>ft,buildStellarSupplyBatchTx:()=>D,buildStellarSupplyTx:()=>$,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>Y,buildStellarTransferOwnershipTx:()=>pt,buildStellarUnpauseTx:()=>ut,buildStellarUpdateAccountThresholdTx:()=>kt,buildStellarUpdateIndexesTx:()=>At,buildStellarUpgradeControllerTx:()=>it,buildStellarUpgradeLiquidityPoolParamsTx:()=>Et,buildStellarWithdrawBatchTx:()=>F,buildStellarWithdrawTx:()=>G,buildTx:()=>C,burnShares:()=>Dn,computeAccountRisk:()=>Hn,createStellarLendingReadClient:()=>Ve.createStellarLendingReadClient,decodeStellarLendingEvent:()=>Kr,decodeStellarLiquidateReturn:()=>X,decodeStellarRouteBytes:()=>co,decodeStellarSwapEnvelope:()=>vo,depositRateRay:()=>xn,divByIntHalfUp:()=>en,encodeAssetOracle:()=>nt,encodeInterestRateModel:()=>Xe,encodeMarketParamsRaw:()=>je,encodePositionLimits:()=>Ke,encodePriceKey:()=>Ze,encodeStrategyPayloadToRouteXdr:()=>yo,extractEventOrder:()=>Qr,getStellarAccountPositions:()=>he,getStellarActiveUsersSeries:()=>De,getStellarAggregatorQuote:()=>ro,getStellarAsset:()=>de,getStellarAssetGraph:()=>ve,getStellarAssetMarkets:()=>me,getStellarAssetPage:()=>ye,getStellarAssets:()=>ie,getStellarCampaignLeaderboard:()=>_e,getStellarCampaignMe:()=>He,getStellarDefiLlamaDimensions:()=>Ne,getStellarDeployment:()=>i,getStellarDetailedMarkets:()=>ne,getStellarFeeRevenueSeries:()=>Me,getStellarGovernanceProposals:()=>Re,getStellarHolderDistribution:()=>Be,getStellarHub:()=>pe,getStellarHubGraph:()=>Te,getStellarHubHolders:()=>Se,getStellarHubs:()=>ae,getStellarLendingContext:()=>re,getStellarLendingLiveState:()=>oe,getStellarLiquidationsLeaderboard:()=>qe,getStellarLiquidationsSeries:()=>Ce,getStellarParticipantCounts:()=>ke,getStellarPnlByScope:()=>Ge,getStellarPositionsLeaderboard:()=>Pe,getStellarPositionsPnl:()=>Fe,getStellarQuoteTokens:()=>oo,getStellarRateSpreadSeries:()=>$e,getStellarReserve:()=>le,getStellarReserveGraph:()=>xe,getStellarReserveHolders:()=>be,getStellarReserves:()=>ue,getStellarRevenueSeries:()=>Ue,getStellarSpoke:()=>ce,getStellarSpokeGraph:()=>Ae,getStellarSpokeHolders:()=>we,getStellarSpokes:()=>se,getStellarStatsHistory:()=>Oe,getStellarUserActivity:()=>Ie,getStellarUserActivityPage:()=>Ee,getStellarUserHistory:()=>We,getStellarUserPositions:()=>fe,getStellarVolumeSeries:()=>Le,getStellarWalletBalance:()=>ge,lendingAssetsSchema:()=>Ve.lendingAssetsSchema,lendingPositionsSchema:()=>Ve.lendingPositionsSchema,liveIndexKey:()=>_n,mapQuoteResponseToStrategyPayload:()=>bo,mapQuoteResponseToStrategySwap:()=>So,mapSorobanError:()=>di,mapStellarPositionActivityType:()=>eo,maxBorrow:()=>ei,maxRepay:()=>oi,maxSupply:()=>ri,maxWithdraw:()=>ti,mintShares:()=>Ln,mulDivCeil:()=>Qo,mulDivFloor:()=>Yo,mulDivHalfUp:()=>Jo,numberToScaled:()=>bn,numberToWad:()=>Sn,parseStellarTokenAmount:()=>M,positionValueWad:()=>fn,prepareStellarBuiltTx:()=>No,prepareStellarTxXdr:()=>$o,projectAccountRisk:()=>ai,projectReserveApy:()=>ui,rayAprToApy:()=>En,rayAprToNumber:()=>In,rayToNumber:()=>yn,rescaleCeil:()=>on,rescaleFloor:()=>rn,rescaleHalfUp:()=>nn,reserveKey:()=>Pn,resolveReserve:()=>kn,stellarAuthPolicyForInvocation:()=>Mo,stellarLendingDispatchKey:()=>Ur,stellarLendingRead:()=>ze,stellarNetworks:()=>n,stellarTokenContractId:()=>fo,syntheticEventOrder:()=>Jr,tagStellarInvokedContractError:()=>Do,toBase64Xdr:()=>_r,toBigInt:()=>Zo,toStellarPositionMode:()=>Wo,unscale:()=>un,unscaleBorrowCeil:()=>dn,unscaleHalfUp:()=>pn,unscaleSupplyFloor:()=>ln,utilizationRay:()=>Tn,valueBasePosition:()=>$n,valueScaledPosition:()=>Cn,verifyStellarRouteBytes:()=>go,wadToNumber:()=>gn});const o={stellarMainnet:{name:"mainnet",passphrase:"Public Global Stellar Network ; September 2015",horizonUrl:"https://horizon.stellar.org",sorobanRpcUrl:"https://stellar-gateway.xoxno.com",quoteUrl:"https://stellar-swap.xoxno.com",explorerNetwork:"public",aquariusApiUrl:"https://amm-api.aqua.network",aquariusRouter:"CBQDHNBFBZYE4MKPWBSJOPIYLW4SFSXAXUTSXJN76GNKYVYPCKWC6QUK",lendingController:"CAUCMIN5KSXEVZ7NMXR3LZATGD5EFIEUI5XWTFLYRO2R5OTXI22WE5JX",lendingPool:"CBXRNDQMAJFG4VUKMKFEMFS75UUXE2SPSNV4LEEFCSNBCN66PYRWBKXO",aggregatorRouter:"CCVENFSVCBYDHVOACFZXMNNYVOZ3LKXPZYU5LUI4N7KTXOKRVYD7F3TR",governance:"CC44PEQW7HSEPKAZ5ZRPH2JS5M5KVJXCUBLJ2ZX4E3WCDKMNFILHC2AD",priceAggregator:"CBGUF2G2Q7HCVCWYISDXBHPVBGMYNXA7PG2VET66YBZX6IKOOV27NSMV",positionNftContract:"CAWCSG77AY2W24QZ6ZXLHZU4UXEFHZBM6EI4A4IF7JB5CTY4XND3TI6C"},stellarTestnet:{name:"testnet",passphrase:"Test SDF Network ; September 2015",horizonUrl:"https://horizon-testnet.stellar.org",sorobanRpcUrl:"https://stellar-testnet-gateway.xoxno.com",quoteUrl:"https://testnet-stellar-swap.xoxno.com",explorerNetwork:"testnet",aquariusApiUrl:"https://amm-api-testnet.aqua.network",aquariusRouter:"CBCFTQSPDBAIZ6R6PJQKSQWKNKWH2QIV3I4J72SHWBIK3ADRRAM5A6GD",lendingController:"CCXRWJ6SIU2WPFEGLFGJVITPL57QAYIMIO6OAM2NBGNDQSSCK2FFV3F3",lendingPool:"CBSGF6QOQAMPFBEVSYPEQHSZRIHJ6RCGUPCRDMUX36DEKRWFAO2PZB5A",aggregatorRouter:"CDNTWMWW2WGYTKIZTJYNGNVQQZI4KTC5BQRZ3275KESRX5T4O3AYECL5",governance:"CDS33JDOYH3F3FL4QUQ6DV4WKHML2AKHF4LADTZ57FRUAEBTE7NMY5FQ",priceAggregator:"CAALOOTIDXCX7D7FMQIBSSAJLPKOM3GMXS4UUSTDIG42JCRRJHOPUHOP",positionNftContract:"CDVN5JU675MEDPVRPCYC45AHFC275UH57WEU5OTFE4WFGZBNN7HTLPSY"}},n=o;function i(e){return o["testnet"===e?"stellarTestnet":"stellarMainnet"]}const a={mainnet:o.stellarMainnet.passphrase,testnet:o.stellarTestnet.passphrase},s=require("@stellar/stellar-sdk");var u=r(287);const l=["Soroswap","Aquarius","Phoenix","Sushi","CometDex","Curve"],d={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4,Curve:7},p=1e6,c=e=>new s.Address(e).toScVal(),f=e=>new s.ScInt(e).toI128(),h=e=>s.xdr.ScVal.scvU32(e),g=e=>{if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("Stellar builder: u64 numbers must be safe integers; pass a decimal string for larger values");return new s.ScInt("string"==typeof e?e:e.toString()).toU64()},y=e=>s.xdr.ScVal.scvBool(e),m=e=>s.xdr.ScVal.scvString(e),b=e=>s.xdr.ScVal.scvSymbol(e),S=()=>s.xdr.ScVal.scvVoid(),w=e=>s.xdr.ScVal.scvVec(e),v=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=u.hp.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return s.xdr.ScVal.scvBytes(o)},T=(e,t)=>null==e?S():t(e),A=(e,t)=>R({asset:c(t),hub_id:h(e)}),x=(e,t,r)=>s.xdr.ScVal.scvVec([A(e,t),f(r)]),I=e=>s.xdr.ScVal.scvVec(e.map((e=>x(e.hubId,e.asset,e.amount)))),E=e=>{if("Transfer"===e)return w([b("Transfer")]);if(e&&"object"==typeof e&&"Credit"in e){const t=e.Credit;if("number"==typeof t&&!Number.isInteger(t))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${t}`);return w([b("Credit"),g(t)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(e)}`)},R=e=>{const t=Object.keys(e).sort().map((t=>new s.xdr.ScMapEntry({key:b(t),val:e[t]})));return s.xdr.ScVal.scvMap(t)};class P{assets=[];amounts=[];ops=[];weights=[];constructor(e){this.amounts.push(e)}asset(e){const t=this.assets.indexOf(e);if(-1!==t)return t;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(e),this.assets.length-1}amount(e){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(e),this.amounts.length-1}weight(e){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(e)||e<=0||e>p)throw new Error(`Stellar builder: split weight ${e} outside 1..=1000000`);return this.weights.push(e),this.weights.length-1}emit(e,t,r,o,n){this.ops.push([e,t,r,o,n])}emitPath(e,t){e.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=e.hops[o-1];if(n&&r.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(d[r.venue],0===o?t:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(e){const t=e.filter((e=>e.hops.length>0)),r=Array.from({length:t.length},(()=>!1));for(let e=0;e<t.length;e+=1){if(r[e])continue;const o=t[e].hops[0]?.tokenIn,n=[];for(let r=e;r<t.length;r+=1)t[r].hops[0]?.tokenIn===o&&n.push(r);const i=n.reduce(((e,r)=>e+t[r].splitPpm),0);if(i>p)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const a=i===p;let s=p;n.forEach(((e,o)=>{r[e]=!0;const i=t[e];let u;if(o+1===n.length&&a)u=0;else{if(0===s)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(i.splitPpm*p/s);s-=Math.min(i.splitPpm,s),u=128+this.weight(e)}this.emitPath(i,u)}))}}toBytes(e,t,r){if(0===this.ops.length)throw new Error("Stellar builder: strategy lowered to zero instructions");if(this.ops.length>48)throw new Error(`Stellar builder: strategy has ${this.ops.length} instructions, the router accepts 48`);const o=[1,e,t,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const e of this.ops)o.push(...e);for(const e of this.weights)o.push(e>>>16&255,e>>>8&255,255&e);return u.hp.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const k=e=>{const t=new P(e.totalMinOut),r=t.asset(e.tokenIn),o=t.asset(e.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(e.burnPool){const o=t.asset(e.burnPool),n=t.amountList.length;for(const r of e.burnMinAmounts??[])t.amount(r);t.emit(5,0,o,r,n)}if(t.lowerPaths(e.paths),e.mintPool){const r=e.preSwapAmount;if(r&&BigInt(r)>0n){const o=e.mintPoolTokens;if(!o||2!==o.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,i]=o,[a,s]=e.preSwapFromA?[n,i]:[i,n];t.emit(d.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(a),t.asset(s))}t.emit(6,0,t.asset(e.mintPool),o,t.amount(e.mintMinShares??"1"))}const n=Number(e.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${e.referralId} does not fit the wire’s u32`);return R({amounts:s.xdr.ScVal.scvVec(t.amountList.map((e=>f(e)))),assets:s.xdr.ScVal.scvVec(t.assetList.map((e=>c(e)))),ops:s.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},q=e=>{const t=u.hp.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return s.xdr.ScVal.scvBytes(t)},B=()=>s.xdr.ScVal.scvBytes(u.hp.alloc(0)),_=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return u.hp.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=u.hp.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},O=e=>{if("string"==typeof e)return q(_(e));if(e instanceof Uint8Array)return 0===e.length?B():q(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?q(_(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?q(_(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?q(_(e.bytes)):0===e.bytes.length?B():q(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length&&!t.burnPool&&!t.mintPool)throw new Error("Stellar builder: `steps.paths` needs a strategy path or a liquidity burn/mint operation");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const r=new Map;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!l.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const t=o.hops[0];r.set(t.tokenIn,(r.get(t.tokenIn)??0)+o.splitPpm)}for(const[e,o]of r){if(o>p)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==p)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),s.xdr.ScVal.scvBytes(u.hp.from(k(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},U=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=u.hp.from(t,"hex");return s.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return s.xdr.ScVal.scvBytes(u.hp.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function M(e,t){if("number"!=typeof t||!Number.isInteger(t)||t<0||t>18)throw new Error("Token decimals must be an integer from 0 to 18");if("string"!=typeof e||!/^\d+(?:\.\d+)?$/.test(e))throw new Error("Token amount must be plain decimal text");const r=s.Soroban.parseTokenAmount(e,t),o=BigInt(r);if(o<=0n||o>(1n<<127n)-1n)throw new Error("Token amount must be within the positive i128 range");return r}function C(e,t,r){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const o=new s.Contract(e.controllerAddress),n=new s.Account(e.caller,e.sourceSequence);return{xdr:new s.TransactionBuilder(n,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[e.network]}).addOperation(o.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function L(e){if(!Number.isInteger(e)||e<1||e>4294967295)throw new Error("Stellar builder: spokeId must be an integer from 1 to 4294967295");return h(e)}function D(e,t){const r=t.accountNonce??0;return C(e,"supply",[c(e.caller),g(r),L(t.spokeId),I([...t.assets])])}function $(e,t){return D(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function N(e,t){return C(e,"borrow",[c(e.caller),g(t.accountNonce),I([...t.borrows]),T(t.to,c)])}function W(e,t){return N(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function F(e,t){return C(e,"withdraw",[c(e.caller),g(t.accountNonce),I([...t.withdrawals]),T(t.to,c)])}function G(e,t){return F(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function H(e,t){return C(e,"repay",[c(e.caller),g(t.accountNonce),I([...t.payments])])}function z(e,t){return H(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function V(e,t){return C(e,"liquidate",[c(e.caller),g(t.accountNonce),I([...t.debtPayments]),E(t.seizeMode??"Transfer")])}function X(e){const t=(0,s.scValToNative)(s.xdr.ScVal.fromXDR(e,"base64"));if("bigint"==typeof t||"number"==typeof t)return t.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof t)}function j(e,t){return C(e,"flash_loan",[c(e.caller),A(t.hubId,t.asset),f(t.amount),c(t.receiver),U(t.data)])}function K(e,t){return C(e,"migrate_from_blend",[c(e.caller),g(t.accountId),L(t.spokeId),h(t.hubId),c(t.blendPool),w(t.collateralTokens.map(c)),w(t.supplyTokens.map(c)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),s.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,s.xdr.ScVal.scvVec([c(t),f(r)]);var t,r}))))]);var r}function Z(e,t){const r=t.accountNonce??0;return C(e,"multiply",[c(e.caller),g(r),L(t.spokeId),A(t.collateral.hubId,t.collateral.asset),f(t.debtToFlashLoan),A(t.debt.hubId,t.debt.asset),h(t.mode),O(t.steps),T(t.initialPayment,(e=>x(e.hubId,e.asset,e.amount))),T(t.convertSwap,O)])}function Y(e,t){return C(e,"swap_debt",[c(e.caller),g(t.accountNonce),A(t.existingDebt.hubId,t.existingDebt.asset),f(t.newDebtAmount),A(t.newDebt.hubId,t.newDebt.asset),O(t.steps)])}function Q(e,t){return C(e,"swap_collateral",[c(e.caller),g(t.accountNonce),A(t.current.hubId,t.current.asset),f(t.fromAmount),A(t.newCollateral.hubId,t.newCollateral.asset),O(t.steps)])}function J(e,t){return C(e,"repay_debt_with_collateral",[c(e.caller),g(t.accountNonce),A(t.collateral.hubId,t.collateral.asset),f(t.collateralAmount),A(t.debt.hubId,t.debt.asset),O(t.steps),y(t.closePosition)])}const ee="/stellar-lending",te=encodeURIComponent,re=(e,t)=>e.fetchWithTimeout(`${ee}/context`,t),oe=(e,t)=>e.fetchWithTimeout(`${ee}/live-state`,t),ne=(e,t)=>e.fetchWithTimeout(`${ee}/markets/detailed`,t),ie=(e,t)=>e.fetchWithTimeout(`${ee}/assets`,t),ae=(e,t)=>e.fetchWithTimeout(`${ee}/hubs`,t),se=(e,t)=>e.fetchWithTimeout(`${ee}/spokes`,t),ue=(e,t={},r)=>e.fetchWithTimeout(`${ee}/reserves`,{...r,params:{...t}}),le=(e,t,r,o,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${te(o)}`,n),de=(e,t,r)=>e.fetchWithTimeout(`${ee}/assets/${te(t)}`,r),pe=(e,t,r)=>e.fetchWithTimeout(`${ee}/hubs/${t}`,r),ce=(e,t,r)=>e.fetchWithTimeout(`${ee}/spokes/${t}`,r),fe=(e,t,r)=>e.fetchWithTimeout(`${ee}/users/${te(t)}/positions`,r),he=(e,t,r)=>e.fetchWithTimeout(`${ee}/accounts/${te(t)}/positions`,r),ge=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/users/${te(t)}/assets/${te(r)}/balance`,o),ye=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${te(t)}/page`,{...o,params:{...r}}),me=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${te(t)}/markets`,{...o,params:{side:r}}),be=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${te(o)}/holders`,{...i,params:{side:n}}),Se=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/hubs/${t}/holders`,{...o,params:{side:r}}),we=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/spokes/${t}/holders`,{...o,params:{side:r}}),ve=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${te(t)}/graph`,{...o,params:{...r}}),Te=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/hubs/${t}/graph`,{...o,params:{...r}}),Ae=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/spokes/${t}/graph`,{...o,params:{...r}}),xe=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${te(o)}/graph`,{...i,params:{...n}}),Ie=(e,t,r={},o)=>e.fetchWithTimeout(`${ee}/users/${te(t)}/activity`,{...o,params:{...r}}),Ee=(e,t,r={},o)=>e.fetchWithTimeout(`${ee}/users/${te(t)}/activity/page`,{...o,params:{...r}}),Re=(e,t={},r)=>e.fetchWithTimeout(`${ee}/governance/proposals`,{...r,params:{...t}}),Pe=(e,t={},r)=>e.fetchWithTimeout(`${ee}/positions`,{...r,params:{...t}}),ke=(e,t={},r)=>e.fetchWithTimeout(`${ee}/participants`,{...r,params:{...t}}),qe=(e,t={},r)=>e.fetchWithTimeout(`${ee}/liquidations/leaderboard`,{...r,params:{...t}}),Be=(e,t={},r)=>e.fetchWithTimeout(`${ee}/distribution`,{...r,params:{...t}}),_e=(e,t={},r)=>e.fetchWithTimeout(`${ee}/campaign/leaderboard`,{...r,params:{...t}}),Oe=(e,t,r)=>e.fetchWithTimeout(`${ee}/stats/history`,{...r,params:{...t}}),Ue=(e,t,r)=>e.fetchWithTimeout(`${ee}/revenue`,{...r,params:{...t}}),Me=(e,t,r)=>e.fetchWithTimeout(`${ee}/revenue/fees`,{...r,params:{...t}}),Ce=(e,t,r)=>e.fetchWithTimeout(`${ee}/liquidations`,{...r,params:{...t}}),Le=(e,t,r)=>e.fetchWithTimeout(`${ee}/volume`,{...r,params:{...t}}),De=(e,t,r)=>e.fetchWithTimeout(`${ee}/active-users`,{...r,params:{...t}}),$e=(e,t,r)=>e.fetchWithTimeout(`${ee}/rate-spread`,{...r,params:{...t}}),Ne=(e,t,r)=>e.fetchWithTimeout(`${ee}/defillama`,{...r,params:{...t}}),We=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/users/${te(t)}/history`,{...o,params:{...r}}),Fe=(e,t,r)=>e.fetchWithTimeout(`${ee}/pnl`,{...r,params:{accountId:t}}),Ge=(e,t,r)=>e.fetchWithTimeout(`${ee}/pnl/scope`,{...r,params:{scope:t}}),He=(e,t,r)=>e.fetchWithTimeout(`${ee}/campaign/me`,{...r,params:{owner:t}}),ze=e=>({context:t=>re(e,t),liveState:t=>oe(e,t),marketsDetailed:t=>ne(e,t),assets:t=>ie(e,t),hubs:t=>ae(e,t),spokes:t=>se(e,t),reserves:(t={},r)=>void 0!==r||"hubId"in t||"spokeId"in t||"asset"in t?ue(e,t,r):ue(e,{},t),reserve:(t,r,o,n)=>le(e,t,r,o,n),asset:(t,r)=>de(e,t,r),hub:(t,r)=>pe(e,t,r),spoke:(t,r)=>ce(e,t,r),userPositions:(t,r)=>fe(e,t,r),accountPositions:(t,r)=>he(e,t,r),walletBalance:(t,r,o)=>ge(e,t,r,o),assetPage:(t,r,o)=>ye(e,t,r,o),assetMarkets:(t,r,o)=>me(e,t,r,o),reserveHolders:(t,r,o,n,i)=>be(e,t,r,o,n,i),hubHolders:(t,r,o)=>Se(e,t,r,o),spokeHolders:(t,r,o)=>we(e,t,r,o),assetGraph:(t,r,o)=>ve(e,t,r,o),hubGraph:(t,r,o)=>Te(e,t,r,o),spokeGraph:(t,r,o)=>Ae(e,t,r,o),reserveGraph:(t,r,o,n,i)=>xe(e,t,r,o,n,i),userActivity:(t,r={},o)=>Ie(e,t,r,o),userActivityPage:(t,r={},o)=>Ee(e,t,r,o),governanceProposals:(t={},r)=>Re(e,t,r),positionsLeaderboard:(t={},r)=>Pe(e,t,r),participants:(t={},r)=>ke(e,t,r),liquidationsLeaderboard:(t={},r)=>qe(e,t,r),distribution:(t={},r)=>Be(e,t,r),campaignLeaderboard:(t={},r)=>_e(e,t,r),statsHistory:(t,r)=>Oe(e,t,r),revenue:(t,r)=>Ue(e,t,r),feeRevenue:(t,r)=>Me(e,t,r),liquidations:(t,r)=>Ce(e,t,r),volume:(t,r)=>Le(e,t,r),activeUsers:(t,r)=>De(e,t,r),rateSpread:(t,r)=>$e(e,t,r),defillama:(t,r)=>Ne(e,t,r),userHistory:(t,r,o)=>We(e,t,r,o),positionsPnl:(t,r)=>Fe(e,t,r),pnlByScope:(t,r)=>Ge(e,t,r),campaignMe:(t,r)=>He(e,t,r)});var Ve=r(468);const Xe=e=>R({base_borrow_rate:f(e.baseBorrowRateRay),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),je=e=>R({asset_decimals:h(e.assetDecimals),asset_id:c(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:y(e.isFlashloanable),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),Ke=e=>R({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),Ze=e=>{if("Token"in e&&e.Token)return w([b("Token"),c(e.Token)]);if("Ref"in e&&e.Ref)return w([b("Ref"),b(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},Ye=e=>{if("Stellar"in e)return w([b("Stellar"),c(e.Stellar)]);if("Symbol"in e)return w([b("Symbol"),b(e.Symbol)]);if("String"in e)return w([b("String"),m(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},Qe=e=>{if("Spot"===e)return w([b("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return w([b("Twap"),h(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},Je=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},et=e=>{if("Market"===e||"Fundamental"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},tt=e=>{if("Reflector"in e){const t=e.Reflector;return w([b("Reflector"),R({asset:Ye(t.asset),contract:c(t.contract),read_mode:Qe(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return w([b("MultiFeed"),R({contract:c(t.contract),feed_id:m(t.feedId),kind:Je(t.kind),nature:et(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},rt=e=>{const t=e;return R({decimals:h(t.decimals),max_stale_seconds:g(t.maxStaleSeconds),provider:tt(t.provider)})},ot=e=>{if("RequireDisjoint"===e)return w([b("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return w([b("AllowShared"),w(t.map((e=>R({contract:c(e.contract),kind:Je(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},nt=e=>{const t=e,r=t.sources??[];let o,n;if("number"==typeof t.toleranceBps)o=1e4+t.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const e=t.tolerance??{};o=Number(e.upperRatioBps),n=Number(e.lowerRatioBps)}return R({asset_decimals:h(Number(t.assetDecimals)),independence:ot(t.independence),max_price_stale_seconds:g(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:f(String(t.maxSanityPriceWad)),min_sanity_price_wad:f(String(t.minSanityPriceWad)),sources:w(r.map((e=>(e=>{if("Feed"in e)return w([b("Feed"),rt(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return w([b("Scaled"),R({factor:rt(t.factor),max_factor_wad:f(t.maxFactorWad),min_factor_wad:f(t.minFactorWad),quote:Ze(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return w([b("LpShare"),R({key_a:Ze(t.keyA),key_b:Ze(t.keyB),kind:w([b(t.kind||"ConstantProduct")]),pool:c(t.pool),reserve_a_decimals:h(t.reserveADecimals),reserve_b_decimals:h(t.reserveBDecimals),share_decimals:h(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:R({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})})};function it(e,t){return C(e,"upgrade",[v(t.wasmHash)])}function at(e,t){return C(e,"migrate",[h(t.newVersion)])}function st(e){return C(e,"pause",[])}function ut(e){return C(e,"unpause",[])}function lt(e,t){return C(e,"grant_role",[c(t.account),b(t.role)])}function dt(e,t){return C(e,"revoke_role",[c(t.account),b(t.role)])}function pt(e,t){return C(e,"transfer_ownership",[c(t.newOwner),h(t.liveUntilLedger)])}function ct(e){return C(e,"accept_ownership",[])}function ft(e,t){return C(e,"set_swap_aggregator",[c(t.aggregator)])}function ht(e,t){return C(e,"set_price_aggregator",[c(t.aggregator)])}function gt(e,t){return C(e,"set_accumulator",[c(t.accumulator)])}function yt(e,t){return C(e,"set_position_limits",[Ke(t)])}function mt(e,t){return C(e,"approve_blend_pool",[c(t.pool)])}function bt(e,t){return C(e,"revoke_blend_pool",[c(t.pool)])}function St(e,t){return C(e,"set_oracle",[Ze(t.key),nt(t.oracle)])}function wt(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return C(e,"set_tolerance",[Ze(t.key),R({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})])}function vt(e,t){return C(e,"set_spoke_asset_flags",[h(t.spokeId),A(t.hubId,t.asset),y(t.paused),y(t.frozen),y(t.noSeize)])}function Tt(e,t){return C(e,"set_oracle_sanity_bounds",[c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function At(e,t){return C(e,"update_indexes",[c(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function xt(e,t){return C(e,"renew_account",[c(e.caller),g(t.accountNonce)])}function It(e,t){return C(e,"create_liquidity_pool",[h(t.hubId),c(t.asset),je(t.params)])}function Et(e,t){return C(e,"upgrade_liquidity_pool_params",[A(t.hubId,t.asset),Xe(t.params)])}function Rt(e,t){return C(e,"claim_revenue",[c(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function Pt(e,t){return C(e,"add_rewards",[c(e.caller),I(t.rewards)])}function kt(e,t){return C(e,"update_account_threshold",[c(e.caller),y(t.hasRisks),w(t.accountNonces.map((e=>g(e))))])}const qt="00".repeat(32),Bt=e=>{if("string"==typeof e)return v(e);const t=u.hp.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return s.xdr.ScVal.scvBytes(t)},_t=(e,...t)=>w([b(e),...t]),Ot=e=>R({new_owner:c(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),Ut=e=>R({asset:c(e.asset),bonus:h(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:y(e.canBorrow),can_collateral:y(e.canCollateral),frozen:y(e.frozen),hub_id:h(e.hubId),paused:y(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),no_seize:y(e.noSeize),spoke_id:h(e.spokeId),supply_cap:f(e.supplyCap),threshold:h(e.threshold)}),Mt=e=>R({account:c(e.account),role:b(e.role)});function Ct(e,t,r){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const o=new s.Contract(e.governanceAddress),n=new s.Account(e.caller,e.sourceSequence);return{xdr:new s.TransactionBuilder(n,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[e.network]}).addOperation(o.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Lt=(e,t,r)=>Ct(e,"propose",[c(e.caller),t,Bt(r)]),Dt=(e,t,r)=>Ct(e,"execute_self",[S(),t,Bt(r)]);function $t(e,t,r){return Lt(e,_t("SetSwapAggregator",c(t.aggregator)),r)}function Nt(e,t,r){return Lt(e,_t("SetPriceAggregator",c(t.aggregator)),r)}function Wt(e,t,r){return Lt(e,_t("SetAccumulator",c(t.accumulator)),r)}function Ft(e,t,r){return Lt(e,_t("SetPositionLimits",Ke(t)),r)}function Gt(e,t){return Lt(e,_t("CreateHub"),t)}function Ht(e,t){return Lt(e,_t("AddSpoke"),t)}function zt(e,t,r){return Lt(e,_t("RemoveSpoke",h(t.spokeId)),r)}function Vt(e,t,r){return Lt(e,_t("AddAssetToSpoke",Ut(t)),r)}function Xt(e,t,r){return Lt(e,_t("EditAssetInSpoke",Ut(t)),r)}function jt(e,t,r){return Lt(e,_t("RemoveAssetFromSpoke",R({hub_asset:A((o=t).hubId,o.asset),spoke_id:h(o.spokeId)})),r);var o}function Kt(e,t,r){return Lt(e,_t("SetSpokeLiquidationCurve",R({hf_for_max_bonus_wad:f((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:h(o.liquidationBonusFactorBps),spoke_id:h(o.spokeId),target_hf_wad:f(o.targetHfWad)})),r);var o}function Zt(e,t,r){return Lt(e,_t("SetPositionManager",c(t.manager),y(t.isActive)),r)}function Yt(e,t,r){return Lt(e,_t("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function Qt(e,t,r){return Lt(e,_t("ApproveToken",c(t.token)),r)}function Jt(e,t,r){return Lt(e,_t("RevokeToken",c(t.token)),r)}function er(e,t,r){return Lt(e,_t("ApproveBlendPool",c(t.pool)),r)}function tr(e,t,r){return Lt(e,_t("RevokeBlendPool",c(t.pool)),r)}function rr(e,t,r){return Lt(e,_t("CreateLiquidityPool",R({asset:c((o=t).asset),hub_id:h(o.hubId),params:je(o.params)})),r);var o}function or(e,t,r){return Lt(e,_t("UpgradeLiquidityPoolParams",R({hub_asset:A((o=t).hubId,o.asset),params:Xe(o.params)})),r);var o}function nr(e,t,r){return Lt(e,_t("DeployPool",v(t.wasmHash)),r)}function ir(e,t,r){return Lt(e,_t("UpgradePool",v(t.wasmHash)),r)}function ar(e,t,r){return Lt(e,_t("UpgradeController",v(t.wasmHash)),r)}function sr(e,t,r){return Lt(e,_t("MigrateController",h(t.newVersion)),r)}function ur(e,t,r){return Lt(e,_t("TransferCtrlOwnership",Ot(t)),r)}function lr(e,t,r){return Lt(e,_t("ConfigureAssetOracle",R({key:Ze((o=t).key),oracle:nt(o.oracle)})),r);var o}function dr(e,t,r){return Lt(e,_t("EditOracleTolerance",R({key:Ze((o=t).key),tolerance:h(o.tolerance)})),r);var o}function pr(e,t,r){return Lt(e,_t("UpgradeGov",v(t.wasmHash)),r)}function cr(e,t,r){return Lt(e,_t("UpdateGovDelay",h(t.newDelay)),r)}function fr(e,t,r){return Lt(e,_t("GrantGovRole",Mt(t)),r)}function hr(e,t,r){return Lt(e,_t("RevokeGovRole",Mt(t)),r)}function gr(e,t,r){return Lt(e,_t("TransferGovOwnership",Ot(t)),r)}function yr(e,t){const r=w(t.argsXdr.map((e=>s.xdr.ScVal.fromXDR(e,"base64")))),o=Bt(t.predecessor??qt);return Ct(e,"execute",[S(),c(t.target),b(t.functionName),r,o,Bt(t.salt)])}function mr(e,t,r){return Dt(e,_t("UpgradeGov",v(t.wasmHash)),r)}function br(e,t,r){return Dt(e,_t("UpdateGovDelay",h(t.newDelay)),r)}function Sr(e,t,r){return Dt(e,_t("GrantGovRole",Mt(t)),r)}function wr(e,t,r){return Dt(e,_t("RevokeGovRole",Mt(t)),r)}function vr(e,t,r){return Dt(e,_t("TransferGovOwnership",Ot(t)),r)}const Tr=e=>w(e.map(c));function Ar(e,t,r){return Ct(e,"propose_canceller_reset",[Tr(t.newCancellers),Bt(r)])}function xr(e,t,r){return Ct(e,"execute_canceller_reset",[T(t.executor,c),Tr(t.newCancellers),Bt(r)])}function Ir(e,t){return Ct(e,"set_spoke_asset_flags",[c(e.caller),h(t.spokeId),A(t.hubId,t.asset),y(t.paused),y(t.frozen),y(t.noSeize)])}function Er(e,t){return Ct(e,"set_oracle_sanity_bounds",[c(e.caller),c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Rr(e){return Ct(e,"create_hub",[c(e.caller)])}function Pr(e){return Ct(e,"add_spoke",[c(e.caller)])}function kr(e,t){return Ct(e,"revoke_role_immediate",[c(t.account),b(t.role)])}function qr(e){return Ct(e,"pause",[c(e.caller)])}function Br(e,t){return Lt(e,_t("Unpause"),t)}const _r=e=>e.toXDR("base64"),Or=e=>s.xdr.ScVal.fromXDR(e,"base64"),Ur=e=>e.map((e=>String((0,s.scValToNative)(Or(e))))).join(":"),Mr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Cr=e=>Number(e),Lr=e=>String(e),Dr=e=>e instanceof Uint8Array?u.hp.from(e).toString("hex"):u.hp.isBuffer(e)?e.toString("hex"):String(e),$r=["None","Multiply","Long","Short"],Nr=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net","liq_credit"],Wr=e=>Array.isArray(e)?e:[],Fr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],Nr[Cr(o)]??Mr(o)),positionType:t,hubId:Cr(e[1]),asset:Lr(e[2]),scaledAmountRay:Mr(e[3]),indexRay:Mr(e[4]),amount:Mr(e[5]),liquidationThresholdBps:r?void 0:Cr(e[6]),liquidationBonusBps:r?void 0:Cr(e[7]),loanToValueBps:r?void 0:Cr(e[8]),liquidationFeesBps:r?void 0:Cr(e[9])};var o},Gr=e=>{return{owner:Lr(e[0]),spokeId:Cr(e[1]),mode:(t=e[2],$r[Cr(t)]??"None")};var t},Hr=e=>Array.isArray(e)?e[1]:void 0,zr=e=>{const t=(r=e,Array.isArray(r)?Lr(r[0]):Lr(r));var r;if("Token"===t)return{Token:Lr(Hr(e))};if("Ref"===t)return{Ref:Lr(Hr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Lr(t.Token)};if(void 0!==t.Ref)return{Ref:Lr(t.Ref)}}return{Token:Lr(e)}},Vr=e=>{const t=e.tolerance??{};return{assetDecimals:Cr(e.asset_decimals),maxPriceStaleSeconds:Cr(e.max_price_stale_seconds),sources:Wr(e.sources).map((e=>e)),tolerance:{upperRatio:Cr(t.upper_ratio_bps),lowerRatio:Cr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:Mr(e.min_sanity_price_wad),maxSanityPriceWad:Mr(e.max_sanity_price_wad)}},Xr={"market:create":e=>({topic:"market:create",data:{hubId:Cr(e.hub_id),baseAsset:Lr(e.base_asset),maxBorrowRate:Mr(e.max_borrow_rate),baseBorrowRate:Mr(e.base_borrow_rate),slope1:Mr(e.slope1),slope2:Mr(e.slope2),slope3:Mr(e.slope3),midUtilization:Mr(e.mid_utilization),optimalUtilization:Mr(e.optimal_utilization),maxUtilization:Mr(e.max_utilization),reserveFactor:Cr(e.reserve_factor),marketAddress:Lr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Lr(e.asset),maxBorrowRateRay:Mr(e.max_borrow_rate),baseBorrowRateRay:Mr(e.base_borrow_rate),slope1Ray:Mr(e.slope1),slope2Ray:Mr(e.slope2),slope3Ray:Mr(e.slope3),midUtilizationRay:Mr(e.mid_utilization),optimalUtilizationRay:Mr(e.optimal_utilization),maxUtilizationRay:Mr(e.max_utilization),reserveFactorBps:Cr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Wr(e).map((e=>{return t=Wr(e),{hubId:Cr(t[0]),asset:Lr(t[1]),timestamp:Cr(t[2]),supplyIndexRay:Mr(t[3]),borrowIndexRay:Mr(t[4]),cash:Mr(t[5]),suppliedRay:Mr(t[6]),borrowedRay:Mr(t[7]),revenueRay:Mr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Wr(e).map((e=>{const t=e;return{hubId:Cr(t.hub_id),asset:Lr(t.asset),params:(r=t.params,{maxBorrowRateRay:Mr(r.max_borrow_rate),baseBorrowRateRay:Mr(r.base_borrow_rate),slope1Ray:Mr(r.slope1),slope2Ray:Mr(r.slope2),slope3Ray:Mr(r.slope3),midUtilizationRay:Mr(r.mid_utilization),optimalUtilizationRay:Mr(r.optimal_utilization),maxUtilizationRay:Mr(r.max_utilization),reserveFactorBps:Cr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Cr(r.flashloan_fee),assetId:Lr(r.asset_id),assetDecimals:Cr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Wr(e);return{topic:"position:batch_update",data:{accountId:Mr(t[0]),accountAttributes:Gr(Wr(t[1])),updates:[...Wr(t[2]).map((e=>Fr(Wr(e),"Deposit"))),...Wr(t[3]).map((e=>Fr(Wr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Cr(e.hub_id),asset:Lr(e.asset),receiver:Lr(e.receiver),caller:Lr(e.caller),amount:Mr(e.amount),fee:Mr(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:zr(e.key),oracle:Vr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Lr(e.asset),oracle:Vr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Lr(e.liquidator),accountId:Mr(e.account_id),repaidUsdWad:Mr(e.repaid_usd_wad),bonusBps:Mr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Mr(e.account_id),totalBorrowUsdWad:Mr(e.total_borrow_usd_wad),totalCollateralUsdWad:Mr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Lr(e.token),amount:Mr(e.amount),usdValueWad:Mr(e.usd_value_wad),accountId:Mr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Cr(e.hub_id),asset:Lr(e.asset),amount:Mr(e.amount),fee:Mr(e.fee),amountSent:Mr(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Lr(e.pool??e.blend_pool??e.token),approved:Boolean(e.approved??e.is_approved??!0)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:Dr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Lr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Lr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Lr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Lr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:Dr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Cr(e.max_supply_positions),maxBorrowPositions:Cr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Mr(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Lr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Cr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Mr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Mr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Cr(t.liquidation_bonus_factor_bps)}}}},jr=Object.freeze(Object.keys(Xr));function Kr(e,t){const r=Ur(e),o=Xr[r];return o?o((0,s.scValToNative)(Or(t))):null}const Zr=1e4;function Yr(e,t){return`${e}-${BigInt(t).toString(10)}`}function Qr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Jr(e,t=0){return e*Zr+t}function eo(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const to=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()};async function ro(e,t){if(!t.baseUrl)throw new Error("Stellar quote baseUrl is required");if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=to(t.baseUrl,"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,simulate:e.simulate,referralId:e.referralId,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function oo(e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");const t=to(e.baseUrl,"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}function no(e,t){const r=e[t];return"function"==typeof r?r.call(e):r}function io(e){if(!e||"object"!=typeof e)return;const t=e;return"function"==typeof t.switch?t.switch().name:t.type}function ao(e){return so(no(e,"bytes"))}function so(e){const t=e;return u.hp.from("value"in t?t.value:t)}const uo=16384;class lo extends Error{code;constructor(e,t){super(`Stellar route verification failed [${e}]: ${t}`),this.name="StellarRouteVerificationError",this.code=e}}const po=(e,t)=>{throw new lo(e,t)};function co(e){const t=(e=>{const t="string"==typeof e?e:e&&"object"==typeof e&&"routeXdr"in e?e.routeXdr:void 0;if("string"==typeof t&&t.length>2*uo)return po("OVERSIZED",`encoded route has ${t.length} characters`);try{return ao(O(e))}catch(e){return po("MALFORMED",e instanceof Error?e.message:String(e))}})(e);0===t.length&&po("MALFORMED","route is empty"),t.length>uo&&po("OVERSIZED",`route has ${t.length} bytes, above ${uo}`);const r=(e=>{let t;try{t=s.xdr.ScVal.fromXDR(e)}catch(e){return po("MALFORMED",`payload is not one XDR ScVal: ${e instanceof Error?e.message:String(e)}`)}if("scvMap"!==io(t))return po("MALFORMED","payload must be a StrategyPayload map");const r=no(t,"map")??[];if("amounts,assets,ops"!==r.map((e=>"scvSymbol"===io(no(e,"key"))?no(no(e,"key"),"sym").toString():"")).join(","))return po("MALFORMED","payload fields must be exactly amounts, assets, ops");const[o,n,i]=r.map((e=>no(e,"val")));return"scvVec"!==io(o)||"scvVec"!==io(n)||"scvBytes"!==io(i)?po("MALFORMED","payload field has the wrong type"):{amounts:no(o,"vec")??[],assets:no(n,"vec")??[],ops:ao(i)}})(t),o=r.assets.length,n=r.amounts.length;0===o&&po("MALFORMED","asset registry is empty"),(o>256||n>126)&&po("OVERSIZED",`registries hold ${o} assets and ${n} amounts`);const i=r.assets.map(((e,t)=>"scvAddress"!==io(e)?po("MALFORMED",`assets[${t}] is not an address`):s.Address.fromScAddress(no(e,"address")).toString())),a=r.amounts.map(((e,t)=>"scvI128"!==io(e)?po("MALFORMED",`amounts[${t}] is not an i128`):(0,s.scValToBigInt)(e))),u=r.ops;u.length<10&&po("MALFORMED","program header is truncated"),u.length>346&&po("OVERSIZED",`program has ${u.length} bytes, above 346`);const c=e=>{const t=u[e];return void 0===t?po("MALFORMED",`program byte ${e} is missing`):t},f=c(0);1!==f&&po("UNSUPPORTED_VERSION",`program version ${f}, expected 1`);const h=c(8),g=c(9);0===h&&po("INVALID_STRUCTURE","program has no instructions"),(h>48||g>32)&&po("OVERSIZED",`program declares ${h} instructions and ${g} weights`);const y=10+5*h;u.length!==y+3*g&&po("MALFORMED","program length does not match its instruction and weight counts");const m=c(1),b=c(2),S=c(3);(m>=o||b>=o||S>=n)&&po("MALFORMED","header index is outside its registry"),m===b&&po("INVALID_STRUCTURE","token_in equals token_out");const w=u.readUInt32BE(4),v=[];for(let e=0;e<g;e+=1){const t=u.readUIntBE(y+3*e,3);(0===t||t>p)&&po("INVALID_STRUCTURE",`split weight ${t} outside 1..=1000000`),v.push(t)}const T=e=>i[e]??po("MALFORMED",`asset index ${e} is outside the registry`),A=e=>a[e]??po("MALFORMED",`amount index ${e} is outside the registry`),x=[];let I;for(let e=0;e<h;e+=1){const t=10+5*e,r=c(t),o=c(t+1),i=c(t+2),a=c(t+3),s=c(t+4),u=l.find((e=>d[e]===r));let p;if(u||5===r||6===r||po("UNKNOWN_OPCODE",`instruction ${e} has opcode ${r}`),0===o)p={kind:"all"};else if(1===o)void 0!==I&&I===a||po("INVALID_STRUCTURE",`instruction ${e} does not chain onto its predecessor`),p={kind:"prev"};else if(o>=128){const t=v[o-128];void 0===t&&po("MALFORMED",`instruction ${e} weight index is out of range`),p={kind:"ppm",ppm:t}}else p={kind:"fixed",amount:A(o-2)};const f=T(i);5!==r&&6!==r?(a===s&&po("INVALID_STRUCTURE",`instruction ${e} swaps a token for itself`),x.push({kind:"swap",venue:u,mode:p,pool:f,tokenIn:T(a),tokenOut:T(s)}),I=s):("all"!==p.kind&&po("MALFORMED",`liquidity instruction ${e} must use mode All`),s>=n&&po("MALFORMED",`instruction ${e} amount index is out of range`),x.push({kind:5===r?"burn":"mint",pool:f,shareToken:T(a),amountIndex:s}),I=6===r?a:void 0)}const E=A(S);return E<=0n&&po("MIN_OUT_TOO_LOW",`encoded total_min_out is ${E}`),{version:f,tokenIn:T(m),tokenOut:T(b),totalMinOut:E,referralId:w,assets:i,amounts:a,ops:x,weights:v}}function fo(e,t){if(s.StrKey.isValidContract(e))return e;if(!t)return po("EXPECTATION_MISSING",`token ${e} is not a contract id; pass \`network\` to derive its asset contract`);try{const r=e.indexOf(":");return("XLM"===e||"native"===e?s.Asset.native():new s.Asset(e.slice(0,r),e.slice(r+1))).contractId(a[t])}catch{return po("MALFORMED",`token id ${e} is not a contract id or a classic asset`)}}const ho=(e,t)=>"bigint"==typeof e?e:/^\d+$/.test(e)?BigInt(e):po("EXPECTATION_MISSING",`${t} must be a base-unit integer string`);function go(e,t){const r=ho(t.minOut,"expected.minOut");r<=0n&&po("EXPECTATION_MISSING","expected.minOut must be positive");const o=co(e);if(o.tokenIn!==t.tokenIn&&po("TOKEN_IN_MISMATCH",`route spends ${o.tokenIn}, expected ${t.tokenIn}`),o.tokenOut!==t.tokenOut&&po("TOKEN_OUT_MISMATCH",`route delivers ${o.tokenOut}, expected ${t.tokenOut}`),o.totalMinOut<r&&po("MIN_OUT_TOO_LOW",`route enforces a minimum of ${o.totalMinOut}, below the expected ${r}`),void 0!==t.amountIn){const e=ho(t.amountIn,"expected.amountIn");for(const t of o.ops)"swap"===t.kind&&"fixed"===t.mode.kind&&t.tokenIn===o.tokenIn&&t.mode.amount>e&&po("AMOUNT_IN_EXCEEDED",`a leg spends ${t.mode.amount}, above the input ${e}`)}return o}const yo=e=>k(e).toXDR("base64");function mo(e,t){if(!e.routerAddress)throw new Error("Stellar aggregator routerAddress is required");const r=new s.Contract(e.routerAddress),o=new s.Account(e.caller,e.sourceSequence),n=O(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new s.TransactionBuilder(o,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[e.network]}).addOperation(r.call("execute_strategy",c(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function bo(e,t={}){if("string"!=typeof e.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:e.paths?e.paths.map((e=>({hops:e.swaps.map(wo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(wo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function So(e,t={}){const r=t.expected??{},o="string"==typeof e.routeXdr&&e.routeXdr.length>0?{routeXdr:e.routeXdr}:bo(e,t),n=[e.amountOutMin,r.minOut].filter((e=>void 0!==e)).map((e=>{if("bigint"==typeof e)return e;if("string"!=typeof e||!/^\d+$/.test(e))throw new lo("MALFORMED","minimum output must be a base-unit integer string");return BigInt(e)})).reduce(((e,t)=>void 0===e||t>e?t:e),void 0);if(void 0===n)throw new lo("EXPECTATION_MISSING","quote has no `amountOutMin`; pass `slippage` when fetching it or `expected.minOut`");return go(o,{tokenIn:fo(r.tokenIn??e.from,t.network),tokenOut:fo(r.tokenOut??e.to,t.network),minOut:n,amountIn:r.amountIn??e.amountIn}),o}const wo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function vo(e){try{const{envelopeXdr:t,networkPassphrase:r,routerAddress:o,viewer:n,operationIndex:i}=e;if(!r||!s.StrKey.isValidContract(o)||new s.Address(n).toString()!==n||"string"!=typeof t||t.length>1048576||t.length%4!=0||!/^[A-Za-z0-9+/]+={0,2}$/.test(t)||void 0!==i&&(!Number.isSafeInteger(i)||i<0))return null;const a=s.TransactionBuilder.fromXDR(t,r),u="innerTransaction"in a?a.innerTransaction:a;if(void 0!==i&&i>=u.operations.length)return null;let l=null;for(const[e,t]of u.operations.entries()){if(void 0!==i&&e!==i)continue;if("invokeHostFunction"!==t.type)continue;const r=t.func;if("hostFunctionTypeInvokeContract"!==io(r))continue;const a=no(r,"invokeContract");if(s.Address.fromScAddress(no(a,"contractAddress")).toString()!==o||"execute_strategy"!==no(a,"functionName").toString())continue;const u=no(a,"args"),[d,p,c]=u;if(3!==u.length||!d||!p||!c||"scvAddress"!==io(d)||"scvI128"!==io(p)||"scvBytes"!==io(c))return null;if(s.Address.fromScAddress(no(d,"address")).toString()!==n)continue;const f=(0,s.scValToBigInt)(p);if(f<=0n)return null;const h=co(ao(c));if(h.tokenIn===h.tokenOut||!s.StrKey.isValidContract(h.tokenIn)||!s.StrKey.isValidContract(h.tokenOut))return null;if(l)return null;l={tokenIn:h.tokenIn,tokenOut:h.tokenOut,amountInAtoms:f.toString(),operationIndex:e}}return l}catch{return null}}class To extends Error{code;offender;constructor(e,t,r){super(`Stellar authorization check failed [${e}]: ${t}${r?` — ${r.contract}.${r.fn}(${r.args.join(", ")})`:""}`),this.name="StellarAuthPolicyError",this.code=e,this.offender=r}}const Ao=e=>e&&"scvAddress"===io(e)?s.Address.fromScAddress(no(e,"address")).toString():void 0,xo=e=>e&&"scvI128"===io(e)?(0,s.scValToBigInt)(e):void 0,Io=e=>e&&"scvVec"===io(e)?no(e,"vec")??[]:void 0,Eo=(e,t)=>{if(!e||"scvMap"!==io(e))return;const r=(no(e,"map")??[]).find((e=>"scvSymbol"===io(no(e,"key"))&&no(no(e,"key"),"sym").toString()===t));return r?no(r,"val"):void 0},Ro=e=>Ao(e)??xo(e)?.toString()??e.toXDR("base64"),Po=e=>({contract:s.Address.fromScAddress(no(e,"contractAddress")).toString(),fn:no(e,"functionName").toString(),args:no(e,"args").map(Ro)}),ko=e=>{const t=no(e,"function");return"sorobanAuthorizedFunctionTypeContractFn"===io(t)?no(t,"contractFn"):void 0};function qo(e,t,r){const o=e.filter((e=>{const o=no(e,"credentials"),n=io(o);if("sorobanCredentialsAddress"!==n&&"sorobanCredentialsSourceAccount"!==n)throw new To("MALFORMED_TRANSACTION","unsupported authorization credentials");return("sorobanCredentialsAddress"===n?s.Address.fromScAddress(no(no(o,"address"),"address")).toString():r??t.caller)===t.caller}));if(o.length>1)throw new To("DUPLICATE_ENTRY",`${o.length} authorization entries for ${t.caller}, expected one`);const n=o[0];if(!n)return;const i=ko(no(n,"rootInvocation"));if(!i)throw new To("UNEXPECTED_ROOT","root is not a contract call");const a=Po(i);if(a.contract!==t.root.contract||a.fn!==t.root.fn)throw new To("UNEXPECTED_ROOT",`expected ${t.root.contract}.${t.root.fn}`,a);const u=t.transfers.map((()=>0n)),l=(t.calls??[]).map((()=>0));for(const e of no(no(n,"rootInvocation"),"subInvocations")){const r=ko(e);if(!r)throw new To("UNEXPECTED_CALL","sub-invocation is not a contract call");const o=Po(r);if(no(e,"subInvocations").length>0)throw new To("NESTED_INVOCATION","sub-invocation carries its own sub-invocations",o);const n=(t.calls??[]).findIndex((e=>e.contract===o.contract&&e.fn===o.fn));if(-1!==n){const e=(t.calls??[])[n],i=e.reject(no(r,"args"));if(i)throw new To("UNEXPECTED_CALL",i,o);if(l[n]=(l[n]??0)+1,(l[n]??0)>e.maxCount)throw new To("UNEXPECTED_CALL",`more than ${e.maxCount} calls`,o);continue}if("transfer"!==o.fn||3!==no(r,"args").length)throw new To("UNEXPECTED_CALL","only `transfer` is allowed",o);if(!t.transfers.some((e=>e.token===o.contract)))throw new To("UNEXPECTED_TOKEN","transfer on an unexpected token",o);const[i,a,s]=no(r,"args");if(Ao(i)!==t.caller)throw new To("UNEXPECTED_SENDER","transfer is not from the caller",o);const d=Ao(a),p=t.transfers.findIndex((e=>e.token===o.contract&&e.to===d));if(-1===p)throw new To("UNEXPECTED_RECIPIENT","transfer to an unexpected recipient",o);const c=xo(s),f=t.transfers[p],h=(u[p]??0n)+(c??0n);if(void 0===c||c<=0n||h>f.maxAmount)throw new To("AMOUNT_EXCEEDED",`transfers total ${h}, above the expected ${f.maxAmount}`,o);u[p]=h}}const Bo=e=>{throw new To("MALFORMED_TRANSACTION",e)},_o=(e,t)=>{const r=new Map;for(const t of Io(e)??Bo("payments argument is not a vector")){const[e,o]=Io(t)??[],n=Ao(Eo(e,"asset")),i=xo(o);if(void 0===n||void 0===i||i<0n)return Bo("payment is not a (HubAssetKey, i128) tuple");r.set(n,(r.get(n)??0n)+i)}return[...r].map((([e,r])=>({token:e,to:t,maxAmount:r})))},Oo=new Set([1,3,5]),Uo=(e,t,r)=>({contract:e,fn:"submit",maxCount:2,reject:e=>{if(4!==e.length)return"submit must have four arguments";if(Ao(e[0])!==t)return"`from` is not the caller";if(Ao(e[1])!==r||Ao(e[2])!==r)return"`spender` and `to` must be the lending controller";const o=Io(e[3]);if(!o)return"requests is not a vector";for(const e of o){const t=Eo(e,"request_type");if(!t||"scvU32"!==io(t)||!Oo.has(no(t,"u32")))return"request is not a withdraw, withdraw-collateral, or repay"}}});function Mo(e,t,r){const{contract:o,fn:n}=Po(t),i=no(t,"args"),a={caller:e,root:{contract:o,fn:n},transfers:[]};if(o===r.governance)return a;if(o===r.aggregatorRouter){if("execute_strategy"!==n)return a;const t=xo(i[1]);if(Ao(i[0])!==e||void 0===t||"scvBytes"!==io(i[2]))return Bo("execute_strategy arguments must be (caller, total_in, swap_xdr)");const r=co(ao(i[2]));return a.transfers=[{token:r.tokenIn,to:o,maxAmount:t}],a}if(o!==r.lendingController)throw new To("UNSUPPORTED_CONTRACT",`no authorization policy for contract ${o}; pass an explicit policy`);if(Ao(i[0])!==e)throw new To("CALLER_MISMATCH",`${n} is not invoked for ${e}`);switch(n){case"supply":a.transfers=_o(i[3],r.lendingPool);break;case"repay":case"liquidate":a.transfers=_o(i[2],r.lendingPool);break;case"multiply":{const e=i[8];e&&"scvVoid"!==io(e)&&(a.transfers=_o(s.xdr.ScVal.scvVec([e]),o));break}case"migrate_from_blend":{const t=Ao(i[4])??Bo("blend_pool is not an address");a.calls=[Uo(t,e,o)];break}}return a}const Co=e=>{let t;try{t=s.xdr.TransactionEnvelope.fromXDR(e,"base64")}catch{return Bo("not a transaction envelope")}if("envelopeTypeTx"!==io(t))return Bo("expected a regular (v1) transaction");const r=no(no(t,"v1"),"tx"),o=no(r,"operations")[0];if(!o||1!==no(r,"operations").length)return Bo("expected exactly one operation");const n=no(o,"body");if("invokeHostFunction"!==io(n))return Bo("operation is not a contract invocation");const i=no(n,"invokeHostFunctionOp");return"hostFunctionTypeInvokeContract"!==io(no(i,"hostFunction"))?Bo("host function is not a contract call"):{source:(a=no(o,"sourceAccount")??no(r,"sourceAccount"),s.StrKey.encodeEd25519PublicKey(so("keyTypeMuxedEd25519"===io(a)?no(no(a,"med25519"),"ed25519"):no(a,"ed25519")))),op:i,call:no(no(i,"hostFunction"),"invokeContract")};var a};function Lo(e,t){const r=Co(e);if(void 0!==t.builtXdr&&no(Co(t.builtXdr).op,"hostFunction").toXDR("base64")!==no(r.op,"hostFunction").toXDR("base64"))throw new To("INVOCATION_CHANGED","the prepared transaction does not invoke what was built",Po(r.call));const o=t.policy??Mo(t.caller,r.call,{...i(t.network),...t.deployment});qo(no(r.op,"auth"),o,r.source)}function Do(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function $o(e,t,r){const o=r?.instructionLeeway??2e7;if(!Number.isInteger(o)||o<0||o>4294967295)throw new Error("instructionLeeway must be an integer from 0 to 4294967295");const n=s.TransactionBuilder.fromXDR(t,r?.network?a[r.network]:"");try{const t=await e.simulateTransaction(n,{cpuInstructions:o});if(s.rpc.Api.isSimulationError(t))throw new Error(t.error);return s.rpc.assembleTransaction(n,t).build().toXDR()}catch(e){if(r?.invokedContractId)throw Do(r.invokedContractId,e);throw e}}async function No(e,t,r){return $o(e,t.xdr,r)}function Wo(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function Fo(e,t){return new Uint8Array(0)}const Go=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return u.hp.from(t,"hex")};function Ho(e){const t=new s.Account(e.caller,e.sourceSequence),r=new s.Contract(e.forwarderAddress).call("mint_and_forward",s.xdr.ScVal.scvBytes(Go(e.message)),s.xdr.ScVal.scvBytes(Go(e.attestation)));return{xdr:new s.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:a[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const zo=10n**27n,Vo=10n**18n,Xo=10000n,jo=27,Ko=18;function Zo(e,t="value"){let r;if("bigint"==typeof e)r=e;else if("number"==typeof e){if(!Number.isSafeInteger(e))throw new Error(`Stellar math: ${t} must be a safe integer, got ${e}`);r=BigInt(e)}else{const o=e.trim();if(!/^-?\d+$/.test(o))throw new Error(`Stellar math: ${t} must be a decimal integer string, got "${e}"`);r=BigInt(o)}if(r<0n)throw new Error(`Stellar math: ${t} must be non-negative, got ${r}`);return r}function Yo(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return e*t/r}function Qo(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");const o=e*t,n=o/r;return o%r===0n?n:n+1n}function Jo(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return(e*t+r/2n)/r}function en(e,t){if(0n===t)throw new Error("Stellar math: division by zero");const r=e/t;return e%t>=t/2n+t%2n?r+1n:r}const tn=e=>10n**BigInt(e);function rn(e,t,r){return t===r?e:r>t?e*tn(r-t):e/tn(t-r)}function on(e,t,r){if(t===r)return e;if(r>t)return e*tn(r-t);const o=tn(t-r),n=e/o;return e%o===0n?n:n+1n}function nn(e,t,r){return t===r?e:r>t?e*tn(r-t):en(e,tn(t-r))}const an={floor:Yo,ceil:Qo,halfUp:Jo},sn={floor:rn,ceil:on,halfUp:nn};function un(e,t,r,o){return sn[o](an[o](e,t,zo),jo,r)}function ln(e,t,r){return un(Zo(e,"scaledRay"),Zo(t,"indexRay"),r,"floor")}function dn(e,t,r){return un(Zo(e,"scaledRay"),Zo(t,"indexRay"),r,"ceil")}function pn(e,t,r){return un(Zo(e,"scaledRay"),Zo(t,"indexRay"),r,"halfUp")}function cn(e,t){if(t>jo)throw new Error(`Stellar math: decimals ${t} exceed RAY scale`);return rn(e,t,jo)}function fn(e,t,r,o){const n=an[o](e,t,zo),i=sn[o](n,jo,Ko);return an[o](i,r,Vo)}function hn(e,t,r,o){const n=sn[o](cn(e,t),jo,Ko);return an[o](n,r,Vo)}const gn=e=>Number(e)/1e18,yn=e=>Number(e)/1e27,mn=(e,t)=>Number(e)/10**t;function bn(e,t){if(!Number.isFinite(e)||e<=0||e>=1e21)return 0n;const r=e.toFixed(t),[o="0",n=""]=r.split(".");return BigInt(o+n.padEnd(t,"0"))}const Sn=e=>bn(e,Ko),wn=(e,t)=>Jo(e,t,zo),vn=(e,t)=>Jo(e,zo,t);function Tn(e,t){return 0n===t?0n:vn(e,t)}function An(e,t){const r=e>zo?zo:e,o=Zo(t.baseRateRay,"irm.baseRateRay"),n=Zo(t.slope1Ray,"irm.slope1Ray"),i=Zo(t.slope2Ray,"irm.slope2Ray"),a=Zo(t.slope3Ray,"irm.slope3Ray"),s=Zo(t.midUtilizationRay,"irm.midUtilizationRay"),u=Zo(t.optimalUtilizationRay,"irm.optimalUtilizationRay"),l=Zo(t.maxBorrowRateRay,"irm.maxBorrowRateRay");let d;if(r<s)d=o+vn(wn(r,n),s);else if(r<u){const e=u-s;d=o+n+vn(wn(r-s,i),e)}else{const e=zo-u;d=o+n+i+(0n===e?0n:vn(wn(r-u,a),e))}return d>l?l:d}function xn(e,t,r){return 0n===e||!Number.isInteger(r)||r<0||r>=1e4?0n:Jo(wn(e,t),Xo-BigInt(r),Xo)}const In=e=>yn(e),En=e=>Math.expm1(yn(e)),Rn=5n*Vo,Pn=(e,t,r)=>`${e}:${t}:${r}`;function kn(e,t,r,o){const n=Array.isArray(e)?e:void 0,i=n?n.find((e=>e.spokeId===t&&e.hubId===r&&e.asset===o)):e[Pn(t,r,o)]??Object.values(e).find((e=>e.spokeId===t&&e.hubId===r&&e.asset===o));if(!i)throw new Error(`Stellar math: no reserve for ${Pn(t,r,o)}`);return i}const qn=/^0*[1-9]\d*$/,Bn=e=>"string"==typeof e&&qn.test(e)?BigInt(e).toString():null,_n=(e,t)=>`${e}:${t}`;function On(e){const t=new Map,r=new Map,o=new Set,n=new Set;for(const i of e?.indexes??[]){const e=_n(i.hubId,i.asset),a=Bn(i.supplyIndex),s=Bn(i.borrowIndex),u=Bn(i.usdPrice),l=t.get(e),d=l&&Bn(l.supplyIndex)===a&&Bn(l.borrowIndex)===s&&Bn(l.usdPrice)===u;null==a||null==s||null==u||l&&!d?o.add(e):l||t.set(e,i);const p=!1===i.valid||!0===i.stale||!0===i.deviation,c=r.get(i.asset);null==u||p||void 0!==c&&c.toString()!==u?n.add(i.asset):void 0===c&&r.set(i.asset,BigInt(u))}for(const e of o)t.delete(e);for(const e of n)r.delete(e);return{indexes:t,prices:r,rejectedIndexKeys:o,rejectedAssets:n}}const Un=(e,t)=>Yo(e,BigInt(t),Xo);function Mn(e,t,r,o){const n="supply"===e.side,i=Math.min(e.entryLtvBps,e.entryLiquidationThresholdBps);return{side:e.side,hubId:e.hubId,asset:e.asset,decimals:e.decimals,scaledRay:e.scaledRay.toString(),indexRay:e.indexRay.toString(),usdPriceWad:e.priceWad.toString(),usdPrice:gn(e.priceWad),amountBase:t.toString(),amountShort:mn(t,e.decimals),usdWad:r.toString(),usd:gn(r),gateUsdWad:o.toString(),entryLtvBps:e.entryLtvBps,entryLiquidationThresholdBps:e.entryLiquidationThresholdBps,entryLiquidationBonusBps:e.entryLiquidationBonusBps,entryLiquidationFeesBps:e.entryLiquidationFeesBps,ltvWeightedUsdWad:n?Un(o,i).toString():"0",liquidationWeightedUsdWad:n?Un(o,e.entryLiquidationThresholdBps).toString():"0",liveDataUsed:e.liveDataUsed}}function Cn(e){if("supply"===e.side)return Mn(e,un(e.scaledRay,e.indexRay,e.decimals,"floor"),fn(e.scaledRay,e.indexRay,e.priceWad,"halfUp"),fn(e.scaledRay,e.indexRay,e.priceWad,"floor"));const t=un(e.scaledRay,e.indexRay,e.decimals,"ceil"),r=fn(e.scaledRay,e.indexRay,e.priceWad,"ceil");return Mn(e,t,r,r)}function Ln(e,t,r,o){const n=cn(t,r);return"supply"===e?Yo(n,zo,o):Qo(n,zo,o)}function Dn(e,t,r,o){const n=cn(t,r);return"supply"===e?Qo(n,zo,o):Yo(n,zo,o)}function $n(e,t){return Cn({...e,scaledRay:Ln(e.side,t,e.decimals,e.indexRay)})}const Nn=(...e)=>{for(const t of e){const e=Bn(t);if(null!=e)return BigInt(e)}return zo};function Wn(e,t,r,o){const n=Zo("supply"===e?t.supplyScaledRay:t.borrowScaledRay,`${e}ScaledRay`);if(0n===n)return null;const i=o.indexes.get(_n(t.hubId,t.asset)),a=o.prices.get(t.asset),s="supply"===e?Nn(i?.supplyIndex,t.liveSupplyIndexRay,r.liveSupplyIndexRay,t.supplyIndexRay):Nn(i?.borrowIndex,t.liveBorrowIndexRay,r.liveBorrowIndexRay,t.borrowIndexRay),u=a??Sn(r.usdPrice);return Cn({side:e,hubId:t.hubId,asset:t.asset,decimals:r.assetDecimals,scaledRay:n,indexRay:s,priceWad:u,entryLtvBps:t.entryLtvBps,entryLiquidationThresholdBps:t.entryLiquidationThresholdBps,entryLiquidationBonusBps:t.entryLiquidationBonusBps,entryLiquidationFeesBps:t.entryLiquidationFeesBps,liveDataUsed:void 0!==i&&void 0!==a})}const Fn=(e,t)=>e.reduce(((e,r)=>e+BigInt(t(r))),0n);function Gn(e,t,r,o,n){const i=Fn(t,(e=>e.usdWad)),a=Fn(t,(e=>e.ltvWeightedUsdWad)),s=Fn(t,(e=>e.liquidationWeightedUsdWad)),u=Fn(r,(e=>e.usdWad)),l=0n===u?null:Yo(s,Vo,u),d=0n===s?0:Number(u)/Number(s)*100,p=a<o||a<=u?0n:a-u;return{...e,supplies:t,borrows:r,totalCollateralUsdWad:i.toString(),totalCollateralUsd:gn(i),ltvWeightedCollateralUsdWad:a.toString(),ltvWeightedCollateralUsd:gn(a),liquidationWeightedCollateralUsdWad:s.toString(),liquidationWeightedCollateralUsd:gn(s),totalDebtUsdWad:u.toString(),totalDebtUsd:gn(u),healthFactorWad:null===l?null:l.toString(),healthFactor:null===l?null:gn(l),healthPercent:d,borrowLimitUsdWad:a.toString(),borrowLimitUsd:gn(a),availableBorrowUsdWad:p.toString(),availableBorrowUsd:gn(p),minBorrowCollateralUsdWad:o.toString(),minBorrowCollateralUsd:gn(o),isLiquidatable:null!==l&&l<Vo,liveDataValid:n}}function Hn(e){const{positions:t,reserves:r,liveState:o}=e,n=t[0];if(!n)throw new Error("Stellar math: computeAccountRisk needs at least one position row");for(const e of t)if(e.accountId!==n.accountId)throw new Error(`Stellar math: computeAccountRisk received mixed account ids (${n.accountId}, ${e.accountId})`);const i=On(o),a=[],s=[];for(const e of t){const t=kn(r,e.spokeId,e.hubId,e.asset),o=Wn("supply",e,t,i);o&&a.push(o);const n=Wn("borrow",e,t,i);n&&s.push(n)}const u=null!=o?.minBorrowCollateralUsdWad?Zo(o.minBorrowCollateralUsdWad,"minBorrowCollateralUsdWad"):Rn,l=void 0!==o&&[...a,...s].every((e=>e.liveDataUsed));return Gn({accountId:n.accountId,owner:n.owner,spokeId:n.spokeId,mode:n.positionMode},a,s,u,l)}const zn=200n,Vn=e=>e.reduce(((e,t)=>t.amount<e.amount?t:e)),Xn=e=>e<0n?0n:e,jn=(e,t,r,o)=>({amountBase:e.amount,amountShort:mn(e.amount,t),isFullClose:r,reason:e.reason,projectedUtilization:o}),Kn=e=>({amountBase:0n,amountShort:0,isFullClose:!1,reason:e,projectedUtilization:null});function Zn(e){const t=e.assetDecimals,r=Zo(e.irm.maxUtilizationRay,"irm.maxUtilizationRay");return{suppliedBase:bn(e.hubPool.suppliedShort,t),borrowedBase:bn(e.hubPool.borrowedShort,t),cashBase:bn(e.availableLiquidityShort,t),spokeSuppliedBase:bn(e.suppliedShort,t),spokeBorrowedBase:bn(e.borrowedShort,t),maxUtilizationRay:r>=zo?null:r}}const Yn=(e,t)=>e<=0n?null:Number(t)/Number(e);function Qn(e,t){if(e<=0n||!t(0n))return 0n;let r=0n,o=e+1n;for(;o-r>1n;){const e=(r+o)/2n;t(e)?r=e:o=e}return r}const Jn=(e,t)=>e.find((e=>e.hubId===t.hubId&&e.asset===t.asset));function ei(e,t,r){if(t.paused)return Kn("paused");if(t.frozen)return Kn("frozen");if(!t.isBorrowable)return Kn("cap");const o=t.assetDecimals,n=Zn(t),i=Jn(e.borrows,t),a=On(r).indexes.get(_n(t.hubId,t.asset)),s=i?BigInt(i.indexRay):Zo(a?.borrowIndex??t.liveBorrowIndexRay,"borrowIndex"),u=i?BigInt(i.usdPriceWad):function(e,t){return On(t).prices.get(e.asset)??Sn(e.usdPrice)}(t,r),l=i?BigInt(i.scaledRay):0n,d=BigInt(e.totalDebtUsdWad)-(i?BigInt(i.usdWad):0n),p=BigInt(e.ltvWeightedCollateralUsdWad),c=BigInt(e.minBorrowCollateralUsdWad),f=[];if(p<c)f.push({amount:0n,reason:"minCollateral"});else{const t=p-BigInt(e.totalDebtUsdWad),r=t<=0n||u<=0n?0n:Yo(t,10n**BigInt(o),u),n=e=>d+fn(l+Ln("borrow",e,o,s),s,u,"ceil");f.push({amount:0n===r?0n:Qn(r+16n,(e=>n(e)<=p)),reason:"ltv"})}f.push({amount:Xn(Zo(t.borrowCap,"borrowCap")-n.spokeBorrowedBase),reason:"cap"});const h=Jo(n.suppliedBase,zn,Xo);f.push({amount:Xn(n.cashBase-h),reason:"liquidity"});const g=function(e,t){const r=e.maxUtilizationRay;if(null===r)return null;const o=cn(e.suppliedBase,t);return 0n===o?null:Qn(Xn(Yo(e.suppliedBase,r,zo)-e.borrowedBase)+16n,(n=>Tn(cn(e.borrowedBase+n,t),o)<=r))}(n,o);null!==g&&f.push({amount:g,reason:"utilizationCap"});const y=Vn(f);return jn(y,o,!1,Yn(n.suppliedBase,n.borrowedBase+y.amount))}function ti(e,t,r){if(t.paused)return Kn("paused");const o=Jn(e.supplies,t);if(!o)return Kn(null);const n=o.decimals,i=Zn(t),a=BigInt(o.scaledRay),s=BigInt(o.indexRay),u=BigInt(o.usdPriceWad),l=BigInt(o.amountBase),d=un(a,s,n,"halfUp"),p=BigInt(e.totalDebtUsdWad),c=BigInt(e.minBorrowCollateralUsdWad),f=BigInt(Math.min(o.entryLtvBps,o.entryLiquidationThresholdBps)),h=[];let g=!0;if(p>0n&&f>0n){const t=p>c?p:c,r=c>p?"minCollateral":"healthFactor",i=BigInt(e.ltvWeightedCollateralUsdWad)-BigInt(o.ltvWeightedUsdWad);if(i<t){g=!1;const e=t-i,l=Qo(e,Xo,f),p=BigInt(o.gateUsdWad)-l,c=p<=0n?0n:Yo(p,10n**BigInt(n),u),y=d>0n?d-1n:0n,m=c+16n>y?y:c+16n,b=e=>{const t=Dn("supply",e,n,s);return Yo(fn(t>=a?0n:a-t,s,u,"floor"),f,Xo)};h.push({amount:Qn(m,(t=>b(t)>=e)),reason:r})}}h.push({amount:l,reason:null}),h.push({amount:i.cashBase,reason:"liquidity"});const y=function(e,t){const r=e.maxUtilizationRay;if(null===r||0n===e.borrowedBase)return null;if(0n===r)return 0n;const o=Qo(e.borrowedBase,zo,r),n=e.suppliedBase<o?0n:e.suppliedBase-o+16n,i=cn(e.borrowedBase,t);return Qn(n>e.suppliedBase?e.suppliedBase:n,(o=>{const n=cn(e.suppliedBase-o,t);return n>0n&&Tn(i,n)<=r}))}(i,n);null!==y&&h.push({amount:y,reason:"utilizationCap"});const m=Vn(h),b=g&&m.amount>=l;return jn(m,n,b,Yn(i.suppliedBase-m.amount,i.borrowedBase))}function ri(e){if(e.paused)return Kn("paused");if(e.frozen)return Kn("frozen");const t=e.assetDecimals,r=Zn(e),o={amount:Xn(Zo(e.supplyCap,"supplyCap")-r.spokeSuppliedBase),reason:"cap"};return jn(o,t,!1,Yn(r.suppliedBase+o.amount,r.borrowedBase))}function oi(e,t,r){if(t.paused)return Kn("paused");const o=Jn(e.borrows,t);if(!o)return Kn(null);const n=o.decimals,i=Zn(t),a=BigInt(o.amountBase),s=void 0===r?null:Zo(r,"walletBalance"),u=null!==s&&s<a?{amount:s,reason:"liquidity"}:{amount:a,reason:null};return jn(u,n,u.amount>=a,Yn(i.suppliedBase,Xn(i.borrowedBase-u.amount)))}const ni=(e,t)=>e.hubId===t.hubId&&e.asset===t.asset,ii=e=>{if("bigint"==typeof e)return e;const t=e.trim();if(!/^-?\d+$/.test(t))throw new Error(`Stellar math: delta amountBase must be an integer string, got "${e}"`);return BigInt(t)};function ai(e,t){const r=[...e.supplies],o=[...e.borrows];for(const e of t){const t="supply"===e.side?r:o,n=t.findIndex((t=>ni(t,e))),i=-1===n?void 0:t[n],a=ii(e.amountBase);let s;if(i){const e={side:i.side,hubId:i.hubId,asset:i.asset,decimals:i.decimals,indexRay:BigInt(i.indexRay),priceWad:BigInt(i.usdPriceWad),entryLtvBps:i.entryLtvBps,entryLiquidationThresholdBps:i.entryLiquidationThresholdBps,entryLiquidationBonusBps:i.entryLiquidationBonusBps,entryLiquidationFeesBps:i.entryLiquidationFeesBps,liveDataUsed:i.liveDataUsed},t=BigInt(i.scaledRay);let r;if(a>=0n)r=t+Ln(e.side,a,e.decimals,e.indexRay);else{const o=-a,n=o>=("supply"===e.side?un(t,e.indexRay,e.decimals,"halfUp"):BigInt(i.amountBase))?t:Dn(e.side,o,e.decimals,e.indexRay);r=n>=t?0n:t-n}s=0n===r?null:Cn({...e,scaledRay:r})}else s=a<=0n?null:$n(si(e),a);-1===n?s&&t.push(s):s?t[n]=s:t.splice(n,1)}return Gn({accountId:e.accountId,owner:e.owner,spokeId:e.spokeId,mode:e.mode},r,o,BigInt(e.minBorrowCollateralUsdWad),e.liveDataValid)}function si(e){const t=e.reserve;if(!t)throw new Error(`Stellar math: projectAccountRisk needs \`reserve\` for a new ${e.side} position on ${e.hubId}:${e.asset}`);return{side:e.side,hubId:e.hubId,asset:e.asset,decimals:t.assetDecimals,indexRay:Zo("supply"===e.side?t.liveSupplyIndexRay:t.liveBorrowIndexRay,"reserve live index"),priceWad:Sn(t.usdPrice),entryLtvBps:t.collateralFactorBps,entryLiquidationThresholdBps:t.liquidationThresholdBps,entryLiquidationBonusBps:t.liquidationPenaltyBps,entryLiquidationFeesBps:t.liquidationFeesBps,liveDataUsed:!1}}function ui(e,t=0n,r=0n){const o=e.assetDecimals,n=e=>e<0n?0n:e,i=n(bn(e.hubPool.suppliedShort,o)+ii(t)),a=Tn(cn(n(bn(e.hubPool.borrowedShort,o)+ii(r)),o),cn(i,o)),s=An(a,e.irm),u=xn(a,s,e.irm.reserveFactorBps);return{utilization:yn(a),utilizationRay:a.toString(),borrowAprRay:s.toString(),supplyAprRay:u.toString(),borrowApr:In(s),supplyApr:In(u),borrowApy:En(s),supplyApy:En(u)}}const li={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},14:{name:"AmountMustBePositive",message:"The amount must be greater than zero."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},318:{name:"SpokeAssetSeizureHalted",message:"Liquidation seizure is halted for this spoke asset."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function di(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=li[r];return o?{code:r,...o}:null}},468(e,t,r){"use strict";r.d(t,{createStellarLendingReadClient:()=>S,lendingAssetsSchema:()=>m,lendingPositionsSchema:()=>y});const o={type:"string"},n={type:"number"},i={type:"boolean"},a={...o,nullable:!0},s={...n,nullable:!0},u={...o,enum:["mainnet","testnet"]},l={...o,enum:["ready","stale","incomplete"]};function d(e){return{type:"object",required:Object.keys(e),properties:e}}const p={sac:o,symbol:o,name:o,decimals:s,logoUrl:a},c=d({valid:i,stale:i,deviation:i,timestamp:s}),f=d({...p,hubId:n,hubName:o,amountRaw:{...a,description:"Integer token base units, never scaled shares."},amount:a,apy:{...s,description:"Fraction: 0.05 means 5%."},priceUsd:s,valueUsd:s,priceStatus:c,indexRay:a,indexedAt:n,indexedLedger:n}),h=d({amountRaw:a,amount:a,usd:s}),g=d({spokeId:n,spokeName:o,ltvBps:n,supplyCapacity:h,borrowCapacity:h,canSupply:i,canBeCollateral:i,canBorrow:i,canOpenAccount:{...i,description:"Spoke admits new accounts; other entry gates still apply."}}),y={type:"array",items:d({accountId:o,nftContract:o,nftImage:{...o,format:"uri",description:"Dynamic position SVG served by the network's XOXNO API."},network:u,spokeId:s,spokeName:a,supplied:{type:"array",items:f},borrow:{type:"array",items:f},hasDebt:{...i,nullable:!0,description:"Null when account rows are unavailable."},healthFactor:{...s,description:"Null without debt or when risk inputs are unavailable."},borrowLimitUsd:s,availableBorrowUsd:{...s,description:"Account headroom, before per-market constraints."},netApy:{...s,description:"Net annual yield divided by positive net equity; fraction."},dataStatus:l})},m={type:"array",items:d({...p,hubId:n,hubName:o,network:u,supplyApy:{...s,description:"Fraction: 0.05 means 5%."},borrowApy:{...s,description:"Fraction: 0.05 means 5%."},priceUsd:s,priceStatus:c,spokes:{type:"array",items:g},dataStatus:l,indexedAt:{...n,description:"Pool state timestamp. Capacities are indexed snapshot estimates; prepare/simulate before signing."},indexedLedger:n})};function b(e){if(!e)return;const t=/\s*<([^<>\s]+)>\s*((?:;\s*[\w!#$%&'*+.^`|~-]+\s*=\s*(?:"(?:[^"\\\r\n]|\\.)*"|[\w!#$%&'*+.^`|~:/-]+)\s*)*)(,|$)/gy;let r,o=0;for(;o<e.length;){const n=t.exec(e);if(!n||n[3]&&t.lastIndex===e.length)throw new Error("Invalid pagination Link header");let i=!1,a=!1;for(const e of n[2].matchAll(/;\s*([\w!#$%&'*+.^`|~-]+)\s*=\s*(?:"((?:[^"\\\r\n]|\\.)*)"|([\w!#$%&'*+.^`|~:/-]+))\s*/g))if("rel"===e[1].toLowerCase()){if(a)throw new Error("Duplicate pagination link relation");a=!0,i=(e[2]??e[3]).replace(/\\(.)/g,"$1").toLowerCase().split(/\s+/).includes("next")}if(i){if(void 0!==r)throw new Error("Multiple next pagination links");r=n[1]}o=t.lastIndex}return r}function S(e){const t=new URL(e.baseUrl.trim());if(!["https:","http:"].includes(t.protocol)||t.username||t.password||t.search||t.hash)throw new Error("baseUrl must be an HTTP API root without credentials, query or fragment");t.pathname=`${t.pathname.replace(/\/+$/,"")}/`;const r=e.fetch??globalThis.fetch?.bind(globalThis);if(!r)throw new Error("A fetch implementation is required");async function o(e,o){const n=new URL(`stellar-lending/v1/${e}`,t);let i=n;const a=new Set,s=[];for(;;){if(a.has(i.href))throw new Error("Pagination Link cycle");a.add(i.href);const e=await r(i.href,{signal:o,redirect:"error"});if(e.redirected||e.url&&new URL(e.url).href!==i.href)throw new Error("Stellar lending redirects are not allowed");if(!e.ok)throw new Error(`Stellar lending request failed: HTTP ${e.status}`);const t=await e.json();if(!Array.isArray(t))throw new Error("Stellar lending response must be an array");s.push(...t);const u=b(e.headers.get("Link"));if(!u)break;const l=new URL(u,i);if(l.origin!==n.origin||l.pathname!==n.pathname||l.username||l.password||l.hash)throw new Error("Pagination Link must stay on the same API endpoint");i=l}return s}return{assets:({usage:e,signal:t}={})=>{if(void 0!==e&&"collateral"!==e&&"borrow"!==e)throw new Error("usage must be collateral or borrow");return o("assets"+(e?`?usage=${e}`:""),t)},positions:(e,{signal:t}={})=>{if(!e.trim()||"."===e||".."===e)throw new Error("owner is required");return o(`users/${encodeURIComponent(e)}/positions`,t)}}}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";r.r(o),r.d(o,{BPS:()=>g.BPS,Chain:()=>a,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>g.DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD,DEFAULT_REQUEST_TIMEOUT_MS:()=>i,LIQUIDATION_BUFFER_BPS:()=>g.LIQUIDATION_BUFFER_BPS,RAY:()=>g.RAY,RAY_DECIMALS:()=>g.RAY_DECIMALS,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>g.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_TOPICS:()=>g.STELLAR_LENDING_TOPICS,STELLAR_NETWORKS:()=>g.STELLAR_NETWORKS,STELLAR_NETWORK_PASSPHRASE:()=>g.STELLAR_NETWORK_PASSPHRASE,STELLAR_ROUTE_MAX_BYTES:()=>g.STELLAR_ROUTE_MAX_BYTES,SYNTHETIC_EVENT_ORDER_STRIDE:()=>g.SYNTHETIC_EVENT_ORDER_STRIDE,StellarAuthPolicyError:()=>g.StellarAuthPolicyError,StellarRouteVerificationError:()=>g.StellarRouteVerificationError,WAD:()=>g.WAD,WAD_DECIMALS:()=>g.WAD_DECIMALS,XOXNOClient:()=>s,aggregateAccountRisk:()=>g.aggregateAccountRisk,annualBorrowRateRay:()=>g.annualBorrowRateRay,assertStellarAuthEntries:()=>g.assertStellarAuthEntries,assertStellarPreparedTxAuth:()=>g.assertStellarPreparedTxAuth,baseToRay:()=>g.baseToRay,baseToShort:()=>g.baseToShort,baseValueWad:()=>g.baseValueWad,buildLiveSnapshot:()=>g.buildLiveSnapshot,buildSameTokenRepaySwapSteps:()=>g.buildSameTokenRepaySwapSteps,buildSdk:()=>S,buildStellarAcceptOwnershipTx:()=>g.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>g.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>g.buildStellarApproveBlendPoolTx,buildStellarBorrowBatchTx:()=>g.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>g.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>g.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>g.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>g.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>g.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>g.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>g.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>g.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>g.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>g.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>g.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>g.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>g.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>g.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>g.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>g.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>g.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>g.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>g.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>g.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>g.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>g.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>g.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>g.buildStellarMigrateTx,buildStellarMultiplyTx:()=>g.buildStellarMultiplyTx,buildStellarPauseTx:()=>g.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>g.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>g.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>g.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>g.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>g.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>g.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeCreateHubTx:()=>g.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>g.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>g.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>g.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>g.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>g.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>g.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>g.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>g.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>g.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>g.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>g.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>g.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>g.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>g.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>g.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>g.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>g.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>g.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>g.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>g.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>g.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>g.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>g.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>g.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>g.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>g.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>g.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>g.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>g.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>g.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>g.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>g.buildStellarRevokeRoleTx,buildStellarSetAccumulatorTx:()=>g.buildStellarSetAccumulatorTx,buildStellarSetOracleSanityBoundsTx:()=>g.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>g.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>g.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>g.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>g.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>g.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>g.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>g.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>g.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>g.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>g.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>g.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>g.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>g.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>g.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>g.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>g.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>g.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>g.buildStellarWithdrawTx,buildTx:()=>g.buildTx,burnShares:()=>g.burnShares,computeAccountRisk:()=>g.computeAccountRisk,createStellarLendingReadClient:()=>g.createStellarLendingReadClient,decodeStellarLendingEvent:()=>g.decodeStellarLendingEvent,decodeStellarLiquidateReturn:()=>g.decodeStellarLiquidateReturn,decodeStellarRouteBytes:()=>g.decodeStellarRouteBytes,decodeStellarSwapEnvelope:()=>g.decodeStellarSwapEnvelope,depositRateRay:()=>g.depositRateRay,divByIntHalfUp:()=>g.divByIntHalfUp,encodeAssetOracle:()=>g.encodeAssetOracle,encodeInterestRateModel:()=>g.encodeInterestRateModel,encodeMarketParamsRaw:()=>g.encodeMarketParamsRaw,encodePositionLimits:()=>g.encodePositionLimits,encodePriceKey:()=>g.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>g.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>g.extractEventOrder,getStellarAccountPositions:()=>g.getStellarAccountPositions,getStellarActiveUsersSeries:()=>g.getStellarActiveUsersSeries,getStellarAggregatorQuote:()=>g.getStellarAggregatorQuote,getStellarAsset:()=>g.getStellarAsset,getStellarAssetGraph:()=>g.getStellarAssetGraph,getStellarAssetMarkets:()=>g.getStellarAssetMarkets,getStellarAssetPage:()=>g.getStellarAssetPage,getStellarAssets:()=>g.getStellarAssets,getStellarCampaignLeaderboard:()=>g.getStellarCampaignLeaderboard,getStellarCampaignMe:()=>g.getStellarCampaignMe,getStellarDefiLlamaDimensions:()=>g.getStellarDefiLlamaDimensions,getStellarDeployment:()=>g.getStellarDeployment,getStellarDetailedMarkets:()=>g.getStellarDetailedMarkets,getStellarFeeRevenueSeries:()=>g.getStellarFeeRevenueSeries,getStellarGovernanceProposals:()=>g.getStellarGovernanceProposals,getStellarHolderDistribution:()=>g.getStellarHolderDistribution,getStellarHub:()=>g.getStellarHub,getStellarHubGraph:()=>g.getStellarHubGraph,getStellarHubHolders:()=>g.getStellarHubHolders,getStellarHubs:()=>g.getStellarHubs,getStellarLendingContext:()=>g.getStellarLendingContext,getStellarLendingLiveState:()=>g.getStellarLendingLiveState,getStellarLiquidationsLeaderboard:()=>g.getStellarLiquidationsLeaderboard,getStellarLiquidationsSeries:()=>g.getStellarLiquidationsSeries,getStellarParticipantCounts:()=>g.getStellarParticipantCounts,getStellarPnlByScope:()=>g.getStellarPnlByScope,getStellarPositionsLeaderboard:()=>g.getStellarPositionsLeaderboard,getStellarPositionsPnl:()=>g.getStellarPositionsPnl,getStellarQuoteTokens:()=>g.getStellarQuoteTokens,getStellarRateSpreadSeries:()=>g.getStellarRateSpreadSeries,getStellarReserve:()=>g.getStellarReserve,getStellarReserveGraph:()=>g.getStellarReserveGraph,getStellarReserveHolders:()=>g.getStellarReserveHolders,getStellarReserves:()=>g.getStellarReserves,getStellarRevenueSeries:()=>g.getStellarRevenueSeries,getStellarSpoke:()=>g.getStellarSpoke,getStellarSpokeGraph:()=>g.getStellarSpokeGraph,getStellarSpokeHolders:()=>g.getStellarSpokeHolders,getStellarSpokes:()=>g.getStellarSpokes,getStellarStatsHistory:()=>g.getStellarStatsHistory,getStellarUserActivity:()=>g.getStellarUserActivity,getStellarUserActivityPage:()=>g.getStellarUserActivityPage,getStellarUserHistory:()=>g.getStellarUserHistory,getStellarUserPositions:()=>g.getStellarUserPositions,getStellarVolumeSeries:()=>g.getStellarVolumeSeries,getStellarWalletBalance:()=>g.getStellarWalletBalance,isValidCollectionTicker:()=>u,isValidNftIdentifier:()=>l,lendingAssetsSchema:()=>g.lendingAssetsSchema,lendingPositionsSchema:()=>g.lendingPositionsSchema,liveIndexKey:()=>g.liveIndexKey,mapQuoteResponseToStrategyPayload:()=>g.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>g.mapQuoteResponseToStrategySwap,mapSorobanError:()=>g.mapSorobanError,mapStellarPositionActivityType:()=>g.mapStellarPositionActivityType,maxBorrow:()=>g.maxBorrow,maxRepay:()=>g.maxRepay,maxSupply:()=>g.maxSupply,maxWithdraw:()=>g.maxWithdraw,mintShares:()=>g.mintShares,mulDivCeil:()=>g.mulDivCeil,mulDivFloor:()=>g.mulDivFloor,mulDivHalfUp:()=>g.mulDivHalfUp,numberToScaled:()=>g.numberToScaled,numberToWad:()=>g.numberToWad,parseStellarTokenAmount:()=>g.parseStellarTokenAmount,positionValueWad:()=>g.positionValueWad,prepareStellarBuiltTx:()=>g.prepareStellarBuiltTx,prepareStellarTxXdr:()=>g.prepareStellarTxXdr,projectAccountRisk:()=>g.projectAccountRisk,projectReserveApy:()=>g.projectReserveApy,rayAprToApy:()=>g.rayAprToApy,rayAprToNumber:()=>g.rayAprToNumber,rayToNumber:()=>g.rayToNumber,rescaleCeil:()=>g.rescaleCeil,rescaleFloor:()=>g.rescaleFloor,rescaleHalfUp:()=>g.rescaleHalfUp,reserveKey:()=>g.reserveKey,resolveReserve:()=>g.resolveReserve,stellarAuthPolicyForInvocation:()=>g.stellarAuthPolicyForInvocation,stellarLendingDispatchKey:()=>g.stellarLendingDispatchKey,stellarLendingRead:()=>g.stellarLendingRead,stellarNetworks:()=>g.stellarNetworks,stellarTokenContractId:()=>g.stellarTokenContractId,syntheticEventOrder:()=>g.syntheticEventOrder,tagStellarInvokedContractError:()=>g.tagStellarInvokedContractError,toBase64Xdr:()=>g.toBase64Xdr,toBigInt:()=>g.toBigInt,toStellarPositionMode:()=>g.toStellarPositionMode,unscale:()=>g.unscale,unscaleBorrowCeil:()=>g.unscaleBorrowCeil,unscaleHalfUp:()=>g.unscaleHalfUp,unscaleSupplyFloor:()=>g.unscaleSupplyFloor,utilizationRay:()=>g.utilizationRay,valueBasePosition:()=>g.valueBasePosition,valueScaledPosition:()=>g.valueScaledPosition,verifyStellarRouteBytes:()=>g.verifyStellarRouteBytes,wadToNumber:()=>g.wadToNumber});const e="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",t="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",n="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e",i=3e4;var a;!function(e){e.MAINNET="1",e.DEVNET="D"}(a||(a={}));class s{apiUrl;chain;init;config;constructor(r){if(!r?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:o=a.MAINNET,apiUrl:i,...s}=r;this.apiUrl=i.trim().replace(/\/$/,""),this.chain=o,this.init=s,this.config=o==a.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:e,DR_SC:t,KG_SC:n,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:e,DR_SC:t,KG_SC:n,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:a,timeout:s,...u}=this.init,{next:l,cache:d,debug:p,timeout:c,headers:f,method:h="GET",...g}=r,y=f?.Authorization,m="Bearer undefined"===y?void 0:y,b="GET"!==h&&"HEAD"!==h&&"PUT"!==h,S={...f,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...b?{"Content-Type":"application/json"}:{},...m?{Authorization:m}:{}},w=Object.entries(t??{}).filter((([,e])=>void 0!==e)).flatMap((([e,t])=>Array.isArray(t)?t.filter((e=>void 0!==e)).map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),v=`${this.apiUrl}${e}${w.length?`?${w}`:""}`,{revalidate:T,...A}=o??{},{revalidate:x,...I}=l??{},E="GET"!==h||m?void 0:x??T,R="GET"!==h||m||E?void 0:d??n,P=g.body,k=c??s??(null==P?i:0),q=k>0?AbortSignal.timeout(k):void 0,B=g.signal??u.signal,_=q&&B?AbortSignal.any([B,q]):q??B,O={...u,...g,method:h,...Object.keys(S).length?{headers:S}:{},..._?{signal:_}:{},cache:R,next:{...A,...I,revalidate:E}};(p??a)&&console.debug("SDK fetch: ",v,O);const U=await fetch(v,O).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${v}: ${e.message}`),{cause:e});throw e})),M=await U.text();if(!U.ok){let e;try{e=JSON.parse(M)}catch{e={message:M}}const t=[v,U.status,U.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(M)}catch{return M}}}const u=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e),o=/^C[A-Z2-7]{55}$/.test(e);return t||r||o},l=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e),o=/^C[A-Z2-7]{55}-\d+$/.test(e);return t||r||o};class d extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class p extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const c=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^[GC][A-Z2-7]{55}$/.test(e)),f={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/integrations/liquid-staking/multiversx/revenue":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/multiversx":{input:{},output:{}},"/integrations/lending/multiversx/revenue":{input:{},output:{}},"/integrations/lending/multiversx/liquidations":{input:{},output:{}},"/integrations/lending/multiversx/active-users":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/campaign/leaderboard":{input:{},output:{}},"/stellar-lending/campaign/me":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/stellar-lending/users/:owner/assets/:asset/balance":{input:{},output:{}},"/stellar-lending/users/:owner/activity/page":{input:{},output:{}}},h=["PATCH","POST","DELETE","PUT"];var g=r(999);const y=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),m=()=>({static:{},params:{},leaves:[]});function b(e,t,r,o){const{input:n,output:i,...a}=t,s=async(t={})=>{const n={...r,...t},i=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),s=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in s,f=/:collection[^A-Z]/.test(e)||"collection"in s;if(l){const e=n.address;if(!c(e))throw new p(e)}if(f){const e=n.collection;if(Array.isArray(e)?e.some((e=>!u(e))):!u(e))throw new d(e)}const h=Object.fromEntries(Object.entries(s).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:g,auth:y,method:m,headers:b,cache:S,next:w,debug:v,signal:T,credentials:A,mode:x,redirect:I,referrer:E,referrerPolicy:R,integrity:P,keepalive:k,priority:q,window:B,continuationToken:_,...O}=h,U=y?`Bearer ${y}`:void 0;e.startsWith("/stellar-lending/")&&void 0!==_&&(O.continuationToken=_);const M={...b,...U?{Authorization:U}:{},..._&&!e.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(_)}:{}},C={...w,tags:[...w?.tags??[],i]};return o.fetchWithTimeout(i,{method:m,params:O,body:g,headers:M,cache:S,debug:v,...Object.fromEntries(Object.entries({signal:T,credentials:A,mode:x,redirect:I,referrer:E,referrerPolicy:R,integrity:P,keepalive:k,priority:q,window:B}).filter((([,e])=>void 0!==e))),...C?{next:C}:{}})},l=(e={})=>s(e);for(const e of Object.keys(a))h.includes(e)&&(l[e]=t=>s({...t,method:t.method??e.toUpperCase()}));return l}function S(e){const t=function(){const e=m();for(const[t,r]of Object.entries(f)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=y(e.slice(1));n=n.params[t]||=m()}else{const t=y(e);n=n.static[t]||=m()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,i=Object.keys(t.static).length,a=Object.keys(t.params).length;let s;if(1===n&&i+a>0){const{rawPath:r,def:n}=t.leaves[0];s=b(r,n,o,e)}else{s={};for(const{rawPath:r,def:n}of t.leaves)s[y(r.split("/").pop().replace(/^:/,""))]=b(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let i=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),i=r)}void 0===s[e]?s[e]=i:"function"==typeof s[e]?Object.assign(s[e],i):"function"==typeof i?(Object.assign(i,s[e]),s[e]=i):Object.assign(s[e],i)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const i=r(n,{...o,[e]:t});if(i&&"object"==typeof i&&1===Object.keys(i).length&&e in i&&"function"==typeof i[e]){const t=i[e],r=(...e)=>t(...e);return Object.assign(r,t)}return i};if(s[e]){const r=s[e];s[e]=e=>({...r(e),...t(e)})}else s[e]=t}return s};return r(t,{})}})(),module.exports=o})();
2
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{var e={526(e,t){"use strict";t.byteLength=function(e){var t=s(e),r=t[0],o=t[1];return 3*(r+o)/4-o},t.toByteArray=function(e){var t,r,i=s(e),a=i[0],u=i[1],l=new n(function(e,t,r){return 3*(t+r)/4-r}(0,a,u)),d=0,p=u>0?a-4:a;for(r=0;r<p;r+=4)t=o[e.charCodeAt(r)]<<18|o[e.charCodeAt(r+1)]<<12|o[e.charCodeAt(r+2)]<<6|o[e.charCodeAt(r+3)],l[d++]=t>>16&255,l[d++]=t>>8&255,l[d++]=255&t;return 2===u&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,l[d++]=255&t),1===u&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,l[d++]=t>>8&255,l[d++]=255&t),l},t.fromByteArray=function(e){for(var t,o=e.length,n=o%3,i=[],a=16383,s=0,l=o-n;s<l;s+=a)i.push(u(e,s,s+a>l?l:s+a));return 1===n?(t=e[o-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[o-2]<<8)+e[o-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],o=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=i[a],o[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,o){for(var n,i,a=[],s=t;s<o;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(i=n)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},287(e,t,r){"use strict";const o=r(526),n=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=u,t.IS=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return p(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let o=s(r);const n=o.write(e,t);return n!==r&&(o=o.slice(0,n)),o}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const o=e.valueOf&&e.valueOf();if(null!=o&&o!==e)return u.from(o,t,r);const n=function(e){if(u.isBuffer(e)){const t=0|h(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?s(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function p(e){return d(e),s(e<0?0:0|h(e))}function c(e){const t=e.length<0?0:0|h(e.length),r=s(t);for(let o=0;o<t;o+=1)r[o]=255&e[o];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let o;return o=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(o,u.prototype),o}function h(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(n)return o?-1:V(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){let o=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return _(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function y(e,t,r){const o=e[t];e[t]=e[r],e[r]=o}function b(e,t,r,o,n){if(0===e.length)return-1;if("string"==typeof r?(o=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=u.from(t,o)),u.isBuffer(t))return 0===t.length?-1:S(e,t,r,o,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):S(e,[t],r,o,n);throw new TypeError("val must be string, number or Buffer")}function S(e,t,r,o,n){let i,a=1,s=e.length,u=t.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){let o=-1;for(i=r;i<s;i++)if(l(e,i)===l(t,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===u)return o*a}else-1!==o&&(i-=i-o),o=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){let r=!0;for(let o=0;o<u;o++)if(l(e,i+o)!==l(t,o)){r=!1;break}if(r)return i}return-1}function w(e,t,r,o){r=Number(r)||0;const n=e.length-r;o?(o=Number(o))>n&&(o=n):o=n;const i=t.length;let a;for(o>i/2&&(o=i/2),a=0;a<o;++a){const o=parseInt(t.substr(2*a,2),16);if(Z(o))return a;e[r+a]=o}return a}function v(e,t,r,o){return j(V(t,e.length-r),e,r,o)}function T(e,t,r,o){return j(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,o)}function A(e,t,r,o){return j(X(t),e,r,o)}function x(e,t,r,o){return j(function(e,t){let r,o,n;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(t,e.length-r),e,r,o)}function I(e,t,r){return 0===t&&r===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,r))}function R(e,t,r){r=Math.min(e.length,r);const o=[];let n=t;for(;n<r;){const t=e[n];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(n+a<=r){let r,o,s,u;switch(a){case 1:t<128&&(i=t);break;case 2:r=e[n+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(i=u));break;case 3:r=e[n+1],o=e[n+2],128==(192&r)&&128==(192&o)&&(u=(15&t)<<12|(63&r)<<6|63&o,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=e[n+1],o=e[n+2],s=e[n+3],128==(192&r)&&128==(192&o)&&128==(192&s)&&(u=(15&t)<<18|(63&r)<<12|(63&o)<<6|63&s,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=a}return function(e){const t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);let r="",o=0;for(;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=E));return r}(o)}u.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return d(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},u.allocUnsafe=function(e){return p(e)},u.allocUnsafeSlow=function(e){return p(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(K(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,o=t.length;for(let n=0,i=Math.min(r,o);n<i;++n)if(e[n]!==t[n]){r=e[n],o=t[n];break}return r<o?-1:o<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const o=u.allocUnsafe(t);let n=0;for(r=0;r<e.length;++r){let t=e[r];if(K(t,Uint8Array))n+t.length>o.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(o,n)):Uint8Array.prototype.set.call(o,t,n);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(o,n)}n+=t.length}return o},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},u.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},u.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):m.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){let e="";const r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(e,t,r,o,n){if(K(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===o&&(o=0),void 0===n&&(n=this.length),t<0||r>e.length||o<0||n>this.length)throw new RangeError("out of range index");if(o>=n&&t>=r)return 0;if(o>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let i=(n>>>=0)-(o>>>=0),a=(r>>>=0)-(t>>>=0);const s=Math.min(i,a),l=this.slice(o,n),d=e.slice(t,r);for(let e=0;e<s;++e)if(l[e]!==d[e]){i=l[e],a=d[e];break}return i<a?-1:a<i?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},u.prototype.write=function(e,t,r,o){if(void 0===t)o="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)o=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===o&&(o="utf8")):(o=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let i=!1;for(;;)switch(o){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":case"latin1":case"binary":return T(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const E=4096;function P(e,t,r){let o="";r=Math.min(e.length,r);for(let n=t;n<r;++n)o+=String.fromCharCode(127&e[n]);return o}function k(e,t,r){let o="";r=Math.min(e.length,r);for(let n=t;n<r;++n)o+=String.fromCharCode(e[n]);return o}function _(e,t,r){const o=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);let n="";for(let o=t;o<r;++o)n+=Y[e[o]];return n}function q(e,t,r){const o=e.slice(t,r);let n="";for(let e=0;e<o.length-1;e+=2)n+=String.fromCharCode(o[e]+256*o[e+1]);return n}function B(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,r,o,n,i){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<i)throw new RangeError('"value" argument is out of bounds');if(r+o>e.length)throw new RangeError("Index out of range")}function C(e,t,r,o,n){F(t,o,n,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function M(e,t,r,o,n){F(t,o,n,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function U(e,t,r,o,n,i){if(r+o>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,o,i){return t=+t,r>>>=0,i||U(e,0,r,4),n.write(e,t,r,o,23,4),r+4}function N(e,t,r,o,i){return t=+t,r>>>=0,i||U(e,0,r,8),n.write(e,t,r,o,52,8),r+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const o=this.subarray(e,t);return Object.setPrototypeOf(o,u.prototype),o},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return o},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let o=this[e+--t],n=1;for(;t>0&&(n*=256);)o+=this[e+--t]*n;return o},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const o=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(o)+(BigInt(n)<<BigInt(32))})),u.prototype.readBigUInt64BE=Q((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const o=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(o)<<BigInt(32))+BigInt(n)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*t)),o},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let o=t,n=1,i=this[e+--o];for(;o>0&&(n*=256);)i+=this[e+--o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Q((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const o=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(o)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),u.prototype.readBigInt64BE=Q((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const o=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||O(this,e,t,r,Math.pow(2,8*r)-1,0);let n=1,i=0;for(this[t]=255&e;++i<r&&(n*=256);)this[t+i]=e/n&255;return t+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,o){e=+e,t>>>=0,r>>>=0,o||O(this,e,t,r,Math.pow(2,8*r)-1,0);let n=r-1,i=1;for(this[t+n]=255&e;--n>=0&&(i*=256);)this[t+n]=e/i&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=Q((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Q((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);O(this,e,t,r,o-1,-o)}let n=0,i=1,a=0;for(this[t]=255&e;++n<r&&(i*=256);)e<0&&0===a&&0!==this[t+n-1]&&(a=1),this[t+n]=(e/i|0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);O(this,e,t,r,o-1,-o)}let n=r-1,i=1,a=0;for(this[t+n]=255&e;--n>=0&&(i*=256);)e<0&&0===a&&0!==this[t+n+1]&&(a=1),this[t+n]=(e/i|0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=Q((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Q((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return N(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,o){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),o||0===o||(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<r&&(o=r),o===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-r&&(o=e.length-t+r);const n=o-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,o):Uint8Array.prototype.set.call(e,this.subarray(r,o),t),n},u.prototype.fill=function(e,t,r,o){if("string"==typeof e){if("string"==typeof t?(o=t,t=0,r=this.length):"string"==typeof r&&(o=r,r=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===e.length){const t=e.charCodeAt(0);("utf8"===o&&t<128||"latin1"===o)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{const i=u.isBuffer(e)?e:u.from(e,o),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=i[n%a]}return this};const D={};function $(e,t,r){D[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function W(e){let t="",r=e.length;const o="-"===e[0]?1:0;for(;r>=o+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function F(e,t,r,o,n,i){if(e>r||e<t){const o="bigint"==typeof t?"n":"";let n;throw n=i>3?0===t||t===BigInt(0)?`>= 0${o} and < 2${o} ** ${8*(i+1)}${o}`:`>= -(2${o} ** ${8*(i+1)-1}${o}) and < 2 ** ${8*(i+1)-1}${o}`:`>= ${t}${o} and <= ${r}${o}`,new D.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||G(t,e.length-(r+1))}(o,n,i)}function z(e,t){if("number"!=typeof e)throw new D.ERR_INVALID_ARG_TYPE(t,"number",e)}function G(e,t,r){if(Math.floor(e)!==e)throw z(e,r),new D.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}$("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),$("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),$("ERR_OUT_OF_RANGE",(function(e,t,r){let o=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=W(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=W(n)),n+="n"),o+=` It must be ${t}. Received ${n}`,o}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function V(e,t){let r;t=t||1/0;const o=e.length;let n=null;const i=[];for(let a=0;a<o;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===o){(t-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function X(e){return o.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,r,o){let n;for(n=0;n<o&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const o=16*r;for(let n=0;n<16;++n)t[o+n]=e[r]+e[n]}return t}();function Q(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,r,o,n){var i,a,s=8*n-o-1,u=(1<<s)-1,l=u>>1,d=-7,p=r?n-1:0,c=r?-1:1,f=e[t+p];for(p+=c,i=f&(1<<-d)-1,f>>=-d,d+=s;d>0;i=256*i+e[t+p],p+=c,d-=8);for(a=i&(1<<-d)-1,i>>=-d,d+=o;d>0;a=256*a+e[t+p],p+=c,d-=8);if(0===i)i=1-l;else{if(i===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,o),i-=l}return(f?-1:1)*a*Math.pow(2,i-o)},t.write=function(e,t,r,o,n,i){var a,s,u,l=8*i-n-1,d=(1<<l)-1,p=d>>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:i-1,h=o?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+p>=1?c/u:c*Math.pow(2,1-p))*u>=2&&(a++,u/=2),a+p>=d?(s=0,a=d):a+p>=1?(s=(t*u-1)*Math.pow(2,n),a+=p):(s=t*Math.pow(2,p-1)*Math.pow(2,n),a=0));n>=8;e[r+f]=255&s,f+=h,s/=256,n-=8);for(a=a<<n|s,l+=n;l>0;e[r+f]=255&a,f+=h,a/=256,l-=8);e[r+f-h]|=128*g}},999(e,t,r){"use strict";r.d(t,{BPS:()=>Qo,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>Bn,LIQUIDATION_BUFFER_BPS:()=>Zn,RAY:()=>Zo,RAY_DECIMALS:()=>Jo,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Mt,STELLAR_LENDING_TOPICS:()=>Jr,STELLAR_NETWORKS:()=>o,STELLAR_NETWORK_PASSPHRASE:()=>a,STELLAR_ROUTE_MAX_BYTES:()=>ho,SYNTHETIC_EVENT_ORDER_STRIDE:()=>to,StellarAuthPolicyError:()=>Eo,StellarRouteVerificationError:()=>go,WAD:()=>Yo,WAD_DECIMALS:()=>en,aggregateAccountRisk:()=>jn,annualBorrowRateRay:()=>Pn,assertStellarAuthEntries:()=>Mo,assertStellarPreparedTxAuth:()=>Fo,baseToRay:()=>yn,baseToShort:()=>Tn,baseValueWad:()=>Sn,buildLiveSnapshot:()=>Nn,buildSameTokenRepaySwapSteps:()=>Xo,buildStellarAcceptOwnershipTx:()=>yt,buildStellarAddRewardsTx:()=>Ot,buildStellarApproveBlendPoolTx:()=>Tt,buildStellarBorrowBatchTx:()=>$,buildStellarBorrowTx:()=>W,buildStellarCctpForwardTx:()=>Ko,buildStellarClaimRevenueTx:()=>Bt,buildStellarCreateLiquidityPoolTx:()=>_t,buildStellarExecuteCancellerResetTx:()=>kr,buildStellarExecuteStrategyTx:()=>To,buildStellarFlashLoanTx:()=>Y,buildStellarGovernanceAddSpokeImmediateTx:()=>Or,buildStellarGovernanceCreateHubImmediateTx:()=>Br,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Tr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>xr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Ir,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Rr,buildStellarGovernanceExecuteTx:()=>vr,buildStellarGovernanceExecuteUpdateDelayTx:()=>Ar,buildStellarGovernancePauseTx:()=>Mr,buildStellarGovernanceRevokeRoleImmediateTx:()=>Cr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>qr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>_r,buildStellarGrantRoleTx:()=>ht,buildStellarLendingIdentifier:()=>ro,buildStellarLiquidateTx:()=>V,buildStellarLiquidationEstimateTx:()=>j,buildStellarMigrateFromBlendTx:()=>Q,buildStellarMigrateTx:()=>pt,buildStellarMultiplyTx:()=>J,buildStellarPauseTx:()=>ct,buildStellarProposeAddAssetToSpokeTx:()=>Yt,buildStellarProposeAddSpokeTx:()=>Kt,buildStellarProposeApproveBlendPoolTx:()=>ir,buildStellarProposeApproveTokenTx:()=>or,buildStellarProposeCancellerResetTx:()=>Pr,buildStellarProposeConfigureAssetOracleTx:()=>hr,buildStellarProposeCreateHubTx:()=>jt,buildStellarProposeCreateLiquidityPoolTx:()=>sr,buildStellarProposeDeployPoolTx:()=>lr,buildStellarProposeEditAssetInSpokeTx:()=>Qt,buildStellarProposeEditOracleToleranceTx:()=>gr,buildStellarProposeGovernanceUpgradeTx:()=>mr,buildStellarProposeGrantGovernanceRoleTx:()=>br,buildStellarProposeMigrateControllerTx:()=>cr,buildStellarProposeRemoveAssetFromSpokeTx:()=>Jt,buildStellarProposeRemoveSpokeTx:()=>Zt,buildStellarProposeRevokeBlendPoolTx:()=>ar,buildStellarProposeRevokeGovernanceRoleTx:()=>Sr,buildStellarProposeRevokeTokenTx:()=>nr,buildStellarProposeSetAccumulatorTx:()=>Vt,buildStellarProposeSetMinBorrowCollatTx:()=>rr,buildStellarProposeSetPositionLimitsTx:()=>Xt,buildStellarProposeSetPositionManagerTx:()=>tr,buildStellarProposeSetPriceAggregatorTx:()=>Ht,buildStellarProposeSetSpokeLiquidationCurveTx:()=>er,buildStellarProposeSetSwapAggregatorTx:()=>Gt,buildStellarProposeTransferCtrlOwnershipTx:()=>fr,buildStellarProposeTransferGovOwnTx:()=>wr,buildStellarProposeUnpauseTx:()=>Ur,buildStellarProposeUpdateDelayTx:()=>yr,buildStellarProposeUpgradeControllerTx:()=>pr,buildStellarProposeUpgradePoolParamsTx:()=>ur,buildStellarProposeUpgradePoolTx:()=>dr,buildStellarRenewAccountTx:()=>kt,buildStellarRepayBatchTx:()=>G,buildStellarRepayDebtWithCollateralTx:()=>re,buildStellarRepayTx:()=>H,buildStellarRevokeBlendPoolTx:()=>At,buildStellarRevokeRoleTx:()=>gt,buildStellarSetAccumulatorTx:()=>wt,buildStellarSetOracleSanityBoundsTx:()=>Et,buildStellarSetOracleToleranceTx:()=>It,buildStellarSetOracleTx:()=>xt,buildStellarSetPositionLimitsTx:()=>vt,buildStellarSetPriceAggregatorTx:()=>St,buildStellarSetSpokeAssetFlagsTx:()=>Rt,buildStellarSetSwapAggregatorTx:()=>bt,buildStellarSupplyBatchTx:()=>N,buildStellarSupplyTx:()=>D,buildStellarSwapCollateralTx:()=>te,buildStellarSwapDebtTx:()=>ee,buildStellarTransferOwnershipTx:()=>mt,buildStellarUnpauseTx:()=>ft,buildStellarUpdateAccountThresholdTx:()=>Ct,buildStellarUpdateIndexesTx:()=>Pt,buildStellarUpgradeControllerTx:()=>dt,buildStellarUpgradeLiquidityPoolParamsTx:()=>qt,buildStellarWithdrawBatchTx:()=>F,buildStellarWithdrawTx:()=>z,buildTx:()=>U,burnShares:()=>zn,computeAccountRisk:()=>Kn,createStellarLendingReadClient:()=>Ye.createStellarLendingReadClient,decodeStellarLendingEvent:()=>eo,decodeStellarLiquidateReturn:()=>X,decodeStellarLiquidationEstimate:()=>Z,decodeStellarRouteBytes:()=>yo,decodeStellarSwapEnvelope:()=>Ro,depositRateRay:()=>kn,divByIntHalfUp:()=>an,encodeAssetOracle:()=>lt,encodeInterestRateModel:()=>Qe,encodeMarketParamsRaw:()=>Je,encodePositionLimits:()=>et,encodePriceKey:()=>tt,encodeStrategyPayloadToRouteXdr:()=>vo,extractEventOrder:()=>oo,getStellarAccountPositions:()=>be,getStellarActiveUsersSeries:()=>ze,getStellarAggregatorQuote:()=>so,getStellarAsset:()=>he,getStellarAssetGraph:()=>Re,getStellarAssetMarkets:()=>Te,getStellarAssetPage:()=>ve,getStellarAssets:()=>le,getStellarCampaignLeaderboard:()=>Le,getStellarCampaignMe:()=>Ke,getStellarDefiLlamaDimensions:()=>He,getStellarDeployment:()=>i,getStellarDetailedMarkets:()=>ue,getStellarFeeRevenueSeries:()=>$e,getStellarGovernanceProposals:()=>Be,getStellarHolderDistribution:()=>Ue,getStellarHub:()=>ge,getStellarHubGraph:()=>Ee,getStellarHubHolders:()=>xe,getStellarHubs:()=>de,getStellarLendingContext:()=>ae,getStellarLendingLiveState:()=>se,getStellarLiquidationsLeaderboard:()=>Me,getStellarLiquidationsSeries:()=>We,getStellarParticipantCounts:()=>Ce,getStellarPnlByScope:()=>je,getStellarPositionsLeaderboard:()=>Oe,getStellarPositionsPnl:()=>Xe,getStellarQuoteTokens:()=>uo,getStellarRateSpreadSeries:()=>Ge,getStellarReserve:()=>fe,getStellarReserveGraph:()=>ke,getStellarReserveHolders:()=>Ae,getStellarReserves:()=>ce,getStellarRevenueSeries:()=>De,getStellarSpoke:()=>me,getStellarSpokeGraph:()=>Pe,getStellarSpokeHolders:()=>Ie,getStellarSpokes:()=>pe,getStellarStatsHistory:()=>Ne,getStellarUserActivity:()=>_e,getStellarUserActivityPage:()=>qe,getStellarUserHistory:()=>Ve,getStellarUserPositions:()=>ye,getStellarVolumeSeries:()=>Fe,getStellarWalletBalance:()=>we,getStellarWalletTokens:()=>Se,lendingAssetsSchema:()=>Ye.lendingAssetsSchema,lendingPositionsSchema:()=>Ye.lendingPositionsSchema,liveIndexKey:()=>Ln,mapQuoteResponseToStrategyPayload:()=>Ao,mapQuoteResponseToStrategySwap:()=>xo,mapSorobanError:()=>Si,mapStellarPositionActivityType:()=>io,maxBorrow:()=>ii,maxRepay:()=>ui,maxSupply:()=>si,maxWithdraw:()=>ai,mintShares:()=>Fn,mulDivCeil:()=>on,mulDivFloor:()=>rn,mulDivHalfUp:()=>nn,numberToScaled:()=>An,numberToWad:()=>xn,parseStellarTokenAmount:()=>M,positionValueWad:()=>bn,prepareStellarBuiltTx:()=>Ho,prepareStellarTxXdr:()=>Go,projectAccountRisk:()=>pi,projectReserveApy:()=>fi,rayAprToApy:()=>qn,rayAprToNumber:()=>_n,rayToNumber:()=>vn,rescaleCeil:()=>ln,rescaleFloor:()=>un,rescaleHalfUp:()=>dn,reserveKey:()=>On,resolveReserve:()=>Cn,stellarAuthPolicyForInvocation:()=>$o,stellarLendingDispatchKey:()=>Dr,stellarLendingRead:()=>Ze,stellarNetworks:()=>n,stellarTokenContractId:()=>bo,syntheticEventOrder:()=>no,tagStellarInvokedContractError:()=>zo,toBase64Xdr:()=>Lr,toBigInt:()=>tn,toStellarPositionMode:()=>Vo,unscale:()=>fn,unscaleBorrowCeil:()=>gn,unscaleHalfUp:()=>mn,unscaleSupplyFloor:()=>hn,utilizationRay:()=>En,valueBasePosition:()=>Gn,valueScaledPosition:()=>Wn,verifyStellarRouteBytes:()=>wo,wadToNumber:()=>wn});const o={stellarMainnet:{name:"mainnet",passphrase:"Public Global Stellar Network ; September 2015",horizonUrl:"https://horizon.stellar.org",sorobanRpcUrl:"https://stellar-gateway.xoxno.com",quoteUrl:"https://stellar-swap.xoxno.com",explorerNetwork:"public",aquariusApiUrl:"https://amm-api.aqua.network",aquariusRouter:"CBQDHNBFBZYE4MKPWBSJOPIYLW4SFSXAXUTSXJN76GNKYVYPCKWC6QUK",lendingController:"CAUCMIN5KSXEVZ7NMXR3LZATGD5EFIEUI5XWTFLYRO2R5OTXI22WE5JX",lendingPool:"CBXRNDQMAJFG4VUKMKFEMFS75UUXE2SPSNV4LEEFCSNBCN66PYRWBKXO",aggregatorRouter:"CCVENFSVCBYDHVOACFZXMNNYVOZ3LKXPZYU5LUI4N7KTXOKRVYD7F3TR",governance:"CC44PEQW7HSEPKAZ5ZRPH2JS5M5KVJXCUBLJ2ZX4E3WCDKMNFILHC2AD",priceAggregator:"CBGUF2G2Q7HCVCWYISDXBHPVBGMYNXA7PG2VET66YBZX6IKOOV27NSMV",positionNftContract:"CAWCSG77AY2W24QZ6ZXLHZU4UXEFHZBM6EI4A4IF7JB5CTY4XND3TI6C"},stellarTestnet:{name:"testnet",passphrase:"Test SDF Network ; September 2015",horizonUrl:"https://horizon-testnet.stellar.org",sorobanRpcUrl:"https://stellar-testnet-gateway.xoxno.com",quoteUrl:"https://testnet-stellar-swap.xoxno.com",explorerNetwork:"testnet",aquariusApiUrl:"https://amm-api-testnet.aqua.network",aquariusRouter:"CBCFTQSPDBAIZ6R6PJQKSQWKNKWH2QIV3I4J72SHWBIK3ADRRAM5A6GD",lendingController:"CCXRWJ6SIU2WPFEGLFGJVITPL57QAYIMIO6OAM2NBGNDQSSCK2FFV3F3",lendingPool:"CBSGF6QOQAMPFBEVSYPEQHSZRIHJ6RCGUPCRDMUX36DEKRWFAO2PZB5A",aggregatorRouter:"CDNTWMWW2WGYTKIZTJYNGNVQQZI4KTC5BQRZ3275KESRX5T4O3AYECL5",governance:"CDS33JDOYH3F3FL4QUQ6DV4WKHML2AKHF4LADTZ57FRUAEBTE7NMY5FQ",priceAggregator:"CBMARXSYE56NPDLX42TTICM5GS5XQCYRD5VMCJME624TS6C2S53VETYU",positionNftContract:"CDVN5JU675MEDPVRPCYC45AHFC275UH57WEU5OTFE4WFGZBNN7HTLPSY"}},n=o;function i(e){return o["testnet"===e?"stellarTestnet":"stellarMainnet"]}const a={mainnet:o.stellarMainnet.passphrase,testnet:o.stellarTestnet.passphrase},s=require("@stellar/stellar-sdk");var u=r(287);const l=["Soroswap","Aquarius","Phoenix","Sushi","CometDex","Curve"],d={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4,Curve:7},p=1e6,c=e=>new s.Address(e).toScVal(),f=e=>new s.ScInt(e).toI128(),h=e=>s.xdr.ScVal.scvU32(e),g=e=>{if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("Stellar builder: u64 numbers must be safe integers; pass a decimal string for larger values");return new s.ScInt("string"==typeof e?e:e.toString()).toU64()},m=e=>s.xdr.ScVal.scvBool(e),y=e=>s.xdr.ScVal.scvString(e),b=e=>s.xdr.ScVal.scvSymbol(e),S=()=>s.xdr.ScVal.scvVoid(),w=e=>s.xdr.ScVal.scvVec(e),v=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=u.hp.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return s.xdr.ScVal.scvBytes(o)},T=(e,t)=>null==e?S():t(e),A=(e,t)=>E({asset:c(t),hub_id:h(e)}),x=(e,t,r)=>s.xdr.ScVal.scvVec([A(e,t),f(r)]),I=e=>s.xdr.ScVal.scvVec(e.map((e=>x(e.hubId,e.asset,e.amount)))),R=e=>{if("Transfer"===e)return w([b("Transfer")]);if(e&&"object"==typeof e&&"Credit"in e){const t=e.Credit;if("number"==typeof t&&!Number.isInteger(t))throw new Error(`Stellar builder: SeizeMode Credit account id must be an integer u64, got ${t}`);return w([b("Credit"),g(t)])}throw new Error(`Stellar builder: SeizeMode must be 'Transfer' or { Credit: accountId }, got ${JSON.stringify(e)}`)},E=e=>{const t=Object.keys(e).sort().map((t=>new s.xdr.ScMapEntry({key:b(t),val:e[t]})));return s.xdr.ScVal.scvMap(t)};class P{assets=[];amounts=[];ops=[];weights=[];constructor(e){this.amounts.push(e)}asset(e){const t=this.assets.indexOf(e);if(-1!==t)return t;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(e),this.assets.length-1}amount(e){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(e),this.amounts.length-1}weight(e){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(e)||e<=0||e>p)throw new Error(`Stellar builder: split weight ${e} outside 1..=1000000`);return this.weights.push(e),this.weights.length-1}emit(e,t,r,o,n){this.ops.push([e,t,r,o,n])}emitPath(e,t){e.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=e.hops[o-1];if(n&&r.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(d[r.venue],0===o?t:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(e){const t=e.filter((e=>e.hops.length>0)),r=Array.from({length:t.length},(()=>!1));for(let e=0;e<t.length;e+=1){if(r[e])continue;const o=t[e].hops[0]?.tokenIn,n=[];for(let r=e;r<t.length;r+=1)t[r].hops[0]?.tokenIn===o&&n.push(r);const i=n.reduce(((e,r)=>e+t[r].splitPpm),0);if(i>p)throw new Error(`Stellar builder: split weights for one token sum to ${i}, above 1000000`);const a=i===p;let s=p;n.forEach(((e,o)=>{r[e]=!0;const i=t[e];let u;if(o+1===n.length&&a)u=0;else{if(0===s)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(i.splitPpm*p/s);s-=Math.min(i.splitPpm,s),u=128+this.weight(e)}this.emitPath(i,u)}))}}toBytes(e,t,r){if(0===this.ops.length)throw new Error("Stellar builder: strategy lowered to zero instructions");if(this.ops.length>48)throw new Error(`Stellar builder: strategy has ${this.ops.length} instructions, the router accepts 48`);const o=[1,e,t,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const e of this.ops)o.push(...e);for(const e of this.weights)o.push(e>>>16&255,e>>>8&255,255&e);return u.hp.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const k=e=>{const t=new P(e.totalMinOut),r=t.asset(e.tokenIn),o=t.asset(e.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(e.burnPool){const o=t.asset(e.burnPool),n=t.amountList.length;for(const r of e.burnMinAmounts??[])t.amount(r);t.emit(5,0,o,r,n)}if(t.lowerPaths(e.paths),e.mintPool){const r=e.preSwapAmount;if(r&&BigInt(r)>0n){const o=e.mintPoolTokens;if(!o||2!==o.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,i]=o,[a,s]=e.preSwapFromA?[n,i]:[i,n];t.emit(d.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(a),t.asset(s))}t.emit(6,0,t.asset(e.mintPool),o,t.amount(e.mintMinShares??"1"))}const n=Number(e.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${e.referralId} does not fit the wire’s u32`);return E({amounts:s.xdr.ScVal.scvVec(t.amountList.map((e=>f(e)))),assets:s.xdr.ScVal.scvVec(t.assetList.map((e=>c(e)))),ops:s.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},_=e=>{const t=u.hp.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return s.xdr.ScVal.scvBytes(t)},q=()=>s.xdr.ScVal.scvBytes(u.hp.alloc(0)),B=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return u.hp.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=u.hp.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},O=e=>{if("string"==typeof e)return _(B(e));if(e instanceof Uint8Array)return 0===e.length?q():_(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?_(B(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?_(B(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?_(B(e.bytes)):0===e.bytes.length?q():_(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length&&!t.burnPool&&!t.mintPool)throw new Error("Stellar builder: `steps.paths` needs a strategy path or a liquidity burn/mint operation");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const r=new Map;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!l.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const t=o.hops[0];r.set(t.tokenIn,(r.get(t.tokenIn)??0)+o.splitPpm)}for(const[e,o]of r){if(o>p)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==p)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),s.xdr.ScVal.scvBytes(u.hp.from(k(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},C=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=u.hp.from(t,"hex");return s.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return s.xdr.ScVal.scvBytes(u.hp.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function M(e,t){if("number"!=typeof t||!Number.isInteger(t)||t<0||t>18)throw new Error("Token decimals must be an integer from 0 to 18");if("string"!=typeof e||!/^\d+(?:\.\d+)?$/.test(e))throw new Error("Token amount must be plain decimal text");const r=s.Soroban.parseTokenAmount(e,t),o=BigInt(r);if(o<=0n||o>(1n<<127n)-1n)throw new Error("Token amount must be within the positive i128 range");return r}function U(e,t,r){if(!e.controllerAddress)throw new Error("Stellar lending controllerAddress is required");const o=new s.Contract(e.controllerAddress),n=new s.Account(e.caller,e.sourceSequence);return{xdr:new s.TransactionBuilder(n,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[e.network]}).addOperation(o.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function L(e){if(!Number.isInteger(e)||e<1||e>4294967295)throw new Error("Stellar builder: spokeId must be an integer from 1 to 4294967295");return h(e)}function N(e,t){const r=t.accountNonce??0;return U(e,"supply",[c(e.caller),g(r),L(t.spokeId),I([...t.assets])])}function D(e,t){return N(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function $(e,t){return U(e,"borrow",[c(e.caller),g(t.accountNonce),I([...t.borrows]),T(t.to,c)])}function W(e,t){return $(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function F(e,t){return U(e,"withdraw",[c(e.caller),g(t.accountNonce),I([...t.withdrawals]),T(t.to,c)])}function z(e,t){return F(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function G(e,t){return U(e,"repay",[c(e.caller),g(t.accountNonce),I([...t.payments])])}function H(e,t){return G(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function V(e,t){return U(e,"liquidate",[c(e.caller),g(t.accountNonce),I([...t.debtPayments]),R(t.seizeMode??"Transfer")])}function X(e){const t=(0,s.scValToNative)(s.xdr.ScVal.fromXDR(e,"base64"));if("bigint"==typeof t||"number"==typeof t)return t.toString();throw new Error("Stellar builder: liquidate return value must be a u64, got "+typeof t)}function j(e,t){return U(e,"get_liquidation_estimate",[g(t.accountNonce),I([...t.debtPayments]),R(t.seizeMode??"Transfer")])}const K=e=>(Array.isArray(e)?e:[]).map((e=>{const t=e;return{asset:String(t.asset),amount:String(t.amount)}}));function Z(e){const t=(0,s.scValToNative)(s.xdr.ScVal.fromXDR(e,"base64"));if(!t||"object"!=typeof t||Array.isArray(t))throw new Error("Stellar builder: liquidation estimate must be a struct");return{seizedCollaterals:K(t.seized_collaterals),protocolFees:K(t.protocol_fees),refunds:K(t.refunds),maxPaymentWad:String(t.max_payment_wad),bonusRateBps:String(t.bonus_rate_bps)}}function Y(e,t){return U(e,"flash_loan",[c(e.caller),A(t.hubId,t.asset),f(t.amount),c(t.receiver),C(t.data)])}function Q(e,t){return U(e,"migrate_from_blend",[c(e.caller),g(t.accountId),L(t.spokeId),h(t.hubId),c(t.blendPool),w(t.collateralTokens.map(c)),w(t.supplyTokens.map(c)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),s.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,s.xdr.ScVal.scvVec([c(t),f(r)]);var t,r}))))]);var r}function J(e,t){const r=t.accountNonce??0;return U(e,"multiply",[c(e.caller),g(r),L(t.spokeId),A(t.collateral.hubId,t.collateral.asset),f(t.debtToFlashLoan),A(t.debt.hubId,t.debt.asset),h(t.mode),O(t.steps),T(t.initialPayment,(e=>x(e.hubId,e.asset,e.amount))),T(t.convertSwap,O)])}function ee(e,t){return U(e,"swap_debt",[c(e.caller),g(t.accountNonce),A(t.existingDebt.hubId,t.existingDebt.asset),f(t.newDebtAmount),A(t.newDebt.hubId,t.newDebt.asset),O(t.steps)])}function te(e,t){return U(e,"swap_collateral",[c(e.caller),g(t.accountNonce),A(t.current.hubId,t.current.asset),f(t.fromAmount),A(t.newCollateral.hubId,t.newCollateral.asset),O(t.steps)])}function re(e,t){return U(e,"repay_debt_with_collateral",[c(e.caller),g(t.accountNonce),A(t.collateral.hubId,t.collateral.asset),f(t.collateralAmount),A(t.debt.hubId,t.debt.asset),O(t.steps),m(t.closePosition)])}var oe=r(928);const ne="/stellar-lending",ie=encodeURIComponent,ae=(e,t)=>e.fetchWithTimeout(`${ne}/context`,t),se=(e,t)=>e.fetchWithTimeout(`${ne}/live-state`,t),ue=(e,t)=>e.fetchWithTimeout(`${ne}/markets/detailed`,t),le=(e,t)=>e.fetchWithTimeout(`${ne}/assets`,t),de=(e,t)=>e.fetchWithTimeout(`${ne}/hubs`,t),pe=(e,t)=>e.fetchWithTimeout(`${ne}/spokes`,t),ce=(e,t={},r)=>e.fetchWithTimeout(`${ne}/reserves`,{...r,params:{...t}}),fe=(e,t,r,o,n)=>e.fetchWithTimeout(`${ne}/reserves/${t}/${r}/${ie(o)}`,n),he=(e,t,r)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}`,r),ge=(e,t,r)=>e.fetchWithTimeout(`${ne}/hubs/${t}`,r),me=(e,t,r)=>e.fetchWithTimeout(`${ne}/spokes/${t}`,r),ye=(e,t,r)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/positions`,r),be=(e,t,r)=>e.fetchWithTimeout(`${ne}/accounts/${ie(t)}/positions`,r),Se=(e,t,r)=>e.fetchWithTimeout(`/user/${ie(t)}/token-inventory`,r),we=async(e,t,r,o)=>{const n=await Se(e,t,o),i=e.chain===oe.sW.MAINNET?"mainnet":"testnet",a=(n?.tokens??[]).find((e=>e.identifier===r));if(a)return{owner:t,network:a.stellarNetwork??i,asset:r,amount:String(a.balance),decimals:a.decimals};const{decimals:s}=await he(e,r,o);if("number"!=typeof s)throw new Error(`Stellar lending: no decimals for ${r}; it is not a lending asset`);return{owner:t,network:i,asset:r,amount:"0",decimals:s}},ve=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}/page`,{...o,params:{...r}}),Te=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}/markets`,{...o,params:{side:r}}),Ae=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${ne}/reserves/${t}/${r}/${ie(o)}/holders`,{...i,params:{side:n}}),xe=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/hubs/${t}/holders`,{...o,params:{side:r}}),Ie=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/spokes/${t}/holders`,{...o,params:{side:r}}),Re=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/assets/${ie(t)}/graph`,{...o,params:{...r}}),Ee=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/hubs/${t}/graph`,{...o,params:{...r}}),Pe=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/spokes/${t}/graph`,{...o,params:{...r}}),ke=(e,t,r,o,n,i)=>e.fetchWithTimeout(`${ne}/reserves/${t}/${r}/${ie(o)}/graph`,{...i,params:{...n}}),_e=(e,t,r={},o)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/activity`,{...o,params:{...r}}),qe=(e,t,r={},o)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/activity/page`,{...o,params:{...r}}),Be=(e,t={},r)=>e.fetchWithTimeout(`${ne}/governance/proposals`,{...r,params:{...t}}),Oe=(e,t={},r)=>e.fetchWithTimeout(`${ne}/positions`,{...r,params:{...t}}),Ce=(e,t={},r)=>e.fetchWithTimeout(`${ne}/participants`,{...r,params:{...t}}),Me=(e,t={},r)=>e.fetchWithTimeout(`${ne}/liquidations/leaderboard`,{...r,params:{...t}}),Ue=(e,t={},r)=>e.fetchWithTimeout(`${ne}/distribution`,{...r,params:{...t}}),Le=(e,t={},r)=>e.fetchWithTimeout(`${ne}/campaign/leaderboard`,{...r,params:{...t}}),Ne=(e,t,r)=>e.fetchWithTimeout(`${ne}/stats/history`,{...r,params:{...t}}),De=(e,t,r)=>e.fetchWithTimeout(`${ne}/revenue`,{...r,params:{...t}}),$e=(e,t,r)=>e.fetchWithTimeout(`${ne}/revenue/fees`,{...r,params:{...t}}),We=(e,t,r)=>e.fetchWithTimeout(`${ne}/liquidations`,{...r,params:{...t}}),Fe=(e,t,r)=>e.fetchWithTimeout(`${ne}/volume`,{...r,params:{...t}}),ze=(e,t,r)=>e.fetchWithTimeout(`${ne}/active-users`,{...r,params:{...t}}),Ge=(e,t,r)=>e.fetchWithTimeout(`${ne}/rate-spread`,{...r,params:{...t}}),He=(e,t,r)=>e.fetchWithTimeout(`${ne}/defillama`,{...r,params:{...t}}),Ve=(e,t,r,o)=>e.fetchWithTimeout(`${ne}/users/${ie(t)}/history`,{...o,params:{...r}}),Xe=(e,t,r)=>e.fetchWithTimeout(`${ne}/pnl`,{...r,params:{accountId:t}}),je=(e,t,r)=>e.fetchWithTimeout(`${ne}/pnl/scope`,{...r,params:{scope:t}}),Ke=(e,t,r)=>e.fetchWithTimeout(`${ne}/campaign/me`,{...r,params:{owner:t}}),Ze=e=>({context:t=>ae(e,t),liveState:t=>se(e,t),marketsDetailed:t=>ue(e,t),assets:t=>le(e,t),hubs:t=>de(e,t),spokes:t=>pe(e,t),reserves:(t={},r)=>void 0!==r||"hubId"in t||"spokeId"in t||"asset"in t?ce(e,t,r):ce(e,{},t),reserve:(t,r,o,n)=>fe(e,t,r,o,n),asset:(t,r)=>he(e,t,r),hub:(t,r)=>ge(e,t,r),spoke:(t,r)=>me(e,t,r),userPositions:(t,r)=>ye(e,t,r),accountPositions:(t,r)=>be(e,t,r),walletTokens:(t,r)=>Se(e,t,r),walletBalance:(t,r,o)=>we(e,t,r,o),assetPage:(t,r,o)=>ve(e,t,r,o),assetMarkets:(t,r,o)=>Te(e,t,r,o),reserveHolders:(t,r,o,n,i)=>Ae(e,t,r,o,n,i),hubHolders:(t,r,o)=>xe(e,t,r,o),spokeHolders:(t,r,o)=>Ie(e,t,r,o),assetGraph:(t,r,o)=>Re(e,t,r,o),hubGraph:(t,r,o)=>Ee(e,t,r,o),spokeGraph:(t,r,o)=>Pe(e,t,r,o),reserveGraph:(t,r,o,n,i)=>ke(e,t,r,o,n,i),userActivity:(t,r={},o)=>_e(e,t,r,o),userActivityPage:(t,r={},o)=>qe(e,t,r,o),governanceProposals:(t={},r)=>Be(e,t,r),positionsLeaderboard:(t={},r)=>Oe(e,t,r),participants:(t={},r)=>Ce(e,t,r),liquidationsLeaderboard:(t={},r)=>Me(e,t,r),distribution:(t={},r)=>Ue(e,t,r),campaignLeaderboard:(t={},r)=>Le(e,t,r),statsHistory:(t,r)=>Ne(e,t,r),revenue:(t,r)=>De(e,t,r),feeRevenue:(t,r)=>$e(e,t,r),liquidations:(t,r)=>We(e,t,r),volume:(t,r)=>Fe(e,t,r),activeUsers:(t,r)=>ze(e,t,r),rateSpread:(t,r)=>Ge(e,t,r),defillama:(t,r)=>He(e,t,r),userHistory:(t,r,o)=>Ve(e,t,r,o),positionsPnl:(t,r)=>Xe(e,t,r),pnlByScope:(t,r)=>je(e,t,r),campaignMe:(t,r)=>Ke(e,t,r)});var Ye=r(468);const Qe=e=>E({base_borrow_rate:f(e.baseBorrowRateRay),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),Je=e=>E({asset_decimals:h(e.assetDecimals),asset_id:c(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:m(e.isFlashloanable),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),et=e=>E({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),tt=e=>{if("Token"in e&&e.Token)return w([b("Token"),c(e.Token)]);if("Ref"in e&&e.Ref)return w([b("Ref"),b(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},rt=e=>{if("Stellar"in e)return w([b("Stellar"),c(e.Stellar)]);if("Symbol"in e)return w([b("Symbol"),b(e.Symbol)]);if("String"in e)return w([b("String"),y(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},ot=e=>{if("Spot"===e)return w([b("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return w([b("Twap"),h(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},nt=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},it=e=>{if("Market"===e||"Fundamental"===e)return w([b(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},at=e=>{if("Reflector"in e){const t=e.Reflector;return w([b("Reflector"),E({asset:rt(t.asset),contract:c(t.contract),read_mode:ot(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return w([b("MultiFeed"),E({contract:c(t.contract),feed_id:y(t.feedId),kind:nt(t.kind),nature:it(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},st=e=>{const t=e;return E({decimals:h(t.decimals),max_stale_seconds:g(t.maxStaleSeconds),provider:at(t.provider)})},ut=e=>{if("RequireDisjoint"===e)return w([b("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return w([b("AllowShared"),w(t.map((e=>E({contract:c(e.contract),kind:nt(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},lt=e=>{const t=e,r=t.sources??[];let o,n;if("number"==typeof t.toleranceBps)o=1e4+t.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const e=t.tolerance??{};o=Number(e.upperRatioBps),n=Number(e.lowerRatioBps)}return E({asset_decimals:h(Number(t.assetDecimals)),independence:ut(t.independence),max_price_stale_seconds:g(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:f(String(t.maxSanityPriceWad)),min_sanity_price_wad:f(String(t.minSanityPriceWad)),sources:w(r.map((e=>(e=>{if("Feed"in e)return w([b("Feed"),st(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return w([b("Scaled"),E({factor:st(t.factor),max_factor_wad:f(t.maxFactorWad),min_factor_wad:f(t.minFactorWad),quote:tt(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return w([b("LpShare"),E({key_a:tt(t.keyA),key_b:tt(t.keyB),kind:w([b(t.kind||"ConstantProduct")]),pool:c(t.pool),reserve_a_decimals:h(t.reserveADecimals),reserve_b_decimals:h(t.reserveBDecimals),share_decimals:h(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:E({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})})};function dt(e,t){return U(e,"upgrade",[v(t.wasmHash)])}function pt(e,t){return U(e,"migrate",[h(t.newVersion)])}function ct(e){return U(e,"pause",[])}function ft(e){return U(e,"unpause",[])}function ht(e,t){return U(e,"grant_role",[c(t.account),b(t.role)])}function gt(e,t){return U(e,"revoke_role",[c(t.account),b(t.role)])}function mt(e,t){return U(e,"transfer_ownership",[c(t.newOwner),h(t.liveUntilLedger)])}function yt(e){return U(e,"accept_ownership",[])}function bt(e,t){return U(e,"set_swap_aggregator",[c(t.aggregator)])}function St(e,t){return U(e,"set_price_aggregator",[c(t.aggregator)])}function wt(e,t){return U(e,"set_accumulator",[c(t.accumulator)])}function vt(e,t){return U(e,"set_position_limits",[et(t)])}function Tt(e,t){return U(e,"approve_blend_pool",[c(t.pool)])}function At(e,t){return U(e,"revoke_blend_pool",[c(t.pool)])}function xt(e,t){return U(e,"set_oracle",[tt(t.key),lt(t.oracle)])}function It(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return U(e,"set_tolerance",[tt(t.key),E({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})])}function Rt(e,t){return U(e,"set_spoke_asset_flags",[h(t.spokeId),A(t.hubId,t.asset),m(t.paused),m(t.frozen),m(t.noSeize)])}function Et(e,t){return U(e,"set_oracle_sanity_bounds",[c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Pt(e,t){return U(e,"update_indexes",[c(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function kt(e,t){return U(e,"renew_account",[c(e.caller),g(t.accountNonce)])}function _t(e,t){return U(e,"create_liquidity_pool",[h(t.hubId),c(t.asset),Je(t.params)])}function qt(e,t){return U(e,"upgrade_liquidity_pool_params",[A(t.hubId,t.asset),Qe(t.params)])}function Bt(e,t){return U(e,"claim_revenue",[c(e.caller),w(t.assets.map((e=>A(e.hubId,e.asset))))])}function Ot(e,t){return U(e,"add_rewards",[c(e.caller),I(t.rewards)])}function Ct(e,t){return U(e,"update_account_threshold",[c(e.caller),m(t.hasRisks),w(t.accountNonces.map((e=>g(e))))])}const Mt="00".repeat(32),Ut=e=>{if("string"==typeof e)return v(e);const t=u.hp.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return s.xdr.ScVal.scvBytes(t)},Lt=(e,...t)=>w([b(e),...t]),Nt=e=>E({new_owner:c(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),Dt=e=>E({asset:c(e.asset),bonus:h(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:m(e.canBorrow),can_collateral:m(e.canCollateral),frozen:m(e.frozen),hub_id:h(e.hubId),paused:m(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),no_seize:m(e.noSeize),spoke_id:h(e.spokeId),supply_cap:f(e.supplyCap),threshold:h(e.threshold)}),$t=e=>E({account:c(e.account),role:b(e.role)});function Wt(e,t,r){if(!e.governanceAddress)throw new Error("Stellar governanceAddress is required");const o=new s.Contract(e.governanceAddress),n=new s.Account(e.caller,e.sourceSequence);return{xdr:new s.TransactionBuilder(n,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[e.network]}).addOperation(o.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Ft=(e,t,r)=>Wt(e,"propose",[c(e.caller),t,Ut(r)]),zt=(e,t,r)=>Wt(e,"execute_self",[S(),t,Ut(r)]);function Gt(e,t,r){return Ft(e,Lt("SetSwapAggregator",c(t.aggregator)),r)}function Ht(e,t,r){return Ft(e,Lt("SetPriceAggregator",c(t.aggregator)),r)}function Vt(e,t,r){return Ft(e,Lt("SetAccumulator",c(t.accumulator)),r)}function Xt(e,t,r){return Ft(e,Lt("SetPositionLimits",et(t)),r)}function jt(e,t){return Ft(e,Lt("CreateHub"),t)}function Kt(e,t){return Ft(e,Lt("AddSpoke"),t)}function Zt(e,t,r){return Ft(e,Lt("RemoveSpoke",h(t.spokeId)),r)}function Yt(e,t,r){return Ft(e,Lt("AddAssetToSpoke",Dt(t)),r)}function Qt(e,t,r){return Ft(e,Lt("EditAssetInSpoke",Dt(t)),r)}function Jt(e,t,r){return Ft(e,Lt("RemoveAssetFromSpoke",E({hub_asset:A((o=t).hubId,o.asset),spoke_id:h(o.spokeId)})),r);var o}function er(e,t,r){return Ft(e,Lt("SetSpokeLiquidationCurve",E({hf_for_max_bonus_wad:f((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:h(o.liquidationBonusFactorBps),spoke_id:h(o.spokeId),target_hf_wad:f(o.targetHfWad)})),r);var o}function tr(e,t,r){return Ft(e,Lt("SetPositionManager",c(t.manager),m(t.isActive)),r)}function rr(e,t,r){return Ft(e,Lt("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function or(e,t,r){return Ft(e,Lt("ApproveToken",c(t.token)),r)}function nr(e,t,r){return Ft(e,Lt("RevokeToken",c(t.token)),r)}function ir(e,t,r){return Ft(e,Lt("ApproveBlendPool",c(t.pool)),r)}function ar(e,t,r){return Ft(e,Lt("RevokeBlendPool",c(t.pool)),r)}function sr(e,t,r){return Ft(e,Lt("CreateLiquidityPool",E({asset:c((o=t).asset),hub_id:h(o.hubId),params:Je(o.params)})),r);var o}function ur(e,t,r){return Ft(e,Lt("UpgradeLiquidityPoolParams",E({hub_asset:A((o=t).hubId,o.asset),params:Qe(o.params)})),r);var o}function lr(e,t,r){return Ft(e,Lt("DeployPool",v(t.wasmHash)),r)}function dr(e,t,r){return Ft(e,Lt("UpgradePool",v(t.wasmHash)),r)}function pr(e,t,r){return Ft(e,Lt("UpgradeController",v(t.wasmHash)),r)}function cr(e,t,r){return Ft(e,Lt("MigrateController",h(t.newVersion)),r)}function fr(e,t,r){return Ft(e,Lt("TransferCtrlOwnership",Nt(t)),r)}function hr(e,t,r){return Ft(e,Lt("ConfigureAssetOracle",E({key:tt((o=t).key),oracle:lt(o.oracle)})),r);var o}function gr(e,t,r){return Ft(e,Lt("EditOracleTolerance",E({key:tt((o=t).key),tolerance:h(o.tolerance)})),r);var o}function mr(e,t,r){return Ft(e,Lt("UpgradeGov",v(t.wasmHash)),r)}function yr(e,t,r){return Ft(e,Lt("UpdateGovDelay",h(t.newDelay)),r)}function br(e,t,r){return Ft(e,Lt("GrantGovRole",$t(t)),r)}function Sr(e,t,r){return Ft(e,Lt("RevokeGovRole",$t(t)),r)}function wr(e,t,r){return Ft(e,Lt("TransferGovOwnership",Nt(t)),r)}function vr(e,t){const r=w(t.argsXdr.map((e=>s.xdr.ScVal.fromXDR(e,"base64")))),o=Ut(t.predecessor??Mt);return Wt(e,"execute",[S(),c(t.target),b(t.functionName),r,o,Ut(t.salt)])}function Tr(e,t,r){return zt(e,Lt("UpgradeGov",v(t.wasmHash)),r)}function Ar(e,t,r){return zt(e,Lt("UpdateGovDelay",h(t.newDelay)),r)}function xr(e,t,r){return zt(e,Lt("GrantGovRole",$t(t)),r)}function Ir(e,t,r){return zt(e,Lt("RevokeGovRole",$t(t)),r)}function Rr(e,t,r){return zt(e,Lt("TransferGovOwnership",Nt(t)),r)}const Er=e=>w(e.map(c));function Pr(e,t,r){return Wt(e,"propose_canceller_reset",[Er(t.newCancellers),Ut(r)])}function kr(e,t,r){return Wt(e,"execute_canceller_reset",[T(t.executor,c),Er(t.newCancellers),Ut(r)])}function _r(e,t){return Wt(e,"set_spoke_asset_flags",[c(e.caller),h(t.spokeId),A(t.hubId,t.asset),m(t.paused),m(t.frozen),m(t.noSeize)])}function qr(e,t){return Wt(e,"set_oracle_sanity_bounds",[c(e.caller),c(t.asset),f(t.minPriceWad),f(t.maxPriceWad)])}function Br(e){return Wt(e,"create_hub",[c(e.caller)])}function Or(e){return Wt(e,"add_spoke",[c(e.caller)])}function Cr(e,t){return Wt(e,"revoke_role_immediate",[c(t.account),b(t.role)])}function Mr(e){return Wt(e,"pause",[c(e.caller)])}function Ur(e,t){return Ft(e,Lt("Unpause"),t)}const Lr=e=>e.toXDR("base64"),Nr=e=>s.xdr.ScVal.fromXDR(e,"base64"),Dr=e=>e.map((e=>String((0,s.scValToNative)(Nr(e))))).join(":"),$r=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Wr=e=>Number(e),Fr=e=>String(e),zr=e=>e instanceof Uint8Array?u.hp.from(e).toString("hex"):u.hp.isBuffer(e)?e.toString("hex"):String(e),Gr=["None","Multiply","Long","Short"],Hr=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net","liq_credit","flash_pos"],Vr=e=>Array.isArray(e)?e:[],Xr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],Hr[Wr(o)]??$r(o)),positionType:t,hubId:Wr(e[1]),asset:Fr(e[2]),scaledAmountRay:$r(e[3]),indexRay:$r(e[4]),amount:$r(e[5]),liquidationThresholdBps:r?void 0:Wr(e[6]),liquidationBonusBps:r?void 0:Wr(e[7]),loanToValueBps:r?void 0:Wr(e[8]),liquidationFeesBps:r?void 0:Wr(e[9])};var o},jr=e=>{return{owner:Fr(e[0]),spokeId:Wr(e[1]),mode:(t=e[2],Gr[Wr(t)]??"None")};var t},Kr=e=>Array.isArray(e)?e[1]:void 0,Zr=e=>{const t=(r=e,Array.isArray(r)?Fr(r[0]):Fr(r));var r;if("Token"===t)return{Token:Fr(Kr(e))};if("Ref"===t)return{Ref:Fr(Kr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Fr(t.Token)};if(void 0!==t.Ref)return{Ref:Fr(t.Ref)}}return{Token:Fr(e)}},Yr=e=>{const t=e.tolerance??{};return{assetDecimals:Wr(e.asset_decimals),maxPriceStaleSeconds:Wr(e.max_price_stale_seconds),sources:Vr(e.sources).map((e=>e)),tolerance:{upperRatio:Wr(t.upper_ratio_bps),lowerRatio:Wr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:$r(e.min_sanity_price_wad),maxSanityPriceWad:$r(e.max_sanity_price_wad)}},Qr={"market:create":e=>({topic:"market:create",data:{hubId:Wr(e.hub_id),baseAsset:Fr(e.base_asset),maxBorrowRate:$r(e.max_borrow_rate),baseBorrowRate:$r(e.base_borrow_rate),slope1:$r(e.slope1),slope2:$r(e.slope2),slope3:$r(e.slope3),midUtilization:$r(e.mid_utilization),optimalUtilization:$r(e.optimal_utilization),maxUtilization:$r(e.max_utilization),reserveFactor:Wr(e.reserve_factor),marketAddress:Fr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{hubId:void 0===e.hub_id?void 0:Wr(e.hub_id),asset:Fr(e.asset),maxBorrowRateRay:$r(e.max_borrow_rate),baseBorrowRateRay:$r(e.base_borrow_rate),slope1Ray:$r(e.slope1),slope2Ray:$r(e.slope2),slope3Ray:$r(e.slope3),midUtilizationRay:$r(e.mid_utilization),optimalUtilizationRay:$r(e.optimal_utilization),maxUtilizationRay:$r(e.max_utilization),reserveFactorBps:Wr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Vr(e).map((e=>{return t=Vr(e),{hubId:Wr(t[0]),asset:Fr(t[1]),timestamp:Wr(t[2]),supplyIndexRay:$r(t[3]),borrowIndexRay:$r(t[4]),cash:$r(t[5]),suppliedRay:$r(t[6]),borrowedRay:$r(t[7]),revenueRay:$r(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Vr(e).map((e=>{const t=e;return{hubId:Wr(t.hub_id),asset:Fr(t.asset),params:(r=t.params,{maxBorrowRateRay:$r(r.max_borrow_rate),baseBorrowRateRay:$r(r.base_borrow_rate),slope1Ray:$r(r.slope1),slope2Ray:$r(r.slope2),slope3Ray:$r(r.slope3),midUtilizationRay:$r(r.mid_utilization),optimalUtilizationRay:$r(r.optimal_utilization),maxUtilizationRay:$r(r.max_utilization),reserveFactorBps:Wr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Wr(r.flashloan_fee),assetId:Fr(r.asset_id),assetDecimals:Wr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Vr(e);return{topic:"position:batch_update",data:{accountId:$r(t[0]),accountAttributes:jr(Vr(t[1])),updates:[...Vr(t[2]).map((e=>Xr(Vr(e),"Deposit"))),...Vr(t[3]).map((e=>Xr(Vr(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Wr(e.hub_id),asset:Fr(e.asset),receiver:Fr(e.receiver),caller:Fr(e.caller),amount:$r(e.amount),fee:$r(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Zr(e.key),oracle:Yr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Fr(e.asset),oracle:Yr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Fr(e.liquidator),accountId:$r(e.account_id),repaidUsdWad:$r(e.repaid_usd_wad),bonusBps:$r(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:$r(e.account_id),totalBorrowUsdWad:$r(e.total_borrow_usd_wad),totalCollateralUsdWad:$r(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Fr(e.token),amount:$r(e.amount),usdValueWad:void 0===e.usd_value_wad?void 0:$r(e.usd_value_wad),accountId:$r(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Wr(e.hub_id),asset:Fr(e.asset),amount:$r(e.amount),fee:$r(e.fee),amountSent:$r(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Fr(e.pool??e.blend_pool??e.token),approved:Boolean(e.approved??e.is_approved??!0)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:zr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Fr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Fr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Fr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Fr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:zr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Wr(e.max_supply_positions),maxBorrowPositions:Wr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:$r(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Fr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Wr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:$r(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:$r(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Wr(t.liquidation_bonus_factor_bps)}}},"position:flash_position":e=>({topic:"position:flash_position",data:{accountId:$r(e.account_id),hubId:Wr(e.hub_id),asset:Fr(e.asset),receiver:Fr(e.receiver),caller:Fr(e.caller),amount:$r(e.amount),amountReceived:$r(e.amount_received),fee:$r(e.fee)}}),"revenue:claim":e=>({topic:"revenue:claim",data:{hubId:Wr(e.hub_id),asset:Fr(e.asset),caller:Fr(e.caller),accumulator:Fr(e.accumulator),amount:$r(e.amount)}}),"account:delegate":e=>({topic:"account:delegate",data:{accountId:$r(e.account_id),owner:Fr(e.owner),delegate:Fr(e.delegate),granted:Boolean(e.granted)}}),"config:hub":e=>({topic:"config:hub",data:{hubId:Wr(e.hub_id)}}),"config:spoke_asset":e=>{const t=e.config;return{topic:"config:spoke_asset",data:{spokeId:Wr(e.spoke_id),hubId:Wr(e.hub_id),asset:Fr(e.asset),config:{isCollateralizable:Boolean(t.is_collateralizable),isBorrowable:Boolean(t.is_borrowable),paused:Boolean(t.paused),frozen:Boolean(t.frozen),noSeize:Boolean(t.no_seize),loanToValueBps:Wr(t.loan_to_value),liquidationThresholdBps:Wr(t.liquidation_threshold),liquidationBonusBps:Wr(t.liquidation_bonus),liquidationFeesBps:Wr(t.liquidation_fees),supplyCap:$r(t.supply_cap),borrowCap:$r(t.borrow_cap)}}}},"config:remove_spoke_asset":e=>({topic:"config:remove_spoke_asset",data:{spokeId:Wr(e.spoke_id),hubId:Wr(e.hub_id),asset:Fr(e.asset)}}),"strategy:blend_migration":e=>({topic:"strategy:blend_migration",data:{accountId:$r(e.account_id),blendPool:Fr(e.blend_pool),collateralCount:Wr(e.collateral_count),supplyCount:Wr(e.supply_count),debtCount:Wr(e.debt_count)}}),"strategy:harvest":e=>({topic:"strategy:harvest",data:{from:Fr(e.from),amount:$r(e.amount),pricePerShare:$r(e.price_per_share)}}),"governance:deploy_controller":e=>({topic:"governance:deploy_controller",data:{controller:Fr(e.controller),wasmHash:zr(e.wasm_hash)}}),"governance:deploy_price_aggregator":e=>({topic:"governance:deploy_price_aggregator",data:{priceAggregator:Fr(e.price_aggregator),wasmHash:zr(e.wasm_hash)}})},Jr=Object.freeze(Object.keys(Qr));function eo(e,t){const r=Dr(e),o=Qr[r];return o?o((0,s.scValToNative)(Nr(t))):null}const to=1e4;function ro(e,t){return`${e}-${BigInt(t).toString(10)}`}function oo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function no(e,t=0){return e*to+t}function io(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"liq_credit":default:return"lendingUpdateAccountPosition";case"param_upd":return"lendingUpdateAccountParameters"}}const ao=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()};async function so(e,t){if(!t.baseUrl)throw new Error("Stellar quote baseUrl is required");if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=ao(t.baseUrl,"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,simulate:e.simulate,referralId:e.referralId,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function uo(e){if(!e.baseUrl)throw new Error("Stellar quote baseUrl is required");const t=ao(e.baseUrl,"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}function lo(e,t){const r=e[t];return"function"==typeof r?r.call(e):r}function po(e){if(!e||"object"!=typeof e)return;const t=e;return"function"==typeof t.switch?t.switch().name:t.type}function co(e){return fo(lo(e,"bytes"))}function fo(e){const t=e;return u.hp.from("value"in t?t.value:t)}const ho=16384;class go extends Error{code;constructor(e,t){super(`Stellar route verification failed [${e}]: ${t}`),this.name="StellarRouteVerificationError",this.code=e}}const mo=(e,t)=>{throw new go(e,t)};function yo(e){const t=(e=>{const t="string"==typeof e?e:e&&"object"==typeof e&&"routeXdr"in e?e.routeXdr:void 0;if("string"==typeof t&&t.length>2*ho)return mo("OVERSIZED",`encoded route has ${t.length} characters`);try{return co(O(e))}catch(e){return mo("MALFORMED",e instanceof Error?e.message:String(e))}})(e);0===t.length&&mo("MALFORMED","route is empty"),t.length>ho&&mo("OVERSIZED",`route has ${t.length} bytes, above ${ho}`);const r=(e=>{let t;try{t=s.xdr.ScVal.fromXDR(e)}catch(e){return mo("MALFORMED",`payload is not one XDR ScVal: ${e instanceof Error?e.message:String(e)}`)}if("scvMap"!==po(t))return mo("MALFORMED","payload must be a StrategyPayload map");const r=lo(t,"map")??[];if("amounts,assets,ops"!==r.map((e=>"scvSymbol"===po(lo(e,"key"))?lo(lo(e,"key"),"sym").toString():"")).join(","))return mo("MALFORMED","payload fields must be exactly amounts, assets, ops");const[o,n,i]=r.map((e=>lo(e,"val")));return"scvVec"!==po(o)||"scvVec"!==po(n)||"scvBytes"!==po(i)?mo("MALFORMED","payload field has the wrong type"):{amounts:lo(o,"vec")??[],assets:lo(n,"vec")??[],ops:co(i)}})(t),o=r.assets.length,n=r.amounts.length;0===o&&mo("MALFORMED","asset registry is empty"),(o>256||n>126)&&mo("OVERSIZED",`registries hold ${o} assets and ${n} amounts`);const i=r.assets.map(((e,t)=>"scvAddress"!==po(e)?mo("MALFORMED",`assets[${t}] is not an address`):s.Address.fromScAddress(lo(e,"address")).toString())),a=r.amounts.map(((e,t)=>"scvI128"!==po(e)?mo("MALFORMED",`amounts[${t}] is not an i128`):(0,s.scValToBigInt)(e))),u=r.ops;u.length<10&&mo("MALFORMED","program header is truncated"),u.length>346&&mo("OVERSIZED",`program has ${u.length} bytes, above 346`);const c=e=>{const t=u[e];return void 0===t?mo("MALFORMED",`program byte ${e} is missing`):t},f=c(0);1!==f&&mo("UNSUPPORTED_VERSION",`program version ${f}, expected 1`);const h=c(8),g=c(9);0===h&&mo("INVALID_STRUCTURE","program has no instructions"),(h>48||g>32)&&mo("OVERSIZED",`program declares ${h} instructions and ${g} weights`);const m=10+5*h;u.length!==m+3*g&&mo("MALFORMED","program length does not match its instruction and weight counts");const y=c(1),b=c(2),S=c(3);(y>=o||b>=o||S>=n)&&mo("MALFORMED","header index is outside its registry"),y===b&&mo("INVALID_STRUCTURE","token_in equals token_out");const w=u.readUInt32BE(4),v=[];for(let e=0;e<g;e+=1){const t=u.readUIntBE(m+3*e,3);(0===t||t>p)&&mo("INVALID_STRUCTURE",`split weight ${t} outside 1..=1000000`),v.push(t)}const T=e=>i[e]??mo("MALFORMED",`asset index ${e} is outside the registry`),A=e=>a[e]??mo("MALFORMED",`amount index ${e} is outside the registry`),x=[];let I;for(let e=0;e<h;e+=1){const t=10+5*e,r=c(t),o=c(t+1),i=c(t+2),a=c(t+3),s=c(t+4),u=l.find((e=>d[e]===r));let p;if(u||5===r||6===r||mo("UNKNOWN_OPCODE",`instruction ${e} has opcode ${r}`),0===o)p={kind:"all"};else if(1===o)void 0!==I&&I===a||mo("INVALID_STRUCTURE",`instruction ${e} does not chain onto its predecessor`),p={kind:"prev"};else if(o>=128){const t=v[o-128];void 0===t&&mo("MALFORMED",`instruction ${e} weight index is out of range`),p={kind:"ppm",ppm:t}}else p={kind:"fixed",amount:A(o-2)};const f=T(i);5!==r&&6!==r?(a===s&&mo("INVALID_STRUCTURE",`instruction ${e} swaps a token for itself`),x.push({kind:"swap",venue:u,mode:p,pool:f,tokenIn:T(a),tokenOut:T(s)}),I=s):("all"!==p.kind&&mo("MALFORMED",`liquidity instruction ${e} must use mode All`),s>=n&&mo("MALFORMED",`instruction ${e} amount index is out of range`),x.push({kind:5===r?"burn":"mint",pool:f,shareToken:T(a),amountIndex:s}),I=6===r?a:void 0)}const R=A(S);return R<=0n&&mo("MIN_OUT_TOO_LOW",`encoded total_min_out is ${R}`),{version:f,tokenIn:T(y),tokenOut:T(b),totalMinOut:R,referralId:w,assets:i,amounts:a,ops:x,weights:v}}function bo(e,t){if(s.StrKey.isValidContract(e))return e;if(!t)return mo("EXPECTATION_MISSING",`token ${e} is not a contract id; pass \`network\` to derive its asset contract`);try{const r=e.indexOf(":");return("XLM"===e||"native"===e?s.Asset.native():new s.Asset(e.slice(0,r),e.slice(r+1))).contractId(a[t])}catch{return mo("MALFORMED",`token id ${e} is not a contract id or a classic asset`)}}const So=(e,t)=>"bigint"==typeof e?e:/^\d+$/.test(e)?BigInt(e):mo("EXPECTATION_MISSING",`${t} must be a base-unit integer string`);function wo(e,t){const r=So(t.minOut,"expected.minOut");r<=0n&&mo("EXPECTATION_MISSING","expected.minOut must be positive");const o=yo(e);if(o.tokenIn!==t.tokenIn&&mo("TOKEN_IN_MISMATCH",`route spends ${o.tokenIn}, expected ${t.tokenIn}`),o.tokenOut!==t.tokenOut&&mo("TOKEN_OUT_MISMATCH",`route delivers ${o.tokenOut}, expected ${t.tokenOut}`),o.totalMinOut<r&&mo("MIN_OUT_TOO_LOW",`route enforces a minimum of ${o.totalMinOut}, below the expected ${r}`),void 0!==t.amountIn){const e=So(t.amountIn,"expected.amountIn");for(const t of o.ops)"swap"===t.kind&&"fixed"===t.mode.kind&&t.tokenIn===o.tokenIn&&t.mode.amount>e&&mo("AMOUNT_IN_EXCEEDED",`a leg spends ${t.mode.amount}, above the input ${e}`)}return o}const vo=e=>k(e).toXDR("base64");function To(e,t){if(!e.routerAddress)throw new Error("Stellar aggregator routerAddress is required");const r=new s.Contract(e.routerAddress),o=new s.Account(e.caller,e.sourceSequence),n=O(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new s.TransactionBuilder(o,{fee:e.fee??s.BASE_FEE,networkPassphrase:a[e.network]}).addOperation(r.call("execute_strategy",c(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Ao(e,t={}){if("string"!=typeof e.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:e.paths?e.paths.map((e=>({hops:e.swaps.map(Io),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Io),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function xo(e,t={}){const r=t.expected??{},o="string"==typeof e.routeXdr&&e.routeXdr.length>0?{routeXdr:e.routeXdr}:Ao(e,t),n=[e.amountOutMin,r.minOut].filter((e=>void 0!==e)).map((e=>{if("bigint"==typeof e)return e;if("string"!=typeof e||!/^\d+$/.test(e))throw new go("MALFORMED","minimum output must be a base-unit integer string");return BigInt(e)})).reduce(((e,t)=>void 0===e||t>e?t:e),void 0);if(void 0===n)throw new go("EXPECTATION_MISSING","quote has no `amountOutMin`; pass `slippage` when fetching it or `expected.minOut`");return wo(o,{tokenIn:bo(r.tokenIn??e.from,t.network),tokenOut:bo(r.tokenOut??e.to,t.network),minOut:n,amountIn:r.amountIn??e.amountIn}),o}const Io=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Ro(e){try{const{envelopeXdr:t,networkPassphrase:r,routerAddress:o,viewer:n,operationIndex:i}=e;if(!r||!s.StrKey.isValidContract(o)||new s.Address(n).toString()!==n||"string"!=typeof t||t.length>1048576||t.length%4!=0||!/^[A-Za-z0-9+/]+={0,2}$/.test(t)||void 0!==i&&(!Number.isSafeInteger(i)||i<0))return null;const a=s.TransactionBuilder.fromXDR(t,r),u="innerTransaction"in a?a.innerTransaction:a;if(void 0!==i&&i>=u.operations.length)return null;let l=null;for(const[e,t]of u.operations.entries()){if(void 0!==i&&e!==i)continue;if("invokeHostFunction"!==t.type)continue;const r=t.func;if("hostFunctionTypeInvokeContract"!==po(r))continue;const a=lo(r,"invokeContract");if(s.Address.fromScAddress(lo(a,"contractAddress")).toString()!==o||"execute_strategy"!==lo(a,"functionName").toString())continue;const u=lo(a,"args"),[d,p,c]=u;if(3!==u.length||!d||!p||!c||"scvAddress"!==po(d)||"scvI128"!==po(p)||"scvBytes"!==po(c))return null;if(s.Address.fromScAddress(lo(d,"address")).toString()!==n)continue;const f=(0,s.scValToBigInt)(p);if(f<=0n)return null;const h=yo(co(c));if(h.tokenIn===h.tokenOut||!s.StrKey.isValidContract(h.tokenIn)||!s.StrKey.isValidContract(h.tokenOut))return null;if(l)return null;l={tokenIn:h.tokenIn,tokenOut:h.tokenOut,amountInAtoms:f.toString(),operationIndex:e}}return l}catch{return null}}class Eo extends Error{code;offender;constructor(e,t,r){super(`Stellar authorization check failed [${e}]: ${t}${r?` — ${r.contract}.${r.fn}(${r.args.join(", ")})`:""}`),this.name="StellarAuthPolicyError",this.code=e,this.offender=r}}const Po=e=>e&&"scvAddress"===po(e)?s.Address.fromScAddress(lo(e,"address")).toString():void 0,ko=e=>e&&"scvI128"===po(e)?(0,s.scValToBigInt)(e):void 0,_o=e=>e&&"scvVec"===po(e)?lo(e,"vec")??[]:void 0,qo=(e,t)=>{if(!e||"scvMap"!==po(e))return;const r=(lo(e,"map")??[]).find((e=>"scvSymbol"===po(lo(e,"key"))&&lo(lo(e,"key"),"sym").toString()===t));return r?lo(r,"val"):void 0},Bo=e=>Po(e)??ko(e)?.toString()??e.toXDR("base64"),Oo=e=>({contract:s.Address.fromScAddress(lo(e,"contractAddress")).toString(),fn:lo(e,"functionName").toString(),args:lo(e,"args").map(Bo)}),Co=e=>{const t=lo(e,"function");return"sorobanAuthorizedFunctionTypeContractFn"===po(t)?lo(t,"contractFn"):void 0};function Mo(e,t,r){const o=e.filter((e=>{const o=lo(e,"credentials"),n=po(o);if("sorobanCredentialsAddress"!==n&&"sorobanCredentialsSourceAccount"!==n)throw new Eo("MALFORMED_TRANSACTION","unsupported authorization credentials");return("sorobanCredentialsAddress"===n?s.Address.fromScAddress(lo(lo(o,"address"),"address")).toString():r??t.caller)===t.caller}));if(o.length>1)throw new Eo("DUPLICATE_ENTRY",`${o.length} authorization entries for ${t.caller}, expected one`);const n=o[0];if(!n)return;const i=Co(lo(n,"rootInvocation"));if(!i)throw new Eo("UNEXPECTED_ROOT","root is not a contract call");const a=Oo(i);if(a.contract!==t.root.contract||a.fn!==t.root.fn)throw new Eo("UNEXPECTED_ROOT",`expected ${t.root.contract}.${t.root.fn}`,a);const u=t.transfers.map((()=>0n)),l=(t.calls??[]).map((()=>0));for(const e of lo(lo(n,"rootInvocation"),"subInvocations")){const r=Co(e);if(!r)throw new Eo("UNEXPECTED_CALL","sub-invocation is not a contract call");const o=Oo(r);if(lo(e,"subInvocations").length>0)throw new Eo("NESTED_INVOCATION","sub-invocation carries its own sub-invocations",o);const n=(t.calls??[]).findIndex((e=>e.contract===o.contract&&e.fn===o.fn));if(-1!==n){const e=(t.calls??[])[n],i=e.reject(lo(r,"args"));if(i)throw new Eo("UNEXPECTED_CALL",i,o);if(l[n]=(l[n]??0)+1,(l[n]??0)>e.maxCount)throw new Eo("UNEXPECTED_CALL",`more than ${e.maxCount} calls`,o);continue}if("transfer"!==o.fn||3!==lo(r,"args").length)throw new Eo("UNEXPECTED_CALL","only `transfer` is allowed",o);if(!t.transfers.some((e=>e.token===o.contract)))throw new Eo("UNEXPECTED_TOKEN","transfer on an unexpected token",o);const[i,a,s]=lo(r,"args");if(Po(i)!==t.caller)throw new Eo("UNEXPECTED_SENDER","transfer is not from the caller",o);const d=Po(a),p=t.transfers.findIndex((e=>e.token===o.contract&&e.to===d));if(-1===p)throw new Eo("UNEXPECTED_RECIPIENT","transfer to an unexpected recipient",o);const c=ko(s),f=t.transfers[p],h=(u[p]??0n)+(c??0n);if(void 0===c||c<=0n||h>f.maxAmount)throw new Eo("AMOUNT_EXCEEDED",`transfers total ${h}, above the expected ${f.maxAmount}`,o);u[p]=h}}const Uo=e=>{throw new Eo("MALFORMED_TRANSACTION",e)},Lo=(e,t)=>{const r=new Map;for(const t of _o(e)??Uo("payments argument is not a vector")){const[e,o]=_o(t)??[],n=Po(qo(e,"asset")),i=ko(o);if(void 0===n||void 0===i||i<0n)return Uo("payment is not a (HubAssetKey, i128) tuple");r.set(n,(r.get(n)??0n)+i)}return[...r].map((([e,r])=>({token:e,to:t,maxAmount:r})))},No=new Set([1,3,5]),Do=(e,t,r)=>({contract:e,fn:"submit",maxCount:2,reject:e=>{if(4!==e.length)return"submit must have four arguments";if(Po(e[0])!==t)return"`from` is not the caller";if(Po(e[1])!==r||Po(e[2])!==r)return"`spender` and `to` must be the lending controller";const o=_o(e[3]);if(!o)return"requests is not a vector";for(const e of o){const t=qo(e,"request_type");if(!t||"scvU32"!==po(t)||!No.has(lo(t,"u32")))return"request is not a withdraw, withdraw-collateral, or repay"}}});function $o(e,t,r){const{contract:o,fn:n}=Oo(t),i=lo(t,"args"),a={caller:e,root:{contract:o,fn:n},transfers:[]};if(o===r.governance)return a;if(o===r.aggregatorRouter){if("execute_strategy"!==n)return a;const t=ko(i[1]);if(Po(i[0])!==e||void 0===t||"scvBytes"!==po(i[2]))return Uo("execute_strategy arguments must be (caller, total_in, swap_xdr)");const r=yo(co(i[2]));return a.transfers=[{token:r.tokenIn,to:o,maxAmount:t}],a}if(o!==r.lendingController)throw new Eo("UNSUPPORTED_CONTRACT",`no authorization policy for contract ${o}; pass an explicit policy`);if(Po(i[0])!==e)throw new Eo("CALLER_MISMATCH",`${n} is not invoked for ${e}`);switch(n){case"supply":a.transfers=Lo(i[3],r.lendingPool);break;case"repay":case"liquidate":a.transfers=Lo(i[2],r.lendingPool);break;case"multiply":{const e=i[8];e&&"scvVoid"!==po(e)&&(a.transfers=Lo(s.xdr.ScVal.scvVec([e]),o));break}case"migrate_from_blend":{const t=Po(i[4])??Uo("blend_pool is not an address");a.calls=[Do(t,e,o)];break}}return a}const Wo=e=>{let t;try{t=s.xdr.TransactionEnvelope.fromXDR(e,"base64")}catch{return Uo("not a transaction envelope")}if("envelopeTypeTx"!==po(t))return Uo("expected a regular (v1) transaction");const r=lo(lo(t,"v1"),"tx"),o=lo(r,"operations")[0];if(!o||1!==lo(r,"operations").length)return Uo("expected exactly one operation");const n=lo(o,"body");if("invokeHostFunction"!==po(n))return Uo("operation is not a contract invocation");const i=lo(n,"invokeHostFunctionOp");return"hostFunctionTypeInvokeContract"!==po(lo(i,"hostFunction"))?Uo("host function is not a contract call"):{source:(a=lo(o,"sourceAccount")??lo(r,"sourceAccount"),s.StrKey.encodeEd25519PublicKey(fo("keyTypeMuxedEd25519"===po(a)?lo(lo(a,"med25519"),"ed25519"):lo(a,"ed25519")))),op:i,call:lo(lo(i,"hostFunction"),"invokeContract")};var a};function Fo(e,t){const r=Wo(e);if(void 0!==t.builtXdr&&lo(Wo(t.builtXdr).op,"hostFunction").toXDR("base64")!==lo(r.op,"hostFunction").toXDR("base64"))throw new Eo("INVOCATION_CHANGED","the prepared transaction does not invoke what was built",Oo(r.call));const o=t.policy??$o(t.caller,r.call,{...i(t.network),...t.deployment});Mo(lo(r.op,"auth"),o,r.source)}function zo(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Go(e,t,r){const o=r?.instructionLeeway??2e7;if(!Number.isInteger(o)||o<0||o>4294967295)throw new Error("instructionLeeway must be an integer from 0 to 4294967295");const n=s.TransactionBuilder.fromXDR(t,r?.network?a[r.network]:"");try{const t=await e.simulateTransaction(n,{cpuInstructions:o});if(s.rpc.Api.isSimulationError(t))throw new Error(t.error);return s.rpc.assembleTransaction(n,t).build().toXDR()}catch(e){if(r?.invokedContractId)throw zo(r.invokedContractId,e);throw e}}async function Ho(e,t,r){return Go(e,t.xdr,r)}function Vo(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function Xo(e,t){return new Uint8Array(0)}const jo=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return u.hp.from(t,"hex")};function Ko(e){const t=new s.Account(e.caller,e.sourceSequence),r=new s.Contract(e.forwarderAddress).call("mint_and_forward",s.xdr.ScVal.scvBytes(jo(e.message)),s.xdr.ScVal.scvBytes(jo(e.attestation)));return{xdr:new s.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:a[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Zo=10n**27n,Yo=10n**18n,Qo=10000n,Jo=27,en=18;function tn(e,t="value"){let r;if("bigint"==typeof e)r=e;else if("number"==typeof e){if(!Number.isSafeInteger(e))throw new Error(`Stellar math: ${t} must be a safe integer, got ${e}`);r=BigInt(e)}else{const o=e.trim();if(!/^-?\d+$/.test(o))throw new Error(`Stellar math: ${t} must be a decimal integer string, got "${e}"`);r=BigInt(o)}if(r<0n)throw new Error(`Stellar math: ${t} must be non-negative, got ${r}`);return r}function rn(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return e*t/r}function on(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");const o=e*t,n=o/r;return o%r===0n?n:n+1n}function nn(e,t,r){if(0n===r)throw new Error("Stellar math: division by zero");return(e*t+r/2n)/r}function an(e,t){if(0n===t)throw new Error("Stellar math: division by zero");const r=e/t;return e%t>=t/2n+t%2n?r+1n:r}const sn=e=>10n**BigInt(e);function un(e,t,r){return t===r?e:r>t?e*sn(r-t):e/sn(t-r)}function ln(e,t,r){if(t===r)return e;if(r>t)return e*sn(r-t);const o=sn(t-r),n=e/o;return e%o===0n?n:n+1n}function dn(e,t,r){return t===r?e:r>t?e*sn(r-t):an(e,sn(t-r))}const pn={floor:rn,ceil:on,halfUp:nn},cn={floor:un,ceil:ln,halfUp:dn};function fn(e,t,r,o){return cn[o](pn[o](e,t,Zo),Jo,r)}function hn(e,t,r){return fn(tn(e,"scaledRay"),tn(t,"indexRay"),r,"floor")}function gn(e,t,r){return fn(tn(e,"scaledRay"),tn(t,"indexRay"),r,"ceil")}function mn(e,t,r){return fn(tn(e,"scaledRay"),tn(t,"indexRay"),r,"halfUp")}function yn(e,t){if(t>Jo)throw new Error(`Stellar math: decimals ${t} exceed RAY scale`);return un(e,t,Jo)}function bn(e,t,r,o){const n=pn[o](e,t,Zo),i=cn[o](n,Jo,en);return pn[o](i,r,Yo)}function Sn(e,t,r,o){const n=cn[o](yn(e,t),Jo,en);return pn[o](n,r,Yo)}const wn=e=>Number(e)/1e18,vn=e=>Number(e)/1e27,Tn=(e,t)=>Number(e)/10**t;function An(e,t){if(!Number.isFinite(e)||e<=0||e>=1e21)return 0n;const r=e.toFixed(t),[o="0",n=""]=r.split(".");return BigInt(o+n.padEnd(t,"0"))}const xn=e=>An(e,en),In=(e,t)=>nn(e,t,Zo),Rn=(e,t)=>nn(e,Zo,t);function En(e,t){return 0n===t?0n:Rn(e,t)}function Pn(e,t){const r=e>Zo?Zo:e,o=tn(t.baseRateRay,"irm.baseRateRay"),n=tn(t.slope1Ray,"irm.slope1Ray"),i=tn(t.slope2Ray,"irm.slope2Ray"),a=tn(t.slope3Ray,"irm.slope3Ray"),s=tn(t.midUtilizationRay,"irm.midUtilizationRay"),u=tn(t.optimalUtilizationRay,"irm.optimalUtilizationRay"),l=tn(t.maxBorrowRateRay,"irm.maxBorrowRateRay");let d;if(r<s)d=o+Rn(In(r,n),s);else if(r<u){const e=u-s;d=o+n+Rn(In(r-s,i),e)}else{const e=Zo-u;d=o+n+i+(0n===e?0n:Rn(In(r-u,a),e))}return d>l?l:d}function kn(e,t,r){return 0n===e||!Number.isInteger(r)||r<0||r>=1e4?0n:nn(In(e,t),Qo-BigInt(r),Qo)}const _n=e=>vn(e),qn=e=>Math.expm1(vn(e)),Bn=5n*Yo,On=(e,t,r)=>`${e}:${t}:${r}`;function Cn(e,t,r,o){const n=Array.isArray(e)?e:void 0,i=n?n.find((e=>e.spokeId===t&&e.hubId===r&&e.asset===o)):e[On(t,r,o)]??Object.values(e).find((e=>e.spokeId===t&&e.hubId===r&&e.asset===o));if(!i)throw new Error(`Stellar math: no reserve for ${On(t,r,o)}`);return i}const Mn=/^0*[1-9]\d*$/,Un=e=>"string"==typeof e&&Mn.test(e)?BigInt(e).toString():null,Ln=(e,t)=>`${e}:${t}`;function Nn(e){const t=new Map,r=new Map,o=new Set,n=new Set;for(const i of e?.indexes??[]){const e=Ln(i.hubId,i.asset),a=Un(i.supplyIndex),s=Un(i.borrowIndex),u=Un(i.usdPrice),l=t.get(e),d=l&&Un(l.supplyIndex)===a&&Un(l.borrowIndex)===s&&Un(l.usdPrice)===u;null==a||null==s||null==u||l&&!d?o.add(e):l||t.set(e,i);const p=!1===i.valid||!0===i.stale||!0===i.deviation,c=r.get(i.asset);null==u||p||void 0!==c&&c.toString()!==u?n.add(i.asset):void 0===c&&r.set(i.asset,BigInt(u))}for(const e of o)t.delete(e);for(const e of n)r.delete(e);return{indexes:t,prices:r,rejectedIndexKeys:o,rejectedAssets:n}}const Dn=(e,t)=>rn(e,BigInt(t),Qo);function $n(e,t,r,o){const n="supply"===e.side,i=Math.min(e.entryLtvBps,e.entryLiquidationThresholdBps);return{side:e.side,hubId:e.hubId,asset:e.asset,decimals:e.decimals,scaledRay:e.scaledRay.toString(),indexRay:e.indexRay.toString(),usdPriceWad:e.priceWad.toString(),usdPrice:wn(e.priceWad),amountBase:t.toString(),amountShort:Tn(t,e.decimals),usdWad:r.toString(),usd:wn(r),gateUsdWad:o.toString(),entryLtvBps:e.entryLtvBps,entryLiquidationThresholdBps:e.entryLiquidationThresholdBps,entryLiquidationBonusBps:e.entryLiquidationBonusBps,entryLiquidationFeesBps:e.entryLiquidationFeesBps,ltvWeightedUsdWad:n?Dn(o,i).toString():"0",liquidationWeightedUsdWad:n?Dn(o,e.entryLiquidationThresholdBps).toString():"0",liveDataUsed:e.liveDataUsed}}function Wn(e){if("supply"===e.side)return $n(e,fn(e.scaledRay,e.indexRay,e.decimals,"floor"),bn(e.scaledRay,e.indexRay,e.priceWad,"halfUp"),bn(e.scaledRay,e.indexRay,e.priceWad,"floor"));const t=fn(e.scaledRay,e.indexRay,e.decimals,"ceil"),r=bn(e.scaledRay,e.indexRay,e.priceWad,"ceil");return $n(e,t,r,r)}function Fn(e,t,r,o){const n=yn(t,r);return"supply"===e?rn(n,Zo,o):on(n,Zo,o)}function zn(e,t,r,o){const n=yn(t,r);return"supply"===e?on(n,Zo,o):rn(n,Zo,o)}function Gn(e,t){return Wn({...e,scaledRay:Fn(e.side,t,e.decimals,e.indexRay)})}const Hn=(...e)=>{for(const t of e){const e=Un(t);if(null!=e)return BigInt(e)}return Zo};function Vn(e,t,r,o){const n=tn("supply"===e?t.supplyScaledRay:t.borrowScaledRay,`${e}ScaledRay`);if(0n===n)return null;const i=o.indexes.get(Ln(t.hubId,t.asset)),a=o.prices.get(t.asset),s="supply"===e?Hn(i?.supplyIndex,t.liveSupplyIndexRay,r.liveSupplyIndexRay,t.supplyIndexRay):Hn(i?.borrowIndex,t.liveBorrowIndexRay,r.liveBorrowIndexRay,t.borrowIndexRay),u=a??xn(r.usdPrice);return Wn({side:e,hubId:t.hubId,asset:t.asset,decimals:r.assetDecimals,scaledRay:n,indexRay:s,priceWad:u,entryLtvBps:t.entryLtvBps,entryLiquidationThresholdBps:t.entryLiquidationThresholdBps,entryLiquidationBonusBps:t.entryLiquidationBonusBps,entryLiquidationFeesBps:t.entryLiquidationFeesBps,liveDataUsed:void 0!==i&&void 0!==a})}const Xn=(e,t)=>e.reduce(((e,r)=>e+BigInt(t(r))),0n);function jn(e,t,r,o,n){const i=Xn(t,(e=>e.usdWad)),a=Xn(t,(e=>e.ltvWeightedUsdWad)),s=Xn(t,(e=>e.liquidationWeightedUsdWad)),u=Xn(r,(e=>e.usdWad)),l=0n===u?null:rn(s,Yo,u),d=0n===s?0:Number(u)/Number(s)*100,p=a<o||a<=u?0n:a-u;return{...e,supplies:t,borrows:r,totalCollateralUsdWad:i.toString(),totalCollateralUsd:wn(i),ltvWeightedCollateralUsdWad:a.toString(),ltvWeightedCollateralUsd:wn(a),liquidationWeightedCollateralUsdWad:s.toString(),liquidationWeightedCollateralUsd:wn(s),totalDebtUsdWad:u.toString(),totalDebtUsd:wn(u),healthFactorWad:null===l?null:l.toString(),healthFactor:null===l?null:wn(l),healthPercent:d,borrowLimitUsdWad:a.toString(),borrowLimitUsd:wn(a),availableBorrowUsdWad:p.toString(),availableBorrowUsd:wn(p),minBorrowCollateralUsdWad:o.toString(),minBorrowCollateralUsd:wn(o),isLiquidatable:null!==l&&l<Yo,liveDataValid:n}}function Kn(e){const{positions:t,reserves:r,liveState:o}=e,n=t[0];if(!n)throw new Error("Stellar math: computeAccountRisk needs at least one position row");for(const e of t)if(e.accountId!==n.accountId)throw new Error(`Stellar math: computeAccountRisk received mixed account ids (${n.accountId}, ${e.accountId})`);const i=Nn(o),a=[],s=[];for(const e of t){const t=Cn(r,e.spokeId,e.hubId,e.asset),o=Vn("supply",e,t,i);o&&a.push(o);const n=Vn("borrow",e,t,i);n&&s.push(n)}const u=null!=o?.minBorrowCollateralUsdWad?tn(o.minBorrowCollateralUsdWad,"minBorrowCollateralUsdWad"):Bn,l=void 0!==o&&[...a,...s].every((e=>e.liveDataUsed));return jn({accountId:n.accountId,owner:n.owner,spokeId:n.spokeId,mode:n.positionMode},a,s,u,l)}const Zn=200n,Yn=e=>e.reduce(((e,t)=>t.amount<e.amount?t:e)),Qn=e=>e<0n?0n:e,Jn=(e,t,r,o)=>({amountBase:e.amount,amountShort:Tn(e.amount,t),isFullClose:r,reason:e.reason,projectedUtilization:o}),ei=e=>({amountBase:0n,amountShort:0,isFullClose:!1,reason:e,projectedUtilization:null});function ti(e){const t=e.assetDecimals,r=tn(e.irm.maxUtilizationRay,"irm.maxUtilizationRay");return{suppliedBase:An(e.hubPool.suppliedShort,t),borrowedBase:An(e.hubPool.borrowedShort,t),cashBase:An(e.availableLiquidityShort,t),spokeSuppliedBase:An(e.suppliedShort,t),spokeBorrowedBase:An(e.borrowedShort,t),maxUtilizationRay:r>=Zo?null:r}}const ri=(e,t)=>e<=0n?null:Number(t)/Number(e);function oi(e,t){if(e<=0n||!t(0n))return 0n;let r=0n,o=e+1n;for(;o-r>1n;){const e=(r+o)/2n;t(e)?r=e:o=e}return r}const ni=(e,t)=>e.find((e=>e.hubId===t.hubId&&e.asset===t.asset));function ii(e,t,r){if(t.paused)return ei("paused");if(t.frozen)return ei("frozen");if(!t.isBorrowable)return ei("cap");const o=t.assetDecimals,n=ti(t),i=ni(e.borrows,t),a=Nn(r).indexes.get(Ln(t.hubId,t.asset)),s=i?BigInt(i.indexRay):tn(a?.borrowIndex??t.liveBorrowIndexRay,"borrowIndex"),u=i?BigInt(i.usdPriceWad):function(e,t){return Nn(t).prices.get(e.asset)??xn(e.usdPrice)}(t,r),l=i?BigInt(i.scaledRay):0n,d=BigInt(e.totalDebtUsdWad)-(i?BigInt(i.usdWad):0n),p=BigInt(e.ltvWeightedCollateralUsdWad),c=BigInt(e.minBorrowCollateralUsdWad),f=[];if(p<c)f.push({amount:0n,reason:"minCollateral"});else{const t=p-BigInt(e.totalDebtUsdWad),r=t<=0n||u<=0n?0n:rn(t,10n**BigInt(o),u),n=e=>d+bn(l+Fn("borrow",e,o,s),s,u,"ceil");f.push({amount:0n===r?0n:oi(r+16n,(e=>n(e)<=p)),reason:"ltv"})}f.push({amount:Qn(tn(t.borrowCap,"borrowCap")-n.spokeBorrowedBase),reason:"cap"});const h=nn(n.suppliedBase,Zn,Qo);f.push({amount:Qn(n.cashBase-h),reason:"liquidity"});const g=function(e,t){const r=e.maxUtilizationRay;if(null===r)return null;const o=yn(e.suppliedBase,t);return 0n===o?null:oi(Qn(rn(e.suppliedBase,r,Zo)-e.borrowedBase)+16n,(n=>En(yn(e.borrowedBase+n,t),o)<=r))}(n,o);null!==g&&f.push({amount:g,reason:"utilizationCap"});const m=Yn(f);return Jn(m,o,!1,ri(n.suppliedBase,n.borrowedBase+m.amount))}function ai(e,t,r){if(t.paused)return ei("paused");const o=ni(e.supplies,t);if(!o)return ei(null);const n=o.decimals,i=ti(t),a=BigInt(o.scaledRay),s=BigInt(o.indexRay),u=BigInt(o.usdPriceWad),l=BigInt(o.amountBase),d=fn(a,s,n,"halfUp"),p=BigInt(e.totalDebtUsdWad),c=BigInt(e.minBorrowCollateralUsdWad),f=BigInt(Math.min(o.entryLtvBps,o.entryLiquidationThresholdBps)),h=[];let g=!0;if(p>0n&&f>0n){const t=p>c?p:c,r=c>p?"minCollateral":"healthFactor",i=BigInt(e.ltvWeightedCollateralUsdWad)-BigInt(o.ltvWeightedUsdWad);if(i<t){g=!1;const e=t-i,l=on(e,Qo,f),p=BigInt(o.gateUsdWad)-l,c=p<=0n?0n:rn(p,10n**BigInt(n),u),m=d>0n?d-1n:0n,y=c+16n>m?m:c+16n,b=e=>{const t=zn("supply",e,n,s);return rn(bn(t>=a?0n:a-t,s,u,"floor"),f,Qo)};h.push({amount:oi(y,(t=>b(t)>=e)),reason:r})}}h.push({amount:l,reason:null}),h.push({amount:i.cashBase,reason:"liquidity"});const m=function(e,t){const r=e.maxUtilizationRay;if(null===r||0n===e.borrowedBase)return null;if(0n===r)return 0n;const o=on(e.borrowedBase,Zo,r),n=e.suppliedBase<o?0n:e.suppliedBase-o+16n,i=yn(e.borrowedBase,t);return oi(n>e.suppliedBase?e.suppliedBase:n,(o=>{const n=yn(e.suppliedBase-o,t);return n>0n&&En(i,n)<=r}))}(i,n);null!==m&&h.push({amount:m,reason:"utilizationCap"});const y=Yn(h),b=g&&y.amount>=l;return Jn(y,n,b,ri(i.suppliedBase-y.amount,i.borrowedBase))}function si(e){if(e.paused)return ei("paused");if(e.frozen)return ei("frozen");const t=e.assetDecimals,r=ti(e),o={amount:Qn(tn(e.supplyCap,"supplyCap")-r.spokeSuppliedBase),reason:"cap"};return Jn(o,t,!1,ri(r.suppliedBase+o.amount,r.borrowedBase))}function ui(e,t,r){if(t.paused)return ei("paused");const o=ni(e.borrows,t);if(!o)return ei(null);const n=o.decimals,i=ti(t),a=BigInt(o.amountBase),s=void 0===r?null:tn(r,"walletBalance"),u=null!==s&&s<a?{amount:s,reason:"liquidity"}:{amount:a,reason:null};return Jn(u,n,u.amount>=a,ri(i.suppliedBase,Qn(i.borrowedBase-u.amount)))}const li=(e,t)=>e.hubId===t.hubId&&e.asset===t.asset,di=e=>{if("bigint"==typeof e)return e;const t=e.trim();if(!/^-?\d+$/.test(t))throw new Error(`Stellar math: delta amountBase must be an integer string, got "${e}"`);return BigInt(t)};function pi(e,t){const r=[...e.supplies],o=[...e.borrows];for(const e of t){const t="supply"===e.side?r:o,n=t.findIndex((t=>li(t,e))),i=-1===n?void 0:t[n],a=di(e.amountBase);let s;if(i){const e={side:i.side,hubId:i.hubId,asset:i.asset,decimals:i.decimals,indexRay:BigInt(i.indexRay),priceWad:BigInt(i.usdPriceWad),entryLtvBps:i.entryLtvBps,entryLiquidationThresholdBps:i.entryLiquidationThresholdBps,entryLiquidationBonusBps:i.entryLiquidationBonusBps,entryLiquidationFeesBps:i.entryLiquidationFeesBps,liveDataUsed:i.liveDataUsed},t=BigInt(i.scaledRay);let r;if(a>=0n)r=t+Fn(e.side,a,e.decimals,e.indexRay);else{const o=-a,n=o>=("supply"===e.side?fn(t,e.indexRay,e.decimals,"halfUp"):BigInt(i.amountBase))?t:zn(e.side,o,e.decimals,e.indexRay);r=n>=t?0n:t-n}s=0n===r?null:Wn({...e,scaledRay:r})}else s=a<=0n?null:Gn(ci(e),a);-1===n?s&&t.push(s):s?t[n]=s:t.splice(n,1)}return jn({accountId:e.accountId,owner:e.owner,spokeId:e.spokeId,mode:e.mode},r,o,BigInt(e.minBorrowCollateralUsdWad),e.liveDataValid)}function ci(e){const t=e.reserve;if(!t)throw new Error(`Stellar math: projectAccountRisk needs \`reserve\` for a new ${e.side} position on ${e.hubId}:${e.asset}`);return{side:e.side,hubId:e.hubId,asset:e.asset,decimals:t.assetDecimals,indexRay:tn("supply"===e.side?t.liveSupplyIndexRay:t.liveBorrowIndexRay,"reserve live index"),priceWad:xn(t.usdPrice),entryLtvBps:t.collateralFactorBps,entryLiquidationThresholdBps:t.liquidationThresholdBps,entryLiquidationBonusBps:t.liquidationPenaltyBps,entryLiquidationFeesBps:t.liquidationFeesBps,liveDataUsed:!1}}function fi(e,t=0n,r=0n){const o=e.assetDecimals,n=e=>e<0n?0n:e,i=n(An(e.hubPool.suppliedShort,o)+di(t)),a=En(yn(n(An(e.hubPool.borrowedShort,o)+di(r)),o),yn(i,o)),s=Pn(a,e.irm),u=kn(a,s,e.irm.reserveFactorBps);return{utilization:vn(a),utilizationRay:a.toString(),borrowAprRay:s.toString(),supplyAprRay:u.toString(),borrowApr:_n(s),supplyApr:_n(u),borrowApy:qn(s),supplyApy:qn(u)}}const hi={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},5:{name:"PoolAlreadyDeployed",message:"Singleton pool, controller, or price aggregator already recorded."},6:{name:"InvalidAsset",message:"Invalid asset address."},7:{name:"AssetsAreTheSame",message:"Same market or token where distinct HubAssetKeys or underlying assets, respectively, are required."},8:{name:"WrongToken",message:"Params.asset_id differs from the market's asset."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},13:{name:"AccountNotInMarket",message:"Caller lacks the account's position NFT, or the account has no metadata."},14:{name:"AmountMustBePositive",message:"The amount must be greater than zero."},16:{name:"InvalidPayments",message:"Payments or route list empty when required, non-empty when forbidden, or over the view limit."},18:{name:"NotSmartContract",message:"Address is not a deployed contract."},24:{name:"AccountNotFound",message:"Account id has no state, or its NFT owner is unresolvable."},25:{name:"AccountModeMismatch",message:"Account mode differs from the call's required mode."},27:{name:"AggregatorNotSet",message:"Swap or price aggregator not configured."},29:{name:"PositionLimitsNotSet",message:"No position limits stored."},30:{name:"PoolNotInitialized",message:"Pool or controller unset, or market params/state missing."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},33:{name:"MathOverflow",message:"Checked arithmetic overflow or failed narrowing conversion."},34:{name:"InternalError",message:"Internal invariant failed. Report it."},36:{name:"InvalidPositionLimits",message:"Supply or borrow limit is zero or above POSITION_LIMIT_MAX (5)."},38:{name:"SpotOnlyNotProductionSafe",message:"Every oracle source reads an unsmoothed spot market."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},40:{name:"TimelockOperationExpired",message:"Scheduled operation's grace period elapsed."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},42:{name:"BlendPoolNotApproved",message:"Blend pool not approved."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},45:{name:"RegistryCapReached",message:"Account already has MAX_DELEGATES (16)."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},47:{name:"BorrowRoundsToZeroShares",message:"Positive borrow mints zero scaled debt shares."},48:{name:"CannotRemoveLastProposer",message:"Revoke would leave no proposer."},49:{name:"WithdrawRoundsToZeroShares",message:"Positive withdrawal burns zero scaled supply shares."},50:{name:"NetSettleRoundsToZeroShares",message:"Positive net settlement burns zero shares."},51:{name:"SupplyRoundsToZeroShares",message:"Positive supply mints zero scaled shares."},52:{name:"RepayRoundsToZeroShares",message:"Positive net repayment burns zero scaled debt shares."},53:{name:"PositionNftNotSet",message:"NFT address unset on a path needing it, such as account creation. Ownership lookup can return #24 instead."},54:{name:"PositionNftAlreadyDeployed",message:"Position-NFT address already recorded."},55:{name:"DivisionByZero",message:"Fixed-point multiply-divide with zero denominator."},100:{name:"InsufficientCollateral",message:"Post-operation LTV-weighted collateral below total debt, or health factor below 1 WAD."},101:{name:"HealthFactorTooHigh",message:"Target has no debt or health factor >= 1 WAD; not liquidatable."},102:{name:"HealthFactorTooLow",message:"Update_account_threshold with has_risks = true ends below 1.05 WAD. A gated liquidation-tuple refresh skips a tuple that fails its hypothetical health-factor check."},104:{name:"NotCollateral",message:"Spoke listing disallows the asset as collateral."},107:{name:"AssetNotBorrowable",message:"Spoke listing disallows borrowing the asset."},109:{name:"PositionLimitExceeded",message:"New slot exceeds the position limit, or a sub-3-decimal supply leg would coexist with another supply slot."},110:{name:"PositionNotFound",message:"Reserved code; no longer emitted."},111:{name:"InvalidPositionMode",message:"Mode is not Multiply, Long, or Short."},112:{name:"InsufficientLiquidity",message:"Market cash below the draw, or the draw breaks the liquidation buffer."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},114:{name:"CannotCleanBadDebt",message:"Account fails the bad-debt gate."},115:{name:"WithdrawLessThanFee",message:"Liquidation protocol fee exceeds the gross withdrawal."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},118:{name:"OptUtilTooHigh",message:"Optimal utilization >= 100%."},119:{name:"InvalidReserveFactor",message:"Reserve factor >= 100%."},120:{name:"DebtPositionNotFound",message:"No debt position for that hub asset."},121:{name:"CollateralPositionNotFound",message:"No supply position for that hub asset."},122:{name:"CannotCloseWithRemainingDebt",message:"Close_position with borrow positions open."},123:{name:"PoolInsolvent",message:"Supplier claims exceed cash plus debt, or zero supply with debt outstanding."},126:{name:"MinBorrowCollateralNotMet",message:"With debt outstanding, LTV-weighted collateral below the USD floor, or a sub-3-decimal supply leg under 2 raw units after floor conversion."},127:{name:"UtilizationAboveMax",message:"Post-operation utilization above max_utilization."},128:{name:"BaseRateNegative",message:"Negative base borrow rate."},129:{name:"SlopeNonMonotonic",message:"Rate slopes do not increase monotonically."},130:{name:"MaxRateBelowBase",message:"Max borrow rate not strictly above base."},131:{name:"MaxBorrowRateTooHigh",message:"Max borrow rate exceeds MAX_BORROW_RATE_RAY (200% APR)."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},133:{name:"SelfLiquidationNotAllowed",message:"SeizeMode::Credit(id) receiver is the liquidated account. Owners may still liquidate their own account."},134:{name:"InvalidLiquidationCurve",message:"Curve bounds fail validation."},135:{name:"FullCloseRequired",message:"Retired; no error site."},201:{name:"InvalidAggregator",message:"Proposed aggregator is not a deployed contract."},204:{name:"InvalidOracleTokenType",message:"Reflector asset given as string; only address or symbol accepted."},205:{name:"UnsafePriceNotAllowed",message:"Two legs disagree beyond tolerance, or only one produced a reading."},206:{name:"PriceFeedStale",message:"Observation exceeds its staleness budget. Timestamps over 60 s ahead are dropped; the error then depends on remaining sources."},208:{name:"BadLastTolerance",message:"Upper ratio outside 10150..12500 (excess over BPS outside 150..2500 bps), or lower ratio is not the required rounded reciprocal."},210:{name:"NoLastPrice",message:"No readable source, or an Aquarius LP read failed (for example, reserves or shares)."},211:{name:"NoAccumulator",message:"Controller has no revenue accumulator."},212:{name:"ReflectorHistoryEmpty",message:"Reflector returns no price history."},216:{name:"OracleNotConfigured",message:"No oracle for the price key, or the response omits a requested asset."},217:{name:"InvalidPrice",message:"Price <= 0, or LP fair-value math non-representable."},218:{name:"InvalidStalenessConfig",message:"Max_stale_seconds out of range or below the source's guaranteed freshness."},219:{name:"TwapInsufficientObservations",message:"Record count zero or below the smoothing minimum, or history too short, too long, or denser than feed resolution."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},222:{name:"InvalidOracleResolution",message:"Reflector resolution below minimum, above max_stale_seconds, or implying a TWAP span above it."},223:{name:"SanityBoundViolated",message:"Price outside the stored sanity band."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."},226:{name:"SanityBandTooWideForSingleSource",message:"Band exceeds the tighter limit for single-source, LP, or dual-source oracles with identical provider trust sets."},227:{name:"SanityBandMustTighten",message:"Set_sanity_band would widen the band. Widen via timelocked ConfigureAssetOracle."},228:{name:"TwapRecordsOutOfRange",message:"Record count above MAX_TWAP_RECORDS (12)."},229:{name:"OracleDepthExceeded",message:"Composition nests deeper than MAX_RESOLUTION_DEPTH (3)."},230:{name:"FactorOutOfBounds",message:"Scaled source's factor price outside its min/max."},231:{name:"SourceCountOutOfRange",message:"Zero or over two sources, or Aquarius LP combined with another source."},232:{name:"IndependenceNotDeclared",message:"Sources violate RequireDisjoint, or AllowShared is empty or not exactly the shared providers."},234:{name:"UnsupportedAquariusPool",message:"Aquarius pool of wrong type, or zero reserve or total shares."},235:{name:"InsufficientAquariusLiquidity",message:"Pool value below min_pool_value_wad."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},310:{name:"SpokeMismatch",message:"Account's spoke differs from the targeted spoke."},311:{name:"SpokeSupplyCapReached",message:"Supply would exceed the spoke supply cap."},312:{name:"SpokeBorrowCapReached",message:"Borrow would exceed the spoke borrow cap."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},318:{name:"SpokeAssetSeizureHalted",message:"Liquidation seizure is halted for this spoke asset."},319:{name:"SpokeFlagsEpochMismatch",message:"RelaxSpokeAssetFlags epoch is stale or wrong; checked at proposal and execution."},400:{name:"FlashLoanOngoing",message:"Flash loan in progress; re-entrant calls refused."},401:{name:"FlashloanNotEnabled",message:"Market is_flashloanable is false."},402:{name:"InvalidFlashloanRepay",message:"Allowance below principal plus fee, or a pool balance check after payout, callback, or repayment fails."},409:{name:"StrategyFeeExceeds",message:"Strategy fee exceeds the borrowed amount."},412:{name:"InvalidFlashloanReceiver",message:"Receiver not a deployed Wasm contract, or a controller payout targets the controller or pool."},500:{name:"ConvertStepsRequired",message:"Multiply initial payment is neither collateral nor debt asset, with no convert_swap."},501:{name:"RouterOverspend",message:"Controller input balance rose during the swap, or router spent over amount_in."},502:{name:"NoSwapOutput",message:"Swap produced no positive measured output."},503:{name:"CollateralRequired",message:"Flash_position collateral list has no positive minimum. Empty list raises #16."},504:{name:"CollateralMinimumNotMet",message:"Measured deposit below its minimum, or none positive."},505:{name:"FlashPositionClosed",message:"Flash_position ended without supply or positive debt in its debt market."}},gi=/Error\(Contract,\s*#(\d+)\)/,mi=/contract:(C[A-Z2-7]{55})[^\n]*?Error\(Contract,\s*#(\d+)\)/g,yi=/\[xoxno-invoked:(C[A-Z2-7]{55})\]/,bi=/contract:C[A-Z2-7]{55}/;function Si(e,t){let r;if(t?.contracts?.length)r=((e,t)=>{for(const r of e.matchAll(mi))if(t.has(r[1]))return Number(r[2]);if(bi.test(e))return null;const r=e.match(yi),o=e.match(gi);return r&&t.has(r[1])&&o?Number(o[1]):null})(e,new Set(t.contracts));else{const t=e.match(gi);r=t?Number(t[1]):null}if(null===r)return null;const o=hi[r];return o?{code:r,...o}:null}},468(e,t,r){"use strict";r.d(t,{createStellarLendingReadClient:()=>S,lendingAssetsSchema:()=>y,lendingPositionsSchema:()=>m});const o={type:"string"},n={type:"number"},i={type:"boolean"},a={...o,nullable:!0},s={...n,nullable:!0},u={...o,enum:["mainnet","testnet"]},l={...o,enum:["ready","stale","incomplete"]};function d(e){return{type:"object",required:Object.keys(e),properties:e}}const p={sac:o,symbol:o,name:o,decimals:s,logoUrl:a},c=d({valid:i,stale:i,deviation:i,timestamp:s}),f=d({...p,hubId:n,hubName:o,amountRaw:{...a,description:"Integer token base units, never scaled shares."},amount:a,apy:{...s,description:"Fraction: 0.05 means 5%."},priceUsd:s,valueUsd:s,priceStatus:c,indexRay:a,indexedAt:n,indexedLedger:n}),h=d({amountRaw:a,amount:a,usd:s}),g=d({spokeId:n,spokeName:o,ltvBps:n,supplyCapacity:h,borrowCapacity:h,canSupply:i,canBeCollateral:i,canBorrow:i,canOpenAccount:{...i,description:"Spoke admits new accounts; other entry gates still apply."}}),m={type:"array",items:d({accountId:o,nftContract:o,nftImage:{...o,format:"uri",description:"Dynamic position SVG served by the network's XOXNO API."},network:u,spokeId:s,spokeName:a,supplied:{type:"array",items:f},borrow:{type:"array",items:f},hasDebt:{...i,nullable:!0,description:"Null when account rows are unavailable."},healthFactor:{...s,description:"Null without debt or when risk inputs are unavailable."},borrowLimitUsd:s,availableBorrowUsd:{...s,description:"Account headroom, before per-market constraints."},netApy:{...s,description:"Net annual yield divided by positive net equity; fraction."},dataStatus:l})},y={type:"array",items:d({...p,hubId:n,hubName:o,network:u,supplyApy:{...s,description:"Fraction: 0.05 means 5%."},borrowApy:{...s,description:"Fraction: 0.05 means 5%."},priceUsd:s,priceStatus:c,spokes:{type:"array",items:g},dataStatus:l,indexedAt:{...n,description:"Pool state timestamp. Capacities are indexed snapshot estimates; prepare/simulate before signing."},indexedLedger:n})};function b(e){if(!e)return;const t=/\s*<([^<>\s]+)>\s*((?:;\s*[\w!#$%&'*+.^`|~-]+\s*=\s*(?:"(?:[^"\\\r\n]|\\.)*"|[\w!#$%&'*+.^`|~:/-]+)\s*)*)(,|$)/gy;let r,o=0;for(;o<e.length;){const n=t.exec(e);if(!n||n[3]&&t.lastIndex===e.length)throw new Error("Invalid pagination Link header");let i=!1,a=!1;for(const e of n[2].matchAll(/;\s*([\w!#$%&'*+.^`|~-]+)\s*=\s*(?:"((?:[^"\\\r\n]|\\.)*)"|([\w!#$%&'*+.^`|~:/-]+))\s*/g))if("rel"===e[1].toLowerCase()){if(a)throw new Error("Duplicate pagination link relation");a=!0,i=(e[2]??e[3]).replace(/\\(.)/g,"$1").toLowerCase().split(/\s+/).includes("next")}if(i){if(void 0!==r)throw new Error("Multiple next pagination links");r=n[1]}o=t.lastIndex}return r}function S(e){const t=new URL(e.baseUrl.trim());if(!["https:","http:"].includes(t.protocol)||t.username||t.password||t.search||t.hash)throw new Error("baseUrl must be an HTTP API root without credentials, query or fragment");t.pathname=`${t.pathname.replace(/\/+$/,"")}/`;const r=e.fetch??globalThis.fetch?.bind(globalThis);if(!r)throw new Error("A fetch implementation is required");async function o(e,o){const n=new URL(`stellar-lending/v1/${e}`,t);let i=n;const a=new Set,s=[];for(;;){if(a.has(i.href))throw new Error("Pagination Link cycle");a.add(i.href);const e=await r(i.href,{signal:o,redirect:"error"});if(e.redirected||e.url&&new URL(e.url).href!==i.href)throw new Error("Stellar lending redirects are not allowed");if(!e.ok)throw new Error(`Stellar lending request failed: HTTP ${e.status}`);const t=await e.json();if(!Array.isArray(t))throw new Error("Stellar lending response must be an array");s.push(...t);const u=b(e.headers.get("Link"));if(!u)break;const l=new URL(u,i);if(l.origin!==n.origin||l.pathname!==n.pathname||l.username||l.password||l.hash)throw new Error("Pagination Link must stay on the same API endpoint");i=l}return s}return{assets:({usage:e,signal:t}={})=>{if(void 0!==e&&"collateral"!==e&&"borrow"!==e)throw new Error("usage must be collateral or borrow");return o("assets"+(e?`?usage=${e}`:""),t)},positions:(e,{signal:t}={})=>{if(!e.trim()||"."===e||".."===e)throw new Error("owner is required");return o(`users/${encodeURIComponent(e)}/positions`,t)}}}},928(e,t,r){"use strict";r.d(t,{sW:()=>s,Zc:()=>a,GW:()=>u});const o="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",n="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e",a=3e4;var s;!function(e){e.MAINNET="1",e.DEVNET="D"}(s||(s={}));class u{apiUrl;chain;init;config;constructor(e){if(!e?.apiUrl?.trim())throw new Error("XOXNOClient: apiUrl is required");const{chain:t=s.MAINNET,apiUrl:r,...a}=e;this.apiUrl=r.trim().replace(/\/$/,""),this.chain=t,this.init=a,this.config=t==s.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:o,DR_SC:n,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:o,DR_SC:n,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:i,timeout:s,...u}=this.init,{next:l,cache:d,debug:p,timeout:c,headers:f,method:h="GET",...g}=r,m=f?.Authorization,y="Bearer undefined"===m?void 0:m,b="GET"!==h&&"HEAD"!==h&&"PUT"!==h,S={...f,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",...b?{"Content-Type":"application/json"}:{},...y?{Authorization:y}:{}},w=Object.entries(t??{}).filter((([,e])=>void 0!==e)).flatMap((([e,t])=>Array.isArray(t)?t.filter((e=>void 0!==e)).map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),v=`${this.apiUrl}${e}${w.length?`?${w}`:""}`,{revalidate:T,...A}=o??{},{revalidate:x,...I}=l??{},R="GET"!==h||y?void 0:x??T,E="GET"!==h||y||R?void 0:d??n,P=g.body,k=c??s??(null==P?a:0),_=k>0?AbortSignal.timeout(k):void 0,q=g.signal??u.signal,B=_&&q?AbortSignal.any([q,_]):_??q,O={...u,...g,method:h,...Object.keys(S).length?{headers:S}:{},...B?{signal:B}:{},cache:E,next:{...A,...I,revalidate:R}};(p??i)&&console.debug("SDK fetch: ",v,O);const C=await fetch(v,O).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${v}: ${e.message}`),{cause:e});throw e})),M=await C.text();if(!C.ok){let e;try{e=JSON.parse(M)}catch{e={message:M}}const t=[v,C.status,C.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(M)}catch{return M}}}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";r.r(o),r.d(o,{BPS:()=>d.BPS,Chain:()=>e.sW,DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD:()=>d.DEFAULT_MIN_BORROW_COLLATERAL_USD_WAD,DEFAULT_REQUEST_TIMEOUT_MS:()=>e.Zc,LIQUIDATION_BUFFER_BPS:()=>d.LIQUIDATION_BUFFER_BPS,RAY:()=>d.RAY,RAY_DECIMALS:()=>d.RAY_DECIMALS,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>d.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_TOPICS:()=>d.STELLAR_LENDING_TOPICS,STELLAR_NETWORKS:()=>d.STELLAR_NETWORKS,STELLAR_NETWORK_PASSPHRASE:()=>d.STELLAR_NETWORK_PASSPHRASE,STELLAR_ROUTE_MAX_BYTES:()=>d.STELLAR_ROUTE_MAX_BYTES,SYNTHETIC_EVENT_ORDER_STRIDE:()=>d.SYNTHETIC_EVENT_ORDER_STRIDE,StellarAuthPolicyError:()=>d.StellarAuthPolicyError,StellarRouteVerificationError:()=>d.StellarRouteVerificationError,WAD:()=>d.WAD,WAD_DECIMALS:()=>d.WAD_DECIMALS,XOXNOClient:()=>e.GW,aggregateAccountRisk:()=>d.aggregateAccountRisk,annualBorrowRateRay:()=>d.annualBorrowRateRay,assertStellarAuthEntries:()=>d.assertStellarAuthEntries,assertStellarPreparedTxAuth:()=>d.assertStellarPreparedTxAuth,baseToRay:()=>d.baseToRay,baseToShort:()=>d.baseToShort,baseValueWad:()=>d.baseValueWad,buildLiveSnapshot:()=>d.buildLiveSnapshot,buildSameTokenRepaySwapSteps:()=>d.buildSameTokenRepaySwapSteps,buildSdk:()=>h,buildStellarAcceptOwnershipTx:()=>d.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>d.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>d.buildStellarApproveBlendPoolTx,buildStellarBorrowBatchTx:()=>d.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>d.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>d.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>d.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>d.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>d.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>d.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>d.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>d.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>d.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>d.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>d.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>d.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>d.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>d.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>d.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>d.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>d.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>d.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>d.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>d.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>d.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>d.buildStellarLiquidateTx,buildStellarLiquidationEstimateTx:()=>d.buildStellarLiquidationEstimateTx,buildStellarMigrateFromBlendTx:()=>d.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>d.buildStellarMigrateTx,buildStellarMultiplyTx:()=>d.buildStellarMultiplyTx,buildStellarPauseTx:()=>d.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>d.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>d.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>d.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>d.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>d.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>d.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeCreateHubTx:()=>d.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>d.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>d.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>d.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>d.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>d.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>d.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>d.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>d.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>d.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>d.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>d.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>d.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>d.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>d.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>d.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>d.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>d.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>d.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>d.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>d.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>d.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>d.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>d.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>d.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>d.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>d.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>d.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>d.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>d.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>d.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>d.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>d.buildStellarRevokeRoleTx,buildStellarSetAccumulatorTx:()=>d.buildStellarSetAccumulatorTx,buildStellarSetOracleSanityBoundsTx:()=>d.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>d.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>d.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>d.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>d.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>d.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>d.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>d.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>d.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>d.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>d.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>d.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>d.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>d.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>d.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>d.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>d.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>d.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>d.buildStellarWithdrawTx,buildTx:()=>d.buildTx,burnShares:()=>d.burnShares,computeAccountRisk:()=>d.computeAccountRisk,createStellarLendingReadClient:()=>d.createStellarLendingReadClient,decodeStellarLendingEvent:()=>d.decodeStellarLendingEvent,decodeStellarLiquidateReturn:()=>d.decodeStellarLiquidateReturn,decodeStellarLiquidationEstimate:()=>d.decodeStellarLiquidationEstimate,decodeStellarRouteBytes:()=>d.decodeStellarRouteBytes,decodeStellarSwapEnvelope:()=>d.decodeStellarSwapEnvelope,depositRateRay:()=>d.depositRateRay,divByIntHalfUp:()=>d.divByIntHalfUp,encodeAssetOracle:()=>d.encodeAssetOracle,encodeInterestRateModel:()=>d.encodeInterestRateModel,encodeMarketParamsRaw:()=>d.encodeMarketParamsRaw,encodePositionLimits:()=>d.encodePositionLimits,encodePriceKey:()=>d.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>d.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>d.extractEventOrder,getStellarAccountPositions:()=>d.getStellarAccountPositions,getStellarActiveUsersSeries:()=>d.getStellarActiveUsersSeries,getStellarAggregatorQuote:()=>d.getStellarAggregatorQuote,getStellarAsset:()=>d.getStellarAsset,getStellarAssetGraph:()=>d.getStellarAssetGraph,getStellarAssetMarkets:()=>d.getStellarAssetMarkets,getStellarAssetPage:()=>d.getStellarAssetPage,getStellarAssets:()=>d.getStellarAssets,getStellarCampaignLeaderboard:()=>d.getStellarCampaignLeaderboard,getStellarCampaignMe:()=>d.getStellarCampaignMe,getStellarDefiLlamaDimensions:()=>d.getStellarDefiLlamaDimensions,getStellarDeployment:()=>d.getStellarDeployment,getStellarDetailedMarkets:()=>d.getStellarDetailedMarkets,getStellarFeeRevenueSeries:()=>d.getStellarFeeRevenueSeries,getStellarGovernanceProposals:()=>d.getStellarGovernanceProposals,getStellarHolderDistribution:()=>d.getStellarHolderDistribution,getStellarHub:()=>d.getStellarHub,getStellarHubGraph:()=>d.getStellarHubGraph,getStellarHubHolders:()=>d.getStellarHubHolders,getStellarHubs:()=>d.getStellarHubs,getStellarLendingContext:()=>d.getStellarLendingContext,getStellarLendingLiveState:()=>d.getStellarLendingLiveState,getStellarLiquidationsLeaderboard:()=>d.getStellarLiquidationsLeaderboard,getStellarLiquidationsSeries:()=>d.getStellarLiquidationsSeries,getStellarParticipantCounts:()=>d.getStellarParticipantCounts,getStellarPnlByScope:()=>d.getStellarPnlByScope,getStellarPositionsLeaderboard:()=>d.getStellarPositionsLeaderboard,getStellarPositionsPnl:()=>d.getStellarPositionsPnl,getStellarQuoteTokens:()=>d.getStellarQuoteTokens,getStellarRateSpreadSeries:()=>d.getStellarRateSpreadSeries,getStellarReserve:()=>d.getStellarReserve,getStellarReserveGraph:()=>d.getStellarReserveGraph,getStellarReserveHolders:()=>d.getStellarReserveHolders,getStellarReserves:()=>d.getStellarReserves,getStellarRevenueSeries:()=>d.getStellarRevenueSeries,getStellarSpoke:()=>d.getStellarSpoke,getStellarSpokeGraph:()=>d.getStellarSpokeGraph,getStellarSpokeHolders:()=>d.getStellarSpokeHolders,getStellarSpokes:()=>d.getStellarSpokes,getStellarStatsHistory:()=>d.getStellarStatsHistory,getStellarUserActivity:()=>d.getStellarUserActivity,getStellarUserActivityPage:()=>d.getStellarUserActivityPage,getStellarUserHistory:()=>d.getStellarUserHistory,getStellarUserPositions:()=>d.getStellarUserPositions,getStellarVolumeSeries:()=>d.getStellarVolumeSeries,getStellarWalletBalance:()=>d.getStellarWalletBalance,getStellarWalletTokens:()=>d.getStellarWalletTokens,isValidCollectionTicker:()=>t,isValidNftIdentifier:()=>n,lendingAssetsSchema:()=>d.lendingAssetsSchema,lendingPositionsSchema:()=>d.lendingPositionsSchema,liveIndexKey:()=>d.liveIndexKey,mapQuoteResponseToStrategyPayload:()=>d.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>d.mapQuoteResponseToStrategySwap,mapSorobanError:()=>d.mapSorobanError,mapStellarPositionActivityType:()=>d.mapStellarPositionActivityType,maxBorrow:()=>d.maxBorrow,maxRepay:()=>d.maxRepay,maxSupply:()=>d.maxSupply,maxWithdraw:()=>d.maxWithdraw,mintShares:()=>d.mintShares,mulDivCeil:()=>d.mulDivCeil,mulDivFloor:()=>d.mulDivFloor,mulDivHalfUp:()=>d.mulDivHalfUp,numberToScaled:()=>d.numberToScaled,numberToWad:()=>d.numberToWad,parseStellarTokenAmount:()=>d.parseStellarTokenAmount,positionValueWad:()=>d.positionValueWad,prepareStellarBuiltTx:()=>d.prepareStellarBuiltTx,prepareStellarTxXdr:()=>d.prepareStellarTxXdr,projectAccountRisk:()=>d.projectAccountRisk,projectReserveApy:()=>d.projectReserveApy,rayAprToApy:()=>d.rayAprToApy,rayAprToNumber:()=>d.rayAprToNumber,rayToNumber:()=>d.rayToNumber,rescaleCeil:()=>d.rescaleCeil,rescaleFloor:()=>d.rescaleFloor,rescaleHalfUp:()=>d.rescaleHalfUp,reserveKey:()=>d.reserveKey,resolveReserve:()=>d.resolveReserve,stellarAuthPolicyForInvocation:()=>d.stellarAuthPolicyForInvocation,stellarLendingDispatchKey:()=>d.stellarLendingDispatchKey,stellarLendingRead:()=>d.stellarLendingRead,stellarNetworks:()=>d.stellarNetworks,stellarTokenContractId:()=>d.stellarTokenContractId,syntheticEventOrder:()=>d.syntheticEventOrder,tagStellarInvokedContractError:()=>d.tagStellarInvokedContractError,toBase64Xdr:()=>d.toBase64Xdr,toBigInt:()=>d.toBigInt,toStellarPositionMode:()=>d.toStellarPositionMode,unscale:()=>d.unscale,unscaleBorrowCeil:()=>d.unscaleBorrowCeil,unscaleHalfUp:()=>d.unscaleHalfUp,unscaleSupplyFloor:()=>d.unscaleSupplyFloor,utilizationRay:()=>d.utilizationRay,valueBasePosition:()=>d.valueBasePosition,valueScaledPosition:()=>d.valueScaledPosition,verifyStellarRouteBytes:()=>d.verifyStellarRouteBytes,wadToNumber:()=>d.wadToNumber});var e=r(928);const t=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e),o=/^C[A-Z2-7]{55}$/.test(e);return t||r||o},n=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e),o=/^C[A-Z2-7]{55}-\d+$/.test(e);return t||r||o};class i extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class a extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const s=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^[GC][A-Z2-7]{55}$/.test(e)),u={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/integrations/liquid-staking/multiversx/revenue":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/multiversx":{input:{},output:{}},"/integrations/lending/multiversx/revenue":{input:{},output:{}},"/integrations/lending/multiversx/liquidations":{input:{},output:{}},"/integrations/lending/multiversx/active-users":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/campaign/leaderboard":{input:{},output:{}},"/stellar-lending/campaign/me":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/stellar-lending/users/:owner/assets/:asset/balance":{input:{},output:{}},"/stellar-lending/users/:owner/activity/page":{input:{},output:{}}},l=["PATCH","POST","DELETE","PUT"];var d=r(999);const p=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),c=()=>({static:{},params:{},leaves:[]});function f(e,r,o,n){const{input:u,output:d,...p}=r,c=async(r={})=>{const u={...o,...r},l=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${u[t]}`)),d=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),p=Object.fromEntries(Object.entries(u).filter((([e])=>!d.includes(e)))),c=/:address[^A-Z]/.test(e)||"address"in p,f=/:collection[^A-Z]/.test(e)||"collection"in p;if(c){const e=u.address;if(!s(e))throw new a(e)}if(f){const e=u.collection;if(Array.isArray(e)?e.some((e=>!t(e))):!t(e))throw new i(e)}const h=Object.fromEntries(Object.entries(p).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:g,auth:m,method:y,headers:b,cache:S,next:w,debug:v,signal:T,credentials:A,mode:x,redirect:I,referrer:R,referrerPolicy:E,integrity:P,keepalive:k,priority:_,window:q,continuationToken:B,...O}=h,C=m?`Bearer ${m}`:void 0;e.startsWith("/stellar-lending/")&&void 0!==B&&(O.continuationToken=B);const M={...b,...C?{Authorization:C}:{},...B&&!e.startsWith("/stellar-lending/")?{"X-Continuation-Token":String(B)}:{}},U={...w,tags:[...w?.tags??[],l]};return n.fetchWithTimeout(l,{method:y,params:O,body:g,headers:M,cache:S,debug:v,...Object.fromEntries(Object.entries({signal:T,credentials:A,mode:x,redirect:I,referrer:R,referrerPolicy:E,integrity:P,keepalive:k,priority:_,window:q}).filter((([,e])=>void 0!==e))),...U?{next:U}:{}})},f=(e={})=>c(e);for(const e of Object.keys(p))l.includes(e)&&(f[e]=t=>c({...t,method:t.method??e.toUpperCase()}));return f}function h(e){const t=function(){const e=c();for(const[t,r]of Object.entries(u)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=p(e.slice(1));n=n.params[t]||=c()}else{const t=p(e);n=n.static[t]||=c()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,i=Object.keys(t.static).length,a=Object.keys(t.params).length;let s;if(1===n&&i+a>0){const{rawPath:r,def:n}=t.leaves[0];s=f(r,n,o,e)}else{s={};for(const{rawPath:r,def:n}of t.leaves)s[p(r.split("/").pop().replace(/^:/,""))]=f(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let i=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),i=r)}void 0===s[e]?s[e]=i:"function"==typeof s[e]?Object.assign(s[e],i):"function"==typeof i?(Object.assign(i,s[e]),s[e]=i):Object.assign(s[e],i)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const i=r(n,{...o,[e]:t});if(i&&"object"==typeof i&&1===Object.keys(i).length&&e in i&&"function"==typeof i[e]){const t=i[e],r=(...e)=>t(...e);return Object.assign(r,t)}return i};if(s[e]){const r=s[e];s[e]=e=>({...r(e),...t(e)})}else s[e]=t}return s};return r(t,{})}})(),module.exports=o})();